Macro-time hiccup compilation for client components.
Literal hiccup in defc render segments is compiled into ($h ...) descriptor calls at macro-expansion time, so the client runtime needs no parsing heuristics for the common path: tag shorthand, attrs-map detection, and element-vs-fragment disambiguation are all resolved here, on the JVM, where they are unit-testable. Dynamically constructed hiccup (vectors built at runtime) falls back to the runtime array interpreter.
The runtime counterpart lives in resources/hyper/component-runtime.js:
$h consumes the descriptors emitted here, and $parseTag implements
the same tag-shorthand contract as parse-tag for the dynamic fallback
path. The two must stay in agreement — the kitchen-sink conformance
e2e test (hyper.component-e2e-test) pins the shared contract.
Macro-time hiccup compilation for client components. Literal hiccup in defc render segments is compiled into ($h ...) descriptor calls at macro-expansion time, so the client runtime needs no parsing heuristics for the common path: tag shorthand, attrs-map detection, and element-vs-fragment disambiguation are all resolved here, on the JVM, where they are unit-testable. Dynamically constructed hiccup (vectors built at runtime) falls back to the runtime array interpreter. The runtime counterpart lives in resources/hyper/component-runtime.js: `$h` consumes the descriptors emitted here, and `$parseTag` implements the same tag-shorthand contract as `parse-tag` for the dynamic fallback path. The two must stay in agreement — the kitchen-sink conformance e2e test (hyper.component-e2e-test) pins the shared contract.
(compile-hiccup form)Compile literal hiccup in a render form into ($h tag id classes attrs [children]) descriptor calls. See compile-element / compile-expr for the rules. Public for testing.
Compile literal hiccup in a render form into ($h tag id classes attrs [children]) descriptor calls. See compile-element / compile-expr for the rules. Public for testing.
(parse-tag tag-kw)Parse a hiccup tag keyword into [tag id classes]. :div -> ["div" nil nil] :div#m -> ["div" "m" nil] :div.a.b -> ["div" nil "a b"] :svg.chart#c -> ["svg" "c" "chart"] :.box -> ["div" nil "box"]
JS twin: $parseTag in component-runtime.js (runtime fallback path).
Parse a hiccup tag keyword into [tag id classes]. :div -> ["div" nil nil] :div#m -> ["div" "m" nil] :div.a.b -> ["div" nil "a b"] :svg.chart#c -> ["svg" "c" "chart"] :.box -> ["div" nil "box"] JS twin: `$parseTag` in component-runtime.js (runtime fallback path).
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |