(arrow-delta key-name)Unit direction map {:dx :dy} for an arrow key, or nil for any other key.
Unit direction map `{:dx :dy}` for an arrow key, or nil for any other key.
(clamp-position {:keys [x y w handle-h vw vh]})Constrain a panel top-left so its handle bar stays reachable.
Clamping the whole panel inside the viewport makes a tall panel unusable on
a short viewport, so the policy is weaker: at least min-visible pixels of
the panel remain on screen horizontally, and the handle bar (height
handle-h) remains fully on screen vertically.
All measurements are supplied by the caller — this function never touches the DOM.
Constrain a panel top-left so its handle bar stays reachable. Clamping the whole panel inside the viewport makes a tall panel unusable on a short viewport, so the policy is weaker: at least `min-visible` pixels of the panel remain on screen horizontally, and the handle bar (height `handle-h`) remains fully on screen vertically. All measurements are supplied by the caller — this function never touches the DOM.
(dismiss-event-detail reason)Build the x-floating-panel-dismiss-request CustomEvent detail.
Build the x-floating-panel-dismiss-request CustomEvent detail.
(drag-moved? {:keys [start-x start-y] :as drag})True when the pointer has travelled since the grab.
A press that never moved is a click on the handle, not a drag. Committing it would announce a move that did not happen and would pin an unpositioned panel to viewport coordinates, silently taking it out of the CSS default placement.
True when the pointer has travelled since the grab. A press that never moved is a click on the handle, not a drag. Committing it would announce a move that did not happen and would pin an unpositioned panel to viewport coordinates, silently taking it out of the CSS default placement.
(drag-position {:keys [pointer-x pointer-y offset-x offset-y]})Panel top-left for a pointer at {:pointer-x :pointer-y}, given the grab
offset captured at pointerdown. Returns {:x :y} in viewport coordinates.
Panel top-left for a pointer at `{:pointer-x :pointer-y}`, given the grab
offset captured at pointerdown. Returns `{:x :y}` in viewport coordinates.(move-event-detail x y source)Build the x-floating-panel-move CustomEvent detail.
Build the x-floating-panel-move CustomEvent detail.
(normalize {:keys [open-present? x-raw y-raw closable-present? label-raw
focus-on-open-present? step-raw header-slotted?]})Normalise raw attribute inputs into a stable view-model map.
resizable is deliberately absent: no effect reads it, so carrying it here
would only add a field to compare on every attribute change.
Input keys: :open-present? boolean :x-raw string | nil :y-raw string | nil :closable-present? boolean :label-raw string | nil :focus-on-open-present? boolean :step-raw string | nil :header-slotted? boolean
Output keys: :open? boolean :x number | nil (nil → CSS default placement governs) :y number | nil :closable? boolean :label string :focus-on-open? boolean :step number :header-slotted? boolean
Normalise raw attribute inputs into a stable view-model map. `resizable` is deliberately absent: no effect reads it, so carrying it here would only add a field to compare on every attribute change. Input keys: :open-present? boolean :x-raw string | nil :y-raw string | nil :closable-present? boolean :label-raw string | nil :focus-on-open-present? boolean :step-raw string | nil :header-slotted? boolean Output keys: :open? boolean :x number | nil (nil → CSS default placement governs) :y number | nil :closable? boolean :label string :focus-on-open? boolean :step number :header-slotted? boolean
(normalize-label raw)Normalize raw label attribute value. Falls back to default-label.
Normalize raw label attribute value. Falls back to default-label.
(nudge-position {:keys [x y dx dy step]})Move {:x :y} by one keyboard step in the direction {:dx :dy}.
Move `{:x :y}` by one keyboard `step` in the direction `{:dx :dy}`.
(parse-coordinate raw)Parse a raw x / y attribute value into a finite number.
Returns nil for absent, blank, or non-numeric input. Absent and invalid are deliberately the same state: coercing garbage to 0 would teleport the panel to the viewport corner, whereas nil falls through to the CSS default placement and leaves the panel where the author last saw it.
Parse a raw `x` / `y` attribute value into a finite number. Returns nil for absent, blank, or non-numeric input. Absent and invalid are deliberately the same state: coercing garbage to 0 would teleport the panel to the viewport corner, whereas nil falls through to the CSS default placement and leaves the panel where the author last saw it.
(parse-step raw)Parse the step attribute into a positive number of pixels. Absent,
non-numeric, and non-positive values all fall back to default-step.
Parse the `step` attribute into a positive number of pixels. Absent, non-numeric, and non-positive values all fall back to default-step.
(toggle-event-detail open)Build the x-floating-panel-toggle CustomEvent detail.
Build the x-floating-panel-toggle CustomEvent detail.
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 |