(can-go-next? {:keys [active-index loop?]} child-count)True when forward navigation is possible.
True when forward navigation is possible.
(can-go-prev? {:keys [active-index loop?]} child-count)True when backward navigation is possible.
True when backward navigation is possible.
(clamp-index idx child-count)Clamp idx to [0, count-1] for non-loop mode.
Clamp idx to [0, count-1] for non-loop mode.
(crosses-boundary? current-index target-index delta child-count)True when navigating from current to target crosses the loop boundary.
True when navigating from current to target crosses the loop boundary.
(direction-for-delta delta)Return "forward" for positive deltas, "backward" for negative.
Return "forward" for positive deltas, "backward" for negative.
(effective-loop? loop? child-count)True when loop is requested AND there are enough children.
True when loop is requested AND there are enough children.
(effective-offset slide-index active-index child-count)Compute the visual offset of slide-index relative to active-index in loop mode. Returns a value in [-floor(count/2), ceil(count/2)-1] so the active slide is at 0 and neighbors wrap around it.
Compute the visual offset of slide-index relative to active-index in loop mode. Returns a value in [-floor(count/2), ceil(count/2)-1] so the active slide is at 0 and neighbors wrap around it.
(loop-eligible? child-count)Loop requires at least 3 children to avoid ambiguity.
Loop requires at least 3 children to avoid ambiguity.
(normalize {:keys [mode-raw snap-raw loop-attr auto-play-attr interval-raw
show-controls-attr show-indicators-attr active-index-raw
gap-raw disabled-attr label-raw]})Normalise raw attribute inputs into a stable view-model map.
Input keys: :mode-raw string | nil :snap-raw string | nil :loop-attr string | nil (hasAttribute) :auto-play-attr string | nil (hasAttribute) :interval-raw string | nil :show-controls-attr string | nil (getAttribute, nil=absent) :show-indicators-attr string | nil (hasAttribute) :active-index-raw string | nil :gap-raw string | nil :disabled-attr string | nil (hasAttribute) :label-raw string | nil
Normalise raw attribute inputs into a stable view-model map. Input keys: :mode-raw string | nil :snap-raw string | nil :loop-attr string | nil (hasAttribute) :auto-play-attr string | nil (hasAttribute) :interval-raw string | nil :show-controls-attr string | nil (getAttribute, nil=absent) :show-indicators-attr string | nil (hasAttribute) :active-index-raw string | nil :gap-raw string | nil :disabled-attr string | nil (hasAttribute) :label-raw string | nil
(parse-active-index s)Parse active-index attribute. Default 0.
Parse active-index attribute. Default 0.
(parse-bool-attr s)Standard HTML boolean attribute: present (non-nil) = true, absent (nil) = false.
Standard HTML boolean attribute: present (non-nil) = true, absent (nil) = false.
(parse-bool-default-true s)Parse an attribute that is true when absent or empty, false only when "false".
Parse an attribute that is true when absent or empty, false only when "false".
(parse-gap s)Parse gap attribute. Default 0.
Parse gap attribute. Default 0.
(parse-interval s)Parse interval attribute. Default 5000, minimum 500.
Parse interval attribute. Default 5000, minimum 500.
(parse-mode s)Normalise mode attribute to "horizontal" or "vertical". Unknown / nil values fall back to "horizontal".
Normalise mode attribute to "horizontal" or "vertical". Unknown / nil values fall back to "horizontal".
(parse-non-neg-int s default-val)Parse a string to a non-negative integer, returning default-val on failure.
Parse a string to a non-negative integer, returning default-val on failure.
(parse-snap s)Normalise snap attribute to "none", "start", "center", or "end". Unknown / nil values fall back to "none".
Normalise snap attribute to "none", "start", "center", or "end". Unknown / nil values fall back to "none".
(resolve-target-index current-index delta child-count loop?)Given a delta (+1 or -1), compute the target index. In loop mode wraps around; in non-loop mode clamps.
Given a delta (+1 or -1), compute the target index. In loop mode wraps around; in non-loop mode clamps.
(slide-translate offset slide-size gap)Compute pixel translation for a slide at the given offset.
Compute pixel translation for a slide at the given offset.
(snap-to-index position slide-size gap child-count)Given a free-form drag position (in pixels), compute the nearest slide index to snap to. Returns clamped [0, count-1] index.
Given a free-form drag position (in pixels), compute the nearest slide index to snap to. Returns clamped [0, count-1] index.
(wrap-index idx count)Wrap idx into valid range [0, count). Returns 0 when count <= 0.
Wrap idx into valid range [0, count). Returns 0 when count <= 0.
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 |