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.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,37 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [8.9.0] - 2026-10-09
11
+
12
+ ### Added
13
+ - **Low-code component export (8.9)** in `motionary/components/widgets` (also in `dist/widgets.umd.js`):
14
+ - `exportComponent(el, 'html' | 'react' | 'vue' | 'json')` — copy-paste code for any live, configured element (runtime attributes / generated parts stripped; HTML gets a CDN module import, React a `useEffect(defineWidgets)` component, Vue an SFC); `describeComponent(el)` — the portable JSON (`motionary/component@1`) the 9.0 declarative DSL reads.
15
+ - `<usa-code-export>` — shows that code in HTML / React / Vue / JSON tabs (`formats`) for its child or `for` target, follows attribute changes, one-click copy (`copy()`, `usa:copy` { format, ok }); `format`, `code`.
16
+ - `<usa-prop-panel>` — property editor bound to a live component's attributes (`for` selector or `previous`): `props="value:number:0:100, icon:select:star|heart, readonly:boolean, color:color, label:text"` (falls back to its `observedAttributes`); `reset()` (also a Reset button); `usa:prop` { name, value }; `parseProps()`.
17
+ - `usa-codemod-9` (`npx usa-codemod-9 --write src`) and [docs/upgrading-9.md](docs/upgrading-9.md).
18
+ - `applyMotionTheme()`, `MOTION_THEMES`, `MOTION_THEME_NAMES`, `<usa-motion-theme>` / `defineMotionTheme()` — the 9.0 names of the 5.8 motion-theme API (`motionary/components/effects`).
19
+
20
+ ### Deprecated (removed in 9.0)
21
+ - `applyTheme()`, `THEMES`, `THEME_NAMES`, `<usa-theme>` / `defineTheme()` — renamed with a `Motion` prefix so they can't be confused with the 8.6 surface themes (`applySurfaceTheme`, `SURFACE_THEMES`). `applyTheme()` and `<usa-theme>` warn once in the console; the codemod rewrites identifiers and tags.
22
+
23
+ ### Accessibility
24
+ - Code export: a `tablist` with arrow keys and a focusable `tabpanel`; the copy button reports "Copied ✓" in text. Property panel: a labelled `form` with a `<label>` for every field, `<output>` readouts and `role="switch"` checkboxes.
25
+
26
+ ### Fixed
27
+ - the low-code export test checked the whole `<usa-hud-panel>` description for `usa-hud` (always present in the tag name); it now checks that the generated HUD parts are stripped from the children.
28
+
29
+ ## [8.8.0] - 2026-10-09
30
+
31
+ ### Added
32
+ - **2 new components (8.8)** in `motionary/components/widgets` (also in `dist/widgets.umd.js`):
33
+ - `<usa-panorama>` — 360° panorama viewer: drag / swipe to look around with inertia, slow `autorotate` (°/s, `0` off, pauses on hover / focus), ← / → keys, compass, built-in procedural landscape when no `src`; "View in XR" badge when WebXR immersive sessions are offered (`usa:xr` { mode }, `usa:xr-request`); `yaw`, `lookAt(deg)`; `usa:look` { yaw }.
34
+ - `<usa-spatial-card>` — spatial-computing window: frosted glass floating in depth, gaze highlight following the pointer, `[data-depth]` layers, `[slot=ornament]` bar below the window; eases forward on hover / focus, sinks on press; `active`; `usa:focus-depth` { active }.
35
+ - **XR / spatial pack — `motionary/fx/spatial`** (= `motionary/components/fx-spatial`, `registerSpatialPack()`, also in `registerEffectPacks()`): `portal-open` (enter), `orbit-in` (enter), `spatial-float` (loop), `depth-pop` (attention). `yawToOffset()`, `xrSupport()` (WebXR session detection).
36
+ - Showcase: 4 new gallery cards with copyable code, live demos and live Store thumbnails.
37
+
38
+ ### Accessibility
39
+ - The panorama is a focusable `img` (roledescription "panorama") with your `label`; ← / → look around; auto-rotate pauses while hovered or focused. The spatial card keeps its content in reading order, the gaze layer is `aria-hidden`. Reduced motion: no auto-rotate, inertia or depth transitions; `portal-open` / `orbit-in` just show, `spatial-float` is skipped, `depth-pop` does nothing.
40
+
10
41
  ## [8.7.0] - 2026-10-09
11
42
 
12
43
  ### Added
