use-scroll-animate 8.8.0 → 9.0.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.
Files changed (44) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +2 -2
  3. package/README_ja.md +2 -2
  4. package/README_zh.md +2 -2
  5. package/bin/usa-codemod-9.mjs +71 -0
  6. package/dist/chunks/manifest-B08-vo9G.cjs +81 -0
  7. package/dist/chunks/manifest-B08-vo9G.cjs.map +1 -0
  8. package/dist/chunks/manifest-PJ0h8RS_.js +76 -0
  9. package/dist/chunks/manifest-PJ0h8RS_.js.map +1 -0
  10. package/dist/components/dsl.cjs +210 -0
  11. package/dist/components/dsl.cjs.map +1 -0
  12. package/dist/components/dsl.d.cts +76 -0
  13. package/dist/components/dsl.d.ts +76 -0
  14. package/dist/components/dsl.js +203 -0
  15. package/dist/components/dsl.js.map +1 -0
  16. package/dist/components/effects.cjs +14 -14
  17. package/dist/components/effects.cjs.map +1 -1
  18. package/dist/components/effects.d.cts +8 -8
  19. package/dist/components/effects.d.ts +8 -8
  20. package/dist/components/effects.js +11 -11
  21. package/dist/components/effects.js.map +1 -1
  22. package/dist/components/fx2.cjs +5 -5
  23. package/dist/components/fx2.js +1 -1
  24. package/dist/components/marketplace.cjs +81 -71
  25. package/dist/components/marketplace.cjs.map +1 -1
  26. package/dist/components/marketplace.d.cts +33 -2
  27. package/dist/components/marketplace.d.ts +33 -2
  28. package/dist/components/marketplace.js +73 -68
  29. package/dist/components/marketplace.js.map +1 -1
  30. package/dist/components/widgets.cjs +593 -186
  31. package/dist/components/widgets.cjs.map +1 -1
  32. package/dist/components/widgets.d.cts +152 -2
  33. package/dist/components/widgets.d.ts +152 -2
  34. package/dist/components/widgets.js +587 -187
  35. package/dist/components/widgets.js.map +1 -1
  36. package/dist/components.umd.js +2 -2
  37. package/dist/components.umd.js.map +1 -1
  38. package/dist/widgets.umd.js +1 -1
  39. package/dist/widgets.umd.js.map +1 -1
  40. package/docs/ROADMAP.md +12 -14
  41. package/docs/components.md +40 -4
  42. package/docs/deprecations.md +4 -0
  43. package/docs/upgrading-9.md +37 -0
  44. package/package.json +33 -2
package/docs/ROADMAP.md CHANGED
@@ -1,16 +1,14 @@
1
- # Motionary 路线图(8.0 之后)
1
+ # Motionary 路线图(9.0 之后)
2
2
 
3
- 8.0 已发布:统一时间线引擎(`motionary/engine` —— 所有组件、特效与帧循环共享一个时钟,可整体暂停、变速、编排)、SSR 水合动画(`ssrHead()` + `hydrateMotion()` / `<usa-hydrate>`)、移除 7.9 弃用的 `<usa-rating>`;`motionary` 与 `use-scroll-animate` 同时成为 npm `latest`。下面是 8.1 → 9.0 的计划,每个版本一个特效主题 + 一组新的动画组件,x.9 版本负责下一个大版本的弃用与迁移工具。
3
+ 9.0 已发布:声明式动效 DSL(`motionary/dsl` —— 用 `data-motion="enter: fade-up 600ms stagger 80ms; hover: pop"` 一行文本描述完整动效,或用 `<usa-motion>`)、插件市场正式版(`motionary/marketplace` —— 目录、搜索、一键安装,`<usa-plugin-store>`)、移除 8.9 弃用的 `applyTheme()` / `THEMES` / `THEME_NAMES` / `<usa-theme>`(改名为 Motion 前缀);`motionary` 与 `use-scroll-animate` 同时成为 npm `latest`。下面是 9.1 → 10.0 的计划,每个版本一个主题 + 一组新组件,9.9 负责 10.0 的弃用与迁移工具。
4
4
 
