Liking cljdoc? Tell your friends :D

dev.zeko.stube.fragments

Fragment data shapes and the one Datastar SSE translator.

A fragment is the kernel's wire-format-neutral way of saying "push this to the browser":

{:fragment/kind :elements
 :fragment/html "<form id=ix-001>…</form>"
 :fragment/opts {…patch-elements! options…}}

{:fragment/kind :signals
 :fragment/data {:foo 1}
 :fragment/opts {}}

{:fragment/kind :script
 :fragment/script "alert('hi')"
 :fragment/opts {}}

{:fragment/kind :close}

The kernel never touches Datastar; it just produces these maps. This namespace is the single Datastar SDK boundary — it owns the patch- mode keyword translation and turns fragments into SSE events. Before it existed, the translator was duplicated between dev.zeko.stube.http and dev.zeko.stube.server.

Fragment data shapes and the one Datastar SSE translator.

A *fragment* is the kernel's wire-format-neutral way of saying "push
this to the browser":

    {:fragment/kind :elements
     :fragment/html "<form id=ix-001>…</form>"
     :fragment/opts {…patch-elements! options…}}

    {:fragment/kind :signals
     :fragment/data {:foo 1}
     :fragment/opts {}}

    {:fragment/kind :script
     :fragment/script "alert('hi')"
     :fragment/opts {}}

    {:fragment/kind :close}

The kernel never touches Datastar; it just produces these maps.  This
namespace is the **single Datastar SDK boundary** — it owns the patch-
mode keyword translation and turns fragments into SSE events.  Before
it existed, the translator was duplicated between [[dev.zeko.stube.http]] and
[[dev.zeko.stube.server]].
raw docstring

closeclj

Tell the SSE channel to close. Used after :end.

Tell the SSE channel to close.  Used after `:end`.
sourceraw docstring

elementsclj

(elements html)
(elements html opts)

Build an :elements fragment. opts is a kernel-level options map ({:selector ... :patch-mode ...}); leave it empty to let Datastar morph by id.

Build an `:elements` fragment.  `opts` is a kernel-level options map
(`{:selector ... :patch-mode ...}`); leave it empty to let Datastar
morph by id.
sourceraw docstring

push!clj

(push! sse-gen fragments)

Push a sequence of fragments to an open Datastar SSE generator, holding the SSE lock so concurrent pushes never interleave.

Push a sequence of fragments to an open Datastar SSE generator,
holding the SSE lock so concurrent pushes never interleave.
sourceraw docstring

scriptclj

(script js)

Build an :execute-script fragment.

Build an `:execute-script` fragment.
sourceraw docstring

signalsclj

(signals m)

Build a :signals fragment from a Clojure map.

Build a `:signals` fragment from a Clojure map.
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