Liking cljdoc? Tell your friends :D

baredom.components.x-morph-stack.model


allowed-variantscljs

source

attr-active-indexcljs

source

attr-active-statecljs

source

attr-dampingcljs

source

attr-data-active-statecljs

source

attr-data-morph-idcljs

source

attr-data-statecljs

source

attr-data-variantcljs

source

attr-disabledcljs

source

attr-durationcljs

source

attr-masscljs

source

attr-stiffnesscljs

source

attr-variantcljs

source

change-detailcljs

(change-detail from to reason)

Build the detail map for an x-morph-stack-change event.

Build the detail map for an x-morph-stack-change event.
sourceraw docstring

changed-detailcljs

(changed-detail from to)

Build the detail map for an x-morph-stack-changed event.

Build the detail map for an x-morph-stack-changed event.
sourceraw docstring

default-goo-blurcljs

source

default-goo-thresholdcljs

source

default-variantcljs

source

diff-morph-idscljs

(diff-morph-ids old-ids new-ids)

Given two collections of morph-ids, partition into matched/entering/leaving.

Given two collections of morph-ids, partition into matched/entering/leaving.
sourceraw docstring

event-changecljs

source

event-changedcljs

source

event-schemacljs

source

goo-matrix-valuescljs

(goo-matrix-values threshold)

Build the feColorMatrix values string for a given alpha multiplier. The alpha offset is derived linearly from the multiplier so that:

  • threshold = 18 → '0 0 0 18 -7' (the canonical gooey configuration)
  • threshold = 1 → '0 0 0 1 0' (the identity alpha row, no goo effect) This lets callers tween a single number toward 1 to fade the gooey filter smoothly into a no-op as the morph spring settles, avoiding a visual snap when the filtered ghost is replaced by the un-filtered real element.
Build the feColorMatrix `values` string for a given alpha multiplier.
The alpha offset is derived linearly from the multiplier so that:
  - threshold = 18 → '0 0 0 18 -7' (the canonical gooey configuration)
  - threshold =  1 → '0 0 0  1  0' (the identity alpha row, no goo effect)
This lets callers tween a single number toward 1 to fade the gooey filter
smoothly into a no-op as the morph spring settles, avoiding a visual snap
when the filtered ghost is replaced by the un-filtered real element.
sourceraw docstring

lerpcljs

(lerp a b t)

Linear interpolation between a and b at progress t (0..1).

Linear interpolation between a and b at progress t (0..1).
sourceraw docstring

lerp-colorcljs

(lerp-color a b t)

Lerp two CSS rgb/rgba colors. If either fails to parse, snaps at midpoint.

Lerp two CSS rgb/rgba colors. If either fails to parse, snaps at midpoint.
sourceraw docstring

lerp-radius-listcljs

(lerp-radius-list a b t)

Lerp two border-radius strings. Both must be matched-shape px lists. Falls back to snap-at-midpoint when shapes differ.

Lerp two border-radius strings. Both must be matched-shape px lists.
Falls back to snap-at-midpoint when shapes differ.
sourceraw docstring

natural-duration-mscljs

(natural-duration-ms stiffness damping mass)

Estimate the spring's natural settle time in milliseconds from the current stiffness, damping, and mass. Combines two physical effects:

ω₀ = √(k/m) (undamped natural angular frequency, rad/s) ζ = c / (2·√(k·m)) (damping ratio)

ts ≈ 4 / (ζ·ω₀) + π / ω₀ = envelope decay + rise time to first reach the target

The envelope-decay term alone simplifies to 8m/c and is therefore insensitive to stiffness — that's mathematically right for the asymptotic decay of the displacement envelope, but it doesn't match the perceived duration because it ignores how fast the spring first arrives. Adding the rise-time term π/ω₀ (which is π·√(m/k)) brings stiffness back in, so a stiffer spring of the same damping is correctly estimated as faster.

Inputs are clamped to safe positive ranges; ζ is clamped to [0.2, 5] so very low / very high damping doesn't blow the result up. The component divides this by an author-supplied duration to derive a per-tick time scale, so the exact constant matters less than its monotonic behaviour across spring tunings.

Estimate the spring's natural settle time in milliseconds from the current
`stiffness`, `damping`, and `mass`. Combines two physical effects:

  ω₀ = √(k/m)          (undamped natural angular frequency, rad/s)
  ζ  = c / (2·√(k·m))  (damping ratio)

  ts ≈ 4 / (ζ·ω₀)  +  π / ω₀
     = envelope decay  +  rise time to first reach the target

The envelope-decay term alone simplifies to 8m/c and is therefore
insensitive to stiffness — that's mathematically right for the asymptotic
decay of the displacement envelope, but it doesn't match the perceived
duration because it ignores how fast the spring first arrives. Adding the
rise-time term π/ω₀ (which is π·√(m/k)) brings stiffness back in, so a
stiffer spring of the same damping is correctly estimated as faster.

Inputs are clamped to safe positive ranges; ζ is clamped to [0.2, 5] so
very low / very high damping doesn't blow the result up. The component
divides this by an author-supplied `duration` to derive a per-tick time
scale, so the exact constant matters less than its monotonic behaviour
across spring tunings.
sourceraw docstring