5
- - ✅ **v8.1** — 节日特效包:烟花、新春(灯笼、福字、鞭炮)、圣诞飘雪、万圣节;新组件 节日横幅、红包。
6
- - ✅ **v8.2** — 复古风:像素化、CRT 显示器、VHS 噪点、Y2K;新组件 复古按钮、终端窗口。
7
- - ✅ **v8.3** — 自然有机:水波涟漪、藤蔓生长、花朵绽放;新组件 有机卡片、液态导航。
8
- - ✅ **v8.4** — 赛博 / 科幻:HUD 线框、扫描线、全息投影;新组件 HUD 面板、雷达扫描。
9
- - ✅ **v8.5** — 纸张与手绘:折纸、铅笔素描、水彩晕染;新组件 便利贴墙、手绘图表。
10
- - ✅ **v8.6** — 霓虹 / 玻璃 / 新拟态主题系统;新组件 主题切换器。
11
- - ✅ **v8.7** — 手势 3.0:多点触控、陀螺仪;新组件 陀螺仪 3D 卡片。
12
- - ✅ **v8.8** — XR / 空间界面:WebXR 预览、空间卡片;新组件 全景查看器。
13
- - **v8.9** — 9.0 预备:9.0 弃用警告、`upgrading-9.md` 与 `usa-codemod-9`;低代码组件导出。
14
- - **v9.0** — 声明式动效 DSL(用一段文本描述完整动效)、插件市场正式版;移除 8.9 弃用项;npm `latest`。
15
-
16
- 之后的方向(9.1 → 10.0):电影化叙事 2.0、Lottie / Rive 导入、生成艺术 2.0、视频动效、无障碍动效 2.0、性能 3.0(OffscreenCanvas / Worker)、设计工具集成、原生 2.0;10.0 目标是零依赖核心 < 10 KB、所有特效插件化、默认 WebGPU。
5
+ - **v9.1** — 电影化叙事 2.0:镜头语言(推拉摇移、景深切换、转场);新组件 章节导航。
6
+ - **v9.2** — Lottie / Rive 导入(JSON → 动效时间线);新组件 动画图标集。
7
+ - **v9.3** — 生成艺术 2.0:风格化着色器;新组件 背景生成器。
8
+ - **v9.4** — 视频动效:滚动驱动视频、帧序列;新组件 视频卡片、英雄视频。
9
+ - **v9.5** — 无障碍动效 2.0:更细的动效偏好分级;新组件 动效偏好面板。
10
+ - **v9.6** — 性能 3.0:OffscreenCanvas、Worker 渲染;新组件 性能监视器。
11
+ - **v9.7** — 设计工具集成:Figma 插件脚手架、Framer 导出。
12
+ - **v9.8** — 原生 2.0:React Native / Flutter 组件示例。
13
+ - **v9.9** — 10.0 预备:10.0 弃用警告、`upgrading-10.md` 与 `usa-codemod-10`。
14
+ - **v10.0** — 全新架构:零依赖核心 < 10 KB、所有特效插件化、默认 WebGPU;npm `latest`。
@@ -453,18 +453,18 @@ bindGesture(dial, 'twist', ({ direction }) => step(direction === 'cw' ? 1 : -1))
453
453
  ### v5.8 Theme packs & micro-interactions (`components/effects`)
454
454
 
455
455
  ```html
456
- <usa-theme name="glass">
456
+ <usa-motion-theme name="glass">
457
457
  <div class="usa-surface">
458
458
  <button data-theme-fx="click">Tap</button>
459
459
  <usa-fx effect="like-heart" trigger="click"><button aria-pressed="false">♥ <span data-count="12">12</span></button></usa-fx>
460
460
  <usa-fx effect="copy-success" trigger="click"><button data-copy="npm i motionary">Copy</button></usa-fx>
461
461
  </div>
462
- </usa-theme>
462
+ </usa-motion-theme>
463
463
  ```
