use-scroll-animate 3.8.0 → 3.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/README.md +1 -0
- package/README_ja.md +1 -0
- package/README_zh.md +1 -0
- package/dist/chunks/{base-BpROOcey.js → base-BRIPyPtX.js} +11 -2
- package/dist/chunks/{base-BpROOcey.js.map → base-BRIPyPtX.js.map} +1 -1
- package/dist/chunks/{base-CXx7jZ-o.cjs → base-Dm6ee5ug.cjs} +11 -1
- package/dist/chunks/{base-CXx7jZ-o.cjs.map → base-Dm6ee5ug.cjs.map} +1 -1
- package/dist/chunks/{core-IaorbTdu.cjs → core-CHAtivHV.cjs} +2 -2
- package/dist/chunks/{core-IaorbTdu.cjs.map → core-CHAtivHV.cjs.map} +1 -1
- package/dist/chunks/{core-uxs3ETou.js → core-CYozf_E-.js} +2 -2
- package/dist/chunks/{core-uxs3ETou.js.map → core-CYozf_E-.js.map} +1 -1
- package/dist/chunks/{index-tags-BANJ-e4H.js → index-tags-BmQR17Sb.js} +2 -1
- package/dist/chunks/{index-tags-BANJ-e4H.js.map → index-tags-BmQR17Sb.js.map} +1 -1
- package/dist/chunks/{index-tags-wbuPiMR6.cjs → index-tags-DYYsgbba.cjs} +2 -1
- package/dist/chunks/{index-tags-wbuPiMR6.cjs.map → index-tags-DYYsgbba.cjs.map} +1 -1
- package/dist/chunks/{spring-2OTnYCzm.cjs → spring-Dp5BllPB.cjs} +2 -2
- package/dist/chunks/{spring-2OTnYCzm.cjs.map → spring-Dp5BllPB.cjs.map} +1 -1
- package/dist/chunks/{spring-C-fw7_9f.js → spring-UBPhrh1X.js} +2 -2
- package/dist/chunks/{spring-C-fw7_9f.js.map → spring-UBPhrh1X.js.map} +1 -1
- package/dist/chunks/{variants-CHe1VbSn.js → variants-DTypaOH3.js} +2 -2
- package/dist/chunks/{variants-CHe1VbSn.js.map → variants-DTypaOH3.js.map} +1 -1
- package/dist/chunks/{variants-BNIrn4ch.cjs → variants-_dC-ey6R.cjs} +2 -2
- package/dist/chunks/{variants-BNIrn4ch.cjs.map → variants-_dC-ey6R.cjs.map} +1 -1
- package/dist/components/angular.cjs +6 -5
- package/dist/components/angular.cjs.map +1 -1
- package/dist/components/angular.d.cts +25 -0
- package/dist/components/angular.d.ts +25 -0
- package/dist/components/angular.js +6 -5
- package/dist/components/angular.js.map +1 -1
- package/dist/components/background.cjs +2 -2
- package/dist/components/background.js +3 -3
- package/dist/components/cards.cjs +2 -2
- package/dist/components/cards.js +3 -3
- package/dist/components/click.cjs +2 -2
- package/dist/components/click.js +3 -3
- package/dist/components/depth.cjs +3 -3
- package/dist/components/depth.js +4 -4
- package/dist/components/feedback.cjs +1 -1
- package/dist/components/feedback.js +2 -2
- package/dist/components/gesture.cjs +3 -3
- package/dist/components/gesture.js +5 -5
- package/dist/components/interaction.cjs +1 -1
- package/dist/components/interaction.js +2 -2
- package/dist/components/jsx.d.cts +1 -0
- package/dist/components/jsx.d.ts +1 -0
- package/dist/components/layout.cjs +1 -1
- package/dist/components/layout.js +2 -2
- package/dist/components/lazy.cjs +2 -1
- package/dist/components/lazy.cjs.map +1 -1
- package/dist/components/lazy.d.cts +1 -0
- package/dist/components/lazy.d.ts +1 -0
- package/dist/components/lazy.js +2 -1
- package/dist/components/lazy.js.map +1 -1
- package/dist/components/packs.cjs +194 -0
- package/dist/components/packs.cjs.map +1 -0
- package/dist/components/packs.css +3 -0
- package/dist/components/packs.d.cts +107 -0
- package/dist/components/packs.d.ts +107 -0
- package/dist/components/packs.js +185 -0
- package/dist/components/packs.js.map +1 -0
- package/dist/components/page.cjs +2 -2
- package/dist/components/page.js +3 -3
- package/dist/components/physics.cjs +2 -2
- package/dist/components/physics.js +4 -4
- package/dist/components/react.cjs +1 -1
- package/dist/components/react.js +1 -1
- package/dist/components/reveal.cjs +1 -1
- package/dist/components/reveal.js +2 -2
- package/dist/components/solid.cjs +6 -5
- package/dist/components/solid.cjs.map +1 -1
- package/dist/components/solid.d.cts +25 -0
- package/dist/components/solid.d.ts +25 -0
- package/dist/components/solid.js +6 -5
- package/dist/components/solid.js.map +1 -1
- package/dist/components/svelte.cjs +6 -5
- package/dist/components/svelte.cjs.map +1 -1
- package/dist/components/svelte.d.cts +25 -0
- package/dist/components/svelte.d.ts +25 -0
- package/dist/components/svelte.js +6 -5
- package/dist/components/svelte.js.map +1 -1
- package/dist/components/svg.cjs +1 -1
- package/dist/components/svg.js +2 -2
- package/dist/components/text.cjs +1 -1
- package/dist/components/text.js +2 -2
- package/dist/components/timeline.cjs +1 -1
- package/dist/components/timeline.js +2 -2
- package/dist/components/transitions.cjs +5 -1
- package/dist/components/transitions.cjs.map +1 -1
- package/dist/components/transitions.d.cts +2 -0
- package/dist/components/transitions.d.ts +2 -0
- package/dist/components/transitions.js +6 -2
- package/dist/components/transitions.js.map +1 -1
- package/dist/components/ui.cjs +3 -3
- package/dist/components/ui.js +5 -5
- package/dist/components/vue.cjs +6 -5
- package/dist/components/vue.cjs.map +1 -1
- package/dist/components/vue.d.cts +25 -0
- package/dist/components/vue.d.ts +25 -0
- package/dist/components/vue.js +6 -5
- package/dist/components/vue.js.map +1 -1
- package/dist/components/webgl.cjs +1 -1
- package/dist/components/webgl.js +2 -2
- package/dist/components.cjs +14 -5
- package/dist/components.cjs.map +1 -1
- package/dist/components.css +1 -0
- package/dist/components.d.cts +65 -2
- package/dist/components.d.ts +65 -2
- package/dist/components.js +11 -8
- package/dist/components.js.map +1 -1
- package/dist/components.umd.js +2 -2
- package/dist/components.umd.js.map +1 -1
- package/dist/index.cjs +7 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/docs/components.md +14 -0
- package/docs/upgrading-4.md +65 -0
- package/package.json +13 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var base = require('./base-
|
|
3
|
+
var base = require('./base-Dm6ee5ug.cjs');
|
|
4
4
|
|
|
5
5
|
const SPRING_PRESETS = {
|
|
6
6
|
default: { stiffness: 170, damping: 26, mass: 1 },
|
|
@@ -229,4 +229,4 @@ exports.springEasing = springEasing;
|
|
|
229
229
|
exports.springSamples = springSamples;
|
|
230
230
|
exports.stepSpring = stepSpring;
|
|
231
231
|
exports.supportsLinearEasing = supportsLinearEasing;
|
|
232
|
-
//# sourceMappingURL=spring-
|
|
232
|
+
//# sourceMappingURL=spring-Dp5BllPB.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spring-2OTnYCzm.cjs","sources":["../../src/components/physics/spring.ts"],"sourcesContent":["import { prefersReducedMotion, motionScale, raf, caf, now, applyFrame, EASE_SPRING } from '../base';\n\n/**\n * Spring physics core (v2.3). A damped harmonic oscillator integrated in\n * 1 ms steps: `stiffness` (k, N/m), `damping` (c) and `mass` (m). Used by\n * the `<usa-spring>`, `<usa-draggable>` and `<usa-overscroll>` elements and\n * exported for your own animations:\n *\n * - `springEasing()` turns a spring into a CSS `linear()` easing + duration\n * for WAAPI / CSS (falls back to a cubic-bezier overshoot where `linear()`\n * is unsupported);\n * - `spring(el, keyframes, cfg)` animates with it;\n * - `createSpring()` is an interruptible, velocity-preserving value for\n * gestures (drag, inertia, snap).\n */\nexport interface SpringConfig {\n /** Spring stiffness (default 170). Higher = faster, snappier. */\n stiffness?: number;\n /** Damping / friction (default 26). Lower = more bounces. */\n damping?: number;\n /** Mass (default 1). Higher = slower, heavier. */\n mass?: number;\n /** Initial velocity in progress units per second (default 0). */\n velocity?: number;\n /** Rest threshold (default 0.001). */\n precision?: number;\n}\n\nexport type SpringPreset = 'default' | 'gentle' | 'wobbly' | 'stiff' | 'bouncy' | 'slow' | 'molasses';\n\nexport const SPRING_PRESETS: Record<SpringPreset, Required<Pick<SpringConfig, 'stiffness' | 'damping' | 'mass'>>> = {\n default: { stiffness: 170, damping: 26, mass: 1 },\n gentle: { stiffness: 120, damping: 14, mass: 1 },\n wobbly: { stiffness: 180, damping: 12, mass: 1 },\n stiff: { stiffness: 210, damping: 20, mass: 1 },\n bouncy: { stiffness: 300, damping: 10, mass: 1 },\n slow: { stiffness: 280, damping: 60, mass: 1 },\n molasses: { stiffness: 280, damping: 120, mass: 1 },\n};\n\nexport type SpringInput = SpringPreset | SpringConfig | string | undefined;\n\n/** Resolve a preset name or a partial config to a full config. */\nexport function resolveSpring(input?: SpringInput): Required<SpringConfig> {\n const base = typeof input === 'string' ? SPRING_PRESETS[input as SpringPreset] || SPRING_PRESETS.default : { ...SPRING_PRESETS.default, ...(input || {}) };\n const pos = (v: unknown, d: number) => (typeof v === 'number' && Number.isFinite(v) && v > 0 ? v : d);\n const o = (typeof input === 'object' && input) || {};\n return {\n stiffness: pos(base.stiffness, 170),\n damping: Math.max(0, Number.isFinite(base.damping) ? base.damping : 26),\n mass: pos(base.mass, 1),\n velocity: Number.isFinite(o.velocity) ? (o.velocity as number) : 0,\n precision: pos(o.precision, 0.001),\n };\n}\n\n/** One integration step (semi-implicit Euler) towards `to`. Returns [x, v]. */\nexport function stepSpring(cfg: Required<SpringConfig>, x: number, v: number, to: number, dt: number): [number, number] {\n const a = (-cfg.stiffness * (x - to) - cfg.damping * v) / cfg.mass;\n const nv = v + a * dt;\n return [x + nv * dt, nv];\n}\n\nconst cache = new Map<string, { values: number[]; duration: number }>();\n\n/**\n * Sample the spring from 0 to 1 at `fps` (default 60). `values` may exceed 1\n * (overshoot); `duration` is the time to rest, in ms (max 10 s).\n */\nexport function springSamples(input?: SpringInput, fps = 60): { values: number[]; duration: number } {\n const cfg = resolveSpring(input);\n const key = `${cfg.stiffness}|${cfg.damping}|${cfg.mass}|${cfg.velocity}|${cfg.precision}|${fps}`;\n const hit = cache.get(key);\n if (hit) return hit;\n const values = [0];\n let x = 0;\n let v = cfg.velocity;\n const frame = 1000 / fps;\n let t = 0;\n let next = frame;\n while (t < 10000) {\n [x, v] = stepSpring(cfg, x, v, 1, 0.001);\n t += 1;\n if (t >= next) {\n values.push(x);\n next += frame;\n if (Math.abs(1 - x) < cfg.precision && Math.abs(v) < cfg.precision * 10) break;\n }\n }\n values[values.length - 1] = 1;\n const out = { values, duration: Math.round(t) };\n if (cache.size > 64) cache.clear();\n cache.set(key, out);\n return out;\n}\n\n/** `true` when CSS `linear()` easing is supported. */\nexport function supportsLinearEasing(): boolean {\n return typeof CSS !== 'undefined' && typeof CSS.supports === 'function' && CSS.supports('animation-timing-function', 'linear(0, 1)');\n}\n\n/**\n * The spring as `{ easing, duration }` for `el.animate()` / CSS. `easing` is\n * a `linear(…)` function with at most `points` stops (default 48), or a\n * cubic-bezier overshoot where `linear()` is unsupported.\n */\nexport function springEasing(input?: SpringInput, points = 48): { easing: string; duration: number } {\n const { values, duration } = springSamples(input);\n if (!supportsLinearEasing()) return { easing: EASE_SPRING, duration: Math.min(duration, 1200) };\n return { easing: linearEasing(values, points), duration };\n}\n\n/** Build a CSS `linear()` easing from samples (down-sampled to `points`). */\nexport function linearEasing(values: number[], points = 48): string {\n const n = values.length;\n const step = Math.max(1, Math.ceil((n - 1) / Math.max(2, points - 1)));\n const out: string[] = [];\n for (let i = 0; i < n - 1; i += step) out.push(String(Math.round(values[i] * 1000) / 1000));\n out.push('1');\n return `linear(${out.join(', ')})`;\n}\n\n/**\n * Animate `el` between keyframes with spring timing (WAAPI). Under reduced\n * motion the final frame is applied immediately. Returns the Animation (or\n * `null` without WAAPI / under reduced motion).\n */\nexport function spring(el: Element, keyframes: Keyframe[], input?: SpringInput, options: KeyframeAnimationOptions = {}): Animation | null {\n const target = el as HTMLElement;\n if (prefersReducedMotion() || typeof target.animate !== 'function') {\n applyFrame(target, keyframes[keyframes.length - 1]);\n return null;\n }\n const { easing, duration } = springEasing(input);\n return target.animate(keyframes, { duration: duration * motionScale(), easing, fill: 'both', ...options });\n}\n\n/* ------------------------------------------------------------------ */\n/* Interactive springs */\n/* ------------------------------------------------------------------ */\n\nexport interface SpringValueOptions {\n /** Start value (default 0). */\n value?: number;\n /** Spring config or preset (default `'default'`). */\n spring?: SpringInput;\n /** Called with the value every frame (and on `jump()`). */\n onUpdate?: (value: number, velocity: number) => void;\n /** Called when the value comes to rest at its target. */\n onRest?: (value: number) => void;\n}\n\nexport interface SpringValue {\n readonly value: number;\n /** Units per second. */\n readonly velocity: number;\n readonly target: number;\n readonly animating: boolean;\n /** Animate to `target`, optionally with a new initial velocity (units/s). */\n set(target: number, velocity?: number): void;\n /** Jump to `value` with no animation. */\n jump(value: number): void;\n /** Stop where it is. */\n stop(): void;\n /** Change the spring config. */\n configure(spring: SpringInput): void;\n}\n\n/**\n * An interruptible spring-animated number: call `set()` as often as you like,\n * the motion keeps its velocity (like iOS / Framer springs). Reduced motion\n * jumps straight to the target.\n */\nexport function createSpring(opts: SpringValueOptions = {}): SpringValue {\n let cfg = resolveSpring(opts.spring);\n let x = opts.value ?? 0;\n let v = 0;\n let to = x;\n let id = 0;\n let last = 0;\n let running = false;\n const stop = () => {\n if (running) caf(id);\n running = false;\n };\n const loop = () => {\n const t = now();\n let dt = Math.min(64, Math.max(1, t - last));\n last = t;\n while (dt > 0) {\n const s = Math.min(dt, 4);\n [x, v] = stepSpring(cfg, x, v, to, s / 1000);\n dt -= s;\n }\n const scale = Math.max(1, Math.abs(to) * 0.0005);\n if (Math.abs(to - x) < cfg.precision * scale * 10 && Math.abs(v) < cfg.precision * scale * 100) {\n x = to;\n v = 0;\n running = false;\n opts.onUpdate?.(x, 0);\n opts.onRest?.(x);\n return;\n }\n opts.onUpdate?.(x, v);\n id = raf(loop);\n };\n const api: SpringValue = {\n get value() {\n return x;\n },\n get velocity() {\n return v;\n },\n get target() {\n return to;\n },\n get animating() {\n return running;\n },\n set(target, velocity) {\n to = target;\n if (velocity !== undefined && Number.isFinite(velocity)) v = velocity;\n if (prefersReducedMotion()) {\n api.jump(target);\n opts.onRest?.(target);\n return;\n }\n if (!running) {\n running = true;\n last = now();\n id = raf(loop);\n }\n },\n jump(value) {\n stop();\n x = to = value;\n v = 0;\n opts.onUpdate?.(x, 0);\n },\n stop() {\n stop();\n v = 0;\n to = x;\n },\n configure(input) {\n cfg = resolveSpring(input);\n },\n };\n return api;\n}\n\n/* ------------------------------------------------------------------ */\n/* Inertia + snapping */\n/* ------------------------------------------------------------------ */\n\n/**\n * Where a flick at `velocity` (units/s) comes to rest with exponential\n * decay: `value + velocity · timeConstant` (default 0.325 s, iOS-like).\n */\nexport function projectInertia(value: number, velocity: number, timeConstant = 0.325): number {\n return value + velocity * timeConstant;\n}\n\n/** Snap to a grid (`number`) or the nearest of a list of points. */\nexport function snapTo(value: number, to: number | number[] | null | undefined): number {\n if (Array.isArray(to)) {\n if (!to.length) return value;\n return to.reduce((best, p) => (Math.abs(p - value) < Math.abs(best - value) ? p : best), to[0]);\n }\n if (typeof to === 'number' && to > 0) return Math.round(value / to) * to;\n return value;\n}\n\n/** iOS-style rubber-band resistance: how far content moves when pulled `distance` past an edge. */\nexport function rubberBand(distance: number, dimension: number, constant = 0.55): number {\n if (dimension <= 0) return 0;\n const sign = distance < 0 ? -1 : 1;\n const d = Math.abs(distance);\n return sign * (1 - 1 / ((d * constant) / dimension + 1)) * dimension;\n}\n"],"names":["EASE_SPRING","prefersReducedMotion","applyFrame","motionScale","caf","now","raf"],"mappings":";;;;AA8BO,MAAM,cAAc,GAAyF;AAClH,IAAA,OAAO,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;AACjD,IAAA,MAAM,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;AAChD,IAAA,MAAM,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;AAChD,IAAA,KAAK,EAAE,EAAE,S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d;AAEA;AACM,SAAU,UAAU,CAAC,QAAgB,EAAE,SAAiB,EAAE,QAAQ,GAAG,IAAI,EAAA;IAC7E,IAAI,SAAS,IAAI,CAAC;AAAE,QAAA,OAAO,CAAC;AAC5B,IAAA,MAAM,IAAI,GAAG,QAAQ,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC;IAClC,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC;IAC5B,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,QAAQ,IAAI,SAAS,GAAG,CAAC,CAAC,CAAC,GAAG,SAAS;AACtE;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"spring-Dp5BllPB.cjs","sources":["../../src/components/physics/spring.ts"],"sourcesContent":["import { prefersReducedMotion, motionScale, raf, caf, now, applyFrame, EASE_SPRING } from '../base';\n\n/**\n * Spring physics core (v2.3). A damped harmonic oscillator integrated in\n * 1 ms steps: `stiffness` (k, N/m), `damping` (c) and `mass` (m). Used by\n * the `<usa-spring>`, `<usa-draggable>` and `<usa-overscroll>` elements and\n * exported for your own animations:\n *\n * - `springEasing()` turns a spring into a CSS `linear()` easing + duration\n * for WAAPI / CSS (falls back to a cubic-bezier overshoot where `linear()`\n * is unsupported);\n * - `spring(el, keyframes, cfg)` animates with it;\n * - `createSpring()` is an interruptible, velocity-preserving value for\n * gestures (drag, inertia, snap).\n */\nexport interface SpringConfig {\n /** Spring stiffness (default 170). Higher = faster, snappier. */\n stiffness?: number;\n /** Damping / friction (default 26). Lower = more bounces. */\n damping?: number;\n /** Mass (default 1). Higher = slower, heavier. */\n mass?: number;\n /** Initial velocity in progress units per second (default 0). */\n velocity?: number;\n /** Rest threshold (default 0.001). */\n precision?: number;\n}\n\nexport type SpringPreset = 'default' | 'gentle' | 'wobbly' | 'stiff' | 'bouncy' | 'slow' | 'molasses';\n\nexport const SPRING_PRESETS: Record<SpringPreset, Required<Pick<SpringConfig, 'stiffness' | 'damping' | 'mass'>>> = {\n default: { stiffness: 170, damping: 26, mass: 1 },\n gentle: { stiffness: 120, damping: 14, mass: 1 },\n wobbly: { stiffness: 180, damping: 12, mass: 1 },\n stiff: { stiffness: 210, damping: 20, mass: 1 },\n bouncy: { stiffness: 300, damping: 10, mass: 1 },\n slow: { stiffness: 280, damping: 60, mass: 1 },\n molasses: { stiffness: 280, damping: 120, mass: 1 },\n};\n\nexport type SpringInput = SpringPreset | SpringConfig | string | undefined;\n\n/** Resolve a preset name or a partial config to a full config. */\nexport function resolveSpring(input?: SpringInput): Required<SpringConfig> {\n const base = typeof input === 'string' ? SPRING_PRESETS[input as SpringPreset] || SPRING_PRESETS.default : { ...SPRING_PRESETS.default, ...(input || {}) };\n const pos = (v: unknown, d: number) => (typeof v === 'number' && Number.isFinite(v) && v > 0 ? v : d);\n const o = (typeof input === 'object' && input) || {};\n return {\n stiffness: pos(base.stiffness, 170),\n damping: Math.max(0, Number.isFinite(base.damping) ? base.damping : 26),\n mass: pos(base.mass, 1),\n velocity: Number.isFinite(o.velocity) ? (o.velocity as number) : 0,\n precision: pos(o.precision, 0.001),\n };\n}\n\n/** One integration step (semi-implicit Euler) towards `to`. Returns [x, v]. */\nexport function stepSpring(cfg: Required<SpringConfig>, x: number, v: number, to: number, dt: number): [number, number] {\n const a = (-cfg.stiffness * (x - to) - cfg.damping * v) / cfg.mass;\n const nv = v + a * dt;\n return [x + nv * dt, nv];\n}\n\nconst cache = new Map<string, { values: number[]; duration: number }>();\n\n/**\n * Sample the spring from 0 to 1 at `fps` (default 60). `values` may exceed 1\n * (overshoot); `duration` is the time to rest, in ms (max 10 s).\n */\nexport function springSamples(input?: SpringInput, fps = 60): { values: number[]; duration: number } {\n const cfg = resolveSpring(input);\n const key = `${cfg.stiffness}|${cfg.damping}|${cfg.mass}|${cfg.velocity}|${cfg.precision}|${fps}`;\n const hit = cache.get(key);\n if (hit) return hit;\n const values = [0];\n let x = 0;\n let v = cfg.velocity;\n const frame = 1000 / fps;\n let t = 0;\n let next = frame;\n while (t < 10000) {\n [x, v] = stepSpring(cfg, x, v, 1, 0.001);\n t += 1;\n if (t >= next) {\n values.push(x);\n next += frame;\n if (Math.abs(1 - x) < cfg.precision && Math.abs(v) < cfg.precision * 10) break;\n }\n }\n values[values.length - 1] = 1;\n const out = { values, duration: Math.round(t) };\n if (cache.size > 64) cache.clear();\n cache.set(key, out);\n return out;\n}\n\n/** `true` when CSS `linear()` easing is supported. */\nexport function supportsLinearEasing(): boolean {\n return typeof CSS !== 'undefined' && typeof CSS.supports === 'function' && CSS.supports('animation-timing-function', 'linear(0, 1)');\n}\n\n/**\n * The spring as `{ easing, duration }` for `el.animate()` / CSS. `easing` is\n * a `linear(…)` function with at most `points` stops (default 48), or a\n * cubic-bezier overshoot where `linear()` is unsupported.\n */\nexport function springEasing(input?: SpringInput, points = 48): { easing: string; duration: number } {\n const { values, duration } = springSamples(input);\n if (!supportsLinearEasing()) return { easing: EASE_SPRING, duration: Math.min(duration, 1200) };\n return { easing: linearEasing(values, points), duration };\n}\n\n/** Build a CSS `linear()` easing from samples (down-sampled to `points`). */\nexport function linearEasing(values: number[], points = 48): string {\n const n = values.length;\n const step = Math.max(1, Math.ceil((n - 1) / Math.max(2, points - 1)));\n const out: string[] = [];\n for (let i = 0; i < n - 1; i += step) out.push(String(Math.round(values[i] * 1000) / 1000));\n out.push('1');\n return `linear(${out.join(', ')})`;\n}\n\n/**\n * Animate `el` between keyframes with spring timing (WAAPI). Under reduced\n * motion the final frame is applied immediately. Returns the Animation (or\n * `null` without WAAPI / under reduced motion).\n */\nexport function spring(el: Element, keyframes: Keyframe[], input?: SpringInput, options: KeyframeAnimationOptions = {}): Animation | null {\n const target = el as HTMLElement;\n if (prefersReducedMotion() || typeof target.animate !== 'function') {\n applyFrame(target, keyframes[keyframes.length - 1]);\n return null;\n }\n const { easing, duration } = springEasing(input);\n return target.animate(keyframes, { duration: duration * motionScale(), easing, fill: 'both', ...options });\n}\n\n/* ------------------------------------------------------------------ */\n/* Interactive springs */\n/* ------------------------------------------------------------------ */\n\nexport interface SpringValueOptions {\n /** Start value (default 0). */\n value?: number;\n /** Spring config or preset (default `'default'`). */\n spring?: SpringInput;\n /** Called with the value every frame (and on `jump()`). */\n onUpdate?: (value: number, velocity: number) => void;\n /** Called when the value comes to rest at its target. */\n onRest?: (value: number) => void;\n}\n\nexport interface SpringValue {\n readonly value: number;\n /** Units per second. */\n readonly velocity: number;\n readonly target: number;\n readonly animating: boolean;\n /** Animate to `target`, optionally with a new initial velocity (units/s). */\n set(target: number, velocity?: number): void;\n /** Jump to `value` with no animation. */\n jump(value: number): void;\n /** Stop where it is. */\n stop(): void;\n /** Change the spring config. */\n configure(spring: SpringInput): void;\n}\n\n/**\n * An interruptible spring-animated number: call `set()` as often as you like,\n * the motion keeps its velocity (like iOS / Framer springs). Reduced motion\n * jumps straight to the target.\n */\nexport function createSpring(opts: SpringValueOptions = {}): SpringValue {\n let cfg = resolveSpring(opts.spring);\n let x = opts.value ?? 0;\n let v = 0;\n let to = x;\n let id = 0;\n let last = 0;\n let running = false;\n const stop = () => {\n if (running) caf(id);\n running = false;\n };\n const loop = () => {\n const t = now();\n let dt = Math.min(64, Math.max(1, t - last));\n last = t;\n while (dt > 0) {\n const s = Math.min(dt, 4);\n [x, v] = stepSpring(cfg, x, v, to, s / 1000);\n dt -= s;\n }\n const scale = Math.max(1, Math.abs(to) * 0.0005);\n if (Math.abs(to - x) < cfg.precision * scale * 10 && Math.abs(v) < cfg.precision * scale * 100) {\n x = to;\n v = 0;\n running = false;\n opts.onUpdate?.(x, 0);\n opts.onRest?.(x);\n return;\n }\n opts.onUpdate?.(x, v);\n id = raf(loop);\n };\n const api: SpringValue = {\n get value() {\n return x;\n },\n get velocity() {\n return v;\n },\n get target() {\n return to;\n },\n get animating() {\n return running;\n },\n set(target, velocity) {\n to = target;\n if (velocity !== undefined && Number.isFinite(velocity)) v = velocity;\n if (prefersReducedMotion()) {\n api.jump(target);\n opts.onRest?.(target);\n return;\n }\n if (!running) {\n running = true;\n last = now();\n id = raf(loop);\n }\n },\n jump(value) {\n stop();\n x = to = value;\n v = 0;\n opts.onUpdate?.(x, 0);\n },\n stop() {\n stop();\n v = 0;\n to = x;\n },\n configure(input) {\n cfg = resolveSpring(input);\n },\n };\n return api;\n}\n\n/* ------------------------------------------------------------------ */\n/* Inertia + snapping */\n/* ------------------------------------------------------------------ */\n\n/**\n * Where a flick at `velocity` (units/s) comes to rest with exponential\n * decay: `value + velocity · timeConstant` (default 0.325 s, iOS-like).\n */\nexport function projectInertia(value: number, velocity: number, timeConstant = 0.325): number {\n return value + velocity * timeConstant;\n}\n\n/** Snap to a grid (`number`) or the nearest of a list of points. */\nexport function snapTo(value: number, to: number | number[] | null | undefined): number {\n if (Array.isArray(to)) {\n if (!to.length) return value;\n return to.reduce((best, p) => (Math.abs(p - value) < Math.abs(best - value) ? p : best), to[0]);\n }\n if (typeof to === 'number' && to > 0) return Math.round(value / to) * to;\n return value;\n}\n\n/** iOS-style rubber-band resistance: how far content moves when pulled `distance` past an edge. */\nexport function rubberBand(distance: number, dimension: number, constant = 0.55): number {\n if (dimension <= 0) return 0;\n const sign = distance < 0 ? -1 : 1;\n const d = Math.abs(distance);\n return sign * (1 - 1 / ((d * constant) / dimension + 1)) * dimension;\n}\n"],"names":["EASE_SPRING","prefersReducedMotion","applyFrame","motionScale","caf","now","raf"],"mappings":";;;;AA8BO,MAAM,cAAc,GAAyF;AAClH,IAAA,OAAO,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;AACjD,IAAA,MAAM,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;AAChD,IAAA,MAAM,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;AAChD,IAAA,KAAK,EAAE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KAAK;AACd;AAEA;AACM,SAAU,UAAU,CAAC,QAAgB,EAAE,SAAiB,EAAE,QAAQ,GAAG,IAAI,EAAA;IAC7E,IAAI,SAAS,IAAI,CAAC;AAAE,QAAA,OAAO,CAAC;AAC5B,IAAA,MAAM,IAAI,GAAG,QAAQ,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC;IAClC,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC;IAC5B,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,QAAQ,IAAI,SAAS,GAAG,CAAC,CAAC,CAAC,GAAG,SAAS;AACtE;;;;;;;;;;;;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as prefersReducedMotion, d as applyFrame, m as motionScale, E as EASE_SPRING, n as now, r as raf, e as caf } from './base-
|
|
1
|
+
import { p as prefersReducedMotion, d as applyFrame, m as motionScale, E as EASE_SPRING, n as now, r as raf, e as caf } from './base-BRIPyPtX.js';
|
|
2
2
|
|
|
3
3
|
const SPRING_PRESETS = {
|
|
4
4
|
default: { stiffness: 170, damping: 26, mass: 1 },
|
|
@@ -216,4 +216,4 @@ function rubberBand(distance, dimension, constant = 0.55) {
|
|
|
216
216
|
}
|
|
217
217
|
|
|
218
218
|
export { SPRING_PRESETS as S, rubberBand as a, spring as b, createSpring as c, springEasing as d, springSamples as e, stepSpring as f, supportsLinearEasing as g, linearEasing as l, projectInertia as p, resolveSpring as r, snapTo as s };
|
|
219
|
-
//# sourceMappingURL=spring-
|
|
219
|
+
//# sourceMappingURL=spring-UBPhrh1X.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spring-C-fw7_9f.js","sources":["../../src/components/physics/spring.ts"],"sourcesContent":["import { prefersReducedMotion, motionScale, raf, caf, now, applyFrame, EASE_SPRING } from '../base';\n\n/**\n * Spring physics core (v2.3). A damped harmonic oscillator integrated in\n * 1 ms steps: `stiffness` (k, N/m), `damping` (c) and `mass` (m). Used by\n * the `<usa-spring>`, `<usa-draggable>` and `<usa-overscroll>` elements and\n * exported for your own animations:\n *\n * - `springEasing()` turns a spring into a CSS `linear()` easing + duration\n * for WAAPI / CSS (falls back to a cubic-bezier overshoot where `linear()`\n * is unsupported);\n * - `spring(el, keyframes, cfg)` animates with it;\n * - `createSpring()` is an interruptible, velocity-preserving value for\n * gestures (drag, inertia, snap).\n */\nexport interface SpringConfig {\n /** Spring stiffness (default 170). Higher = faster, snappier. */\n stiffness?: number;\n /** Damping / friction (default 26). Lower = more bounces. */\n damping?: number;\n /** Mass (default 1). Higher = slower, heavier. */\n mass?: number;\n /** Initial velocity in progress units per second (default 0). */\n velocity?: number;\n /** Rest threshold (default 0.001). */\n precision?: number;\n}\n\nexport type SpringPreset = 'default' | 'gentle' | 'wobbly' | 'stiff' | 'bouncy' | 'slow' | 'molasses';\n\nexport const SPRING_PRESETS: Record<SpringPreset, Required<Pick<SpringConfig, 'stiffness' | 'damping' | 'mass'>>> = {\n default: { stiffness: 170, damping: 26, mass: 1 },\n gentle: { stiffness: 120, damping: 14, mass: 1 },\n wobbly: { stiffness: 180, damping: 12, mass: 1 },\n stiff: { stiffness: 210, damping: 20, mass: 1 },\n bouncy: { stiffness: 300, damping: 10, mass: 1 },\n slow: { stiffness: 280, damping: 60, mass: 1 },\n molasses: { stiffness: 280, damping: 120, mass: 1 },\n};\n\nexport type SpringInput = SpringPreset | SpringConfig | string | undefined;\n\n/** Resolve a preset name or a partial config to a full config. */\nexport function resolveSpring(input?: SpringInput): Required<SpringConfig> {\n const base = typeof input === 'string' ? SPRING_PRESETS[input as SpringPreset] || SPRING_PRESETS.default : { ...SPRING_PRESETS.default, ...(input || {}) };\n const pos = (v: unknown, d: number) => (typeof v === 'number' && Number.isFinite(v) && v > 0 ? v : d);\n const o = (typeof input === 'object' && input) || {};\n return {\n stiffness: pos(base.stiffness, 170),\n damping: Math.max(0, Number.isFinite(base.damping) ? base.damping : 26),\n mass: pos(base.mass, 1),\n velocity: Number.isFinite(o.velocity) ? (o.velocity as number) : 0,\n precision: pos(o.precision, 0.001),\n };\n}\n\n/** One integration step (semi-implicit Euler) towards `to`. Returns [x, v]. */\nexport function stepSpring(cfg: Required<SpringConfig>, x: number, v: number, to: number, dt: number): [number, number] {\n const a = (-cfg.stiffness * (x - to) - cfg.damping * v) / cfg.mass;\n const nv = v + a * dt;\n return [x + nv * dt, nv];\n}\n\nconst cache = new Map<string, { values: number[]; duration: number }>();\n\n/**\n * Sample the spring from 0 to 1 at `fps` (default 60). `values` may exceed 1\n * (overshoot); `duration` is the time to rest, in ms (max 10 s).\n */\nexport function springSamples(input?: SpringInput, fps = 60): { values: number[]; duration: number } {\n const cfg = resolveSpring(input);\n const key = `${cfg.stiffness}|${cfg.damping}|${cfg.mass}|${cfg.velocity}|${cfg.precision}|${fps}`;\n const hit = cache.get(key);\n if (hit) return hit;\n const values = [0];\n let x = 0;\n let v = cfg.velocity;\n const frame = 1000 / fps;\n let t = 0;\n let next = frame;\n while (t < 10000) {\n [x, v] = stepSpring(cfg, x, v, 1, 0.001);\n t += 1;\n if (t >= next) {\n values.push(x);\n next += frame;\n if (Math.abs(1 - x) < cfg.precision && Math.abs(v) < cfg.precision * 10) break;\n }\n }\n values[values.length - 1] = 1;\n const out = { values, duration: Math.round(t) };\n if (cache.size > 64) cache.clear();\n cache.set(key, out);\n return out;\n}\n\n/** `true` when CSS `linear()` easing is supported. */\nexport function supportsLinearEasing(): boolean {\n return typeof CSS !== 'undefined' && typeof CSS.supports === 'function' && CSS.supports('animation-timing-function', 'linear(0, 1)');\n}\n\n/**\n * The spring as `{ easing, duration }` for `el.animate()` / CSS. `easing` is\n * a `linear(…)` function with at most `points` stops (default 48), or a\n * cubic-bezier overshoot where `linear()` is unsupported.\n */\nexport function springEasing(input?: SpringInput, points = 48): { easing: string; duration: number } {\n const { values, duration } = springSamples(input);\n if (!supportsLinearEasing()) return { easing: EASE_SPRING, duration: Math.min(duration, 1200) };\n return { easing: linearEasing(values, points), duration };\n}\n\n/** Build a CSS `linear()` easing from samples (down-sampled to `points`). */\nexport function linearEasing(values: number[], points = 48): string {\n const n = values.length;\n const step = Math.max(1, Math.ceil((n - 1) / Math.max(2, points - 1)));\n const out: string[] = [];\n for (let i = 0; i < n - 1; i += step) out.push(String(Math.round(values[i] * 1000) / 1000));\n out.push('1');\n return `linear(${out.join(', ')})`;\n}\n\n/**\n * Animate `el` between keyframes with spring timing (WAAPI). Under reduced\n * motion the final frame is applied immediately. Returns the Animation (or\n * `null` without WAAPI / under reduced motion).\n */\nexport function spring(el: Element, keyframes: Keyframe[], input?: SpringInput, options: KeyframeAnimationOptions = {}): Animation | null {\n const target = el as HTMLElement;\n if (prefersReducedMotion() || typeof target.animate !== 'function') {\n applyFrame(target, keyframes[keyframes.length - 1]);\n return null;\n }\n const { easing, duration } = springEasing(input);\n return target.animate(keyframes, { duration: duration * motionScale(), easing, fill: 'both', ...options });\n}\n\n/* ------------------------------------------------------------------ */\n/* Interactive springs */\n/* ------------------------------------------------------------------ */\n\nexport interface SpringValueOptions {\n /** Start value (default 0). */\n value?: number;\n /** Spring config or preset (default `'default'`). */\n spring?: SpringInput;\n /** Called with the value every frame (and on `jump()`). */\n onUpdate?: (value: number, velocity: number) => void;\n /** Called when the value comes to rest at its target. */\n onRest?: (value: number) => void;\n}\n\nexport interface SpringValue {\n readonly value: number;\n /** Units per second. */\n readonly velocity: number;\n readonly target: number;\n readonly animating: boolean;\n /** Animate to `target`, optionally with a new initial velocity (units/s). */\n set(target: number, velocity?: number): void;\n /** Jump to `value` with no animation. */\n jump(value: number): void;\n /** Stop where it is. */\n stop(): void;\n /** Change the spring config. */\n configure(spring: SpringInput): void;\n}\n\n/**\n * An interruptible spring-animated number: call `set()` as often as you like,\n * the motion keeps its velocity (like iOS / Framer springs). Reduced motion\n * jumps straight to the target.\n */\nexport function createSpring(opts: SpringValueOptions = {}): SpringValue {\n let cfg = resolveSpring(opts.spring);\n let x = opts.value ?? 0;\n let v = 0;\n let to = x;\n let id = 0;\n let last = 0;\n let running = false;\n const stop = () => {\n if (running) caf(id);\n running = false;\n };\n const loop = () => {\n const t = now();\n let dt = Math.min(64, Math.max(1, t - last));\n last = t;\n while (dt > 0) {\n const s = Math.min(dt, 4);\n [x, v] = stepSpring(cfg, x, v, to, s / 1000);\n dt -= s;\n }\n const scale = Math.max(1, Math.abs(to) * 0.0005);\n if (Math.abs(to - x) < cfg.precision * scale * 10 && Math.abs(v) < cfg.precision * scale * 100) {\n x = to;\n v = 0;\n running = false;\n opts.onUpdate?.(x, 0);\n opts.onRest?.(x);\n return;\n }\n opts.onUpdate?.(x, v);\n id = raf(loop);\n };\n const api: SpringValue = {\n get value() {\n return x;\n },\n get velocity() {\n return v;\n },\n get target() {\n return to;\n },\n get animating() {\n return running;\n },\n set(target, velocity) {\n to = target;\n if (velocity !== undefined && Number.isFinite(velocity)) v = velocity;\n if (prefersReducedMotion()) {\n api.jump(target);\n opts.onRest?.(target);\n return;\n }\n if (!running) {\n running = true;\n last = now();\n id = raf(loop);\n }\n },\n jump(value) {\n stop();\n x = to = value;\n v = 0;\n opts.onUpdate?.(x, 0);\n },\n stop() {\n stop();\n v = 0;\n to = x;\n },\n configure(input) {\n cfg = resolveSpring(input);\n },\n };\n return api;\n}\n\n/* ------------------------------------------------------------------ */\n/* Inertia + snapping */\n/* ------------------------------------------------------------------ */\n\n/**\n * Where a flick at `velocity` (units/s) comes to rest with exponential\n * decay: `value + velocity · timeConstant` (default 0.325 s, iOS-like).\n */\nexport function projectInertia(value: number, velocity: number, timeConstant = 0.325): number {\n return value + velocity * timeConstant;\n}\n\n/** Snap to a grid (`number`) or the nearest of a list of points. */\nexport function snapTo(value: number, to: number | number[] | null | undefined): number {\n if (Array.isArray(to)) {\n if (!to.length) return value;\n return to.reduce((best, p) => (Math.abs(p - value) < Math.abs(best - value) ? p : best), to[0]);\n }\n if (typeof to === 'number' && to > 0) return Math.round(value / to) * to;\n return value;\n}\n\n/** iOS-style rubber-band resistance: how far content moves when pulled `distance` past an edge. */\nexport function rubberBand(distance: number, dimension: number, constant = 0.55): number {\n if (dimension <= 0) return 0;\n const sign = distance < 0 ? -1 : 1;\n const d = Math.abs(distance);\n return sign * (1 - 1 / ((d * constant) / dimension + 1)) * dimension;\n}\n"],"names":[],"mappings":";;AA8BO,MAAM,cAAc,GAAyF;AAClH,IAAA,OAAO,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;AACjD,IAAA,MAAM,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;AAChD,IAAA,MAAM,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;AAChD,IAAA,KAAK,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;AAC/C,IAAA,MAAM,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;AAChD,IAAA,IAAI,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;AAC9C,IAAA,QAAQ,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE;;AAKrD;AACM,SAAU,aAAa,CAAC,KAAmB,EAAA;AAC/C,IAAA,MAAM,IAAI,GAAG,OAAO,KAAK,KAAK,QAAQ,GAAG,cAAc,CAAC,KAAqB,CAAC,IAAI,cAAc,CAAC,OAAO,GAAG,EAAE,GAAG,cAAc,CAAC,OAAO,EAAE,IAAI,KAAK,IAAI,EAAE,CAAC,EAAE;AAC1J,IAAA,MAAM,GAAG,GAAG,CAAC,CAAU,EAAE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KAAa,EAAE,EAAwC,EAAA;AAC5E,IAAA,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;QACrB,IAAI,CAAC,EAAE,CAAC,MAAM;AAAE,YAAA,OAAO,KAAK;QAC5B,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;IACjG;AACA,IAAA,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,EAAE,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC,GAAG,EAAE;AACxE,IAAA,OAAO,KAAK;AACd;AAEA;AACM,SAAU,UAAU,CAAC,QAAgB,EAAE,SAAiB,EAAE,QAAQ,GAAG,IAAI,EAAA;IAC7E,IAAI,SAAS,IAAI,CAAC;AAAE,QAAA,OAAO,CAAC;AAC5B,IAAA,MAAM,IAAI,GAAG,QAAQ,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC;IAClC,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC;IAC5B,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,QAAQ,IAAI,SAAS,GAAG,CAAC,CAAC,CAAC,GAAG,SAAS;AACtE;;;;"}
|
|
1
|
+
{"version":3,"file":"spring-UBPhrh1X.js","sources":["../../src/components/physics/spring.ts"],"sourcesContent":["import { prefersReducedMotion, motionScale, raf, caf, now, applyFrame, EASE_SPRING } from '../base';\n\n/**\n * Spring physics core (v2.3). A damped harmonic oscillator integrated in\n * 1 ms steps: `stiffness` (k, N/m), `damping` (c) and `mass` (m). Used by\n * the `<usa-spring>`, `<usa-draggable>` and `<usa-overscroll>` elements and\n * exported for your own animations:\n *\n * - `springEasing()` turns a spring into a CSS `linear()` easing + duration\n * for WAAPI / CSS (falls back to a cubic-bezier overshoot where `linear()`\n * is unsupported);\n * - `spring(el, keyframes, cfg)` animates with it;\n * - `createSpring()` is an interruptible, velocity-preserving value for\n * gestures (drag, inertia, snap).\n */\nexport interface SpringConfig {\n /** Spring stiffness (default 170). Higher = faster, snappier. */\n stiffness?: number;\n /** Damping / friction (default 26). Lower = more bounces. */\n damping?: number;\n /** Mass (default 1). Higher = slower, heavier. */\n mass?: number;\n /** Initial velocity in progress units per second (default 0). */\n velocity?: number;\n /** Rest threshold (default 0.001). */\n precision?: number;\n}\n\nexport type SpringPreset = 'default' | 'gentle' | 'wobbly' | 'stiff' | 'bouncy' | 'slow' | 'molasses';\n\nexport const SPRING_PRESETS: Record<SpringPreset, Required<Pick<SpringConfig, 'stiffness' | 'damping' | 'mass'>>> = {\n default: { stiffness: 170, damping: 26, mass: 1 },\n gentle: { stiffness: 120, damping: 14, mass: 1 },\n wobbly: { stiffness: 180, damping: 12, mass: 1 },\n stiff: { stiffness: 210, damping: 20, mass: 1 },\n bouncy: { stiffness: 300, damping: 10, mass: 1 },\n slow: { stiffness: 280, damping: 60, mass: 1 },\n molasses: { stiffness: 280, damping: 120, mass: 1 },\n};\n\nexport type SpringInput = SpringPreset | SpringConfig | string | undefined;\n\n/** Resolve a preset name or a partial config to a full config. */\nexport function resolveSpring(input?: SpringInput): Required<SpringConfig> {\n const base = typeof input === 'string' ? SPRING_PRESETS[input as SpringPreset] || SPRING_PRESETS.default : { ...SPRING_PRESETS.default, ...(input || {}) };\n const pos = (v: unknown, d: number) => (typeof v === 'number' && Number.isFinite(v) && v > 0 ? v : d);\n const o = (typeof input === 'object' && input) || {};\n return {\n stiffness: pos(base.stiffness, 170),\n damping: Math.max(0, Number.isFinite(base.damping) ? base.damping : 26),\n mass: pos(base.mass, 1),\n velocity: Number.isFinite(o.velocity) ? (o.velocity as number) : 0,\n precision: pos(o.precision, 0.001),\n };\n}\n\n/** One integration step (semi-implicit Euler) towards `to`. Returns [x, v]. */\nexport function stepSpring(cfg: Required<SpringConfig>, x: number, v: number, to: number, dt: number): [number, number] {\n const a = (-cfg.stiffness * (x - to) - cfg.damping * v) / cfg.mass;\n const nv = v + a * dt;\n return [x + nv * dt, nv];\n}\n\nconst cache = new Map<string, { values: number[]; duration: number }>();\n\n/**\n * Sample the spring from 0 to 1 at `fps` (default 60). `values` may exceed 1\n * (overshoot); `duration` is the time to rest, in ms (max 10 s).\n */\nexport function springSamples(input?: SpringInput, fps = 60): { values: number[]; duration: number } {\n const cfg = resolveSpring(input);\n const key = `${cfg.stiffness}|${cfg.damping}|${cfg.mass}|${cfg.velocity}|${cfg.precision}|${fps}`;\n const hit = cache.get(key);\n if (hit) return hit;\n const values = [0];\n let x = 0;\n let v = cfg.velocity;\n const frame = 1000 / fps;\n let t = 0;\n let next = frame;\n while (t < 10000) {\n [x, v] = stepSpring(cfg, x, v, 1, 0.001);\n t += 1;\n if (t >= next) {\n values.push(x);\n next += frame;\n if (Math.abs(1 - x) < cfg.precision && Math.abs(v) < cfg.precision * 10) break;\n }\n }\n values[values.length - 1] = 1;\n const out = { values, duration: Math.round(t) };\n if (cache.size > 64) cache.clear();\n cache.set(key, out);\n return out;\n}\n\n/** `true` when CSS `linear()` easing is supported. */\nexport function supportsLinearEasing(): boolean {\n return typeof CSS !== 'undefined' && typeof CSS.supports === 'function' && CSS.supports('animation-timing-function', 'linear(0, 1)');\n}\n\n/**\n * The spring as `{ easing, duration }` for `el.animate()` / CSS. `easing` is\n * a `linear(…)` function with at most `points` stops (default 48), or a\n * cubic-bezier overshoot where `linear()` is unsupported.\n */\nexport function springEasing(input?: SpringInput, points = 48): { easing: string; duration: number } {\n const { values, duration } = springSamples(input);\n if (!supportsLinearEasing()) return { easing: EASE_SPRING, duration: Math.min(duration, 1200) };\n return { easing: linearEasing(values, points), duration };\n}\n\n/** Build a CSS `linear()` easing from samples (down-sampled to `points`). */\nexport function linearEasing(values: number[], points = 48): string {\n const n = values.length;\n const step = Math.max(1, Math.ceil((n - 1) / Math.max(2, points - 1)));\n const out: string[] = [];\n for (let i = 0; i < n - 1; i += step) out.push(String(Math.round(values[i] * 1000) / 1000));\n out.push('1');\n return `linear(${out.join(', ')})`;\n}\n\n/**\n * Animate `el` between keyframes with spring timing (WAAPI). Under reduced\n * motion the final frame is applied immediately. Returns the Animation (or\n * `null` without WAAPI / under reduced motion).\n */\nexport function spring(el: Element, keyframes: Keyframe[], input?: SpringInput, options: KeyframeAnimationOptions = {}): Animation | null {\n const target = el as HTMLElement;\n if (prefersReducedMotion() || typeof target.animate !== 'function') {\n applyFrame(target, keyframes[keyframes.length - 1]);\n return null;\n }\n const { easing, duration } = springEasing(input);\n return target.animate(keyframes, { duration: duration * motionScale(), easing, fill: 'both', ...options });\n}\n\n/* ------------------------------------------------------------------ */\n/* Interactive springs */\n/* ------------------------------------------------------------------ */\n\nexport interface SpringValueOptions {\n /** Start value (default 0). */\n value?: number;\n /** Spring config or preset (default `'default'`). */\n spring?: SpringInput;\n /** Called with the value every frame (and on `jump()`). */\n onUpdate?: (value: number, velocity: number) => void;\n /** Called when the value comes to rest at its target. */\n onRest?: (value: number) => void;\n}\n\nexport interface SpringValue {\n readonly value: number;\n /** Units per second. */\n readonly velocity: number;\n readonly target: number;\n readonly animating: boolean;\n /** Animate to `target`, optionally with a new initial velocity (units/s). */\n set(target: number, velocity?: number): void;\n /** Jump to `value` with no animation. */\n jump(value: number): void;\n /** Stop where it is. */\n stop(): void;\n /** Change the spring config. */\n configure(spring: SpringInput): void;\n}\n\n/**\n * An interruptible spring-animated number: call `set()` as often as you like,\n * the motion keeps its velocity (like iOS / Framer springs). Reduced motion\n * jumps straight to the target.\n */\nexport function createSpring(opts: SpringValueOptions = {}): SpringValue {\n let cfg = resolveSpring(opts.spring);\n let x = opts.value ?? 0;\n let v = 0;\n let to = x;\n let id = 0;\n let last = 0;\n let running = false;\n const stop = () => {\n if (running) caf(id);\n running = false;\n };\n const loop = () => {\n const t = now();\n let dt = Math.min(64, Math.max(1, t - last));\n last = t;\n while (dt > 0) {\n const s = Math.min(dt, 4);\n [x, v] = stepSpring(cfg, x, v, to, s / 1000);\n dt -= s;\n }\n const scale = Math.max(1, Math.abs(to) * 0.0005);\n if (Math.abs(to - x) < cfg.precision * scale * 10 && Math.abs(v) < cfg.precision * scale * 100) {\n x = to;\n v = 0;\n running = false;\n opts.onUpdate?.(x, 0);\n opts.onRest?.(x);\n return;\n }\n opts.onUpdate?.(x, v);\n id = raf(loop);\n };\n const api: SpringValue = {\n get value() {\n return x;\n },\n get velocity() {\n return v;\n },\n get target() {\n return to;\n },\n get animating() {\n return running;\n },\n set(target, velocity) {\n to = target;\n if (velocity !== undefined && Number.isFinite(velocity)) v = velocity;\n if (prefersReducedMotion()) {\n api.jump(target);\n opts.onRest?.(target);\n return;\n }\n if (!running) {\n running = true;\n last = now();\n id = raf(loop);\n }\n },\n jump(value) {\n stop();\n x = to = value;\n v = 0;\n opts.onUpdate?.(x, 0);\n },\n stop() {\n stop();\n v = 0;\n to = x;\n },\n configure(input) {\n cfg = resolveSpring(input);\n },\n };\n return api;\n}\n\n/* ------------------------------------------------------------------ */\n/* Inertia + snapping */\n/* ------------------------------------------------------------------ */\n\n/**\n * Where a flick at `velocity` (units/s) comes to rest with exponential\n * decay: `value + velocity · timeConstant` (default 0.325 s, iOS-like).\n */\nexport function projectInertia(value: number, velocity: number, timeConstant = 0.325): number {\n return value + velocity * timeConstant;\n}\n\n/** Snap to a grid (`number`) or the nearest of a list of points. */\nexport function snapTo(value: number, to: number | number[] | null | undefined): number {\n if (Array.isArray(to)) {\n if (!to.length) return value;\n return to.reduce((best, p) => (Math.abs(p - value) < Math.abs(best - value) ? p : best), to[0]);\n }\n if (typeof to === 'number' && to > 0) return Math.round(value / to) * to;\n return value;\n}\n\n/** iOS-style rubber-band resistance: how far content moves when pulled `distance` past an edge. */\nexport function rubberBand(distance: number, dimension: number, constant = 0.55): number {\n if (dimension <= 0) return 0;\n const sign = distance < 0 ? -1 : 1;\n const d = Math.abs(distance);\n return sign * (1 - 1 / ((d * constant) / dimension + 1)) * dimension;\n}\n"],"names":[],"mappings":";;AA8BO,MAAM,cAAc,GAAyF;AAClH,IAAA,OAAO,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;AACjD,IAAA,MAAM,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;AAChD,IAAA,MAAM,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;AAChD,IAAA,KAAK,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;AAC/C,IAAA,MAAM,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;AAChD,IAAA,IAAI,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;AAC9C,IAAA,QAAQ,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE;;AAKrD;AACM,SAAU,aAAa,CAAC,KAAmB,EAAA;AAC/C,IAAA,MAAM,IAAI,GAAG,OAAO,KAAK,KAAK,QAAQ,GAAG,cAAc,CAAC,KAAqB,CAAC,IAAI,cAAc,CAAC,OAAO,GAAG,EAAE,GAAG,cAAc,CAAC,OAAO,EAAE,IAAI,KAAK,IAAI,EAAE,CAAC,EAAE;AAC1J,IAAA,MAAM,GAAG,GAAG,CAAC,CAAU,EAAE,CAAS,MAAM,OAAO,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,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AAE,CAAC,EAAE;QACrB,IAAI,CAAC,EAAE,CAAC,MAAM;AAAE,YAAA,OAAO,KAAK;QAC5B,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;IACjG;AACA,IAAA,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,EAAE,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC,GAAG,EAAE;AACxE,IAAA,OAAO,KAAK;AACd;AAEA;AACM,SAAU,UAAU,CAAC,QAAgB,EAAE,SAAiB,EAAE,QAAQ,GAAG,IAAI,EAAA;IAC7E,IAAI,SAAS,IAAI,CAAC;AAAE,QAAA,OAAO,CAAC;AAC5B,IAAA,MAAM,IAAI,GAAG,QAAQ,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC;IAClC,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC;IAC5B,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,QAAQ,IAAI,SAAS,GAAG,CAAC,CAAC,CAAC,GAAG,SAAS;AACtE;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as adoptStyles } from './base-
|
|
1
|
+
import { f as adoptStyles } from './base-BRIPyPtX.js';
|
|
2
2
|
|
|
3
3
|
var css = ":root{--usa-accent:#7c5cff;--usa-accent-text:#fff;--usa-surface:#1b1e27;--usa-text:inherit;--usa-radius:14px;--usa-border:1px solid rgb(127 127 127 / 0.25);--usa-shadow:0 10px 30px -12px rgb(0 0 0 / 0.45);--usa-blur:0px;--usa-font:inherit}:where([variant=\"minimal\"],[data-usa-variant=\"minimal\"]){--usa-accent:currentColor;--usa-accent-text:Canvas;--usa-surface:transparent;--usa-radius:6px;--usa-border:1px solid color-mix(in srgb,currentColor 22%,transparent);--usa-shadow:none;--usa-blur:0px}:where([variant=\"neon\"],[data-usa-variant=\"neon\"]){--usa-accent:#00f0ff;--usa-accent-text:#04121a;--usa-surface:#0a0b14;--usa-text:#e6fbff;--usa-radius:10px;--usa-border:1px solid #00f0ff;--usa-shadow:0 0 6px #00f0ff,0 0 22px rgb(0 240 255 / 0.45);--usa-blur:0px}:where([variant=\"glass\"],[data-usa-variant=\"glass\"]){--usa-accent:#a78bfa;--usa-accent-text:#fff;--usa-surface:rgb(255 255 255 / 0.12);--usa-radius:18px;--usa-border:1px solid rgb(255 255 255 / 0.28);--usa-shadow:0 12px 40px -12px rgb(0 0 0 / 0.35);--usa-blur:16px}:where([variant=\"brutalist\"],[data-usa-variant=\"brutalist\"]){--usa-accent:#ff3d00;--usa-accent-text:#000;--usa-surface:#fff;--usa-text:#000;--usa-radius:0px;--usa-border:3px solid #000;--usa-shadow:5px 5px 0 #000;--usa-blur:0px;--usa-font:ui-monospace,\"SFMono-Regular\",Menlo,monospace}:where([variant=\"fluent\"],[data-usa-variant=\"fluent\"]){--usa-accent:#0067c0;--usa-accent-text:#fff;--usa-surface:rgb(249 249 249 / 0.82);--usa-text:#1a1a1a;--usa-radius:8px;--usa-border:1px solid rgb(0 0 0 / 0.08);--usa-shadow:0 2px 4px rgb(0 0 0 / 0.14),0 0 2px rgb(0 0 0 / 0.12);--usa-blur:30px;--usa-font:\"Segoe UI Variable\",\"Segoe UI\",system-ui,sans-serif}:where([variant=\"material\"],[data-usa-variant=\"material\"]){--usa-accent:#6750a4;--usa-accent-text:#fff;--usa-surface:#fffbfe;--usa-text:#1c1b1f;--usa-radius:20px;--usa-border:0 solid transparent;--usa-shadow:0 1px 3px rgb(0 0 0 / 0.3),0 4px 8px 3px rgb(0 0 0 / 0.15);--usa-blur:0px;--usa-font:Roboto,system-ui,sans-serif}@media (prefers-color-scheme:dark){:where([variant=\"fluent\"],[data-usa-variant=\"fluent\"]){--usa-accent:#4cc2ff;--usa-accent-text:#000;--usa-surface:rgb(44 44 44 / 0.8);--usa-text:#fff;--usa-border:1px solid rgb(255 255 255 / 0.08)}:where([variant=\"material\"],[data-usa-variant=\"material\"]){--usa-accent:#d0bcff;--usa-accent-text:#381e72;--usa-surface:#1c1b1f;--usa-text:#e6e1e5}}.usa-surface{background:var(--usa-surface);color:var(--usa-text);border:var(--usa-border);border-radius:var(--usa-radius);box-shadow:var(--usa-shadow);font-family:var(--usa-font);-webkit-backdrop-filter:blur(var(--usa-blur));backdrop-filter:blur(var(--usa-blur))}@media (prefers-reduced-transparency:reduce){.usa-surface{-webkit-backdrop-filter:none;backdrop-filter:none}}";
|
|
4
4
|
|
|
@@ -32,4 +32,4 @@ function setVariant(variant, root = typeof document !== 'undefined' ? document.d
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
export { VARIANTS as V, adoptVariants as a, setVariant as s };
|
|
35
|
-
//# sourceMappingURL=variants-
|
|
35
|
+
//# sourceMappingURL=variants-DTypaOH3.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variants-
|
|
1
|
+
{"version":3,"file":"variants-DTypaOH3.js","sources":["../../src/components/ui/variants.ts"],"sourcesContent":["import { adoptStyles } from '../base';\nimport css from './variants.css?raw';\n\n/**\n * Style variants (v2.6): `variant=\"minimal | neon | glass | brutalist |\n * fluent | material\"` on any `<usa-*>` element — or on any ancestor as\n * `data-usa-variant`, or page-wide with `setVariant()` — sets the shared\n * design tokens every component reads:\n *\n * `--usa-accent`, `--usa-accent-text`, `--usa-surface`, `--usa-text`,\n * `--usa-radius`, `--usa-border`, `--usa-shadow`, `--usa-blur`, `--usa-font`.\n *\n * (`<usa-spinner>`, `<usa-check>` and `<usa-dialog>` already use `variant`\n * for their kind; the token names never clash with those values except\n * `fluent`, which means the same thing there.)\n */\nexport const VARIANTS = ['minimal', 'neon', 'glass', 'brutalist', 'fluent', 'material'] as const;\nexport type Variant = (typeof VARIANTS)[number];\n\n/** Inject the variant token sheet (done automatically by every `ui` component). */\nexport function adoptVariants(): void {\n adoptStyles('variants', css);\n}\n\n/** Apply a variant to the whole page (or `root`); `null` removes it. */\nexport function setVariant(variant: Variant | null, root: Element | null = typeof document !== 'undefined' ? document.documentElement : null): void {\n if (!root) return;\n adoptVariants();\n if (variant) root.setAttribute('data-usa-variant', variant);\n else root.removeAttribute('data-usa-variant');\n}\n"],"names":[],"mappings":";;;;AAGA;;;;;;;;;;;;AAYG;AACI,MAAM,QAAQ,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU;AAGtF;SACgB,aAAa,GAAA;AAC3B,IAAA,WAAW,CAAC,UAAU,EAAE,GAAG,CAAC;AAC9B;AAEA;SACgB,UAAU,CAAC,OAAuB,EAAE,IAAA,GAAuB,OAAO,QAAQ,KAAK,WAAW,GAAG,QAAQ,CAAC,eAAe,GAAG,IAAI,EAAA;AAC1I,IAAA,IAAI,CAAC,IAAI;QAAE;AACX,IAAA,aAAa,EAAE;AACf,IAAA,IAAI,OAAO;AAAE,QAAA,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE,OAAO,CAAC;;AACtD,QAAA,IAAI,CAAC,eAAe,CAAC,kBAAkB,CAAC;AAC/C;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var base = require('./base-
|
|
3
|
+
var base = require('./base-Dm6ee5ug.cjs');
|
|
4
4
|
|
|
5
5
|
var css = ":root{--usa-accent:#7c5cff;--usa-accent-text:#fff;--usa-surface:#1b1e27;--usa-text:inherit;--usa-radius:14px;--usa-border:1px solid rgb(127 127 127 / 0.25);--usa-shadow:0 10px 30px -12px rgb(0 0 0 / 0.45);--usa-blur:0px;--usa-font:inherit}:where([variant=\"minimal\"],[data-usa-variant=\"minimal\"]){--usa-accent:currentColor;--usa-accent-text:Canvas;--usa-surface:transparent;--usa-radius:6px;--usa-border:1px solid color-mix(in srgb,currentColor 22%,transparent);--usa-shadow:none;--usa-blur:0px}:where([variant=\"neon\"],[data-usa-variant=\"neon\"]){--usa-accent:#00f0ff;--usa-accent-text:#04121a;--usa-surface:#0a0b14;--usa-text:#e6fbff;--usa-radius:10px;--usa-border:1px solid #00f0ff;--usa-shadow:0 0 6px #00f0ff,0 0 22px rgb(0 240 255 / 0.45);--usa-blur:0px}:where([variant=\"glass\"],[data-usa-variant=\"glass\"]){--usa-accent:#a78bfa;--usa-accent-text:#fff;--usa-surface:rgb(255 255 255 / 0.12);--usa-radius:18px;--usa-border:1px solid rgb(255 255 255 / 0.28);--usa-shadow:0 12px 40px -12px rgb(0 0 0 / 0.35);--usa-blur:16px}:where([variant=\"brutalist\"],[data-usa-variant=\"brutalist\"]){--usa-accent:#ff3d00;--usa-accent-text:#000;--usa-surface:#fff;--usa-text:#000;--usa-radius:0px;--usa-border:3px solid #000;--usa-shadow:5px 5px 0 #000;--usa-blur:0px;--usa-font:ui-monospace,\"SFMono-Regular\",Menlo,monospace}:where([variant=\"fluent\"],[data-usa-variant=\"fluent\"]){--usa-accent:#0067c0;--usa-accent-text:#fff;--usa-surface:rgb(249 249 249 / 0.82);--usa-text:#1a1a1a;--usa-radius:8px;--usa-border:1px solid rgb(0 0 0 / 0.08);--usa-shadow:0 2px 4px rgb(0 0 0 / 0.14),0 0 2px rgb(0 0 0 / 0.12);--usa-blur:30px;--usa-font:\"Segoe UI Variable\",\"Segoe UI\",system-ui,sans-serif}:where([variant=\"material\"],[data-usa-variant=\"material\"]){--usa-accent:#6750a4;--usa-accent-text:#fff;--usa-surface:#fffbfe;--usa-text:#1c1b1f;--usa-radius:20px;--usa-border:0 solid transparent;--usa-shadow:0 1px 3px rgb(0 0 0 / 0.3),0 4px 8px 3px rgb(0 0 0 / 0.15);--usa-blur:0px;--usa-font:Roboto,system-ui,sans-serif}@media (prefers-color-scheme:dark){:where([variant=\"fluent\"],[data-usa-variant=\"fluent\"]){--usa-accent:#4cc2ff;--usa-accent-text:#000;--usa-surface:rgb(44 44 44 / 0.8);--usa-text:#fff;--usa-border:1px solid rgb(255 255 255 / 0.08)}:where([variant=\"material\"],[data-usa-variant=\"material\"]){--usa-accent:#d0bcff;--usa-accent-text:#381e72;--usa-surface:#1c1b1f;--usa-text:#e6e1e5}}.usa-surface{background:var(--usa-surface);color:var(--usa-text);border:var(--usa-border);border-radius:var(--usa-radius);box-shadow:var(--usa-shadow);font-family:var(--usa-font);-webkit-backdrop-filter:blur(var(--usa-blur));backdrop-filter:blur(var(--usa-blur))}@media (prefers-reduced-transparency:reduce){.usa-surface{-webkit-backdrop-filter:none;backdrop-filter:none}}";
|
|
6
6
|
|
|
@@ -36,4 +36,4 @@ function setVariant(variant, root = typeof document !== 'undefined' ? document.d
|
|
|
36
36
|
exports.VARIANTS = VARIANTS;
|
|
37
37
|
exports.adoptVariants = adoptVariants;
|
|
38
38
|
exports.setVariant = setVariant;
|
|
39
|
-
//# sourceMappingURL=variants-
|
|
39
|
+
//# sourceMappingURL=variants-_dC-ey6R.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variants-
|
|
1
|
+
{"version":3,"file":"variants-_dC-ey6R.cjs","sources":["../../src/components/ui/variants.ts"],"sourcesContent":["import { adoptStyles } from '../base';\nimport css from './variants.css?raw';\n\n/**\n * Style variants (v2.6): `variant=\"minimal | neon | glass | brutalist |\n * fluent | material\"` on any `<usa-*>` element — or on any ancestor as\n * `data-usa-variant`, or page-wide with `setVariant()` — sets the shared\n * design tokens every component reads:\n *\n * `--usa-accent`, `--usa-accent-text`, `--usa-surface`, `--usa-text`,\n * `--usa-radius`, `--usa-border`, `--usa-shadow`, `--usa-blur`, `--usa-font`.\n *\n * (`<usa-spinner>`, `<usa-check>` and `<usa-dialog>` already use `variant`\n * for their kind; the token names never clash with those values except\n * `fluent`, which means the same thing there.)\n */\nexport const VARIANTS = ['minimal', 'neon', 'glass', 'brutalist', 'fluent', 'material'] as const;\nexport type Variant = (typeof VARIANTS)[number];\n\n/** Inject the variant token sheet (done automatically by every `ui` component). */\nexport function adoptVariants(): void {\n adoptStyles('variants', css);\n}\n\n/** Apply a variant to the whole page (or `root`); `null` removes it. */\nexport function setVariant(variant: Variant | null, root: Element | null = typeof document !== 'undefined' ? document.documentElement : null): void {\n if (!root) return;\n adoptVariants();\n if (variant) root.setAttribute('data-usa-variant', variant);\n else root.removeAttribute('data-usa-variant');\n}\n"],"names":["adoptStyles"],"mappings":";;;;;;AAGA;;;;;;;;;;;;AAYG;AACI,MAAM,QAAQ,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU;AAGtF;SACgB,aAAa,GAAA;AAC3B,IAAAA,gBAAW,CAAC,UAAU,EAAE,GAAG,CAAC;AAC9B;AAEA;SACgB,UAAU,CAAC,OAAuB,EAAE,IAAA,GAAuB,OAAO,QAAQ,KAAK,WAAW,GAAG,QAAQ,CAAC,eAAe,GAAG,IAAI,EAAA;AAC1I,IAAA,IAAI,CAAC,IAAI;QAAE;AACX,IAAA,aAAa,EAAE;AACf,IAAA,IAAI,OAAO;AAAE,QAAA,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE,OAAO,CAAC;;AACtD,QAAA,IAAI,CAAC,eAAe,CAAC,kBAAkB,CAAC;AAC/C;;;;;;"}
|
|
@@ -3,27 +3,28 @@
|
|
|
3
3
|
var components = require('../components.cjs');
|
|
4
4
|
var bind = require('../chunks/bind-Ui43-n2d.cjs');
|
|
5
5
|
require('./reveal.cjs');
|
|
6
|
-
require('../chunks/base-
|
|
6
|
+
require('../chunks/base-Dm6ee5ug.cjs');
|
|
7
7
|
require('./text.cjs');
|
|
8
8
|
require('./interaction.cjs');
|
|
9
9
|
require('./feedback.cjs');
|
|
10
10
|
require('./background.cjs');
|
|
11
|
-
require('../chunks/variants-
|
|
11
|
+
require('../chunks/variants-_dC-ey6R.cjs');
|
|
12
12
|
require('./transitions.cjs');
|
|
13
13
|
require('./physics.cjs');
|
|
14
|
-
require('../chunks/spring-
|
|
14
|
+
require('../chunks/spring-Dp5BllPB.cjs');
|
|
15
15
|
require('./cards.cjs');
|
|
16
16
|
require('./click.cjs');
|
|
17
17
|
require('./ui.cjs');
|
|
18
18
|
require('./page.cjs');
|
|
19
19
|
require('./timeline.cjs');
|
|
20
20
|
require('./gesture.cjs');
|
|
21
|
-
require('../chunks/core-
|
|
21
|
+
require('../chunks/core-CHAtivHV.cjs');
|
|
22
22
|
require('./svg.cjs');
|
|
23
23
|
require('./webgl.cjs');
|
|
24
24
|
require('./depth.cjs');
|
|
25
25
|
require('./layout.cjs');
|
|
26
|
-
require('
|
|
26
|
+
require('./packs.cjs');
|
|
27
|
+
require('../chunks/index-tags-DYYsgbba.cjs');
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
30
|
* use-scroll-animate/components/angular — Angular integration (v3.8).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"angular.cjs","sources":["../../src/components/frameworks/angular.ts"],"sourcesContent":["/**\n * use-scroll-animate/components/angular — Angular integration (v3.8).\n * Angular renders `<usa-*>` tags once the component (or NgModule) allows\n * custom elements with `CUSTOM_ELEMENTS_SCHEMA`; property binding\n * `[checked]=\"on\"` and event binding `(usa:change)=\"…\"` then work as is.\n * This entry is framework-free (no `@angular/*` import):\n *\n * ```ts\n * import { CUSTOM_ELEMENTS_SCHEMA, Component, APP_INITIALIZER } from '@angular/core';\n * import { usaInitializer } from 'use-scroll-animate/components/angular';\n *\n * // app.config.ts\n * providers: [{ provide: APP_INITIALIZER, multi: true, useFactory: usaInitializer(['click', 'ui']) }]\n *\n * @Component({ standalone: true, schemas: [CUSTOM_ELEMENTS_SCHEMA],\n * template: `<usa-toggle [checked]=\"on\" (usa:change)=\"on = $any($event).detail.checked\"></usa-toggle>` })\n * ```\n * `bindUsa(el, { props, on })` is available for directives that bind imperatively.\n */\nimport { defineComponents, type ComponentCategory } from '../index';\n\nexport { bindUsa, usaEventName } from './bind';\nexport type { UsaBinding } from './bind';\n\n/** `APP_INITIALIZER` factory: registers the elements in the browser (no-op during SSR). */\nexport function usaInitializer(categories?: ComponentCategory[]): () => () => void {\n return () => () => {\n if (typeof window !== 'undefined') defineComponents(categories);\n };\n}\n\n/** Register the elements directly (e.g. in `main.ts` before `bootstrapApplication`). */\nexport function defineUsa(categories?: ComponentCategory[]): void {\n if (typeof window !== 'undefined') defineComponents(categories);\n}\n\n/** Read `event.detail` from a `usa:*` event in a template handler: `(usa:change)=\"on = usaDetail($event).checked\"`. */\nexport const usaDetail = <T = any>(e: Event): T => (e as CustomEvent<T>).detail;\n"],"names":["defineComponents"],"mappings":"
|
|
1
|
+
{"version":3,"file":"angular.cjs","sources":["../../src/components/frameworks/angular.ts"],"sourcesContent":["/**\n * use-scroll-animate/components/angular — Angular integration (v3.8).\n * Angular renders `<usa-*>` tags once the component (or NgModule) allows\n * custom elements with `CUSTOM_ELEMENTS_SCHEMA`; property binding\n * `[checked]=\"on\"` and event binding `(usa:change)=\"…\"` then work as is.\n * This entry is framework-free (no `@angular/*` import):\n *\n * ```ts\n * import { CUSTOM_ELEMENTS_SCHEMA, Component, APP_INITIALIZER } from '@angular/core';\n * import { usaInitializer } from 'use-scroll-animate/components/angular';\n *\n * // app.config.ts\n * providers: [{ provide: APP_INITIALIZER, multi: true, useFactory: usaInitializer(['click', 'ui']) }]\n *\n * @Component({ standalone: true, schemas: [CUSTOM_ELEMENTS_SCHEMA],\n * template: `<usa-toggle [checked]=\"on\" (usa:change)=\"on = $any($event).detail.checked\"></usa-toggle>` })\n * ```\n * `bindUsa(el, { props, on })` is available for directives that bind imperatively.\n */\nimport { defineComponents, type ComponentCategory } from '../index';\n\nexport { bindUsa, usaEventName } from './bind';\nexport type { UsaBinding } from './bind';\n\n/** `APP_INITIALIZER` factory: registers the elements in the browser (no-op during SSR). */\nexport function usaInitializer(categories?: ComponentCategory[]): () => () => void {\n return () => () => {\n if (typeof window !== 'undefined') defineComponents(categories);\n };\n}\n\n/** Register the elements directly (e.g. in `main.ts` before `bootstrapApplication`). */\nexport function defineUsa(categories?: ComponentCategory[]): void {\n if (typeof window !== 'undefined') defineComponents(categories);\n}\n\n/** Read `event.detail` from a `usa:*` event in a template handler: `(usa:change)=\"on = usaDetail($event).checked\"`. */\nexport const usaDetail = <T = any>(e: Event): T => (e as CustomEvent<T>).detail;\n"],"names":["defineComponents"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;AAkBG;AAMH;AACM,SAAU,cAAc,CAAC,UAAgC,EAAA;AAC7D,IAAA,OAAO,MAAM,MAAK;QAChB,IAAI,OAAO,MAAM,KAAK,WAAW;YAAEA,2BAAgB,CAAC,UAAU,CAAC;AACjE,IAAA,CAAC;AACH;AAEA;AACM,SAAU,SAAS,CAAC,UAAgC,EAAA;IACxD,IAAI,OAAO,MAAM,KAAK,WAAW;QAAEA,2BAAgB,CAAC,UAAU,CAAC;AACjE;AAEA;AACO,MAAM,SAAS,GAAG,CAAU,CAAQ,KAAS,CAAoB,CAAC;;;;;;;;"}
|
|
@@ -1590,6 +1590,30 @@ declare global {
|
|
|
1590
1590
|
}
|
|
1591
1591
|
}
|
|
1592
1592
|
|
|
1593
|
+
/**
|
|
1594
|
+
* `<usa-pack name="ecommerce">` — applies an effect pack (`ecommerce` ·
|
|
1595
|
+
* `portfolio` · `dashboard` · `game` · `landing`) to its subtree:
|
|
1596
|
+
* descendants opt in with `data-role` (see `PACKS`). Re-applies when
|
|
1597
|
+
* `name` changes; undone on disconnect.
|
|
1598
|
+
*/
|
|
1599
|
+
interface UsaPackElement extends UsaElement {
|
|
1600
|
+
readonly roles: string[];
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
/**
|
|
1604
|
+
* use-scroll-animate/components/packs — effect packs (v3.9).
|
|
1605
|
+
* Ready-made motion for e-commerce, portfolio, dashboard, game UI and
|
|
1606
|
+
* landing pages: mark elements with `data-role` and apply a pack with
|
|
1607
|
+
* `<usa-pack name="…">` or `applyPack(name, root)`. Includes `flyToCart()`
|
|
1608
|
+
* and `countUp()`.
|
|
1609
|
+
*/
|
|
1610
|
+
|
|
1611
|
+
declare global {
|
|
1612
|
+
interface HTMLElementTagNameMap {
|
|
1613
|
+
'usa-pack': UsaPackElement;
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
|
|
1593
1617
|
/** The component categories and their default tags. */
|
|
1594
1618
|
declare const COMPONENT_CATEGORIES: {
|
|
1595
1619
|
readonly reveal: readonly ["usa-reveal", "usa-stagger", "usa-scroll-progress", "usa-scrolly"];
|
|
@@ -1609,6 +1633,7 @@ declare const COMPONENT_CATEGORIES: {
|
|
|
1609
1633
|
readonly webgl: readonly ["usa-shader", "usa-distort", "usa-liquid"];
|
|
1610
1634
|
readonly depth: readonly ["usa-cube", "usa-depth"];
|
|
1611
1635
|
readonly layout: readonly ["usa-auto-animate", "usa-masonry"];
|
|
1636
|
+
readonly packs: readonly ["usa-pack"];
|
|
1612
1637
|
};
|
|
1613
1638
|
type ComponentCategory = keyof typeof COMPONENT_CATEGORIES;
|
|
1614
1639
|
|
|
@@ -1590,6 +1590,30 @@ declare global {
|
|
|
1590
1590
|
}
|
|
1591
1591
|
}
|
|
1592
1592
|
|
|
1593
|
+
/**
|
|
1594
|
+
* `<usa-pack name="ecommerce">` — applies an effect pack (`ecommerce` ·
|
|
1595
|
+
* `portfolio` · `dashboard` · `game` · `landing`) to its subtree:
|
|
1596
|
+
* descendants opt in with `data-role` (see `PACKS`). Re-applies when
|
|
1597
|
+
* `name` changes; undone on disconnect.
|
|
1598
|
+
*/
|
|
1599
|
+
interface UsaPackElement extends UsaElement {
|
|
1600
|
+
readonly roles: string[];
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
/**
|
|
1604
|
+
* use-scroll-animate/components/packs — effect packs (v3.9).
|
|
1605
|
+
* Ready-made motion for e-commerce, portfolio, dashboard, game UI and
|
|
1606
|
+
* landing pages: mark elements with `data-role` and apply a pack with
|
|
1607
|
+
* `<usa-pack name="…">` or `applyPack(name, root)`. Includes `flyToCart()`
|
|
1608
|
+
* and `countUp()`.
|
|
1609
|
+
*/
|
|
1610
|
+
|
|
1611
|
+
declare global {
|
|
1612
|
+
interface HTMLElementTagNameMap {
|
|
1613
|
+
'usa-pack': UsaPackElement;
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
|
|
1593
1617
|
/** The component categories and their default tags. */
|
|
1594
1618
|
declare const COMPONENT_CATEGORIES: {
|
|
1595
1619
|
readonly reveal: readonly ["usa-reveal", "usa-stagger", "usa-scroll-progress", "usa-scrolly"];
|
|
@@ -1609,6 +1633,7 @@ declare const COMPONENT_CATEGORIES: {
|
|
|
1609
1633
|
readonly webgl: readonly ["usa-shader", "usa-distort", "usa-liquid"];
|
|
1610
1634
|
readonly depth: readonly ["usa-cube", "usa-depth"];
|
|
1611
1635
|
readonly layout: readonly ["usa-auto-animate", "usa-masonry"];
|
|
1636
|
+
readonly packs: readonly ["usa-pack"];
|
|
1612
1637
|
};
|
|
1613
1638
|
type ComponentCategory = keyof typeof COMPONENT_CATEGORIES;
|
|
1614
1639
|
|
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
import { defineComponents } from '../components.js';
|
|
2
2
|
export { b as bindUsa, u as usaEventName } from '../chunks/bind-B_CTL6Qn.js';
|
|
3
3
|
import './reveal.js';
|
|
4
|
-
import '../chunks/base-
|
|
4
|
+
import '../chunks/base-BRIPyPtX.js';
|
|
5
5
|
import './text.js';
|
|
6
6
|
import './interaction.js';
|
|
7
7
|
import './feedback.js';
|
|
8
8
|
import './background.js';
|
|
9
|
-
import '../chunks/variants-
|
|
9
|
+
import '../chunks/variants-DTypaOH3.js';
|
|
10
10
|
import './transitions.js';
|
|
11
11
|
import './physics.js';
|
|
12
|
-
import '../chunks/spring-
|
|
12
|
+
import '../chunks/spring-UBPhrh1X.js';
|
|
13
13
|
import './cards.js';
|
|
14
14
|
import './click.js';
|
|
15
15
|
import './ui.js';
|
|
16
16
|
import './page.js';
|
|
17
17
|
import './timeline.js';
|
|
18
18
|
import './gesture.js';
|
|
19
|
-
import '../chunks/core-
|
|
19
|
+
import '../chunks/core-CYozf_E-.js';
|
|
20
20
|
import './svg.js';
|
|
21
21
|
import './webgl.js';
|
|
22
22
|
import './depth.js';
|
|
23
23
|
import './layout.js';
|
|
24
|
-
import '
|
|
24
|
+
import './packs.js';
|
|
25
|
+
import '../chunks/index-tags-BmQR17Sb.js';
|
|
25
26
|
|
|
26
27
|
/**
|
|
27
28
|
* use-scroll-animate/components/angular — Angular integration (v3.8).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"angular.js","sources":["../../src/components/frameworks/angular.ts"],"sourcesContent":["/**\n * use-scroll-animate/components/angular — Angular integration (v3.8).\n * Angular renders `<usa-*>` tags once the component (or NgModule) allows\n * custom elements with `CUSTOM_ELEMENTS_SCHEMA`; property binding\n * `[checked]=\"on\"` and event binding `(usa:change)=\"…\"` then work as is.\n * This entry is framework-free (no `@angular/*` import):\n *\n * ```ts\n * import { CUSTOM_ELEMENTS_SCHEMA, Component, APP_INITIALIZER } from '@angular/core';\n * import { usaInitializer } from 'use-scroll-animate/components/angular';\n *\n * // app.config.ts\n * providers: [{ provide: APP_INITIALIZER, multi: true, useFactory: usaInitializer(['click', 'ui']) }]\n *\n * @Component({ standalone: true, schemas: [CUSTOM_ELEMENTS_SCHEMA],\n * template: `<usa-toggle [checked]=\"on\" (usa:change)=\"on = $any($event).detail.checked\"></usa-toggle>` })\n * ```\n * `bindUsa(el, { props, on })` is available for directives that bind imperatively.\n */\nimport { defineComponents, type ComponentCategory } from '../index';\n\nexport { bindUsa, usaEventName } from './bind';\nexport type { UsaBinding } from './bind';\n\n/** `APP_INITIALIZER` factory: registers the elements in the browser (no-op during SSR). */\nexport function usaInitializer(categories?: ComponentCategory[]): () => () => void {\n return () => () => {\n if (typeof window !== 'undefined') defineComponents(categories);\n };\n}\n\n/** Register the elements directly (e.g. in `main.ts` before `bootstrapApplication`). */\nexport function defineUsa(categories?: ComponentCategory[]): void {\n if (typeof window !== 'undefined') defineComponents(categories);\n}\n\n/** Read `event.detail` from a `usa:*` event in a template handler: `(usa:change)=\"on = usaDetail($event).checked\"`. */\nexport const usaDetail = <T = any>(e: Event): T => (e as CustomEvent<T>).detail;\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"angular.js","sources":["../../src/components/frameworks/angular.ts"],"sourcesContent":["/**\n * use-scroll-animate/components/angular — Angular integration (v3.8).\n * Angular renders `<usa-*>` tags once the component (or NgModule) allows\n * custom elements with `CUSTOM_ELEMENTS_SCHEMA`; property binding\n * `[checked]=\"on\"` and event binding `(usa:change)=\"…\"` then work as is.\n * This entry is framework-free (no `@angular/*` import):\n *\n * ```ts\n * import { CUSTOM_ELEMENTS_SCHEMA, Component, APP_INITIALIZER } from '@angular/core';\n * import { usaInitializer } from 'use-scroll-animate/components/angular';\n *\n * // app.config.ts\n * providers: [{ provide: APP_INITIALIZER, multi: true, useFactory: usaInitializer(['click', 'ui']) }]\n *\n * @Component({ standalone: true, schemas: [CUSTOM_ELEMENTS_SCHEMA],\n * template: `<usa-toggle [checked]=\"on\" (usa:change)=\"on = $any($event).detail.checked\"></usa-toggle>` })\n * ```\n * `bindUsa(el, { props, on })` is available for directives that bind imperatively.\n */\nimport { defineComponents, type ComponentCategory } from '../index';\n\nexport { bindUsa, usaEventName } from './bind';\nexport type { UsaBinding } from './bind';\n\n/** `APP_INITIALIZER` factory: registers the elements in the browser (no-op during SSR). */\nexport function usaInitializer(categories?: ComponentCategory[]): () => () => void {\n return () => () => {\n if (typeof window !== 'undefined') defineComponents(categories);\n };\n}\n\n/** Register the elements directly (e.g. in `main.ts` before `bootstrapApplication`). */\nexport function defineUsa(categories?: ComponentCategory[]): void {\n if (typeof window !== 'undefined') defineComponents(categories);\n}\n\n/** Read `event.detail` from a `usa:*` event in a template handler: `(usa:change)=\"on = usaDetail($event).checked\"`. */\nexport const usaDetail = <T = any>(e: Event): T => (e as CustomEvent<T>).detail;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;AAkBG;AAMH;AACM,SAAU,cAAc,CAAC,UAAgC,EAAA;AAC7D,IAAA,OAAO,MAAM,MAAK;QAChB,IAAI,OAAO,MAAM,KAAK,WAAW;YAAE,gBAAgB,CAAC,UAAU,CAAC;AACjE,IAAA,CAAC;AACH;AAEA;AACM,SAAU,SAAS,CAAC,UAAgC,EAAA;IACxD,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,gBAAgB,CAAC,UAAU,CAAC;AACjE;AAEA;AACO,MAAM,SAAS,GAAG,CAAU,CAAQ,KAAS,CAAoB,CAAC;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var base = require('../chunks/base-
|
|
4
|
-
var variants = require('../chunks/variants-
|
|
3
|
+
var base = require('../chunks/base-Dm6ee5ug.cjs');
|
|
4
|
+
var variants = require('../chunks/variants-_dC-ey6R.cjs');
|
|
5
5
|
|
|
6
6
|
var css$6 = "usa-aurora{position:relative;display:block;isolation:isolate;overflow:hidden}usa-aurora .usa-aurora-layer{position:absolute;inset:0;z-index:-1;pointer-events:none;opacity:var(--usa-aurora-opacity,0.7);overflow:hidden;contain:strict}usa-aurora .usa-aurora-layer i{position:absolute;display:block;width:70%;aspect-ratio:1;border-radius:50%;background:radial-gradient(closest-side,var(--c),transparent);will-change:transform;animation:usa-aurora-a var(--usa-aurora-speed,18s) ease-in-out infinite alternate}usa-aurora .usa-aurora-layer i:nth-child(1){left:-15%;top:-30%}usa-aurora .usa-aurora-layer i:nth-child(2){right:-20%;top:-10%;animation-name:usa-aurora-b;animation-duration:calc(var(--usa-aurora-speed,18s) * 1.3)}usa-aurora .usa-aurora-layer i:nth-child(3){left:10%;bottom:-45%;animation-name:usa-aurora-c;animation-duration:calc(var(--usa-aurora-speed,18s) * 0.9)}usa-aurora .usa-aurora-layer i:nth-child(4){right:0;bottom:-30%;width:50%;animation-name:usa-aurora-b;animation-direction:alternate-reverse}usa-aurora[paused] .usa-aurora-layer i,usa-aurora[data-offscreen] .usa-aurora-layer i{animation-play-state:paused}@keyframes usa-aurora-a{from{transform:translate3d(0,0,0) scale(1)}to{transform:translate3d(30%,20%,0) scale(1.25)}}@keyframes usa-aurora-b{from{transform:translate3d(0,0,0) scale(1.1)}to{transform:translate3d(-35%,25%,0) scale(0.85)}}@keyframes usa-aurora-c{from{transform:translate3d(0,0,0) rotate(0deg) scale(1)}to{transform:translate3d(25%,-30%,0) rotate(40deg) scale(1.2)}}@media (prefers-reduced-motion:reduce){usa-aurora .usa-aurora-layer i,usa-grain .usa-grain-layer,usa-acrylic::after{animation:none !important}}";
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { a as configureComponents } from '../chunks/base-
|
|
3
|
-
import { s as setVariant } from '../chunks/variants-
|
|
1
|
+
import { i as defineElement, e as caf, r as raf, f as adoptStyles, p as prefersReducedMotion } from '../chunks/base-BRIPyPtX.js';
|
|
2
|
+
export { a as configureComponents } from '../chunks/base-BRIPyPtX.js';
|
|
3
|
+
import { s as setVariant } from '../chunks/variants-DTypaOH3.js';
|
|
4
4
|
|
|
5
5
|
var css$6 = "usa-aurora{position:relative;display:block;isolation:isolate;overflow:hidden}usa-aurora .usa-aurora-layer{position:absolute;inset:0;z-index:-1;pointer-events:none;opacity:var(--usa-aurora-opacity,0.7);overflow:hidden;contain:strict}usa-aurora .usa-aurora-layer i{position:absolute;display:block;width:70%;aspect-ratio:1;border-radius:50%;background:radial-gradient(closest-side,var(--c),transparent);will-change:transform;animation:usa-aurora-a var(--usa-aurora-speed,18s) ease-in-out infinite alternate}usa-aurora .usa-aurora-layer i:nth-child(1){left:-15%;top:-30%}usa-aurora .usa-aurora-layer i:nth-child(2){right:-20%;top:-10%;animation-name:usa-aurora-b;animation-duration:calc(var(--usa-aurora-speed,18s) * 1.3)}usa-aurora .usa-aurora-layer i:nth-child(3){left:10%;bottom:-45%;animation-name:usa-aurora-c;animation-duration:calc(var(--usa-aurora-speed,18s) * 0.9)}usa-aurora .usa-aurora-layer i:nth-child(4){right:0;bottom:-30%;width:50%;animation-name:usa-aurora-b;animation-direction:alternate-reverse}usa-aurora[paused] .usa-aurora-layer i,usa-aurora[data-offscreen] .usa-aurora-layer i{animation-play-state:paused}@keyframes usa-aurora-a{from{transform:translate3d(0,0,0) scale(1)}to{transform:translate3d(30%,20%,0) scale(1.25)}}@keyframes usa-aurora-b{from{transform:translate3d(0,0,0) scale(1.1)}to{transform:translate3d(-35%,25%,0) scale(0.85)}}@keyframes usa-aurora-c{from{transform:translate3d(0,0,0) rotate(0deg) scale(1)}to{transform:translate3d(25%,-30%,0) rotate(40deg) scale(1.2)}}@media (prefers-reduced-motion:reduce){usa-aurora .usa-aurora-layer i,usa-grain .usa-grain-layer,usa-acrylic::after{animation:none !important}}";
|
|
6
6
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var base = require('../chunks/base-
|
|
4
|
-
var spring = require('../chunks/spring-
|
|
3
|
+
var base = require('../chunks/base-Dm6ee5ug.cjs');
|
|
4
|
+
var spring = require('../chunks/spring-Dp5BllPB.cjs');
|
|
5
5
|
|
|
6
6
|
var css$3 = "usa-card{--usa-card-radius:18px;--usa-card-bg:var(--usa-surface,#1b1e27);--usa-card-glow:var(--usa-accent,#7c5cff);--usa-card-x:50%;--usa-card-y:50%;--usa-card-nx:0;--usa-card-ny:0;position:relative;display:block;border-radius:var(--usa-card-radius);isolation:isolate;-webkit-tap-highlight-color:transparent}usa-card:focus-visible{outline:2px solid var(--usa-card-glow);outline-offset:3px}usa-card[effect~=\"lift\"]{transition:transform 0.45s cubic-bezier(0.34,1.56,0.64,1),box-shadow 0.45s ease}usa-card[effect~=\"lift\"][data-hover],usa-card[effect~=\"lift\"]:focus-visible{transform:translateY(-6px) perspective(900px) rotateX(calc(var(--usa-card-ny) * -4deg)) rotateY(calc(var(--usa-card-nx) * 4deg));box-shadow:0 22px 44px -18px rgb(0 0 0 / 0.55)}usa-card[effect~=\"glass\"]{background:color-mix(in srgb,var(--usa-card-bg) 45%,transparent);border:1px solid rgb(255 255 255 / 0.16);-webkit-backdrop-filter:blur(18px) saturate(1.5);backdrop-filter:blur(18px) saturate(1.5)}usa-card[effect~=\"spotlight\"]::before,usa-card[effect~=\"border-glow\"]::after{content:\"\";position:absolute;inset:0;border-radius:inherit;pointer-events:none;opacity:0;transition:opacity 0.3s ease}usa-card[effect~=\"spotlight\"]::before{z-index:-1;background:radial-gradient(260px circle at var(--usa-card-x) var(--usa-card-y),color-mix(in srgb,var(--usa-card-glow) 28%,transparent),transparent 70%)}usa-card[effect~=\"border-glow\"]::after{padding:1.5px;background:radial-gradient(180px circle at var(--usa-card-x) var(--usa-card-y),var(--usa-card-glow),transparent 70%);-webkit-mask:linear-gradient(#000 0 0) content-box exclude,linear-gradient(#000 0 0);mask:linear-gradient(#000 0 0) content-box exclude,linear-gradient(#000 0 0)}usa-card[data-hover]::before,usa-card[data-hover]::after{opacity:1}@property --usa-card-angle{syntax:\"<angle>\";inherits:false;initial-value:0deg}usa-card[effect~=\"conic-border\"]{border:2px solid transparent;background:linear-gradient(var(--usa-card-bg),var(--usa-card-bg)) padding-box,conic-gradient(from var(--usa-card-angle),var(--usa-card-glow),#22d3ee,#f472b6,var(--usa-card-glow)) border-box;animation:usa-card-spin 4s linear infinite}@keyframes usa-card-spin{to{--usa-card-angle:360deg}}usa-card .usa-card-sheen{position:absolute;inset:0;border-radius:inherit;overflow:hidden;pointer-events:none}usa-card .usa-card-sheen::before{content:\"\";position:absolute;top:0;bottom:0;width:45%;left:-60%;transform:skewX(-20deg);background:linear-gradient(90deg,transparent,rgb(255 255 255 / 0.35),transparent)}usa-card[effect~=\"sheen\"]:hover .usa-card-sheen::before,usa-card[effect~=\"sheen\"]:focus-visible .usa-card-sheen::before{left:130%;transition:left 0.8s cubic-bezier(0.22,1,0.36,1)}usa-card .usa-card-holo{position:absolute;inset:0;border-radius:inherit;pointer-events:none;mix-blend-mode:color-dodge;opacity:0.35;background:linear-gradient(115deg,transparent 20%,#ff7ad9 35%,#7af0ff 45%,#ffe27a 55%,transparent 70%) calc(var(--usa-card-x) * 1.4 - 20%) calc(var(--usa-card-y) * 1.4 - 20%) / 220% 220%;transition:opacity 0.3s ease}usa-card[data-hover] .usa-card-holo{opacity:0.7}usa-card[effect~=\"parallax-layers\"] [data-depth]{transition:transform 0.25s ease-out;will-change:transform}usa-card[effect~=\"flip\"]{perspective:1000px;display:grid}usa-card[effect~=\"flip\"]>[data-front],usa-card[effect~=\"flip\"]>[data-back]{grid-area:1 / 1;backface-visibility:hidden;-webkit-backface-visibility:hidden;border-radius:inherit;transition:transform 0.7s cubic-bezier(0.34,1.3,0.64,1),opacity 0.3s ease}usa-card[effect~=\"flip\"]>[data-back]{transform:rotateY(180deg)}usa-card[effect~=\"flip\"][axis=\"x\"]>[data-back]{transform:rotateX(180deg)}usa-card[effect~=\"flip\"][flipped]>[data-front],usa-card[effect~=\"flip\"]:not([trigger=\"click\"]):hover>[data-front]{transform:rotateY(-180deg)}usa-card[effect~=\"flip\"][flipped]>[data-back],usa-card[effect~=\"flip\"]:not([trigger=\"click\"]):hover>[data-back]{transform:rotateY(0deg)}usa-card[effect~=\"flip\"][axis=\"x\"][flipped]>[data-front],usa-card[effect~=\"flip\"][axis=\"x\"]:not([trigger=\"click\"]):hover>[data-front]{transform:rotateX(180deg)}usa-card[effect~=\"flip\"][axis=\"x\"][flipped]>[data-back],usa-card[effect~=\"flip\"][axis=\"x\"]:not([trigger=\"click\"]):hover>[data-back]{transform:rotateX(0deg)}usa-card[effect~=\"flip\"][trigger=\"click\"]{cursor:pointer}usa-card[effect~=\"expand\"]{cursor:zoom-in}usa-card[effect~=\"expand\"]:not([expanded]) [data-detail]{display:none}usa-card[expanded]{position:fixed;inset:6vh max(4vw,calc(50vw - 420px));z-index:1000;overflow:auto;cursor:default;background:var(--usa-card-bg);box-shadow:0 30px 80px -20px rgb(0 0 0 / 0.6)}.usa-card-backdrop{position:fixed;inset:0;z-index:999;background:rgb(0 0 0 / 0.45)}@media (prefers-reduced-motion:reduce){usa-card,usa-card *,usa-card .usa-card-sheen::before{transition-duration:0.01ms !important;animation:none !important}usa-card[effect~=\"lift\"][data-hover]{transform:none}usa-card[effect~=\"flip\"]>[data-front],usa-card[effect~=\"flip\"]>[data-back]{transform:none !important}usa-card[effect~=\"flip\"][flipped]>[data-front],usa-card[effect~=\"flip\"]:not([flipped])>[data-back]{opacity:0;visibility:hidden}usa-card[effect~=\"flip\"]:not([trigger=\"click\"]):hover>[data-front]{opacity:0;visibility:hidden}usa-card[effect~=\"flip\"]:not([trigger=\"click\"]):hover>[data-back]{opacity:1;visibility:visible}}@media (prefers-reduced-transparency:reduce),(forced-colors:active){usa-card[effect~=\"glass\"]{background:var(--usa-card-bg);-webkit-backdrop-filter:none;backdrop-filter:none}}";
|
|
7
7
|
|
package/dist/components/cards.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { a as configureComponents, p as prefersReducedMotion } from '../chunks/base-
|
|
3
|
-
import { d as springEasing, c as createSpring } from '../chunks/spring-
|
|
1
|
+
import { i as defineElement, r as raf, e as caf, h as EASE_OUT, b as clamp } from '../chunks/base-BRIPyPtX.js';
|
|
2
|
+
export { a as configureComponents, p as prefersReducedMotion } from '../chunks/base-BRIPyPtX.js';
|
|
3
|
+
import { d as springEasing, c as createSpring } from '../chunks/spring-UBPhrh1X.js';
|
|
4
4
|
|
|
5
5
|
var css$3 = "usa-card{--usa-card-radius:18px;--usa-card-bg:var(--usa-surface,#1b1e27);--usa-card-glow:var(--usa-accent,#7c5cff);--usa-card-x:50%;--usa-card-y:50%;--usa-card-nx:0;--usa-card-ny:0;position:relative;display:block;border-radius:var(--usa-card-radius);isolation:isolate;-webkit-tap-highlight-color:transparent}usa-card:focus-visible{outline:2px solid var(--usa-card-glow);outline-offset:3px}usa-card[effect~=\"lift\"]{transition:transform 0.45s cubic-bezier(0.34,1.56,0.64,1),box-shadow 0.45s ease}usa-card[effect~=\"lift\"][data-hover],usa-card[effect~=\"lift\"]:focus-visible{transform:translateY(-6px) perspective(900px) rotateX(calc(var(--usa-card-ny) * -4deg)) rotateY(calc(var(--usa-card-nx) * 4deg));box-shadow:0 22px 44px -18px rgb(0 0 0 / 0.55)}usa-card[effect~=\"glass\"]{background:color-mix(in srgb,var(--usa-card-bg) 45%,transparent);border:1px solid rgb(255 255 255 / 0.16);-webkit-backdrop-filter:blur(18px) saturate(1.5);backdrop-filter:blur(18px) saturate(1.5)}usa-card[effect~=\"spotlight\"]::before,usa-card[effect~=\"border-glow\"]::after{content:\"\";position:absolute;inset:0;border-radius:inherit;pointer-events:none;opacity:0;transition:opacity 0.3s ease}usa-card[effect~=\"spotlight\"]::before{z-index:-1;background:radial-gradient(260px circle at var(--usa-card-x) var(--usa-card-y),color-mix(in srgb,var(--usa-card-glow) 28%,transparent),transparent 70%)}usa-card[effect~=\"border-glow\"]::after{padding:1.5px;background:radial-gradient(180px circle at var(--usa-card-x) var(--usa-card-y),var(--usa-card-glow),transparent 70%);-webkit-mask:linear-gradient(#000 0 0) content-box exclude,linear-gradient(#000 0 0);mask:linear-gradient(#000 0 0) content-box exclude,linear-gradient(#000 0 0)}usa-card[data-hover]::before,usa-card[data-hover]::after{opacity:1}@property --usa-card-angle{syntax:\"<angle>\";inherits:false;initial-value:0deg}usa-card[effect~=\"conic-border\"]{border:2px solid transparent;background:linear-gradient(var(--usa-card-bg),var(--usa-card-bg)) padding-box,conic-gradient(from var(--usa-card-angle),var(--usa-card-glow),#22d3ee,#f472b6,var(--usa-card-glow)) border-box;animation:usa-card-spin 4s linear infinite}@keyframes usa-card-spin{to{--usa-card-angle:360deg}}usa-card .usa-card-sheen{position:absolute;inset:0;border-radius:inherit;overflow:hidden;pointer-events:none}usa-card .usa-card-sheen::before{content:\"\";position:absolute;top:0;bottom:0;width:45%;left:-60%;transform:skewX(-20deg);background:linear-gradient(90deg,transparent,rgb(255 255 255 / 0.35),transparent)}usa-card[effect~=\"sheen\"]:hover .usa-card-sheen::before,usa-card[effect~=\"sheen\"]:focus-visible .usa-card-sheen::before{left:130%;transition:left 0.8s cubic-bezier(0.22,1,0.36,1)}usa-card .usa-card-holo{position:absolute;inset:0;border-radius:inherit;pointer-events:none;mix-blend-mode:color-dodge;opacity:0.35;background:linear-gradient(115deg,transparent 20%,#ff7ad9 35%,#7af0ff 45%,#ffe27a 55%,transparent 70%) calc(var(--usa-card-x) * 1.4 - 20%) calc(var(--usa-card-y) * 1.4 - 20%) / 220% 220%;transition:opacity 0.3s ease}usa-card[data-hover] .usa-card-holo{opacity:0.7}usa-card[effect~=\"parallax-layers\"] [data-depth]{transition:transform 0.25s ease-out;will-change:transform}usa-card[effect~=\"flip\"]{perspective:1000px;display:grid}usa-card[effect~=\"flip\"]>[data-front],usa-card[effect~=\"flip\"]>[data-back]{grid-area:1 / 1;backface-visibility:hidden;-webkit-backface-visibility:hidden;border-radius:inherit;transition:transform 0.7s cubic-bezier(0.34,1.3,0.64,1),opacity 0.3s ease}usa-card[effect~=\"flip\"]>[data-back]{transform:rotateY(180deg)}usa-card[effect~=\"flip\"][axis=\"x\"]>[data-back]{transform:rotateX(180deg)}usa-card[effect~=\"flip\"][flipped]>[data-front],usa-card[effect~=\"flip\"]:not([trigger=\"click\"]):hover>[data-front]{transform:rotateY(-180deg)}usa-card[effect~=\"flip\"][flipped]>[data-back],usa-card[effect~=\"flip\"]:not([trigger=\"click\"]):hover>[data-back]{transform:rotateY(0deg)}usa-card[effect~=\"flip\"][axis=\"x\"][flipped]>[data-front],usa-card[effect~=\"flip\"][axis=\"x\"]:not([trigger=\"click\"]):hover>[data-front]{transform:rotateX(180deg)}usa-card[effect~=\"flip\"][axis=\"x\"][flipped]>[data-back],usa-card[effect~=\"flip\"][axis=\"x\"]:not([trigger=\"click\"]):hover>[data-back]{transform:rotateX(0deg)}usa-card[effect~=\"flip\"][trigger=\"click\"]{cursor:pointer}usa-card[effect~=\"expand\"]{cursor:zoom-in}usa-card[effect~=\"expand\"]:not([expanded]) [data-detail]{display:none}usa-card[expanded]{position:fixed;inset:6vh max(4vw,calc(50vw - 420px));z-index:1000;overflow:auto;cursor:default;background:var(--usa-card-bg);box-shadow:0 30px 80px -20px rgb(0 0 0 / 0.6)}.usa-card-backdrop{position:fixed;inset:0;z-index:999;background:rgb(0 0 0 / 0.45)}@media (prefers-reduced-motion:reduce){usa-card,usa-card *,usa-card .usa-card-sheen::before{transition-duration:0.01ms !important;animation:none !important}usa-card[effect~=\"lift\"][data-hover]{transform:none}usa-card[effect~=\"flip\"]>[data-front],usa-card[effect~=\"flip\"]>[data-back]{transform:none !important}usa-card[effect~=\"flip\"][flipped]>[data-front],usa-card[effect~=\"flip\"]:not([flipped])>[data-back]{opacity:0;visibility:hidden}usa-card[effect~=\"flip\"]:not([trigger=\"click\"]):hover>[data-front]{opacity:0;visibility:hidden}usa-card[effect~=\"flip\"]:not([trigger=\"click\"]):hover>[data-back]{opacity:1;visibility:visible}}@media (prefers-reduced-transparency:reduce),(forced-colors:active){usa-card[effect~=\"glass\"]{background:var(--usa-card-bg);-webkit-backdrop-filter:none;backdrop-filter:none}}";
|
|
6
6
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var base = require('../chunks/base-
|
|
4
|
-
var spring = require('../chunks/spring-
|
|
3
|
+
var base = require('../chunks/base-Dm6ee5ug.cjs');
|
|
4
|
+
var spring = require('../chunks/spring-Dp5BllPB.cjs');
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Click-effect helpers (v2.5): `burst()`, `confetti()`, `shake()`, `haptic()`.
|
package/dist/components/click.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { p as prefersReducedMotion,
|
|
2
|
-
export { a as configureComponents } from '../chunks/base-
|
|
3
|
-
import { d as springEasing, c as createSpring } from '../chunks/spring-
|
|
1
|
+
import { p as prefersReducedMotion, i as defineElement, h as EASE_OUT, b as clamp, e as caf, n as now, r as raf } from '../chunks/base-BRIPyPtX.js';
|
|
2
|
+
export { a as configureComponents } from '../chunks/base-BRIPyPtX.js';
|
|
3
|
+
import { d as springEasing, c as createSpring } from '../chunks/spring-UBPhrh1X.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Click-effect helpers (v2.5): `burst()`, `confetti()`, `shake()`, `haptic()`.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var base = require('../chunks/base-
|
|
4
|
-
var spring = require('../chunks/spring-
|
|
5
|
-
var core = require('../chunks/core-
|
|
3
|
+
var base = require('../chunks/base-Dm6ee5ug.cjs');
|
|
4
|
+
var spring = require('../chunks/spring-Dp5BllPB.cjs');
|
|
5
|
+
var core = require('../chunks/core-CHAtivHV.cjs');
|
|
6
6
|
|
|
7
7
|
var css = "usa-cube{--usa-cube-size:200px;display:block;width:var(--usa-cube-size);height:var(--usa-cube-size);perspective:var(--usa-cube-perspective,900px);touch-action:pan-y;user-select:none;-webkit-user-select:none;position:relative}usa-cube>[data-face]{position:absolute;inset:0;backface-visibility:hidden;transform:translateZ(calc(var(--usa-cube-size) / -2)) rotateX(var(--usa-cube-rx,0deg)) rotateY(var(--usa-cube-ry,0deg)) var(--usa-face) translateZ(calc(var(--usa-cube-size) / 2));transform-origin:50% 50%}usa-cube>[data-face=\"front\"]{--usa-face:rotateY(0deg)}usa-cube>[data-face=\"right\"]{--usa-face:rotateY(90deg)}usa-cube>[data-face=\"back\"]{--usa-face:rotateY(180deg)}usa-cube>[data-face=\"left\"]{--usa-face:rotateY(-90deg)}usa-cube>[data-face=\"top\"]{--usa-face:rotateX(90deg)}usa-cube>[data-face=\"bottom\"]{--usa-face:rotateX(-90deg)}usa-cube:focus-visible{outline:2px solid currentColor;outline-offset:6px}usa-depth{display:block;position:relative;perspective:1000px}usa-depth>*{transform:var(--usa-depth-rot,none);transform-style:preserve-3d}usa-depth [data-depth]{will-change:transform;transition:transform 0.12s linear}@media (prefers-reduced-motion:reduce){usa-depth [data-depth]{transform:none !important}}";
|
|
8
8
|
|
package/dist/components/depth.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { a as configureComponents, p as prefersReducedMotion } from '../chunks/base-
|
|
3
|
-
import { c as createSpring } from '../chunks/spring-
|
|
4
|
-
import { g as gesture } from '../chunks/core-
|
|
1
|
+
import { i as defineElement, b as clamp, r as raf, e as caf } from '../chunks/base-BRIPyPtX.js';
|
|
2
|
+
export { a as configureComponents, p as prefersReducedMotion } from '../chunks/base-BRIPyPtX.js';
|
|
3
|
+
import { c as createSpring } from '../chunks/spring-UBPhrh1X.js';
|
|
4
|
+
import { g as gesture } from '../chunks/core-CYozf_E-.js';
|
|
5
5
|
|
|
6
6
|
var css = "usa-cube{--usa-cube-size:200px;display:block;width:var(--usa-cube-size);height:var(--usa-cube-size);perspective:var(--usa-cube-perspective,900px);touch-action:pan-y;user-select:none;-webkit-user-select:none;position:relative}usa-cube>[data-face]{position:absolute;inset:0;backface-visibility:hidden;transform:translateZ(calc(var(--usa-cube-size) / -2)) rotateX(var(--usa-cube-rx,0deg)) rotateY(var(--usa-cube-ry,0deg)) var(--usa-face) translateZ(calc(var(--usa-cube-size) / 2));transform-origin:50% 50%}usa-cube>[data-face=\"front\"]{--usa-face:rotateY(0deg)}usa-cube>[data-face=\"right\"]{--usa-face:rotateY(90deg)}usa-cube>[data-face=\"back\"]{--usa-face:rotateY(180deg)}usa-cube>[data-face=\"left\"]{--usa-face:rotateY(-90deg)}usa-cube>[data-face=\"top\"]{--usa-face:rotateX(90deg)}usa-cube>[data-face=\"bottom\"]{--usa-face:rotateX(-90deg)}usa-cube:focus-visible{outline:2px solid currentColor;outline-offset:6px}usa-depth{display:block;position:relative;perspective:1000px}usa-depth>*{transform:var(--usa-depth-rot,none);transform-style:preserve-3d}usa-depth [data-depth]{will-change:transform;transition:transform 0.12s linear}@media (prefers-reduced-motion:reduce){usa-depth [data-depth]{transform:none !important}}";
|
|
7
7
|
|