normalizecljs

(normalize {:keys [active-state-raw active-index-raw stiffness-raw damping-raw
                   mass-raw variant-raw duration-raw disabled-present?]})

Normalise raw attribute inputs into a stable view-model map.

Input keys: :active-state-raw string | nil :active-index-raw string | nil :stiffness-raw string | nil :damping-raw string | nil :mass-raw string | nil :variant-raw string | nil :duration-raw string | nil :disabled-present? boolean

Output keys: :active-state string | nil :active-index int | nil :stiffness number :damping number :mass number :variant string (one of allowed-variants) :duration number | nil (ms; nil means natural spring time) :disabled? boolean

Normalise raw attribute inputs into a stable view-model map.

Input keys:
  :active-state-raw   string | nil
  :active-index-raw   string | nil
  :stiffness-raw      string | nil
  :damping-raw        string | nil
  :mass-raw           string | nil
  :variant-raw        string | nil
  :duration-raw       string | nil
  :disabled-present?  boolean

Output keys:
  :active-state  string | nil
  :active-index  int | nil
  :stiffness     number
  :damping       number
  :mass          number
  :variant       string  (one of allowed-variants)
  :duration      number | nil  (ms; nil means natural spring time)
  :disabled?     boolean
sourceraw docstring

observed-attributescljs

source

parse-active-indexcljs

(parse-active-index s)

Parse the active-index attribute to a non-negative integer, or nil.

Parse the active-index attribute to a non-negative integer, or nil.
sourceraw docstring

parse-dampingcljs

(parse-damping s)
source

parse-durationcljs

(parse-duration s)

Parse the duration attribute (positive number of ms) to a number, or nil. nil / empty / non-numeric / non-positive → nil, meaning the spring runs at its natural settle time.

Parse the duration attribute (positive number of ms) to a number, or nil.
nil / empty / non-numeric / non-positive → nil, meaning the spring runs at
its natural settle time.
sourceraw docstring

parse-masscljs

(parse-mass s)
source

parse-px-listcljs

(parse-px-list s)

Parse a CSS length list like '8px 12px 4px 0px' into #js [n n n n] (in px). Returns nil if any token is not in px.

Parse a CSS length list like '8px 12px 4px 0px' into #js [n n n n] (in px).
Returns nil if any token is not in px.
sourceraw docstring

parse-rgb-stringcljs

(parse-rgb-string s)

Parse a CSS color in 'rgb(r,g,b)' or 'rgba(r,g,b,a)' form into #js [r g b a]. Returns nil for any other format (transparent, named colors, etc).

Parse a CSS color in 'rgb(r,g,b)' or 'rgba(r,g,b,a)' form into #js [r g b a].
Returns nil for any other format (transparent, named colors, etc).
sourceraw docstring

parse-stiffnesscljs

(parse-stiffness s)
source

parse-variantcljs

(parse-variant s)

Normalise a raw variant attribute string. Unknown / nil / empty → default.

Normalise a raw variant attribute string. Unknown / nil / empty → default.
sourceraw docstring

property-apicljs

source

resolve-activecljs

(resolve-active state-names {:keys [active-state active-index]})

Given a sequence of available state names and the normalised model, return the resolved active state name (string), or nil when no states.

Rules:

  1. If active-state matches a known name → use it.
  2. Else clamp active-index (default 0) to [0, count-1] → name at that index.
  3. When the list is empty → nil.
Given a sequence of available state names and the normalised model,
return the resolved active state name (string), or nil when no states.

Rules:
  1. If active-state matches a known name → use it.
  2. Else clamp active-index (default 0) to [0, count-1] → name at that index.
  3. When the list is empty → nil.
sourceraw docstring

slot-statecljs

source

spring-settled?cljs

(spring-settled? displacement velocity)

Returns true when displacement and velocity are below threshold.

Returns true when displacement and velocity are below threshold.
sourceraw docstring

spring-stepcljs

(spring-step current target velocity dt mass tension friction)

Single step of damped spring physics (1D) with mass. Returns #js [new-displacement new-velocity]. Acceleration = (tension * (target - current) - friction * velocity) / mass

Single step of damped spring physics (1D) with mass.
Returns #js [new-displacement new-velocity].
Acceleration = (tension * (target - current) - friction * velocity) / mass
sourceraw docstring

tag-namecljs

source

time-scale-forcljs

(time-scale-for duration-ms stiffness damping mass)

Compute the per-tick time scale that stretches/compresses the spring's natural settle time to the requested duration-ms. Returns 1.0 (no scaling) when duration-ms is nil / non-positive.

Compute the per-tick time scale that stretches/compresses the spring's
natural settle time to the requested `duration-ms`. Returns 1.0 (no scaling)
when `duration-ms` is nil / non-positive.
sourceraw docstring

variant-cleancljs

source

variant-liquidcljs

source

variant-organiccljs

source

variant-uses-goo?cljs

(variant-uses-goo? variant)

Whether a given variant string installs the SVG gooey filter.

Whether a given variant string installs the SVG gooey filter.
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