use-scroll-animate 8.7.0 → 8.9.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.
@@ -394,12 +394,21 @@ interface ThemePack {
394
394
  }
395
395
  declare const THEMES: Record<string, ThemePack>;
396
396
  declare const THEME_NAMES: string[];
397
+ /** The 5.8 motion theme packs (8.9 name of `THEMES`). */
398
+ declare const MOTION_THEMES: Record<string, ThemePack>;
399
+ /** Names of the 5.8 motion theme packs (8.9 name of `THEME_NAMES`). */
400
+ declare const MOTION_THEME_NAMES: string[];
397
401
  /** The CSS custom properties of a theme (design + motion tokens). */
398
402
  declare function themeVars(t: string | ThemePack): Record<string, string>;
399
403
  /** A theme as a CSS rule (`selector` default `[data-usa-theme=<name>]`) — for SSR / static CSS. */
400
404
  declare function themeCss(t: string | ThemePack, selector?: string): string;
401
- /** Apply a theme to `root` (default `<html>`). Returns an undo. */
405
+ /**
406
+ * Apply a motion theme to `root` (default `<html>`). Returns an undo.
407
+ * @deprecated 8.9 — removed in 9.0. Use `applyMotionTheme()` (same signature); `npx usa-codemod-9 --write src`.
408
+ */
402
409
  declare function applyTheme(t: string | ThemePack, root?: HTMLElement): () => void;
410
+ /** Apply a 5.8 motion theme to `root` (default `<html>`). Returns an undo (8.9). */
411
+ declare function applyMotionTheme(t: string | ThemePack, root?: HTMLElement): () => void;
403
412
  /** The effect preset of a theme for a role. */
404
413
  declare function themePreset(t: string | ThemePack, role: ThemeRole): {
405
414
  effect: string;
@@ -413,6 +422,8 @@ interface UsaThemeElement extends UsaElement {
413
422
  }
414
423
  /** `<usa-theme name="neon | paper | glass | retro | brutalist">` — a themed subtree. */
415
424
  declare function defineTheme(tag?: string): CustomElementConstructor | undefined;
425
+ /** `<usa-motion-theme name="neon">` — the 8.9 name of `<usa-theme>` (removed in 9.0). */
426
+ declare function defineMotionTheme(tag?: string): CustomElementConstructor | undefined;
416
427
 
417
428
  interface AnimationTrack {
418
429
  /** Selector inside the player (`:scope` = the player). */
@@ -541,5 +552,5 @@ declare function defineEffectElements(): void;
541
552
  /** Register the built-ins and every pack (idempotent). */
542
553
  declare function registerAllEffects(): void;
543
554
 
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 };
555
+ 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, THEMES, THEME_FX, THEME_NAMES, THEME_ROLES, angleDelta, applyMotionTheme, applyTheme, bindBeat, bindGesture, bounceKeyframes, bumpCount, canvasBackground, createBeatDetector, createPlayer, defineAudio, defineEffectElements, defineGestureFx, defineMotionTheme, 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 };
545
556
  export type { AnimationJSON, AnimationTrack, AudioInput, AudioReactive, AudioSample, BeatOptions, GenFrame, GenerativeSpec, GestureDetail, GestureFxOptions, GestureName, Player, SpringOptions, StoryTemplate, ThemePack, ThemeRole, UsaAudioElement, UsaGestureFxElement, UsaPlayerElement, UsaStoryElement, UsaThemeElement };
@@ -394,12 +394,21 @@ interface ThemePack {
394
394
  }
395
395
  declare const THEMES: Record<string, ThemePack>;
396
396
  declare const THEME_NAMES: string[];
397
+ /** The 5.8 motion theme packs (8.9 name of `THEMES`). */
398
+ declare const MOTION_THEMES: Record<string, ThemePack>;
399
+ /** Names of the 5.8 motion theme packs (8.9 name of `THEME_NAMES`). */
400
+ declare const MOTION_THEME_NAMES: string[];
397
401
  /** The CSS custom properties of a theme (design + motion tokens). */
398
402
  declare function themeVars(t: string | ThemePack): Record<string, string>;
399
403
  /** A theme as a CSS rule (`selector` default `[data-usa-theme=<name>]`) — for SSR / static CSS. */
