use-scroll-animate 8.9.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.
- package/CHANGELOG.md +19 -0
- package/README.md +2 -2
- package/README_ja.md +2 -2
- package/README_zh.md +2 -2
- package/dist/chunks/manifest-B08-vo9G.cjs +81 -0
- package/dist/chunks/manifest-B08-vo9G.cjs.map +1 -0
- package/dist/chunks/manifest-PJ0h8RS_.js +76 -0
- package/dist/chunks/manifest-PJ0h8RS_.js.map +1 -0
- package/dist/components/dsl.cjs +210 -0
- package/dist/components/dsl.cjs.map +1 -0
- package/dist/components/dsl.d.cts +76 -0
- package/dist/components/dsl.d.ts +76 -0
- package/dist/components/dsl.js +203 -0
- package/dist/components/dsl.js.map +1 -0
- package/dist/components/effects.cjs +6 -29
- package/dist/components/effects.cjs.map +1 -1
- package/dist/components/effects.d.cts +3 -14
- package/dist/components/effects.d.ts +3 -14
- package/dist/components/effects.js +8 -27
- package/dist/components/effects.js.map +1 -1
- package/dist/components/fx2.cjs +5 -5
- package/dist/components/fx2.js +1 -1
- package/dist/components/marketplace.cjs +81 -71
- package/dist/components/marketplace.cjs.map +1 -1
- package/dist/components/marketplace.d.cts +33 -2
- package/dist/components/marketplace.d.ts +33 -2
- package/dist/components/marketplace.js +73 -68
- package/dist/components/marketplace.js.map +1 -1
- package/dist/components/widgets.cjs +323 -198
- package/dist/components/widgets.cjs.map +1 -1
- package/dist/components/widgets.d.cts +95 -2
- package/dist/components/widgets.d.ts +95 -2
- package/dist/components/widgets.js +322 -199
- package/dist/components/widgets.js.map +1 -1
- package/dist/components.umd.js +2 -2
- package/dist/components.umd.js.map +1 -1
- package/dist/widgets.umd.js +1 -1
- package/dist/widgets.umd.js.map +1 -1
- package/docs/ROADMAP.md +12 -14
- package/docs/components.md +25 -5
- package/docs/deprecations.md +1 -1
- package/docs/upgrading-9.md +11 -1
- package/package.json +31 -1
|
@@ -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
|
-
* - `
|
|
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,21 +392,12 @@ 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[];
|
|
397
|
-
/** The 5.8 motion theme packs (8.9 name of `THEMES`). */
|
|
398
395
|
declare const MOTION_THEMES: Record<string, ThemePack>;
|
|
399
|
-
/** Names of the 5.8 motion theme packs (8.9 name of `THEME_NAMES`). */
|
|
400
396
|
declare const MOTION_THEME_NAMES: string[];
|
|
401
397
|
/** The CSS custom properties of a theme (design + motion tokens). */
|
|
402
398
|
declare function themeVars(t: string | ThemePack): Record<string, string>;
|
|
403
399
|
/** A theme as a CSS rule (`selector` default `[data-usa-theme=<name>]`) — for SSR / static CSS. */
|
|
404
400
|
declare function themeCss(t: string | ThemePack, selector?: string): string;
|
|
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
|
-
*/
|
|
409
|
-
declare function applyTheme(t: string | ThemePack, root?: HTMLElement): () => void;
|
|
410
401
|
/** Apply a 5.8 motion theme to `root` (default `<html>`). Returns an undo (8.9). */
|
|
411
402
|
declare function applyMotionTheme(t: string | ThemePack, root?: HTMLElement): () => void;
|
|
412
403
|
/** The effect preset of a theme for a role. */
|
|
@@ -421,8 +412,6 @@ interface UsaThemeElement extends UsaElement {
|
|
|
421
412
|
readonly theme: string;
|
|
422
413
|
}
|
|
423
414
|
/** `<usa-theme name="neon | paper | glass | retro | brutalist">` — a themed subtree. */
|
|
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
415
|
declare function defineMotionTheme(tag?: string): CustomElementConstructor | undefined;
|
|
427
416
|
|
|
428
417
|
interface AnimationTrack {
|
|
@@ -552,5 +541,5 @@ declare function defineEffectElements(): void;
|
|
|
552
541
|
/** Register the built-ins and every pack (idempotent). */
|
|
553
542
|
declare function registerAllEffects(): void;
|
|
554
543
|
|
|
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,
|
|
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 };
|
|
556
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
|
-
* - `
|
|
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,21 +392,12 @@ 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[];
|
|
397
|
-
/** The 5.8 motion theme packs (8.9 name of `THEMES`). */
|
|
398
395
|
declare const MOTION_THEMES: Record<string, ThemePack>;
|
|
399
|
-
/** Names of the 5.8 motion theme packs (8.9 name of `THEME_NAMES`). */
|
|
400
396
|
declare const MOTION_THEME_NAMES: string[];
|
|
401
397
|
/** The CSS custom properties of a theme (design + motion tokens). */
|
|
402
398
|
declare function themeVars(t: string | ThemePack): Record<string, string>;
|
|
403
399
|
/** A theme as a CSS rule (`selector` default `[data-usa-theme=<name>]`) — for SSR / static CSS. */
|
|
404
400
|
declare function themeCss(t: string | ThemePack, selector?: string): string;
|
|
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
|
-
*/
|
|
409
|
-
declare function applyTheme(t: string | ThemePack, root?: HTMLElement): () => void;
|
|
410
401
|
/** Apply a 5.8 motion theme to `root` (default `<html>`). Returns an undo (8.9). */
|
|
411
402
|
declare function applyMotionTheme(t: string | ThemePack, root?: HTMLElement): () => void;
|
|
412
403
|
/** The effect preset of a theme for a role. */
|
|
@@ -421,8 +412,6 @@ interface UsaThemeElement extends UsaElement {
|
|
|
421
412
|
readonly theme: string;
|
|
422
413
|
}
|
|
423
414
|
/** `<usa-theme name="neon | paper | glass | retro | brutalist">` — a themed subtree. */
|
|
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
415
|
declare function defineMotionTheme(tag?: string): CustomElementConstructor | undefined;
|
|
427
416
|
|
|
428
417
|
interface AnimationTrack {
|
|
@@ -552,5 +541,5 @@ declare function defineEffectElements(): void;
|
|
|
552
541
|
/** Register the built-ins and every pack (idempotent). */
|
|
553
542
|
declare function registerAllEffects(): void;
|
|
554
543
|
|
|
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,
|
|
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 };
|
|
556
545
|
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
|
|
10
|
+
import { u as defineElement, B as adoptStyles } 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';
|
|
@@ -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
|
|
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,19 +1157,15 @@ const THEMES = {
|
|
|
1157
1157
|
presets: P('drop-bounce', 'jelly', 'brutal-shift', 'shake', 'voronoi'),
|
|
1158
1158
|
},
|
|
1159
1159
|
};
|
|
1160
|
-
const
|
|
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;
|
|
1160
|
+
const MOTION_THEME_NAMES = Object.keys(MOTION_THEMES);
|
|
1165
1161
|
const BASE_CSS = `[data-usa-theme]{background:var(--usa-theme-bg);color:var(--usa-theme-fg);font-family:var(--usa-theme-font)}
|
|
1166
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)}
|
|
1167
1163
|
[data-usa-theme] .usa-accent{color:var(--usa-theme-accent)}
|
|
1168
1164
|
[data-usa-theme=glass] .usa-surface{-webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px)}`;
|
|
1169
1165
|
const pack = (t) => {
|
|
1170
|
-
const p = typeof t === 'string' ?
|
|
1166
|
+
const p = typeof t === 'string' ? MOTION_THEMES[t] : t;
|
|
1171
1167
|
if (!p)
|
|
1172
|
-
throw new Error(`[motionary] unknown theme "${String(t)}" — ${
|
|
1168
|
+
throw new Error(`[motionary] unknown theme "${String(t)}" — ${MOTION_THEME_NAMES.join(', ')}`);
|
|
1173
1169
|
return p;
|
|
1174
1170
|
};
|
|
1175
1171
|
/** The CSS custom properties of a theme (design + motion tokens). */
|
|
@@ -1185,14 +1181,6 @@ function themeCss(t, selector) {
|
|
|
1185
1181
|
const p = pack(t);
|
|
1186
1182
|
return `${selector || `[data-usa-theme=${p.name}]`}{${Object.entries(themeVars(p)).map(([k, v]) => `${k}:${v}`).join(';')}}`;
|
|
1187
1183
|
}
|
|
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
|
-
*/
|
|
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
1184
|
/** Apply a 5.8 motion theme to `root` (default `<html>`). Returns an undo (8.9). */
|
|
1197
1185
|
function applyMotionTheme(t, root) {
|
|
1198
1186
|
const p = pack(t);
|
|
@@ -1283,18 +1271,16 @@ const THEME_FX = [
|
|
|
1283
1271
|
},
|
|
1284
1272
|
];
|
|
1285
1273
|
/** `<usa-theme name="neon | paper | glass | retro | brutalist">` — a themed subtree. */
|
|
1286
|
-
function
|
|
1274
|
+
function defineMotionTheme(tag = 'usa-motion-theme') {
|
|
1287
1275
|
return defineElement(tag, (Base) => class UsaTheme extends Base {
|
|
1288
1276
|
static get observedAttributes() {
|
|
1289
1277
|
return ['name'];
|
|
1290
1278
|
}
|
|
1291
1279
|
get theme() {
|
|
1292
1280
|
const n = this.str('name', 'neon');
|
|
1293
|
-
return
|
|
1281
|
+
return MOTION_THEMES[n] ? n : 'neon';
|
|
1294
1282
|
}
|
|
1295
1283
|
mount() {
|
|
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
1284
|
this.onCleanup(applyMotionTheme(this.theme, this));
|
|
1299
1285
|
this.querySelectorAll('[data-theme-fx]').forEach((el) => {
|
|
1300
1286
|
const role = (el.dataset.themeFx || 'click');
|
|
@@ -1312,10 +1298,6 @@ function defineTheme(tag = 'usa-theme') {
|
|
|
1312
1298
|
}
|
|
1313
1299
|
}, { id: 'usa-theme-el', text: 'usa-theme{display:block}' });
|
|
1314
1300
|
}
|
|
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
|
-
}
|
|
1319
1301
|
|
|
1320
1302
|
/**
|
|
1321
1303
|
* motionary/components/effects — the 5.x effect packs, all
|
|
@@ -1374,7 +1356,6 @@ function defineEffectElements() {
|
|
|
1374
1356
|
defineStory();
|
|
1375
1357
|
defineAudio();
|
|
1376
1358
|
defineGestureFx();
|
|
1377
|
-
defineTheme();
|
|
1378
1359
|
defineMotionTheme();
|
|
1379
1360
|
definePlayer();
|
|
1380
1361
|
}
|
|
@@ -1385,5 +1366,5 @@ function registerAllEffects() {
|
|
|
1385
1366
|
registerEffects(defs);
|
|
1386
1367
|
}
|
|
1387
1368
|
|
|
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,
|
|
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 };
|
|
1389
1370
|
//# sourceMappingURL=effects.js.map
|