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
@@ -369,12 +369,12 @@ type DeepPartialTokens = {
369
369
  * ship with them: `neon-flicker`, `paper-fold`, `glass-shine`,
370
370
  * `retro-scanlines`, `brutal-shift`.
371
371
  *
372
- * - `applyTheme(name, root?)` — on `<html>` (default) it also makes the motion
372
+ * - `applyMotionTheme(name, root?)` — on `<html>` (default) it also makes the motion
373
373
  * tokens active for `motionToken()`; on any other element the tokens are
374
374
  * only written as variables there. Returns an undo.
375
375
  * - `themePreset(name, role)`, `playThemeEffect(el, role)` (theme of the
376
376
  * closest `[data-usa-theme]`).
377
- * - `<usa-theme name="neon">` — scopes a theme to its subtree and binds the
377
+ * - `<usa-motion-theme name="neon">` — scopes a theme to its subtree and binds the
378
378
  * presets to children with `data-theme-fx="click | hover | enter | attention"`.
379
379
  */
380
380
 
@@ -392,14 +392,14 @@ interface ThemePack {
392
392
  options?: Record<string, unknown>;
393
393
  }>;
394
394
  }
395
- declare const THEMES: Record<string, ThemePack>;
396
- declare const THEME_NAMES: string[];
395
+ declare const MOTION_THEMES: Record<string, ThemePack>;
396
+ declare const MOTION_THEME_NAMES: string[];
397
397
  /** The CSS custom properties of a theme (design + motion tokens). */
398
398
  declare function themeVars(t: string | ThemePack): Record<string, string>;
399
399
  /** A theme as a CSS rule (`selector` default `[data-usa-theme=<name>]`) — for SSR / static CSS. */
400
400
  declare function themeCss(t: string | ThemePack, selector?: string): string;
401
- /** Apply a theme to `root` (default `<html>`). Returns an undo. */
402
- declare function applyTheme(t: string | ThemePack, root?: HTMLElement): () => void;
401
+ /** Apply a 5.8 motion theme to `root` (default `<html>`). Returns an undo (8.9). */
402
+ declare function applyMotionTheme(t: string | ThemePack, root?: HTMLElement): () => void;
403
403
  /** The effect preset of a theme for a role. */