400
404
  declare function themeCss(t: string | ThemePack, selector?: string): string;
401
- /** Apply a theme to `root` (default `<html>`). Returns an undo. */
405
+ /**
406
+ * Apply a motion theme to `root` (default `<html>`). Returns an undo.
407
+ * @deprecated 8.9 — removed in 9.0. Use `applyMotionTheme()` (same signature); `npx usa-codemod-9 --write src`.
408
+ */
402
409
  declare function applyTheme(t: string | ThemePack, root?: HTMLElement): () => void;
410
+ /** Apply a 5.8 motion theme to `root` (default `<html>`). Returns an undo (8.9). */
411
+ declare function applyMotionTheme(t: string | ThemePack, root?: HTMLElement): () => void;
403
412
  /** The effect preset of a theme for a role. */
404
413
  declare function themePreset(t: string | ThemePack, role: ThemeRole): {
405
414
  effect: string;
@@ -413,6 +422,8 @@ interface UsaThemeElement extends UsaElement {
413
422
  }
414
423
  /** `<usa-theme name="neon | paper | glass | retro | brutalist">` — a themed subtree. */
415
424
  declare function defineTheme(tag?: string): CustomElementConstructor | undefined;
425
+ /** `<usa-motion-theme name="neon">` — the 8.9 name of `<usa-theme>` (removed in 9.0). */
426
+ declare function defineMotionTheme(tag?: string): CustomElementConstructor | undefined;
416
427
 
417
428
  interface AnimationTrack {
418
429
  /** Selector inside the player (`:scope` = the player). */
@@ -541,5 +552,5 @@ declare function defineEffectElements(): void;
541
552
  /** Register the built-ins and every pack (idempotent). */
542
553
  declare function registerAllEffects(): void;
543
554
 
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 };
555
+ 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, THEMES, THEME_FX, THEME_NAMES, THEME_ROLES, angleDelta, applyMotionTheme, applyTheme, bindBeat, bindGesture, bounceKeyframes, bumpCount, canvasBackground, createBeatDetector, createPlayer, defineAudio, defineEffectElements, defineGestureFx, defineMotionTheme, 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 };
545
556
  export type { AnimationJSON, AnimationTrack, AudioInput, AudioReactive, AudioSample, BeatOptions, GenFrame, GenerativeSpec, GestureDetail, GestureFxOptions, GestureName, Player, SpringOptions, StoryTemplate, ThemePack, ThemeRole, UsaAudioElement, UsaGestureFxElement, UsaPlayerElement, UsaStoryElement, UsaThemeElement };
@@ -7,7 +7,7 @@ export { n as noise2 } from '../chunks/generative-2LhxG5BJ.js';
7
7
  import { A as AUDIO_FX, d as defineAudio } from '../chunks/audio-CynhhWDi.js';
8
8
  export { b as bindBeat, c as createBeatDetector, a as disableAudio, e as enableAudio, g as getAudio, o as onBeat } from '../chunks/audio-CynhhWDi.js';
9
9
  import { playEffect, bindEffect, registerEffects } from '../chunks/registry-CnO7ZVPK.js';
10
- import { u as defineElement, B as adoptStyles } from '../chunks/base-CLuqlLfG.js';
10
+ import { u as defineElement, B as adoptStyles, C as deprecate } from '../chunks/base-CLuqlLfG.js';
11
11
  import { applyMotionTokens, motionTokensToVars, mergeMotionTokens } from './tokens.js';
12
12
  import '../chunks/builtins-Bs4smevg.js';
13
13
  import '../chunks/core-CiN5sqxB.js';
@@ -1158,6 +1158,10 @@ const THEMES = {
1158
1158
  },
1159
1159
  };
1160
1160
  const THEME_NAMES = Object.keys(THEMES);
