Liking cljdoc? Tell your friends :D

ty.shim

Thin CLJS wrapper over wc-shim.js so you don't touch classes or js*. Provides helpers for attributes, props, shadow DOM, and hot reload support.

Thin CLJS wrapper over wc-shim.js so you don't touch classes or js*.
Provides helpers for attributes, props, shadow DOM, and hot reload support.
raw docstring

attrcljs

(attr el k)

Get raw attribute from element.

Get raw attribute from element.
sourceraw docstring

define!cljs

(define! tag opts)

Define a Custom Element with batched attribute/property updates by default.

New batched API: :attr (fn [el delta] ...) ; delta = {'attr-name' 'new-value' ...} :prop (fn [el delta] ...) ; delta = {'prop-name' new-value ...}

Batching happens automatically using requestAnimationFrame. Multiple rapid changes are collected and delivered as a single delta.

tag - string tag name, e.g. "x-counter" opts - hooks/options map with batched callbacks

Returns the constructor (for completeness), but you rarely need it.

Define a Custom Element with batched attribute/property updates by default.

New batched API:
:attr (fn [el delta] ...)  ; delta = {'attr-name' 'new-value' ...}
:prop (fn [el delta] ...)  ; delta = {'prop-name' new-value ...}

Batching happens automatically using requestAnimationFrame.
Multiple rapid changes are collected and delivered as a single delta.

tag  - string tag name, e.g. "x-counter"
opts - hooks/options map with batched callbacks

Returns the constructor (for completeness), but you rarely need it.
sourceraw docstring

ensure-shadowcljs

(ensure-shadow el)
(ensure-shadow el mode)
source

get-initial-attrscljs

(get-initial-attrs el attr-map)

Extract initial-only attributes on first render - React compatible.

Reads attributes from the element once (on first call) and parses them using the provided attribute map. Subsequent calls return nil.

This pattern is ideal for 'initial view' parameters that should only be applied once on component initialization, preventing conflicts with user interactions or React re-renders.

Usage: (let [initial (get-initial-attrs el {:view-year js/parseInt :view-month js/parseInt :min-date date/parse-value})] (when (seq initial) (apply-initial-state! el initial)))

Arguments:

  • el: The web component element
  • attr-map: Map of attribute keywords to parser functions

Returns:

  • Map of parsed attribute values (first call only)
  • nil on subsequent calls
Extract initial-only attributes on first render - React compatible.

Reads attributes from the element once (on first call) and parses them
using the provided attribute map. Subsequent calls return nil.

This pattern is ideal for 'initial view' parameters that should only
be applied once on component initialization, preventing conflicts 
with user interactions or React re-renders.

Usage:
(let [initial (get-initial-attrs el {:view-year js/parseInt
                                     :view-month js/parseInt
                                     :min-date date/parse-value})]
  (when (seq initial)
    (apply-initial-state! el initial)))

Arguments:
- el: The web component element
- attr-map: Map of attribute keywords to parser functions

Returns:
- Map of parsed attribute values (first call only)
- nil on subsequent calls
sourceraw docstring

get-propscljs

(get-props el)

Return current props as CLJS map.

Return current props as CLJS map.
sourceraw docstring

parse-bool-attrcljs

(parse-bool-attr el k)

Boolean attribute semantics: presence -> true, explicit 'false' -> false.

Boolean attribute semantics: presence -> true, explicit 'false' -> false.
sourceraw docstring

parse-edn-attrcljs

(parse-edn-attr el k)
source

parse-float-attrcljs

(parse-float-attr el k)
source

parse-int-attrcljs

(parse-int-attr el k)
source

parse-json-attrcljs

(parse-json-attr el k)
source

reload-all-components!cljs

(reload-all-components!)

Force refresh all registered components after hot reload

Force refresh all registered components after hot reload
sourceraw docstring

rm-attr!cljs

(rm-attr! el k)
source

set-attr!cljs

(set-attr! el k v)

Set attribute (string).

Set attribute (string).
sourceraw docstring

set-props!cljs

(set-props! el m)

Batch set props (EDN map). Triggers per-key prop hook.

Batch set props (EDN map). Triggers per-key prop hook.
sourceraw docstring

set-shadow-html!cljs

(set-shadow-html! el html)
source

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