@@ -0,0 +1,71 @@
1
+ #!/usr/bin/env node
2
+ // motionary 8.x → 9.0 codemod.
3
+ // npx usa-codemod-9 [--write] [paths…] (default: ./src; dry run without --write)
4
+ // Rewrites (8.9 deprecations, removed in 9.0):
5
+ // 1. applyTheme → applyMotionTheme, THEMES → MOTION_THEMES, THEME_NAMES → MOTION_THEME_NAMES
6
+ // (the 5.8 motion-theme API of motionary/components/effects; the 8.6 surface themes are
7
+ // applySurfaceTheme / SURFACE_THEMES and are not touched).
8
+ // 2. <usa-theme …> → <usa-motion-theme …> (<usa-theme-switcher> / <usa-theme-surface> untouched).
9
+ // Reported for a manual change:
10
+ // 3. document.createElement('usa-theme'), CSS selectors on usa-theme.
11
+ import { readFileSync, writeFileSync, readdirSync, statSync } from 'node:fs';
12
+ import { join, extname } from 'node:path';
13
+ import { pathToFileURL } from 'node:url';
14
+
15
+ const EXT = new Set(['.js', '.mjs', '.cjs', '.jsx', '.ts', '.tsx', '.mts', '.cts', '.vue', '.svelte', '.html', '.astro', '.md', '.mdx', '.css', '.scss']);
16
+ export const RENAMES = { applyTheme: 'applyMotionTheme', THEMES: 'MOTION_THEMES', THEME_NAMES: 'MOTION_THEME_NAMES' };
17
+ export const TAGS = { 'usa-theme': 'usa-motion-theme' };
18
+
19
+ /** Apply every rewrite to one file's source. Returns { code, changes, manual }. */
20
+ export function transform(source) {
21
+ const changes = [];
22
+ const manual = [];
23
+ let code = source;
24
+ for (const [from, to] of Object.entries(RENAMES)) {
25
+ const re = new RegExp(`(?<![\\w$.])${from}(?![\\w$])`, 'g');
26
+ const n = (code.match(re) || []).length;
27
+ if (n) {
28
+ code = code.replace(re, to);
29
+ changes.push(`${from} → ${to} (${n}×)`);
30
+ }
31
+ }
32
+ let t = 0;
33
+ code = code.replace(/<(\/?)usa-theme(?=[\s>/])/g, (_, slash) => {
34
+ t++;
35
+ return `<${slash}usa-motion-theme`;
36
+ });
37
+ if (t) changes.push(`<usa-theme> → <usa-motion-theme> (${t}×)`);
38
+ if (/createElement\((['"`])usa-theme\1\)/.test(code)) manual.push("document.createElement('usa-theme') — use 'usa-motion-theme' (removed in 9.0)");
39
+ if (/(^|[\s,{}>+~])usa-theme(?=[\s.:#[{,>+~)]|$)/m.test(code.replace(/<\/?[a-z][^>]*>/g, ''))) manual.push('CSS selectors on usa-theme — select usa-motion-theme');
40
+ return { code, changes, manual };
41
+ }
42
+
43
+ function* walk(p) {
44
+ const st = statSync(p);
45
+ if (st.isDirectory()) {
46
+ for (const f of readdirSync(p)) if (!['node_modules', 'dist', '.git'].includes(f)) yield* walk(join(p, f));
47
+ } else if (EXT.has(extname(p))) yield p;
48
+ }
49
+
50
+ export function run(args) {
51
+ const write = args.includes('--write');
52
+ const paths = args.filter((a) => !a.startsWith('--'));
53
+ let files = 0;
54
+ let edits = 0;
55
+ let todo = 0;
56
+ for (const root of paths.length ? paths : ['src'])
57
+ for (const f of walk(root)) {
58
+ const src = readFileSync(f, 'utf8');
59
+ const { code, changes, manual } = transform(src);
60
+ if (!changes.length && !manual.length) continue;
61
+ files++;
62
+ edits += changes.length;
63
+ todo += manual.length;
64
+ console.log(`${f}${changes.map((c) => `\n - ${c}`).join('')}${manual.map((c) => `\n ! manual: ${c}`).join('')}`);
65
+ if (write && changes.length) writeFileSync(f, code);
66
+ }
67
+ console.log(`\n${files} file(s), ${edits} rewrite(s)${write ? ' applied' : ' (dry run — pass --write to apply)'}, ${todo} manual change(s).`);
68
+ return { files, edits, todo };
69
+ }
70
+
71
+ if (import.meta.url === pathToFileURL(process.argv[1] || '').href) run(process.argv.slice(2));
@@ -1157,6 +1157,10 @@ const THEMES = {
1157
1157
  },
1158
1158
  };
1159
1159
  const THEME_NAMES = Object.keys(THEMES);
1160
+ /** The 5.8 motion theme packs (8.9 name of `THEMES`). */
1161
+ const MOTION_THEMES = THEMES;
1162
+ /** Names of the 5.8 motion theme packs (8.9 name of `THEME_NAMES`). */
1163
+ const MOTION_THEME_NAMES = THEME_NAMES;
1160
1164
  const BASE_CSS = `[data-usa-theme]{background:var(--usa-theme-bg);color:var(--usa-theme-fg);font-family:var(--usa-theme-font)}
1161
1165
  [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)}
1162
1166
  [data-usa-theme] .usa-accent{color:var(--usa-theme-accent)}
@@ -1180,8 +1184,16 @@ function themeCss(t, selector) {
1180
1184
  const p = pack(t);
1181
1185
  return `${selector || `[data-usa-theme=${p.name}]`}{${Object.entries(themeVars(p)).map(([k, v]) => `${k}:${v}`).join(';')}}`;
1182
1186
  }
1183
- /** Apply a theme to `root` (default `<html>`). Returns an undo. */
1187
+ /**
1188
+ * Apply a motion theme to `root` (default `<html>`). Returns an undo.
1189
+ * @deprecated 8.9 — removed in 9.0. Use `applyMotionTheme()` (same signature); `npx usa-codemod-9 --write src`.
1190
+ */
1184
1191
  function applyTheme(t, root) {
1192
+ base.deprecate('applyTheme', 'applyTheme() is deprecated and removed in 9.0 — use applyMotionTheme() (same signature). Run `npx usa-codemod-9 --write src`.');
1193
+ return applyMotionTheme(t, root);
1194
+ }
1195
+ /** Apply a 5.8 motion theme to `root` (default `<html>`). Returns an undo (8.9). */
1196
+ function applyMotionTheme(t, root) {
1185
1197
  const p = pack(t);
1186
1198
  const el = root || document.documentElement;
1187
1199
  base.adoptStyles('usa-theme', BASE_CSS);
@@ -1280,7 +1292,9 @@ function defineTheme(tag = 'usa-theme') {
1280
1292
  return THEMES[n] ? n : 'neon';
1281
1293
  }
1282
1294
  mount() {
1283
- this.onCleanup(applyTheme(this.theme, this));
1295
+ if (this.localName === 'usa-theme')
1296
+ base.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`.');
1297
+ this.onCleanup(applyMotionTheme(this.theme, this));
1284
1298
  this.querySelectorAll('[data-theme-fx]').forEach((el) => {
1285
1299
  const role = (el.dataset.themeFx || 'click');
1286
1300
  if (!THEME_ROLES.includes(role))
@@ -1297,6 +1311,10 @@ function defineTheme(tag = 'usa-theme') {
1297
1311
  }
1298
1312
  }, { id: 'usa-theme-el', text: 'usa-theme{display:block}' });
1299
1313
  }
1314
+ /** `<usa-motion-theme name="neon">` — the 8.9 name of `<usa-theme>` (removed in 9.0). */
1315
+ function defineMotionTheme(tag = 'usa-motion-theme') {
1316
+ return defineTheme(tag);
1317
+ }
1300
1318
 
1301
1319
  /**
1302
1320
  * motionary/components/effects — the 5.x effect packs, all
@@ -1356,6 +1374,7 @@ function defineEffectElements() {
1356
1374
  audio.defineAudio();
1357
1375
  defineGestureFx();
1358
1376
  defineTheme();
1377
+ defineMotionTheme();
1359
1378
  player.definePlayer();
1360
1379
  }
1361
1380
  /** Register the built-ins and every pack (idempotent). */
@@ -1392,6 +1411,8 @@ exports.CURSOR_FX = CURSOR_FX;
1392
1411
  exports.EFFECT_PACKS = EFFECT_PACKS;
1393
1412
  exports.GESTURES = GESTURES;
1394
1413
  exports.MICRO_FX = MICRO_FX;
1414
+ exports.MOTION_THEMES = MOTION_THEMES;
1415
+ exports.MOTION_THEME_NAMES = MOTION_THEME_NAMES;
1395
1416
  exports.PAGE_FX = PAGE_FX;
1396
1417
  exports.PHYSICS_FX = PHYSICS_FX;
1397
1418
  exports.THEMES = THEMES;
@@ -1399,12 +1420,14 @@ exports.THEME_FX = THEME_FX;
1399
1420
  exports.THEME_NAMES = THEME_NAMES;
1400
1421
  exports.THEME_ROLES = THEME_ROLES;
1401
1422
  exports.angleDelta = angleDelta;
1423
+ exports.applyMotionTheme = applyMotionTheme;
1402
1424
  exports.applyTheme = applyTheme;
1403
1425
  exports.bindGesture = bindGesture;
1404
1426
  exports.bounceKeyframes = bounceKeyframes;
1405
1427
  exports.bumpCount = bumpCount;
1406
1428
  exports.defineEffectElements = defineEffectElements;
1407
1429
  exports.defineGestureFx = defineGestureFx;
1430
+ exports.defineMotionTheme = defineMotionTheme;
1408
1431
  exports.defineTheme = defineTheme;
1409
1432
  exports.flingVelocity = flingVelocity;
1410
1433
  exports.playThemeEffect = playThemeEffect;