1161
+ /** The 5.8 motion theme packs (8.9 name of `THEMES`). */
1162
+ const MOTION_THEMES = THEMES;
1163
+ /** Names of the 5.8 motion theme packs (8.9 name of `THEME_NAMES`). */
1164
+ const MOTION_THEME_NAMES = THEME_NAMES;
1161
1165
  const BASE_CSS = `[data-usa-theme]{background:var(--usa-theme-bg);color:var(--usa-theme-fg);font-family:var(--usa-theme-font)}
1162
1166
  [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
1167
  [data-usa-theme] .usa-accent{color:var(--usa-theme-accent)}
@@ -1181,8 +1185,16 @@ function themeCss(t, selector) {
1181
1185
  const p = pack(t);
1182
1186
  return `${selector || `[data-usa-theme=${p.name}]`}{${Object.entries(themeVars(p)).map(([k, v]) => `${k}:${v}`).join(';')}}`;
1183
1187
  }
1184
- /** Apply a theme to `root` (default `<html>`). Returns an undo. */
1188
+ /**
1189
+ * Apply a motion theme to `root` (default `<html>`). Returns an undo.
1190
+ * @deprecated 8.9 — removed in 9.0. Use `applyMotionTheme()` (same signature); `npx usa-codemod-9 --write src`.
1191
+ */
1185
1192
  function applyTheme(t, root) {
1193
+ deprecate('applyTheme', 'applyTheme() is deprecated and removed in 9.0 — use applyMotionTheme() (same signature). Run `npx usa-codemod-9 --write src`.');
1194
+ return applyMotionTheme(t, root);
1195
+ }
1196
+ /** Apply a 5.8 motion theme to `root` (default `<html>`). Returns an undo (8.9). */
1197
+ function applyMotionTheme(t, root) {
1186
1198
  const p = pack(t);
1187
1199
  const el = root || document.documentElement;
1188
1200
  adoptStyles('usa-theme', BASE_CSS);
@@ -1281,7 +1293,9 @@ function defineTheme(tag = 'usa-theme') {
1281
1293
  return THEMES[n] ? n : 'neon';
1282
1294
  }
1283
1295
  mount() {
1284
- this.onCleanup(applyTheme(this.theme, this));
1296
+ if (this.localName === 'usa-theme')
1297
+ deprecate('usa-theme', '<usa-theme> is deprecated and removed in 9.0 — use <usa-motion-theme> (same name / data-theme-fx). Run `npx usa-codemod-9 --write src`.');
1298
+ this.onCleanup(applyMotionTheme(this.theme, this));
1285
1299
  this.querySelectorAll('[data-theme-fx]').forEach((el) => {
1286
1300
  const role = (el.dataset.themeFx || 'click');
1287
1301
  if (!THEME_ROLES.includes(role))
@@ -1298,6 +1312,10 @@ function defineTheme(tag = 'usa-theme') {
1298
1312
  }
1299
1313
  }, { id: 'usa-theme-el', text: 'usa-theme{display:block}' });
1300
1314
  }
1315
+ /** `<usa-motion-theme name="neon">` — the 8.9 name of `<usa-theme>` (removed in 9.0). */
1316
+ function defineMotionTheme(tag = 'usa-motion-theme') {
1317
+ return defineTheme(tag);
1318
+ }
1301
1319
 
1302
1320
  /**
1303
1321
  * motionary/components/effects — the 5.x effect packs, all
@@ -1357,6 +1375,7 @@ function defineEffectElements() {
1357
1375
  defineAudio();
1358
1376
  defineGestureFx();
1359
1377
  defineTheme();
1378
+ defineMotionTheme();
1360
1379
  definePlayer();
1361
1380
  }
1362
1381
  /** Register the built-ins and every pack (idempotent). */
@@ -1366,5 +1385,5 @@ function registerAllEffects() {
1366
1385
  registerEffects(defs);
1367
1386
  }
1368
1387
 
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 };
1388
+ 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, THEMES, THEME_FX, THEME_NAMES, THEME_ROLES, angleDelta, applyMotionTheme, applyTheme, bindGesture, bounceKeyframes, bumpCount, canvasBackground, defineAudio, defineEffectElements, defineGestureFx, defineMotionTheme, definePlayer, defineStory, defineTheme, flingVelocity, fxLayer, hexRgb, playThemeEffect, registerAllEffects, registerAudioEffects, registerCardClickEffects, registerCursorEffects, registerGenerativeEffects, registerMicroEffects, registerPageEffects, registerPhysicsEffects, solveSpring, springKeyframes, swapLabel, themeCss, themePreset, themeVars, togglePressed };
1370
1389
  //# sourceMappingURL=effects.js.map