464
464
  ```js
465
- import { applyTheme, themeCss, playEffect, registerAllEffects } from 'motionary/components/effects';
465
+ import { applyMotionTheme, themeCss, playEffect, registerAllEffects } from 'motionary/components/effects';
466
466
  registerAllEffects();
467
- const undo = applyTheme('neon'); // whole page: design + motion tokens + data-usa-theme
467
+ const undo = applyMotionTheme('neon'); // whole page: design + motion tokens + data-usa-theme
468
468
  const css = themeCss('paper', ':root'); // static CSS for SSR
469
469
  playEffect(passwordToggle, 'password-reveal');
470
470
  ```
@@ -1131,6 +1131,42 @@ pano.addEventListener('usa:look', (e) => console.log(e.detail.yaw));
1131
1131
  - `<usa-spatial-card>`: `active`; `usa:focus-depth`.
1132
1132
  - Spatial: `portal-open` (`color`) · `orbit-in` (`from`) · `spatial-float` · `depth-pop`; `yawToOffset(yaw, width)`, `xrSupport()`.
1133
1133
 
1134
+ ### v8.9 Low-code export: `exportComponent()`, `<usa-code-export>`, `<usa-prop-panel>` (`components/widgets`)
1135
+
1136
+ ```html
1137
+ <usa-star-rating id="r" value="3"></usa-star-rating>
1138
+ <usa-prop-panel for="#r" props="value:number:0:5, icon:select:star|heart, readonly:boolean"></usa-prop-panel>
1139
+ <usa-code-export for="#r" formats="html,react,vue,json"></usa-code-export>
1140
+ ```
1141
+ ```js
1142
+ import { defineWidgets, exportComponent, describeComponent } from 'motionary/components/widgets';
1143
+ defineWidgets();
1144
+ console.log(exportComponent(document.querySelector('#r'), 'react'));
1145
+ ```
1146
+ - `<usa-code-export for formats>`: `format`, `code`, `copy()`; `usa:copy` { format, ok }.
1147
+ - `<usa-prop-panel for props label>`: `props`, `reset()`; `usa:prop` { name, value }; `parseProps(str)`.
1148
+ - 9.0 prep: `applyMotionTheme` / `MOTION_THEMES` / `MOTION_THEME_NAMES` / `<usa-motion-theme>` are deprecated → `applyMotionTheme` / `MOTION_THEMES` / `MOTION_THEME_NAMES` / `<usa-motion-theme>` (`npx usa-codemod-9 --write src`, see docs/upgrading-9.md).
1149
+
1150
+ ### v9.0 Declarative motion DSL (`motionary/dsl`) + plugin marketplace (`motionary/marketplace`): `<usa-motion>`, `<usa-plugin-store>`
1151
+
1152
+ ```html
1153
+ <section data-motion="enter: fade-up 600ms ease-out stagger 80ms; hover: pop">
1154
+ <div class="card">One</div><div class="card">Two</div>
1155
+ </section>
1156
+ <usa-motion rules="click: confetti count=40"><button>Celebrate</button></usa-motion>
1157
+
1158
+ <usa-plugin-store query="neon"></usa-plugin-store>
1159
+ ```
1160
+ ```js
1161
+ import { applyMotion, parseMotion } from 'motionary/dsl';
1162
+ import { searchPlugins, installPlugin } from 'motionary/marketplace';
1163
+ const { errors } = applyMotion(document, { observe: true });
1164
+ await installPlugin(searchPlugins('retro')[0], { load: () => import('motionary/fx/retro') });
1165
+ ```
1166
+ - DSL: `trigger: effect [600ms] [ease-out] [delay 100ms] [stagger 80ms] [once] [key=value…]`, rules separated by `;`.
1167
+ - `<usa-motion rules>`: `parsed`, `errors`; `usa:motion-error` { message }.
1168
+ - `<usa-plugin-store query label>`: `plugins`, `loader`, `search(q)`, `install(name)`; `usa:install` { name, effects }, `usa:install-error`.
1169
+
1134
1170
  ## Frameworks
