Liking cljdoc? Tell your friends :D

hyper.component.hiccup

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.
raw docstring

compile-hiccupclj

(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.
sourceraw docstring

parse-tagclj

(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).
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close