Pure model layer for x-split-pane — a resizable two-panel layout.
No DOM, no side effects. Every function here is a plain data transform and is exercised directly by model_test.cljs with sparse inputs.
Pure model layer for x-split-pane — a resizable two-panel layout. No DOM, no side effects. Every function here is a plain data transform and is exercised directly by model_test.cljs with sparse inputs.
(clamp n lo hi)Clamp n into the inclusive range [lo, hi].
Clamp `n` into the inclusive range [lo, hi].
(clamp-by-mins percent container-px min-start-px min-end-px)Clamp a position percentage so the start pane stays >= min-start-px
and the end pane stays >= min-end-px, given the container's px size.
When the two minimums overlap (no feasible position satisfies both)
a clamped midpoint of the conflicting range is returned so the result
stays deterministic and within [0,100].
Clamp a position percentage so the start pane stays >= `min-start-px` and the end pane stays >= `min-end-px`, given the container's px size. When the two minimums overlap (no feasible position satisfies both) a clamped midpoint of the conflicting range is returned so the result stays deterministic and within [0,100].
(clamp-position n)Clamp a position percentage into [0, 100].
Clamp a position percentage into [0, 100].
(keyboard-delta key orientation)Map a keyboard key to a position change for the given orientation.
Increasing the position grows the start pane. Returns a numeric
percentage delta, the keyword :to-min or :to-max, or nil when the key
is not a resize key.
Map a keyboard `key` to a position change for the given `orientation`. Increasing the position grows the start pane. Returns a numeric percentage delta, the keyword :to-min or :to-max, or nil when the key is not a resize key.
(next-position current delta)Compute the next position from current and a keyboard-delta result.
delta is a numeric percentage, :to-min, or :to-max. The result is
clamped to [0, 100].
Compute the next position from `current` and a `keyboard-delta` result. `delta` is a numeric percentage, :to-min, or :to-max. The result is clamped to [0, 100].
(normalize {:keys [orientation-raw position-raw min-start-raw min-end-raw
disabled? divider-label-raw]})Normalise raw attribute inputs into a stable view-model map.
Input keys: :orientation-raw string | nil :position-raw string | nil :min-start-raw string | nil :min-end-raw string | nil :disabled? boolean :divider-label-raw string | nil
Output keys: :orientation "horizontal" | "vertical" :position number 0–100 :min-start number >= 0 (px) :min-end number >= 0 (px) :disabled? boolean :divider-label non-empty string
Normalise raw attribute inputs into a stable view-model map. Input keys: :orientation-raw string | nil :position-raw string | nil :min-start-raw string | nil :min-end-raw string | nil :disabled? boolean :divider-label-raw string | nil Output keys: :orientation "horizontal" | "vertical" :position number 0–100 :min-start number >= 0 (px) :min-end number >= 0 (px) :disabled? boolean :divider-label non-empty string
(parse-min s)Parse a min-start / min-end attribute into a non-negative pixel count.
Parse a `min-start` / `min-end` attribute into a non-negative pixel count.
(parse-number s default-val)Parse a numeric attribute string, falling back to default-val for
nil / non-string / non-numeric input.
Parse a numeric attribute string, falling back to `default-val` for nil / non-string / non-numeric input.
(parse-orientation s)Parse the orientation attribute. Unknown / nil fall back to horizontal.
Parse the `orientation` attribute. Unknown / nil fall back to horizontal.
(parse-position s)Parse the position attribute into a clamped percentage 0–100.
Parse the `position` attribute into a clamped percentage 0–100.
(pointer->percent client rect-start rect-size)Convert a pointer client coordinate to a percentage of the container.
client is clientX (horizontal split) or clientY (vertical split);
rect-start is the container's left/top edge and rect-size its
width/height in px. The result is clamped to [0, 100].
Convert a pointer client coordinate to a percentage of the container. `client` is clientX (horizontal split) or clientY (vertical split); `rect-start` is the container's left/top edge and `rect-size` its width/height in px. The result is clamped to [0, 100].
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 |