motionary 0.0.0-stage → 6.2.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 +803 -0
- package/LICENSE +21 -0
- package/README.md +218 -2
- package/README_ja.md +219 -0
- package/README_zh.md +219 -0
- package/bin/usa-codemod-5.mjs +79 -0
- package/bin/usa-codemod-6.mjs +146 -0
- package/dist/chunks/base-BaQV-2ha.cjs +436 -0
- package/dist/chunks/base-BaQV-2ha.cjs.map +1 -0
- package/dist/chunks/base-C_3cAoRz.js +404 -0
- package/dist/chunks/base-C_3cAoRz.js.map +1 -0
- package/dist/chunks/bind-B_CTL6Qn.js +22 -0
- package/dist/chunks/bind-B_CTL6Qn.js.map +1 -0
- package/dist/chunks/bind-Ui43-n2d.cjs +25 -0
- package/dist/chunks/bind-Ui43-n2d.cjs.map +1 -0
- package/dist/chunks/core-B5T0dhFH.cjs +920 -0
- package/dist/chunks/core-B5T0dhFH.cjs.map +1 -0
- package/dist/chunks/core-BGAyaY6L.cjs +265 -0
- package/dist/chunks/core-BGAyaY6L.cjs.map +1 -0
- package/dist/chunks/core-D7cVumUu.js +909 -0
- package/dist/chunks/core-D7cVumUu.js.map +1 -0
- package/dist/chunks/core-VEBw36QK.js +260 -0
- package/dist/chunks/core-VEBw36QK.js.map +1 -0
- package/dist/chunks/core-ps8uvYuN.js +181 -0
- package/dist/chunks/core-ps8uvYuN.js.map +1 -0
- package/dist/chunks/core-zq17EeCI.cjs +185 -0
- package/dist/chunks/core-zq17EeCI.cjs.map +1 -0
- package/dist/chunks/fx-Bs6IrV4Q.js +109 -0
- package/dist/chunks/fx-Bs6IrV4Q.js.map +1 -0
- package/dist/chunks/fx-lBGVtQO1.cjs +114 -0
- package/dist/chunks/fx-lBGVtQO1.cjs.map +1 -0
- package/dist/chunks/generative-D2YyhaeO.js +336 -0
- package/dist/chunks/generative-D2YyhaeO.js.map +1 -0
- package/dist/chunks/generative-DzIZq-_g.cjs +348 -0
- package/dist/chunks/generative-DzIZq-_g.cjs.map +1 -0
- package/dist/chunks/gpu-Bu7qwugO.js +380 -0
- package/dist/chunks/gpu-Bu7qwugO.js.map +1 -0
- package/dist/chunks/gpu-CenK2l6b.cjs +387 -0
- package/dist/chunks/gpu-CenK2l6b.cjs.map +1 -0
- package/dist/chunks/index-tags-DucKMQr_.js +26 -0
- package/dist/chunks/index-tags-DucKMQr_.js.map +1 -0
- package/dist/chunks/index-tags-wv0R_vkO.cjs +28 -0
- package/dist/chunks/index-tags-wv0R_vkO.cjs.map +1 -0
- package/dist/chunks/presets-BYBVJVeP.js +226 -0
- package/dist/chunks/presets-BYBVJVeP.js.map +1 -0
- package/dist/chunks/presets-CUHys3sK.cjs +233 -0
- package/dist/chunks/presets-CUHys3sK.cjs.map +1 -0
- package/dist/chunks/registry-CKNLQpwd.js +121 -0
- package/dist/chunks/registry-CKNLQpwd.js.map +1 -0
- package/dist/chunks/registry-DehBVRDV.cjs +131 -0
- package/dist/chunks/registry-DehBVRDV.cjs.map +1 -0
- package/dist/chunks/spring-CbvHfVtP.js +219 -0
- package/dist/chunks/spring-CbvHfVtP.js.map +1 -0
- package/dist/chunks/spring-Dgx187Vh.cjs +232 -0
- package/dist/chunks/spring-Dgx187Vh.cjs.map +1 -0
- package/dist/chunks/stagger-CCFyhzSw.cjs +86 -0
- package/dist/chunks/stagger-CCFyhzSw.cjs.map +1 -0
- package/dist/chunks/stagger-DtMKo2SK.js +84 -0
- package/dist/chunks/stagger-DtMKo2SK.js.map +1 -0
- package/dist/chunks/variants-BhjyddG8.cjs +39 -0
- package/dist/chunks/variants-BhjyddG8.cjs.map +1 -0
- package/dist/chunks/variants-DRlKVHvu.js +35 -0
- package/dist/chunks/variants-DRlKVHvu.js.map +1 -0
- package/dist/components/a11y.cjs +276 -0
- package/dist/components/a11y.cjs.map +1 -0
- package/dist/components/a11y.d.cts +131 -0
- package/dist/components/a11y.d.ts +131 -0
- package/dist/components/a11y.js +259 -0
- package/dist/components/a11y.js.map +1 -0
- package/dist/components/angular.cjs +76 -0
- package/dist/components/angular.cjs.map +1 -0
- package/dist/components/angular.d.cts +1734 -0
- package/dist/components/angular.d.ts +1734 -0
- package/dist/components/angular.js +70 -0
- package/dist/components/angular.js.map +1 -0
- package/dist/components/background.cjs +659 -0
- package/dist/components/background.cjs.map +1 -0
- package/dist/components/background.css +9 -0
- package/dist/components/background.d.cts +166 -0
- package/dist/components/background.d.ts +166 -0
- package/dist/components/background.js +647 -0
- package/dist/components/background.js.map +1 -0
- package/dist/components/bridge.cjs +154 -0
- package/dist/components/bridge.cjs.map +1 -0
- package/dist/components/bridge.d.cts +63 -0
- package/dist/components/bridge.d.ts +63 -0
- package/dist/components/bridge.js +147 -0
- package/dist/components/bridge.js.map +1 -0
- package/dist/components/cards.cjs +561 -0
- package/dist/components/cards.cjs.map +1 -0
- package/dist/components/cards.css +6 -0
- package/dist/components/cards.d.cts +115 -0
- package/dist/components/cards.d.ts +115 -0
- package/dist/components/cards.js +554 -0
- package/dist/components/cards.js.map +1 -0
- package/dist/components/click.cjs +877 -0
- package/dist/components/click.cjs.map +1 -0
- package/dist/components/click.css +9 -0
- package/dist/components/click.d.cts +218 -0
- package/dist/components/click.d.ts +218 -0
- package/dist/components/click.js +863 -0
- package/dist/components/click.js.map +1 -0
- package/dist/components/depth.cjs +250 -0
- package/dist/components/depth.cjs.map +1 -0
- package/dist/components/depth.css +3 -0
- package/dist/components/depth.d.cts +86 -0
- package/dist/components/depth.d.ts +86 -0
- package/dist/components/depth.js +242 -0
- package/dist/components/depth.js.map +1 -0
- package/dist/components/effects.cjs +2258 -0
- package/dist/components/effects.cjs.map +1 -0
- package/dist/components/effects.d.cts +545 -0
- package/dist/components/effects.d.ts +545 -0
- package/dist/components/effects.js +2200 -0
- package/dist/components/effects.js.map +1 -0
- package/dist/components/feedback.cjs +442 -0
- package/dist/components/feedback.cjs.map +1 -0
- package/dist/components/feedback.css +7 -0
- package/dist/components/feedback.d.cts +144 -0
- package/dist/components/feedback.d.ts +144 -0
- package/dist/components/feedback.js +433 -0
- package/dist/components/feedback.js.map +1 -0
- package/dist/components/fx-gpu.cjs +12 -0
- package/dist/components/fx-gpu.cjs.map +1 -0
- package/dist/components/fx-gpu.d.cts +63 -0
- package/dist/components/fx-gpu.d.ts +63 -0
- package/dist/components/fx-gpu.js +5 -0
- package/dist/components/fx-gpu.js.map +1 -0
- package/dist/components/fx.cjs +169 -0
- package/dist/components/fx.cjs.map +1 -0
- package/dist/components/fx.css +3 -0
- package/dist/components/fx.d.cts +114 -0
- package/dist/components/fx.d.ts +114 -0
- package/dist/components/fx.js +156 -0
- package/dist/components/fx.js.map +1 -0
- package/dist/components/fx2.cjs +25 -0
- package/dist/components/fx2.cjs.map +1 -0
- package/dist/components/fx2.d.cts +136 -0
- package/dist/components/fx2.d.ts +136 -0
- package/dist/components/fx2.js +17 -0
- package/dist/components/fx2.js.map +1 -0
- package/dist/components/gesture.cjs +209 -0
- package/dist/components/gesture.cjs.map +1 -0
- package/dist/components/gesture.css +3 -0
- package/dist/components/gesture.d.cts +134 -0
- package/dist/components/gesture.d.ts +134 -0
- package/dist/components/gesture.js +203 -0
- package/dist/components/gesture.js.map +1 -0
- package/dist/components/interaction.cjs +424 -0
- package/dist/components/interaction.cjs.map +1 -0
- package/dist/components/interaction.css +8 -0
- package/dist/components/interaction.d.cts +115 -0
- package/dist/components/interaction.d.ts +115 -0
- package/dist/components/interaction.js +416 -0
- package/dist/components/interaction.js.map +1 -0
- package/dist/components/jsx.cjs +3 -0
- package/dist/components/jsx.cjs.map +1 -0
- package/dist/components/jsx.d.cts +53 -0
- package/dist/components/jsx.d.ts +53 -0
- package/dist/components/jsx.js +2 -0
- package/dist/components/jsx.js.map +1 -0
- package/dist/components/layout.cjs +257 -0
- package/dist/components/layout.cjs.map +1 -0
- package/dist/components/layout.css +3 -0
- package/dist/components/layout.d.cts +99 -0
- package/dist/components/layout.d.ts +99 -0
- package/dist/components/layout.js +249 -0
- package/dist/components/layout.js.map +1 -0
- package/dist/components/lazy.cjs +92 -0
- package/dist/components/lazy.cjs.map +1 -0
- package/dist/components/lazy.d.cts +48 -0
- package/dist/components/lazy.d.ts +48 -0
- package/dist/components/lazy.js +87 -0
- package/dist/components/lazy.js.map +1 -0
- package/dist/components/lite.cjs +11095 -0
- package/dist/components/lite.cjs.map +1 -0
- package/dist/components/lite.d.cts +4 -0
- package/dist/components/lite.d.ts +4 -0
- package/dist/components/lite.js +10827 -0
- package/dist/components/lite.js.map +1 -0
- package/dist/components/packs.cjs +192 -0
- package/dist/components/packs.cjs.map +1 -0
- package/dist/components/packs.css +3 -0
- package/dist/components/packs.d.cts +72 -0
- package/dist/components/packs.d.ts +72 -0
- package/dist/components/packs.js +184 -0
- package/dist/components/packs.js.map +1 -0
- package/dist/components/page.cjs +824 -0
- package/dist/components/page.cjs.map +1 -0
- package/dist/components/page.css +11 -0
- package/dist/components/page.d.cts +249 -0
- package/dist/components/page.d.ts +249 -0
- package/dist/components/page.js +799 -0
- package/dist/components/page.js.map +1 -0
- package/dist/components/perf.cjs +120 -0
- package/dist/components/perf.cjs.map +1 -0
- package/dist/components/perf.d.cts +98 -0
- package/dist/components/perf.d.ts +98 -0
- package/dist/components/perf.js +110 -0
- package/dist/components/perf.js.map +1 -0
- package/dist/components/physics.cjs +448 -0
- package/dist/components/physics.cjs.map +1 -0
- package/dist/components/physics.css +5 -0
- package/dist/components/physics.d.cts +189 -0
- package/dist/components/physics.d.ts +189 -0
- package/dist/components/physics.js +430 -0
- package/dist/components/physics.js.map +1 -0
- package/dist/components/react.cjs +96 -0
- package/dist/components/react.cjs.map +1 -0
- package/dist/components/react.d.cts +18 -0
- package/dist/components/react.d.ts +18 -0
- package/dist/components/react.js +91 -0
- package/dist/components/react.js.map +1 -0
- package/dist/components/reveal.cjs +362 -0
- package/dist/components/reveal.cjs.map +1 -0
- package/dist/components/reveal.css +5 -0
- package/dist/components/reveal.d.cts +105 -0
- package/dist/components/reveal.d.ts +105 -0
- package/dist/components/reveal.js +353 -0
- package/dist/components/reveal.js.map +1 -0
- package/dist/components/solid.cjs +86 -0
- package/dist/components/solid.cjs.map +1 -0
- package/dist/components/solid.d.cts +1751 -0
- package/dist/components/solid.d.ts +1751 -0
- package/dist/components/solid.js +82 -0
- package/dist/components/solid.js.map +1 -0
- package/dist/components/svelte.cjs +68 -0
- package/dist/components/svelte.cjs.map +1 -0
- package/dist/components/svelte.d.cts +1733 -0
- package/dist/components/svelte.d.ts +1733 -0
- package/dist/components/svelte.js +64 -0
- package/dist/components/svelte.js.map +1 -0
- package/dist/components/svg.cjs +359 -0
- package/dist/components/svg.cjs.map +1 -0
- package/dist/components/svg.css +3 -0
- package/dist/components/svg.d.cts +113 -0
- package/dist/components/svg.d.ts +113 -0
- package/dist/components/svg.js +347 -0
- package/dist/components/svg.js.map +1 -0
- package/dist/components/text.cjs +968 -0
- package/dist/components/text.cjs.map +1 -0
- package/dist/components/text.css +8 -0
- package/dist/components/text.d.cts +342 -0
- package/dist/components/text.d.ts +342 -0
- package/dist/components/text.js +947 -0
- package/dist/components/text.js.map +1 -0
- package/dist/components/timeline.cjs +109 -0
- package/dist/components/timeline.cjs.map +1 -0
- package/dist/components/timeline.css +3 -0
- package/dist/components/timeline.d.cts +155 -0
- package/dist/components/timeline.d.ts +155 -0
- package/dist/components/timeline.js +103 -0
- package/dist/components/timeline.js.map +1 -0
- package/dist/components/tokens.cjs +226 -0
- package/dist/components/tokens.cjs.map +1 -0
- package/dist/components/tokens.d.cts +74 -0
- package/dist/components/tokens.d.ts +74 -0
- package/dist/components/tokens.js +211 -0
- package/dist/components/tokens.js.map +1 -0
- package/dist/components/transitions.cjs +430 -0
- package/dist/components/transitions.cjs.map +1 -0
- package/dist/components/transitions.css +5 -0
- package/dist/components/transitions.d.cts +126 -0
- package/dist/components/transitions.d.ts +126 -0
- package/dist/components/transitions.js +423 -0
- package/dist/components/transitions.js.map +1 -0
- package/dist/components/ui.cjs +1050 -0
- package/dist/components/ui.cjs.map +1 -0
- package/dist/components/ui.css +14 -0
- package/dist/components/ui.d.cts +224 -0
- package/dist/components/ui.d.ts +224 -0
- package/dist/components/ui.js +1034 -0
- package/dist/components/ui.js.map +1 -0
- package/dist/components/vue.cjs +67 -0
- package/dist/components/vue.cjs.map +1 -0
- package/dist/components/vue.d.cts +1722 -0
- package/dist/components/vue.d.ts +1722 -0
- package/dist/components/vue.js +64 -0
- package/dist/components/vue.js.map +1 -0
- package/dist/components/webgl.cjs +459 -0
- package/dist/components/webgl.cjs.map +1 -0
- package/dist/components/webgl.css +3 -0
- package/dist/components/webgl.d.cts +133 -0
- package/dist/components/webgl.d.ts +133 -0
- package/dist/components/webgl.js +442 -0
- package/dist/components/webgl.js.map +1 -0
- package/dist/components/widgets.cjs +591 -0
- package/dist/components/widgets.cjs.map +1 -0
- package/dist/components/widgets.d.cts +110 -0
- package/dist/components/widgets.d.ts +110 -0
- package/dist/components/widgets.js +581 -0
- package/dist/components/widgets.js.map +1 -0
- package/dist/components.cjs +351 -0
- package/dist/components.cjs.map +1 -0
- package/dist/components.css +75 -0
- package/dist/components.d.cts +2997 -0
- package/dist/components.d.ts +2997 -0
- package/dist/components.js +106 -0
- package/dist/components.js.map +1 -0
- package/dist/components.umd.js +23 -0
- package/dist/components.umd.js.map +1 -0
- package/dist/element.cjs +97 -0
- package/dist/element.cjs.map +1 -0
- package/dist/element.d.cts +215 -0
- package/dist/element.d.ts +215 -0
- package/dist/element.js +95 -0
- package/dist/element.js.map +1 -0
- package/dist/element.umd.js +2 -0
- package/dist/element.umd.js.map +1 -0
- package/dist/index.cjs +149 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +425 -0
- package/dist/index.d.ts +425 -0
- package/dist/index.js +131 -0
- package/dist/index.js.map +1 -0
- package/dist/index.umd.js +15 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/presets/extended.cjs +243 -0
- package/dist/presets/extended.cjs.map +1 -0
- package/dist/presets/extended.d.cts +37 -0
- package/dist/presets/extended.d.ts +37 -0
- package/dist/presets/extended.js +239 -0
- package/dist/presets/extended.js.map +1 -0
- package/dist/presets-extended.umd.js +2 -0
- package/dist/presets-extended.umd.js.map +1 -0
- package/dist/react.cjs +68 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +158 -0
- package/dist/react.d.ts +158 -0
- package/dist/react.js +65 -0
- package/dist/react.js.map +1 -0
- package/dist/solid.cjs +93 -0
- package/dist/solid.cjs.map +1 -0
- package/dist/solid.d.cts +249 -0
- package/dist/solid.d.ts +249 -0
- package/dist/solid.js +89 -0
- package/dist/solid.js.map +1 -0
- package/dist/svelte.cjs +66 -0
- package/dist/svelte.cjs.map +1 -0
- package/dist/svelte.d.cts +243 -0
- package/dist/svelte.d.ts +243 -0
- package/dist/svelte.js +63 -0
- package/dist/svelte.js.map +1 -0
- package/dist/vue.cjs +62 -0
- package/dist/vue.cjs.map +1 -0
- package/dist/vue.d.cts +158 -0
- package/dist/vue.d.ts +158 -0
- package/dist/vue.js +60 -0
- package/dist/vue.js.map +1 -0
- package/dist/widgets.umd.js +2 -0
- package/dist/widgets.umd.js.map +1 -0
- package/docs/API.md +147 -0
- package/docs/ROADMAP.md +14 -0
- package/docs/accessibility.md +60 -0
- package/docs/components.md +564 -0
- package/docs/deprecations.md +30 -0
- package/docs/frameworks-ssr.md +100 -0
- package/docs/hybrid-apps.md +145 -0
- package/docs/images/showcase-detail.png +0 -0
- package/docs/images/showcase-grid.png +0 -0
- package/docs/images/showcase-mobile.png +0 -0
- package/docs/migration-from-aos.md +67 -0
- package/docs/migration-from-gsap-scrolltrigger.md +80 -0
- package/docs/motion-tokens.css +31 -0
- package/docs/motion-tokens.md +46 -0
- package/docs/motion.tokens.json +132 -0
- package/docs/performance.md +24 -0
- package/docs/presets.md +310 -0
- package/docs/upgrading-3.md +21 -0
- package/docs/upgrading-4.md +65 -0
- package/docs/upgrading-5.md +31 -0
- package/docs/upgrading-6.md +32 -0
- package/docs/windows-apps.md +119 -0
- package/package.json +562 -4
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Members shared by every `<usa-*>` element. Attribute helpers, a cleanup
|
|
3
|
+
* bag that is emptied on disconnect, and motion helpers that degrade to the
|
|
4
|
+
* final state without WAAPI or under reduced motion.
|
|
5
|
+
*/
|
|
6
|
+
interface UsaElement extends HTMLElement {
|
|
7
|
+
/** `true` while reduced motion applies to this element. */
|
|
8
|
+
readonly reduced: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* `<usa-typewriter>` — types text character by character, optionally cycling
|
|
13
|
+
* through several phrases (typing, pausing, deleting).
|
|
14
|
+
*
|
|
15
|
+
* Attributes: `text` (default: the element's text), `words` (phrases
|
|
16
|
+
* separated by `|`, overrides `text`), `speed` (ms per character, 55),
|
|
17
|
+
* `delete-speed` (ms, 30), `pause` (ms before deleting, 1400), `delay`
|
|
18
|
+
* (ms, 0), `loop`, `cursor="false"` to hide the caret, `start`
|
|
19
|
+
* (`view` | `load` | `manual`, default `view`). The full text is exposed to
|
|
20
|
+
* assistive tech via `aria-label`. Event: `usa:complete` (one pass done).
|
|
21
|
+
* Reduced motion: the text appears at once.
|
|
22
|
+
*/
|
|
23
|
+
interface UsaTypewriterElement extends UsaElement {
|
|
24
|
+
/** Phrases being typed. */
|
|
25
|
+
readonly phrases: string[];
|
|
26
|
+
start(): void;
|
|
27
|
+
stop(): void;
|
|
28
|
+
restart(): void;
|
|
29
|
+
}
|
|
30
|
+
declare function defineTypewriter(tag?: string): CustomElementConstructor | undefined;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* `<usa-split-text>` — splits its text into words or characters and reveals
|
|
34
|
+
* them in a cascade (pure CSS animation per unit, transform / opacity /
|
|
35
|
+
* filter only). Words never break across lines.
|
|
36
|
+
*
|
|
37
|
+
* 4.3: `Intl.Segmenter`-aware (emoji, CJK words), Arabic-script words are
|
|
38
|
+
* never split below the word, `by="lines"` reveals line by line, and `from`
|
|
39
|
+
* (`start` · `end` · `center` · `edges` · `random`) sets the cascade order.
|
|
40
|
+
*
|
|
41
|
+
* Attributes: `by` (`chars` | `words` | `lines`, default `chars`), `effect`
|
|
42
|
+
* (`rise` | `fade` | `blur` | `flip` | `pop`, default `rise`), `stagger`
|
|
43
|
+
* (ms between units, 28 for chars / 70 for words), `duration` (ms, 620),
|
|
44
|
+
* `delay` (ms, 0), `trigger` (`view` | `load` | `manual`, default `view`),
|
|
45
|
+
* `repeat`. The original text stays readable via `aria-label`.
|
|
46
|
+
* Event: `usa:complete`.
|
|
47
|
+
*/
|
|
48
|
+
interface UsaSplitTextElement extends UsaElement {
|
|
49
|
+
readonly units: HTMLElement[];
|
|
50
|
+
play(): void;
|
|
51
|
+
reset(): void;
|
|
52
|
+
}
|
|
53
|
+
declare function defineSplitText(tag?: string): CustomElementConstructor | undefined;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* `<usa-scramble>` — "decodes" text out of random glyphs, left to right.
|
|
57
|
+
*
|
|
58
|
+
* Attributes: `text` (default: the element's text), `duration` (ms, 900),
|
|
59
|
+
* `chars` (glyph set), `trigger` (`view` | `hover` | `load` | `manual`,
|
|
60
|
+
* default `view`). Spaces and punctuation stay in place. Uses a monospace-
|
|
61
|
+
* friendly fixed width per glyph only if you style it so; the element sets
|
|
62
|
+
* nothing that causes reflow beyond its own text. Event: `usa:complete`.
|
|
63
|
+
* Reduced motion: shows the final text.
|
|
64
|
+
*/
|
|
65
|
+
interface UsaScrambleElement extends UsaElement {
|
|
66
|
+
play(): Promise<void>;
|
|
67
|
+
}
|
|
68
|
+
/** One frame of the scramble: the first `progress` share is resolved. */
|
|
69
|
+
declare function scrambleFrame(text: string, progress: number, glyphs?: string, rnd?: () => number): string;
|
|
70
|
+
declare function defineScramble(tag?: string): CustomElementConstructor | undefined;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* `<usa-counter>` — counts up (or down) to a number when it scrolls into view.
|
|
74
|
+
*
|
|
75
|
+
* Attributes: `to` (target, required), `from` (0), `duration` (ms, 1600),
|
|
76
|
+
* `decimals` (0), `locale` (default: the document language), `prefix`,
|
|
77
|
+
* `suffix`, `grouping="false"` (no thousands separators), `start`
|
|
78
|
+
* (`view` | `load` | `manual`). Setting the `value` property animates from
|
|
79
|
+
* the current value — handy for live dashboards. Uses tabular digits so
|
|
80
|
+
* the width does not jump. Event: `usa:complete`. Reduced motion: jumps.
|
|
81
|
+
*/
|
|
82
|
+
interface UsaCounterElement extends UsaElement {
|
|
83
|
+
/** Current target; setting it animates to the new number. */
|
|
84
|
+
value: number;
|
|
85
|
+
/** Animate to `to` (default: the `to` attribute). */
|
|
86
|
+
play(to?: number): Promise<void>;
|
|
87
|
+
format(n: number): string;
|
|
88
|
+
}
|
|
89
|
+
/** easeOutExpo */
|
|
90
|
+
declare const easeOutExpo: (t: number) => number;
|
|
91
|
+
declare function defineCounter(tag?: string): CustomElementConstructor | undefined;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* `<usa-shimmer-text>` — a light sweep across gradient-filled text (CSS
|
|
95
|
+
* only; the element just maps attributes to custom properties).
|
|
96
|
+
*
|
|
97
|
+
* Attributes: `duration` (ms, 2600), `color` (base text colour), `shine`
|
|
98
|
+
* (highlight colour), `angle` (deg, 110). Or style `--usa-shimmer-*`
|
|
99
|
+
* directly. Reduced motion: static gradient text.
|
|
100
|
+
*/
|
|
101
|
+
type UsaShimmerTextElement = UsaElement;
|
|
102
|
+
declare function defineShimmerText(tag?: string): CustomElementConstructor | undefined;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* `<usa-text-rotate>` — cycles through words in place ("Build *fast* /
|
|
106
|
+
* *small* / *typed* apps"). All words share one grid cell, so the width is
|
|
107
|
+
* that of the longest word and nothing around it reflows.
|
|
108
|
+
*
|
|
109
|
+
* Attributes: `words` (separated by `|`, default: the element's text split
|
|
110
|
+
* on `|`), `interval` (ms, 2200), `effect` (`slide` | `fade` | `flip` |
|
|
111
|
+
* `blur`, default `slide`), `paused`. Pauses while off-screen and on hover
|
|
112
|
+
* is not needed. Event: `usa:change` (`detail.index`, `detail.word`).
|
|
113
|
+
* Reduced motion: words still change, without movement (fade only).
|
|
114
|
+
*/
|
|
115
|
+
interface UsaTextRotateElement extends UsaElement {
|
|
116
|
+
readonly index: number;
|
|
117
|
+
next(): void;
|
|
118
|
+
}
|
|
119
|
+
declare function defineTextRotate(tag?: string): CustomElementConstructor | undefined;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* `<usa-wave-text>` — letters bob in a travelling wave.
|
|
123
|
+
* Attributes: `amplitude` (em, 0.25), `speed` (s per cycle, 1.6), `stagger`
|
|
124
|
+
* (s between letters, 0.06). Reduced motion: still text.
|
|
125
|
+
*/
|
|
126
|
+
interface UsaWaveTextElement extends UsaElement {
|
|
127
|
+
}
|
|
128
|
+
declare function defineWaveText(tag?: string): CustomElementConstructor | undefined;
|
|
129
|
+
/**
|
|
130
|
+
* `<usa-glitch>` — an RGB-split glitch on its text (`trigger="always"`
|
|
131
|
+
* default, or `hover`). Attributes: `intensity` (px, 3), `trigger`.
|
|
132
|
+
* Reduced motion: no animation (plain text).
|
|
133
|
+
*/
|
|
134
|
+
interface UsaGlitchElement extends UsaElement {
|
|
135
|
+
}
|
|
136
|
+
declare function defineGlitch(tag?: string): CustomElementConstructor | undefined;
|
|
137
|
+
/**
|
|
138
|
+
* `<usa-gradient-text>` — text filled with a flowing multi-colour gradient.
|
|
139
|
+
* Attributes: `colors` (comma list), `speed` (s, 6), `angle` (deg, 90).
|
|
140
|
+
* Reduced motion: a static gradient.
|
|
141
|
+
*/
|
|
142
|
+
interface UsaGradientTextElement extends UsaElement {
|
|
143
|
+
}
|
|
144
|
+
declare function defineGradientText(tag?: string): CustomElementConstructor | undefined;
|
|
145
|
+
/**
|
|
146
|
+
* `<usa-handwriting>` — the text draws itself stroke by stroke (SVG text
|
|
147
|
+
* outline), then fills in, when it scrolls into view.
|
|
148
|
+
* Attributes: `text`, `duration` (ms, 2400), `stroke` (colour), `size` (px,
|
|
149
|
+
* 64), `font` (family; a script font looks best). Events: `usa:complete`.
|
|
150
|
+
* Reduced motion: the filled text appears at once.
|
|
151
|
+
*/
|
|
152
|
+
interface UsaHandwritingElement extends UsaElement {
|
|
153
|
+
play(): void;
|
|
154
|
+
}
|
|
155
|
+
declare function defineHandwriting(tag?: string): CustomElementConstructor | undefined;
|
|
156
|
+
/**
|
|
157
|
+
* `<usa-scroll-highlight>` — reading highlight: words light up one by one
|
|
158
|
+
* as the paragraph scrolls through the viewport (`mode="words"`, default),
|
|
159
|
+
* or a highlighter marker sweeps behind the text on enter (`mode="marker"`).
|
|
160
|
+
* Attributes: `mode`, `color` (marker), `dim` (opacity of unread words,
|
|
161
|
+
* 0.2). Reduced motion: fully highlighted text.
|
|
162
|
+
*/
|
|
163
|
+
interface UsaScrollHighlightElement extends UsaElement {
|
|
164
|
+
readonly progress: number;
|
|
165
|
+
}
|
|
166
|
+
declare function defineScrollHighlight(tag?: string): CustomElementConstructor | undefined;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Where a step starts on a timeline:
|
|
170
|
+
* - a number: absolute time in ms
|
|
171
|
+
* - `'>'` (default): when the previous step ends · `'<'`: when it starts
|
|
172
|
+
* - `'+=200'` / `'-=200'`: after / overlapping the previous end
|
|
173
|
+
* - `'<+=100'`: 100ms after the previous step's start
|
|
174
|
+
* - `'intro'` / `'intro+=150'`: at (or relative to) a label
|
|
175
|
+
*/
|
|
176
|
+
type TimelinePosition = number | string;
|
|
177
|
+
interface TimelineStepOptions {
|
|
178
|
+
/** Duration in ms or a motion token name (`'fast'`, `'slow'`…; 4.2). Default: timeline default, 600. */
|
|
179
|
+
duration?: number | string;
|
|
180
|
+
/** CSS easing or a motion token name (`'emphasized'`, `'spring'`…; 4.2). Default `cubic-bezier(0.22, 1, 0.36, 1)`. */
|
|
181
|
+
easing?: string;
|
|
182
|
+
/** Start position, see `TimelinePosition`. */
|
|
183
|
+
at?: TimelinePosition;
|
|
184
|
+
/** ms between targets when the selector matches several elements. */
|
|
185
|
+
stagger?: number;
|
|
186
|
+
}
|
|
187
|
+
interface ScrubOptions {
|
|
188
|
+
/** Scroll offset (px) before the source's top reaches the viewport bottom where progress starts (JS engine only). */
|
|
189
|
+
offset?: number;
|
|
190
|
+
/** Smoothing 0–1 (0 = immediate, default 0). Smoothing needs the JS engine. */
|
|
191
|
+
smooth?: number;
|
|
192
|
+
/**
|
|
193
|
+
* 4.1: which progress source drives the timeline.
|
|
194
|
+
* - `'view'` (default): `source` moving through the viewport (CSS `ViewTimeline`, range `cover`).
|
|
195
|
+
* - `'scroll'`: the scroll position of `source` itself (a scroll container; CSS `ScrollTimeline`).
|
|
196
|
+
*/
|
|
197
|
+
source?: 'view' | 'scroll';
|
|
198
|
+
/** 4.1: `'auto'` (default) uses the browser's native scroll-driven animations when available, `'js'` forces the fallback. */
|
|
199
|
+
engine?: 'auto' | 'native' | 'js';
|
|
200
|
+
/** 4.1: scroll axis, `'block'` (default) · `'inline'` · `'x'` · `'y'`. */
|
|
201
|
+
axis?: 'block' | 'inline' | 'x' | 'y';
|
|
202
|
+
}
|
|
203
|
+
/** The function `scrub()` returns: call it to stop. `native` tells which engine runs it. */
|
|
204
|
+
interface ScrubHandle {
|
|
205
|
+
(): void;
|
|
206
|
+
/** `true` when the browser's ScrollTimeline / ViewTimeline drives it (compositor, no JS per frame). */
|
|
207
|
+
readonly native: boolean;
|
|
208
|
+
}
|
|
209
|
+
interface Timeline {
|
|
210
|
+
/** Total length in ms. */
|
|
211
|
+
readonly duration: number;
|
|
212
|
+
/** Label positions in ms. */
|
|
213
|
+
readonly labels: Readonly<Record<string, number>>;
|
|
214
|
+
/** Current playhead in ms. */
|
|
215
|
+
readonly time: number;
|
|
216
|
+
/** Add a step: animate `target` with keyframes or a preset name (`fade-up`, `scale`…). */
|
|
217
|
+
to(target: string | Element | Element[] | NodeList, frames: Keyframe[] | string, options?: TimelineStepOptions): Timeline;
|
|
218
|
+
/** Name a position (default: the current end). */
|
|
219
|
+
label(name: string, at?: TimelinePosition): Timeline;
|
|
220
|
+
/** Run `fn` when the playhead passes `at`. */
|
|
221
|
+
call(fn: () => void, at?: TimelinePosition): Timeline;
|
|
222
|
+
/** Play forwards from the playhead (from 0 when at the end). Resolves at the end. */
|
|
223
|
+
play(from?: TimelinePosition): Promise<void>;
|
|
224
|
+
/** Play backwards to 0. */
|
|
225
|
+
reverse(): Promise<void>;
|
|
226
|
+
pause(): Timeline;
|
|
227
|
+
/** Jump to a time (ms) or label. */
|
|
228
|
+
seek(to: TimelinePosition): Timeline;
|
|
229
|
+
/** Get or set progress 0–1. */
|
|
230
|
+
progress(p?: number): number;
|
|
231
|
+
/**
|
|
232
|
+
* Tie progress to scroll: `source` moving through the viewport (or, with
|
|
233
|
+
* `{ source: 'scroll' }`, a scroll container's own position). Runs on native
|
|
234
|
+
* ScrollTimeline / ViewTimeline when available (and no `smooth`, `offset`,
|
|
235
|
+
* `call()` cues or `onUpdate` need JS), else on a rAF-throttled listener.
|
|
236
|
+
* Returns a stop function with a `native` flag.
|
|
237
|
+
*/
|
|
238
|
+
scrub(source: Element, options?: ScrubOptions): ScrubHandle;
|
|
239
|
+
/** Stop and drop every animation (elements keep their last frame). */
|
|
240
|
+
cancel(): void;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* `splitText()` (4.3) — split an element's text into characters, words and / or
|
|
245
|
+
* lines, ready for per-unit choreography with `timeline()`.
|
|
246
|
+
*
|
|
247
|
+
* - Grapheme- and word-aware via `Intl.Segmenter` when available: emoji and
|
|
248
|
+
* combining marks stay whole; Chinese / Japanese / Korean text is split into
|
|
249
|
+
* real words (or one unit per character without `Segmenter`).
|
|
250
|
+
* - RTL aware: Arabic-script text (cursive, letters join) is never split
|
|
251
|
+
* below the word, so shaping is preserved; Hebrew and other RTL scripts
|
|
252
|
+
* split per character. Units stay in logical (reading) order.
|
|
253
|
+
* - Nested inline markup (`<em>`, `<a>`, `<br>`) is preserved.
|
|
254
|
+
* - Accessible: the original text stays available to assistive tech via a
|
|
255
|
+
* visually hidden copy; the split spans are `aria-hidden`.
|
|
256
|
+
*/
|
|
257
|
+
type SplitBy = 'char' | 'word' | 'line';
|
|
258
|
+
interface SplitTextOptions {
|
|
259
|
+
/** What to split into: `'char'`, `'word'`, `'line'` or several, e.g. `['word', 'line']`. Default `'char'` (words are always wrapped too). */
|
|
260
|
+
by?: SplitBy | SplitBy[] | string;
|
|
261
|
+
/** Locale for `Intl.Segmenter` (default: the element's `lang`, else the document's). */
|
|
262
|
+
locale?: string;
|
|
263
|
+
/** Class prefix (default `usa-split`): units get `usa-split-char` / `-word` / `-line`. */
|
|
264
|
+
className?: string;
|
|
265
|
+
}
|
|
266
|
+
interface SplitResult {
|
|
267
|
+
chars: HTMLElement[];
|
|
268
|
+
words: HTMLElement[];
|
|
269
|
+
lines: HTMLElement[];
|
|
270
|
+
/** `'rtl'` or `'ltr'` — the direction the split ran in. */
|
|
271
|
+
direction: 'ltr' | 'rtl';
|
|
272
|
+
/** Re-measure lines (call after a resize or font load). */
|
|
273
|
+
relayout(): HTMLElement[];
|
|
274
|
+
/** Restore the original markup. */
|
|
275
|
+
revert(): void;
|
|
276
|
+
}
|
|
277
|
+
/** Scripts whose letters join (splitting them would break shaping). */
|
|
278
|
+
declare const JOINING_SCRIPT: RegExp;
|
|
279
|
+
/** Grapheme clusters of `s` (emoji / combining marks stay whole). */
|
|
280
|
+
declare function graphemes(s: string, locale?: string): string[];
|
|
281
|
+
/**
|
|
282
|
+
* Word-ish tokens of `s`, whitespace kept as separate tokens. CJK text is
|
|
283
|
+
* segmented into words with `Intl.Segmenter`, or per character without it.
|
|
284
|
+
*/
|
|
285
|
+
declare function words(s: string, locale?: string): string[];
|
|
286
|
+
declare function splitText(el: HTMLElement, options?: SplitTextOptions): SplitResult;
|
|
287
|
+
type SplitFrom = 'start' | 'end' | 'center' | 'edges' | 'random';
|
|
288
|
+
/** Order indices `0…n-1` by choreography: from the start, end, center outwards, edges inwards, or random (seeded). */
|
|
289
|
+
declare function splitOrder(n: number, from?: SplitFrom, seed?: number): number[];
|
|
290
|
+
interface SplitTimelineOptions extends SplitTextOptions {
|
|
291
|
+
/** Which units to animate (default: the finest in `by`). */
|
|
292
|
+
unit?: 'char' | 'word' | 'line';
|
|
293
|
+
/** Timeline preset name or keyframes (default `'fade-up'`). */
|
|
294
|
+
preset?: string | Keyframe[];
|
|
295
|
+
/** ms between units (default 30 for chars, 80 for words, 140 for lines). */
|
|
296
|
+
stagger?: number;
|
|
297
|
+
/** Duration per unit in ms or a motion token name (default 500). */
|
|
298
|
+
duration?: number | string;
|
|
299
|
+
easing?: string;
|
|
300
|
+
/** Choreography order (default `'start'` — reading order, also for RTL). */
|
|
301
|
+
from?: SplitFrom;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Split `el` and build a `timeline()` with one step per unit — play it,
|
|
305
|
+
* `scrub()` it with scroll, `reverse()` or `seek()` it.
|
|
306
|
+
*
|
|
307
|
+
* ```ts
|
|
308
|
+
* const { timeline: tl } = splitTimeline(h1, { by: 'char', preset: 'blur', from: 'center' });
|
|
309
|
+
* tl.play();
|
|
310
|
+
* ```
|
|
311
|
+
*/
|
|
312
|
+
declare function splitTimeline(el: HTMLElement, options?: SplitTimelineOptions): {
|
|
313
|
+
split: SplitResult;
|
|
314
|
+
timeline: Timeline;
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* motionary/components/text — text effects.
|
|
319
|
+
* `<usa-typewriter>`, `<usa-split-text>`, `<usa-scramble>`, `<usa-counter>`,
|
|
320
|
+
* `<usa-shimmer-text>`, `<usa-text-rotate>`.
|
|
321
|
+
*/
|
|
322
|
+
|
|
323
|
+
/** Register every component of this category under its default tag. */
|
|
324
|
+
declare function defineTextComponents(): void;
|
|
325
|
+
declare global {
|
|
326
|
+
interface HTMLElementTagNameMap {
|
|
327
|
+
'usa-wave-text': UsaWaveTextElement;
|
|
328
|
+
'usa-glitch': UsaGlitchElement;
|
|
329
|
+
'usa-gradient-text': UsaGradientTextElement;
|
|
330
|
+
'usa-handwriting': UsaHandwritingElement;
|
|
331
|
+
'usa-scroll-highlight': UsaScrollHighlightElement;
|
|
332
|
+
'usa-typewriter': UsaTypewriterElement;
|
|
333
|
+
'usa-split-text': UsaSplitTextElement;
|
|
334
|
+
'usa-scramble': UsaScrambleElement;
|
|
335
|
+
'usa-counter': UsaCounterElement;
|
|
336
|
+
'usa-shimmer-text': UsaShimmerTextElement;
|
|
337
|
+
'usa-text-rotate': UsaTextRotateElement;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export { JOINING_SCRIPT, defineCounter, defineGlitch, defineGradientText, defineHandwriting, defineScramble, defineScrollHighlight, defineShimmerText, defineSplitText, defineTextComponents, defineTextRotate, defineTypewriter, defineWaveText, easeOutExpo, graphemes, scrambleFrame, splitOrder, splitText, splitTimeline, words as splitWords };
|
|
342
|
+
export type { SplitBy, SplitFrom, SplitResult, SplitTextOptions, SplitTimelineOptions, UsaCounterElement, UsaGlitchElement, UsaGradientTextElement, UsaHandwritingElement, UsaScrambleElement, UsaScrollHighlightElement, UsaShimmerTextElement, UsaSplitTextElement, UsaTextRotateElement, UsaTypewriterElement, UsaWaveTextElement };
|