Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

v1 state

Back to all declarations

glyph

func(c uint8) string

glyph returns the stroke encoding for one character, or "" for anything unknown — an unknown character draws nothing rather than a box, because this markup lands inside a token that other people's software renders and a missing letter is better than a wrong one.

Open
OID
0cbe92…66c1:3
glyph details

Inspect func

glyphW

untyped bigint

// grid width of one glyph

Value

(10 <untyped> bigint)

glyphH

untyped bigint

// grid height, top to bottom

Value

(14 <untyped> bigint)

glyphAd

untyped bigint

// advance: glyph width plus the gap to the next one

Value

(12 <untyped> bigint)

hexish

func(c uint8) int

hexish decodes one coordinate character. Digits are themselves; a..d carry 10..13, which is the only reason y can exceed nine in two characters.

Open
OID
0cbe92…66c1:5
hexish details

Inspect func

MarkerText

func(s string, x int, y int, size int, colour string, weight int) string

MarkerText draws a line of text as stroked paths. \`size\` is the CAP HEIGHT in user units, not an em size: it is the height of a capital letter, which is the measurement anybody positioning this by eye is actually thinking in. \`x\` is the left edge and \`y\` is the TOP of the capitals, matching how the rest of this file positions things and unlike SVG's own text baseline, which is a trap when mixing the two. The jitter is what makes it read as a pen rather than a plotter. It is derived from the character and its position, so it is stable: the same string renders identically on every read, which matters because these cards are regenerated constantly and a letter that wobbled between reads would look like a rendering fault.

Open
OID
0cbe92…66c1:6
MarkerText details

Inspect func

strokes

func(enc string, ox int, oy int, size int, idx int) string

strokes turns one glyph's encoding into path elements at a position.

Open
OID
0cbe92…66c1:7
strokes details

Inspect func

wobble

func(seed int) int

wobble is a tiny deterministic offset in the range -1..1. Not random: the cards are regenerated on every read, and anything genuinely random would make the lettering shimmer.

Open
OID
0cbe92…66c1:8
wobble details

Inspect func

MarkerWidth

func(s string, size int) int

MarkerWidth is what MarkerText will occupy, so a caller can centre it. Counts every character including the ones that draw nothing, because a space still advances.

Open
OID
0cbe92…66c1:9
MarkerWidth details

Inspect func

MarkerCentred

func(s string, cx int, y int, size int, colour string, weight int) string

MarkerCentred draws text centred on cx, which is what almost every caller here wants and what the SVG text-anchor attribute would have done for them if a font had been available.

Open
OID
0cbe92…66c1:10
MarkerCentred details

Inspect func

keyFX

untyped string

Seasonal decoration, driven by DATA rather than by code. The card is generated on every read, so anything it draws can change after names have been sold. That makes a holiday overlay possible — snow in December, falling leaves in October — across every token at once. The temptation is to write a drawSnow() into this realm and a drawPumpkins() next year, which would make every new decoration a redeploy of the view. So it is parameterised instead. This realm knows how to draw drifting particles; WHICH particles, what colour, how many and until when live in a global that any admin call can rewrite. Christmas is then one transaction, not a deployment, and so is turning it off. Format, read from the global key \`cardfx\`: dir:fall;n:22;c:#ffffff;c2:#dbeafe;s:3;d:9;until:1767225600 dir fall | rise | burst drift down, drift up, or fireworks n 1..40 how many c #rrggbb colour (c2, c3 optional, cycled) s 1..6 pixel size d 2..30 seconds for one traverse (lower = faster) sv 0..3 size jitter, so they are not all identical k 4..16 sparks per shell, when dir is burst sh sq | leaf | petal particle shape; leaf and petal are angled until unix seconds, 0 = no expiry \`until\` matters more than it looks: an overlay that expires on its own cannot be forgotten in January. Everything is parsed defensively and a malformed value yields NO overlay, for the same reason the sprite parser does — this markup lands inside a token that other people's software renders.

Value

"cardfx"

overlaySVG

func(now int64) string
Open
OID
0cbe92…66c1:11
overlaySVG details

Inspect func

pickRule

func(spec string, now int64) string

A SCHEDULE, so December snows without anybody remembering to make it. This is free in a way the treasury swap was not. That needed somebody to send a transaction, because a realm cannot act on its own. This needs nobody, because the card is generated on every read and can simply look at the clock — the decoration is a rendering decision, not an action. Rules are separated by "|" and the FIRST one whose window contains today wins, so put the specific ones first: from:12-01;to:01-06;dir:fall;n:26;c:#ffffff|from:10-24;to:11-02;dir:rise;n:22;c:#f97316 from/to are MM-DD and RECUR every year, which is the point — set it once and every December snows. A window whose start is after its end wraps the new year, so 12-01 to 01-06 is what you would expect rather than an empty range. A rule with no window is always eligible, so a bare spec still behaves as it did.

Open
OID
0cbe92…66c1:13
pickRule details

Inspect func

ruleField

func(rule string, key string) string
Open
OID
0cbe92…66c1:14
ruleField details

Inspect func

mmdd

func(s string) (int, bool)

mmdd reads "12-01" into 1201. Rejects anything that is not a real calendar date, so a typo cannot silently make a rule match all year.

Open
OID
0cbe92…66c1:15
mmdd details

Inspect func

buildOverlay

func(spec string, now int64) string
Open
OID
0cbe92…66c1:16
buildOverlay details

Inspect func

hash

func(i int) int

A small deterministic spread. Not random: the same index must always give the same particle, or a cached render and a fresh one disagree.

Open
OID
0cbe92…66c1:17
hash details

Inspect func

atoiClamp

func(s string, lo int, hi int) int
Open
OID
0cbe92…66c1:18
atoiClamp details

Inspect func

fireworks

func(shells int, sparks int, size int, dur int, cols []string) string

Fireworks: a shell climbs, vanishes, and throws sparks outward. The cost question is worth answering plainly, because it is the first decoration that is not one rect per particle. A shell is 1 rect for the climb plus k rects for the burst, so \`n:5;k:10\` is 55 rects — the same order as the 34 the rain already draws, and a fifth of the 128 the domain sprite draws on every card anyway. None of it is stored: the card is built during a read, so this costs no gas and no storage, only the browser's time. That is the real ceiling, so the totals are capped below rather than left to whoever writes the spec. Two phases in one loop, driven by keyTimes on a single animation each, because a \<set> chain or nested \<g> would double the element count for the same picture.

Open
OID
0cbe92…66c1:19
fireworks details

Inspect func

dirCos

[16]int

Sixteen directions on a circle, as hundredths. A table rather than math.Sin: the same integers must come out on every node, and this is the whole of the trigonometry the card needs.

Open
OID
0cbe92…66c1:21
dirCos details

Inspect array

dirSin

[16]int

Sixteen directions on a circle, as hundredths. A table rather than math.Sin: the same integers must come out on every node, and this is the whole of the trigonometry the card needs.

Open
OID
0cbe92…66c1:23
dirSin details

Inspect array

shapeAt

func(kind string, x int, y int, px int, ang int, col string) string

shapeAt draws one non-square particle at a position, turned to its own angle. Leaves and petals are two curves each rather than a polygon: a leaf is pointed at both ends, a petal is round at one, and that single difference is the whole of what distinguishes October from April. The numbers are derived from the particle size so \`s\` still means what it means everywhere else, and both shapes stay legible at the size a card is actually looked at.

Open
OID
0cbe92…66c1:24
shapeAt details

Inspect func

weekdayMatch

func(spec string, t time.Time) bool

weekdayMatch reads "fri" or "fri-13": a weekday, optionally pinned to a day of the month. Anything it does not understand matches nothing, so a typo disables its own rule rather than firing every day.

Open
OID
0cbe92…66c1:25
weekdayMatch details

Inspect func

keyDisplayName

untyped string

Profile keys inside a name's extension slot. Conventions owned by this realm and the logic realm, not by the vault — the vault stores strings and has no opinion about what they mean.

Value

"displayName"

keyBio

untyped string

Profile keys inside a name's extension slot. Conventions owned by this realm and the logic realm, not by the vault — the vault stores strings and has no opinion about what they mean.

Value

"bio"

keyWebsite

untyped string

Profile keys inside a name's extension slot. Conventions owned by this realm and the logic realm, not by the vault — the vault stores strings and has no opinion about what they mean.

Value

"website"

renderDomain

func(domainLabel string) string
Open
OID
0cbe92…66c1:29
renderDomain details

Inspect func

renderName

func(label string, domainLabel string) string
Open
OID
0cbe92…66c1:30
renderName details

Inspect func

splitCSV

func(s string) []string
Open
OID
0cbe92…66c1:31
splitCSV details

Inspect func

splitTokenID

func(tid string) (label string, domain string)

splitTokenID splits \`label\*domain\`; a leading "\*" yields an empty label, which is how a domain page is addressed.

Open
OID
0cbe92…66c1:32
splitTokenID details

Inspect func

escapeMarkdown

func(s string) string

escapeMarkdown neutralises user-authored text so it renders as the literal characters typed rather than as markup. Backslash-escapes the CommonMark ASCII punctuation set and folds newlines, which stops headings, lists, tables, images, links, and raw HTML alike.

Open
OID
0cbe92…66c1:33
escapeMarkdown details

Inspect func

isSafeURL

func(u string) bool

isSafeURL only admits plain http/https. Everything else — javascript:, data:, anything unrecognised — is refused a live link. Checked on read rather than on write so tightening the rule later also applies to profiles that already exist.

Open
OID
0cbe92…66c1:34
isSafeURL details

Inspect func

skinFor

func(now int64) string

skinFor returns the skin named by whichever calendar rule is active today, or "" for the ordinary card. Reusing pickRule means a skin obeys the same window rules, the same first-match-wins ordering and the same year wrapping as every other season.

Open
OID
0cbe92…66c1:35
skinFor details

Inspect func

skinFromSpec

func(spec string, now int64) string

Split out so the calendar logic can be tested against a spec directly, without standing up a vault to hold one.

Open
OID
0cbe92…66c1:37
skinFromSpec details

Inspect func

hasSkin

func(name string) bool

hasSkin reports whether a name is renderable as this skin. Unknown names render nothing rather than a broken card — the same defensive stance the overlay parser takes, and for the same reason: this markup lands inside a token that other people's software renders.

Open
OID
0cbe92…66c1:38
hasSkin details

Inspect func

seedOf

func(tid string) int

seedOf turns a token id into a small number, so that a card can differ from the one beside it without any randomness — which a deterministic machine does not have. Every node computes the same answer for the same name, which is the requirement; looking arbitrary is merely the effect.

Open
OID
0cbe92…66c1:39
seedOf details

Inspect func

skinSVG

func(name string, tid string, now int64) string

skinSVG renders a complete 400x400 card. Same frame as the ordinary one, so nothing downstream has to know which it received.

Open
OID
0cbe92…66c1:40
skinSVG details

Inspect func

skinPizza

func(label string, size int, seed int) string

\---------------- 22 May: the pizza ---------------- \* \* Eight wedges with a gap between them, so it reads as CUT rather than \* merely divided, and each wedge carries its own toppings inside its own \* group — that is what makes a slice leave with its pepperoni still on \* it instead of leaving them floating over the board. \* \* EVERY NAME EATS IN ITS OWN ORDER. The seed decides which slice goes \* first and how long each one waits, so a marketplace full of these is a \* room full of pizzas being eaten from different sides at different \* rates rather than one animation repeated. It is derived from the token \* id, so it is the same on every node and different for every name.

Open
OID
0cbe92…66c1:43
skinPizza details

Inspect func

wedge

func(cx int, cy int, r float64, a0 float64, a1 float64, fill string) string
Open
OID
0cbe92…66c1:44
wedge details

Inspect func

polar

func(cx int, cy int, r float64, deg float64) (int, int)

Degrees clockwise from twelve o'clock, which is how a pizza is cut. Integer maths throughout: a realm has no floating point worth trusting across nodes, and a pizza does not need sub-pixel accuracy.

Open
OID
0cbe92…66c1:45
polar details

Inspect func

sinApprox

func(x float64) float64
Open
OID
0cbe92…66c1:46
sinApprox details

Inspect func

cosApprox

func(x float64) float64
Open
OID
0cbe92…66c1:47
cosApprox details

Inspect func

skinPaper

func(label string, size int, now int64) string

\---------------- 3 Jan: the front page ----------------

Open
OID
0cbe92…66c1:48
skinPaper details

Inspect func

skinCal

func(label string, size int) string

\---------------- 29 Feb: the calendar page ----------------

Open
OID
0cbe92…66c1:49
skinCal details

Inspect func

skinFog

func(label string, size int) string

\---------------- 20 Apr: the fog ----------------

Open
OID
0cbe92…66c1:50
skinFog details

Inspect func

skinSlash

func(label string, size int) string

\---------------- Friday 13th: the poster ----------------

Open
OID
0cbe92…66c1:51
skinSlash details

Inspect func

skinPi

func(label string, size int) string

\---------------- 14 Mar: pi ----------------

Open
OID
0cbe92…66c1:52
skinPi details

Inspect func

skinHeart

func(label string, size int) string

\---------------- 14 Feb: the heart ---------------- \* \* A real double thump, not one pulse: squeeze, small recoil, second \* smaller squeeze, then a long rest. The rest is most of what makes it \* read as a heartbeat rather than a throb.

Open
OID
0cbe92…66c1:53
skinHeart details

Inspect func

esc

func(s string) string

Markup safety, same as everywhere else that puts a name into SVG: a label is validated on registration, but this is the last gate before it lands inside somebody else's renderer.

Open
OID
0cbe92…66c1:54
esc details

Inspect func

TokenURI

func(tid string) string

TokenURI returns the full data: URI for a token, generated on every read so the image always reflects current state (never baked at mint).

Open
OID
0cbe92…66c1:55
TokenURI details

Inspect func

BuildSVG

func(tid string) string

BuildSVG renders a token. Everything on the card derives from four stored values — owner, registered, expires, and the domain's drawing — so a renewal moves \`expires\` and the bar, the time remaining and the years held all follow from it. Nothing is baked at mint: the card is generated on every read, which is what lets a domain's artwork be changed after its names have been sold.

Open
OID
0cbe92…66c1:57
BuildSVG details

Inspect func

cardSVG

func(tid string, art string, registered int64, expires int64, streak int64, frozen bool, now int64, overlay string) string

cardSVG is the card itself, with every stored value already resolved. Split out from BuildSVG so the markup can be rendered — and asserted against — without a vault under it. TestStaticFrameShowsTheDate is the reason: what a marketplace shows as a still is a property of this string and of nothing else, and it deserves to be checked rather than assumed.

Open
OID
0cbe92…66c1:58
cardSVG details

Inspect func

fitSize

func(s string) int

fitSize solves for a size rather than stepping through a ladder. Monospace glyphs are ~0.6em, so a name up to the full 32-character limit sets on one line without overflowing 336px.

Open
OID
0cbe92…66c1:59
fitSize details

Inspect func

domainAccent

func(domainLabel string) string

domainAccent reads the accent out of the domain's stored drawing, so the card wears the domain's own colour without this realm carrying a palette of its own. Falls back to the house colour.

Open
OID
0cbe92…66c1:60
domainAccent details

Inspect func

accentOf

func(enc string) string
Open
OID
0cbe92…66c1:61
accentOf details

Inspect func

remaining

func(expires int64, now int64) string
Open
OID
0cbe92…66c1:62
remaining details

Inspect func

keyArt

untyped string

keyArt is the per-domain extension key holding the drawing. The value is "A#facc15,B#7c2d12|............|....AAAA....|..." — the palette, then twelve rows of twelve characters where '.' is transparent. PARSED DEFENSIVELY AND NEVER TRUSTED. It is written by whichever logic realm is current, so a future one could store something malformed; anything unexpected yields no sprite rather than broken markup inside a token that a marketplace will render.

Value

"art"

spriteSVG

func(enc string, px int, ox int, oy int, opacity string) string
Open
OID
0cbe92…66c1:63
spriteSVG details

Inspect func

isHexColour

func(s string) bool
Open
OID
0cbe92…66c1:64
isHexColour details

Inspect func

placeholderSVG

func(msg string) string
Open
OID
0cbe92…66c1:65
placeholderSVG details

Inspect func

daySeconds

int64

statusFields formats a lifecycle state for display. Reads the grace period from nsdata rather than hardcoding it, so retuning the lifecycle is a config change and this stays correct. All lifecycle times are unix seconds, so this is integer arithmetic over a day constant rather than duration division.

Value

86400

statusFields

func(expires int64, frozen bool) (status string, edge string)
Open
OID
0cbe92…66c1:66
statusFields details

Inspect func

escapeXML

func(s string) string
Open
OID
0cbe92…66c1:67
escapeXML details

Inspect func
glyph : func(c uint8) string Inspect
glyphW : untyped bigint =(10 <untyped> bigint)
glyphH : untyped bigint =(14 <untyped> bigint)
glyphAd : untyped bigint =(12 <untyped> bigint)
hexish : func(c uint8) int Inspect
MarkerText : func(s string, x int, y int, size int, colour string, weight int) string Inspect
strokes : func(enc string, ox int, oy int, size int, idx int) string Inspect
wobble : func(seed int) int Inspect
MarkerWidth : func(s string, size int) int Inspect
MarkerCentred : func(s string, cx int, y int, size int, colour string, weight int) string Inspect
keyFX : untyped string ="cardfx"
overlaySVG : func(now int64) string Inspect
pickRule : func(spec string, now int64) string Inspect
ruleField : func(rule string, key string) string Inspect
mmdd : func(s string) (int, bool) Inspect
buildOverlay : func(spec string, now int64) string Inspect
hash : func(i int) int Inspect
atoiClamp : func(s string, lo int, hi int) int Inspect
fireworks : func(shells int, sparks int, size int, dur int, cols []string) string Inspect
dirCos : [16]int Inspect
dirSin : [16]int Inspect
shapeAt : func(kind string, x int, y int, px int, ang int, col string) string Inspect
weekdayMatch : func(spec string, t time.Time) bool Inspect
keyDisplayName : untyped string ="displayName"
keyBio : untyped string ="bio"
keyWebsite : untyped string ="website"
Render : func(path string) string Inspect
renderHome : func() string Inspect
renderDomain : func(domainLabel string) string Inspect
renderName : func(label string, domainLabel string) string Inspect
splitCSV : func(s string) []string Inspect
splitTokenID : func(tid string) (label string, domain string) Inspect
escapeMarkdown : func(s string) string Inspect
isSafeURL : func(u string) bool Inspect
skinFor : func(now int64) string Inspect
skinFromSpec : func(spec string, now int64) string Inspect
hasSkin : func(name string) bool Inspect
seedOf : func(tid string) int Inspect
skinSVG : func(name string, tid string, now int64) string Inspect
head : func(bg string) string Inspect
foot : func() string Inspect
skinPizza : func(label string, size int, seed int) string Inspect
wedge : func(cx int, cy int, r float64, a0 float64, a1 float64, fill string) string Inspect
polar : func(cx int, cy int, r float64, deg float64) (int, int) Inspect
sinApprox : func(x float64) float64 Inspect
cosApprox : func(x float64) float64 Inspect
skinPaper : func(label string, size int, now int64) string Inspect
skinCal : func(label string, size int) string Inspect
skinFog : func(label string, size int) string Inspect
skinSlash : func(label string, size int) string Inspect
skinPi : func(label string, size int) string Inspect
skinHeart : func(label string, size int) string Inspect
esc : func(s string) string Inspect
TokenURI : func(tid string) string Inspect
BuildSVG : func(tid string) string Inspect
cardSVG : func(tid string, art string, registered int64, expires int64, streak int64, frozen bool, now int64, overlay string) string Inspect
fitSize : func(s string) int Inspect
domainAccent : func(domainLabel string) string Inspect
accentOf : func(enc string) string Inspect
remaining : func(expires int64, now int64) string Inspect
keyArt : untyped string ="art"
spriteSVG : func(enc string, px int, ox int, oy int, opacity string) string Inspect
isHexColour : func(s string) bool Inspect
placeholderSVG : func(msg string) string Inspect
daySeconds : int64 =86400
statusFields : func(expires int64, frozen bool) (status string, edge string) Inspect
escapeXML : func(s string) string Inspect