Rendering an instance into a fragment.
Three small jobs:
:render against the merged instance map (with
render/*conv* bound so s/render-slot can resolve children).selector=#root, mode=inner (first render of a
frame) and Datastar's default morph-by-id (subsequent renders),
so input focus and scroll state survive across re-renders.Rendering an instance into a fragment. Three small jobs: * Invoke the user's `:render` against the merged instance map (with `render/*conv*` bound so `s/render-slot` can resolve children). * Decorate the outer hiccup with halo data-attrs when halos are active, and cache the resulting HTML on the instance for the dev panel's HTML tab. * Decide between `selector=#root, mode=inner` (first render of a frame) and Datastar's default morph-by-id (subsequent renders), so input focus and scroll state survive across re-renders.
(default-render self)Default renderer for components that don't supply one (e.g. tasks). An empty hidden div with the instance id keeps the morph-by-id wire contract intact.
Default renderer for components that don't supply one (e.g. tasks). An empty hidden div with the instance id keeps the morph-by-id wire contract intact.
(render-frame conv iid)Produce the elements fragment for iid and return [conv' fragment].
Patching strategy:
<div id="root"> with mode inner.Produce the elements fragment for `iid` and return `[conv' fragment]`. Patching strategy: * **First render of a frame** — its id is not yet in the DOM, so we target the shell's `<div id="root">` with `mode inner`. * **Subsequent renders** — the id is in the DOM, so we let Datastar's default morph-by-id do the work. Sibling DOM state — input focus, selection, scroll position — is preserved.
(render-instance conv iid opts)Render iid with explicit Datastar patch opts, mark it and its
rendered descendants as present in the DOM, and return [conv' frag].
When :conv/halos? is set, the outer hiccup is decorated with
data-stube-* attrs and the resulting HTML is cached on the instance
under :instance/last-html so the dev panel's HTML tab can show it.
Render `iid` with explicit Datastar patch `opts`, mark it and its rendered descendants as present in the DOM, and return `[conv' frag]`. When `:conv/halos?` is set, the outer hiccup is decorated with `data-stube-*` attrs and the resulting HTML is cached on the instance under `:instance/last-html` so the dev panel's HTML tab can show it.
(render-slot-overlay conv parent-id old-iid new-iid)Render the child currently occupying slot after a :call-in-slot.
If the slot already had a DOM root, patch that root outer; otherwise
fall back to re-rendering the parent because there is no child anchor
yet.
Render the child currently occupying `slot` after a `:call-in-slot`. If the slot already had a DOM root, patch that root `outer`; otherwise fall back to re-rendering the parent because there is no child anchor yet.
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 |