Files
rose-ash/shared/static/wasm/sx/dom.sxbc
giles e0070041d6 Add .sxbc s-expression bytecode format
Bytecode modules are now serialized as s-expressions (.sxbc) in addition
to JSON (.sxbc.json). The .sxbc format is the canonical representation —
content-addressable, parseable by the SX parser, and suitable for CID
referencing. Annotation layers (source maps, variable names, tests, docs)
can reference the bytecode CID without polluting the bytecode itself.

Format: (sxbc version hash (code :arity N :bytecode (...) :constants (...)))

The browser loader tries .sxbc first (via load-sxbc kernel primitive),
falls back to .sxbc.json. Caddy needs .sxbc MIME type to serve the new
format (currently 404s, JSON fallback works).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 14:16:22 +00:00

533 lines
18 KiB
Plaintext

(sxbc 1 "229a5c9f55b2ac03"
(code
:bytecode (51 1 0 128 0 0 5 51 3 0 128 2 0 5 51 5 0 128 4 0 5 51 7 0 128 6 0 5 51 9 0 128 8 0 5 51 11 0 128 10 0 5 51 13 0 128 12 0 5 51 15 0 128 14 0 5 51 17 0 128 16 0 5 51 19 0 128 18 0 5 51 21 0 128 20 0 5 51 23 0 128 22 0 5 51 25 0 128 24 0 5 51 27 0 128 26 0 5 51 29 0 128 28 0 5 51 31 0 128 30 0 5 51 33 0 128 32 0 5 51 35 0 128 34 0 5 51 37 0 128 36 0 5 51 39 0 128 38 0 5 51 41 0 128 40 0 5 51 43 0 128 42 0 5 51 45 0 128 44 0 5 51 47 0 128 46 0 5 51 49 0 128 48 0 5 51 51 0 128 50 0 5 51 53 0 128 52 0 5 51 55 0 128 54 0 5 51 57 0 128 56 0 5 51 59 0 128 58 0 5 51 61 0 128 60 0 5 51 63 0 128 62 0 5 51 65 0 128 64 0 5 51 67 0 128 66 0 5 51 69 0 128 68 0 5 51 71 0 128 70 0 5 51 73 0 128 72 0 5 51 75 0 128 74 0 5 51 77 0 128 76 0 5 51 79 0 128 78 0 5 51 81 0 128 80 0 5 51 83 0 128 82 0 5 51 85 0 128 84 0 5 51 87 0 128 86 0 5 51 89 0 128 88 0 5 51 91 0 128 90 0 5 51 93 0 128 92 0 5 51 95 0 128 94 0 5 51 97 0 128 96 0 5 51 99 0 128 98 0 5 51 101 0 128 100 0 5 51 99 0 128 102 0 5 51 104 0 128 103 0 5 51 106 0 128 105 0 5 51 108 0 128 107 0 5 51 110 0 128 109 0 5 51 112 0 128 111 0 5 51 114 0 128 113 0 5 51 116 0 128 115 0 5 51 118 0 128 117 0 5 51 120 0 128 119 0 5 51 122 0 128 121 0 5 51 124 0 128 123 0 5 51 126 0 128 125 0 5 51 128 0 128 127 0 5 51 130 0 128 129 0 5 51 132 0 128 131 0 5 51 134 0 128 133 0 50)
:constants (
"dom-document"
(code
:bytecode (20 0 0 1 1 0 49 1 50)
:constants (
"host-global"
"document"))
"dom-window"
(code
:bytecode (20 0 0 1 1 0 49 1 50)
:constants (
"host-global"
"window"))
"dom-body"
(code
:bytecode (20 0 0 20 1 0 48 0 1 2 0 49 2 50)
:constants (
"host-get"
"dom-document"
"body"))
"dom-head"
(code
:bytecode (20 0 0 20 1 0 48 0 1 2 0 49 2 50)
:constants (
"host-get"
"dom-document"
"head"))
"dom-create-element"
(code :arity 2
:bytecode (16 1 33 20 0 20 0 0 20 1 0 48 0 1 2 0 16 1 16 0 49 4 32 15 0 20 0 0 20 1 0 48 0 1 3 0 16 0 49 3 50)
:constants (
"host-call"
"dom-document"
"createElementNS"
"createElement"))
"create-text-node"
(code :arity 1
:bytecode (20 0 0 20 1 0 48 0 1 2 0 16 0 49 3 50)
:constants (
"host-call"
"dom-document"
"createTextNode"))
"create-fragment"
(code
:bytecode (20 0 0 20 1 0 48 0 1 2 0 49 2 50)
:constants (
"host-call"
"dom-document"
"createDocumentFragment"))
"create-comment"
(code :arity 1
:bytecode (20 0 0 20 1 0 48 0 1 2 0 16 0 6 34 4 0 5 1 3 0 49 3 50)
:constants (
"host-call"
"dom-document"
"createComment"
""))
"dom-append"
(code :arity 2
:bytecode (16 0 6 33 3 0 5 16 1 33 15 0 20 0 0 16 0 1 1 0 16 1 49 3 32 1 0 2 50)
:constants (
"host-call"
"appendChild"))
"dom-prepend"
(code :arity 2
:bytecode (16 0 6 33 3 0 5 16 1 33 15 0 20 0 0 16 0 1 1 0 16 1 49 3 32 1 0 2 50)
:constants (
"host-call"
"prepend"))
"dom-insert-before"
(code :arity 3
:bytecode (16 0 6 33 3 0 5 16 1 33 17 0 20 0 0 16 0 1 1 0 16 1 16 2 49 4 32 1 0 2 50)
:constants (
"host-call"
"insertBefore"))
"dom-insert-after"
(code :arity 2
:bytecode (1 0 0 5 20 1 0 16 0 1 2 0 48 2 17 2 20 1 0 16 0 1 3 0 48 2 17 3 16 2 33 37 0 16 3 33 17 0 20 4 0 16 2 1 5 0 16 1 16 3 49 4 32 12 0 20 4 0 16 2 1 6 0 16 1 49 3 32 1 0 2 50)
:constants (
"Insert node after ref in the same parent."
"host-get"
"parentNode"
"nextSibling"
"host-call"
"insertBefore"
"appendChild"))
"dom-remove"
(code :arity 1
:bytecode (16 0 33 13 0 20 0 0 16 0 1 1 0 49 2 32 1 0 2 50)
:constants (
"host-call"
"remove"))
"dom-is-active-element?"
(code :arity 1
:bytecode (20 0 0 20 1 0 48 0 1 2 0 48 2 17 1 16 1 6 33 3 0 5 16 0 33 11 0 16 0 16 1 52 3 0 2 32 1 0 4 50)
:constants (
"host-get"
"dom-document"
"activeElement"
"identical?"))
"dom-is-input-element?"
(code :arity 1
:bytecode (20 1 0 16 0 48 1 6 34 4 0 5 1 2 0 52 0 0 1 17 1 16 1 1 4 0 52 3 0 2 6 34 24 0 5 16 1 1 5 0 52 3 0 2 6 34 10 0 5 16 1 1 6 0 52 3 0 2 50)
:constants (
"upper"
"dom-tag-name"
""
"="
"INPUT"
"TEXTAREA"
"SELECT"))
"dom-is-child-of?"
(code :arity 2
:bytecode (16 0 6 33 20 0 5 16 1 6 33 13 0 5 20 0 0 16 1 1 1 0 16 0 49 3 50)
:constants (
"host-call"
"contains"))
"dom-attr-list"
(code :arity 1
:bytecode (20 0 0 16 0 1 1 0 48 2 17 1 52 2 0 0 17 2 16 1 33 38 0 20 0 0 16 1 1 3 0 48 2 17 3 2 17 4 51 4 0 1 3 1 1 1 2 1 4 17 4 16 4 1 5 0 48 1 32 1 0 2 5 16 2 50)
:constants (
"host-get"
"attributes"
"list"
"length"
(code :arity 1 :upvalue-count 4
:bytecode (16 0 18 0 52 0 0 2 33 62 0 20 1 0 18 1 1 2 0 16 0 48 3 17 1 20 3 0 18 2 20 5 0 16 1 1 6 0 48 2 20 5 0 16 1 1 7 0 48 2 52 4 0 2 48 2 5 18 3 16 0 1 9 0 52 8 0 2 49 1 32 1 0 2 50)
:constants (
"<"
"host-call"
"item"
"append!"
"list"
"host-get"
"name"
"value"
"+"
1))
0))
"dom-remove-child"
(code :arity 2
:bytecode (16 0 6 33 3 0 5 16 1 33 15 0 20 0 0 16 0 1 1 0 16 1 49 3 32 1 0 2 50)
:constants (
"host-call"
"removeChild"))
"dom-replace-child"
(code :arity 3
:bytecode (16 0 6 33 10 0 5 16 1 6 33 3 0 5 16 2 33 17 0 20 0 0 16 0 1 1 0 16 1 16 2 49 4 32 1 0 2 50)
:constants (
"host-call"
"replaceChild"))
"dom-clone"
(code :arity 2
:bytecode (20 0 0 16 0 1 1 0 16 1 52 2 0 1 33 4 0 3 32 2 0 16 1 49 3 50)
:constants (
"host-call"
"cloneNode"
"nil?"))
"dom-query"
(code :arity 2
:bytecode (16 1 52 0 0 1 33 18 0 20 1 0 20 2 0 48 0 1 3 0 16 0 49 3 32 12 0 20 1 0 16 0 1 3 0 16 1 49 3 50)
:constants (
"nil?"
"host-call"
"dom-document"
"querySelector"))
"dom-query-all"
(code :arity 2
:bytecode (1 0 0 5 16 1 52 1 0 1 33 18 0 20 2 0 20 3 0 48 0 1 4 0 16 0 48 3 32 12 0 20 2 0 16 0 1 4 0 16 1 48 3 17 2 16 2 52 1 0 1 33 7 0 52 5 0 0 32 44 0 20 6 0 16 2 1 7 0 48 2 17 3 52 5 0 0 17 4 2 17 5 51 8 0 1 3 1 4 1 2 1 5 17 5 16 5 1 9 0 48 1 5 16 4 50)
:constants (
"Query DOM and return an SX list (not a host NodeList)."
"nil?"
"host-call"
"dom-document"
"querySelectorAll"
"list"
"host-get"
"length"
(code :arity 1 :upvalue-count 4
:bytecode (16 0 18 0 52 0 0 2 33 36 0 20 1 0 18 1 20 2 0 18 2 1 3 0 16 0 48 3 48 2 5 18 3 16 0 1 5 0 52 4 0 2 49 1 32 1 0 2 50)
:constants (
"<"
"append!"
"host-call"
"item"
"+"
1))
0))
"dom-query-by-id"
(code :arity 1
:bytecode (20 0 0 20 1 0 48 0 1 2 0 16 0 49 3 50)
:constants (
"host-call"
"dom-document"
"getElementById"))
"dom-closest"
(code :arity 2
:bytecode (16 0 33 15 0 20 0 0 16 0 1 1 0 16 1 49 3 32 1 0 2 50)
:constants (
"host-call"
"closest"))
"dom-matches?"
(code :arity 2
:bytecode (16 0 6 33 11 0 5 20 0 0 16 0 1 1 0 48 2 33 15 0 20 2 0 16 0 1 1 0 16 1 49 3 32 1 0 4 50)
:constants (
"host-get"
"matches"
"host-call"))
"dom-get-attr"
(code :arity 2
:bytecode (16 0 6 33 11 0 5 20 0 0 16 0 1 1 0 48 2 33 32 0 20 2 0 16 0 1 1 0 16 1 48 3 17 2 16 2 52 3 0 1 33 4 0 2 32 2 0 16 2 32 1 0 2 50)
:constants (
"host-get"
"getAttribute"
"host-call"
"nil?"))
"dom-set-attr"
(code :arity 3
:bytecode (16 0 6 33 11 0 5 20 0 0 16 0 1 1 0 48 2 33 17 0 20 2 0 16 0 1 1 0 16 1 16 2 49 4 32 1 0 2 50)
:constants (
"host-get"
"setAttribute"
"host-call"))
"dom-remove-attr"
(code :arity 2
:bytecode (16 0 6 33 11 0 5 20 0 0 16 0 1 1 0 48 2 33 15 0 20 2 0 16 0 1 1 0 16 1 49 3 32 1 0 2 50)
:constants (
"host-get"
"removeAttribute"
"host-call"))
"dom-has-attr?"
(code :arity 2
:bytecode (16 0 6 33 11 0 5 20 0 0 16 0 1 1 0 48 2 33 15 0 20 2 0 16 0 1 1 0 16 1 49 3 32 1 0 4 50)
:constants (
"host-get"
"hasAttribute"
"host-call"))
"dom-add-class"
(code :arity 2
:bytecode (16 0 33 23 0 20 0 0 20 1 0 16 0 1 2 0 48 2 1 3 0 16 1 49 3 32 1 0 2 50)
:constants (
"host-call"
"host-get"
"classList"
"add"))
"dom-remove-class"
(code :arity 2
:bytecode (16 0 33 23 0 20 0 0 20 1 0 16 0 1 2 0 48 2 1 3 0 16 1 49 3 32 1 0 2 50)
:constants (
"host-call"
"host-get"
"classList"
"remove"))
"dom-has-class?"
(code :arity 2
:bytecode (16 0 33 23 0 20 0 0 20 1 0 16 0 1 2 0 48 2 1 3 0 16 1 49 3 32 1 0 4 50)
:constants (
"host-call"
"host-get"
"classList"
"contains"))
"dom-text-content"
(code :arity 1
:bytecode (20 0 0 16 0 1 1 0 49 2 50)
:constants (
"host-get"
"textContent"))
"dom-set-text-content"
(code :arity 2
:bytecode (20 0 0 16 0 1 1 0 16 1 49 3 50)
:constants (
"host-set!"
"textContent"))
"dom-inner-html"
(code :arity 1
:bytecode (20 0 0 16 0 1 1 0 49 2 50)
:constants (
"host-get"
"innerHTML"))
"dom-set-inner-html"
(code :arity 2
:bytecode (20 0 0 16 0 1 1 0 16 1 49 3 50)
:constants (
"host-set!"
"innerHTML"))
"dom-outer-html"
(code :arity 1
:bytecode (20 0 0 16 0 1 1 0 49 2 50)
:constants (
"host-get"
"outerHTML"))
"dom-insert-adjacent-html"
(code :arity 3
:bytecode (20 0 0 16 0 1 1 0 16 1 16 2 49 4 50)
:constants (
"host-call"
"insertAdjacentHTML"))
"dom-get-style"
(code :arity 2
:bytecode (20 0 0 20 0 0 16 0 1 1 0 48 2 16 1 49 2 50)
:constants (
"host-get"
"style"))
"dom-set-style"
(code :arity 3
:bytecode (20 0 0 20 1 0 16 0 1 2 0 48 2 1 3 0 16 1 16 2 49 4 50)
:constants (
"host-call"
"host-get"
"style"
"setProperty"))
"dom-get-prop"
(code :arity 2
:bytecode (20 0 0 16 0 16 1 49 2 50)
:constants (
"host-get"))
"dom-set-prop"
(code :arity 3
:bytecode (20 0 0 16 0 16 1 16 2 49 3 50)
:constants (
"host-set!"))
"dom-tag-name"
(code :arity 1
:bytecode (16 0 33 25 0 20 1 0 16 0 1 2 0 48 2 6 34 4 0 5 1 3 0 52 0 0 1 32 3 0 1 3 0 50)
:constants (
"lower"
"host-get"
"tagName"
""))
"dom-node-type"
(code :arity 1
:bytecode (20 0 0 16 0 1 1 0 49 2 50)
:constants (
"host-get"
"nodeType"))
"dom-node-name"
(code :arity 1
:bytecode (20 0 0 16 0 1 1 0 49 2 50)
:constants (
"host-get"
"nodeName"))
"dom-id"
(code :arity 1
:bytecode (20 0 0 16 0 1 1 0 49 2 50)
:constants (
"host-get"
"id"))
"dom-parent"
(code :arity 1
:bytecode (20 0 0 16 0 1 1 0 49 2 50)
:constants (
"host-get"
"parentNode"))
"dom-first-child"
(code :arity 1
:bytecode (20 0 0 16 0 1 1 0 49 2 50)
:constants (
"host-get"
"firstChild"))
"dom-next-sibling"
(code :arity 1
:bytecode (20 0 0 16 0 1 1 0 49 2 50)
:constants (
"host-get"
"nextSibling"))
"dom-child-list"
(code :arity 1
:bytecode (1 0 0 5 16 0 33 59 0 20 1 0 16 0 1 2 0 48 2 17 1 20 1 0 16 1 1 3 0 48 2 17 2 52 4 0 0 17 3 2 17 4 51 5 0 1 2 1 3 1 1 1 4 17 4 16 4 1 6 0 48 1 5 16 3 32 4 0 52 4 0 0 50)
:constants (
"Return child nodes as an SX list."
"host-get"
"childNodes"
"length"
"list"
(code :arity 1 :upvalue-count 4
:bytecode (16 0 18 0 52 0 0 2 33 36 0 20 1 0 18 1 20 2 0 18 2 1 3 0 16 0 48 3 48 2 5 18 3 16 0 1 5 0 52 4 0 2 49 1 32 1 0 2 50)
:constants (
"<"
"append!"
"host-call"
"item"
"+"
1))
0))
"dom-is-fragment?"
(code :arity 1
:bytecode (20 1 0 16 0 1 2 0 48 2 1 3 0 52 0 0 2 50)
:constants (
"="
"host-get"
"nodeType"
11))
"dom-child-nodes"
"dom-remove-children-after"
(code :arity 1
:bytecode (1 0 0 5 20 1 0 16 0 48 1 17 1 16 1 33 21 0 2 17 2 51 2 0 1 0 1 1 1 2 17 2 16 2 49 0 32 1 0 2 50)
:constants (
"Remove all siblings after marker node."
"dom-parent"
(code :upvalue-count 3
:bytecode (20 0 0 18 0 48 1 17 0 16 0 33 20 0 20 1 0 18 1 1 2 0 16 0 48 3 5 18 2 49 0 32 1 0 2 50)
:constants (
"dom-next-sibling"
"host-call"
"removeChild"))))
"dom-focus"
(code :arity 1
:bytecode (16 0 33 13 0 20 0 0 16 0 1 1 0 49 2 32 1 0 2 50)
:constants (
"host-call"
"focus"))
"dom-parse-html"
(code :arity 1
:bytecode (20 0 0 1 1 0 48 1 17 1 20 2 0 16 1 1 3 0 16 0 1 4 0 48 4 17 2 20 5 0 20 5 0 16 2 1 6 0 48 2 1 7 0 49 2 50)
:constants (
"host-new"
"DOMParser"
"host-call"
"parseFromString"
"text/html"
"host-get"
"body"
"childNodes"))
"dom-listen"
(code :arity 3
:bytecode (20 0 0 16 2 48 1 17 3 20 1 0 16 0 1 2 0 16 1 16 3 48 4 5 51 3 0 1 0 1 1 1 3 50)
:constants (
"host-callback"
"host-call"
"addEventListener"
(code :upvalue-count 3
:bytecode (20 0 0 18 0 1 1 0 18 1 18 2 49 4 50)
:constants (
"host-call"
"removeEventListener"))))
"dom-add-listener"
(code :arity 4
:bytecode (20 0 0 16 2 48 1 17 4 16 3 33 19 0 20 1 0 16 0 1 2 0 16 1 16 4 16 3 48 5 32 14 0 20 1 0 16 0 1 2 0 16 1 16 4 48 4 5 51 3 0 1 0 1 1 1 4 50)
:constants (
"host-callback"
"host-call"
"addEventListener"
(code :upvalue-count 3
:bytecode (20 0 0 18 0 1 1 0 18 1 18 2 49 4 50)
:constants (
"host-call"
"removeEventListener"))))
"dom-dispatch"
(code :arity 3
:bytecode (20 0 0 1 1 0 16 1 1 3 0 16 2 1 4 0 3 52 2 0 4 48 3 17 3 20 5 0 16 0 1 6 0 16 3 49 3 50)
:constants (
"host-new"
"CustomEvent"
"dict"
"detail"
"bubbles"
"host-call"
"dispatchEvent"))
"event-detail"
(code :arity 1
:bytecode (20 0 0 16 0 1 1 0 49 2 50)
:constants (
"host-get"
"detail"))
"prevent-default"
(code :arity 1
:bytecode (16 0 33 13 0 20 0 0 16 0 1 1 0 49 2 32 1 0 2 50)
:constants (
"host-call"
"preventDefault"))
"stop-propagation"
(code :arity 1
:bytecode (16 0 33 13 0 20 0 0 16 0 1 1 0 49 2 32 1 0 2 50)
:constants (
"host-call"
"stopPropagation"))
"event-modifier-key?"
(code :arity 1
:bytecode (16 0 6 33 56 0 5 20 0 0 16 0 1 1 0 48 2 6 34 41 0 5 20 0 0 16 0 1 2 0 48 2 6 34 26 0 5 20 0 0 16 0 1 3 0 48 2 6 34 11 0 5 20 0 0 16 0 1 4 0 49 2 50)
:constants (
"host-get"
"ctrlKey"
"metaKey"
"shiftKey"
"altKey"))
"element-value"
(code :arity 1
:bytecode (16 0 6 33 19 0 5 20 2 0 16 0 1 3 0 48 2 52 1 0 1 52 0 0 1 33 13 0 20 2 0 16 0 1 3 0 49 2 32 1 0 2 50)
:constants (
"not"
"nil?"
"host-get"
"value"))
"error-message"
(code :arity 1
:bytecode (16 0 6 33 11 0 5 20 0 0 16 0 1 1 0 48 2 33 13 0 20 0 0 16 0 1 1 0 49 2 32 6 0 16 0 52 2 0 1 50)
:constants (
"host-get"
"message"
"str"))
"dom-get-data"
(code :arity 2
:bytecode (20 0 0 16 0 1 1 0 48 2 17 2 16 2 33 12 0 20 0 0 16 2 16 1 49 2 32 1 0 2 50)
:constants (
"host-get"
"__sx_data"))
"dom-set-data"
(code :arity 3
:bytecode (20 1 0 16 0 1 2 0 48 2 52 0 0 1 33 17 0 20 3 0 16 0 1 2 0 52 4 0 0 48 3 32 1 0 2 5 20 3 0 20 1 0 16 0 1 2 0 48 2 16 1 16 2 49 3 50)
:constants (
"not"
"host-get"
"__sx_data"
"host-set!"
"dict"))
"dom-append-to-head"
(code :arity 1
:bytecode (20 0 0 48 0 33 18 0 20 1 0 20 0 0 48 0 1 2 0 16 0 49 3 32 1 0 2 50)
:constants (
"dom-head"
"host-call"
"appendChild"))
"set-document-title"
(code :arity 1
:bytecode (20 0 0 20 1 0 48 0 1 2 0 16 0 49 3 50)
:constants (
"host-set!"
"dom-document"
"title")))))