use-scroll-animate 6.1.0 → 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 +30 -0
- package/README.md +157 -411
- package/README_ja.md +170 -175
- package/README_zh.md +169 -198
- 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-C_3cAoRz.js} +4 -4
- package/dist/chunks/base-C_3cAoRz.js.map +1 -0
- package/dist/chunks/{core-BYLtO0Po.cjs → core-B5T0dhFH.cjs} +3 -3
- 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-BVQW34aX.js → core-D7cVumUu.js} +3 -3
- package/dist/chunks/core-D7cVumUu.js.map +1 -0
- package/dist/chunks/{core-DN3hHbHh.js → core-VEBw36QK.js} +2 -2
- package/dist/chunks/{core-DN3hHbHh.js.map → core-VEBw36QK.js.map} +1 -1
- package/dist/chunks/{core-BTf__I-8.js → core-ps8uvYuN.js} +2 -2
- package/dist/chunks/{core-BTf__I-8.js.map → core-ps8uvYuN.js.map} +1 -1
- 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-Bs6IrV4Q.js} +2 -2
- package/dist/chunks/{fx-ChjxrMBo.js.map → fx-Bs6IrV4Q.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/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/{presets-BJ09NeTo.js → presets-BYBVJVeP.js} +3 -3
- package/dist/chunks/presets-BYBVJVeP.js.map +1 -0
- package/dist/chunks/{presets-D2ksQNzJ.cjs → presets-CUHys3sK.cjs} +3 -3
- 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-CckMe3x0.js → spring-CbvHfVtP.js} +2 -2
- package/dist/chunks/{spring-CckMe3x0.js.map → spring-CbvHfVtP.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-CvhYlKrF.cjs → stagger-CCFyhzSw.cjs} +3 -3
- package/dist/chunks/stagger-CCFyhzSw.cjs.map +1 -0
- package/dist/chunks/{stagger-Dh4V-OL0.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-DRlKVHvu.js} +2 -2
- package/dist/chunks/{variants-Bsevy6Xm.js.map → variants-DRlKVHvu.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 +9 -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 +9 -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 +84 -416
- 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 +18 -349
- 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-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 +18 -138
- 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 +8 -127
- package/dist/components/fx.js.map +1 -1
- 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 +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 +46 -50
- package/dist/components/lite.cjs.map +1 -1
- package/dist/components/lite.js +46 -50
- 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 +2 -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 +2 -2
- package/dist/components/reveal.js.map +1 -1
- package/dist/components/solid.cjs +10 -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 +10 -9
- package/dist/components/solid.js.map +1 -1
- package/dist/components/svelte.cjs +9 -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 +9 -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 +10 -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 +10 -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/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 +19 -18
- 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 +13 -12
- 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 -4
- package/dist/element.cjs.map +1 -1
- package/dist/element.d.cts +5 -5
- package/dist/element.d.ts +5 -5
- package/dist/element.js +4 -4
- package/dist/element.js.map +1 -1
- package/dist/element.umd.js.map +1 -1
- package/dist/index.cjs +10 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -9
- package/dist/index.d.ts +9 -9
- package/dist/index.js +11 -11
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +3 -3
- package/dist/index.umd.js.map +1 -1
- package/dist/presets/extended.cjs +3 -3
- package/dist/presets/extended.cjs.map +1 -1
- package/dist/presets/extended.d.cts +3 -3
- package/dist/presets/extended.d.ts +3 -3
- package/dist/presets/extended.js +3 -3
- package/dist/presets/extended.js.map +1 -1
- package/dist/presets-extended.umd.js.map +1 -1
- package/dist/react.cjs +4 -4
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +5 -5
- package/dist/react.d.ts +5 -5
- package/dist/react.js +4 -4
- package/dist/react.js.map +1 -1
- package/dist/solid.cjs +5 -5
- package/dist/solid.cjs.map +1 -1
- package/dist/solid.d.cts +6 -6
- package/dist/solid.d.ts +6 -6
- package/dist/solid.js +5 -5
- package/dist/solid.js.map +1 -1
- package/dist/svelte.cjs +5 -5
- package/dist/svelte.cjs.map +1 -1
- package/dist/svelte.d.cts +6 -6
- package/dist/svelte.d.ts +6 -6
- package/dist/svelte.js +5 -5
- package/dist/svelte.js.map +1 -1
- package/dist/vue.cjs +4 -4
- package/dist/vue.cjs.map +1 -1
- package/dist/vue.d.cts +5 -5
- package/dist/vue.d.ts +5 -5
- package/dist/vue.js +4 -4
- package/dist/vue.js.map +1 -1
- package/dist/widgets.umd.js +2 -0
- package/dist/widgets.umd.js.map +1 -0
- package/docs/API.md +13 -13
- package/docs/ROADMAP.md +11 -12
- package/docs/accessibility.md +2 -2
- package/docs/components.md +62 -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 +5 -5
- package/docs/windows-apps.md +8 -8
- package/package.json +56 -25
- package/dist/chunks/base-B5i8qQPR.cjs.map +0 -1
- package/dist/chunks/base-C3Sw9sAO.js.map +0 -1
- package/dist/chunks/core-BVQW34aX.js.map +0 -1
- package/dist/chunks/core-BYLtO0Po.cjs.map +0 -1
- package/dist/chunks/presets-BJ09NeTo.js.map +0 -1
- package/dist/chunks/presets-D2ksQNzJ.cjs.map +0 -1
- package/dist/chunks/stagger-CvhYlKrF.cjs.map +0 -1
- package/dist/chunks/stagger-Dh4V-OL0.js.map +0 -1
package/docs/ROADMAP.md
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
# 路线图(6.0 之后)
|
|
2
2
|
|
|
3
|
-
> 6.0.0:移除 5.9 弃用的 API(`burst()` / `confetti()` / `shake()`、`<usa-cursor mode="trail">`),所有效果统一通过注册表(`registerEffect()` / `playEffect()` / `<usa-fx>`)提供。以下为 6.x → 7.0 的规划,每个版本一个 PR(6.1 插入“滚动预设 2.0
|
|
3
|
+
> 6.0.0:移除 5.9 弃用的 API(`burst()` / `confetti()` / `shake()`、`<usa-cursor mode="trail">`),所有效果统一通过注册表(`registerEffect()` / `playEffect()` / `<usa-fx>`)提供。以下为 6.x → 7.0 的规划,每个版本一个 PR(6.1 插入“滚动预设 2.0”后顺延;6.2 起每个版本同时新增 3–6 个动画 UI 组件,天气与交互物理合并为 6.8);6.x 新效果包各自独立入口(`motionary/components/fx-*`),新组件在 `motionary/components/widgets`(`components/lite` 维持 70 KB 预算),全部兼容“减少动态效果”。
|
|
4
4
|
|
|
5
|
-
- **v6.1** ✅ — 滚动预设 2.0(Scroll presets 2.0,已发布):新增 181 个滚动入场预设(总计 214 个),独立入口 `
|
|
6
|
-
- **v6.2** — 粒子与流体 2.0
|
|
7
|
-
- **v6.3** — 文字特效 3.0
|
|
8
|
-
- **v6.4** —
|
|
9
|
-
- **v6.5** — 3D
|
|
10
|
-
- **v6.6** — 形变与 SVG 2.0
|
|
11
|
-
- **v6.7** —
|
|
12
|
-
- **v6.8** —
|
|
13
|
-
- **v6.9** —
|
|
14
|
-
- **
|
|
15
|
-
- **v7.0** — 破坏性清理:移除 6.10 弃用的 API,效果包按需拆分入口,WebGPU 渲染后端(WebGL2 回退),迁移指南与自动迁移脚本,npm `latest`。
|
|
5
|
+
- **v6.1** ✅ — 滚动预设 2.0(Scroll presets 2.0,已发布):新增 181 个滚动入场预设(总计 214 个),独立入口 `motionary/presets/extended`(导入即注册,UMD `dist/presets-extended.umd.js`),核心包体积不变;预设支持中间关键帧 `frames`,新增 `registerPresets()` / `reversePreset()`;动画商店扩展到 227 个条目、14 个预设分类(含随滚动 `scrub-*` 与错峰 `stagger-*`)。
|
|
6
|
+
- ✅ **v6.2** — 粒子与流体 2.0 + 组件:GPU 流体、烟雾、火焰、墨滴扩散、萤火虫、樱花与落叶、点击水花(WebGL2,自动降级 Canvas 2D);新组件 轮播 / 滑块、动画指示器标签页、手风琴 2.0、快拍浏览器(独立入口 `motionary/components/widgets`)。
|
|
7
|
+
- **v6.3** — 文字特效 3.0 + 组件:液态文字、霓虹书写、文字粒子聚散、故障字、光标拖影、可变字体呼吸、逐字 3D 翻转;新组件 通知 / Toast 堆叠、模态对话框、抽屉 / 底部面板。
|
|
8
|
+
- **v6.4** — 光影与材质 + 组件:动态光源、玻璃折射、金属拉丝、珠光 / 镭射、体积光、指针实时阴影;新组件 进度条 / 进度环、计数器 / 里程表、骨架屏闪光、评分星。
|
|
9
|
+
- **v6.5** — 3D 场景卡片 + 组件:景深层叠卡、可旋转商品展示、立方体画廊、折纸展开、轨道相机叙事;新组件 时间轴、瀑布流(布局动画)、图片对比滑块。
|
|
10
|
+
- **v6.6** — 形变与 SVG 2.0 + 组件:路径补间、液态 blob 按钮、描边绘制、SVG 滤镜转场、图标变形;新组件 Dock 栏(macOS 放大)、形变下划线导航、汉堡 → 关闭图标、提示 / 气泡。
|
|
11
|
+
- **v6.7** — 转场大全 + 组件:涟漪溶解、碎片爆裂、马赛克翻牌、液体擦除、卷页、镜头推拉(View Transitions 优先,MPA 可用);新组件 步骤条 / 向导、分页、分段控件、开关变体。
|
|
12
|
+
- **v6.8** — 天气与氛围 + 交互物理 2.0 + 组件:玻璃雨滴、积雪、安全闪电、雾、极光、昼夜光照;软体、布料、绳索、磁吸、弹球、重力翻转(Verlet);新组件 看板 / 拖拽排序、滑动卡片、下拉刷新。
|
|
13
|
+
- **v6.9** — 7.0 预备 + 组件:动画编辑器 2.0、效果市场清单格式、7.0 弃用警告、`upgrading-7.md` 与 `usa-codemod-7`;新组件 日期选择器、取色器、文件拖放区动画。
|
|
14
|
+
- **v7.0** — 破坏性清理:移除 6.9 弃用的 API,效果包与组件按需拆分入口,WebGPU 渲染后端(WebGL2 回退),npm `latest`。
|
package/docs/accessibility.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Accessibility (`
|
|
1
|
+
# Accessibility (`motionary/components`)
|
|
2
2
|
|
|
3
3
|
Audited in v2.9 (automated sweep in `test/components-a11y-frameworks.test.ts` + per-component tests).
|
|
4
4
|
|
|
@@ -33,7 +33,7 @@ Glass, acrylic and Fluent materials fall back to solid surfaces under `prefers-r
|
|
|
33
33
|
|
|
34
34
|
## Motion-sensitivity levels (4.4)
|
|
35
35
|
|
|
36
|
-
`import { setMotionSensitivity, restoreMotionSensitivity } from '
|
|
36
|
+
`import { setMotionSensitivity, restoreMotionSensitivity } from 'motionary/components/a11y'`
|
|
37
37
|
|
|
38
38
|
| Level | What moves | Use for |
|
|
39
39
|
|---|---|---|
|
package/docs/components.md
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
# Animated components (`
|
|
1
|
+
# Animated components (`motionary/components`)
|
|
2
2
|
|
|
3
3
|
Since **v2.2** (now **v3**) the package ships **30 animated UI components** as standard Web Components (`<usa-*>` custom elements) plus three transition helpers. They are built only on Custom Elements, CSS and the Web Animations API, so the same code runs:
|
|
4
4
|
|
|
5
5
|
- in any modern browser (Chrome, Edge, Firefox, Safari), and with React, Vue, Svelte, Solid, Angular or no framework;
|
|
6
6
|
- in **Windows desktop software** that renders its UI with a web view — Electron, Tauri (WebView2), WinUI 3 / WPF / WinForms with WebView2, and installed PWAs. See **[Windows apps guide](./windows-apps.md)**.
|
|
7
7
|
|
|
8
|
-
Live gallery: <https://harrisoncn.github.io/
|
|
8
|
+
Live gallery: <https://harrisoncn.github.io/motionary/showcase/components.html>
|
|
9
9
|
|
|
10
10
|
## Principles
|
|
11
11
|
|
|
12
|
-
- **Zero dependencies, tree-shakable.** Import one category (`
|
|
12
|
+
- **Zero dependencies, tree-shakable.** Import one category (`motionary/components/text`) or one component (`import { defineTypewriter } …`) and only that ships.
|
|
13
13
|
- **SSR-safe.** Importing never touches `window`/`document`; every `define*()` is a no-op on the server.
|
|
14
14
|
- **Opt-in registration.** Nothing is registered until you call `define*()` (or load the IIFE bundle). Every `define*()` accepts a custom tag name: `defineSpinner('my-loader')`.
|
|
15
15
|
- **`prefers-reduced-motion` everywhere.** Each component has a calm variant (instant reveal, fade instead of slide, static background…). Override globally with `configureComponents({ reducedMotion: 'reduce' | 'no-preference' | 'user' })`.
|
|
16
16
|
- **GPU-friendly.** Animations use `transform` / `opacity` (plus `filter` for blur effects); layout is read and written in separate phases, at most once per frame, and loops pause when off-screen or the tab is hidden.
|
|
17
17
|
- **Accessible.** Animated text keeps a visually-hidden plain copy for screen readers; switches, progress bars, toasts and dialogs carry the right roles and ARIA states.
|
|
18
|
-
- **Styles included.** Each component injects its own small stylesheet once (as a constructable stylesheet, which a `style-src 'self'` CSP allows). Prefer a file? `import '
|
|
18
|
+
- **Styles included.** Each component injects its own small stylesheet once (as a constructable stylesheet, which a `style-src 'self'` CSP allows). Prefer a file? `import 'motionary/components.css'` (or `/components/<category>.css`) and call `configureComponents({ injectStyles: false })`.
|
|
19
19
|
|
|
20
20
|
## Install & register
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
npm i
|
|
23
|
+
npm i motionary
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
```js
|
|
27
27
|
// everything
|
|
28
|
-
import { defineComponents } from '
|
|
28
|
+
import { defineComponents } from 'motionary/components';
|
|
29
29
|
defineComponents(); // or defineComponents(['text', 'feedback'])
|
|
30
30
|
|
|
31
31
|
// one category
|
|
32
|
-
import { defineTextComponents } from '
|
|
32
|
+
import { defineTextComponents } from 'motionary/components/text';
|
|
33
33
|
defineTextComponents();
|
|
34
34
|
|
|
35
35
|
// one component
|
|
36
|
-
import { defineTypewriter } from '
|
|
36
|
+
import { defineTypewriter } from 'motionary/components/text';
|
|
37
37
|
defineTypewriter();
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
No build step (registers every `<usa-*>` and exposes the API as `window.UsaComponents`):
|
|
41
41
|
|
|
42
42
|
```html
|
|
43
|
-
<script src="https://unpkg.com/
|
|
43
|
+
<script src="https://unpkg.com/motionary@6/dist/components.umd.js"></script>
|
|
44
44
|
<usa-typewriter words="Hello, Windows.|Hello, web."></usa-typewriter>
|
|
45
45
|
<script>UsaComponents.toast('Ready', { type: 'success' });</script>
|
|
46
46
|
```
|
|
47
47
|
|
|
48
48
|
| Entry | Contents |
|
|
49
49
|
|---|---|
|
|
50
|
-
| `
|
|
51
|
-
| `
|
|
52
|
-
| `
|
|
50
|
+
| `motionary/components` | everything + `defineComponents()`, `COMPONENT_CATEGORIES`, `configureComponents()` |
|
|
51
|
+
| `motionary/components/reveal` · `/text` · `/interaction` · `/feedback` · `/background` · `/transitions` | one category + `define<Category>Components()` |
|
|
52
|
+
| `motionary/components.css`, `/components/<category>.css` | the same styles as files |
|
|
53
53
|
| `dist/components.umd.js` | IIFE/UMD bundle for `<script>` tags, auto-registers |
|
|
54
54
|
|
|
55
55
|
## Components by category
|
|
@@ -60,7 +60,7 @@ All attributes are optional unless noted. Events are `CustomEvent`s that bubble,
|
|
|
60
60
|
|
|
61
61
|
| Element | What it does | Key attributes | JS API / events |
|
|
62
62
|
|---|---|---|---|
|
|
63
|
-
| `<usa-reveal>` | Reveals content when it enters the viewport | `effect` (`fade`, `fade-up`*, `fade-down`, `fade-left`, `fade-right`, `zoom-in`, `zoom-out`, `blur`, `blur-up`, `flip-up`, `flip-left`, `rise`, or since 6.1 any registered scroll preset name such as `bounce-in-up` / `clip-diamond` once `
|
|
63
|
+
| `<usa-reveal>` | Reveals content when it enters the viewport | `effect` (`fade`, `fade-up`*, `fade-down`, `fade-left`, `fade-right`, `zoom-in`, `zoom-out`, `blur`, `blur-up`, `flip-up`, `flip-left`, `rise`, or since 6.1 any registered scroll preset name such as `bounce-in-up` / `clip-diamond` once `motionary` or `motionary/presets/extended` is loaded — see [presets.md](./presets.md)), `duration` (700), `delay`, `distance` (32), `easing`, `threshold` (0.15), `root-margin`, `repeat` | `reveal()`, `reset()`, `revealed`; `usa:enter`, `usa:leave`, `usa:complete` |
|
|
64
64
|
| `<usa-stagger>` | Reveals its children one after another | `effect`, `interval` (70 ms), `duration`, `delay`, `distance`, `threshold`, `repeat` | `reveal()`, `reset()`; `usa:enter`, `usa:complete` |
|
|
65
65
|
| `<usa-scroll-progress>` | Reading-progress bar for the page or one article | `target` (selector), `position` (`top`*, `bottom`, `inline`), `label`; CSS `--usa-progress-color/-height/-track` | `progress`, `update()`; `usa:progress` (`detail.progress`); `--usa-progress` on the element |
|
|
66
66
|
| `<usa-scrolly>` | Sticky scrollytelling: `[data-sticky]` stays pinned while `[data-step]` children scroll by | `offset` (trigger line, 0.5) | `active`, `steps`; `usa:step` (`detail.index/step/name`); `data-step-name` + `--usa-step` on the host, `data-active` on the step |
|
|
@@ -222,10 +222,10 @@ Every component reads these CSS custom properties (set them on `:root`, any ance
|
|
|
222
222
|
|
|
223
223
|
| Import | What |
|
|
224
224
|
|---|---|
|
|
225
|
-
| `
|
|
226
|
-
| `
|
|
227
|
-
| `
|
|
228
|
-
| `
|
|
225
|
+
| `motionary/components/react` | `createUsaComponents(React)` typed wrappers (props, ref, `onUsa*` events) |
|
|
226
|
+
| `motionary/components/vue` | `isUsaElement`, `UsaPlugin` |
|
|
227
|
+
| `motionary/components/jsx` | `UsaIntrinsicElements` JSX types |
|
|
228
|
+
| `motionary/components/lazy` | `lazyDefine()`, `defineUsed()`, `loadCategory()` |
|
|
229
229
|
|
|
230
230
|
See [frameworks-ssr.md](./frameworks-ssr.md) and [accessibility.md](./accessibility.md).
|
|
231
231
|
|
|
@@ -327,7 +327,7 @@ Hybrid / desktop hosts (MAUI, Flutter WebView, Electron, Tauri): [hybrid-apps.md
|
|
|
327
327
|
`<usa-fx>` (`defineFx()`, `defineFxComponents()`) plays any registered effect on its first child: `<usa-fx effect="jelly" trigger="click"><button>Go</button></usa-fx>` — `trigger` `click` · `hover` · `enter` · `load` · `loop` · `manual`, `options` (JSON), `once`, `self`.
|
|
328
328
|
|
|
329
329
|
```js
|
|
330
|
-
import { registerEffect, playEffect, bindEffect, listEffects } from '
|
|
330
|
+
import { registerEffect, playEffect, bindEffect, listEffects } from 'motionary/components/fx';
|
|
331
331
|
registerEffect({ name: 'spin-pop', kind: 'attention', run: (el, o, ctx) => ctx.animate(el, frames, { duration: 700 }) });
|
|
332
332
|
await playEffect(el, 'spin-pop');
|
|
333
333
|
const unbind = bindEffect(card, 'fade-up', { trigger: 'enter' });
|
|
@@ -337,10 +337,10 @@ Built-ins (`BUILTIN_EFFECTS`): every timeline preset as an `enter` effect (`fade
|
|
|
337
337
|
|
|
338
338
|
### v5.1 Card & click effects 2.0 (`components/effects`)
|
|
339
339
|
|
|
340
|
-
The 5.x effect packs live in `
|
|
340
|
+
The 5.x effect packs live in `motionary/components/effects` (not in `components` / `components/lite`). Register them once, then use any name with `<usa-fx>`, `playEffect()` or `bindEffect()`:
|
|
341
341
|
|
|
342
342
|
```js
|
|
343
|
-
import { registerAllEffects } from '
|
|
343
|
+
import { registerAllEffects } from 'motionary/components/effects';
|
|
344
344
|
registerAllEffects();
|
|
345
345
|
```
|
|
346
346
|
```html
|
|
@@ -355,7 +355,7 @@ Card: `holo` · `glare-sweep` · `book-open` · `card-fan` · `topple` · `float
|
|
|
355
355
|
`bounce-in` · `rubber-band` · `elastic-hover` · `drop-bounce` · `gravity-text` · `spring-follow` · `bell-swing` — keyframes come from a damped-spring / gravity solver and play on WAAPI.
|
|
356
356
|
|
|
357
357
|
```js
|
|
358
|
-
import { registerAllEffects, solveSpring, springKeyframes } from '
|
|
358
|
+
import { registerAllEffects, solveSpring, springKeyframes } from 'motionary/components/effects';
|
|
359
359
|
registerAllEffects();
|
|
360
360
|
const { frames, duration } = springKeyframes((p) => ({ transform: `scale(${p})` }), { stiffness: 220, damping: 11 });
|
|
361
361
|
el.animate(frames, { duration });
|
|
@@ -370,8 +370,8 @@ el.animate(frames, { duration });
|
|
|
370
370
|
Transitions `curtain` · `iris` · `pixel-dissolve` · `blinds` cover the viewport, await `onCovered()`, then reveal:
|
|
371
371
|
|
|
372
372
|
```js
|
|
373
|
-
import { registerAllEffects } from '
|
|
374
|
-
import { playEffect } from '
|
|
373
|
+
import { registerAllEffects } from 'motionary/components/effects';
|
|
374
|
+
import { playEffect } from 'motionary/components/fx';
|
|
375
375
|
registerAllEffects();
|
|
376
376
|
link.addEventListener('click', (e) => {
|
|
377
377
|
e.preventDefault();
|
|
@@ -384,7 +384,7 @@ Persistent: `<usa-fx effect="velocity-skew" trigger="load">`, `spotlight` (`radi
|
|
|
384
384
|
### v5.4 Scroll stories — `<usa-story>` (`components/effects`)
|
|
385
385
|
|
|
386
386
|
```js
|
|
387
|
-
import { defineStory } from '
|
|
387
|
+
import { defineStory } from 'motionary/components/effects';
|
|
388
388
|
defineStory();
|
|
389
389
|
```
|
|
390
390
|
```html
|
|
@@ -410,8 +410,8 @@ Templates `pin` · `gallery` · `zoom` (`zoom="6"`) · `compare` · `counter` ·
|
|
|
410
410
|
</usa-fx>
|
|
411
411
|
```
|
|
412
412
|
```js
|
|
413
|
-
import { registerEffect } from '
|
|
414
|
-
import { canvasBackground } from '
|
|
413
|
+
import { registerEffect } from 'motionary/components/fx';
|
|
414
|
+
import { canvasBackground } from 'motionary/components/effects';
|
|
415
415
|
registerEffect({ name: 'pulse-bg', kind: 'background', reduced: 'run',
|
|
416
416
|
run: (el, o, ctx) => canvasBackground(el, ctx, { draw: ({ ctx: g, w, h, t }) => { g.fillStyle = `hsl(${t * 40} 70% 50%)`; g.fillRect(0, 0, w, h); } }, o) });
|
|
417
417
|
```
|
|
@@ -428,7 +428,7 @@ registerEffect({ name: 'pulse-bg', kind: 'background', reduced: 'run',
|
|
|
428
428
|
</usa-audio>
|
|
429
429
|
```
|
|
430
430
|
```js
|
|
431
|
-
import { enableAudio, bindBeat, registerAllEffects } from '
|
|
431
|
+
import { enableAudio, bindBeat, registerAllEffects } from 'motionary/components/effects';
|
|
432
432
|
registerAllEffects();
|
|
433
433
|
button.addEventListener('click', async () => {
|
|
434
434
|
await enableAudio('mic'); // or an <audio>/<video> element, selector or MediaStream
|
|
@@ -446,7 +446,7 @@ Cursor effects (`comet-trail` · `ribbon-trail` · `sparkle-trail` · `magnetic-
|
|
|
446
446
|
<usa-gesture-fx gesture="long-press" effect="tada"><button>Hold me</button></usa-gesture-fx>
|
|
447
447
|
```
|
|
448
448
|
```js
|
|
449
|
-
import { bindGesture, registerAllEffects } from '
|
|
449
|
+
import { bindGesture, registerAllEffects } from 'motionary/components/effects';
|
|
450
450
|
registerAllEffects();
|
|
451
451
|
bindGesture(card, 'fling', 'confetti', { velocity: 1 });
|
|
452
452
|
bindGesture(dial, 'twist', ({ direction }) => step(direction === 'cw' ? 1 : -1));
|
|
@@ -460,12 +460,12 @@ bindGesture(dial, 'twist', ({ direction }) => step(direction === 'cw' ? 1 : -1))
|
|
|
460
460
|
<div class="usa-surface">
|
|
461
461
|
<button data-theme-fx="click">Tap</button>
|
|
462
462
|
<usa-fx effect="like-heart" trigger="click"><button aria-pressed="false">♥ <span data-count="12">12</span></button></usa-fx>
|
|
463
|
-
<usa-fx effect="copy-success" trigger="click"><button data-copy="npm i
|
|
463
|
+
<usa-fx effect="copy-success" trigger="click"><button data-copy="npm i motionary">Copy</button></usa-fx>
|
|
464
464
|
</div>
|
|
465
465
|
</usa-theme>
|
|
466
466
|
```
|
|
467
467
|
```js
|
|
468
|
-
import { applyTheme, themeCss, playEffect, registerAllEffects } from '
|
|
468
|
+
import { applyTheme, themeCss, playEffect, registerAllEffects } from 'motionary/components/effects';
|
|
469
469
|
registerAllEffects();
|
|
470
470
|
const undo = applyTheme('neon'); // whole page: design + motion tokens + data-usa-theme
|
|
471
471
|
const css = themeCss('paper', ':root'); // static CSS for SSR
|
|
@@ -492,20 +492,49 @@ Plays JSON animations made of timeline presets, keyframes and registered effects
|
|
|
492
492
|
</usa-player>
|
|
493
493
|
```
|
|
494
494
|
```js
|
|
495
|
-
import { createPlayer, registerAllEffects } from '
|
|
495
|
+
import { createPlayer, registerAllEffects } from 'motionary/components/effects';
|
|
496
496
|
registerAllEffects();
|
|
497
497
|
const p = createPlayer(hero, await (await fetch('/hero.json')).json());
|
|
498
498
|
p.play(); p.seek(500); p.rate = 0.5;
|
|
499
499
|
```
|
|
500
500
|
`trigger="scroll"` scrubs the animation with the page. Reduced motion: the final state, no effects. Export JSON from the Playground (`<usa-player> JSON` tab).
|
|
501
501
|
|
|
502
|
+
### v6.2 Widgets: carousel, tab bar, accordion 2.0, stories (`components/widgets`) + GPU pack (`components/fx-gpu`)
|
|
503
|
+
|
|
504
|
+
```html
|
|
505
|
+
<usa-carousel effect="cards" loop autoplay="4000" label="Featured">
|
|
506
|
+
<img src="a.jpg" alt="…"><img src="b.jpg" alt="…"><img src="c.jpg" alt="…">
|
|
507
|
+
</usa-carousel>
|
|
508
|
+
|
|
509
|
+
<usa-tab-bar indicator="pill">
|
|
510
|
+
<button>Overview</button><button>Specs</button>
|
|
511
|
+
<div data-panel>…</div><div data-panel>…</div>
|
|
512
|
+
</usa-tab-bar>
|
|
513
|
+
|
|
514
|
+
<usa-disclosure variant="cards">
|
|
515
|
+
<details><summary>Shipping</summary><p>…</p></details>
|
|
516
|
+
</usa-disclosure>
|
|
517
|
+
|
|
518
|
+
<usa-stories duration="5000" loop><img src="1.jpg" alt="…"><img src="2.jpg" alt="…"></usa-stories>
|
|
519
|
+
|
|
520
|
+
<usa-fx effect="fluid" trigger="load" self class="hero"><h1>Hello</h1></usa-fx>
|
|
521
|
+
```
|
|
522
|
+
```js
|
|
523
|
+
import { defineWidgets } from 'motionary/components/widgets';
|
|
524
|
+
import { defineFx } from 'motionary/components/fx';
|
|
525
|
+
import { registerGpuEffects } from 'motionary/components/fx-gpu';
|
|
526
|
+
defineWidgets(); defineFx(); registerGpuEffects();
|
|
527
|
+
document.querySelector('usa-carousel').next();
|
|
528
|
+
```
|
|
529
|
+
No build: `components.umd.js` + `widgets.umd.js`. GPU effects: `fluid` · `smoke` · `fire` · `ink` · `fireflies` (WebGL2 → Canvas 2D) · `sakura` · `leaves` (Canvas 2D) · `splash` (click). Reduced motion: instant switches, no autoplay, one still frame.
|
|
530
|
+
|
|
502
531
|
## Frameworks
|
|
503
532
|
|
|
504
533
|
Custom elements work in every framework. Register once (e.g. in your entry file), then use the tags.
|
|
505
534
|
|
|
506
535
|
```jsx
|
|
507
536
|
// React 19 passes props to custom elements as properties; React 18 passes strings — both work for attributes.
|
|
508
|
-
import { defineFeedbackComponents, toast } from '
|
|
537
|
+
import { defineFeedbackComponents, toast } from 'motionary/components/feedback';
|
|
509
538
|
defineFeedbackComponents();
|
|
510
539
|
|
|
511
540
|
export function Save() {
|
|
@@ -532,4 +561,4 @@ Gzipped, minified (budgets enforced in CI by `npm run size:check`):
|
|
|
532
561
|
| `viewTransition` only | ≈ 0.4 kB |
|
|
533
562
|
| `dist/components.css` | ≈ 5.5 kB |
|
|
534
563
|
|
|
535
|
-
The scroll-animation core (`
|
|
564
|
+
The scroll-animation core (`motionary`) is unchanged and is not pulled in by the components.
|
package/docs/frameworks-ssr.md
CHANGED
|
@@ -8,22 +8,22 @@ All entry points are **SSR-safe**: importing never touches `window`/`document`;
|
|
|
8
8
|
'use client';
|
|
9
9
|
import { useEffect } from 'react';
|
|
10
10
|
export function UsaProvider() {
|
|
11
|
-
useEffect(() => { import('
|
|
11
|
+
useEffect(() => { import('motionary/components/lazy').then((m) => m.lazyDefine()); }, []);
|
|
12
12
|
return null;
|
|
13
13
|
}
|
|
14
14
|
// app/layout.tsx → <body><UsaProvider />{children}</body>
|
|
15
15
|
```
|
|
16
|
-
The raw tags render on the server as plain HTML and upgrade on hydration. Type them with `
|
|
16
|
+
The raw tags render on the server as plain HTML and upgrade on hydration. Type them with `motionary/components/jsx`:
|
|
17
17
|
```ts
|
|
18
18
|
// usa-jsx.d.ts
|
|
19
|
-
import type { UsaIntrinsicElements } from '
|
|
19
|
+
import type { UsaIntrinsicElements } from 'motionary/components/jsx';
|
|
20
20
|
declare module 'react' { namespace JSX { interface IntrinsicElements extends UsaIntrinsicElements {} } }
|
|
21
21
|
```
|
|
22
22
|
Prefer typed wrappers (React 18 sets properties & `usa:*` events for you):
|
|
23
23
|
```tsx
|
|
24
24
|
'use client';
|
|
25
25
|
import * as React from 'react';
|
|
26
|
-
import { createUsaComponents } from '
|
|
26
|
+
import { createUsaComponents } from 'motionary/components/react';
|
|
27
27
|
export const { UsaButton, UsaToggle, UsaCard } = createUsaComponents(React);
|
|
28
28
|
// <UsaToggle checked={on} onUsaChange={(e) => setOn(e.detail.checked)} />
|
|
29
29
|
```
|
|
@@ -37,8 +37,8 @@ Page transitions in the App Router: wrap `router.push` in `pageTransition(() =>
|
|
|
37
37
|
<html><body>
|
|
38
38
|
<slot />
|
|
39
39
|
<script>
|
|
40
|
-
import { lazyDefine } from '
|
|
41
|
-
import { enableMpaTransitions } from '
|
|
40
|
+
import { lazyDefine } from 'motionary/components/lazy';
|
|
41
|
+
import { enableMpaTransitions } from 'motionary/components/page';
|
|
42
42
|
lazyDefine();
|
|
43
43
|
enableMpaTransitions('fade'); // cross-page View Transitions (or use Astro's <ClientRouter />)
|
|
44
44
|
</script>
|
|
@@ -49,10 +49,10 @@ Use the tags directly in `.astro`, `.md` and island components. With `<ClientRou
|
|
|
49
49
|
## Vue / Nuxt
|
|
50
50
|
```js
|
|
51
51
|
// vite.config.js
|
|
52
|
-
import { isUsaElement } from '
|
|
52
|
+
import { isUsaElement } from 'motionary/components/vue';
|
|
53
53
|
vue({ template: { compilerOptions: { isCustomElement: isUsaElement } } });
|
|
54
54
|
// main.js (or a Nuxt client plugin: plugins/usa.client.ts)
|
|
55
|
-
import { UsaPlugin } from '
|
|
55
|
+
import { UsaPlugin } from 'motionary/components/vue';
|
|
56
56
|
app.use(UsaPlugin); // or app.use(UsaPlugin, { categories: ['click', 'ui'] })
|
|
57
57
|
```
|
|
58
58
|
`<usa-toggle :checked.prop="on" @usa:change="on = $event.detail.checked" />`
|
|
@@ -61,14 +61,14 @@ app.use(UsaPlugin); // or app.use(UsaPlugin, { categories: ['click',
|
|
|
61
61
|
Custom elements work as-is: Svelte (`on:usa:change`), Solid (`on:usa:change`, `prop:checked`), Angular (`schemas: [CUSTOM_ELEMENTS_SCHEMA]`). Call `defineComponents()` or `lazyDefine()` in the client entry.
|
|
62
62
|
|
|
63
63
|
## Lazy registration
|
|
64
|
-
`lazyDefine()` (from `
|
|
64
|
+
`lazyDefine()` (from `motionary/components/lazy`) watches the DOM and dynamically imports only the categories whose tags appear — a page with just `<usa-button>` loads the click chunk only.
|
|
65
65
|
|
|
66
66
|
## Svelte / SvelteKit (v3.8)
|
|
67
67
|
|
|
68
68
|
```svelte
|
|
69
69
|
<script>
|
|
70
70
|
import { onMount } from 'svelte';
|
|
71
|
-
import { usa, defineUsa } from '
|
|
71
|
+
import { usa, defineUsa } from 'motionary/components/svelte';
|
|
72
72
|
onMount(() => defineUsa());
|
|
73
73
|
let on = false;
|
|
74
74
|
</script>
|
|
@@ -79,7 +79,7 @@ Custom elements work as-is: Svelte (`on:usa:change`), Solid (`on:usa:change`, `p
|
|
|
79
79
|
|
|
80
80
|
```tsx
|
|
81
81
|
import { onMount } from 'solid-js';
|
|
82
|
-
import { defineUsa } from '
|
|
82
|
+
import { defineUsa } from 'motionary/components/solid';
|
|
83
83
|
onMount(() => defineUsa());
|
|
84
84
|
<usa-toggle prop:checked={on()} on:usa:change={(e) => setOn(e.detail.checked)} />;
|
|
85
85
|
```
|
|
@@ -88,7 +88,7 @@ onMount(() => defineUsa());
|
|
|
88
88
|
|
|
89
89
|
```ts
|
|
90
90
|
import { APP_INITIALIZER, CUSTOM_ELEMENTS_SCHEMA, Component } from '@angular/core';
|
|
91
|
-
import { usaInitializer, usaDetail } from '
|
|
91
|
+
import { usaInitializer, usaDetail } from 'motionary/components/angular';
|
|
92
92
|
// app.config.ts
|
|
93
93
|
providers: [{ provide: APP_INITIALIZER, multi: true, useFactory: usaInitializer() }];
|
|
94
94
|
// component
|
package/docs/hybrid-apps.md
CHANGED
|
@@ -17,7 +17,7 @@ MAUI 9+ has `HybridWebView` (raw HTML + JS bridge); `BlazorWebView` also works (
|
|
|
17
17
|
```text
|
|
18
18
|
Resources/Raw/wwwroot/
|
|
19
19
|
index.html
|
|
20
|
-
components.umd.js ← copied from node_modules/
|
|
20
|
+
components.umd.js ← copied from node_modules/motionary/dist/
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
```xml
|
|
@@ -84,7 +84,7 @@ The renderer is Chromium — use the npm package with your bundler, or the UMD f
|
|
|
84
84
|
|
|
85
85
|
```js
|
|
86
86
|
// renderer.js (bundled)
|
|
87
|
-
import { defineComponents, configureComponents } from '
|
|
87
|
+
import { defineComponents, configureComponents } from 'motionary/components';
|
|
88
88
|
configureComponents({ injectStyles: true });
|
|
89
89
|
defineComponents();
|
|
90
90
|
```
|
|
@@ -106,7 +106,7 @@ Imports are SSR-safe (no `window` access at import time), so the same modules ca
|
|
|
106
106
|
|
|
107
107
|
```js
|
|
108
108
|
// src/main.js (Vite)
|
|
109
|
-
import { defineComponents } from '
|
|
109
|
+
import { defineComponents } from 'motionary/components';
|
|
110
110
|
import { invoke } from '@tauri-apps/api/core';
|
|
111
111
|
defineComponents();
|
|
112
112
|
document.querySelector('usa-toggle').addEventListener('usa:change', (e) => invoke('set_setting', { on: e.detail.checked }));
|
|
@@ -121,10 +121,10 @@ Tauri uses WebView2 on Windows, WKWebView on macOS / iOS and WebKitGTK on Linux.
|
|
|
121
121
|
|
|
122
122
|
## Native shell bridge (4.7)
|
|
123
123
|
|
|
124
|
-
`
|
|
124
|
+
`motionary/components/bridge` keeps the page in sync with the host app's **system settings** — reduce motion, light / dark / high-contrast theme, accent color — on WinUI 3 / WPF (WebView2), .NET MAUI and Flutter:
|
|
125
125
|
|
|
126
126
|
```js
|
|
127
|
-
import { connectNativeShell } from '
|
|
127
|
+
import { connectNativeShell } from 'motionary/components/bridge';
|
|
128
128
|
const { host } = connectNativeShell(); // 'webview2' | 'maui' | 'flutter' | 'electron' | 'tauri' | 'browser'
|
|
129
129
|
```
|
|
130
130
|
|
|
@@ -138,8 +138,8 @@ Helpers: `detectNativeHost()`, `postToNative(msg)`, `parseNativeSettings(data)`,
|
|
|
138
138
|
|
|
139
139
|
| Framework | Entry | What it gives you |
|
|
140
140
|
|---|---|---|
|
|
141
|
-
| React | `
|
|
142
|
-
| Vue | `
|
|
143
|
-
| Svelte | `
|
|
144
|
-
| Solid | `
|
|
145
|
-
| Angular | `
|
|
141
|
+
| React | `motionary/components/react` | `createUsaComponents(React)` typed wrappers |
|
|
142
|
+
| Vue | `motionary/components/vue` | `UsaPlugin`, `isUsaElement` |
|
|
143
|
+
| Svelte | `motionary/components/svelte` | `use:usa={{ props, on }}` action, `defineUsa()` |
|
|
144
|
+
| Solid | `motionary/components/solid` | `use:usa` directive, `defineUsa()`, JSX types |
|
|
145
|
+
| Angular | `motionary/components/angular` | `usaInitializer()` for `APP_INITIALIZER`, `usaDetail()`; use `CUSTOM_ELEMENTS_SCHEMA` |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Migrating from AOS (Animate On Scroll)
|
|
2
2
|
|
|
3
|
-
AOS and `
|
|
3
|
+
AOS and `motionary` work the same way at the markup level — mark elements with attributes and call `init()` — so most pages migrate with a search-and-replace.
|
|
4
4
|
|
|
5
5
|
## 1. Install and initialise
|
|
6
6
|
|
|
@@ -8,7 +8,7 @@ AOS and `use-scroll-animate` work the same way at the markup level — mark elem
|
|
|
8
8
|
- import AOS from 'aos';
|
|
9
9
|
- import 'aos/dist/aos.css';
|
|
10
10
|
- AOS.init({ duration: 800, once: true, offset: 120 });
|
|
11
|
-
+ import ScrollAnimate from '
|
|
11
|
+
+ import ScrollAnimate from 'motionary';
|
|
12
12
|
+ ScrollAnimate.configure({ defaultDuration: 800, defaultOnce: true, defaultOffset: 120 });
|
|
13
13
|
+ ScrollAnimate.watch(); // like init(), and also picks up elements added later (AOS.refreshHard())
|
|
14
14
|
```
|
|
@@ -17,7 +17,7 @@ No stylesheet is needed: animations run through the Web Animations API (or opt i
|
|
|
17
17
|
|
|
18
18
|
## 2. Attributes
|
|
19
19
|
|
|
20
|
-
| AOS |
|
|
20
|
+
| AOS | motionary |
|
|
21
21
|
|---|---|
|
|
22
22
|
| `data-aos="fade-up"` | `data-sa data-sa-animation="fade-in-up"` |
|
|
23
23
|
| `data-aos-duration="800"` | `data-sa-duration="800"` |
|
|
@@ -31,7 +31,7 @@ No stylesheet is needed: animations run through the Web Animations API (or opt i
|
|
|
31
31
|
|
|
32
32
|
## 3. Animation names
|
|
33
33
|
|
|
34
|
-
| AOS |
|
|
34
|
+
| AOS | motionary |
|
|
35
35
|
|---|---|
|
|
36
36
|
| `fade` | `fade-in` |
|
|
37
37
|
| `fade-up` / `fade-down` | `fade-in-up` / `fade-in-down` |
|
|
@@ -57,7 +57,7 @@ No stylesheet is needed: animations run through the Web Animations API (or opt i
|
|
|
57
57
|
|
|
58
58
|
## 5. Events and refresh
|
|
59
59
|
|
|
60
|
-
| AOS |
|
|
60
|
+
| AOS | motionary |
|
|
61
61
|
|---|---|
|
|
62
62
|
| `document.addEventListener('aos:in', ...)` | `onEnter` / `onStart` options, or `<scroll-animate>`'s `sa:enter` / `sa:start` events |
|
|
63
63
|
| `aos:out` | `onLeave` |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Migrating from GSAP ScrollTrigger
|
|
2
2
|
|
|
3
|
-
GSAP + ScrollTrigger is a full animation platform; `
|
|
3
|
+
GSAP + ScrollTrigger is a full animation platform; `motionary` covers the common scroll cases — reveal on enter, staggered lists, timelines, scrubbed progress and parallax — in a few kB with no dependencies. If you rely on pinning, `snap`, morphing or arbitrary property tweens, keep GSAP for those parts.
|
|
4
4
|
|
|
5
5
|
## Reveal on enter
|
|
6
6
|
|
|
@@ -9,7 +9,7 @@ GSAP + ScrollTrigger is a full animation platform; `use-scroll-animate` covers t
|
|
|
9
9
|
+ ScrollAnimate.observe('.card', { animation: 'fade-in-up', duration: 600 });
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
| ScrollTrigger |
|
|
12
|
+
| ScrollTrigger | motionary |
|
|
13
13
|
|---|---|
|
|
14
14
|
| `start: 'top 90%'` | `threshold` / `rootMargin` (`'0px 0px -10% 0px'`) or `offset` (px) |
|
|
15
15
|
| `once: true` | `once: true` (default) |
|
|
@@ -69,7 +69,7 @@ ScrollAnimate.observe('.card', { animation: 'zoom-in', engine: 'auto', viewRange
|
|
|
69
69
|
|
|
70
70
|
## Cleanup
|
|
71
71
|
|
|
72
|
-
| GSAP |
|
|
72
|
+
| GSAP | motionary |
|
|
73
73
|
|---|---|
|
|
74
74
|
| `ScrollTrigger.refresh()` | `refresh()` |
|
|
75
75
|
| `trigger.kill()` / `ScrollTrigger.getAll().forEach(t => t.kill())` | `unobserve(target)` / `destroy()` |
|
package/docs/motion-tokens.css
CHANGED
package/docs/motion-tokens.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# Motion design tokens (4.2)
|
|
2
2
|
|
|
3
|
-
`
|
|
3
|
+
`motionary/components/tokens` gives your product one motion scale — durations, easings and springs — as **CSS custom properties**, **W3C Design Tokens JSON**, and **JS values**, and imports the scale your designers keep in **Figma Tokens (Tokens Studio)** or **Style Dictionary**.
|
|
4
4
|
|
|
5
5
|
```ts
|
|
6
|
-
import { applyMotionTokens, importMotionTokens, motionToken, motionVar } from '
|
|
6
|
+
import { applyMotionTokens, importMotionTokens, motionToken, motionVar } from 'motionary/components/tokens';
|
|
7
7
|
|
|
8
8
|
// 1. Use the defaults (writes --usa-* variables on <html>)…
|
|
9
9
|
applyMotionTokens();
|
package/docs/performance.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
Every `<usa-*>` loop (cursors, particles, springs, marquees, WebGL, scroll effects…) schedules work through **one shared `requestAnimationFrame`**: callbacks registered during a frame run together, in order, and a throwing callback no longer starves the rest. Use it for your own loops:
|
|
5
5
|
|
|
6
6
|
```ts
|
|
7
|
-
import { onFrame, schedulerStats } from '
|
|
7
|
+
import { onFrame, schedulerStats } from 'motionary/components/perf';
|
|
8
8
|
const stop = onFrame((time, dt) => { /* … */ });
|
|
9
9
|
schedulerStats(); // { frames, callbacks, peak, pending, loops }
|
|
10
10
|
```
|
|
@@ -13,12 +13,12 @@ schedulerStats(); // { frames, callbacks, peak, pending, loops }
|
|
|
13
13
|
- `setAnimationBudget(n)` caps concurrent component animations; extra ones land on their final frame instantly. `activeAnimations()` reports the current count.
|
|
14
14
|
- `autoDegrade({ minFps = 45, maxActive = 40, sample = 1000, patience = 2, recovery = 3 })` samples the frame rate and animation count. After `patience` bad samples it sets motion intensity to `low` and the budget to `maxActive / 2`; after `recovery` good samples it restores both. Dispatches `usa:degrade` (`{ degraded, fps, active, reason }`).
|
|
15
15
|
|
|
16
|
-
## On-demand CSS — `
|
|
17
|
-
Same API as `
|
|
16
|
+
## On-demand CSS — `motionary/components/lite`
|
|
17
|
+
Same API as `motionary/components`, but the light-DOM CSS is **not** inlined: the first time an element of a category connects, `dist/components/<category>.css` is added as a `<link>` (custom tag names fall back to `components.css`). Shadow-DOM styles stay inlined.
|
|
18
18
|
|
|
19
19
|
| Import | gzip |
|
|
20
20
|
|---|---|
|
|
21
|
-
| `
|
|
22
|
-
| `
|
|
21
|
+
| `motionary/components` (everything, CSS inlined) | ≈ 79 KB |
|
|
22
|
+
| `motionary/components/lite` (everything, CSS on demand) | **≈ 62 KB** (budget 70 KB, checked in CI) |
|
|
23
23
|
|
|
24
|
-
Serve the CSS from somewhere else with `onDemandStyles('https://cdn.example/
|
|
24
|
+
Serve the CSS from somewhere else with `onDemandStyles('https://cdn.example/motionary@6/dist/')`, or preload with `loadCategoryStyles('cards', base)`.
|
package/docs/presets.md
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
# Presets
|
|
2
2
|
|
|
3
|
-
`
|
|
3
|
+
`motionary` ships **214 scroll-reveal presets**: 33 in the core (always available) and **181 extended presets** added in 6.1 ("Scroll presets 2.0").
|
|
4
4
|
|
|
5
5
|
```js
|
|
6
|
-
import ScrollAnimate from '
|
|
7
|
-
import '
|
|
6
|
+
import ScrollAnimate from 'motionary';
|
|
7
|
+
import 'motionary/presets/extended'; // registers the extended set (≈ 4 kB gzip, separate entry)
|
|
8
8
|
|
|
9
9
|
ScrollAnimate.observe('.card', { animation: 'bounce-in-up', duration: 900 });
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
```html
|
|
13
13
|
<!-- No build: the UMD core, then the extended set (registers itself) -->
|
|
14
|
-
<script src="https://unpkg.com/
|
|
15
|
-
<script src="https://unpkg.com/
|
|
14
|
+
<script src="https://unpkg.com/motionary@6/dist/index.umd.js"></script>
|
|
15
|
+
<script src="https://unpkg.com/motionary@6/dist/presets-extended.umd.js"></script>
|
|
16
16
|
<div data-sa data-sa-animation="clip-diamond">…</div>
|
|
17
17
|
<script>ScrollAnimate.default.init();</script>
|
|
18
18
|
```
|