use-scroll-animate 6.0.1 → 6.1.1
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 +31 -0
- package/README.md +157 -373
- package/README_ja.md +171 -145
- package/README_zh.md +169 -167
- package/dist/chunks/{base-B5i8qQPR.cjs → base-BaQV-2ha.cjs} +3 -3
- package/dist/chunks/base-BaQV-2ha.cjs.map +1 -0
- package/dist/chunks/{base-C3Sw9sAO.js → base-Yno7N2eC.js} +3 -3
- package/dist/chunks/base-Yno7N2eC.js.map +1 -0
- package/dist/chunks/{core-qpECfEkb.cjs → core-B5T0dhFH.cjs} +14 -210
- package/dist/chunks/core-B5T0dhFH.cjs.map +1 -0
- package/dist/chunks/{core-BDcszY4L.cjs → core-BGAyaY6L.cjs} +2 -2
- package/dist/chunks/{core-BDcszY4L.cjs.map → core-BGAyaY6L.cjs.map} +1 -1
- package/dist/chunks/{core-BTf__I-8.js → core-BIOaYdgN.js} +2 -2
- package/dist/chunks/{core-BTf__I-8.js.map → core-BIOaYdgN.js.map} +1 -1
- package/dist/chunks/{core-DN3hHbHh.js → core-CUGCsMsJ.js} +2 -2
- package/dist/chunks/{core-DN3hHbHh.js.map → core-CUGCsMsJ.js.map} +1 -1
- package/dist/chunks/{core-mV_TPgG_.js → core-D7cVumUu.js} +11 -203
- package/dist/chunks/core-D7cVumUu.js.map +1 -0
- package/dist/chunks/{core-BjOYKSrV.cjs → core-zq17EeCI.cjs} +2 -2
- package/dist/chunks/{core-BjOYKSrV.cjs.map → core-zq17EeCI.cjs.map} +1 -1
- package/dist/chunks/{fx-ChjxrMBo.js → fx-BqDeFywO.js} +2 -2
- package/dist/chunks/{fx-ChjxrMBo.js.map → fx-BqDeFywO.js.map} +1 -1
- package/dist/chunks/{fx-B8hk1Fby.cjs → fx-lBGVtQO1.cjs} +2 -2
- package/dist/chunks/{fx-B8hk1Fby.cjs.map → fx-lBGVtQO1.cjs.map} +1 -1
- 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/{spring-CckMe3x0.js → spring-DfQO5USi.js} +2 -2
- package/dist/chunks/{spring-CckMe3x0.js.map → spring-DfQO5USi.js.map} +1 -1
- package/dist/chunks/{spring--oZh55tB.cjs → spring-Dgx187Vh.cjs} +2 -2
- package/dist/chunks/{spring--oZh55tB.cjs.map → spring-Dgx187Vh.cjs.map} +1 -1
- package/dist/chunks/{stagger-CLc3j58T.cjs → stagger-CCFyhzSw.cjs} +3 -3
- package/dist/chunks/stagger-CCFyhzSw.cjs.map +1 -0
- package/dist/chunks/{stagger-BFAhKknX.js → stagger-DtMKo2SK.js} +3 -3
- package/dist/chunks/stagger-DtMKo2SK.js.map +1 -0
- package/dist/chunks/{variants-DxPmgrNX.cjs → variants-BhjyddG8.cjs} +2 -2
- package/dist/chunks/{variants-DxPmgrNX.cjs.map → variants-BhjyddG8.cjs.map} +1 -1
- package/dist/chunks/{variants-Bsevy6Xm.js → variants-VNscPeTD.js} +2 -2
- package/dist/chunks/{variants-Bsevy6Xm.js.map → variants-VNscPeTD.js.map} +1 -1
- package/dist/components/a11y.cjs +4 -4
- package/dist/components/a11y.cjs.map +1 -1
- package/dist/components/a11y.d.cts +2 -2
- package/dist/components/a11y.d.ts +2 -2
- package/dist/components/a11y.js +5 -5
- package/dist/components/a11y.js.map +1 -1
- package/dist/components/angular.cjs +8 -8
- package/dist/components/angular.cjs.map +1 -1
- package/dist/components/angular.d.cts +22 -22
- package/dist/components/angular.d.ts +22 -22
- package/dist/components/angular.js +8 -8
- package/dist/components/angular.js.map +1 -1
- package/dist/components/background.cjs +3 -3
- package/dist/components/background.cjs.map +1 -1
- package/dist/components/background.css +1 -1
- package/dist/components/background.d.cts +1 -1
- package/dist/components/background.d.ts +1 -1
- package/dist/components/background.js +3 -3
- package/dist/components/background.js.map +1 -1
- package/dist/components/bridge.cjs +2 -2
- package/dist/components/bridge.cjs.map +1 -1
- package/dist/components/bridge.d.cts +1 -1
- package/dist/components/bridge.d.ts +1 -1
- package/dist/components/bridge.js +2 -2
- package/dist/components/bridge.js.map +1 -1
- package/dist/components/cards.cjs +3 -3
- package/dist/components/cards.cjs.map +1 -1
- package/dist/components/cards.css +1 -1
- package/dist/components/cards.d.cts +1 -1
- package/dist/components/cards.d.ts +1 -1
- package/dist/components/cards.js +3 -3
- package/dist/components/cards.js.map +1 -1
- package/dist/components/click.cjs +4 -4
- package/dist/components/click.cjs.map +1 -1
- package/dist/components/click.css +1 -1
- package/dist/components/click.d.cts +1 -1
- package/dist/components/click.d.ts +1 -1
- package/dist/components/click.js +4 -4
- package/dist/components/click.js.map +1 -1
- package/dist/components/depth.cjs +4 -4
- package/dist/components/depth.cjs.map +1 -1
- package/dist/components/depth.css +1 -1
- package/dist/components/depth.d.cts +1 -1
- package/dist/components/depth.d.ts +1 -1
- package/dist/components/depth.js +4 -4
- package/dist/components/depth.js.map +1 -1
- package/dist/components/effects.cjs +13 -13
- package/dist/components/effects.cjs.map +1 -1
- package/dist/components/effects.d.cts +2 -2
- package/dist/components/effects.d.ts +2 -2
- package/dist/components/effects.js +13 -13
- package/dist/components/effects.js.map +1 -1
- package/dist/components/feedback.cjs +2 -2
- package/dist/components/feedback.cjs.map +1 -1
- package/dist/components/feedback.css +1 -1
- package/dist/components/feedback.d.cts +1 -1
- package/dist/components/feedback.d.ts +1 -1
- package/dist/components/feedback.js +2 -2
- package/dist/components/feedback.js.map +1 -1
- package/dist/components/fx.cjs +10 -10
- package/dist/components/fx.cjs.map +1 -1
- package/dist/components/fx.css +1 -1
- package/dist/components/fx.d.cts +2 -2
- package/dist/components/fx.d.ts +2 -2
- package/dist/components/fx.js +10 -10
- package/dist/components/fx.js.map +1 -1
- package/dist/components/gesture.cjs +4 -4
- package/dist/components/gesture.cjs.map +1 -1
- package/dist/components/gesture.css +1 -1
- package/dist/components/gesture.d.cts +1 -1
- package/dist/components/gesture.d.ts +1 -1
- package/dist/components/gesture.js +5 -5
- package/dist/components/gesture.js.map +1 -1
- package/dist/components/interaction.cjs +2 -2
- package/dist/components/interaction.cjs.map +1 -1
- package/dist/components/interaction.css +1 -1
- package/dist/components/interaction.d.cts +1 -1
- package/dist/components/interaction.d.ts +1 -1
- package/dist/components/interaction.js +2 -2
- package/dist/components/interaction.js.map +1 -1
- package/dist/components/jsx.d.cts +2 -2
- package/dist/components/jsx.d.ts +2 -2
- package/dist/components/layout.cjs +2 -2
- package/dist/components/layout.cjs.map +1 -1
- package/dist/components/layout.css +1 -1
- package/dist/components/layout.d.cts +1 -1
- package/dist/components/layout.d.ts +1 -1
- package/dist/components/layout.js +2 -2
- package/dist/components/layout.js.map +1 -1
- package/dist/components/lazy.cjs +2 -2
- package/dist/components/lazy.cjs.map +1 -1
- package/dist/components/lazy.d.cts +2 -2
- package/dist/components/lazy.d.ts +2 -2
- package/dist/components/lazy.js +2 -2
- package/dist/components/lazy.js.map +1 -1
- package/dist/components/lite.cjs +45 -41
- package/dist/components/lite.cjs.map +1 -1
- package/dist/components/lite.js +45 -41
- package/dist/components/lite.js.map +1 -1
- package/dist/components/packs.cjs +2 -2
- package/dist/components/packs.cjs.map +1 -1
- package/dist/components/packs.css +1 -1
- package/dist/components/packs.d.cts +1 -1
- package/dist/components/packs.d.ts +1 -1
- package/dist/components/packs.js +2 -2
- package/dist/components/packs.js.map +1 -1
- package/dist/components/page.cjs +3 -3
- package/dist/components/page.cjs.map +1 -1
- package/dist/components/page.css +1 -1
- package/dist/components/page.d.cts +1 -1
- package/dist/components/page.d.ts +1 -1
- package/dist/components/page.js +4 -4
- package/dist/components/page.js.map +1 -1
- package/dist/components/perf.cjs +3 -3
- package/dist/components/perf.cjs.map +1 -1
- package/dist/components/perf.d.cts +2 -2
- package/dist/components/perf.d.ts +2 -2
- package/dist/components/perf.js +4 -4
- package/dist/components/perf.js.map +1 -1
- package/dist/components/physics.cjs +3 -3
- package/dist/components/physics.cjs.map +1 -1
- package/dist/components/physics.css +1 -1
- package/dist/components/physics.d.cts +1 -1
- package/dist/components/physics.d.ts +1 -1
- package/dist/components/physics.js +4 -4
- package/dist/components/physics.js.map +1 -1
- package/dist/components/react.cjs +4 -4
- package/dist/components/react.cjs.map +1 -1
- package/dist/components/react.js +4 -4
- package/dist/components/react.js.map +1 -1
- package/dist/components/reveal.cjs +6 -2
- package/dist/components/reveal.cjs.map +1 -1
- package/dist/components/reveal.css +1 -1
- package/dist/components/reveal.d.cts +1 -1
- package/dist/components/reveal.d.ts +1 -1
- package/dist/components/reveal.js +6 -2
- package/dist/components/reveal.js.map +1 -1
- package/dist/components/solid.cjs +9 -9
- package/dist/components/solid.cjs.map +1 -1
- package/dist/components/solid.d.cts +22 -22
- package/dist/components/solid.d.ts +22 -22
- package/dist/components/solid.js +9 -9
- package/dist/components/solid.js.map +1 -1
- package/dist/components/svelte.cjs +8 -8
- package/dist/components/svelte.cjs.map +1 -1
- package/dist/components/svelte.d.cts +22 -22
- package/dist/components/svelte.d.ts +22 -22
- package/dist/components/svelte.js +8 -8
- package/dist/components/svelte.js.map +1 -1
- package/dist/components/svg.cjs +2 -2
- package/dist/components/svg.cjs.map +1 -1
- package/dist/components/svg.css +1 -1
- package/dist/components/svg.d.cts +1 -1
- package/dist/components/svg.d.ts +1 -1
- package/dist/components/svg.js +2 -2
- package/dist/components/svg.js.map +1 -1
- package/dist/components/text.cjs +3 -3
- package/dist/components/text.cjs.map +1 -1
- package/dist/components/text.css +1 -1
- package/dist/components/text.d.cts +1 -1
- package/dist/components/text.d.ts +1 -1
- package/dist/components/text.js +3 -3
- package/dist/components/text.js.map +1 -1
- package/dist/components/timeline.cjs +3 -3
- package/dist/components/timeline.cjs.map +1 -1
- package/dist/components/timeline.css +1 -1
- package/dist/components/timeline.d.cts +1 -1
- package/dist/components/timeline.d.ts +1 -1
- package/dist/components/timeline.js +4 -4
- package/dist/components/timeline.js.map +1 -1
- package/dist/components/tokens.cjs +2 -2
- package/dist/components/tokens.cjs.map +1 -1
- package/dist/components/tokens.d.cts +2 -2
- package/dist/components/tokens.d.ts +2 -2
- package/dist/components/tokens.js +2 -2
- package/dist/components/tokens.js.map +1 -1
- package/dist/components/transitions.cjs +2 -2
- package/dist/components/transitions.cjs.map +1 -1
- package/dist/components/transitions.css +1 -1
- package/dist/components/transitions.d.cts +1 -1
- package/dist/components/transitions.d.ts +1 -1
- package/dist/components/transitions.js +2 -2
- package/dist/components/transitions.js.map +1 -1
- package/dist/components/ui.cjs +4 -4
- package/dist/components/ui.cjs.map +1 -1
- package/dist/components/ui.css +1 -1
- package/dist/components/ui.d.cts +1 -1
- package/dist/components/ui.d.ts +1 -1
- package/dist/components/ui.js +5 -5
- package/dist/components/ui.js.map +1 -1
- package/dist/components/vue.cjs +9 -9
- package/dist/components/vue.cjs.map +1 -1
- package/dist/components/vue.d.cts +23 -23
- package/dist/components/vue.d.ts +23 -23
- package/dist/components/vue.js +9 -9
- package/dist/components/vue.js.map +1 -1
- package/dist/components/webgl.cjs +2 -2
- package/dist/components/webgl.cjs.map +1 -1
- package/dist/components/webgl.css +1 -1
- package/dist/components/webgl.d.cts +1 -1
- package/dist/components/webgl.d.ts +1 -1
- package/dist/components/webgl.js +2 -2
- package/dist/components/webgl.js.map +1 -1
- package/dist/components.cjs +9 -9
- package/dist/components.cjs.map +1 -1
- package/dist/components.css +1 -1
- package/dist/components.d.cts +30 -30
- package/dist/components.d.ts +30 -30
- package/dist/components.js +11 -11
- package/dist/components.js.map +1 -1
- package/dist/components.umd.js +5 -5
- package/dist/components.umd.js.map +1 -1
- package/dist/element.cjs +4 -3
- package/dist/element.cjs.map +1 -1
- package/dist/element.d.cts +19 -5
- package/dist/element.d.ts +19 -5
- package/dist/element.js +4 -3
- package/dist/element.js.map +1 -1
- package/dist/element.umd.js +1 -1
- package/dist/element.umd.js.map +1 -1
- package/dist/index.cjs +28 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +40 -15
- package/dist/index.d.ts +40 -15
- package/dist/index.js +11 -10
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +5 -5
- package/dist/index.umd.js.map +1 -1
- 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 +4 -3
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +19 -5
- package/dist/react.d.ts +19 -5
- package/dist/react.js +4 -3
- package/dist/react.js.map +1 -1
- package/dist/solid.cjs +5 -4
- package/dist/solid.cjs.map +1 -1
- package/dist/solid.d.cts +20 -6
- package/dist/solid.d.ts +20 -6
- package/dist/solid.js +5 -4
- package/dist/solid.js.map +1 -1
- package/dist/svelte.cjs +5 -4
- package/dist/svelte.cjs.map +1 -1
- package/dist/svelte.d.cts +20 -6
- package/dist/svelte.d.ts +20 -6
- package/dist/svelte.js +5 -4
- package/dist/svelte.js.map +1 -1
- package/dist/vue.cjs +4 -3
- package/dist/vue.cjs.map +1 -1
- package/dist/vue.d.cts +19 -5
- package/dist/vue.d.ts +19 -5
- package/dist/vue.js +4 -3
- package/dist/vue.js.map +1 -1
- package/docs/API.md +17 -12
- package/docs/ROADMAP.md +12 -11
- package/docs/accessibility.md +2 -2
- package/docs/components.md +33 -33
- package/docs/frameworks-ssr.md +12 -12
- package/docs/hybrid-apps.md +10 -10
- package/docs/migration-from-aos.md +5 -5
- package/docs/migration-from-gsap-scrolltrigger.md +3 -3
- package/docs/motion-tokens.css +1 -1
- package/docs/motion-tokens.md +2 -2
- package/docs/performance.md +6 -6
- package/docs/presets.md +310 -0
- package/docs/windows-apps.md +8 -8
- package/package.json +40 -26
- package/dist/chunks/base-B5i8qQPR.cjs.map +0 -1
- package/dist/chunks/base-C3Sw9sAO.js.map +0 -1
- package/dist/chunks/core-mV_TPgG_.js.map +0 -1
- package/dist/chunks/core-qpECfEkb.cjs.map +0 -1
- package/dist/chunks/stagger-BFAhKknX.js.map +0 -1
- package/dist/chunks/stagger-CLc3j58T.cjs.map +0 -1
package/dist/components/lite.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* motionary/components — shared base for the `<usa-*>` custom elements.
|
|
3
3
|
*
|
|
4
4
|
* Everything here is lazy: nothing touches `window`, `document`,
|
|
5
5
|
* `HTMLElement` or `matchMedia` at import time, so the components can be
|
|
@@ -388,7 +388,7 @@ function deprecate(key, message) {
|
|
|
388
388
|
return;
|
|
389
389
|
warned.add(key);
|
|
390
390
|
if (typeof console !== 'undefined')
|
|
391
|
-
console.warn(`[
|
|
391
|
+
console.warn(`[motionary] ${message}`);
|
|
392
392
|
}
|
|
393
393
|
/**
|
|
394
394
|
* The `kind` attribute of `<usa-spinner>`, `<usa-check>`, `<usa-dialog>` and
|
|
@@ -425,7 +425,7 @@ const COMPONENT_CATEGORIES = {
|
|
|
425
425
|
};
|
|
426
426
|
|
|
427
427
|
/**
|
|
428
|
-
*
|
|
428
|
+
* motionary/components/perf — performance toolkit (4.5).
|
|
429
429
|
*
|
|
430
430
|
* - One shared rAF scheduler for every component loop (`onFrame()`, `schedulerStats()`).
|
|
431
431
|
* - Animation budget: `setAnimationBudget(n)` caps concurrent component
|
|
@@ -434,7 +434,7 @@ const COMPONENT_CATEGORIES = {
|
|
|
434
434
|
* down (`low`, then a tighter budget) while the device struggles, restoring
|
|
435
435
|
* it when frames recover.
|
|
436
436
|
* - On-demand CSS: `loadCategoryStyles()` / `onDemandStyles()` — used by
|
|
437
|
-
* `
|
|
437
|
+
* `motionary/components/lite`, the build without inlined CSS.
|
|
438
438
|
*/
|
|
439
439
|
/**
|
|
440
440
|
* Watch frame rate and animation count; while the device struggles, set
|
|
@@ -576,6 +576,10 @@ function revealFrom(effect, distance = 32) {
|
|
|
576
576
|
}
|
|
577
577
|
/** Keyframes from the effect to the natural state. */
|
|
578
578
|
function revealKeyframes(effect, distance) {
|
|
579
|
+
// Any preset registered with the scroll library (core, `presets/extended`, your own)
|
|
580
|
+
const p = REVEAL_EFFECTS.includes(effect) ? null : globalThis[Symbol.for('use-scroll-animate.presets')]?.[effect];
|
|
581
|
+
if (p)
|
|
582
|
+
return [p.from, ...(p.frames || []), p.to];
|
|
579
583
|
const from = revealFrom(effect, distance);
|
|
580
584
|
const to = {};
|
|
581
585
|
for (const k of Object.keys(from)) {
|
|
@@ -862,7 +866,7 @@ function defineScrolly(tag = 'usa-scrolly') {
|
|
|
862
866
|
}
|
|
863
867
|
|
|
864
868
|
/**
|
|
865
|
-
*
|
|
869
|
+
* motionary/components/reveal — entrance & scroll reveal components.
|
|
866
870
|
* `<usa-reveal>`, `<usa-stagger>`, `<usa-scroll-progress>`, `<usa-scrolly>`.
|
|
867
871
|
*/
|
|
868
872
|
/** Register every component of this category under its default tag. */
|
|
@@ -993,7 +997,7 @@ function defineTypewriter(tag = 'usa-typewriter') {
|
|
|
993
997
|
var css$12 = "";
|
|
994
998
|
|
|
995
999
|
/**
|
|
996
|
-
*
|
|
1000
|
+
* motionary/components/tokens — motion design tokens (4.2).
|
|
997
1001
|
*
|
|
998
1002
|
* One source of truth for durations, easings and springs: as CSS custom
|
|
999
1003
|
* properties (`--usa-duration-fast`, `--usa-easing-emphasized`,
|
|
@@ -1001,7 +1005,7 @@ var css$12 = "";
|
|
|
1001
1005
|
* from Figma Tokens (Tokens Studio) or Style Dictionary exports.
|
|
1002
1006
|
*
|
|
1003
1007
|
* ```ts
|
|
1004
|
-
* import { applyMotionTokens, importMotionTokens, motionToken } from '
|
|
1008
|
+
* import { applyMotionTokens, importMotionTokens, motionToken } from 'motionary/components/tokens';
|
|
1005
1009
|
* applyMotionTokens(importMotionTokens(await (await fetch('/tokens.json')).json()));
|
|
1006
1010
|
* el.animate(frames, { duration: motionToken('duration', 'slow'), easing: motionToken('easing', 'emphasized') });
|
|
1007
1011
|
* ```
|
|
@@ -2259,7 +2263,7 @@ function defineScrollHighlight(tag = 'usa-scroll-highlight') {
|
|
|
2259
2263
|
}
|
|
2260
2264
|
|
|
2261
2265
|
/**
|
|
2262
|
-
*
|
|
2266
|
+
* motionary/components/text — text effects.
|
|
2263
2267
|
* `<usa-typewriter>`, `<usa-split-text>`, `<usa-scramble>`, `<usa-counter>`,
|
|
2264
2268
|
* `<usa-shimmer-text>`, `<usa-text-rotate>`.
|
|
2265
2269
|
*/
|
|
@@ -2676,7 +2680,7 @@ function defineToggle(tag = 'usa-toggle') {
|
|
|
2676
2680
|
}
|
|
2677
2681
|
|
|
2678
2682
|
/**
|
|
2679
|
-
*
|
|
2683
|
+
* motionary/components/interaction — micro-interactions.
|
|
2680
2684
|
* `<usa-ripple>`, `<usa-magnetic>`, `<usa-tilt>`, `<usa-spotlight>`,
|
|
2681
2685
|
* `<usa-press>`, `<usa-toggle>`.
|
|
2682
2686
|
*/
|
|
@@ -3106,7 +3110,7 @@ function defineCheck(tag = 'usa-check') {
|
|
|
3106
3110
|
}
|
|
3107
3111
|
|
|
3108
3112
|
/**
|
|
3109
|
-
*
|
|
3113
|
+
* motionary/components/feedback — loading & feedback.
|
|
3110
3114
|
* `<usa-spinner>`, `<usa-skeleton>`, `<usa-progress>`, `<usa-toaster>` +
|
|
3111
3115
|
* `toast()`, `<usa-check>`.
|
|
3112
3116
|
*/
|
|
@@ -3775,7 +3779,7 @@ function fluentPreset(options = {}) {
|
|
|
3775
3779
|
}
|
|
3776
3780
|
|
|
3777
3781
|
/**
|
|
3778
|
-
*
|
|
3782
|
+
* motionary/components/background — backgrounds & decoration.
|
|
3779
3783
|
* `<usa-aurora>`, `<usa-particles>`, `<usa-grain>`, `<usa-marquee>`,
|
|
3780
3784
|
* `<usa-acrylic>`.
|
|
3781
3785
|
*/
|
|
@@ -4199,7 +4203,7 @@ async function flip(targets, mutate, options = {}) {
|
|
|
4199
4203
|
}
|
|
4200
4204
|
|
|
4201
4205
|
/**
|
|
4202
|
-
*
|
|
4206
|
+
* motionary/components/transitions — view & layout transitions.
|
|
4203
4207
|
* `<usa-dialog>`, `<usa-accordion>`, `<usa-view-switch>`
|
|
4204
4208
|
* and the `viewTransition()` and `flip()` helpers (4.0: `<usa-flip-list>` → `<usa-auto-animate>`,
|
|
4205
4209
|
* `connectedAnimation()` → `sharedTransition()`, both in `components/layout`).
|
|
@@ -4837,7 +4841,7 @@ function defineOverscroll(tag = 'usa-overscroll') {
|
|
|
4837
4841
|
}
|
|
4838
4842
|
|
|
4839
4843
|
/**
|
|
4840
|
-
*
|
|
4844
|
+
* motionary/components/physics — spring & bounce physics (v2.3).
|
|
4841
4845
|
* `<usa-spring>` (bounce-in, pop, drop, jelly, rubber-band), `<usa-draggable>`
|
|
4842
4846
|
* (spring-back, inertia, snap) and `<usa-overscroll>` (elastic edges), plus
|
|
4843
4847
|
* the spring core: `spring()`, `springEasing()`, `createSpring()`,
|
|
@@ -5385,7 +5389,7 @@ function defineCarousel3d(tag = 'usa-carousel-3d') {
|
|
|
5385
5389
|
}
|
|
5386
5390
|
|
|
5387
5391
|
/**
|
|
5388
|
-
*
|
|
5392
|
+
* motionary/components/cards — card effects (v2.4).
|
|
5389
5393
|
* `<usa-card effect="flip | holo | glass | border-glow | conic-border | lift |
|
|
5390
5394
|
* spotlight | sheen | parallax-layers | expand">` (combinable),
|
|
5391
5395
|
* `<usa-card-stack>` (swipeable deck), `<usa-sticky-stack>` (stacking on
|
|
@@ -6342,7 +6346,7 @@ function defineCheckbox(tag = 'usa-checkbox') {
|
|
|
6342
6346
|
}
|
|
6343
6347
|
|
|
6344
6348
|
/**
|
|
6345
|
-
*
|
|
6349
|
+
* motionary/components/click — click & tap effects (v2.5).
|
|
6346
6350
|
* `<usa-click>` (ripple, burst, confetti, squish, press-spring, shake),
|
|
6347
6351
|
* `<usa-button>` (button click deformation: squash, wobble, gooey, dent;
|
|
6348
6352
|
* shape morph; submit → loading → success), `<usa-icon-morph>`,
|
|
@@ -7365,7 +7369,7 @@ function defineAvatarStack(tag = 'usa-avatar-stack') {
|
|
|
7365
7369
|
}
|
|
7366
7370
|
|
|
7367
7371
|
/**
|
|
7368
|
-
*
|
|
7372
|
+
* motionary/components/ui — animated UI components + style variants (v2.6).
|
|
7369
7373
|
* `<usa-tabs>`, `<usa-drawer>`, `<usa-bottom-sheet>`, `<usa-pull-refresh>`,
|
|
7370
7374
|
* `<usa-fab>`, `<usa-navbar>`, `<usa-slider>`, `<usa-rating>`,
|
|
7371
7375
|
* `<usa-tooltip>`, `<usa-popover>`, `<usa-badge>`, `<usa-avatar-stack>`,
|
|
@@ -8162,7 +8166,7 @@ function themeTransition(apply, options = {}) {
|
|
|
8162
8166
|
}
|
|
8163
8167
|
|
|
8164
8168
|
/**
|
|
8165
|
-
*
|
|
8169
|
+
* motionary/components/page — page & app-wide effects (v2.7).
|
|
8166
8170
|
* Page transitions (`pageTransition()`, `enableMpaTransitions()`,
|
|
8167
8171
|
* `themeTransition()`), `<usa-cursor>`, `smoothScroll()` / `scrollToTarget()`,
|
|
8168
8172
|
* `<usa-fullpage>`, `<usa-loading-bar>` + `loadingBar`, `<usa-back-to-top>`,
|
|
@@ -8267,7 +8271,7 @@ function defineTimeline(tag = 'usa-timeline') {
|
|
|
8267
8271
|
}
|
|
8268
8272
|
|
|
8269
8273
|
/**
|
|
8270
|
-
*
|
|
8274
|
+
* motionary/components/timeline — choreography (v3.1).
|
|
8271
8275
|
* `timeline()` chains, overlaps, labels, seeks, reverses and scroll-scrubs
|
|
8272
8276
|
* WAAPI animations on one playhead; `<usa-timeline>` builds one from
|
|
8273
8277
|
* `data-tl` children.
|
|
@@ -8639,7 +8643,7 @@ function definePinchZoom(tag = 'usa-pinch-zoom') {
|
|
|
8639
8643
|
}
|
|
8640
8644
|
|
|
8641
8645
|
/**
|
|
8642
|
-
*
|
|
8646
|
+
* motionary/components/gesture — unified gestures (v3.2).
|
|
8643
8647
|
* `gesture()` recognises pan, swipe, pinch, long-press, tap and double-tap
|
|
8644
8648
|
* with release velocities for springs; `<usa-swipeable>` (swipe-to-dismiss)
|
|
8645
8649
|
* and `<usa-pinch-zoom>` are built on it.
|
|
@@ -8980,7 +8984,7 @@ function defineAnimIcon(tag = 'usa-anim-icon') {
|
|
|
8980
8984
|
}
|
|
8981
8985
|
|
|
8982
8986
|
/**
|
|
8983
|
-
*
|
|
8987
|
+
* motionary/components/svg — SVG animation (v3.3).
|
|
8984
8988
|
* `<usa-draw>` (line drawing), `<usa-morph>` (path morph), `<usa-mask-reveal>`
|
|
8985
8989
|
* (mask / clip-path reveals) and `<usa-anim-icon>` (animated icons), plus
|
|
8986
8990
|
* `interpolatePath()`, `morphTo()`, `drawLines()`.
|
|
@@ -9418,7 +9422,7 @@ function definePostFx(tag = 'usa-post-fx') {
|
|
|
9418
9422
|
}
|
|
9419
9423
|
|
|
9420
9424
|
/**
|
|
9421
|
-
*
|
|
9425
|
+
* motionary/components/webgl — lightweight canvas / WebGL (v3.4).
|
|
9422
9426
|
* `<usa-shader>` (shader backgrounds), `<usa-distort>` (hover image
|
|
9423
9427
|
* distortion), `<usa-liquid>` (ripple images) on a tiny single-quad runner
|
|
9424
9428
|
* (`glQuad()`), with graceful fallbacks when WebGL is unavailable.
|
|
@@ -9656,7 +9660,7 @@ function defineDepth(tag = 'usa-depth') {
|
|
|
9656
9660
|
}
|
|
9657
9661
|
|
|
9658
9662
|
/**
|
|
9659
|
-
*
|
|
9663
|
+
* motionary/components/depth — 3D (v3.5).
|
|
9660
9664
|
* `<usa-cube>` (CSS 3D cube), `<usa-depth>` (layered depth parallax driven by
|
|
9661
9665
|
* pointer, device orientation or scroll) and `deviceTilt()`. The 3D ring
|
|
9662
9666
|
* carousel is `<usa-carousel-3d>` in `components/cards`.
|
|
@@ -9901,7 +9905,7 @@ function defineMasonry(tag = 'usa-masonry') {
|
|
|
9901
9905
|
}
|
|
9902
9906
|
|
|
9903
9907
|
/**
|
|
9904
|
-
*
|
|
9908
|
+
* motionary/components/layout — layout animation (v3.6).
|
|
9905
9909
|
* `autoAnimate()` / `<usa-auto-animate>` (list & grid reflow),
|
|
9906
9910
|
* `<usa-masonry>`, and `sharedTransition()` for shared-element transitions
|
|
9907
9911
|
* (View Transitions API with a FLIP fallback).
|
|
@@ -10081,7 +10085,7 @@ function definePack(tag = 'usa-pack') {
|
|
|
10081
10085
|
}
|
|
10082
10086
|
|
|
10083
10087
|
/**
|
|
10084
|
-
*
|
|
10088
|
+
* motionary/components/packs — effect packs (v3.9).
|
|
10085
10089
|
* Ready-made motion for e-commerce, portfolio, dashboard, game UI and
|
|
10086
10090
|
* landing pages: mark elements with `data-role` and apply a pack with
|
|
10087
10091
|
* `<usa-pack name="…">` or `applyPack(name, root)`. Includes `flyToCart()`
|
|
@@ -10106,11 +10110,11 @@ const registry = new Map();
|
|
|
10106
10110
|
/** Register an effect (throws on a duplicate name unless `override`). Returns an unregister function. */
|
|
10107
10111
|
function registerEffect(def, opts = {}) {
|
|
10108
10112
|
if (!/^[a-z][a-z0-9-]*$/.test(def.name))
|
|
10109
|
-
throw new Error(`[
|
|
10113
|
+
throw new Error(`[motionary] invalid effect name "${def.name}"`);
|
|
10110
10114
|
if (!EFFECT_KINDS.includes(def.kind))
|
|
10111
|
-
throw new Error(`[
|
|
10115
|
+
throw new Error(`[motionary] unknown effect kind "${def.kind}"`);
|
|
10112
10116
|
if (registry.has(def.name) && !opts.override)
|
|
10113
|
-
throw new Error(`[
|
|
10117
|
+
throw new Error(`[motionary] effect "${def.name}" is already registered`);
|
|
10114
10118
|
registry.set(def.name, def);
|
|
10115
10119
|
return () => {
|
|
10116
10120
|
if (registry.get(def.name) === def)
|
|
@@ -10150,7 +10154,7 @@ function context(event) {
|
|
|
10150
10154
|
async function playEffect(el, name, options = {}, event) {
|
|
10151
10155
|
const def = registry.get(name);
|
|
10152
10156
|
if (!def)
|
|
10153
|
-
throw new Error(`[
|
|
10157
|
+
throw new Error(`[motionary] unknown effect "${name}" — registered: ${Array.from(registry.keys()).join(', ')}`);
|
|
10154
10158
|
const ctx = context(event);
|
|
10155
10159
|
if (ctx.reduced && (def.reduced ?? (SKIP_BY_DEFAULT.includes(def.kind) ? 'skip' : 'run')) === 'skip')
|
|
10156
10160
|
return;
|
|
@@ -10169,7 +10173,7 @@ function bindEffect(el, name, options = {}) {
|
|
|
10169
10173
|
const { trigger = 'click', once, ...opts } = options;
|
|
10170
10174
|
const def = registry.get(name);
|
|
10171
10175
|
if (!def)
|
|
10172
|
-
throw new Error(`[
|
|
10176
|
+
throw new Error(`[motionary] unknown effect "${name}"`);
|
|
10173
10177
|
const offs = [];
|
|
10174
10178
|
let current = null;
|
|
10175
10179
|
const fire = (e) => {
|
|
@@ -10343,12 +10347,12 @@ const click = [
|
|
|
10343
10347
|
const BUILTIN_EFFECTS = [...enter, ...attention, ...click];
|
|
10344
10348
|
|
|
10345
10349
|
/**
|
|
10346
|
-
*
|
|
10350
|
+
* motionary/components/fx — unified plugin-style effects (5.0).
|
|
10347
10351
|
* `registerEffect({ name, kind, run })`, `playEffect(el, name)`,
|
|
10348
10352
|
* `bindEffect(el, name, { trigger })`, `<usa-fx effect trigger>`. Built-ins:
|
|
10349
10353
|
* every timeline preset (`enter`), `pulse` · `pop` · `jelly` · `wiggle` ·
|
|
10350
10354
|
* `heartbeat` · `bounce` · `flash` · `tada` · `shake` (attention),
|
|
10351
|
-
* `burst` · `confetti` · `ripple` (click). More packs: `
|
|
10355
|
+
* `burst` · `confetti` · `ripple` (click). More packs: `motionary/components/effects`.
|
|
10352
10356
|
*/
|
|
10353
10357
|
/** Register the built-in effects (idempotent; `defineFxComponents()` calls it). */
|
|
10354
10358
|
function registerBuiltinEffects() {
|
|
@@ -10390,12 +10394,12 @@ function baselineReport() {
|
|
|
10390
10394
|
function warnBaseline() {
|
|
10391
10395
|
const missing = baselineReport().filter((f) => f.required && !f.supported).map((f) => f.id);
|
|
10392
10396
|
if (missing.length)
|
|
10393
|
-
deprecate('baseline', `this browser lacks ${missing.join(', ')};
|
|
10397
|
+
deprecate('baseline', `this browser lacks ${missing.join(', ')}; motionary 5.0 requires them (modern-browser baseline, see docs/upgrading-5.md).`);
|
|
10394
10398
|
return missing;
|
|
10395
10399
|
}
|
|
10396
10400
|
|
|
10397
10401
|
/**
|
|
10398
|
-
*
|
|
10402
|
+
* motionary/components/a11y — accessibility toolkit (4.4).
|
|
10399
10403
|
*
|
|
10400
10404
|
* - Motion-sensitivity levels: `setMotionSensitivity('full' | 'gentle' | 'minimal' | 'static')`.
|
|
10401
10405
|
* - Static alternatives: what every component shows when motion is off, and
|
|
@@ -10406,7 +10410,7 @@ function warnBaseline() {
|
|
|
10406
10410
|
* over every `<usa-*>` element — usable in your own tests too.
|
|
10407
10411
|
*
|
|
10408
10412
|
* ```ts
|
|
10409
|
-
* import { setMotionSensitivity, announce, auditMotionA11y } from '
|
|
10413
|
+
* import { setMotionSensitivity, announce, auditMotionA11y } from 'motionary/components/a11y';
|
|
10410
10414
|
* setMotionSensitivity('gentle', true); // no spins / zooms / parallax, remembered
|
|
10411
10415
|
* announce('3 items added to cart'); // polite live region
|
|
10412
10416
|
* expect(auditMotionA11y(document.body).errors).toEqual([]);
|
|
@@ -10614,7 +10618,7 @@ function auditMotionA11y(root) {
|
|
|
10614
10618
|
const ALL_TAGS = Object.values(COMPONENT_CATEGORIES).flat();
|
|
10615
10619
|
|
|
10616
10620
|
/**
|
|
10617
|
-
*
|
|
10621
|
+
* motionary/components/bridge — native shell bridges (4.7).
|
|
10618
10622
|
*
|
|
10619
10623
|
* Keeps the web UI in sync with the host app's system settings when it runs
|
|
10620
10624
|
* inside **WinUI 3 / WPF (WebView2)**, **.NET MAUI** (WebView / HybridWebView)
|
|
@@ -10757,7 +10761,7 @@ function connectNativeShell(options = {}) {
|
|
|
10757
10761
|
}
|
|
10758
10762
|
|
|
10759
10763
|
/**
|
|
10760
|
-
*
|
|
10764
|
+
* motionary/components
|
|
10761
10765
|
*
|
|
10762
10766
|
* Framework-agnostic, dependency-free animated UI components built on
|
|
10763
10767
|
* Custom Elements + CSS + the Web Animations API. They run in any browser
|
|
@@ -10765,10 +10769,10 @@ function connectNativeShell(options = {}) {
|
|
|
10765
10769
|
* (WebView2), WinUI 3 / WPF / WinForms with WebView2, and installed PWAs.
|
|
10766
10770
|
*
|
|
10767
10771
|
* ```js
|
|
10768
|
-
* import { defineComponents } from '
|
|
10772
|
+
* import { defineComponents } from 'motionary/components';
|
|
10769
10773
|
* defineComponents(); // registers every <usa-*> element
|
|
10770
10774
|
* // or only what you use (tree-shakable):
|
|
10771
|
-
* import { defineTypewriter } from '
|
|
10775
|
+
* import { defineTypewriter } from 'motionary/components/text';
|
|
10772
10776
|
* ```
|
|
10773
10777
|
*
|
|
10774
10778
|
* Importing has no side effects and is SSR-safe; nothing is registered
|
|
@@ -10808,13 +10812,13 @@ function defineComponents(categories) {
|
|
|
10808
10812
|
}
|
|
10809
10813
|
|
|
10810
10814
|
/**
|
|
10811
|
-
*
|
|
10815
|
+
* motionary/components/lite — every component and helper **without
|
|
10812
10816
|
* inlined CSS** (4.5): each category's stylesheet (`dist/components/<cat>.css`)
|
|
10813
10817
|
* is loaded on demand the first time one of its elements connects.
|
|
10814
|
-
* Same API as `
|
|
10818
|
+
* Same API as `motionary/components`; ~15 KB gzip smaller.
|
|
10815
10819
|
*
|
|
10816
10820
|
* ```ts
|
|
10817
|
-
* import { defineComponents } from '
|
|
10821
|
+
* import { defineComponents } from 'motionary/components/lite';
|
|
10818
10822
|
* defineComponents(); // CSS for <usa-card> loads when the first card mounts
|
|
10819
10823
|
* ```
|
|
10820
10824
|
* Override where the CSS comes from with `onDemandStyles(base)`.
|