Liking cljdoc? Tell your friends :D

baredom.utils.overlay

Shared overlay root management for portal-based components. Provides document-level fixed layers that escape CSS stacking contexts.

Shared overlay root management for portal-based components.
Provides document-level fixed layers that escape CSS stacking contexts.
raw docstring

attach-listener!cljs

(attach-listener! layer target event-name handler capture)

Attach handler to target for event-name and remember the binding on layer so remove-layer! will detach it. target is usually the layer itself, but may be any node reachable from it (panel, close button, etc.). capture is the addEventListener capture flag.

Attach `handler` to `target` for `event-name` and remember the binding
on `layer` so `remove-layer!` will detach it. `target` is usually the
layer itself, but may be any node reachable from it (panel, close
button, etc.). `capture` is the `addEventListener` capture flag.
sourceraw docstring

cancel-deferred-doc-listener!cljs

(cancel-deferred-doc-listener! el k)

Cancel a pending defer-doc-listener! call at k on el, if any. Safe to call when no deferral is pending.

Cancel a pending `defer-doc-listener!` call at `k` on `el`, if any.
Safe to call when no deferral is pending.
sourceraw docstring

defer-doc-listener!cljs

(defer-doc-listener! el k install-fn)

Schedule install-fn to run on the next macrotask, with cancel support.

Use for overlay components that defer document-listener installation past the event that triggered open — otherwise the opening pointer click is caught by the new listener and immediately re-closes the panel. Pair with cancel-deferred-doc-listener! on disconnect and on programmatic close to avoid leaking listeners that reference a stale element after teardown.

The timer id is stored on el under instance-field key k. Calling defer-doc-listener! again with the same k cancels the prior pending timer first. install-fn only runs if el is still isConnected when the timer fires; component-specific predicates (e.g. "open attribute still present") remain install-fn's responsibility.

Schedule `install-fn` to run on the next macrotask, with cancel support.

Use for overlay components that defer document-listener installation
past the event that triggered open — otherwise the opening pointer
click is caught by the new listener and immediately re-closes the
panel. Pair with `cancel-deferred-doc-listener!` on disconnect and on
programmatic close to avoid leaking listeners that reference a stale
element after teardown.

The timer id is stored on `el` under instance-field key `k`. Calling
`defer-doc-listener!` again with the same `k` cancels the prior
pending timer first. `install-fn` only runs if `el` is still
`isConnected` when the timer fires; component-specific predicates
(e.g. "open attribute still present") remain `install-fn`'s
responsibility.
sourceraw docstring

ensure-overlay-root!cljs

(ensure-overlay-root! trigger-el)

Return (or create) the fixed overlay container. When an x-theme wrapper exists, the root is placed inside it so theme tokens cascade into panels.

Return (or create) the fixed overlay container. When an x-theme wrapper
exists, the root is placed inside it so theme tokens cascade into panels.
sourceraw docstring

find-theme-hostcljs

(find-theme-host el)

Walk up from el to find the nearest x-theme ancestor, or fall back to body.

Walk up from el to find the nearest x-theme ancestor, or fall back to body.
sourceraw docstring

get-panelcljs

(get-panel layer)

Query the layer's shadow root for the panel element.

Query the layer's shadow root for the panel element.
sourceraw docstring

make-layer!cljs

(make-layer! trigger-el style-text z-index)

Create a fixed-position layer with its own shadow DOM inside the overlay root. style-text is the CSS for the layer's shadow root. Returns the layer element.

Create a fixed-position layer with its own shadow DOM inside the overlay root.
style-text is the CSS for the layer's shadow root. Returns the layer element.
sourceraw docstring

remove-layer!cljs

(remove-layer! layer)

Detach every listener attached via attach-listener! and remove the layer from the DOM.

Detach every listener attached via `attach-listener!` and remove the
layer from the DOM.
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