1135
1171
 
1136
1172
  Custom elements work in every framework. Register once (e.g. in your entry file), then use the tags.
@@ -1,5 +1,9 @@
1
1
  # Deprecations
2
2
 
3
+ ## Deprecated in 8.9, removed in 9.0 (released)
4
+
5
+ See [upgrading-9.md](./upgrading-9.md) — the 5.8 motion-theme names `applyTheme()`, `THEMES`, `THEME_NAMES`, `<usa-theme>` / `defineTheme()` (use `applyMotionTheme()`, `MOTION_THEMES`, `MOTION_THEME_NAMES`, `<usa-motion-theme>` / `defineMotionTheme()`; same behaviour). Run `npx usa-codemod-9 --write src`.
6
+
3
7
  ## Deprecated in 7.9, removed in 8.0 (released)
4
8
 
5
9
  See [upgrading-8.md](./upgrading-8.md) — `<usa-rating>` / `defineRating()` (use `<usa-star-rating>` / `defineStarRating()`; same `value`, `max`, `readonly`, `label`, `name`; `icon="♥"` → `icon="heart"`). Run `npx usa-codemod-8 --write src`.
@@ -0,0 +1,37 @@
1
+ # Upgrading to 9.0
2
+
3
+ 9.0.0 is released. 8.9 **warned once in the console** for everything below, and a codemod rewrites it:
4
+
5
+ ```sh
6
+ npx usa-codemod-9 src # dry run: lists every change (and what needs a manual edit)
7
+ npx usa-codemod-9 --write src # apply
8
+ ```
9
+
10
+ ## Removed in 9.0 (deprecated in 8.9)
11
+
12
+ 8.6 added *surface* themes (`applySurfaceTheme`, `SURFACE_THEMES`, `data-usa-surface`). To keep them apart from the 5.8 *motion* themes, the 5.8 names get a `Motion` prefix:
13
+
14
+ | 8.x | 9.0 | Codemod |
15
+ |---|---|---|
16
+ | `applyTheme(name, root?)` | `applyMotionTheme(name, root?)` (same signature, returns the undo) | ✅ |
17
+ | `THEMES` / `THEME_NAMES` | `MOTION_THEMES` / `MOTION_THEME_NAMES` | ✅ |
18
+ | `<usa-theme name="neon">` | `<usa-motion-theme name="neon">` (same `data-theme-fx` bindings) | ✅ tags |
19
+ | `defineTheme()` | `defineMotionTheme()` | ⚠️ manual |
20
+
21
+ `document.createElement('usa-theme')` and CSS selectors on `usa-theme` are reported for a manual edit. `themeVars`, `themeCss`, `themePreset`, `playThemeEffect`, `THEME_ROLES` and the `data-usa-theme` attribute are unchanged.
22
+
23
+ ## New in 9.0
24
+
25
+ - **Declarative motion DSL — `motionary/dsl`.** Describe motion as one string: `data-motion="enter: fade-up 600ms ease-out stagger 80ms; hover: pop; click: confetti count=40"` (triggers `enter` · `click` · `hover` · `load` · `loop` · `manual`; modifiers: duration, `delay`, `stagger`, easing, `once`, `key=value` options). `applyMotion(root, { observe })` binds every `[data-motion]`, `bindMotion(el, rules)` one element, `parseMotion()` / `serializeMotion()` round-trip, `motion\`…\`` tagged template, `createComponent(json)` builds markup from the 8.9 component JSON. `<usa-motion rules="…">` is the same as an element.
26
+ - **Plugin marketplace GA — `motionary/marketplace`** (also `motionary/components/marketplace`, which keeps the 6.9 manifest API): `MARKETPLACE` (first-party catalogue), `searchPlugins()`, `installPlugin(listing | url, { load })`, `installedPlugins()`, `fetchMarketplace(url)` for third-party indexes; `<usa-plugin-store>` puts search + one-click install on a page.
27
+ - `motionary` and the `use-scroll-animate` alias are both published with the npm `latest` tag.
28
+
29
+ ## Behaviour
30
+
31
+ - Nothing else changes: every 8.x widget, effect pack and engine API stays the same; `data-usa-theme`, `themeVars`, `themeCss`, `themePreset`, `playThemeEffect` and `THEME_ROLES` are unchanged.
32
+
33
+ ## New in 8.9 (before the break)
34
+
35
+ - **Low-code export.** `exportComponent(el, 'html' | 'react' | 'vue' | 'json')` turns any live, configured component into copy-paste code (runtime parts stripped); `describeComponent(el)` gives the portable JSON. `<usa-code-export>` shows it in tabs with a copy button and follows attribute changes; `<usa-prop-panel for="#el" props="…">` edits a live component's attributes with typed fields.
36
+
37
+ See the [CHANGELOG](../CHANGELOG.md) for the full list.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "use-scroll-animate",
3
- "version": "8.8.0",
3
+ "version": "9.0.0",
4
4
  "description": "Compatibility alias of motionary (same build). The project was renamed to Motionary — install `motionary` instead. Motionary (formerly use-scroll-animate): dependency-free scroll animations + 94 animated Web Components — 214 scroll-reveal presets, card/click/button morphs, physics, page transitions, generative & sound-reactive backgrounds, cursor/gesture effects, themes, micro-interactions, <usa-player>, WebGL. React, Vue, Svelte, Solid, Angular or plain HTML.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -98,6 +98,26 @@