404
404
  declare function themePreset(t: string | ThemePack, role: ThemeRole): {
405
405
  effect: string;
@@ -412,7 +412,7 @@ interface UsaThemeElement extends UsaElement {
412
412
  readonly theme: string;
413
413
  }
414
414
  /** `<usa-theme name="neon | paper | glass | retro | brutalist">` — a themed subtree. */
415
- declare function defineTheme(tag?: string): CustomElementConstructor | undefined;
415
+ declare function defineMotionTheme(tag?: string): CustomElementConstructor | undefined;
416
416
 
417
417
  interface AnimationTrack {
418
418
  /** Selector inside the player (`:scope` = the player). */
@@ -541,5 +541,5 @@ declare function defineEffectElements(): void;
541
541
  /** Register the built-ins and every pack (idempotent). */
542
542
  declare function registerAllEffects(): void;
543
543
 
544
- export { ANIMATION_FORMAT, AUDIO_FX, CARD_FX, CLICK_FX, CURSOR_FX, EFFECT_PACKS, GENERATIVE_FX, GESTURES, MICRO_FX, PAGE_FX, PHYSICS_FX, STORY_TEMPLATES, THEMES, THEME_FX, THEME_NAMES, THEME_ROLES, angleDelta, applyTheme, bindBeat, bindGesture, bounceKeyframes, bumpCount, canvasBackground, createBeatDetector, createPlayer, defineAudio, defineEffectElements, defineGestureFx, definePlayer, defineStory, defineTheme, disableAudio, enableAudio, flingVelocity, formatCount, fxLayer, getAudio, hexRgb, noise2, normalizeAnimation, onBeat, playThemeEffect, registerAllEffects, registerAudioEffects, registerCardClickEffects, registerCursorEffects, registerGenerativeEffects, registerMicroEffects, registerPageEffects, registerPhysicsEffects, solveSpring, springKeyframes, storyProgress, swapLabel, themeCss, themePreset, themeVars, togglePressed };
544
+ export { ANIMATION_FORMAT, AUDIO_FX, CARD_FX, CLICK_FX, CURSOR_FX, EFFECT_PACKS, GENERATIVE_FX, GESTURES, MICRO_FX, MOTION_THEMES, MOTION_THEME_NAMES, PAGE_FX, PHYSICS_FX, STORY_TEMPLATES, THEME_FX, THEME_ROLES, angleDelta, applyMotionTheme, bindBeat, bindGesture, bounceKeyframes, bumpCount, canvasBackground, createBeatDetector, createPlayer, defineAudio, defineEffectElements, defineGestureFx, defineMotionTheme, definePlayer, defineStory, disableAudio, enableAudio, flingVelocity, formatCount, fxLayer, getAudio, hexRgb, noise2, normalizeAnimation, onBeat, playThemeEffect, registerAllEffects, registerAudioEffects, registerCardClickEffects, registerCursorEffects, registerGenerativeEffects, registerMicroEffects, registerPageEffects, registerPhysicsEffects, solveSpring, springKeyframes, storyProgress, swapLabel, themeCss, themePreset, themeVars, togglePressed };
545
545
  export type { AnimationJSON, AnimationTrack, AudioInput, AudioReactive, AudioSample, BeatOptions, GenFrame, GenerativeSpec, GestureDetail, GestureFxOptions, GestureName, Player, SpringOptions, StoryTemplate, ThemePack, ThemeRole, UsaAudioElement, UsaGestureFxElement, UsaPlayerElement, UsaStoryElement, UsaThemeElement };
@@ -369,12 +369,12 @@ type DeepPartialTokens = {
369
369
  * ship with them: `neon-flicker`, `paper-fold`, `glass-shine`,
370
370
  * `retro-scanlines`, `brutal-shift`.
371
371
  *
372
- * - `applyTheme(name, root?)` — on `<html>` (default) it also makes the motion
372
+ * - `applyMotionTheme(name, root?)` — on `<html>` (default) it also makes the motion
373
373
  * tokens active for `motionToken()`; on any other element the tokens are
374
374
  * only written as variables there. Returns an undo.
375
375
  * - `themePreset(name, role)`, `playThemeEffect(el, role)` (theme of the
376
376
  * closest `[data-usa-theme]`).
377
- * - `<usa-theme name="neon">` — scopes a theme to its subtree and binds the
377
+ * - `<usa-motion-theme name="neon">` — scopes a theme to its subtree and binds the
378
378
  * presets to children with `data-theme-fx="click | hover | enter | attention"`.
379
379
  */
380
380
 
@@ -392,14 +392,14 @@ interface ThemePack {
392
392
  options?: Record<string, unknown>;
393
393
  }>;
394
394
  }
395
- declare const THEMES: Record<string, ThemePack>;
396
- declare const THEME_NAMES: string[];
395
+ declare const MOTION_THEMES: Record<string, ThemePack>;
396
+ declare const MOTION_THEME_NAMES: string[];
397
397
  /** The CSS custom properties of a theme (design + motion tokens). */
398
398
  declare function themeVars(t: string | ThemePack): Record<string, string>;
399
399
  /** A theme as a CSS rule (`selector` default `[data-usa-theme=<name>]`) — for SSR / static CSS. */
400
400
  declare function themeCss(t: string | ThemePack, selector?: string): string;
401
- /** Apply a theme to `root` (default `<html>`). Returns an undo. */
402
- declare function applyTheme(t: string | ThemePack, root?: HTMLElement): () => void;
401
+ /** Apply a 5.8 motion theme to `root` (default `<html>`). Returns an undo (8.9). */
402
+ declare function applyMotionTheme(t: string | ThemePack, root?: HTMLElement): () => void;
403
403
  /** The effect preset of a theme for a role. */
404
404
  declare function themePreset(t: string | ThemePack, role: ThemeRole): {
405
405
  effect: string;
@@ -412,7 +412,7 @@ interface UsaThemeElement extends UsaElement {
412
412
  readonly theme: string;
413
413
  }
414
414
  /** `<usa-theme name="neon | paper | glass | retro | brutalist">` — a themed subtree. */
415
- declare function defineTheme(tag?: string): CustomElementConstructor | undefined;
415
+ declare function defineMotionTheme(tag?: string): CustomElementConstructor | undefined;
416
416
 
417
417
  interface AnimationTrack {
418
418
  /** Selector inside the player (`:scope` = the player). */
@@ -541,5 +541,5 @@ declare function defineEffectElements(): void;
541
541
  /** Register the built-ins and every pack (idempotent). */
542
542
  declare function registerAllEffects(): void;
543
543
 
544
- export { ANIMATION_FORMAT, AUDIO_FX, CARD_FX, CLICK_FX, CURSOR_FX, EFFECT_PACKS, GENERATIVE_FX, GESTURES, MICRO_FX, PAGE_FX, PHYSICS_FX, STORY_TEMPLATES, THEMES, THEME_FX, THEME_NAMES, THEME_ROLES, angleDelta, applyTheme, bindBeat, bindGesture, bounceKeyframes, bumpCount, canvasBackground, createBeatDetector, createPlayer, defineAudio, defineEffectElements, defineGestureFx, definePlayer, defineStory, defineTheme, disableAudio, enableAudio, flingVelocity, formatCount, fxLayer, getAudio, hexRgb, noise2, normalizeAnimation, onBeat, playThemeEffect, registerAllEffects, registerAudioEffects, registerCardClickEffects, registerCursorEffects, registerGenerativeEffects, registerMicroEffects, registerPageEffects, registerPhysicsEffects, solveSpring, springKeyframes, storyProgress, swapLabel, themeCss, themePreset, themeVars, togglePressed };
544
+ export { ANIMATION_FORMAT, AUDIO_FX, CARD_FX, CLICK_FX, CURSOR_FX, EFFECT_PACKS, GENERATIVE_FX, GESTURES, MICRO_FX, MOTION_THEMES, MOTION_THEME_NAMES, PAGE_FX, PHYSICS_FX, STORY_TEMPLATES, THEME_FX, THEME_ROLES, angleDelta, applyMotionTheme, bindBeat, bindGesture, bounceKeyframes, bumpCount, canvasBackground, createBeatDetector, createPlayer, defineAudio, defineEffectElements, defineGestureFx, defineMotionTheme, definePlayer, defineStory, disableAudio, enableAudio, flingVelocity, formatCount, fxLayer, getAudio, hexRgb, noise2, normalizeAnimation, onBeat, playThemeEffect, registerAllEffects, registerAudioEffects, registerCardClickEffects, registerCursorEffects, registerGenerativeEffects, registerMicroEffects, registerPageEffects, registerPhysicsEffects, solveSpring, springKeyframes, storyProgress, swapLabel, themeCss, themePreset, themeVars, togglePressed };
545
545
  export type { AnimationJSON, AnimationTrack, AudioInput, AudioReactive, AudioSample, BeatOptions, GenFrame, GenerativeSpec, GestureDetail, GestureFxOptions, GestureName, Player, SpringOptions, StoryTemplate, ThemePack, ThemeRole, UsaAudioElement, UsaGestureFxElement, UsaPlayerElement, UsaStoryElement, UsaThemeElement };
@@ -1125,7 +1125,7 @@ const P = (enter, hover, click, attention, background) => ({
1125
1125
  attention: { effect: attention },
1126
1126
  background: { effect: background },
1127
1127
  });
1128
- const THEMES = {
1128
+ const MOTION_THEMES = {
1129
1129
  neon: {
1130
1130
  name: 'neon',
1131
1131
  vars: { bg: '#07070c', fg: '#e8e8ff', accent: '#22d3ee', 'accent-2': '#ff2bd6', surface: '#11111c', border: '1px solid #22d3ee', radius: '10px', shadow: '0 0 18px #22d3ee66, inset 0 0 12px #ff2bd622', font: 'ui-monospace, SFMono-Regular, Menlo, monospace' },
@@ -1157,15 +1157,15 @@ const THEMES = {
1157
1157
  presets: P('drop-bounce', 'jelly', 'brutal-shift', 'shake', 'voronoi'),
1158
1158
  },
1159
1159
  };
1160
- const THEME_NAMES = Object.keys(THEMES);
1160
+ const MOTION_THEME_NAMES = Object.keys(MOTION_THEMES);
1161
1161
  const BASE_CSS = `[data-usa-theme]{background:var(--usa-theme-bg);color:var(--usa-theme-fg);font-family:var(--usa-theme-font)}
1162
1162
  [data-usa-theme] .usa-surface{background:var(--usa-theme-surface);border:var(--usa-theme-border);border-radius:var(--usa-theme-radius);box-shadow:var(--usa-theme-shadow)}
1163
1163
  [data-usa-theme] .usa-accent{color:var(--usa-theme-accent)}
1164
1164
  [data-usa-theme=glass] .usa-surface{-webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px)}`;
1165
1165
  const pack = (t) => {
1166
- const p = typeof t === 'string' ? THEMES[t] : t;
1166
+ const p = typeof t === 'string' ? MOTION_THEMES[t] : t;
1167
1167
  if (!p)
1168
- throw new Error(`[motionary] unknown theme "${String(t)}" — ${THEME_NAMES.join(', ')}`);
1168
+ throw new Error(`[motionary] unknown theme "${String(t)}" — ${MOTION_THEME_NAMES.join(', ')}`);
1169
1169
  return p;
1170
1170
  };
1171
1171
  /** The CSS custom properties of a theme (design + motion tokens). */
@@ -1181,8 +1181,8 @@ function themeCss(t, selector) {
1181
1181
  const p = pack(t);
1182
1182
  return `${selector || `[data-usa-theme=${p.name}]`}{${Object.entries(themeVars(p)).map(([k, v]) => `${k}:${v}`).join(';')}}`;
1183
1183
  }
1184
- /** Apply a theme to `root` (default `<html>`). Returns an undo. */
1185
- function applyTheme(t, root) {
1184
+ /** Apply a 5.8 motion theme to `root` (default `<html>`). Returns an undo (8.9). */
1185
+ function applyMotionTheme(t, root) {
1186
1186
  const p = pack(t);
1187
1187
  const el = root || document.documentElement;
1188
1188
  adoptStyles('usa-theme', BASE_CSS);
@@ -1271,17 +1271,17 @@ const THEME_FX = [
1271
1271
  },
1272
1272
  ];
1273
1273
  /** `<usa-theme name="neon | paper | glass | retro | brutalist">` — a themed subtree. */
1274
- function defineTheme(tag = 'usa-theme') {
1274
+ function defineMotionTheme(tag = 'usa-motion-theme') {
1275
1275
  return defineElement(tag, (Base) => class UsaTheme extends Base {
1276
1276
  static get observedAttributes() {
1277
1277
  return ['name'];
1278
1278
  }
1279
1279
  get theme() {
1280
1280
  const n = this.str('name', 'neon');
1281
- return THEMES[n] ? n : 'neon';
1281
+ return MOTION_THEMES[n] ? n : 'neon';
1282
1282
  }
1283
1283
  mount() {
1284
- this.onCleanup(applyTheme(this.theme, this));
1284
+ this.onCleanup(applyMotionTheme(this.theme, this));
1285
1285
  this.querySelectorAll('[data-theme-fx]').forEach((el) => {
1286
1286
  const role = (el.dataset.themeFx || 'click');
1287
1287
  if (!THEME_ROLES.includes(role))
@@ -1356,7 +1356,7 @@ function defineEffectElements() {
1356
1356
  defineStory();
1357
1357
  defineAudio();
1358
1358
  defineGestureFx();
1359
- defineTheme();
1359
+ defineMotionTheme();
1360
1360
  definePlayer();
1361
1361
  }
1362
1362
  /** Register the built-ins and every pack (idempotent). */
@@ -1366,5 +1366,5 @@ function registerAllEffects() {
1366
1366
  registerEffects(defs);
1367
1367
  }
1368
1368
 
1369
- export { AUDIO_FX, CARD_FX, CLICK_FX, CURSOR_FX, EFFECT_PACKS, GENERATIVE_FX, GESTURES, MICRO_FX, PAGE_FX, PHYSICS_FX, THEMES, THEME_FX, THEME_NAMES, THEME_ROLES, angleDelta, applyTheme, bindGesture, bounceKeyframes, bumpCount, canvasBackground, defineAudio, defineEffectElements, defineGestureFx, definePlayer, defineStory, defineTheme, flingVelocity, fxLayer, hexRgb, playThemeEffect, registerAllEffects, registerAudioEffects, registerCardClickEffects, registerCursorEffects, registerGenerativeEffects, registerMicroEffects, registerPageEffects, registerPhysicsEffects, solveSpring, springKeyframes, swapLabel, themeCss, themePreset, themeVars, togglePressed };
1369
+ export { AUDIO_FX, CARD_FX, CLICK_FX, CURSOR_FX, EFFECT_PACKS, GENERATIVE_FX, GESTURES, MICRO_FX, MOTION_THEMES, MOTION_THEME_NAMES, PAGE_FX, PHYSICS_FX, THEME_FX, THEME_ROLES, angleDelta, applyMotionTheme, bindGesture, bounceKeyframes, bumpCount, canvasBackground, defineAudio, defineEffectElements, defineGestureFx, defineMotionTheme, definePlayer, defineStory, flingVelocity, fxLayer, hexRgb, playThemeEffect, registerAllEffects, registerAudioEffects, registerCardClickEffects, registerCursorEffects, registerGenerativeEffects, registerMicroEffects, registerPageEffects, registerPhysicsEffects, solveSpring, springKeyframes, swapLabel, themeCss, themePreset, themeVars, togglePressed };
1370
1370
  //# sourceMappingURL=effects.js.map