Pure functions for the x-welcome-tour orchestrator component. Positioning, cutout geometry, connector path computation, and attribute normalisation — no DOM or side effects.
Pure functions for the x-welcome-tour orchestrator component. Positioning, cutout geometry, connector path computation, and attribute normalisation — no DOM or side effects.
(arrow-style final-placement arrow-size target-rect popover-rect)Compute inline style for the CSS arrow element so it points at the centre of the target. target-rect and popover-rect are viewport-relative maps with :x :y :width :height. The arrow slides along the popover edge to aim at the target centre, clamped so it stays inside the popover. Returns a map of CSS property strings.
Compute inline style for the CSS arrow element so it points at the centre of the target. target-rect and popover-rect are viewport-relative maps with :x :y :width :height. The arrow slides along the popover edge to aim at the target centre, clamped so it stays inside the popover. Returns a map of CSS property strings.
(clamp-step step total)Clamp step index to valid range [0, total-1].
Clamp step index to valid range [0, total-1].
(compute-cutout target-rect padding radius)Compute cutout rect from a target DOMRect and padding/radius values. Returns {:x :y :width :height :rx :ry}.
Compute cutout rect from a target DOMRect and padding/radius values.
Returns {:x :y :width :height :rx :ry}.(compute-position placement
anchor-rect
popover-size
viewport-size
connector-type)Compute viewport-relative position for the tour popover. Tries preferred placement, then opposite, then cross-axis placements. connector-type controls the gap: line/curve get extra distance so the connector path is visible. Returns {:x :y :final-placement}.
Compute viewport-relative position for the tour popover.
Tries preferred placement, then opposite, then cross-axis placements.
connector-type controls the gap: line/curve get extra distance so the
connector path is visible.
Returns {:x :y :final-placement}.(connector-anchor-points target-rect popover-rect final-placement)Compute connector anchor points on target and popover edges. Returns {:target-point {:x :y} :popover-point {:x :y}}.
Compute connector anchor points on target and popover edges.
Returns {:target-point {:x :y} :popover-point {:x :y}}.(connector-path-d connector-type target-point popover-point final-placement)Returns SVG path d attribute string for the connector. connector-type is "line" or "curve". Returns nil for "arrow" or "none".
Returns SVG path d attribute string for the connector. connector-type is "line" or "curve". Returns nil for "arrow" or "none".
(counter-text step total)Format the step counter string, e.g. '2 / 5'.
Format the step counter string, e.g. '2 / 5'.
(first-step? step)Return true when the current step is the first.
Return true when the current step is the first.
(last-step? step total)Return true when the current step is the last.
Return true when the current step is the last.
(normalize {:keys [open? step-raw connector-raw prev-label-raw next-label-raw
done-label-raw skip-label-raw counter? dots?]})Normalise raw attribute inputs into a stable view-model map.
Input keys: :open? boolean :step-raw string | nil :connector-raw string | nil :prev-label-raw string | nil :next-label-raw string | nil :done-label-raw string | nil :skip-label-raw string | nil :counter? boolean :dots? boolean
Output keys: :open? boolean :step number :connector string :prev-label string :next-label string :done-label string :skip-label string :counter? boolean :dots? boolean
Normalise raw attribute inputs into a stable view-model map. Input keys: :open? boolean :step-raw string | nil :connector-raw string | nil :prev-label-raw string | nil :next-label-raw string | nil :done-label-raw string | nil :skip-label-raw string | nil :counter? boolean :dots? boolean Output keys: :open? boolean :step number :connector string :prev-label string :next-label string :done-label string :skip-label string :counter? boolean :dots? boolean
(offset-for-connector connector-type)Return the gap between the target and popover based on connector type. Line and curve connectors need more space so the path is visible.
Return the gap between the target and popover based on connector type. Line and curve connectors need more space so the path is visible.
(parse-connector s)Normalise a raw connector attribute string. Falls back to default.
Normalise a raw connector attribute string. Falls back to default.
(parse-step s)Parse step attribute to a non-negative integer. Defaults to 0.
Parse step attribute to a non-negative integer. Defaults to 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 |