use-scroll-animate 4.0.0 → 4.1.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 +26 -0
- package/dist/chunks/{base-ZARFccur.js → base-BPG5zvex.js} +2 -2
- package/dist/chunks/{base-ZARFccur.js.map → base-BPG5zvex.js.map} +1 -1
- package/dist/chunks/{core-DXqZm5Il.cjs → core-CLu8ZrC-.cjs} +52 -10
- package/dist/chunks/core-CLu8ZrC-.cjs.map +1 -0
- package/dist/chunks/{core-Co-6AL0h.js → core-QTFk4kgO.js} +53 -12
- package/dist/chunks/core-QTFk4kgO.js.map +1 -0
- package/dist/chunks/{core-DKY-fVzR.js → core-eXX8rB_b.js} +2 -2
- package/dist/chunks/{core-DKY-fVzR.js.map → core-eXX8rB_b.js.map} +1 -1
- package/dist/chunks/{spring-E2ickYNI.js → spring-BziPsW3r.js} +2 -2
- package/dist/chunks/{spring-E2ickYNI.js.map → spring-BziPsW3r.js.map} +1 -1
- package/dist/chunks/{variants-DvnxvRCM.js → variants-BVYMcxRv.js} +2 -2
- package/dist/chunks/{variants-DvnxvRCM.js.map → variants-BVYMcxRv.js.map} +1 -1
- package/dist/components/angular.cjs +1 -1
- package/dist/components/angular.d.cts +29 -5
- package/dist/components/angular.d.ts +29 -5
- package/dist/components/angular.js +5 -5
- package/dist/components/background.js +3 -3
- package/dist/components/cards.js +3 -3
- package/dist/components/click.js +3 -3
- package/dist/components/depth.js +4 -4
- package/dist/components/feedback.js +2 -2
- package/dist/components/gesture.js +5 -5
- package/dist/components/interaction.js +2 -2
- package/dist/components/layout.js +2 -2
- package/dist/components/packs.js +2 -2
- package/dist/components/page.js +3 -3
- package/dist/components/physics.js +4 -4
- package/dist/components/reveal.js +2 -2
- package/dist/components/solid.cjs +20 -5
- package/dist/components/solid.cjs.map +1 -1
- package/dist/components/solid.d.cts +33 -23
- package/dist/components/solid.d.ts +33 -23
- package/dist/components/solid.js +24 -9
- package/dist/components/solid.js.map +1 -1
- package/dist/components/svelte.cjs +1 -1
- package/dist/components/svelte.d.cts +29 -5
- package/dist/components/svelte.d.ts +29 -5
- package/dist/components/svelte.js +5 -5
- package/dist/components/svg.cjs +16 -10
- package/dist/components/svg.cjs.map +1 -1
- package/dist/components/svg.css +1 -1
- package/dist/components/svg.js +18 -12
- package/dist/components/svg.js.map +1 -1
- package/dist/components/text.cjs +1 -1
- package/dist/components/text.css +1 -1
- package/dist/components/text.js +3 -3
- package/dist/components/timeline.cjs +25 -5
- package/dist/components/timeline.cjs.map +1 -1
- package/dist/components/timeline.d.cts +33 -7
- package/dist/components/timeline.d.ts +33 -7
- package/dist/components/timeline.js +27 -8
- package/dist/components/timeline.js.map +1 -1
- package/dist/components/transitions.js +2 -2
- package/dist/components/ui.js +5 -5
- package/dist/components/vue.cjs +1 -1
- package/dist/components/vue.d.cts +29 -5
- package/dist/components/vue.d.ts +29 -5
- package/dist/components/vue.js +5 -5
- package/dist/components/webgl.cjs +10 -0
- package/dist/components/webgl.cjs.map +1 -1
- package/dist/components/webgl.js +12 -2
- package/dist/components/webgl.js.map +1 -1
- package/dist/components.cjs +2 -1
- package/dist/components.cjs.map +1 -1
- package/dist/components.css +2 -2
- package/dist/components.d.cts +34 -8
- package/dist/components.d.ts +34 -8
- package/dist/components.js +7 -7
- package/dist/components.umd.js +2 -2
- package/dist/components.umd.js.map +1 -1
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +30 -6
- package/dist/index.d.ts +30 -6
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/solid.cjs +38 -8
- package/dist/solid.cjs.map +1 -1
- package/dist/solid.d.cts +6 -1
- package/dist/solid.d.ts +6 -1
- package/dist/solid.js +39 -9
- package/dist/solid.js.map +1 -1
- package/docs/API.md +3 -1
- package/docs/ROADMAP.md +1 -1
- package/package.json +1 -1
- package/dist/chunks/core-Co-6AL0h.js.map +0 -1
- package/dist/chunks/core-DXqZm5Il.cjs.map +0 -1
package/dist/components/svg.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { a as configureComponents } from '../chunks/base-
|
|
1
|
+
import { b as clamp, m as motionScale, d as caf, p as prefersReducedMotion, n as now, r as raf, h as defineElement, i as EASE_OUT } from '../chunks/base-BPG5zvex.js';
|
|
2
|
+
export { a as configureComponents } from '../chunks/base-BPG5zvex.js';
|
|
3
3
|
|
|
4
4
|
const NUM = /-?(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?/gi;
|
|
5
5
|
/** `true` when two path strings share the same commands (so their numbers can be interpolated). */
|
|
@@ -75,7 +75,7 @@ function drawLines(root, o = {}) {
|
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
var css = "usa-draw{display:inline-block}usa-draw svg :is(path,line,polyline,polygon,circle,ellipse,rect){transition:fill-opacity 0.6s ease}usa-draw[fill]:not([data-drawn]) svg :is(path,polygon,circle,ellipse,rect){fill-opacity:0}usa-morph{display:inline-block;line-height:0}usa-morph svg{width:100%;height:100%;fill:currentColor}usa-morph[role=\"button\"]{cursor:pointer}usa-mask-reveal{display:block}usa-mask-reveal[data-state=\"visible\"]{clip-path:none !important}usa-anim-icon{display:inline-flex;line-height:0;vertical-align:middle}usa-anim-icon svg{overflow:visible}@media (prefers-reduced-motion:reduce){usa-mask-reveal{clip-path:none !important}usa-draw svg *{stroke-dashoffset:0 !important}}";
|
|
78
|
+
var css = "usa-draw{display:inline-block}usa-draw svg :is(path,line,polyline,polygon,circle,ellipse,rect){transition:fill-opacity 0.6s ease}usa-draw[fill]:not([data-drawn]) svg :is(path,polygon,circle,ellipse,rect){fill-opacity:0}usa-morph{display:inline-block;line-height:0}usa-morph svg{width:100%;height:100%;fill:currentColor}usa-morph[role=\"button\"]{cursor:pointer}usa-mask-reveal{display:block}usa-mask-reveal[data-state=\"visible\"]{clip-path:none !important}usa-mask-reveal[data-state=\"hidden\"]{opacity:0}usa-anim-icon{display:inline-flex;line-height:0;vertical-align:middle}usa-anim-icon svg{overflow:visible}@media (prefers-reduced-motion:reduce){usa-mask-reveal{clip-path:none !important;opacity:1 !important}usa-draw svg *{stroke-dashoffset:0 !important}}";
|
|
79
79
|
|
|
80
80
|
function defineDraw(tag = 'usa-draw') {
|
|
81
81
|
return defineElement(tag, (Base) => class UsaDraw extends Base {
|
|
@@ -238,7 +238,9 @@ function defineMaskReveal(tag = 'usa-mask-reveal') {
|
|
|
238
238
|
reveal() {
|
|
239
239
|
const [a, b] = this.frames();
|
|
240
240
|
this.setAttribute('data-state', 'revealing');
|
|
241
|
-
|
|
241
|
+
// fill 'both' keeps the closed mask applied during `delay`
|
|
242
|
+
const anim = this.motion(this, [{ clipPath: a }, { clipPath: b }], { duration: this.num('duration', 900), delay: this.num('delay', 0), easing: EASE_OUT, fill: 'both' });
|
|
243
|
+
this.style.opacity = '';
|
|
242
244
|
const done = () => {
|
|
243
245
|
this.setAttribute('data-state', 'visible');
|
|
244
246
|
this.emit('complete');
|
|
@@ -252,9 +254,16 @@ function defineMaskReveal(tag = 'usa-mask-reveal') {
|
|
|
252
254
|
this.setAttribute('data-state', 'visible');
|
|
253
255
|
return;
|
|
254
256
|
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
257
|
+
// 4.0.1: hide with opacity, not the closed clip-path — Chromium's
|
|
258
|
+
// IntersectionObserver honours the target's own clip-path, so a fully
|
|
259
|
+
// clipped element never reports as intersecting and never revealed.
|
|
260
|
+
const hide = () => {
|
|
261
|
+
this.getAnimations?.().forEach((x) => x.cancel());
|
|
262
|
+
this.style.opacity = '0';
|
|
263
|
+
this.setAttribute('data-state', 'hidden');
|
|
264
|
+
};
|
|
265
|
+
hide();
|
|
266
|
+
this.onCleanup(() => ((this.style.opacity = ''), (this.style.clipPath = '')));
|
|
258
267
|
const t = this.str('trigger', 'view');
|
|
259
268
|
if (t === 'hover')
|
|
260
269
|
this.listen(this, 'pointerenter', () => void this.reveal());
|
|
@@ -267,11 +276,8 @@ function defineMaskReveal(tag = 'usa-mask-reveal') {
|
|
|
267
276
|
done = true;
|
|
268
277
|
void this.reveal();
|
|
269
278
|
}
|
|
270
|
-
else if (!v && this.flag('repeat'))
|
|
271
|
-
|
|
272
|
-
this.style.clipPath = this.frames()[0];
|
|
273
|
-
this.setAttribute('data-state', 'hidden');
|
|
274
|
-
}
|
|
279
|
+
else if (!v && this.flag('repeat'))
|
|
280
|
+
hide();
|
|
275
281
|
}, { threshold: 0.25 });
|
|
276
282
|
}
|
|
277
283
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svg.js","sources":["../../src/components/svg/core.ts","../../src/components/svg/draw.ts","../../src/components/svg/morph.ts","../../src/components/svg/mask-reveal.ts","../../src/components/svg/anim-icon.ts","../../src/components/svg/index.ts"],"sourcesContent":["import { prefersReducedMotion, motionScale, raf, caf, now, clamp } from '../base';\n\nconst NUM = /-?(?:\\d+\\.?\\d*|\\.\\d+)(?:e[-+]?\\d+)?/gi;\n\n/** `true` when two path strings share the same commands (so their numbers can be interpolated). */\nexport function pathsCompatible(a: string, b: string): boolean {\n return a.replace(NUM, '#').replace(/[\\s,]+/g, ' ').trim() === b.replace(NUM, '#').replace(/[\\s,]+/g, ' ').trim();\n}\n\n/**\n * Path data between `a` and `b` at `t` (0–1). Paths with the same command\n * structure morph number-by-number; others switch at the midpoint.\n */\nexport function interpolatePath(a: string, b: string, t: number): string {\n if (t <= 0) return a;\n if (t >= 1) return b;\n if (!pathsCompatible(a, b)) return t < 0.5 ? a : b;\n const nb = b.match(NUM) || [];\n let i = 0;\n return a.replace(NUM, (n) => {\n const v = Number(n) + (Number(nb[i++]) - Number(n)) * t;\n return String(Math.round(v * 1000) / 1000);\n });\n}\n\nconst ease = (t: number) => 1 - Math.pow(1 - t, 3);\n\nexport interface MorphOptions {\n duration?: number;\n easing?: (t: number) => number;\n}\n\n/** Animate a `<path>`'s `d` to `to`. Resolves when done; instant under reduced motion. */\nexport function morphTo(path: SVGPathElement | Element, to: string, o: MorphOptions = {}): Promise<void> {\n const from = path.getAttribute('d') || to;\n const dur = (o.duration ?? 500) * motionScale();\n const prev = (path as any).__usaMorph as number | undefined;\n if (prev) caf(prev);\n if (prefersReducedMotion() || dur <= 0 || from === to) {\n path.setAttribute('d', to);\n return Promise.resolve();\n }\n const fn = o.easing || ease;\n const t0 = now();\n return new Promise((resolve) => {\n const step = () => {\n const t = clamp((now() - t0) / dur, 0, 1);\n path.setAttribute('d', interpolatePath(from, to, fn(t)));\n if (t < 1) (path as any).__usaMorph = raf(step);\n else {\n (path as any).__usaMorph = 0;\n resolve();\n }\n };\n (path as any).__usaMorph = raf(step);\n });\n}\n\nconst DRAWABLE = 'path, line, polyline, polygon, circle, ellipse, rect';\n\n/**\n * Prepare every stroke in `root` for line drawing (normalised `pathLength=1`,\n * so no `getTotalLength()` is needed) and return a function that sets\n * progress 0–1, optionally staggered between shapes.\n */\nexport function drawLines(root: Element, o: { stagger?: number } = {}): (progress: number) => void {\n const shapes = Array.from(root.querySelectorAll(DRAWABLE)) as SVGElement[];\n shapes.forEach((s) => {\n s.setAttribute('pathLength', '1');\n s.style.strokeDasharray = '1 1';\n });\n const st = clamp(o.stagger ?? 0, 0, 0.9);\n return (p: number) => {\n const n = shapes.length;\n shapes.forEach((s, i) => {\n const start = n > 1 ? (i / (n - 1)) * st : 0;\n const local = clamp((p - start) / (1 - st || 1), 0, 1);\n s.style.strokeDashoffset = String(1 - local);\n });\n };\n}\n","import { defineElement, raf, caf, now, clamp, motionScale, type UsaElement } from '../base';\nimport { drawLines } from './core';\nimport css from './svg.css?raw';\n\n/**\n * `<usa-draw>` — line drawing: every stroke of the SVG inside draws itself.\n * Attributes: `trigger` (`view` default · `hover` · `click` · `scrub`),\n * `duration` (1600), `stagger` (0–0.9 share of the timeline, 0.2), `fill`\n * (fade the fill in after drawing), `repeat`. Method `play()`, property\n * `progress`, event `usa:complete`. Reduced motion: drawn immediately.\n */\nexport interface UsaDrawElement extends UsaElement {\n play(): void;\n progress: number;\n}\n\nexport function defineDraw(tag = 'usa-draw'): CustomElementConstructor | undefined {\n return defineElement(\n tag,\n (Base) =>\n class UsaDraw extends Base {\n private _set: (p: number) => void = () => {};\n private _p = 0;\n private _id = 0;\n\n get progress(): number {\n return this._p;\n }\n set progress(p: number) {\n this._p = clamp(p, 0, 1);\n this._set(this._p);\n this.toggleAttribute('data-drawn', this._p >= 1);\n }\n\n play(): void {\n caf(this._id);\n if (this.reduced) {\n this.progress = 1;\n return void this.emit('complete');\n }\n const dur = this.num('duration', 1600) * motionScale();\n const t0 = now();\n this.progress = 0;\n const step = () => {\n this.progress = (now() - t0) / dur;\n if (this._p < 1) this._id = raf(step);\n else this.emit('complete');\n };\n this._id = raf(step);\n }\n\n mount(): void {\n this._set = drawLines(this, { stagger: this.num('stagger', 0.2) });\n const trigger = this.str('trigger', 'view');\n if (this.reduced) {\n this.progress = 1;\n return;\n }\n this.progress = 0;\n if (trigger === 'scrub') {\n const update = () => {\n const r = this.getBoundingClientRect();\n const vh = window.innerHeight || 1;\n this.progress = (vh - r.top) / (vh * 0.6 + r.height * 0.4 || 1);\n };\n this.listen(window, 'scroll', update, { passive: true });\n update();\n } else if (trigger === 'hover') this.listen(this, 'pointerenter', () => this.play());\n else if (trigger === 'click') this.listen(this, 'click', () => this.play());\n else {\n let done = false;\n this.inView((v) => {\n if (v && (!done || this.flag('repeat'))) {\n done = true;\n this.play();\n } else if (!v && this.flag('repeat')) this.progress = 0;\n }, { threshold: 0.3 });\n }\n this.onCleanup(() => caf(this._id));\n }\n },\n { id: 'svg', text: css }\n );\n}\n","import { defineElement, type UsaElement } from '../base';\nimport { morphTo } from './core';\nimport css from './svg.css?raw';\n\n/**\n * `<usa-morph>` — morphs an SVG path through a list of shapes.\n * Put a `<svg><path></path></svg>` inside (one is created otherwise) and set\n * `paths=\"M… | M… | M…\"` (same command structure morphs smoothly, others\n * switch at the midpoint). Attributes: `trigger` (`click` default · `hover`\n * · `auto` · `view`), `interval` (ms for auto, 2000), `duration` (600).\n * Property `index`, method `next()`, event `usa:change`.\n * Reduced motion: shapes switch without animating; `auto` does not cycle.\n */\nexport interface UsaMorphElement extends UsaElement {\n readonly index: number;\n next(): Promise<void>;\n}\n\nexport function defineMorph(tag = 'usa-morph'): CustomElementConstructor | undefined {\n return defineElement(\n tag,\n (Base) =>\n class UsaMorph extends Base {\n static get observedAttributes(): string[] {\n return ['paths', 'trigger'];\n }\n private _i = 0;\n private _path: SVGPathElement | null = null;\n\n get index(): number {\n return this._i;\n }\n\n private list(): string[] {\n return this.str('paths').split('|').map((s) => s.trim()).filter(Boolean);\n }\n\n next(): Promise<void> {\n const l = this.list();\n if (!this._path || l.length < 2) return Promise.resolve();\n this._i = (this._i + 1) % l.length;\n this.emit('change', { index: this._i });\n return morphTo(this._path, l[this._i], { duration: this.num('duration', 600) });\n }\n\n mount(): void {\n let path = this.querySelector('path');\n if (!path) {\n this.innerHTML = '<svg viewBox=\"0 0 100 100\" aria-hidden=\"true\"><path></path></svg>';\n path = this.querySelector('path');\n }\n this._path = path as SVGPathElement;\n const l = this.list();\n if (l[0]) this._path.setAttribute('d', l[this._i % l.length]);\n const t = this.str('trigger', 'click');\n if (t === 'hover') {\n this.listen(this, 'pointerenter', () => void this.next());\n this.listen(this, 'pointerleave', () => void this.next());\n } else if (t === 'auto' || t === 'view') {\n let timer: ReturnType<typeof setInterval> | undefined;\n this.inView((v) => {\n clearInterval(timer);\n if (!v || this.reduced) return;\n if (t === 'view') return void this.next();\n timer = setInterval(() => void this.next(), this.num('interval', 2000));\n });\n this.onCleanup(() => clearInterval(timer));\n } else {\n if (!this.hasAttribute('tabindex')) this.tabIndex = 0;\n if (!this.hasAttribute('role')) this.setAttribute('role', 'button');\n this.listen(this, 'click', () => void this.next());\n this.listen(this, 'keydown', (e: KeyboardEvent) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n void this.next();\n }\n });\n }\n }\n },\n { id: 'svg', text: css }\n );\n}\n","import { defineElement, EASE_OUT, type UsaElement } from '../base';\nimport css from './svg.css?raw';\n\n/** Clip-path start / end frames for each reveal shape. */\nexport const MASK_SHAPES: Record<string, [string, string]> = {\n circle: ['circle(0% at 50% 50%)', 'circle(75% at 50% 50%)'],\n diamond: ['polygon(50% 50%, 50% 50%, 50% 50%, 50% 50%)', 'polygon(50% -50%, 150% 50%, 50% 150%, -50% 50%)'],\n wipe: ['inset(0 100% 0 0)', 'inset(0 0% 0 0)'],\n 'wipe-up': ['inset(100% 0 0 0)', 'inset(0% 0 0 0)'],\n iris: ['inset(50% 50% 50% 50% round 50%)', 'inset(0% 0% 0% 0% round 0%)'],\n star: [\n 'polygon(50% 50%, 50% 50%, 50% 50%, 50% 50%, 50% 50%, 50% 50%, 50% 50%, 50% 50%, 50% 50%, 50% 50%)',\n 'polygon(50% -60%, 80% 20%, 160% 30%, 95% 85%, 115% 170%, 50% 125%, -15% 170%, 5% 85%, -60% 30%, 20% 20%)',\n ],\n};\n\n/**\n * `<usa-mask-reveal>` — reveals its content through a growing mask shape.\n * Attributes: `shape` (`circle` default · `diamond` · `wipe` · `wipe-up` ·\n * `iris` · `star`), `duration` (900), `delay`, `trigger` (`view` · `hover`\n * · `click`), `repeat`, `at` (`x% y%` origin for circle). Event\n * `usa:complete`. Reduced motion: content is shown without the mask.\n */\nexport interface UsaMaskRevealElement extends UsaElement {\n reveal(): Promise<void>;\n}\n\nexport function defineMaskReveal(tag = 'usa-mask-reveal'): CustomElementConstructor | undefined {\n return defineElement(\n tag,\n (Base) =>\n class UsaMaskReveal extends Base {\n private frames(): [string, string] {\n const s = MASK_SHAPES[this.str('shape', 'circle')] || MASK_SHAPES.circle;\n const at = this.str('at');\n return at && s[0].startsWith('circle') ? [s[0].replace('50% 50%', at), s[1].replace('50% 50%', at)] : s;\n }\n\n reveal(): Promise<void> {\n const [a, b] = this.frames();\n this.setAttribute('data-state', 'revealing');\n const anim = this.motion(this, [{ clipPath: a }, { clipPath: b }], { duration: this.num('duration', 900), delay: this.num('delay', 0), easing: EASE_OUT, fill: 'forwards' });\n const done = () => {\n this.setAttribute('data-state', 'visible');\n this.emit('complete');\n };\n if (!anim) return Promise.resolve(done());\n return anim.finished.then(done, () => {});\n }\n\n mount(): void {\n if (this.reduced) {\n this.setAttribute('data-state', 'visible');\n return;\n }\n this.setAttribute('data-state', 'hidden');\n this.style.clipPath = this.frames()[0];\n this.onCleanup(() => (this.style.clipPath = ''));\n const t = this.str('trigger', 'view');\n if (t === 'hover') this.listen(this, 'pointerenter', () => void this.reveal());\n else if (t === 'click') this.listen(this, 'click', () => void this.reveal());\n else {\n let done = false;\n this.inView((v) => {\n if (v && (!done || this.flag('repeat'))) {\n done = true;\n void this.reveal();\n } else if (!v && this.flag('repeat')) {\n this.getAnimations?.().forEach((x) => x.cancel());\n this.style.clipPath = this.frames()[0];\n this.setAttribute('data-state', 'hidden');\n }\n }, { threshold: 0.25 });\n }\n }\n },\n { id: 'svg', text: css }\n );\n}\n","import { defineElement, type UsaElement } from '../base';\nimport css from './svg.css?raw';\n\ntype Icon = { d: string; frames: Keyframe[]; duration: number; origin?: string };\n\n/** Built-in animated icons (24×24 strokes) and the motion each one plays. */\nexport const ANIM_ICONS: Record<string, Icon> = {\n bell: { d: 'M6 16V11a6 6 0 0 1 12 0v5l2 2H4l2-2M10 20a2 2 0 0 0 4 0', duration: 800, origin: '50% 10%', frames: [{ rotate: '0deg' }, { rotate: '18deg' }, { rotate: '-14deg' }, { rotate: '9deg' }, { rotate: '-5deg' }, { rotate: '0deg' }] },\n heart: { d: 'M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z', duration: 600, frames: [{ scale: 1 }, { scale: 1.3 }, { scale: 0.92 }, { scale: 1.12 }, { scale: 1 }] },\n check: { d: 'M4 12.5l5 5L20 6.5', duration: 600, frames: [{ strokeDashoffset: 1 }, { strokeDashoffset: 0 }] },\n arrow: { d: 'M4 12h15M13 6l6 6-6 6', duration: 600, frames: [{ translate: '0 0' }, { translate: '5px 0' }, { translate: '0 0' }] },\n star: { d: 'M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z', duration: 700, frames: [{ rotate: '0deg', scale: 1 }, { rotate: '72deg', scale: 1.2 }, { rotate: '144deg', scale: 1 }] },\n gear: { d: 'M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8zM12 2v3M12 19v3M2 12h3M19 12h3M4.9 4.9l2.1 2.1M17 17l2.1 2.1M4.9 19.1L7 17M17 7l2.1-2.1', duration: 900, frames: [{ rotate: '0deg' }, { rotate: '180deg' }] },\n search: { d: 'M10.5 4a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13zM15.5 15.5L20 20', duration: 700, frames: [{ rotate: '0deg' }, { rotate: '-15deg' }, { rotate: '10deg' }, { rotate: '0deg' }] },\n download: { d: 'M12 4v11M7 10l5 5 5-5M5 20h14', duration: 700, frames: [{ translate: '0 0' }, { translate: '0 3px' }, { translate: '0 0' }] },\n};\n\n/**\n * `<usa-anim-icon name=\"bell\">` — an animated stroke icon that plays its\n * motion on `trigger` (`hover` default · `click` · `view` · `loop`).\n * Attributes: `name` (see `ANIM_ICONS`), `size` (24), `label` (accessible\n * name; decorative when absent). Method `play()`. Reduced motion: static.\n */\nexport interface UsaAnimIconElement extends UsaElement {\n play(): void;\n}\n\nexport function defineAnimIcon(tag = 'usa-anim-icon'): CustomElementConstructor | undefined {\n return defineElement(\n tag,\n (Base) =>\n class UsaAnimIcon extends Base {\n static get observedAttributes(): string[] {\n return ['name', 'size', 'label'];\n }\n private icon(): Icon {\n return ANIM_ICONS[this.str('name', 'heart')] || ANIM_ICONS.heart;\n }\n\n play(): void {\n if (this.reduced) return;\n const svg = this.querySelector('svg');\n const i = this.icon();\n const target = i.frames[0].strokeDashoffset !== undefined ? this.querySelector('path') : svg;\n if (target) this.motion(target, i.frames, { duration: i.duration, easing: 'ease-in-out', iterations: this.str('trigger') === 'loop' ? Infinity : 1 });\n }\n\n mount(): void {\n const i = this.icon();\n const size = this.num('size', 24);\n const label = this.str('label');\n this.innerHTML = `<svg viewBox=\"0 0 24 24\" width=\"${size}\" height=\"${size}\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"transform-origin:${i.origin || '50% 50%'}\"${label ? ` role=\"img\" aria-label=\"${label.replace(/\"/g, '"')}\"` : ' aria-hidden=\"true\"'}><path d=\"${i.d}\"${i.frames[0].strokeDashoffset !== undefined ? ' pathLength=\"1\" stroke-dasharray=\"1\"' : ''}></path></svg>`;\n const t = this.str('trigger', 'hover');\n if (t === 'click') this.listen(this, 'click', () => this.play());\n else if (t === 'view' || t === 'loop') this.inView((v) => v && this.play(), { threshold: 0.5 });\n else {\n this.listen(this, 'pointerenter', () => this.play());\n this.listen(this, 'focusin', () => this.play());\n }\n }\n },\n { id: 'svg', text: css }\n );\n}\n","/**\n * use-scroll-animate/components/svg — SVG animation (v3.3).\n * `<usa-draw>` (line drawing), `<usa-morph>` (path morph), `<usa-mask-reveal>`\n * (mask / clip-path reveals) and `<usa-anim-icon>` (animated icons), plus\n * `interpolatePath()`, `morphTo()`, `drawLines()`.\n */\nimport { defineDraw, type UsaDrawElement } from './draw';\nimport { defineMorph, type UsaMorphElement } from './morph';\nimport { defineMaskReveal, type UsaMaskRevealElement } from './mask-reveal';\nimport { defineAnimIcon, type UsaAnimIconElement } from './anim-icon';\n\nexport { defineDraw, defineMorph, defineMaskReveal, defineAnimIcon };\nexport { interpolatePath, pathsCompatible, morphTo, drawLines } from './core';\nexport type { MorphOptions } from './core';\nexport { MASK_SHAPES } from './mask-reveal';\nexport { ANIM_ICONS } from './anim-icon';\nexport type { UsaDrawElement, UsaMorphElement, UsaMaskRevealElement, UsaAnimIconElement };\nexport { configureComponents, prefersReducedMotion } from '../base';\nexport type { ComponentsConfig, UsaElement } from '../base';\n\n/** Register every component of this category under its default tag. */\nexport function defineSvgComponents(): void {\n defineDraw();\n defineMorph();\n defineMaskReveal();\n defineAnimIcon();\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'usa-draw': UsaDrawElement;\n 'usa-morph': UsaMorphElement;\n 'usa-mask-reveal': UsaMaskRevealElement;\n 'usa-anim-icon': UsaAnimIconElement;\n }\n}\n"],"names":[],"mappings":";;;AAEA,MAAM,GAAG,GAAG,uCAAuC;AAEnD;AACM,SAAU,eAAe,CAAC,CAAS,EAAE,CAAS,EAAA;AAClD,IAAA,OAAO,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE;AAClH;AAEA;;;AAGG;SACa,eAAe,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAA;IAC7D,IAAI,CAAC,IAAI,CAAC;AAAE,QAAA,OAAO,CAAC;IACpB,IAAI,CAAC,IAAI,CAAC;AAAE,QAAA,OAAO,CAAC;AACpB,IAAA,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC;QAAE,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC;IAClD,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE;IAC7B,IAAI,CAAC,GAAG,CAAC;IACT,OAAO,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,KAAI;QAC1B,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CA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AI,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC;iBAC1F;AACH,gBAAA,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;AACpD,gBAAA,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;YACjD;QACF;KACD,EACH,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,CACzB;AACH;;AC/DA;;;;;AAKG;AAeH;SACgB,mBAAmB,GAAA;AACjC,IAAA,UAAU,EAAE;AACZ,IAAA,WAAW,EAAE;AACb,IAAA,gBAAgB,EAAE;AAClB,IAAA,cAAc,EAAE;AAClB;;;;"}
|
|
1
|
+
{"version":3,"file":"svg.js","sources":["../../src/components/svg/core.ts","../../src/components/svg/draw.ts","../../src/components/svg/morph.ts","../../src/components/svg/mask-reveal.ts","../../src/components/svg/anim-icon.ts","../../src/components/svg/index.ts"],"sourcesContent":["import { prefersReducedMotion, motionScale, raf, caf, now, clamp } from '../base';\n\nconst NUM = /-?(?:\\d+\\.?\\d*|\\.\\d+)(?:e[-+]?\\d+)?/gi;\n\n/** `true` when two path strings share the same commands (so their numbers can be interpolated). */\nexport function pathsCompatible(a: string, b: string): boolean {\n return a.replace(NUM, '#').replace(/[\\s,]+/g, ' ').trim() === b.replace(NUM, '#').replace(/[\\s,]+/g, ' ').trim();\n}\n\n/**\n * Path data between `a` and `b` at `t` (0–1). Paths with the same command\n * structure morph number-by-number; others switch at the midpoint.\n */\nexport function interpolatePath(a: string, b: string, t: number): string {\n if (t <= 0) return a;\n if (t >= 1) return b;\n if (!pathsCompatible(a, b)) return t < 0.5 ? a : b;\n const nb = b.match(NUM) || [];\n let i = 0;\n return a.replace(NUM, (n) => {\n const v = Number(n) + (Number(nb[i++]) - Number(n)) * t;\n return String(Math.round(v * 1000) / 1000);\n });\n}\n\nconst ease = (t: number) => 1 - Math.pow(1 - t, 3);\n\nexport interface MorphOptions {\n duration?: number;\n easing?: (t: number) => number;\n}\n\n/** Animate a `<path>`'s `d` to `to`. Resolves when done; instant under reduced motion. */\nexport function morphTo(path: SVGPathElement | Element, to: string, o: MorphOptions = {}): Promise<void> {\n const from = path.getAttribute('d') || to;\n const dur = (o.duration ?? 500) * motionScale();\n const prev = (path as any).__usaMorph as number | undefined;\n if (prev) caf(prev);\n if (prefersReducedMotion() || dur <= 0 || from === to) {\n path.setAttribute('d', to);\n return Promise.resolve();\n }\n const fn = o.easing || ease;\n const t0 = now();\n return new Promise((resolve) => {\n const step = () => {\n const t = clamp((now() - t0) / dur, 0, 1);\n path.setAttribute('d', interpolatePath(from, to, fn(t)));\n if (t < 1) (path as any).__usaMorph = raf(step);\n else {\n (path as any).__usaMorph = 0;\n resolve();\n }\n };\n (path as any).__usaMorph = raf(step);\n });\n}\n\nconst DRAWABLE = 'path, line, polyline, polygon, circle, ellipse, rect';\n\n/**\n * Prepare every stroke in `root` for line drawing (normalised `pathLength=1`,\n * so no `getTotalLength()` is needed) and return a function that sets\n * progress 0–1, optionally staggered between shapes.\n */\nexport function drawLines(root: Element, o: { stagger?: number } = {}): (progress: number) => void {\n const shapes = Array.from(root.querySelectorAll(DRAWABLE)) as SVGElement[];\n shapes.forEach((s) => {\n s.setAttribute('pathLength', '1');\n s.style.strokeDasharray = '1 1';\n });\n const st = clamp(o.stagger ?? 0, 0, 0.9);\n return (p: number) => {\n const n = shapes.length;\n shapes.forEach((s, i) => {\n const start = n > 1 ? (i / (n - 1)) * st : 0;\n const local = clamp((p - start) / (1 - st || 1), 0, 1);\n s.style.strokeDashoffset = String(1 - local);\n });\n };\n}\n","import { defineElement, raf, caf, now, clamp, motionScale, type UsaElement } from '../base';\nimport { drawLines } from './core';\nimport css from './svg.css?raw';\n\n/**\n * `<usa-draw>` — line drawing: every stroke of the SVG inside draws itself.\n * Attributes: `trigger` (`view` default · `hover` · `click` · `scrub`),\n * `duration` (1600), `stagger` (0–0.9 share of the timeline, 0.2), `fill`\n * (fade the fill in after drawing), `repeat`. Method `play()`, property\n * `progress`, event `usa:complete`. Reduced motion: drawn immediately.\n */\nexport interface UsaDrawElement extends UsaElement {\n play(): void;\n progress: number;\n}\n\nexport function defineDraw(tag = 'usa-draw'): CustomElementConstructor | undefined {\n return defineElement(\n tag,\n (Base) =>\n class UsaDraw extends Base {\n private _set: (p: number) => void = () => {};\n private _p = 0;\n private _id = 0;\n\n get progress(): number {\n return this._p;\n }\n set progress(p: number) {\n this._p = clamp(p, 0, 1);\n this._set(this._p);\n this.toggleAttribute('data-drawn', this._p >= 1);\n }\n\n play(): void {\n caf(this._id);\n if (this.reduced) {\n this.progress = 1;\n return void this.emit('complete');\n }\n const dur = this.num('duration', 1600) * motionScale();\n const t0 = now();\n this.progress = 0;\n const step = () => {\n this.progress = (now() - t0) / dur;\n if (this._p < 1) this._id = raf(step);\n else this.emit('complete');\n };\n this._id = raf(step);\n }\n\n mount(): void {\n this._set = drawLines(this, { stagger: this.num('stagger', 0.2) });\n const trigger = this.str('trigger', 'view');\n if (this.reduced) {\n this.progress = 1;\n return;\n }\n this.progress = 0;\n if (trigger === 'scrub') {\n const update = () => {\n const r = this.getBoundingClientRect();\n const vh = window.innerHeight || 1;\n this.progress = (vh - r.top) / (vh * 0.6 + r.height * 0.4 || 1);\n };\n this.listen(window, 'scroll', update, { passive: true });\n update();\n } else if (trigger === 'hover') this.listen(this, 'pointerenter', () => this.play());\n else if (trigger === 'click') this.listen(this, 'click', () => this.play());\n else {\n let done = false;\n this.inView((v) => {\n if (v && (!done || this.flag('repeat'))) {\n done = true;\n this.play();\n } else if (!v && this.flag('repeat')) this.progress = 0;\n }, { threshold: 0.3 });\n }\n this.onCleanup(() => caf(this._id));\n }\n },\n { id: 'svg', text: css }\n );\n}\n","import { defineElement, type UsaElement } from '../base';\nimport { morphTo } from './core';\nimport css from './svg.css?raw';\n\n/**\n * `<usa-morph>` — morphs an SVG path through a list of shapes.\n * Put a `<svg><path></path></svg>` inside (one is created otherwise) and set\n * `paths=\"M… | M… | M…\"` (same command structure morphs smoothly, others\n * switch at the midpoint). Attributes: `trigger` (`click` default · `hover`\n * · `auto` · `view`), `interval` (ms for auto, 2000), `duration` (600).\n * Property `index`, method `next()`, event `usa:change`.\n * Reduced motion: shapes switch without animating; `auto` does not cycle.\n */\nexport interface UsaMorphElement extends UsaElement {\n readonly index: number;\n next(): Promise<void>;\n}\n\nexport function defineMorph(tag = 'usa-morph'): CustomElementConstructor | undefined {\n return defineElement(\n tag,\n (Base) =>\n class UsaMorph extends Base {\n static get observedAttributes(): string[] {\n return ['paths', 'trigger'];\n }\n private _i = 0;\n private _path: SVGPathElement | null = null;\n\n get index(): number {\n return this._i;\n }\n\n private list(): string[] {\n return this.str('paths').split('|').map((s) => s.trim()).filter(Boolean);\n }\n\n next(): Promise<void> {\n const l = this.list();\n if (!this._path || l.length < 2) return Promise.resolve();\n this._i = (this._i + 1) % l.length;\n this.emit('change', { index: this._i });\n return morphTo(this._path, l[this._i], { duration: this.num('duration', 600) });\n }\n\n mount(): void {\n let path = this.querySelector('path');\n if (!path) {\n this.innerHTML = '<svg viewBox=\"0 0 100 100\" aria-hidden=\"true\"><path></path></svg>';\n path = this.querySelector('path');\n }\n this._path = path as SVGPathElement;\n const l = this.list();\n if (l[0]) this._path.setAttribute('d', l[this._i % l.length]);\n const t = this.str('trigger', 'click');\n if (t === 'hover') {\n this.listen(this, 'pointerenter', () => void this.next());\n this.listen(this, 'pointerleave', () => void this.next());\n } else if (t === 'auto' || t === 'view') {\n let timer: ReturnType<typeof setInterval> | undefined;\n this.inView((v) => {\n clearInterval(timer);\n if (!v || this.reduced) return;\n if (t === 'view') return void this.next();\n timer = setInterval(() => void this.next(), this.num('interval', 2000));\n });\n this.onCleanup(() => clearInterval(timer));\n } else {\n if (!this.hasAttribute('tabindex')) this.tabIndex = 0;\n if (!this.hasAttribute('role')) this.setAttribute('role', 'button');\n this.listen(this, 'click', () => void this.next());\n this.listen(this, 'keydown', (e: KeyboardEvent) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n void this.next();\n }\n });\n }\n }\n },\n { id: 'svg', text: css }\n );\n}\n","import { defineElement, EASE_OUT, type UsaElement } from '../base';\nimport css from './svg.css?raw';\n\n/** Clip-path start / end frames for each reveal shape. */\nexport const MASK_SHAPES: Record<string, [string, string]> = {\n circle: ['circle(0% at 50% 50%)', 'circle(75% at 50% 50%)'],\n diamond: ['polygon(50% 50%, 50% 50%, 50% 50%, 50% 50%)', 'polygon(50% -50%, 150% 50%, 50% 150%, -50% 50%)'],\n wipe: ['inset(0 100% 0 0)', 'inset(0 0% 0 0)'],\n 'wipe-up': ['inset(100% 0 0 0)', 'inset(0% 0 0 0)'],\n iris: ['inset(50% 50% 50% 50% round 50%)', 'inset(0% 0% 0% 0% round 0%)'],\n star: [\n 'polygon(50% 50%, 50% 50%, 50% 50%, 50% 50%, 50% 50%, 50% 50%, 50% 50%, 50% 50%, 50% 50%, 50% 50%)',\n 'polygon(50% -60%, 80% 20%, 160% 30%, 95% 85%, 115% 170%, 50% 125%, -15% 170%, 5% 85%, -60% 30%, 20% 20%)',\n ],\n};\n\n/**\n * `<usa-mask-reveal>` — reveals its content through a growing mask shape.\n * Attributes: `shape` (`circle` default · `diamond` · `wipe` · `wipe-up` ·\n * `iris` · `star`), `duration` (900), `delay`, `trigger` (`view` · `hover`\n * · `click`), `repeat`, `at` (`x% y%` origin for circle). Event\n * `usa:complete`. Reduced motion: content is shown without the mask.\n */\nexport interface UsaMaskRevealElement extends UsaElement {\n reveal(): Promise<void>;\n}\n\nexport function defineMaskReveal(tag = 'usa-mask-reveal'): CustomElementConstructor | undefined {\n return defineElement(\n tag,\n (Base) =>\n class UsaMaskReveal extends Base {\n private frames(): [string, string] {\n const s = MASK_SHAPES[this.str('shape', 'circle')] || MASK_SHAPES.circle;\n const at = this.str('at');\n return at && s[0].startsWith('circle') ? [s[0].replace('50% 50%', at), s[1].replace('50% 50%', at)] : s;\n }\n\n reveal(): Promise<void> {\n const [a, b] = this.frames();\n this.setAttribute('data-state', 'revealing');\n // fill 'both' keeps the closed mask applied during `delay`\n const anim = this.motion(this, [{ clipPath: a }, { clipPath: b }], { duration: this.num('duration', 900), delay: this.num('delay', 0), easing: EASE_OUT, fill: 'both' });\n this.style.opacity = '';\n const done = () => {\n this.setAttribute('data-state', 'visible');\n this.emit('complete');\n };\n if (!anim) return Promise.resolve(done());\n return anim.finished.then(done, () => {});\n }\n\n mount(): void {\n if (this.reduced) {\n this.setAttribute('data-state', 'visible');\n return;\n }\n // 4.0.1: hide with opacity, not the closed clip-path — Chromium's\n // IntersectionObserver honours the target's own clip-path, so a fully\n // clipped element never reports as intersecting and never revealed.\n const hide = () => {\n this.getAnimations?.().forEach((x) => x.cancel());\n this.style.opacity = '0';\n this.setAttribute('data-state', 'hidden');\n };\n hide();\n this.onCleanup(() => ((this.style.opacity = ''), (this.style.clipPath = '')));\n const t = this.str('trigger', 'view');\n if (t === 'hover') this.listen(this, 'pointerenter', () => void this.reveal());\n else if (t === 'click') this.listen(this, 'click', () => void this.reveal());\n else {\n let done = false;\n this.inView((v) => {\n if (v && (!done || this.flag('repeat'))) {\n done = true;\n void this.reveal();\n } else if (!v && this.flag('repeat')) hide();\n }, { threshold: 0.25 });\n }\n }\n },\n { id: 'svg', text: css }\n );\n}\n","import { defineElement, type UsaElement } from '../base';\nimport css from './svg.css?raw';\n\ntype Icon = { d: string; frames: Keyframe[]; duration: number; origin?: string };\n\n/** Built-in animated icons (24×24 strokes) and the motion each one plays. */\nexport const ANIM_ICONS: Record<string, Icon> = {\n bell: { d: 'M6 16V11a6 6 0 0 1 12 0v5l2 2H4l2-2M10 20a2 2 0 0 0 4 0', duration: 800, origin: '50% 10%', frames: [{ rotate: '0deg' }, { rotate: '18deg' }, { rotate: '-14deg' }, { rotate: '9deg' }, { rotate: '-5deg' }, { rotate: '0deg' }] },\n heart: { d: 'M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z', duration: 600, frames: [{ scale: 1 }, { scale: 1.3 }, { scale: 0.92 }, { scale: 1.12 }, { scale: 1 }] },\n check: { d: 'M4 12.5l5 5L20 6.5', duration: 600, frames: [{ strokeDashoffset: 1 }, { strokeDashoffset: 0 }] },\n arrow: { d: 'M4 12h15M13 6l6 6-6 6', duration: 600, frames: [{ translate: '0 0' }, { translate: '5px 0' }, { translate: '0 0' }] },\n star: { d: 'M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z', duration: 700, frames: [{ rotate: '0deg', scale: 1 }, { rotate: '72deg', scale: 1.2 }, { rotate: '144deg', scale: 1 }] },\n gear: { d: 'M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8zM12 2v3M12 19v3M2 12h3M19 12h3M4.9 4.9l2.1 2.1M17 17l2.1 2.1M4.9 19.1L7 17M17 7l2.1-2.1', duration: 900, frames: [{ rotate: '0deg' }, { rotate: '180deg' }] },\n search: { d: 'M10.5 4a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13zM15.5 15.5L20 20', duration: 700, frames: [{ rotate: '0deg' }, { rotate: '-15deg' }, { rotate: '10deg' }, { rotate: '0deg' }] },\n download: { d: 'M12 4v11M7 10l5 5 5-5M5 20h14', duration: 700, frames: [{ translate: '0 0' }, { translate: '0 3px' }, { translate: '0 0' }] },\n};\n\n/**\n * `<usa-anim-icon name=\"bell\">` — an animated stroke icon that plays its\n * motion on `trigger` (`hover` default · `click` · `view` · `loop`).\n * Attributes: `name` (see `ANIM_ICONS`), `size` (24), `label` (accessible\n * name; decorative when absent). Method `play()`. Reduced motion: static.\n */\nexport interface UsaAnimIconElement extends UsaElement {\n play(): void;\n}\n\nexport function defineAnimIcon(tag = 'usa-anim-icon'): CustomElementConstructor | undefined {\n return defineElement(\n tag,\n (Base) =>\n class UsaAnimIcon extends Base {\n static get observedAttributes(): string[] {\n return ['name', 'size', 'label'];\n }\n private icon(): Icon {\n return ANIM_ICONS[this.str('name', 'heart')] || ANIM_ICONS.heart;\n }\n\n play(): void {\n if (this.reduced) return;\n const svg = this.querySelector('svg');\n const i = this.icon();\n const target = i.frames[0].strokeDashoffset !== undefined ? this.querySelector('path') : svg;\n if (target) this.motion(target, i.frames, { duration: i.duration, easing: 'ease-in-out', iterations: this.str('trigger') === 'loop' ? Infinity : 1 });\n }\n\n mount(): void {\n const i = this.icon();\n const size = this.num('size', 24);\n const label = this.str('label');\n this.innerHTML = `<svg viewBox=\"0 0 24 24\" width=\"${size}\" height=\"${size}\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"transform-origin:${i.origin || '50% 50%'}\"${label ? ` role=\"img\" aria-label=\"${label.replace(/\"/g, '"')}\"` : ' aria-hidden=\"true\"'}><path d=\"${i.d}\"${i.frames[0].strokeDashoffset !== undefined ? ' pathLength=\"1\" stroke-dasharray=\"1\"' : ''}></path></svg>`;\n const t = this.str('trigger', 'hover');\n if (t === 'click') this.listen(this, 'click', () => this.play());\n else if (t === 'view' || t === 'loop') this.inView((v) => v && this.play(), { threshold: 0.5 });\n else {\n this.listen(this, 'pointerenter', () => this.play());\n this.listen(this, 'focusin', () => this.play());\n }\n }\n },\n { id: 'svg', text: css }\n );\n}\n","/**\n * use-scroll-animate/components/svg — SVG animation (v3.3).\n * `<usa-draw>` (line drawing), `<usa-morph>` (path morph), `<usa-mask-reveal>`\n * (mask / clip-path reveals) and `<usa-anim-icon>` (animated icons), plus\n * `interpolatePath()`, `morphTo()`, `drawLines()`.\n */\nimport { defineDraw, type UsaDrawElement } from './draw';\nimport { defineMorph, type UsaMorphElement } from './morph';\nimport { defineMaskReveal, type UsaMaskRevealElement } from './mask-reveal';\nimport { defineAnimIcon, type UsaAnimIconElement } from './anim-icon';\n\nexport { defineDraw, defineMorph, defineMaskReveal, defineAnimIcon };\nexport { interpolatePath, pathsCompatible, morphTo, drawLines } from './core';\nexport type { MorphOptions } from './core';\nexport { MASK_SHAPES } from './mask-reveal';\nexport { ANIM_ICONS } from './anim-icon';\nexport type { UsaDrawElement, UsaMorphElement, UsaMaskRevealElement, UsaAnimIconElement };\nexport { configureComponents, prefersReducedMotion } from '../base';\nexport type { ComponentsConfig, UsaElement } from '../base';\n\n/** Register every component of this category under its default tag. */\nexport function defineSvgComponents(): void {\n defineDraw();\n defineMorph();\n defineMaskReveal();\n defineAnimIcon();\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'usa-draw': UsaDrawElement;\n 'usa-morph': UsaMorphElement;\n 'usa-mask-reveal': UsaMaskRevealElement;\n 'usa-anim-icon': UsaAnimIconElement;\n }\n}\n"],"names":[],"mappings":";;;AAEA,MAAM,GAAG,GAAG,uCAAuC;AAEnD;AACM,SAAU,eAAe,CAAC,CAAS,EAAE,CAAS,EAAA;AAClD,IAAA,OAAO,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE;AAClH;AAEA;;;AAGG;SACa,eAAe,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAA;IAC7D,IAAI,CAAC,IAAI,CAAC;AAAE,QAAA,OAAO,CAAC;IACpB,IAAI,CAAC,IAAI,CAAC;AAAE,QAAA,OAAO,CAAC;AACpB,IAAA,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC;QAAE,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC;IAClD,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE;IAC7B,IAAI,CA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;AAAE,gBAAA,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;AAC3D,iBAAA,IAAI,CAAC,KAAK,MAAM,IAAI,CAAC,KAAK,MAAM;gBAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC;iBAC1F;AACH,gBAAA,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;AACpD,gBAAA,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;YACjD;QACF;KACD,EACH,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,CACzB;AACH;;AC/DA;;;;;AAKG;AAeH;SACgB,mBAAmB,GAAA;AACjC,IAAA,UAAU,EAAE;AACZ,IAAA,WAAW,EAAE;AACb,IAAA,gBAAgB,EAAE;AAClB,IAAA,cAAc,EAAE;AAClB;;;;"}
|
package/dist/components/text.cjs
CHANGED
|
@@ -499,7 +499,7 @@ function defineTextRotate(tag = 'usa-text-rotate') {
|
|
|
499
499
|
}, { id: 'text-rotate', text: css$1 });
|
|
500
500
|
}
|
|
501
501
|
|
|
502
|
-
var css = "usa-wave-text .usa-word,usa-scroll-highlight .usa-word{display:inline-block;white-space:nowrap}usa-wave-text .usa-char{display:inline-block;animation:usa-wave var(--usa-wave-s,1.6s) ease-in-out infinite;animation-delay:calc(var(--i) * var(--usa-wave-d,0.06s))}@keyframes usa-wave{0%,60%,100%{transform:translateY(0)}30%{transform:translateY(calc(var(--usa-wave-a,0.25em) * -1))}}usa-glitch{position:relative;display:inline-block}usa-glitch::before,usa-glitch::after{content:attr(data-text);position:absolute;inset:0;pointer-events:none}usa-glitch::before{color:#ff2bd6;transform:translate(calc(var(--usa-glitch-i,3px) * -1),0);clip-path:inset(0 0 55% 0);mix-blend-mode:screen;animation:usa-glitch-a 2.4s steps(2,end) infinite}usa-glitch::after{color:#00f0ff;transform:translate(var(--usa-glitch-i,3px),0);clip-path:inset(50% 0 0 0);mix-blend-mode:screen;animation:usa-glitch-b 1.9s steps(2,end) infinite}usa-glitch[trigger=\"hover\"]::before,usa-glitch[trigger=\"hover\"]::after{animation-play-state:paused;opacity:0}usa-glitch[trigger=\"hover\"]:hover::before,usa-glitch[trigger=\"hover\"]:hover::after{animation-play-state:running;opacity:1}@keyframes usa-glitch-a{0%{clip-path:inset(0 0 80% 0)}20%{clip-path:inset(30% 0 40% 0)}40%{clip-path:inset(70% 0 5% 0)}60%{clip-path:inset(10% 0 60% 0)}80%{clip-path:inset(50% 0 30% 0)}100%{clip-path:inset(0 0 80% 0)}}@keyframes usa-glitch-b{0%{clip-path:inset(60% 0 10% 0)}25%{clip-path:inset(15% 0 70% 0)}50%{clip-path:inset(80% 0 2% 0)}75%{clip-path:inset(40% 0 35% 0)}100%{clip-path:inset(60% 0 10% 0)}}usa-gradient-text{background:var(--usa-grad) 0 50% / 300% 100%;-webkit-background-clip:text;background-clip:text;color:transparent;-webkit-text-fill-color:transparent;animation:usa-grad-flow var(--usa-grad-s,6s) linear infinite}@keyframes usa-grad-flow{to{background-position:150% 50%}}usa-handwriting{--usa-hw-stroke:currentColor;display:inline-block;line-height:0}usa-handwriting svg{max-width:100%;height:auto;overflow:visible}usa-handwriting text{fill:transparent;stroke:var(--usa-hw-stroke);stroke-width:1.2;stroke-dasharray:1600;stroke-dashoffset:1600;font-family:\"Segoe Script\",\"Brush Script MT\",\"Snell Roundhand\",cursive}usa-handwriting[data-state=\"drawing\"] text{animation:usa-hw-draw var(--usa-hw-d,2400ms) cubic-bezier(0.55,0,0.45,1) forwards,usa-hw-fill 0.6s ease calc(var(--usa-hw-d,2400ms) * 0.8) forwards}usa-handwriting[data-state=\"done\"] text{stroke-dashoffset:0;fill:currentColor}@keyframes usa-hw-draw{to{stroke-dashoffset:0}}@keyframes usa-hw-fill{to{fill:currentColor}}usa-scroll-highlight .usa-hl-word{opacity:var(--usa-hl-dim,0.2);transition:opacity 0.35s ease}usa-scroll-highlight .usa-hl-word[data-on]{opacity:1}usa-scroll-highlight[mode=\"marker\"]{--usa-hl-color:color-mix(in srgb,#facc15 55%,transparent);background:linear-gradient(var(--usa-hl-color),var(--usa-hl-color)) 0 88% / 0% 40% no-repeat;transition:background-size 1s cubic-bezier(0.65,0,0.35,1);-webkit-box-decoration-break:clone;box-decoration-break:clone}usa-scroll-highlight[mode=\"marker\"][data-lit]{background-size:100% 40%}@media (prefers-reduced-motion:reduce){usa-wave-text .usa-char,usa-glitch::before,usa-glitch::after,usa-gradient-text{animation:none !important}usa-glitch::before,usa-glitch::after{display:none}usa-scroll-highlight .usa-hl-word,usa-scroll-highlight[mode=\"marker\"]{transition:none}}";
|
|
502
|
+
var css = "usa-wave-text .usa-word,usa-scroll-highlight .usa-word{display:inline-block;white-space:nowrap}usa-wave-text .usa-char{display:inline-block;animation:usa-wave var(--usa-wave-s,1.6s) ease-in-out infinite;animation-delay:calc(var(--i) * var(--usa-wave-d,0.06s))}@keyframes usa-wave{0%,60%,100%{transform:translateY(0)}30%{transform:translateY(calc(var(--usa-wave-a,0.25em) * -1))}}usa-glitch{position:relative;display:inline-block}usa-glitch::before,usa-glitch::after{content:attr(data-text);position:absolute;inset:0;pointer-events:none}usa-glitch::before{color:#ff2bd6;transform:translate(calc(var(--usa-glitch-i,3px) * -1),0);clip-path:inset(0 0 55% 0);mix-blend-mode:screen;animation:usa-glitch-a 2.4s steps(2,end) infinite}usa-glitch::after{color:#00f0ff;transform:translate(var(--usa-glitch-i,3px),0);clip-path:inset(50% 0 0 0);mix-blend-mode:screen;animation:usa-glitch-b 1.9s steps(2,end) infinite}usa-glitch[trigger=\"hover\"]::before,usa-glitch[trigger=\"hover\"]::after{animation-play-state:paused;opacity:0}usa-glitch[trigger=\"hover\"]:hover::before,usa-glitch[trigger=\"hover\"]:hover::after{animation-play-state:running;opacity:1}@keyframes usa-glitch-a{0%{clip-path:inset(0 0 80% 0)}20%{clip-path:inset(30% 0 40% 0)}40%{clip-path:inset(70% 0 5% 0)}60%{clip-path:inset(10% 0 60% 0)}80%{clip-path:inset(50% 0 30% 0)}100%{clip-path:inset(0 0 80% 0)}}@keyframes usa-glitch-b{0%{clip-path:inset(60% 0 10% 0)}25%{clip-path:inset(15% 0 70% 0)}50%{clip-path:inset(80% 0 2% 0)}75%{clip-path:inset(40% 0 35% 0)}100%{clip-path:inset(60% 0 10% 0)}}usa-gradient-text{background:var(--usa-grad) 0 50% / 300% 100%;-webkit-background-clip:text;background-clip:text;color:transparent;-webkit-text-fill-color:transparent;animation:usa-grad-flow var(--usa-grad-s,6s) linear infinite}@keyframes usa-grad-flow{to{background-position:150% 50%}}usa-handwriting{--usa-hw-stroke:currentColor;display:inline-block;line-height:0}usa-handwriting svg{width:auto;max-width:100%;height:auto;overflow:visible}usa-handwriting text{fill:transparent;stroke:var(--usa-hw-stroke);stroke-width:1.2;stroke-dasharray:1600;stroke-dashoffset:1600;font-family:\"Segoe Script\",\"Brush Script MT\",\"Snell Roundhand\",cursive}usa-handwriting[data-state=\"drawing\"] text{animation:usa-hw-draw var(--usa-hw-d,2400ms) cubic-bezier(0.55,0,0.45,1) forwards,usa-hw-fill 0.6s ease calc(var(--usa-hw-d,2400ms) * 0.8) forwards}usa-handwriting[data-state=\"done\"] text{stroke-dashoffset:0;fill:currentColor}@keyframes usa-hw-draw{to{stroke-dashoffset:0}}@keyframes usa-hw-fill{to{fill:currentColor}}usa-scroll-highlight .usa-hl-word{opacity:var(--usa-hl-dim,0.2);transition:opacity 0.35s ease}usa-scroll-highlight .usa-hl-word[data-on]{opacity:1}usa-scroll-highlight[mode=\"marker\"]{--usa-hl-color:color-mix(in srgb,#facc15 55%,transparent);background:linear-gradient(var(--usa-hl-color),var(--usa-hl-color)) 0 88% / 0% 40% no-repeat;transition:background-size 1s cubic-bezier(0.65,0,0.35,1);-webkit-box-decoration-break:clone;box-decoration-break:clone}usa-scroll-highlight[mode=\"marker\"][data-lit]{background-size:100% 40%}@media (prefers-reduced-motion:reduce){usa-wave-text .usa-char,usa-glitch::before,usa-glitch::after,usa-gradient-text{animation:none !important}usa-glitch::before,usa-glitch::after{display:none}usa-scroll-highlight .usa-hl-word,usa-scroll-highlight[mode=\"marker\"]{transition:none}}";
|
|
503
503
|
|
|
504
504
|
/** Split `text` into per-character spans (words never break). The animated copy is aria-hidden. */
|
|
505
505
|
function splitChars(host, text) {
|
package/dist/components/text.css
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
usa-counter{font-variant-numeric:tabular-nums}
|
|
4
4
|
usa-shimmer-text{--usa-shimmer-color:currentColor;--usa-shimmer-shine:#fff;background:linear-gradient(var(--usa-shimmer-angle,110deg),var(--usa-shimmer-color) 35%,var(--usa-shimmer-shine) 50%,var(--usa-shimmer-color) 65%) 0 0 / 250% 100%;-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;color:transparent;animation:usa-shimmer var(--usa-shimmer-duration,2600ms) linear infinite}@keyframes usa-shimmer{from{background-position:100% 0}to{background-position:-150% 0}}
|
|
5
5
|
usa-split-text .usa-split-word{display:inline-block;white-space:nowrap}usa-split-text .usa-split-unit{display:inline-block;white-space:pre}usa-split-text[data-state="hidden"] .usa-split-unit{opacity:0}usa-split-text[data-state="play"] .usa-split-unit{animation:usa-split-rise var(--usa-split-duration,620ms) cubic-bezier(0.22,1,0.36,1) both;animation-delay:calc(var(--usa-split-delay,0ms) + var(--i,0) * var(--usa-split-stagger,28ms))}usa-split-text[effect="fade"][data-state="play"] .usa-split-unit{animation-name:usa-split-fade}usa-split-text[effect="blur"][data-state="play"] .usa-split-unit{animation-name:usa-split-blur}usa-split-text[effect="flip"][data-state="play"] .usa-split-unit{animation-name:usa-split-flip;transform-origin:50% 100%}usa-split-text[effect="pop"][data-state="play"] .usa-split-unit{animation-name:usa-split-pop;animation-timing-function:cubic-bezier(0.34,1.56,0.64,1)}@keyframes usa-split-rise{from{opacity:0;transform:translate3d(0,0.6em,0)}to{opacity:1;transform:none}}@keyframes usa-split-fade{from{opacity:0}to{opacity:1}}@keyframes usa-split-blur{from{opacity:0;filter:blur(8px)}to{opacity:1;filter:none}}@keyframes usa-split-flip{from{opacity:0;transform:perspective(500px) rotateX(-80deg)}to{opacity:1;transform:none}}@keyframes usa-split-pop{from{opacity:0;transform:scale(0.3)}to{opacity:1;transform:none}}@media (prefers-reduced-motion:reduce){usa-split-text .usa-split-unit{animation:none !important;opacity:1 !important}}
|
|
6
|
-
usa-wave-text .usa-word,usa-scroll-highlight .usa-word{display:inline-block;white-space:nowrap}usa-wave-text .usa-char{display:inline-block;animation:usa-wave var(--usa-wave-s,1.6s) ease-in-out infinite;animation-delay:calc(var(--i) * var(--usa-wave-d,0.06s))}@keyframes usa-wave{0%,60%,100%{transform:translateY(0)}30%{transform:translateY(calc(var(--usa-wave-a,0.25em) * -1))}}usa-glitch{position:relative;display:inline-block}usa-glitch::before,usa-glitch::after{content:attr(data-text);position:absolute;inset:0;pointer-events:none}usa-glitch::before{color:#ff2bd6;transform:translate(calc(var(--usa-glitch-i,3px) * -1),0);clip-path:inset(0 0 55% 0);mix-blend-mode:screen;animation:usa-glitch-a 2.4s steps(2,end) infinite}usa-glitch::after{color:#00f0ff;transform:translate(var(--usa-glitch-i,3px),0);clip-path:inset(50% 0 0 0);mix-blend-mode:screen;animation:usa-glitch-b 1.9s steps(2,end) infinite}usa-glitch[trigger="hover"]::before,usa-glitch[trigger="hover"]::after{animation-play-state:paused;opacity:0}usa-glitch[trigger="hover"]:hover::before,usa-glitch[trigger="hover"]:hover::after{animation-play-state:running;opacity:1}@keyframes usa-glitch-a{0%{clip-path:inset(0 0 80% 0)}20%{clip-path:inset(30% 0 40% 0)}40%{clip-path:inset(70% 0 5% 0)}60%{clip-path:inset(10% 0 60% 0)}80%{clip-path:inset(50% 0 30% 0)}100%{clip-path:inset(0 0 80% 0)}}@keyframes usa-glitch-b{0%{clip-path:inset(60% 0 10% 0)}25%{clip-path:inset(15% 0 70% 0)}50%{clip-path:inset(80% 0 2% 0)}75%{clip-path:inset(40% 0 35% 0)}100%{clip-path:inset(60% 0 10% 0)}}usa-gradient-text{background:var(--usa-grad) 0 50% / 300% 100%;-webkit-background-clip:text;background-clip:text;color:transparent;-webkit-text-fill-color:transparent;animation:usa-grad-flow var(--usa-grad-s,6s) linear infinite}@keyframes usa-grad-flow{to{background-position:150% 50%}}usa-handwriting{--usa-hw-stroke:currentColor;display:inline-block;line-height:0}usa-handwriting svg{max-width:100%;height:auto;overflow:visible}usa-handwriting text{fill:transparent;stroke:var(--usa-hw-stroke);stroke-width:1.2;stroke-dasharray:1600;stroke-dashoffset:1600;font-family:"Segoe Script","Brush Script MT","Snell Roundhand",cursive}usa-handwriting[data-state="drawing"] text{animation:usa-hw-draw var(--usa-hw-d,2400ms) cubic-bezier(0.55,0,0.45,1) forwards,usa-hw-fill 0.6s ease calc(var(--usa-hw-d,2400ms) * 0.8) forwards}usa-handwriting[data-state="done"] text{stroke-dashoffset:0;fill:currentColor}@keyframes usa-hw-draw{to{stroke-dashoffset:0}}@keyframes usa-hw-fill{to{fill:currentColor}}usa-scroll-highlight .usa-hl-word{opacity:var(--usa-hl-dim,0.2);transition:opacity 0.35s ease}usa-scroll-highlight .usa-hl-word[data-on]{opacity:1}usa-scroll-highlight[mode="marker"]{--usa-hl-color:color-mix(in srgb,#facc15 55%,transparent);background:linear-gradient(var(--usa-hl-color),var(--usa-hl-color)) 0 88% / 0% 40% no-repeat;transition:background-size 1s cubic-bezier(0.65,0,0.35,1);-webkit-box-decoration-break:clone;box-decoration-break:clone}usa-scroll-highlight[mode="marker"][data-lit]{background-size:100% 40%}@media (prefers-reduced-motion:reduce){usa-wave-text .usa-char,usa-glitch::before,usa-glitch::after,usa-gradient-text{animation:none !important}usa-glitch::before,usa-glitch::after{display:none}usa-scroll-highlight .usa-hl-word,usa-scroll-highlight[mode="marker"]{transition:none}}
|
|
6
|
+
usa-wave-text .usa-word,usa-scroll-highlight .usa-word{display:inline-block;white-space:nowrap}usa-wave-text .usa-char{display:inline-block;animation:usa-wave var(--usa-wave-s,1.6s) ease-in-out infinite;animation-delay:calc(var(--i) * var(--usa-wave-d,0.06s))}@keyframes usa-wave{0%,60%,100%{transform:translateY(0)}30%{transform:translateY(calc(var(--usa-wave-a,0.25em) * -1))}}usa-glitch{position:relative;display:inline-block}usa-glitch::before,usa-glitch::after{content:attr(data-text);position:absolute;inset:0;pointer-events:none}usa-glitch::before{color:#ff2bd6;transform:translate(calc(var(--usa-glitch-i,3px) * -1),0);clip-path:inset(0 0 55% 0);mix-blend-mode:screen;animation:usa-glitch-a 2.4s steps(2,end) infinite}usa-glitch::after{color:#00f0ff;transform:translate(var(--usa-glitch-i,3px),0);clip-path:inset(50% 0 0 0);mix-blend-mode:screen;animation:usa-glitch-b 1.9s steps(2,end) infinite}usa-glitch[trigger="hover"]::before,usa-glitch[trigger="hover"]::after{animation-play-state:paused;opacity:0}usa-glitch[trigger="hover"]:hover::before,usa-glitch[trigger="hover"]:hover::after{animation-play-state:running;opacity:1}@keyframes usa-glitch-a{0%{clip-path:inset(0 0 80% 0)}20%{clip-path:inset(30% 0 40% 0)}40%{clip-path:inset(70% 0 5% 0)}60%{clip-path:inset(10% 0 60% 0)}80%{clip-path:inset(50% 0 30% 0)}100%{clip-path:inset(0 0 80% 0)}}@keyframes usa-glitch-b{0%{clip-path:inset(60% 0 10% 0)}25%{clip-path:inset(15% 0 70% 0)}50%{clip-path:inset(80% 0 2% 0)}75%{clip-path:inset(40% 0 35% 0)}100%{clip-path:inset(60% 0 10% 0)}}usa-gradient-text{background:var(--usa-grad) 0 50% / 300% 100%;-webkit-background-clip:text;background-clip:text;color:transparent;-webkit-text-fill-color:transparent;animation:usa-grad-flow var(--usa-grad-s,6s) linear infinite}@keyframes usa-grad-flow{to{background-position:150% 50%}}usa-handwriting{--usa-hw-stroke:currentColor;display:inline-block;line-height:0}usa-handwriting svg{width:auto;max-width:100%;height:auto;overflow:visible}usa-handwriting text{fill:transparent;stroke:var(--usa-hw-stroke);stroke-width:1.2;stroke-dasharray:1600;stroke-dashoffset:1600;font-family:"Segoe Script","Brush Script MT","Snell Roundhand",cursive}usa-handwriting[data-state="drawing"] text{animation:usa-hw-draw var(--usa-hw-d,2400ms) cubic-bezier(0.55,0,0.45,1) forwards,usa-hw-fill 0.6s ease calc(var(--usa-hw-d,2400ms) * 0.8) forwards}usa-handwriting[data-state="done"] text{stroke-dashoffset:0;fill:currentColor}@keyframes usa-hw-draw{to{stroke-dashoffset:0}}@keyframes usa-hw-fill{to{fill:currentColor}}usa-scroll-highlight .usa-hl-word{opacity:var(--usa-hl-dim,0.2);transition:opacity 0.35s ease}usa-scroll-highlight .usa-hl-word[data-on]{opacity:1}usa-scroll-highlight[mode="marker"]{--usa-hl-color:color-mix(in srgb,#facc15 55%,transparent);background:linear-gradient(var(--usa-hl-color),var(--usa-hl-color)) 0 88% / 0% 40% no-repeat;transition:background-size 1s cubic-bezier(0.65,0,0.35,1);-webkit-box-decoration-break:clone;box-decoration-break:clone}usa-scroll-highlight[mode="marker"][data-lit]{background-size:100% 40%}@media (prefers-reduced-motion:reduce){usa-wave-text .usa-char,usa-glitch::before,usa-glitch::after,usa-gradient-text{animation:none !important}usa-glitch::before,usa-glitch::after{display:none}usa-scroll-highlight .usa-hl-word,usa-scroll-highlight[mode="marker"]{transition:none}}
|
|
7
7
|
usa-text-rotate{display:inline-grid;vertical-align:bottom;overflow:hidden;padding-block:0.08em}usa-text-rotate .usa-rotate-word{grid-area:1 / 1;white-space:nowrap}usa-text-rotate .usa-rotate-word[data-hidden]{opacity:0}
|
|
8
8
|
usa-typewriter{white-space:pre-wrap}usa-typewriter .usa-tw-caret{display:inline-block;width:var(--usa-caret-width,0.08em);height:1.05em;margin-left:0.06em;vertical-align:-0.12em;background:var(--usa-caret-color,currentColor);animation:usa-caret 1.06s steps(1) infinite}usa-typewriter[data-typing] .usa-tw-caret{animation:none}usa-typewriter[data-no-cursor] .usa-tw-caret{display:none}@keyframes usa-caret{50%{opacity:0}}@media (prefers-reduced-motion:reduce){usa-typewriter .usa-tw-caret,usa-shimmer-text{animation:none}}
|
package/dist/components/text.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { h as defineElement, j as srText,
|
|
2
|
-
export { a as configureComponents, p as prefersReducedMotion } from '../chunks/base-
|
|
1
|
+
import { h as defineElement, j as srText, d as caf, n as now, r as raf, i as EASE_OUT, E as EASE_SPRING, b as clamp } from '../chunks/base-BPG5zvex.js';
|
|
2
|
+
export { a as configureComponents, p as prefersReducedMotion } from '../chunks/base-BPG5zvex.js';
|
|
3
3
|
|
|
4
4
|
var css$5 = "usa-typewriter{white-space:pre-wrap}usa-typewriter .usa-tw-caret{display:inline-block;width:var(--usa-caret-width,0.08em);height:1.05em;margin-left:0.06em;vertical-align:-0.12em;background:var(--usa-caret-color,currentColor);animation:usa-caret 1.06s steps(1) infinite}usa-typewriter[data-typing] .usa-tw-caret{animation:none}usa-typewriter[data-no-cursor] .usa-tw-caret{display:none}@keyframes usa-caret{50%{opacity:0}}@media (prefers-reduced-motion:reduce){usa-typewriter .usa-tw-caret,usa-shimmer-text{animation:none}}";
|
|
5
5
|
|
|
@@ -498,7 +498,7 @@ function defineTextRotate(tag = 'usa-text-rotate') {
|
|
|
498
498
|
}, { id: 'text-rotate', text: css$1 });
|
|
499
499
|
}
|
|
500
500
|
|
|
501
|
-
var css = "usa-wave-text .usa-word,usa-scroll-highlight .usa-word{display:inline-block;white-space:nowrap}usa-wave-text .usa-char{display:inline-block;animation:usa-wave var(--usa-wave-s,1.6s) ease-in-out infinite;animation-delay:calc(var(--i) * var(--usa-wave-d,0.06s))}@keyframes usa-wave{0%,60%,100%{transform:translateY(0)}30%{transform:translateY(calc(var(--usa-wave-a,0.25em) * -1))}}usa-glitch{position:relative;display:inline-block}usa-glitch::before,usa-glitch::after{content:attr(data-text);position:absolute;inset:0;pointer-events:none}usa-glitch::before{color:#ff2bd6;transform:translate(calc(var(--usa-glitch-i,3px) * -1),0);clip-path:inset(0 0 55% 0);mix-blend-mode:screen;animation:usa-glitch-a 2.4s steps(2,end) infinite}usa-glitch::after{color:#00f0ff;transform:translate(var(--usa-glitch-i,3px),0);clip-path:inset(50% 0 0 0);mix-blend-mode:screen;animation:usa-glitch-b 1.9s steps(2,end) infinite}usa-glitch[trigger=\"hover\"]::before,usa-glitch[trigger=\"hover\"]::after{animation-play-state:paused;opacity:0}usa-glitch[trigger=\"hover\"]:hover::before,usa-glitch[trigger=\"hover\"]:hover::after{animation-play-state:running;opacity:1}@keyframes usa-glitch-a{0%{clip-path:inset(0 0 80% 0)}20%{clip-path:inset(30% 0 40% 0)}40%{clip-path:inset(70% 0 5% 0)}60%{clip-path:inset(10% 0 60% 0)}80%{clip-path:inset(50% 0 30% 0)}100%{clip-path:inset(0 0 80% 0)}}@keyframes usa-glitch-b{0%{clip-path:inset(60% 0 10% 0)}25%{clip-path:inset(15% 0 70% 0)}50%{clip-path:inset(80% 0 2% 0)}75%{clip-path:inset(40% 0 35% 0)}100%{clip-path:inset(60% 0 10% 0)}}usa-gradient-text{background:var(--usa-grad) 0 50% / 300% 100%;-webkit-background-clip:text;background-clip:text;color:transparent;-webkit-text-fill-color:transparent;animation:usa-grad-flow var(--usa-grad-s,6s) linear infinite}@keyframes usa-grad-flow{to{background-position:150% 50%}}usa-handwriting{--usa-hw-stroke:currentColor;display:inline-block;line-height:0}usa-handwriting svg{max-width:100%;height:auto;overflow:visible}usa-handwriting text{fill:transparent;stroke:var(--usa-hw-stroke);stroke-width:1.2;stroke-dasharray:1600;stroke-dashoffset:1600;font-family:\"Segoe Script\",\"Brush Script MT\",\"Snell Roundhand\",cursive}usa-handwriting[data-state=\"drawing\"] text{animation:usa-hw-draw var(--usa-hw-d,2400ms) cubic-bezier(0.55,0,0.45,1) forwards,usa-hw-fill 0.6s ease calc(var(--usa-hw-d,2400ms) * 0.8) forwards}usa-handwriting[data-state=\"done\"] text{stroke-dashoffset:0;fill:currentColor}@keyframes usa-hw-draw{to{stroke-dashoffset:0}}@keyframes usa-hw-fill{to{fill:currentColor}}usa-scroll-highlight .usa-hl-word{opacity:var(--usa-hl-dim,0.2);transition:opacity 0.35s ease}usa-scroll-highlight .usa-hl-word[data-on]{opacity:1}usa-scroll-highlight[mode=\"marker\"]{--usa-hl-color:color-mix(in srgb,#facc15 55%,transparent);background:linear-gradient(var(--usa-hl-color),var(--usa-hl-color)) 0 88% / 0% 40% no-repeat;transition:background-size 1s cubic-bezier(0.65,0,0.35,1);-webkit-box-decoration-break:clone;box-decoration-break:clone}usa-scroll-highlight[mode=\"marker\"][data-lit]{background-size:100% 40%}@media (prefers-reduced-motion:reduce){usa-wave-text .usa-char,usa-glitch::before,usa-glitch::after,usa-gradient-text{animation:none !important}usa-glitch::before,usa-glitch::after{display:none}usa-scroll-highlight .usa-hl-word,usa-scroll-highlight[mode=\"marker\"]{transition:none}}";
|
|
501
|
+
var css = "usa-wave-text .usa-word,usa-scroll-highlight .usa-word{display:inline-block;white-space:nowrap}usa-wave-text .usa-char{display:inline-block;animation:usa-wave var(--usa-wave-s,1.6s) ease-in-out infinite;animation-delay:calc(var(--i) * var(--usa-wave-d,0.06s))}@keyframes usa-wave{0%,60%,100%{transform:translateY(0)}30%{transform:translateY(calc(var(--usa-wave-a,0.25em) * -1))}}usa-glitch{position:relative;display:inline-block}usa-glitch::before,usa-glitch::after{content:attr(data-text);position:absolute;inset:0;pointer-events:none}usa-glitch::before{color:#ff2bd6;transform:translate(calc(var(--usa-glitch-i,3px) * -1),0);clip-path:inset(0 0 55% 0);mix-blend-mode:screen;animation:usa-glitch-a 2.4s steps(2,end) infinite}usa-glitch::after{color:#00f0ff;transform:translate(var(--usa-glitch-i,3px),0);clip-path:inset(50% 0 0 0);mix-blend-mode:screen;animation:usa-glitch-b 1.9s steps(2,end) infinite}usa-glitch[trigger=\"hover\"]::before,usa-glitch[trigger=\"hover\"]::after{animation-play-state:paused;opacity:0}usa-glitch[trigger=\"hover\"]:hover::before,usa-glitch[trigger=\"hover\"]:hover::after{animation-play-state:running;opacity:1}@keyframes usa-glitch-a{0%{clip-path:inset(0 0 80% 0)}20%{clip-path:inset(30% 0 40% 0)}40%{clip-path:inset(70% 0 5% 0)}60%{clip-path:inset(10% 0 60% 0)}80%{clip-path:inset(50% 0 30% 0)}100%{clip-path:inset(0 0 80% 0)}}@keyframes usa-glitch-b{0%{clip-path:inset(60% 0 10% 0)}25%{clip-path:inset(15% 0 70% 0)}50%{clip-path:inset(80% 0 2% 0)}75%{clip-path:inset(40% 0 35% 0)}100%{clip-path:inset(60% 0 10% 0)}}usa-gradient-text{background:var(--usa-grad) 0 50% / 300% 100%;-webkit-background-clip:text;background-clip:text;color:transparent;-webkit-text-fill-color:transparent;animation:usa-grad-flow var(--usa-grad-s,6s) linear infinite}@keyframes usa-grad-flow{to{background-position:150% 50%}}usa-handwriting{--usa-hw-stroke:currentColor;display:inline-block;line-height:0}usa-handwriting svg{width:auto;max-width:100%;height:auto;overflow:visible}usa-handwriting text{fill:transparent;stroke:var(--usa-hw-stroke);stroke-width:1.2;stroke-dasharray:1600;stroke-dashoffset:1600;font-family:\"Segoe Script\",\"Brush Script MT\",\"Snell Roundhand\",cursive}usa-handwriting[data-state=\"drawing\"] text{animation:usa-hw-draw var(--usa-hw-d,2400ms) cubic-bezier(0.55,0,0.45,1) forwards,usa-hw-fill 0.6s ease calc(var(--usa-hw-d,2400ms) * 0.8) forwards}usa-handwriting[data-state=\"done\"] text{stroke-dashoffset:0;fill:currentColor}@keyframes usa-hw-draw{to{stroke-dashoffset:0}}@keyframes usa-hw-fill{to{fill:currentColor}}usa-scroll-highlight .usa-hl-word{opacity:var(--usa-hl-dim,0.2);transition:opacity 0.35s ease}usa-scroll-highlight .usa-hl-word[data-on]{opacity:1}usa-scroll-highlight[mode=\"marker\"]{--usa-hl-color:color-mix(in srgb,#facc15 55%,transparent);background:linear-gradient(var(--usa-hl-color),var(--usa-hl-color)) 0 88% / 0% 40% no-repeat;transition:background-size 1s cubic-bezier(0.65,0,0.35,1);-webkit-box-decoration-break:clone;box-decoration-break:clone}usa-scroll-highlight[mode=\"marker\"][data-lit]{background-size:100% 40%}@media (prefers-reduced-motion:reduce){usa-wave-text .usa-char,usa-glitch::before,usa-glitch::after,usa-gradient-text{animation:none !important}usa-glitch::before,usa-glitch::after{display:none}usa-scroll-highlight .usa-hl-word,usa-scroll-highlight[mode=\"marker\"]{transition:none}}";
|
|
502
502
|
|
|
503
503
|
/** Split `text` into per-character spans (words never break). The animated copy is aria-hidden. */
|
|
504
504
|
function splitChars(host, text) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var base = require('../chunks/base-CXx7jZ-o.cjs');
|
|
4
|
-
var core = require('../chunks/core-
|
|
4
|
+
var core = require('../chunks/core-CLu8ZrC-.cjs');
|
|
5
5
|
|
|
6
6
|
var css = "usa-timeline{display:block}usa-timeline[scrub]{position:relative}@media (prefers-reduced-motion:reduce){usa-timeline [data-tl]{opacity:1 !important;transform:none !important;filter:none !important;clip-path:none !important}}";
|
|
7
7
|
|
|
@@ -44,14 +44,33 @@ function defineTimeline(tag = 'usa-timeline') {
|
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
46
|
if (this.flag('scrub')) {
|
|
47
|
-
|
|
47
|
+
// 4.1: native ScrollTimeline / ViewTimeline when available; `smooth`
|
|
48
|
+
// (0–0.95) or `scrub="js"` opt into the JS engine, `scrub="scroll"`
|
|
49
|
+
// follows this element's own scroll position.
|
|
50
|
+
const v = this.str('scrub');
|
|
51
|
+
const stop = tl.scrub(this, { smooth: this.num('smooth', 0), engine: v === 'js' ? 'js' : 'auto', source: v === 'scroll' ? 'scroll' : 'view' });
|
|
52
|
+
this.toggleAttribute('data-native', stop.native);
|
|
53
|
+
this.onCleanup(stop);
|
|
48
54
|
return;
|
|
49
55
|
}
|
|
50
|
-
tl.seek(0);
|
|
51
56
|
const trigger = this.str('trigger', 'view');
|
|
52
|
-
if (trigger === 'click')
|
|
57
|
+
if (trigger === 'click') {
|
|
58
|
+
// 4.0.1: show the finished composition until the first click
|
|
59
|
+
// (it used to sit invisible at t=0); Enter / Space replay it too.
|
|
60
|
+
tl.seek(tl.duration);
|
|
53
61
|
this.listen(this, 'click', () => void this.play());
|
|
54
|
-
|
|
62
|
+
this.listen(this, 'keydown', (e) => {
|
|
63
|
+
if (e.target === this && (e.key === 'Enter' || e.key === ' ')) {
|
|
64
|
+
e.preventDefault();
|
|
65
|
+
void this.play();
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
if (!this.hasAttribute('tabindex'))
|
|
69
|
+
this.tabIndex = 0;
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
tl.seek(0);
|
|
73
|
+
if (trigger === 'view') {
|
|
55
74
|
let played = false;
|
|
56
75
|
this.inView((v) => {
|
|
57
76
|
if (v && (!played || this.flag('repeat'))) {
|
|
@@ -84,6 +103,7 @@ exports.configureComponents = base.configureComponents;
|
|
|
84
103
|
exports.prefersReducedMotion = base.prefersReducedMotion;
|
|
85
104
|
exports.TIMELINE_PRESETS = core.TIMELINE_PRESETS;
|
|
86
105
|
exports.resolvePosition = core.resolvePosition;
|
|
106
|
+
exports.supportsNativeScrub = core.supportsNativeScrub;
|
|
87
107
|
exports.timeline = core.timeline;
|
|
88
108
|
exports.defineTimeline = defineTimeline;
|
|
89
109
|
exports.defineTimelineComponents = defineTimelineComponents;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeline.cjs","sources":["../../src/components/timeline/timeline-el.ts","../../src/components/timeline/index.ts"],"sourcesContent":["import { defineElement, type UsaElement } from '../base';\nimport { timeline, TIMELINE_PRESETS, type Timeline } from './core';\nimport css from './timeline.css?raw';\n\n/**\n * `<usa-timeline>` — declarative choreography. Every descendant with\n * `data-tl=\"<preset>\"` becomes a step, in document order; `data-at`\n * (`'-=200'`, `'<'`, `'label+=100'`, ms), `data-duration` and `data-label`\n * fine-tune it.\n *\n * Attributes: `trigger` (`view` default · `click` · `manual`), `scrub`\n * (progress follows scroll instead of playing), `overlap` (ms each step\n * overlaps the previous, default 0), `duration` (600), `stagger` (ms),\n * `repeat` (replay every time it enters the viewport). Methods: `play()`,\n * `reverse()`, `seek(t)`; property `timeline`. Event `usa:complete`.\n * Reduced motion: steps appear in their final state.\n */\nexport interface UsaTimelineElement extends UsaElement {\n readonly timeline: Timeline | null;\n play(): Promise<void>;\n reverse(): Promise<void>;\n seek(to: number | string): void;\n}\n\nexport function defineTimeline(tag = 'usa-timeline'): CustomElementConstructor | undefined {\n return defineElement(\n tag,\n (Base) =>\n class UsaTimeline extends Base {\n static get observedAttributes(): string[] {\n return ['scrub', 'trigger', 'overlap'];\n }\n private _tl: Timeline | null = null;\n\n get timeline(): Timeline | null {\n return this._tl;\n }\n\n play(): Promise<void> {\n return this._tl ? this._tl.play(0).then(() => void this.emit('complete')) : Promise.resolve();\n }\n\n reverse(): Promise<void> {\n return this._tl ? this._tl.reverse() : Promise.resolve();\n }\n\n seek(to: number | string): void {\n this._tl?.seek(to);\n }\n\n mount(): void {\n const overlap = this.num('overlap', 0);\n const tl = (this._tl = timeline({ defaults: { duration: this.num('duration', 600), stagger: this.num('stagger', 0) } }));\n this.querySelectorAll<HTMLElement>('[data-tl]').forEach((el, i) => {\n if (el.dataset.label) tl.label(el.dataset.label);\n const name = el.dataset.tl || 'fade';\n tl.to(el, TIMELINE_PRESETS[name] ? name : 'fade', {\n at: el.dataset.at ?? (i && overlap ? `-=${overlap}` : undefined),\n duration: el.dataset.duration ? Number(el.dataset.duration) : undefined,\n });\n });\n this.onCleanup(() => tl.cancel());\n if (this.reduced) {\n tl.seek(tl.duration);\n return;\n }\n if (this.flag('scrub')) {\n this.
|
|
1
|
+
{"version":3,"file":"timeline.cjs","sources":["../../src/components/timeline/timeline-el.ts","../../src/components/timeline/index.ts"],"sourcesContent":["import { defineElement, type UsaElement } from '../base';\nimport { timeline, TIMELINE_PRESETS, type Timeline } from './core';\nimport css from './timeline.css?raw';\n\n/**\n * `<usa-timeline>` — declarative choreography. Every descendant with\n * `data-tl=\"<preset>\"` becomes a step, in document order; `data-at`\n * (`'-=200'`, `'<'`, `'label+=100'`, ms), `data-duration` and `data-label`\n * fine-tune it.\n *\n * Attributes: `trigger` (`view` default · `click` · `manual`), `scrub`\n * (progress follows scroll instead of playing), `overlap` (ms each step\n * overlaps the previous, default 0), `duration` (600), `stagger` (ms),\n * `repeat` (replay every time it enters the viewport). 4.1: `scrub` runs on native\n * ScrollTimeline / ViewTimeline when supported (`data-native` is set); `scrub=\"js\"`,\n * `scrub=\"scroll\"` and `smooth` tune it. Methods: `play()`,\n * `reverse()`, `seek(t)`; property `timeline`. Event `usa:complete`.\n * Reduced motion: steps appear in their final state.\n */\nexport interface UsaTimelineElement extends UsaElement {\n readonly timeline: Timeline | null;\n play(): Promise<void>;\n reverse(): Promise<void>;\n seek(to: number | string): void;\n}\n\nexport function defineTimeline(tag = 'usa-timeline'): CustomElementConstructor | undefined {\n return defineElement(\n tag,\n (Base) =>\n class UsaTimeline extends Base {\n static get observedAttributes(): string[] {\n return ['scrub', 'trigger', 'overlap'];\n }\n private _tl: Timeline | null = null;\n\n get timeline(): Timeline | null {\n return this._tl;\n }\n\n play(): Promise<void> {\n return this._tl ? this._tl.play(0).then(() => void this.emit('complete')) : Promise.resolve();\n }\n\n reverse(): Promise<void> {\n return this._tl ? this._tl.reverse() : Promise.resolve();\n }\n\n seek(to: number | string): void {\n this._tl?.seek(to);\n }\n\n mount(): void {\n const overlap = this.num('overlap', 0);\n const tl = (this._tl = timeline({ defaults: { duration: this.num('duration', 600), stagger: this.num('stagger', 0) } }));\n this.querySelectorAll<HTMLElement>('[data-tl]').forEach((el, i) => {\n if (el.dataset.label) tl.label(el.dataset.label);\n const name = el.dataset.tl || 'fade';\n tl.to(el, TIMELINE_PRESETS[name] ? name : 'fade', {\n at: el.dataset.at ?? (i && overlap ? `-=${overlap}` : undefined),\n duration: el.dataset.duration ? Number(el.dataset.duration) : undefined,\n });\n });\n this.onCleanup(() => tl.cancel());\n if (this.reduced) {\n tl.seek(tl.duration);\n return;\n }\n if (this.flag('scrub')) {\n // 4.1: native ScrollTimeline / ViewTimeline when available; `smooth`\n // (0–0.95) or `scrub=\"js\"` opt into the JS engine, `scrub=\"scroll\"`\n // follows this element's own scroll position.\n const v = this.str('scrub');\n const stop = tl.scrub(this, { smooth: this.num('smooth', 0), engine: v === 'js' ? 'js' : 'auto', source: v === 'scroll' ? 'scroll' : 'view' });\n this.toggleAttribute('data-native', stop.native);\n this.onCleanup(stop);\n return;\n }\n const trigger = this.str('trigger', 'view');\n if (trigger === 'click') {\n // 4.0.1: show the finished composition until the first click\n // (it used to sit invisible at t=0); Enter / Space replay it too.\n tl.seek(tl.duration);\n this.listen(this, 'click', () => void this.play());\n this.listen(this, 'keydown', (e: KeyboardEvent) => {\n if (e.target === this && (e.key === 'Enter' || e.key === ' ')) {\n e.preventDefault();\n void this.play();\n }\n });\n if (!this.hasAttribute('tabindex')) this.tabIndex = 0;\n return;\n }\n tl.seek(0);\n if (trigger === 'view') {\n let played = false;\n this.inView((v) => {\n if (v && (!played || this.flag('repeat'))) {\n played = true;\n void this.play();\n } else if (!v && this.flag('repeat')) tl.seek(0);\n }, { threshold: 0.2 });\n }\n }\n\n unmount(): void {\n this._tl = null;\n }\n },\n { id: 'timeline', text: css }\n );\n}\n","/**\n * use-scroll-animate/components/timeline — choreography (v3.1).\n * `timeline()` chains, overlaps, labels, seeks, reverses and scroll-scrubs\n * WAAPI animations on one playhead; `<usa-timeline>` builds one from\n * `data-tl` children.\n */\nimport { defineTimeline, type UsaTimelineElement } from './timeline-el';\n\nexport { defineTimeline };\nexport { timeline, resolvePosition, TIMELINE_PRESETS, supportsNativeScrub } from './core';\nexport type { Timeline, TimelineOptions, TimelineStepOptions, TimelinePosition, ScrubOptions, ScrubHandle } from './core';\nexport type { UsaTimelineElement };\nexport { configureComponents, prefersReducedMotion } from '../base';\nexport type { ComponentsConfig, UsaElement } from '../base';\n\n/** Register every component of this category under its default tag. */\nexport function defineTimelineComponents(): void {\n defineTimeline();\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'usa-timeline': UsaTimelineElement;\n }\n}\n"],"names":["defineElement","timeline","TIMELINE_PRESETS"],"mappings":";;;;;;;AA0BM,SAAU,cAAc,CAAC,GAAG,GAAG,cAAc,EAAA;AACjD,IAAA,OAAOA,kBAAa,CAClB,GAAG,EACH,CAAC,IAAI,KACH,MAAM,WAAY,SAAQ,IAAI,CAAA;AAA9B,QAAA,WAAA,GAAA;;YAIU,IAAA,CAAA,GAAG,GAAoB,IAAI;QA0ErC;AA7EE,QAAA,WAAW,kBAAkB,GAAA;AAC3B,YAAA,OAAO,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,CAAC;QACxC;AAGA,QAAA,IAAI,QAAQ,GAAA;YACV,OAAO,IAAI,CAAC,GAAG;QACjB;QAEA,IAAI,GAAA;AACF,YAAA,OAAO,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,GAAG,OAAO,CAAC,OAAO,EAAE;QAC/F;QAEA,OAAO,GAAA;AACL,YAAA,OAAO,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE;QAC1D;AAEA,QAAA,IAAI,CAAC,EAAmB,EAAA;AACtB,YAAA,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC;QACpB;QAEA,KAAK,GAAA;YACH,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,C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,gBAAA,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAI;AAChB,oBAAA,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE;wBACzC,MAAM,GAAG,IAAI;AACb,wBAAA,KAAK,IAAI,CAAC,IAAI,EAAE;oBAClB;yBAAO,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;AAAE,wBAAA,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;AAClD,gBAAA,CAAC,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC;YACxB;QACF;QAEA,OAAO,GAAA;AACL,YAAA,IAAI,CAAC,GAAG,GAAG,IAAI;QACjB;KACD,EACH,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,CAC9B;AACH;;AC/GA;;;;;AAKG;AAUH;SACgB,wBAAwB,GAAA;AACtC,IAAA,cAAc,EAAE;AAClB;;;;;;;;;;;"}
|
|
@@ -73,11 +73,29 @@ interface TimelineOptions {
|
|
|
73
73
|
onUpdate?: (progress: number) => void;
|
|
74
74
|
}
|
|
75
75
|
interface ScrubOptions {
|
|
76
|
-
/** Scroll offset (px) before the source's top reaches the viewport bottom where progress starts. */
|
|
76
|
+
/** Scroll offset (px) before the source's top reaches the viewport bottom where progress starts (JS engine only). */
|
|
77
77
|
offset?: number;
|
|
78
|
-
/** Smoothing 0–1 (0 = immediate, default 0). */
|
|
78
|
+
/** Smoothing 0–1 (0 = immediate, default 0). Smoothing needs the JS engine. */
|
|
79
79
|
smooth?: number;
|
|
80
|
+
/**
|
|
81
|
+
* 4.1: which progress source drives the timeline.
|
|
82
|
+
* - `'view'` (default): `source` moving through the viewport (CSS `ViewTimeline`, range `cover`).
|
|
83
|
+
* - `'scroll'`: the scroll position of `source` itself (a scroll container; CSS `ScrollTimeline`).
|
|
84
|
+
*/
|
|
85
|
+
source?: 'view' | 'scroll';
|
|
86
|
+
/** 4.1: `'auto'` (default) uses the browser's native scroll-driven animations when available, `'js'` forces the fallback. */
|
|
87
|
+
engine?: 'auto' | 'native' | 'js';
|
|
88
|
+
/** 4.1: scroll axis, `'block'` (default) · `'inline'` · `'x'` · `'y'`. */
|
|
89
|
+
axis?: 'block' | 'inline' | 'x' | 'y';
|
|
90
|
+
}
|
|
91
|
+
/** The function `scrub()` returns: call it to stop. `native` tells which engine runs it. */
|
|
92
|
+
interface ScrubHandle {
|
|
93
|
+
(): void;
|
|
94
|
+
/** `true` when the browser's ScrollTimeline / ViewTimeline drives it (compositor, no JS per frame). */
|
|
95
|
+
readonly native: boolean;
|
|
80
96
|
}
|
|
97
|
+
/** 4.1: whether `scrub()` can use native ScrollTimeline / ViewTimeline here. */
|
|
98
|
+
declare function supportsNativeScrub(source?: 'view' | 'scroll'): boolean;
|
|
81
99
|
interface Timeline {
|
|
82
100
|
/** Total length in ms. */
|
|
83
101
|
readonly duration: number;
|
|
@@ -100,8 +118,14 @@ interface Timeline {
|
|
|
100
118
|
seek(to: TimelinePosition): Timeline;
|
|
101
119
|
/** Get or set progress 0–1. */
|
|
102
120
|
progress(p?: number): number;
|
|
103
|
-
/**
|
|
104
|
-
|
|
121
|
+
/**
|
|
122
|
+
* Tie progress to scroll: `source` moving through the viewport (or, with
|
|
123
|
+
* `{ source: 'scroll' }`, a scroll container's own position). Runs on native
|
|
124
|
+
* ScrollTimeline / ViewTimeline when available (and no `smooth`, `offset`,
|
|
125
|
+
* `call()` cues or `onUpdate` need JS), else on a rAF-throttled listener.
|
|
126
|
+
* Returns a stop function with a `native` flag.
|
|
127
|
+
*/
|
|
128
|
+
scrub(source: Element, options?: ScrubOptions): ScrubHandle;
|
|
105
129
|
/** Stop and drop every animation (elements keep their last frame). */
|
|
106
130
|
cancel(): void;
|
|
107
131
|
}
|
|
@@ -133,7 +157,9 @@ declare function timeline(options?: TimelineOptions): Timeline;
|
|
|
133
157
|
* Attributes: `trigger` (`view` default · `click` · `manual`), `scrub`
|
|
134
158
|
* (progress follows scroll instead of playing), `overlap` (ms each step
|
|
135
159
|
* overlaps the previous, default 0), `duration` (600), `stagger` (ms),
|
|
136
|
-
* `repeat` (replay every time it enters the viewport).
|
|
160
|
+
* `repeat` (replay every time it enters the viewport). 4.1: `scrub` runs on native
|
|
161
|
+
* ScrollTimeline / ViewTimeline when supported (`data-native` is set); `scrub="js"`,
|
|
162
|
+
* `scrub="scroll"` and `smooth` tune it. Methods: `play()`,
|
|
137
163
|
* `reverse()`, `seek(t)`; property `timeline`. Event `usa:complete`.
|
|
138
164
|
* Reduced motion: steps appear in their final state.
|
|
139
165
|
*/
|
|
@@ -160,5 +186,5 @@ declare global {
|
|
|
160
186
|
}
|
|
161
187
|
}
|
|
162
188
|
|
|
163
|
-
export { TIMELINE_PRESETS, configureComponents, defineTimeline, defineTimelineComponents, prefersReducedMotion, resolvePosition, timeline };
|
|
164
|
-
export type { ComponentsConfig, ScrubOptions, Timeline, TimelineOptions, TimelinePosition, TimelineStepOptions, UsaElement, UsaTimelineElement };
|
|
189
|
+
export { TIMELINE_PRESETS, configureComponents, defineTimeline, defineTimelineComponents, prefersReducedMotion, resolvePosition, supportsNativeScrub, timeline };
|
|
190
|
+
export type { ComponentsConfig, ScrubHandle, ScrubOptions, Timeline, TimelineOptions, TimelinePosition, TimelineStepOptions, UsaElement, UsaTimelineElement };
|
|
@@ -73,11 +73,29 @@ interface TimelineOptions {
|
|
|
73
73
|
onUpdate?: (progress: number) => void;
|
|
74
74
|
}
|
|
75
75
|
interface ScrubOptions {
|
|
76
|
-
/** Scroll offset (px) before the source's top reaches the viewport bottom where progress starts. */
|
|
76
|
+
/** Scroll offset (px) before the source's top reaches the viewport bottom where progress starts (JS engine only). */
|
|
77
77
|
offset?: number;
|
|
78
|
-
/** Smoothing 0–1 (0 = immediate, default 0). */
|
|
78
|
+
/** Smoothing 0–1 (0 = immediate, default 0). Smoothing needs the JS engine. */
|
|
79
79
|
smooth?: number;
|
|
80
|
+
/**
|
|
81
|
+
* 4.1: which progress source drives the timeline.
|
|
82
|
+
* - `'view'` (default): `source` moving through the viewport (CSS `ViewTimeline`, range `cover`).
|
|
83
|
+
* - `'scroll'`: the scroll position of `source` itself (a scroll container; CSS `ScrollTimeline`).
|
|
84
|
+
*/
|
|
85
|
+
source?: 'view' | 'scroll';
|
|
86
|
+
/** 4.1: `'auto'` (default) uses the browser's native scroll-driven animations when available, `'js'` forces the fallback. */
|
|
87
|
+
engine?: 'auto' | 'native' | 'js';
|
|
88
|
+
/** 4.1: scroll axis, `'block'` (default) · `'inline'` · `'x'` · `'y'`. */
|
|
89
|
+
axis?: 'block' | 'inline' | 'x' | 'y';
|
|
90
|
+
}
|
|
91
|
+
/** The function `scrub()` returns: call it to stop. `native` tells which engine runs it. */
|
|
92
|
+
interface ScrubHandle {
|
|
93
|
+
(): void;
|
|
94
|
+
/** `true` when the browser's ScrollTimeline / ViewTimeline drives it (compositor, no JS per frame). */
|
|
95
|
+
readonly native: boolean;
|
|
80
96
|
}
|
|
97
|
+
/** 4.1: whether `scrub()` can use native ScrollTimeline / ViewTimeline here. */
|
|
98
|
+
declare function supportsNativeScrub(source?: 'view' | 'scroll'): boolean;
|
|
81
99
|
interface Timeline {
|
|
82
100
|
/** Total length in ms. */
|
|
83
101
|
readonly duration: number;
|
|
@@ -100,8 +118,14 @@ interface Timeline {
|
|
|
100
118
|
seek(to: TimelinePosition): Timeline;
|
|
101
119
|
/** Get or set progress 0–1. */
|
|
102
120
|
progress(p?: number): number;
|
|
103
|
-
/**
|
|
104
|
-
|
|
121
|
+
/**
|
|
122
|
+
* Tie progress to scroll: `source` moving through the viewport (or, with
|
|
123
|
+
* `{ source: 'scroll' }`, a scroll container's own position). Runs on native
|
|
124
|
+
* ScrollTimeline / ViewTimeline when available (and no `smooth`, `offset`,
|
|
125
|
+
* `call()` cues or `onUpdate` need JS), else on a rAF-throttled listener.
|
|
126
|
+
* Returns a stop function with a `native` flag.
|
|
127
|
+
*/
|
|
128
|
+
scrub(source: Element, options?: ScrubOptions): ScrubHandle;
|
|
105
129
|
/** Stop and drop every animation (elements keep their last frame). */
|
|
106
130
|
cancel(): void;
|
|
107
131
|
}
|
|
@@ -133,7 +157,9 @@ declare function timeline(options?: TimelineOptions): Timeline;
|
|
|
133
157
|
* Attributes: `trigger` (`view` default · `click` · `manual`), `scrub`
|
|
134
158
|
* (progress follows scroll instead of playing), `overlap` (ms each step
|
|
135
159
|
* overlaps the previous, default 0), `duration` (600), `stagger` (ms),
|
|
136
|
-
* `repeat` (replay every time it enters the viewport).
|
|
160
|
+
* `repeat` (replay every time it enters the viewport). 4.1: `scrub` runs on native
|
|
161
|
+
* ScrollTimeline / ViewTimeline when supported (`data-native` is set); `scrub="js"`,
|
|
162
|
+
* `scrub="scroll"` and `smooth` tune it. Methods: `play()`,
|
|
137
163
|
* `reverse()`, `seek(t)`; property `timeline`. Event `usa:complete`.
|
|
138
164
|
* Reduced motion: steps appear in their final state.
|
|
139
165
|
*/
|
|
@@ -160,5 +186,5 @@ declare global {
|
|
|
160
186
|
}
|
|
161
187
|
}
|
|
162
188
|
|
|
163
|
-
export { TIMELINE_PRESETS, configureComponents, defineTimeline, defineTimelineComponents, prefersReducedMotion, resolvePosition, timeline };
|
|
164
|
-
export type { ComponentsConfig, ScrubOptions, Timeline, TimelineOptions, TimelinePosition, TimelineStepOptions, UsaElement, UsaTimelineElement };
|
|
189
|
+
export { TIMELINE_PRESETS, configureComponents, defineTimeline, defineTimelineComponents, prefersReducedMotion, resolvePosition, supportsNativeScrub, timeline };
|
|
190
|
+
export type { ComponentsConfig, ScrubHandle, ScrubOptions, Timeline, TimelineOptions, TimelinePosition, TimelineStepOptions, UsaElement, UsaTimelineElement };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { h as defineElement } from '../chunks/base-
|
|
2
|
-
export { a as configureComponents, p as prefersReducedMotion } from '../chunks/base-
|
|
3
|
-
import { t as timeline, T as TIMELINE_PRESETS } from '../chunks/core-
|
|
4
|
-
export { r as resolvePosition } from '../chunks/core-
|
|
1
|
+
import { h as defineElement } from '../chunks/base-BPG5zvex.js';
|
|
2
|
+
export { a as configureComponents, p as prefersReducedMotion } from '../chunks/base-BPG5zvex.js';
|
|
3
|
+
import { t as timeline, T as TIMELINE_PRESETS } from '../chunks/core-QTFk4kgO.js';
|
|
4
|
+
export { r as resolvePosition, s as supportsNativeScrub } from '../chunks/core-QTFk4kgO.js';
|
|
5
5
|
|
|
6
6
|
var css = "usa-timeline{display:block}usa-timeline[scrub]{position:relative}@media (prefers-reduced-motion:reduce){usa-timeline [data-tl]{opacity:1 !important;transform:none !important;filter:none !important;clip-path:none !important}}";
|
|
7
7
|
|
|
@@ -44,14 +44,33 @@ function defineTimeline(tag = 'usa-timeline') {
|
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
46
|
if (this.flag('scrub')) {
|
|
47
|
-
|
|
47
|
+
// 4.1: native ScrollTimeline / ViewTimeline when available; `smooth`
|
|
48
|
+
// (0–0.95) or `scrub="js"` opt into the JS engine, `scrub="scroll"`
|
|
49
|
+
// follows this element's own scroll position.
|
|
50
|
+
const v = this.str('scrub');
|
|
51
|
+
const stop = tl.scrub(this, { smooth: this.num('smooth', 0), engine: v === 'js' ? 'js' : 'auto', source: v === 'scroll' ? 'scroll' : 'view' });
|
|
52
|
+
this.toggleAttribute('data-native', stop.native);
|
|
53
|
+
this.onCleanup(stop);
|
|
48
54
|
return;
|
|
49
55
|
}
|
|
50
|
-
tl.seek(0);
|
|
51
56
|
const trigger = this.str('trigger', 'view');
|
|
52
|
-
if (trigger === 'click')
|
|
57
|
+
if (trigger === 'click') {
|
|
58
|
+
// 4.0.1: show the finished composition until the first click
|
|
59
|
+
// (it used to sit invisible at t=0); Enter / Space replay it too.
|
|
60
|
+
tl.seek(tl.duration);
|
|
53
61
|
this.listen(this, 'click', () => void this.play());
|
|
54
|
-
|
|
62
|
+
this.listen(this, 'keydown', (e) => {
|
|
63
|
+
if (e.target === this && (e.key === 'Enter' || e.key === ' ')) {
|
|
64
|
+
e.preventDefault();
|
|
65
|
+
void this.play();
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
if (!this.hasAttribute('tabindex'))
|
|
69
|
+
this.tabIndex = 0;
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
tl.seek(0);
|
|
73
|
+
if (trigger === 'view') {
|
|
55
74
|
let played = false;
|
|
56
75
|
this.inView((v) => {
|
|
57
76
|
if (v && (!played || this.flag('repeat'))) {
|