98
98
  "default": "./dist/components/engine.cjs"
99
99
  }
100
100
  },
101
+ "./dsl": {
102
+ "import": {
103
+ "types": "./dist/components/dsl.d.ts",
104
+ "default": "./dist/components/dsl.js"
105
+ },
106
+ "require": {
107
+ "types": "./dist/components/dsl.d.cts",
108
+ "default": "./dist/components/dsl.cjs"
109
+ }
110
+ },
111
+ "./marketplace": {
112
+ "import": {
113
+ "types": "./dist/components/marketplace.d.ts",
114
+ "default": "./dist/components/marketplace.js"
115
+ },
116
+ "require": {
117
+ "types": "./dist/components/marketplace.d.cts",
118
+ "default": "./dist/components/marketplace.cjs"
119
+ }
120
+ },
101
121
  "./fx": {
102
122
  "import": {
103
123
  "types": "./dist/components/fx2.d.ts",
@@ -968,6 +988,16 @@
968
988
  "default": "./dist/components/fx-spatial.cjs"
969
989
  }
970
990
  },
991
+ "./components/dsl": {
992
+ "import": {
993
+ "types": "./dist/components/dsl.d.ts",
994
+ "default": "./dist/components/dsl.js"
995
+ },
996
+ "require": {
997
+ "types": "./dist/components/dsl.d.cts",
998
+ "default": "./dist/components/dsl.cjs"
999
+ }
1000
+ },
971
1001
  "./components/lite": {
972
1002
  "import": {
973
1003
  "types": "./dist/components/lite.d.ts",
@@ -1101,6 +1131,7 @@
1101
1131
  "usa-codemod-5": "./bin/usa-codemod-5.mjs",
1102
1132
  "usa-codemod-6": "./bin/usa-codemod-6.mjs",
1103
1133
  "usa-codemod-7": "./bin/usa-codemod-7.mjs",
1104
- "usa-codemod-8": "./bin/usa-codemod-8.mjs"
1134
+ "usa-codemod-8": "./bin/usa-codemod-8.mjs",
1135
+ "usa-codemod-9": "./bin/usa-codemod-9.mjs"
1105
1136
  }
1106
1137
  }