use-scroll-animate 4.8.0 → 4.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 +14 -0
- package/bin/usa-codemod-5.mjs +79 -0
- package/dist/chunks/{base-CxYU2NK_.cjs → base-BvpQ4Ggj.cjs} +30 -1
- package/dist/chunks/base-BvpQ4Ggj.cjs.map +1 -0
- package/dist/chunks/{base-CZiIAMBc.js → base-DbbRUxaa.js} +29 -2
- package/dist/chunks/base-DbbRUxaa.js.map +1 -0
- package/dist/chunks/{core-CJHJeMI_.js → core-BVTuet9o.js} +2 -2
- package/dist/chunks/{core-CJHJeMI_.js.map → core-BVTuet9o.js.map} +1 -1
- package/dist/chunks/{core-HLqH3qkA.cjs → core-BWO7JKJ5.cjs} +2 -2
- package/dist/chunks/{core-HLqH3qkA.cjs.map → core-BWO7JKJ5.cjs.map} +1 -1
- package/dist/chunks/{core-CctNfzuP.cjs → core-CCAM3nKw.cjs} +2 -2
- package/dist/chunks/{core-CctNfzuP.cjs.map → core-CCAM3nKw.cjs.map} +1 -1
- package/dist/chunks/{core-COi3DrLx.js → core-CcaSsbV8.js} +2 -2
- package/dist/chunks/{core-COi3DrLx.js.map → core-CcaSsbV8.js.map} +1 -1
- package/dist/chunks/{spring-BS5tg6aK.js → spring-B6w7mVCU.js} +2 -2
- package/dist/chunks/{spring-BS5tg6aK.js.map → spring-B6w7mVCU.js.map} +1 -1
- package/dist/chunks/{spring-Dkpygsuj.cjs → spring-fFkqE9J0.cjs} +2 -2
- package/dist/chunks/{spring-Dkpygsuj.cjs.map → spring-fFkqE9J0.cjs.map} +1 -1
- package/dist/chunks/{variants-CfJzrzMh.cjs → variants-C8xj8gfd.cjs} +2 -2
- package/dist/chunks/{variants-CfJzrzMh.cjs.map → variants-C8xj8gfd.cjs.map} +1 -1
- package/dist/chunks/{variants-D9n-3x27.js → variants-Cal4DB0E.js} +2 -2
- package/dist/chunks/{variants-D9n-3x27.js.map → variants-Cal4DB0E.js.map} +1 -1
- package/dist/components/a11y.cjs +37 -1
- package/dist/components/a11y.cjs.map +1 -1
- package/dist/components/a11y.d.cts +12 -2
- package/dist/components/a11y.d.ts +12 -2
- package/dist/components/a11y.js +37 -3
- package/dist/components/a11y.js.map +1 -1
- package/dist/components/angular.cjs +5 -5
- package/dist/components/angular.js +5 -5
- package/dist/components/background.cjs +2 -2
- package/dist/components/background.js +3 -3
- package/dist/components/bridge.cjs +1 -1
- package/dist/components/bridge.js +1 -1
- package/dist/components/cards.cjs +2 -2
- package/dist/components/cards.js +3 -3
- package/dist/components/click.cjs +2 -2
- package/dist/components/click.js +3 -3
- package/dist/components/depth.cjs +3 -3
- package/dist/components/depth.js +4 -4
- package/dist/components/feedback.cjs +1 -1
- package/dist/components/feedback.js +2 -2
- package/dist/components/gesture.cjs +3 -3
- package/dist/components/gesture.js +5 -5
- package/dist/components/interaction.cjs +1 -1
- package/dist/components/interaction.js +2 -2
- package/dist/components/layout.cjs +1 -1
- package/dist/components/layout.js +2 -2
- package/dist/components/lite.cjs +75 -2
- package/dist/components/lite.cjs.map +1 -1
- package/dist/components/lite.js +74 -3
- package/dist/components/lite.js.map +1 -1
- package/dist/components/packs.cjs +1 -1
- package/dist/components/packs.js +2 -2
- package/dist/components/page.cjs +12 -4
- package/dist/components/page.cjs.map +1 -1
- package/dist/components/page.js +13 -5
- package/dist/components/page.js.map +1 -1
- package/dist/components/perf.cjs +1 -1
- package/dist/components/perf.js +2 -2
- package/dist/components/physics.cjs +2 -2
- package/dist/components/physics.js +4 -4
- package/dist/components/reveal.cjs +1 -1
- package/dist/components/reveal.js +2 -2
- package/dist/components/solid.cjs +5 -5
- package/dist/components/solid.js +5 -5
- package/dist/components/svelte.cjs +5 -5
- package/dist/components/svelte.js +5 -5
- package/dist/components/svg.cjs +1 -1
- package/dist/components/svg.js +2 -2
- package/dist/components/text.cjs +2 -2
- package/dist/components/text.js +3 -3
- package/dist/components/timeline.cjs +4 -2
- package/dist/components/timeline.cjs.map +1 -1
- package/dist/components/timeline.js +6 -4
- package/dist/components/timeline.js.map +1 -1
- package/dist/components/transitions.cjs +1 -1
- package/dist/components/transitions.js +2 -2
- package/dist/components/ui.cjs +3 -3
- package/dist/components/ui.js +5 -5
- package/dist/components/vue.cjs +5 -5
- package/dist/components/vue.js +5 -5
- package/dist/components/webgl.cjs +1 -1
- package/dist/components/webgl.js +2 -2
- package/dist/components.cjs +7 -5
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.cts +12 -2
- package/dist/components.d.ts +12 -2
- package/dist/components.js +8 -8
- package/dist/components.umd.js +2 -2
- package/dist/components.umd.js.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/docs/ROADMAP.md +1 -1
- package/docs/deprecations.md +6 -0
- package/docs/upgrading-5.md +31 -0
- package/package.json +5 -1
- package/dist/chunks/base-CZiIAMBc.js.map +0 -1
- package/dist/chunks/base-CxYU2NK_.cjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as adoptStyles } from './base-DbbRUxaa.js';
|
|
2
2
|
|
|
3
3
|
var css = ":root{--usa-accent:#7c5cff;--usa-accent-text:#fff;--usa-surface:#1b1e27;--usa-text:inherit;--usa-radius:14px;--usa-border:1px solid rgb(127 127 127 / 0.25);--usa-shadow:0 10px 30px -12px rgb(0 0 0 / 0.45);--usa-blur:0px;--usa-font:inherit}:where([variant=\"minimal\"],[data-usa-variant=\"minimal\"]){--usa-accent:currentColor;--usa-accent-text:Canvas;--usa-surface:transparent;--usa-radius:6px;--usa-border:1px solid color-mix(in srgb,currentColor 22%,transparent);--usa-shadow:none;--usa-blur:0px}:where([variant=\"neon\"],[data-usa-variant=\"neon\"]){--usa-accent:#00f0ff;--usa-accent-text:#04121a;--usa-surface:#0a0b14;--usa-text:#e6fbff;--usa-radius:10px;--usa-border:1px solid #00f0ff;--usa-shadow:0 0 6px #00f0ff,0 0 22px rgb(0 240 255 / 0.45);--usa-blur:0px}:where([variant=\"glass\"],[data-usa-variant=\"glass\"]){--usa-accent:#a78bfa;--usa-accent-text:#fff;--usa-surface:rgb(255 255 255 / 0.12);--usa-radius:18px;--usa-border:1px solid rgb(255 255 255 / 0.28);--usa-shadow:0 12px 40px -12px rgb(0 0 0 / 0.35);--usa-blur:16px}:where([variant=\"brutalist\"],[data-usa-variant=\"brutalist\"]){--usa-accent:#ff3d00;--usa-accent-text:#000;--usa-surface:#fff;--usa-text:#000;--usa-radius:0px;--usa-border:3px solid #000;--usa-shadow:5px 5px 0 #000;--usa-blur:0px;--usa-font:ui-monospace,\"SFMono-Regular\",Menlo,monospace}:where([variant=\"fluent\"],[data-usa-variant=\"fluent\"]){--usa-accent:#0067c0;--usa-accent-text:#fff;--usa-surface:rgb(249 249 249 / 0.82);--usa-text:#1a1a1a;--usa-radius:8px;--usa-border:1px solid rgb(0 0 0 / 0.08);--usa-shadow:0 2px 4px rgb(0 0 0 / 0.14),0 0 2px rgb(0 0 0 / 0.12);--usa-blur:30px;--usa-font:\"Segoe UI Variable\",\"Segoe UI\",system-ui,sans-serif}:where([variant=\"material\"],[data-usa-variant=\"material\"]){--usa-accent:#6750a4;--usa-accent-text:#fff;--usa-surface:#fffbfe;--usa-text:#1c1b1f;--usa-radius:20px;--usa-border:0 solid transparent;--usa-shadow:0 1px 3px rgb(0 0 0 / 0.3),0 4px 8px 3px rgb(0 0 0 / 0.15);--usa-blur:0px;--usa-font:Roboto,system-ui,sans-serif}@media (prefers-color-scheme:dark){:where([variant=\"fluent\"],[data-usa-variant=\"fluent\"]){--usa-accent:#4cc2ff;--usa-accent-text:#000;--usa-surface:rgb(44 44 44 / 0.8);--usa-text:#fff;--usa-border:1px solid rgb(255 255 255 / 0.08)}:where([variant=\"material\"],[data-usa-variant=\"material\"]){--usa-accent:#d0bcff;--usa-accent-text:#381e72;--usa-surface:#1c1b1f;--usa-text:#e6e1e5}}.usa-surface{background:var(--usa-surface);color:var(--usa-text);border:var(--usa-border);border-radius:var(--usa-radius);box-shadow:var(--usa-shadow);font-family:var(--usa-font);-webkit-backdrop-filter:blur(var(--usa-blur));backdrop-filter:blur(var(--usa-blur))}@media (prefers-reduced-transparency:reduce){.usa-surface{-webkit-backdrop-filter:none;backdrop-filter:none}}";
|
|
4
4
|
|
|
@@ -32,4 +32,4 @@ function setVariant(variant, root = typeof document !== 'undefined' ? document.d
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
export { VARIANTS as V, adoptVariants as a, setVariant as s };
|
|
35
|
-
//# sourceMappingURL=variants-
|
|
35
|
+
//# sourceMappingURL=variants-Cal4DB0E.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variants-
|
|
1
|
+
{"version":3,"file":"variants-Cal4DB0E.js","sources":["../../src/components/ui/variants.ts"],"sourcesContent":["import { adoptStyles } from '../base';\nimport css from './variants.css?raw';\n\n/**\n * Style variants (v2.6): `variant=\"minimal | neon | glass | brutalist |\n * fluent | material\"` on any `<usa-*>` element — or on any ancestor as\n * `data-usa-variant`, or page-wide with `setVariant()` — sets the shared\n * design tokens every component reads:\n *\n * `--usa-accent`, `--usa-accent-text`, `--usa-surface`, `--usa-text`,\n * `--usa-radius`, `--usa-border`, `--usa-shadow`, `--usa-blur`, `--usa-font`.\n *\n * (`<usa-spinner>`, `<usa-check>` and `<usa-dialog>` already use `variant`\n * for their kind; the token names never clash with those values except\n * `fluent`, which means the same thing there.)\n */\nexport const VARIANTS = ['minimal', 'neon', 'glass', 'brutalist', 'fluent', 'material'] as const;\nexport type Variant = (typeof VARIANTS)[number];\n\n/** Inject the variant token sheet (done automatically by every `ui` component). */\nexport function adoptVariants(): void {\n adoptStyles('variants', css);\n}\n\n/** Apply a variant to the whole page (or `root`); `null` removes it. */\nexport function setVariant(variant: Variant | null, root: Element | null = typeof document !== 'undefined' ? document.documentElement : null): void {\n if (!root) return;\n adoptVariants();\n if (variant) root.setAttribute('data-usa-variant', variant);\n else root.removeAttribute('data-usa-variant');\n}\n"],"names":[],"mappings":";;;;AAGA;;;;;;;;;;;;AAYG;AACI,MAAM,QAAQ,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU;AAGtF;SACgB,aAAa,GAAA;AAC3B,IAAA,WAAW,CAAC,UAAU,EAAE,GAAG,CAAC;AAC9B;AAEA;SACgB,UAAU,CAAC,OAAuB,EAAE,IAAA,GAAuB,OAAO,QAAQ,KAAK,WAAW,GAAG,QAAQ,CAAC,eAAe,GAAG,IAAI,EAAA;AAC1I,IAAA,IAAI,CAAC,IAAI;QAAE;AACX,IAAA,aAAa,EAAE;AACf,IAAA,IAAI,OAAO;AAAE,QAAA,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE,OAAO,CAAC;;AACtD,QAAA,IAAI,CAAC,eAAe,CAAC,kBAAkB,CAAC;AAC/C;;;;"}
|
package/dist/components/a11y.cjs
CHANGED
|
@@ -1,8 +1,42 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var base = require('../chunks/base-
|
|
3
|
+
var base = require('../chunks/base-BvpQ4Ggj.cjs');
|
|
4
4
|
var indexTags = require('../chunks/index-tags-CIRY2KnU.cjs');
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* 4.9 — the 5.0 modern-browser baseline. `baselineReport()` lists which
|
|
8
|
+
* required / progressive features this browser has; `warnBaseline()` logs
|
|
9
|
+
* once in development when a required one is missing.
|
|
10
|
+
*/
|
|
11
|
+
/** Required in 5.0: Custom Elements, WAAPI, IntersectionObserver, ResizeObserver, adoptedStyleSheets. Progressive: View Transitions, scroll-driven animations, WebGL. */
|
|
12
|
+
function baselineReport() {
|
|
13
|
+
const w = (typeof window !== 'undefined' ? window : {});
|
|
14
|
+
const d = (typeof document !== 'undefined' ? document : {});
|
|
15
|
+
const css = (q) => typeof w.CSS?.supports === 'function' && w.CSS.supports(q);
|
|
16
|
+
return [
|
|
17
|
+
{ id: 'custom-elements', required: true, supported: !!w.customElements },
|
|
18
|
+
{ id: 'web-animations', required: true, supported: typeof w.Element?.prototype?.animate === 'function' },
|
|
19
|
+
{ id: 'intersection-observer', required: true, supported: typeof w.IntersectionObserver === 'function' },
|
|
20
|
+
{ id: 'resize-observer', required: true, supported: typeof w.ResizeObserver === 'function' },
|
|
21
|
+
{ id: 'adopted-stylesheets', required: true, supported: 'adoptedStyleSheets' in d },
|
|
22
|
+
{ id: 'view-transitions', required: false, supported: typeof d.startViewTransition === 'function' },
|
|
23
|
+
{ id: 'scroll-driven-animations', required: false, supported: css('animation-timeline: view()') },
|
|
24
|
+
{ id: 'webgl', required: false, supported: !!(d.createElement && (() => { try {
|
|
25
|
+
return d.createElement('canvas').getContext('webgl');
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return null;
|
|
29
|
+
} })()) },
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
/** Log (once) which required 5.0 features are missing here. Returns the missing ids. */
|
|
33
|
+
function warnBaseline() {
|
|
34
|
+
const missing = baselineReport().filter((f) => f.required && !f.supported).map((f) => f.id);
|
|
35
|
+
if (missing.length)
|
|
36
|
+
base.deprecate('baseline', `this browser lacks ${missing.join(', ')}; use-scroll-animate 5.0 requires them (modern-browser baseline, see docs/upgrading-5.md).`);
|
|
37
|
+
return missing;
|
|
38
|
+
}
|
|
39
|
+
|
|
6
40
|
/**
|
|
7
41
|
* use-scroll-animate/components/a11y — accessibility toolkit (4.4).
|
|
8
42
|
*
|
|
@@ -231,9 +265,11 @@ exports.SENSITIVITY_CSS = SENSITIVITY_CSS;
|
|
|
231
265
|
exports.STATIC_ALTERNATIVES = STATIC_ALTERNATIVES;
|
|
232
266
|
exports.announce = announce;
|
|
233
267
|
exports.auditMotionA11y = auditMotionA11y;
|
|
268
|
+
exports.baselineReport = baselineReport;
|
|
234
269
|
exports.liveRegion = liveRegion;
|
|
235
270
|
exports.motionAllowed = motionAllowed;
|
|
236
271
|
exports.restoreMotionSensitivity = restoreMotionSensitivity;
|
|
237
272
|
exports.setMotionSensitivity = setMotionSensitivity;
|
|
238
273
|
exports.staticAlternative = staticAlternative;
|
|
274
|
+
exports.warnBaseline = warnBaseline;
|
|
239
275
|
//# sourceMappingURL=a11y.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"a11y.cjs","sources":["../../src/components/a11y/index.ts"],"sourcesContent":["/**\n * use-scroll-animate/components/a11y — accessibility toolkit (4.4).\n *\n * - Motion-sensitivity levels: `setMotionSensitivity('full' | 'gentle' | 'minimal' | 'static')`.\n * - Static alternatives: what every component shows when motion is off, and\n * `staticAlternative(root)` to freeze any subtree at its final state.\n * - `aria-live` conventions: one shared polite and one assertive region,\n * `announce(message, { politeness })`.\n * - `auditMotionA11y(root)`: the rules the automated regression tests run\n * over every `<usa-*>` element — usable in your own tests too.\n *\n * ```ts\n * import { setMotionSensitivity, announce, auditMotionA11y } from 'use-scroll-animate/components/a11y';\n * setMotionSensitivity('gentle', true); // no spins / zooms / parallax, remembered\n * announce('3 items added to cart'); // polite live region\n * expect(auditMotionA11y(document.body).errors).toEqual([]);\n * ```\n */\nimport {\n configureComponents,\n getMotionSensitivity,\n adaptKeyframes,\n adoptStyles,\n MOTION_SENSITIVITY_LEVELS,\n type MotionSensitivity,\n} from '../base';\nimport { COMPONENT_CATEGORIES, type ComponentCategory } from '../index-tags';\n\nexport { getMotionSensitivity, adaptKeyframes, MOTION_SENSITIVITY_LEVELS };\nexport type { MotionSensitivity };\n\nconst KEY = 'usa:sensitivity';\n\n/** What each level allows, for docs and settings UIs. */\nexport const MOTION_SENSITIVITY: Record<MotionSensitivity, { en: string; zh: string; allows: string[] }> = {\n full: { en: 'All motion', zh: '全部动效', allows: ['fade', 'translate', 'scale', 'rotate', 'parallax', 'loop', 'flash'] },\n gentle: { en: 'Gentle — no spins, zooms or parallax', zh: '温和 —— 无旋转、缩放与视差', allows: ['fade', 'translate', 'loop'] },\n minimal: { en: 'Minimal — fades only', zh: '最少 —— 仅淡入淡出', allows: ['fade'] },\n static: { en: 'Static — no animation', zh: '静态 —— 无动画', allows: [] },\n};\n\n/** CSS applied at the `static` / `minimal` / `gentle` levels (also stops your own CSS animations under `static`). */\nexport const SENSITIVITY_CSS =\n 'html[data-usa-sensitivity=\"static\"] *,html[data-usa-sensitivity=\"static\"] *::before,html[data-usa-sensitivity=\"static\"] *::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}' +\n 'html[data-usa-sensitivity=\"minimal\"] *,html[data-usa-sensitivity=\"minimal\"] *::before,html[data-usa-sensitivity=\"minimal\"] *::after{animation-duration:1ms!important;animation-iteration-count:1!important;scroll-behavior:auto!important}' +\n 'html[data-usa-sensitivity=\"gentle\"]{--usa-parallax:0;--usa-tilt:0}';\n\n/**\n * Set the motion-sensitivity level for every `<usa-*>` component and the page:\n * sets `data-usa-sensitivity` on `<html>`, adapts component keyframes, and\n * with `persist` remembers the choice (`restoreMotionSensitivity()`).\n * Dispatches `usa:sensitivity` on `document`.\n */\nexport function setMotionSensitivity(level: MotionSensitivity, persist = false): void {\n if (!MOTION_SENSITIVITY_LEVELS.includes(level)) return;\n configureComponents({ motionSensitivity: level });\n adoptStyles('a11y-sensitivity', SENSITIVITY_CSS);\n if (persist) {\n try {\n localStorage.setItem(KEY, level);\n } catch {\n /* private mode */\n }\n }\n if (level === 'static' && typeof document !== 'undefined') staticAlternative(document.documentElement);\n if (typeof document !== 'undefined') document.dispatchEvent(new CustomEvent('usa:sensitivity', { detail: { level } }));\n}\n\n/** Re-apply a persisted level (call early on page load). Returns the active level. */\nexport function restoreMotionSensitivity(): MotionSensitivity {\n try {\n const v = localStorage.getItem(KEY) as MotionSensitivity | null;\n if (v && MOTION_SENSITIVITY_LEVELS.includes(v)) setMotionSensitivity(v);\n } catch {\n /* ignore */\n }\n return getMotionSensitivity();\n}\n\n/** `true` when the current level allows a kind of motion (`'rotate'`, `'parallax'`, `'loop'`…). */\nexport function motionAllowed(kind: string, level: MotionSensitivity = getMotionSensitivity()): boolean {\n return MOTION_SENSITIVITY[level].allows.includes(kind);\n}\n\n/** The static alternative of each category: what its elements show without motion. */\nexport const STATIC_ALTERNATIVES: Record<ComponentCategory, string> = {\n reveal: 'Content visible in place; progress bars show the current value.',\n text: 'Full final text (screen readers always get a plain copy).',\n interaction: 'Normal hover / focus styles; no tilt, magnet or ripple.',\n feedback: 'Spinners become a static busy indicator; progress shows its value; toasts appear without sliding.',\n background: 'A still frame of the background (gradient / pattern); particles and marquees stop.',\n transitions: 'Dialogs, accordions and views switch instantly.',\n physics: 'Values jump to their target; drag still works, without inertia.',\n cards: 'Cards are shown flat and fully readable; stacks become lists.',\n click: 'Clicks work and states are announced; no bursts, confetti or deformation.',\n ui: 'Tabs, drawers, sheets and popovers open instantly with focus management intact.',\n page: 'Page transitions are instant; cursors and ambient layers are hidden.',\n timeline: 'Every step is shown at its final state.',\n gesture: 'Buttons / keys provide the same actions as swipes and pinches.',\n svg: 'Drawings and icons are shown complete.',\n webgl: 'A static poster image or CSS gradient instead of the shader.',\n depth: 'Flat, front-facing layout.',\n layout: 'Items reflow instantly.',\n packs: 'Roles are styled but not animated.',\n};\n\n/**\n * Freeze a subtree at its static alternative: finishes running animations\n * (`finish()`, so content lands on its final state), marks the root with\n * `data-usa-static` and returns an undo that removes the mark.\n */\nexport function staticAlternative(root: Element): () => void {\n const getAll = (root as any).getAnimations as undefined | ((o: { subtree: boolean }) => Animation[]);\n if (typeof getAll === 'function') {\n for (const a of getAll.call(root, { subtree: true })) {\n try {\n const it = a.effect?.getComputedTiming().iterations;\n if (it === Infinity) a.cancel();\n else a.finish();\n } catch {\n /* finished already */\n }\n }\n }\n root.setAttribute('data-usa-static', '');\n return () => root.removeAttribute('data-usa-static');\n}\n\n// --- aria-live conventions ---------------------------------------------------\n\nexport type Politeness = 'polite' | 'assertive';\n/** The ids of the shared live regions. */\nexport const LIVE_REGION_IDS: Record<Politeness, string> = { polite: 'usa-live-polite', assertive: 'usa-live-assertive' };\n\n/** The shared live region (created once, visually hidden, `role=\"status\"` / `role=\"alert\"`). */\nexport function liveRegion(politeness: Politeness = 'polite'): HTMLElement | null {\n if (typeof document === 'undefined' || !document.body) return null;\n const id = LIVE_REGION_IDS[politeness];\n let el = document.getElementById(id);\n if (!el) {\n el = document.createElement('div');\n el.id = id;\n el.className = 'usa-sr';\n el.setAttribute('role', politeness === 'assertive' ? 'alert' : 'status');\n el.setAttribute('aria-live', politeness);\n el.setAttribute('aria-atomic', 'true');\n document.body.appendChild(el);\n }\n return el;\n}\n\nlet lastMsg = '';\nlet lastAt = 0;\n/**\n * Announce a message through the shared live region. Conventions: `polite`\n * for results of the user's own actions (added, saved, copied), `assertive`\n * only for errors that block them. Identical messages within `dedupe` ms\n * (default 500) are dropped; the region is cleared first so repeats are read.\n */\nexport function announce(message: string, options: { politeness?: Politeness; dedupe?: number } = {}): boolean {\n const { politeness = 'polite', dedupe = 500 } = options;\n const t = Date.now();\n if (!message || (message === lastMsg && t - lastAt < dedupe)) return false;\n lastMsg = message;\n lastAt = t;\n const el = liveRegion(politeness);\n if (!el) return false;\n el.textContent = '';\n el.textContent = message;\n return true;\n}\n\n// --- audit ---------------------------------------------------------------------\n\nexport interface A11yIssue {\n rule: string;\n level: 'error' | 'warning';\n element: Element;\n message: string;\n}\n\nconst FOCUSABLE = 'a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex=\"-1\"])';\nconst NAMED_ROLES = ['button', 'switch', 'checkbox', 'slider', 'tab', 'progressbar', 'radiogroup', 'dialog'];\n\nfunction accessibleName(el: Element): string {\n const label = el.getAttribute('aria-label');\n if (label) return label;\n const by = el.getAttribute('aria-labelledby');\n if (by) return by.split(/\\s+/).map((id) => el.ownerDocument.getElementById(id)?.textContent || '').join(' ').trim();\n return (el.textContent || el.getAttribute('title') || '').trim();\n}\n\n/**\n * Check a subtree against the library's motion-a11y rules:\n * - `aria-hidden-focusable` (error): focusable content inside `aria-hidden`.\n * - `role-name` (error): a widget role without an accessible name.\n * - `range-value` (error): a slider / determinate progressbar without `aria-valuenow`.\n * - `img-alt` (error): an `<img>` without `alt`.\n * - `assertive-live` (warning): `aria-live=\"assertive\"` outside `role=\"alert\"`.\n * - `infinite-no-control` (warning, WCAG 2.2.2): an endless animation on a\n * page with no way to pause motion (`<usa-motion-switch>` or `[data-usa-pause]`).\n */\nexport function auditMotionA11y(root: Element | Document): { errors: A11yIssue[]; warnings: A11yIssue[] } {\n const issues: A11yIssue[] = [];\n const add = (rule: string, level: A11yIssue['level'], element: Element, message: string) => issues.push({ rule, level, element, message });\n const scope = root as ParentNode;\n scope.querySelectorAll('[aria-hidden=\"true\"]').forEach((h) => {\n const f = (h.matches(FOCUSABLE) ? [h] : Array.from(h.querySelectorAll(FOCUSABLE))).filter((x) => !x.closest('[inert]'));\n f.forEach((x) => add('aria-hidden-focusable', 'error', x, `focusable <${x.tagName.toLowerCase()}> inside aria-hidden`));\n });\n scope.querySelectorAll('[role]').forEach((el) => {\n const role = el.getAttribute('role')!;\n if (NAMED_ROLES.includes(role) && !accessibleName(el)) add('role-name', 'error', el, `role=\"${role}\" has no accessible name`);\n if (role === 'slider' && !el.hasAttribute('aria-valuenow'))\n add('range-value', 'error', el, 'slider without aria-valuenow');\n });\n scope.querySelectorAll('img:not([alt])').forEach((el) => add('img-alt', 'error', el, '<img> without alt'));\n scope.querySelectorAll('[aria-live=\"assertive\"]').forEach((el) => {\n if (el.getAttribute('role') !== 'alert') add('assertive-live', 'warning', el, 'assertive live region outside role=\"alert\"');\n });\n const doc = (root as Node).ownerDocument || (root as Document);\n const anims = typeof (root as any).getAnimations === 'function' ? ((root as any).getAnimations({ subtree: true }) as Animation[]) : [];\n const control = doc && (doc.querySelector('usa-motion-switch, [data-usa-pause]') || doc.documentElement.hasAttribute('data-usa-sensitivity'));\n if (!control)\n anims.forEach((a) => {\n try {\n if (a.effect?.getComputedTiming().iterations === Infinity) {\n const t = (a.effect as KeyframeEffect).target;\n if (t) add('infinite-no-control', 'warning', t, 'endless animation and no motion control on the page');\n }\n } catch {\n /* ignore */\n }\n });\n return { errors: issues.filter((i) => i.level === 'error'), warnings: issues.filter((i) => i.level === 'warning') };\n}\n\n/** Every `<usa-*>` tag, for sweeping audits. */\nexport const ALL_TAGS: string[] = (Object.values(COMPONENT_CATEGORIES) as readonly (readonly string[])[]).flat();\n"],"names":["MOTION_SENSITIVITY_LEVELS","configureComponents","adoptStyles","getMotionSensitivity","COMPONENT_CATEGORIES"],"mappings":";;;;;AAAA;;;;;;;;;;;;;;;;;AAiBG;AAcH,MAAM,GAAG,GAAG,iBAAiB;AAE7B;AACO,MAAM,kBAAkB,GAA4E;IACzG,IAAI,EAAE,EAAE,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;AACrH,IAAA,MAAM,EAAE,EAAE,EAAE,EAAE,sCAAsC,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE;AACpH,IAAA,OAAO,EAAE,EAAE,EAAE,EAAE,sBAAsB,EAAE,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE;AAC5E,IAAA,MAAM,EAAE,EAAE,EAAE,EAAE,uBAAuB,EAAE,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE;;AAGtE;AACO,MAAM,eAAe,GAC1B,qNAAqN;IACrN,4OAA4O;AAC5O,IAAA;AAEF;;;;;AAKG;SACa,oBAAoB,CAAC,KAAwB,EAAE,OAAO,GAAG,KAAK,EAAA;AAC5E,IAAA,IAAI,CAACA,8BAAyB,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE;AAChD,IAAAC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AC;AACF,IAAA,MAAM,GAAG,GAAI,IAAa,CAAC,aAAa,IAAK,IAAiB;IAC9D,MAAM,KAAK,GAAG,OAAQ,IAAY,CAAC,aAAa,KAAK,UAAU,GAAK,IAAY,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAiB,GAAG,EAAE;IACtI,MAAM,OAAO,GAAG,GAAG,KAAK,GAAG,CAAC,aAAa,CAAC,qCAAqC,CAAC,IAAI,GAAG,CAAC,eAAe,CAAC,YAAY,CAAC,sBAAsB,CAAC,CAAC;AAC7I,IAAA,IAAI,CAAC,OAAO;AACV,QAAA,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAI;AAClB,YAAA,IAAI;gBACF,IAAI,CAAC,CAAC,MAAM,EAAE,iBAAiB,EAAE,CAAC,UAAU,KAAK,QAAQ,EAAE;AACzD,oBAAA,MAAM,CAAC,GAAI,CAAC,CAAC,MAAyB,CAAC,MAAM;AAC7C,oBAAA,IAAI,CAAC;wBAAE,GAAG,CAAC,qBAAqB,EAAE,SAAS,EAAE,CAAC,EAAE,qDAAqD,CAAC;gBACxG;YACF;AAAE,YAAA,MAAM;;YAER;AACF,QAAA,CAAC,CAAC;AACJ,IAAA,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,KAAK,OAAO,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,EAAE;AACrH;AAEA;AACO,MAAM,QAAQ,GAAc,MAAM,CAAC,MAAM,CAACC,8BAAoB,CAAoC,CAAC,IAAI;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"a11y.cjs","sources":["../../src/components/a11y/baseline.ts","../../src/components/a11y/index.ts"],"sourcesContent":["/**\n * 4.9 — the 5.0 modern-browser baseline. `baselineReport()` lists which\n * required / progressive features this browser has; `warnBaseline()` logs\n * once in development when a required one is missing.\n */\nimport { deprecate } from '../base';\n\nexport interface BaselineFeature {\n id: string;\n required: boolean;\n supported: boolean;\n}\n\n/** Required in 5.0: Custom Elements, WAAPI, IntersectionObserver, ResizeObserver, adoptedStyleSheets. Progressive: View Transitions, scroll-driven animations, WebGL. */\nexport function baselineReport(): BaselineFeature[] {\n const w = (typeof window !== 'undefined' ? window : {}) as any;\n const d = (typeof document !== 'undefined' ? document : {}) as any;\n const css = (q: string) => typeof w.CSS?.supports === 'function' && w.CSS.supports(q);\n return [\n { id: 'custom-elements', required: true, supported: !!w.customElements },\n { id: 'web-animations', required: true, supported: typeof w.Element?.prototype?.animate === 'function' },\n { id: 'intersection-observer', required: true, supported: typeof w.IntersectionObserver === 'function' },\n { id: 'resize-observer', required: true, supported: typeof w.ResizeObserver === 'function' },\n { id: 'adopted-stylesheets', required: true, supported: 'adoptedStyleSheets' in d },\n { id: 'view-transitions', required: false, supported: typeof d.startViewTransition === 'function' },\n { id: 'scroll-driven-animations', required: false, supported: css('animation-timeline: view()') },\n { id: 'webgl', required: false, supported: !!(d.createElement && (() => { try { return d.createElement('canvas').getContext('webgl'); } catch { return null; } })()) },\n ];\n}\n\n/** Log (once) which required 5.0 features are missing here. Returns the missing ids. */\nexport function warnBaseline(): string[] {\n const missing = baselineReport().filter((f) => f.required && !f.supported).map((f) => f.id);\n if (missing.length) deprecate('baseline', `this browser lacks ${missing.join(', ')}; use-scroll-animate 5.0 requires them (modern-browser baseline, see docs/upgrading-5.md).`);\n return missing;\n}\n","/**\n * use-scroll-animate/components/a11y — accessibility toolkit (4.4).\n *\n * - Motion-sensitivity levels: `setMotionSensitivity('full' | 'gentle' | 'minimal' | 'static')`.\n * - Static alternatives: what every component shows when motion is off, and\n * `staticAlternative(root)` to freeze any subtree at its final state.\n * - `aria-live` conventions: one shared polite and one assertive region,\n * `announce(message, { politeness })`.\n * - `auditMotionA11y(root)`: the rules the automated regression tests run\n * over every `<usa-*>` element — usable in your own tests too.\n *\n * ```ts\n * import { setMotionSensitivity, announce, auditMotionA11y } from 'use-scroll-animate/components/a11y';\n * setMotionSensitivity('gentle', true); // no spins / zooms / parallax, remembered\n * announce('3 items added to cart'); // polite live region\n * expect(auditMotionA11y(document.body).errors).toEqual([]);\n * ```\n */\nimport {\n configureComponents,\n getMotionSensitivity,\n adaptKeyframes,\n adoptStyles,\n MOTION_SENSITIVITY_LEVELS,\n type MotionSensitivity,\n} from '../base';\nimport { COMPONENT_CATEGORIES, type ComponentCategory } from '../index-tags';\n\nexport { getMotionSensitivity, adaptKeyframes, MOTION_SENSITIVITY_LEVELS };\nexport { baselineReport, warnBaseline } from './baseline';\nexport type { BaselineFeature } from './baseline';\nexport type { MotionSensitivity };\n\nconst KEY = 'usa:sensitivity';\n\n/** What each level allows, for docs and settings UIs. */\nexport const MOTION_SENSITIVITY: Record<MotionSensitivity, { en: string; zh: string; allows: string[] }> = {\n full: { en: 'All motion', zh: '全部动效', allows: ['fade', 'translate', 'scale', 'rotate', 'parallax', 'loop', 'flash'] },\n gentle: { en: 'Gentle — no spins, zooms or parallax', zh: '温和 —— 无旋转、缩放与视差', allows: ['fade', 'translate', 'loop'] },\n minimal: { en: 'Minimal — fades only', zh: '最少 —— 仅淡入淡出', allows: ['fade'] },\n static: { en: 'Static — no animation', zh: '静态 —— 无动画', allows: [] },\n};\n\n/** CSS applied at the `static` / `minimal` / `gentle` levels (also stops your own CSS animations under `static`). */\nexport const SENSITIVITY_CSS =\n 'html[data-usa-sensitivity=\"static\"] *,html[data-usa-sensitivity=\"static\"] *::before,html[data-usa-sensitivity=\"static\"] *::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}' +\n 'html[data-usa-sensitivity=\"minimal\"] *,html[data-usa-sensitivity=\"minimal\"] *::before,html[data-usa-sensitivity=\"minimal\"] *::after{animation-duration:1ms!important;animation-iteration-count:1!important;scroll-behavior:auto!important}' +\n 'html[data-usa-sensitivity=\"gentle\"]{--usa-parallax:0;--usa-tilt:0}';\n\n/**\n * Set the motion-sensitivity level for every `<usa-*>` component and the page:\n * sets `data-usa-sensitivity` on `<html>`, adapts component keyframes, and\n * with `persist` remembers the choice (`restoreMotionSensitivity()`).\n * Dispatches `usa:sensitivity` on `document`.\n */\nexport function setMotionSensitivity(level: MotionSensitivity, persist = false): void {\n if (!MOTION_SENSITIVITY_LEVELS.includes(level)) return;\n configureComponents({ motionSensitivity: level });\n adoptStyles('a11y-sensitivity', SENSITIVITY_CSS);\n if (persist) {\n try {\n localStorage.setItem(KEY, level);\n } catch {\n /* private mode */\n }\n }\n if (level === 'static' && typeof document !== 'undefined') staticAlternative(document.documentElement);\n if (typeof document !== 'undefined') document.dispatchEvent(new CustomEvent('usa:sensitivity', { detail: { level } }));\n}\n\n/** Re-apply a persisted level (call early on page load). Returns the active level. */\nexport function restoreMotionSensitivity(): MotionSensitivity {\n try {\n const v = localStorage.getItem(KEY) as MotionSensitivity | null;\n if (v && MOTION_SENSITIVITY_LEVELS.includes(v)) setMotionSensitivity(v);\n } catch {\n /* ignore */\n }\n return getMotionSensitivity();\n}\n\n/** `true` when the current level allows a kind of motion (`'rotate'`, `'parallax'`, `'loop'`…). */\nexport function motionAllowed(kind: string, level: MotionSensitivity = getMotionSensitivity()): boolean {\n return MOTION_SENSITIVITY[level].allows.includes(kind);\n}\n\n/** The static alternative of each category: what its elements show without motion. */\nexport const STATIC_ALTERNATIVES: Record<ComponentCategory, string> = {\n reveal: 'Content visible in place; progress bars show the current value.',\n text: 'Full final text (screen readers always get a plain copy).',\n interaction: 'Normal hover / focus styles; no tilt, magnet or ripple.',\n feedback: 'Spinners become a static busy indicator; progress shows its value; toasts appear without sliding.',\n background: 'A still frame of the background (gradient / pattern); particles and marquees stop.',\n transitions: 'Dialogs, accordions and views switch instantly.',\n physics: 'Values jump to their target; drag still works, without inertia.',\n cards: 'Cards are shown flat and fully readable; stacks become lists.',\n click: 'Clicks work and states are announced; no bursts, confetti or deformation.',\n ui: 'Tabs, drawers, sheets and popovers open instantly with focus management intact.',\n page: 'Page transitions are instant; cursors and ambient layers are hidden.',\n timeline: 'Every step is shown at its final state.',\n gesture: 'Buttons / keys provide the same actions as swipes and pinches.',\n svg: 'Drawings and icons are shown complete.',\n webgl: 'A static poster image or CSS gradient instead of the shader.',\n depth: 'Flat, front-facing layout.',\n layout: 'Items reflow instantly.',\n packs: 'Roles are styled but not animated.',\n};\n\n/**\n * Freeze a subtree at its static alternative: finishes running animations\n * (`finish()`, so content lands on its final state), marks the root with\n * `data-usa-static` and returns an undo that removes the mark.\n */\nexport function staticAlternative(root: Element): () => void {\n const getAll = (root as any).getAnimations as undefined | ((o: { subtree: boolean }) => Animation[]);\n if (typeof getAll === 'function') {\n for (const a of getAll.call(root, { subtree: true })) {\n try {\n const it = a.effect?.getComputedTiming().iterations;\n if (it === Infinity) a.cancel();\n else a.finish();\n } catch {\n /* finished already */\n }\n }\n }\n root.setAttribute('data-usa-static', '');\n return () => root.removeAttribute('data-usa-static');\n}\n\n// --- aria-live conventions ---------------------------------------------------\n\nexport type Politeness = 'polite' | 'assertive';\n/** The ids of the shared live regions. */\nexport const LIVE_REGION_IDS: Record<Politeness, string> = { polite: 'usa-live-polite', assertive: 'usa-live-assertive' };\n\n/** The shared live region (created once, visually hidden, `role=\"status\"` / `role=\"alert\"`). */\nexport function liveRegion(politeness: Politeness = 'polite'): HTMLElement | null {\n if (typeof document === 'undefined' || !document.body) return null;\n const id = LIVE_REGION_IDS[politeness];\n let el = document.getElementById(id);\n if (!el) {\n el = document.createElement('div');\n el.id = id;\n el.className = 'usa-sr';\n el.setAttribute('role', politeness === 'assertive' ? 'alert' : 'status');\n el.setAttribute('aria-live', politeness);\n el.setAttribute('aria-atomic', 'true');\n document.body.appendChild(el);\n }\n return el;\n}\n\nlet lastMsg = '';\nlet lastAt = 0;\n/**\n * Announce a message through the shared live region. Conventions: `polite`\n * for results of the user's own actions (added, saved, copied), `assertive`\n * only for errors that block them. Identical messages within `dedupe` ms\n * (default 500) are dropped; the region is cleared first so repeats are read.\n */\nexport function announce(message: string, options: { politeness?: Politeness; dedupe?: number } = {}): boolean {\n const { politeness = 'polite', dedupe = 500 } = options;\n const t = Date.now();\n if (!message || (message === lastMsg && t - lastAt < dedupe)) return false;\n lastMsg = message;\n lastAt = t;\n const el = liveRegion(politeness);\n if (!el) return false;\n el.textContent = '';\n el.textContent = message;\n return true;\n}\n\n// --- audit ---------------------------------------------------------------------\n\nexport interface A11yIssue {\n rule: string;\n level: 'error' | 'warning';\n element: Element;\n message: string;\n}\n\nconst FOCUSABLE = 'a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex=\"-1\"])';\nconst NAMED_ROLES = ['button', 'switch', 'checkbox', 'slider', 'tab', 'progressbar', 'radiogroup', 'dialog'];\n\nfunction accessibleName(el: Element): string {\n const label = el.getAttribute('aria-label');\n if (label) return label;\n const by = el.getAttribute('aria-labelledby');\n if (by) return by.split(/\\s+/).map((id) => el.ownerDocument.getElementById(id)?.textContent || '').join(' ').trim();\n return (el.textContent || el.getAttribute('title') || '').trim();\n}\n\n/**\n * Check a subtree against the library's motion-a11y rules:\n * - `aria-hidden-focusable` (error): focusable content inside `aria-hidden`.\n * - `role-name` (error): a widget role without an accessible name.\n * - `range-value` (error): a slider / determinate progressbar without `aria-valuenow`.\n * - `img-alt` (error): an `<img>` without `alt`.\n * - `assertive-live` (warning): `aria-live=\"assertive\"` outside `role=\"alert\"`.\n * - `infinite-no-control` (warning, WCAG 2.2.2): an endless animation on a\n * page with no way to pause motion (`<usa-motion-switch>` or `[data-usa-pause]`).\n */\nexport function auditMotionA11y(root: Element | Document): { errors: A11yIssue[]; warnings: A11yIssue[] } {\n const issues: A11yIssue[] = [];\n const add = (rule: string, level: A11yIssue['level'], element: Element, message: string) => issues.push({ rule, level, element, message });\n const scope = root as ParentNode;\n scope.querySelectorAll('[aria-hidden=\"true\"]').forEach((h) => {\n const f = (h.matches(FOCUSABLE) ? [h] : Array.from(h.querySelectorAll(FOCUSABLE))).filter((x) => !x.closest('[inert]'));\n f.forEach((x) => add('aria-hidden-focusable', 'error', x, `focusable <${x.tagName.toLowerCase()}> inside aria-hidden`));\n });\n scope.querySelectorAll('[role]').forEach((el) => {\n const role = el.getAttribute('role')!;\n if (NAMED_ROLES.includes(role) && !accessibleName(el)) add('role-name', 'error', el, `role=\"${role}\" has no accessible name`);\n if (role === 'slider' && !el.hasAttribute('aria-valuenow'))\n add('range-value', 'error', el, 'slider without aria-valuenow');\n });\n scope.querySelectorAll('img:not([alt])').forEach((el) => add('img-alt', 'error', el, '<img> without alt'));\n scope.querySelectorAll('[aria-live=\"assertive\"]').forEach((el) => {\n if (el.getAttribute('role') !== 'alert') add('assertive-live', 'warning', el, 'assertive live region outside role=\"alert\"');\n });\n const doc = (root as Node).ownerDocument || (root as Document);\n const anims = typeof (root as any).getAnimations === 'function' ? ((root as any).getAnimations({ subtree: true }) as Animation[]) : [];\n const control = doc && (doc.querySelector('usa-motion-switch, [data-usa-pause]') || doc.documentElement.hasAttribute('data-usa-sensitivity'));\n if (!control)\n anims.forEach((a) => {\n try {\n if (a.effect?.getComputedTiming().iterations === Infinity) {\n const t = (a.effect as KeyframeEffect).target;\n if (t) add('infinite-no-control', 'warning', t, 'endless animation and no motion control on the page');\n }\n } catch {\n /* ignore */\n }\n });\n return { errors: issues.filter((i) => i.level === 'error'), warnings: issues.filter((i) => i.level === 'warning') };\n}\n\n/** Every `<usa-*>` tag, for sweeping audits. */\nexport const ALL_TAGS: string[] = (Object.values(COMPONENT_CATEGORIES) as readonly (readonly string[])[]).flat();\n"],"names":["deprecate","MOTION_SENSITIVITY_LEVELS","configureComponents","adoptStyles","getMotionSensitivity","COMPONENT_CATEGORIES"],"mappings":";;;;;AAAA;;;;AAIG;AASH;SACgB,cAAc,GAAA;AAC5B,IAAA,MAAM,CAAC,IAAI,OAAO,MAAM,KAAK,WAAW,GAAG,MAAM,GAAG,EAAE,CAAQ;AAC9D,IAAA,MAAM,CAAC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AAM,CAACC,8BAAoB,CAAoC,CAAC,IAAI;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -32,6 +32,16 @@ declare const COMPONENT_CATEGORIES: {
|
|
|
32
32
|
};
|
|
33
33
|
type ComponentCategory = keyof typeof COMPONENT_CATEGORIES;
|
|
34
34
|
|
|
35
|
+
interface BaselineFeature {
|
|
36
|
+
id: string;
|
|
37
|
+
required: boolean;
|
|
38
|
+
supported: boolean;
|
|
39
|
+
}
|
|
40
|
+
/** Required in 5.0: Custom Elements, WAAPI, IntersectionObserver, ResizeObserver, adoptedStyleSheets. Progressive: View Transitions, scroll-driven animations, WebGL. */
|
|
41
|
+
declare function baselineReport(): BaselineFeature[];
|
|
42
|
+
/** Log (once) which required 5.0 features are missing here. Returns the missing ids. */
|
|
43
|
+
declare function warnBaseline(): string[];
|
|
44
|
+
|
|
35
45
|
/**
|
|
36
46
|
* use-scroll-animate/components/a11y — accessibility toolkit (4.4).
|
|
37
47
|
*
|
|
@@ -116,5 +126,5 @@ declare function auditMotionA11y(root: Element | Document): {
|
|
|
116
126
|
/** Every `<usa-*>` tag, for sweeping audits. */
|
|
117
127
|
declare const ALL_TAGS: string[];
|
|
118
128
|
|
|
119
|
-
export { ALL_TAGS, LIVE_REGION_IDS, MOTION_SENSITIVITY, MOTION_SENSITIVITY_LEVELS, SENSITIVITY_CSS, STATIC_ALTERNATIVES, adaptKeyframes, announce, auditMotionA11y, getMotionSensitivity, liveRegion, motionAllowed, restoreMotionSensitivity, setMotionSensitivity, staticAlternative };
|
|
120
|
-
export type { A11yIssue, MotionSensitivity, Politeness };
|
|
129
|
+
export { ALL_TAGS, LIVE_REGION_IDS, MOTION_SENSITIVITY, MOTION_SENSITIVITY_LEVELS, SENSITIVITY_CSS, STATIC_ALTERNATIVES, adaptKeyframes, announce, auditMotionA11y, baselineReport, getMotionSensitivity, liveRegion, motionAllowed, restoreMotionSensitivity, setMotionSensitivity, staticAlternative, warnBaseline };
|
|
130
|
+
export type { A11yIssue, BaselineFeature, MotionSensitivity, Politeness };
|
|
@@ -32,6 +32,16 @@ declare const COMPONENT_CATEGORIES: {
|
|
|
32
32
|
};
|
|
33
33
|
type ComponentCategory = keyof typeof COMPONENT_CATEGORIES;
|
|
34
34
|
|
|
35
|
+
interface BaselineFeature {
|
|
36
|
+
id: string;
|
|
37
|
+
required: boolean;
|
|
38
|
+
supported: boolean;
|
|
39
|
+
}
|
|
40
|
+
/** Required in 5.0: Custom Elements, WAAPI, IntersectionObserver, ResizeObserver, adoptedStyleSheets. Progressive: View Transitions, scroll-driven animations, WebGL. */
|
|
41
|
+
declare function baselineReport(): BaselineFeature[];
|
|
42
|
+
/** Log (once) which required 5.0 features are missing here. Returns the missing ids. */
|
|
43
|
+
declare function warnBaseline(): string[];
|
|
44
|
+
|
|
35
45
|
/**
|
|
36
46
|
* use-scroll-animate/components/a11y — accessibility toolkit (4.4).
|
|
37
47
|
*
|
|
@@ -116,5 +126,5 @@ declare function auditMotionA11y(root: Element | Document): {
|
|
|
116
126
|
/** Every `<usa-*>` tag, for sweeping audits. */
|
|
117
127
|
declare const ALL_TAGS: string[];
|
|
118
128
|
|
|
119
|
-
export { ALL_TAGS, LIVE_REGION_IDS, MOTION_SENSITIVITY, MOTION_SENSITIVITY_LEVELS, SENSITIVITY_CSS, STATIC_ALTERNATIVES, adaptKeyframes, announce, auditMotionA11y, getMotionSensitivity, liveRegion, motionAllowed, restoreMotionSensitivity, setMotionSensitivity, staticAlternative };
|
|
120
|
-
export type { A11yIssue, MotionSensitivity, Politeness };
|
|
129
|
+
export { ALL_TAGS, LIVE_REGION_IDS, MOTION_SENSITIVITY, MOTION_SENSITIVITY_LEVELS, SENSITIVITY_CSS, STATIC_ALTERNATIVES, adaptKeyframes, announce, auditMotionA11y, baselineReport, getMotionSensitivity, liveRegion, motionAllowed, restoreMotionSensitivity, setMotionSensitivity, staticAlternative, warnBaseline };
|
|
130
|
+
export type { A11yIssue, BaselineFeature, MotionSensitivity, Politeness };
|
package/dist/components/a11y.js
CHANGED
|
@@ -1,7 +1,41 @@
|
|
|
1
|
-
import { h as getMotionSensitivity, a as MOTION_SENSITIVITY_LEVELS, f as configureComponents,
|
|
2
|
-
export { d as adaptKeyframes } from '../chunks/base-
|
|
1
|
+
import { u as deprecate, h as getMotionSensitivity, a as MOTION_SENSITIVITY_LEVELS, f as configureComponents, t as adoptStyles } from '../chunks/base-DbbRUxaa.js';
|
|
2
|
+
export { d as adaptKeyframes } from '../chunks/base-DbbRUxaa.js';
|
|
3
3
|
import { C as COMPONENT_CATEGORIES } from '../chunks/index-tags-Dh8nwXqw.js';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* 4.9 — the 5.0 modern-browser baseline. `baselineReport()` lists which
|
|
7
|
+
* required / progressive features this browser has; `warnBaseline()` logs
|
|
8
|
+
* once in development when a required one is missing.
|
|
9
|
+
*/
|
|
10
|
+
/** Required in 5.0: Custom Elements, WAAPI, IntersectionObserver, ResizeObserver, adoptedStyleSheets. Progressive: View Transitions, scroll-driven animations, WebGL. */
|
|
11
|
+
function baselineReport() {
|
|
12
|
+
const w = (typeof window !== 'undefined' ? window : {});
|
|
13
|
+
const d = (typeof document !== 'undefined' ? document : {});
|
|
14
|
+
const css = (q) => typeof w.CSS?.supports === 'function' && w.CSS.supports(q);
|
|
15
|
+
return [
|
|
16
|
+
{ id: 'custom-elements', required: true, supported: !!w.customElements },
|
|
17
|
+
{ id: 'web-animations', required: true, supported: typeof w.Element?.prototype?.animate === 'function' },
|
|
18
|
+
{ id: 'intersection-observer', required: true, supported: typeof w.IntersectionObserver === 'function' },
|
|
19
|
+
{ id: 'resize-observer', required: true, supported: typeof w.ResizeObserver === 'function' },
|
|
20
|
+
{ id: 'adopted-stylesheets', required: true, supported: 'adoptedStyleSheets' in d },
|
|
21
|
+
{ id: 'view-transitions', required: false, supported: typeof d.startViewTransition === 'function' },
|
|
22
|
+
{ id: 'scroll-driven-animations', required: false, supported: css('animation-timeline: view()') },
|
|
23
|
+
{ id: 'webgl', required: false, supported: !!(d.createElement && (() => { try {
|
|
24
|
+
return d.createElement('canvas').getContext('webgl');
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return null;
|
|
28
|
+
} })()) },
|
|
29
|
+
];
|
|
30
|
+
}
|
|
31
|
+
/** Log (once) which required 5.0 features are missing here. Returns the missing ids. */
|
|
32
|
+
function warnBaseline() {
|
|
33
|
+
const missing = baselineReport().filter((f) => f.required && !f.supported).map((f) => f.id);
|
|
34
|
+
if (missing.length)
|
|
35
|
+
deprecate('baseline', `this browser lacks ${missing.join(', ')}; use-scroll-animate 5.0 requires them (modern-browser baseline, see docs/upgrading-5.md).`);
|
|
36
|
+
return missing;
|
|
37
|
+
}
|
|
38
|
+
|
|
5
39
|
/**
|
|
6
40
|
* use-scroll-animate/components/a11y — accessibility toolkit (4.4).
|
|
7
41
|
*
|
|
@@ -220,5 +254,5 @@ function auditMotionA11y(root) {
|
|
|
220
254
|
/** Every `<usa-*>` tag, for sweeping audits. */
|
|
221
255
|
const ALL_TAGS = Object.values(COMPONENT_CATEGORIES).flat();
|
|
222
256
|
|
|
223
|
-
export { ALL_TAGS, LIVE_REGION_IDS, MOTION_SENSITIVITY, MOTION_SENSITIVITY_LEVELS, SENSITIVITY_CSS, STATIC_ALTERNATIVES, announce, auditMotionA11y, getMotionSensitivity, liveRegion, motionAllowed, restoreMotionSensitivity, setMotionSensitivity, staticAlternative };
|
|
257
|
+
export { ALL_TAGS, LIVE_REGION_IDS, MOTION_SENSITIVITY, MOTION_SENSITIVITY_LEVELS, SENSITIVITY_CSS, STATIC_ALTERNATIVES, announce, auditMotionA11y, baselineReport, getMotionSensitivity, liveRegion, motionAllowed, restoreMotionSensitivity, setMotionSensitivity, staticAlternative, warnBaseline };
|
|
224
258
|
//# sourceMappingURL=a11y.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"a11y.js","sources":["../../src/components/a11y/index.ts"],"sourcesContent":["/**\n * use-scroll-animate/components/a11y — accessibility toolkit (4.4).\n *\n * - Motion-sensitivity levels: `setMotionSensitivity('full' | 'gentle' | 'minimal' | 'static')`.\n * - Static alternatives: what every component shows when motion is off, and\n * `staticAlternative(root)` to freeze any subtree at its final state.\n * - `aria-live` conventions: one shared polite and one assertive region,\n * `announce(message, { politeness })`.\n * - `auditMotionA11y(root)`: the rules the automated regression tests run\n * over every `<usa-*>` element — usable in your own tests too.\n *\n * ```ts\n * import { setMotionSensitivity, announce, auditMotionA11y } from 'use-scroll-animate/components/a11y';\n * setMotionSensitivity('gentle', true); // no spins / zooms / parallax, remembered\n * announce('3 items added to cart'); // polite live region\n * expect(auditMotionA11y(document.body).errors).toEqual([]);\n * ```\n */\nimport {\n configureComponents,\n getMotionSensitivity,\n adaptKeyframes,\n adoptStyles,\n MOTION_SENSITIVITY_LEVELS,\n type MotionSensitivity,\n} from '../base';\nimport { COMPONENT_CATEGORIES, type ComponentCategory } from '../index-tags';\n\nexport { getMotionSensitivity, adaptKeyframes, MOTION_SENSITIVITY_LEVELS };\nexport type { MotionSensitivity };\n\nconst KEY = 'usa:sensitivity';\n\n/** What each level allows, for docs and settings UIs. */\nexport const MOTION_SENSITIVITY: Record<MotionSensitivity, { en: string; zh: string; allows: string[] }> = {\n full: { en: 'All motion', zh: '全部动效', allows: ['fade', 'translate', 'scale', 'rotate', 'parallax', 'loop', 'flash'] },\n gentle: { en: 'Gentle — no spins, zooms or parallax', zh: '温和 —— 无旋转、缩放与视差', allows: ['fade', 'translate', 'loop'] },\n minimal: { en: 'Minimal — fades only', zh: '最少 —— 仅淡入淡出', allows: ['fade'] },\n static: { en: 'Static — no animation', zh: '静态 —— 无动画', allows: [] },\n};\n\n/** CSS applied at the `static` / `minimal` / `gentle` levels (also stops your own CSS animations under `static`). */\nexport const SENSITIVITY_CSS =\n 'html[data-usa-sensitivity=\"static\"] *,html[data-usa-sensitivity=\"static\"] *::before,html[data-usa-sensitivity=\"static\"] *::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}' +\n 'html[data-usa-sensitivity=\"minimal\"] *,html[data-usa-sensitivity=\"minimal\"] *::before,html[data-usa-sensitivity=\"minimal\"] *::after{animation-duration:1ms!important;animation-iteration-count:1!important;scroll-behavior:auto!important}' +\n 'html[data-usa-sensitivity=\"gentle\"]{--usa-parallax:0;--usa-tilt:0}';\n\n/**\n * Set the motion-sensitivity level for every `<usa-*>` component and the page:\n * sets `data-usa-sensitivity` on `<html>`, adapts component keyframes, and\n * with `persist` remembers the choice (`restoreMotionSensitivity()`).\n * Dispatches `usa:sensitivity` on `document`.\n */\nexport function setMotionSensitivity(level: MotionSensitivity, persist = false): void {\n if (!MOTION_SENSITIVITY_LEVELS.includes(level)) return;\n configureComponents({ motionSensitivity: level });\n adoptStyles('a11y-sensitivity', SENSITIVITY_CSS);\n if (persist) {\n try {\n localStorage.setItem(KEY, level);\n } catch {\n /* private mode */\n }\n }\n if (level === 'static' && typeof document !== 'undefined') staticAlternative(document.documentElement);\n if (typeof document !== 'undefined') document.dispatchEvent(new CustomEvent('usa:sensitivity', { detail: { level } }));\n}\n\n/** Re-apply a persisted level (call early on page load). Returns the active level. */\nexport function restoreMotionSensitivity(): MotionSensitivity {\n try {\n const v = localStorage.getItem(KEY) as MotionSensitivity | null;\n if (v && MOTION_SENSITIVITY_LEVELS.includes(v)) setMotionSensitivity(v);\n } catch {\n /* ignore */\n }\n return getMotionSensitivity();\n}\n\n/** `true` when the current level allows a kind of motion (`'rotate'`, `'parallax'`, `'loop'`…). */\nexport function motionAllowed(kind: string, level: MotionSensitivity = getMotionSensitivity()): boolean {\n return MOTION_SENSITIVITY[level].allows.includes(kind);\n}\n\n/** The static alternative of each category: what its elements show without motion. */\nexport const STATIC_ALTERNATIVES: Record<ComponentCategory, string> = {\n reveal: 'Content visible in place; progress bars show the current value.',\n text: 'Full final text (screen readers always get a plain copy).',\n interaction: 'Normal hover / focus styles; no tilt, magnet or ripple.',\n feedback: 'Spinners become a static busy indicator; progress shows its value; toasts appear without sliding.',\n background: 'A still frame of the background (gradient / pattern); particles and marquees stop.',\n transitions: 'Dialogs, accordions and views switch instantly.',\n physics: 'Values jump to their target; drag still works, without inertia.',\n cards: 'Cards are shown flat and fully readable; stacks become lists.',\n click: 'Clicks work and states are announced; no bursts, confetti or deformation.',\n ui: 'Tabs, drawers, sheets and popovers open instantly with focus management intact.',\n page: 'Page transitions are instant; cursors and ambient layers are hidden.',\n timeline: 'Every step is shown at its final state.',\n gesture: 'Buttons / keys provide the same actions as swipes and pinches.',\n svg: 'Drawings and icons are shown complete.',\n webgl: 'A static poster image or CSS gradient instead of the shader.',\n depth: 'Flat, front-facing layout.',\n layout: 'Items reflow instantly.',\n packs: 'Roles are styled but not animated.',\n};\n\n/**\n * Freeze a subtree at its static alternative: finishes running animations\n * (`finish()`, so content lands on its final state), marks the root with\n * `data-usa-static` and returns an undo that removes the mark.\n */\nexport function staticAlternative(root: Element): () => void {\n const getAll = (root as any).getAnimations as undefined | ((o: { subtree: boolean }) => Animation[]);\n if (typeof getAll === 'function') {\n for (const a of getAll.call(root, { subtree: true })) {\n try {\n const it = a.effect?.getComputedTiming().iterations;\n if (it === Infinity) a.cancel();\n else a.finish();\n } catch {\n /* finished already */\n }\n }\n }\n root.setAttribute('data-usa-static', '');\n return () => root.removeAttribute('data-usa-static');\n}\n\n// --- aria-live conventions ---------------------------------------------------\n\nexport type Politeness = 'polite' | 'assertive';\n/** The ids of the shared live regions. */\nexport const LIVE_REGION_IDS: Record<Politeness, string> = { polite: 'usa-live-polite', assertive: 'usa-live-assertive' };\n\n/** The shared live region (created once, visually hidden, `role=\"status\"` / `role=\"alert\"`). */\nexport function liveRegion(politeness: Politeness = 'polite'): HTMLElement | null {\n if (typeof document === 'undefined' || !document.body) return null;\n const id = LIVE_REGION_IDS[politeness];\n let el = document.getElementById(id);\n if (!el) {\n el = document.createElement('div');\n el.id = id;\n el.className = 'usa-sr';\n el.setAttribute('role', politeness === 'assertive' ? 'alert' : 'status');\n el.setAttribute('aria-live', politeness);\n el.setAttribute('aria-atomic', 'true');\n document.body.appendChild(el);\n }\n return el;\n}\n\nlet lastMsg = '';\nlet lastAt = 0;\n/**\n * Announce a message through the shared live region. Conventions: `polite`\n * for results of the user's own actions (added, saved, copied), `assertive`\n * only for errors that block them. Identical messages within `dedupe` ms\n * (default 500) are dropped; the region is cleared first so repeats are read.\n */\nexport function announce(message: string, options: { politeness?: Politeness; dedupe?: number } = {}): boolean {\n const { politeness = 'polite', dedupe = 500 } = options;\n const t = Date.now();\n if (!message || (message === lastMsg && t - lastAt < dedupe)) return false;\n lastMsg = message;\n lastAt = t;\n const el = liveRegion(politeness);\n if (!el) return false;\n el.textContent = '';\n el.textContent = message;\n return true;\n}\n\n// --- audit ---------------------------------------------------------------------\n\nexport interface A11yIssue {\n rule: string;\n level: 'error' | 'warning';\n element: Element;\n message: string;\n}\n\nconst FOCUSABLE = 'a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex=\"-1\"])';\nconst NAMED_ROLES = ['button', 'switch', 'checkbox', 'slider', 'tab', 'progressbar', 'radiogroup', 'dialog'];\n\nfunction accessibleName(el: Element): string {\n const label = el.getAttribute('aria-label');\n if (label) return label;\n const by = el.getAttribute('aria-labelledby');\n if (by) return by.split(/\\s+/).map((id) => el.ownerDocument.getElementById(id)?.textContent || '').join(' ').trim();\n return (el.textContent || el.getAttribute('title') || '').trim();\n}\n\n/**\n * Check a subtree against the library's motion-a11y rules:\n * - `aria-hidden-focusable` (error): focusable content inside `aria-hidden`.\n * - `role-name` (error): a widget role without an accessible name.\n * - `range-value` (error): a slider / determinate progressbar without `aria-valuenow`.\n * - `img-alt` (error): an `<img>` without `alt`.\n * - `assertive-live` (warning): `aria-live=\"assertive\"` outside `role=\"alert\"`.\n * - `infinite-no-control` (warning, WCAG 2.2.2): an endless animation on a\n * page with no way to pause motion (`<usa-motion-switch>` or `[data-usa-pause]`).\n */\nexport function auditMotionA11y(root: Element | Document): { errors: A11yIssue[]; warnings: A11yIssue[] } {\n const issues: A11yIssue[] = [];\n const add = (rule: string, level: A11yIssue['level'], element: Element, message: string) => issues.push({ rule, level, element, message });\n const scope = root as ParentNode;\n scope.querySelectorAll('[aria-hidden=\"true\"]').forEach((h) => {\n const f = (h.matches(FOCUSABLE) ? [h] : Array.from(h.querySelectorAll(FOCUSABLE))).filter((x) => !x.closest('[inert]'));\n f.forEach((x) => add('aria-hidden-focusable', 'error', x, `focusable <${x.tagName.toLowerCase()}> inside aria-hidden`));\n });\n scope.querySelectorAll('[role]').forEach((el) => {\n const role = el.getAttribute('role')!;\n if (NAMED_ROLES.includes(role) && !accessibleName(el)) add('role-name', 'error', el, `role=\"${role}\" has no accessible name`);\n if (role === 'slider' && !el.hasAttribute('aria-valuenow'))\n add('range-value', 'error', el, 'slider without aria-valuenow');\n });\n scope.querySelectorAll('img:not([alt])').forEach((el) => add('img-alt', 'error', el, '<img> without alt'));\n scope.querySelectorAll('[aria-live=\"assertive\"]').forEach((el) => {\n if (el.getAttribute('role') !== 'alert') add('assertive-live', 'warning', el, 'assertive live region outside role=\"alert\"');\n });\n const doc = (root as Node).ownerDocument || (root as Document);\n const anims = typeof (root as any).getAnimations === 'function' ? ((root as any).getAnimations({ subtree: true }) as Animation[]) : [];\n const control = doc && (doc.querySelector('usa-motion-switch, [data-usa-pause]') || doc.documentElement.hasAttribute('data-usa-sensitivity'));\n if (!control)\n anims.forEach((a) => {\n try {\n if (a.effect?.getComputedTiming().iterations === Infinity) {\n const t = (a.effect as KeyframeEffect).target;\n if (t) add('infinite-no-control', 'warning', t, 'endless animation and no motion control on the page');\n }\n } catch {\n /* ignore */\n }\n });\n return { errors: issues.filter((i) => i.level === 'error'), warnings: issues.filter((i) => i.level === 'warning') };\n}\n\n/** Every `<usa-*>` tag, for sweeping audits. */\nexport const ALL_TAGS: string[] = (Object.values(COMPONENT_CATEGORIES) as readonly (readonly string[])[]).flat();\n"],"names":[],"mappings":";;;;AAAA;;;;;;;;;;;;;;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,CAAC,OAAO,CAAC,CAAC,CAAC,KAAI;AAClB,YAAA,IAAI;gBACF,IAAI,CAAC,CAAC,MAAM,EAAE,iBAAiB,EAAE,CAAC,UAAU,KAAK,QAAQ,EAAE;AACzD,oBAAA,MAAM,CAAC,GAAI,CAAC,CAAC,MAAyB,CAAC,MAAM;AAC7C,oBAAA,IAAI,CAAC;wBAAE,GAAG,CAAC,qBAAqB,EAAE,SAAS,EAAE,CAAC,EAAE,qDAAqD,CAAC;gBACxG;YACF;AAAE,YAAA,MAAM;;YAER;AACF,QAAA,CAAC,CAAC;AACJ,IAAA,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,KAAK,OAAO,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,EAAE;AACrH;AAEA;AACO,MAAM,QAAQ,GAAc,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAoC,CAAC,IAAI;;;;"}
|
|
1
|
+
{"version":3,"file":"a11y.js","sources":["../../src/components/a11y/baseline.ts","../../src/components/a11y/index.ts"],"sourcesContent":["/**\n * 4.9 — the 5.0 modern-browser baseline. `baselineReport()` lists which\n * required / progressive features this browser has; `warnBaseline()` logs\n * once in development when a required one is missing.\n */\nimport { deprecate } from '../base';\n\nexport interface BaselineFeature {\n id: string;\n required: boolean;\n supported: boolean;\n}\n\n/** Required in 5.0: Custom Elements, WAAPI, IntersectionObserver, ResizeObserver, adoptedStyleSheets. Progressive: View Transitions, scroll-driven animations, WebGL. */\nexport function baselineReport(): BaselineFeature[] {\n const w = (typeof window !== 'undefined' ? window : {}) as any;\n const d = (typeof document !== 'undefined' ? document : {}) as any;\n const css = (q: string) => typeof w.CSS?.supports === 'function' && w.CSS.supports(q);\n return [\n { id: 'custom-elements', required: true, supported: !!w.customElements },\n { id: 'web-animations', required: true, supported: typeof w.Element?.prototype?.animate === 'function' },\n { id: 'intersection-observer', required: true, supported: typeof w.IntersectionObserver === 'function' },\n { id: 'resize-observer', required: true, supported: typeof w.ResizeObserver === 'function' },\n { id: 'adopted-stylesheets', required: true, supported: 'adoptedStyleSheets' in d },\n { id: 'view-transitions', required: false, supported: typeof d.startViewTransition === 'function' },\n { id: 'scroll-driven-animations', required: false, supported: css('animation-timeline: view()') },\n { id: 'webgl', required: false, supported: !!(d.createElement && (() => { try { return d.createElement('canvas').getContext('webgl'); } catch { return null; } })()) },\n ];\n}\n\n/** Log (once) which required 5.0 features are missing here. Returns the missing ids. */\nexport function warnBaseline(): string[] {\n const missing = baselineReport().filter((f) => f.required && !f.supported).map((f) => f.id);\n if (missing.length) deprecate('baseline', `this browser lacks ${missing.join(', ')}; use-scroll-animate 5.0 requires them (modern-browser baseline, see docs/upgrading-5.md).`);\n return missing;\n}\n","/**\n * use-scroll-animate/components/a11y — accessibility toolkit (4.4).\n *\n * - Motion-sensitivity levels: `setMotionSensitivity('full' | 'gentle' | 'minimal' | 'static')`.\n * - Static alternatives: what every component shows when motion is off, and\n * `staticAlternative(root)` to freeze any subtree at its final state.\n * - `aria-live` conventions: one shared polite and one assertive region,\n * `announce(message, { politeness })`.\n * - `auditMotionA11y(root)`: the rules the automated regression tests run\n * over every `<usa-*>` element — usable in your own tests too.\n *\n * ```ts\n * import { setMotionSensitivity, announce, auditMotionA11y } from 'use-scroll-animate/components/a11y';\n * setMotionSensitivity('gentle', true); // no spins / zooms / parallax, remembered\n * announce('3 items added to cart'); // polite live region\n * expect(auditMotionA11y(document.body).errors).toEqual([]);\n * ```\n */\nimport {\n configureComponents,\n getMotionSensitivity,\n adaptKeyframes,\n adoptStyles,\n MOTION_SENSITIVITY_LEVELS,\n type MotionSensitivity,\n} from '../base';\nimport { COMPONENT_CATEGORIES, type ComponentCategory } from '../index-tags';\n\nexport { getMotionSensitivity, adaptKeyframes, MOTION_SENSITIVITY_LEVELS };\nexport { baselineReport, warnBaseline } from './baseline';\nexport type { BaselineFeature } from './baseline';\nexport type { MotionSensitivity };\n\nconst KEY = 'usa:sensitivity';\n\n/** What each level allows, for docs and settings UIs. */\nexport const MOTION_SENSITIVITY: Record<MotionSensitivity, { en: string; zh: string; allows: string[] }> = {\n full: { en: 'All motion', zh: '全部动效', allows: ['fade', 'translate', 'scale', 'rotate', 'parallax', 'loop', 'flash'] },\n gentle: { en: 'Gentle — no spins, zooms or parallax', zh: '温和 —— 无旋转、缩放与视差', allows: ['fade', 'translate', 'loop'] },\n minimal: { en: 'Minimal — fades only', zh: '最少 —— 仅淡入淡出', allows: ['fade'] },\n static: { en: 'Static — no animation', zh: '静态 —— 无动画', allows: [] },\n};\n\n/** CSS applied at the `static` / `minimal` / `gentle` levels (also stops your own CSS animations under `static`). */\nexport const SENSITIVITY_CSS =\n 'html[data-usa-sensitivity=\"static\"] *,html[data-usa-sensitivity=\"static\"] *::before,html[data-usa-sensitivity=\"static\"] *::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}' +\n 'html[data-usa-sensitivity=\"minimal\"] *,html[data-usa-sensitivity=\"minimal\"] *::before,html[data-usa-sensitivity=\"minimal\"] *::after{animation-duration:1ms!important;animation-iteration-count:1!important;scroll-behavior:auto!important}' +\n 'html[data-usa-sensitivity=\"gentle\"]{--usa-parallax:0;--usa-tilt:0}';\n\n/**\n * Set the motion-sensitivity level for every `<usa-*>` component and the page:\n * sets `data-usa-sensitivity` on `<html>`, adapts component keyframes, and\n * with `persist` remembers the choice (`restoreMotionSensitivity()`).\n * Dispatches `usa:sensitivity` on `document`.\n */\nexport function setMotionSensitivity(level: MotionSensitivity, persist = false): void {\n if (!MOTION_SENSITIVITY_LEVELS.includes(level)) return;\n configureComponents({ motionSensitivity: level });\n adoptStyles('a11y-sensitivity', SENSITIVITY_CSS);\n if (persist) {\n try {\n localStorage.setItem(KEY, level);\n } catch {\n /* private mode */\n }\n }\n if (level === 'static' && typeof document !== 'undefined') staticAlternative(document.documentElement);\n if (typeof document !== 'undefined') document.dispatchEvent(new CustomEvent('usa:sensitivity', { detail: { level } }));\n}\n\n/** Re-apply a persisted level (call early on page load). Returns the active level. */\nexport function restoreMotionSensitivity(): MotionSensitivity {\n try {\n const v = localStorage.getItem(KEY) as MotionSensitivity | null;\n if (v && MOTION_SENSITIVITY_LEVELS.includes(v)) setMotionSensitivity(v);\n } catch {\n /* ignore */\n }\n return getMotionSensitivity();\n}\n\n/** `true` when the current level allows a kind of motion (`'rotate'`, `'parallax'`, `'loop'`…). */\nexport function motionAllowed(kind: string, level: MotionSensitivity = getMotionSensitivity()): boolean {\n return MOTION_SENSITIVITY[level].allows.includes(kind);\n}\n\n/** The static alternative of each category: what its elements show without motion. */\nexport const STATIC_ALTERNATIVES: Record<ComponentCategory, string> = {\n reveal: 'Content visible in place; progress bars show the current value.',\n text: 'Full final text (screen readers always get a plain copy).',\n interaction: 'Normal hover / focus styles; no tilt, magnet or ripple.',\n feedback: 'Spinners become a static busy indicator; progress shows its value; toasts appear without sliding.',\n background: 'A still frame of the background (gradient / pattern); particles and marquees stop.',\n transitions: 'Dialogs, accordions and views switch instantly.',\n physics: 'Values jump to their target; drag still works, without inertia.',\n cards: 'Cards are shown flat and fully readable; stacks become lists.',\n click: 'Clicks work and states are announced; no bursts, confetti or deformation.',\n ui: 'Tabs, drawers, sheets and popovers open instantly with focus management intact.',\n page: 'Page transitions are instant; cursors and ambient layers are hidden.',\n timeline: 'Every step is shown at its final state.',\n gesture: 'Buttons / keys provide the same actions as swipes and pinches.',\n svg: 'Drawings and icons are shown complete.',\n webgl: 'A static poster image or CSS gradient instead of the shader.',\n depth: 'Flat, front-facing layout.',\n layout: 'Items reflow instantly.',\n packs: 'Roles are styled but not animated.',\n};\n\n/**\n * Freeze a subtree at its static alternative: finishes running animations\n * (`finish()`, so content lands on its final state), marks the root with\n * `data-usa-static` and returns an undo that removes the mark.\n */\nexport function staticAlternative(root: Element): () => void {\n const getAll = (root as any).getAnimations as undefined | ((o: { subtree: boolean }) => Animation[]);\n if (typeof getAll === 'function') {\n for (const a of getAll.call(root, { subtree: true })) {\n try {\n const it = a.effect?.getComputedTiming().iterations;\n if (it === Infinity) a.cancel();\n else a.finish();\n } catch {\n /* finished already */\n }\n }\n }\n root.setAttribute('data-usa-static', '');\n return () => root.removeAttribute('data-usa-static');\n}\n\n// --- aria-live conventions ---------------------------------------------------\n\nexport type Politeness = 'polite' | 'assertive';\n/** The ids of the shared live regions. */\nexport const LIVE_REGION_IDS: Record<Politeness, string> = { polite: 'usa-live-polite', assertive: 'usa-live-assertive' };\n\n/** The shared live region (created once, visually hidden, `role=\"status\"` / `role=\"alert\"`). */\nexport function liveRegion(politeness: Politeness = 'polite'): HTMLElement | null {\n if (typeof document === 'undefined' || !document.body) return null;\n const id = LIVE_REGION_IDS[politeness];\n let el = document.getElementById(id);\n if (!el) {\n el = document.createElement('div');\n el.id = id;\n el.className = 'usa-sr';\n el.setAttribute('role', politeness === 'assertive' ? 'alert' : 'status');\n el.setAttribute('aria-live', politeness);\n el.setAttribute('aria-atomic', 'true');\n document.body.appendChild(el);\n }\n return el;\n}\n\nlet lastMsg = '';\nlet lastAt = 0;\n/**\n * Announce a message through the shared live region. Conventions: `polite`\n * for results of the user's own actions (added, saved, copied), `assertive`\n * only for errors that block them. Identical messages within `dedupe` ms\n * (default 500) are dropped; the region is cleared first so repeats are read.\n */\nexport function announce(message: string, options: { politeness?: Politeness; dedupe?: number } = {}): boolean {\n const { politeness = 'polite', dedupe = 500 } = options;\n const t = Date.now();\n if (!message || (message === lastMsg && t - lastAt < dedupe)) return false;\n lastMsg = message;\n lastAt = t;\n const el = liveRegion(politeness);\n if (!el) return false;\n el.textContent = '';\n el.textContent = message;\n return true;\n}\n\n// --- audit ---------------------------------------------------------------------\n\nexport interface A11yIssue {\n rule: string;\n level: 'error' | 'warning';\n element: Element;\n message: string;\n}\n\nconst FOCUSABLE = 'a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex=\"-1\"])';\nconst NAMED_ROLES = ['button', 'switch', 'checkbox', 'slider', 'tab', 'progressbar', 'radiogroup', 'dialog'];\n\nfunction accessibleName(el: Element): string {\n const label = el.getAttribute('aria-label');\n if (label) return label;\n const by = el.getAttribute('aria-labelledby');\n if (by) return by.split(/\\s+/).map((id) => el.ownerDocument.getElementById(id)?.textContent || '').join(' ').trim();\n return (el.textContent || el.getAttribute('title') || '').trim();\n}\n\n/**\n * Check a subtree against the library's motion-a11y rules:\n * - `aria-hidden-focusable` (error): focusable content inside `aria-hidden`.\n * - `role-name` (error): a widget role without an accessible name.\n * - `range-value` (error): a slider / determinate progressbar without `aria-valuenow`.\n * - `img-alt` (error): an `<img>` without `alt`.\n * - `assertive-live` (warning): `aria-live=\"assertive\"` outside `role=\"alert\"`.\n * - `infinite-no-control` (warning, WCAG 2.2.2): an endless animation on a\n * page with no way to pause motion (`<usa-motion-switch>` or `[data-usa-pause]`).\n */\nexport function auditMotionA11y(root: Element | Document): { errors: A11yIssue[]; warnings: A11yIssue[] } {\n const issues: A11yIssue[] = [];\n const add = (rule: string, level: A11yIssue['level'], element: Element, message: string) => issues.push({ rule, level, element, message });\n const scope = root as ParentNode;\n scope.querySelectorAll('[aria-hidden=\"true\"]').forEach((h) => {\n const f = (h.matches(FOCUSABLE) ? [h] : Array.from(h.querySelectorAll(FOCUSABLE))).filter((x) => !x.closest('[inert]'));\n f.forEach((x) => add('aria-hidden-focusable', 'error', x, `focusable <${x.tagName.toLowerCase()}> inside aria-hidden`));\n });\n scope.querySelectorAll('[role]').forEach((el) => {\n const role = el.getAttribute('role')!;\n if (NAMED_ROLES.includes(role) && !accessibleName(el)) add('role-name', 'error', el, `role=\"${role}\" has no accessible name`);\n if (role === 'slider' && !el.hasAttribute('aria-valuenow'))\n add('range-value', 'error', el, 'slider without aria-valuenow');\n });\n scope.querySelectorAll('img:not([alt])').forEach((el) => add('img-alt', 'error', el, '<img> without alt'));\n scope.querySelectorAll('[aria-live=\"assertive\"]').forEach((el) => {\n if (el.getAttribute('role') !== 'alert') add('assertive-live', 'warning', el, 'assertive live region outside role=\"alert\"');\n });\n const doc = (root as Node).ownerDocument || (root as Document);\n const anims = typeof (root as any).getAnimations === 'function' ? ((root as any).getAnimations({ subtree: true }) as Animation[]) : [];\n const control = doc && (doc.querySelector('usa-motion-switch, [data-usa-pause]') || doc.documentElement.hasAttribute('data-usa-sensitivity'));\n if (!control)\n anims.forEach((a) => {\n try {\n if (a.effect?.getComputedTiming().iterations === Infinity) {\n const t = (a.effect as KeyframeEffect).target;\n if (t) add('infinite-no-control', 'warning', t, 'endless animation and no motion control on the page');\n }\n } catch {\n /* ignore */\n }\n });\n return { errors: issues.filter((i) => i.level === 'error'), warnings: issues.filter((i) => i.level === 'warning') };\n}\n\n/** Every `<usa-*>` tag, for sweeping audits. */\nexport const ALL_TAGS: string[] = (Object.values(COMPONENT_CATEGORIES) as readonly (readonly string[])[]).flat();\n"],"names":[],"mappings":";;;;AAAA;;;;AAIG;AASH;SACgB,cAAc,GAAA;AAC5B,IAAA,MAAM,CAAC,IAAI,OAAO,MAAM,KAAK,WAAW,GAAG,MAAM,GAAG,EAAE,CAAQ;AAC9D,IAAA,MAAM,CAAC,IAAI,OAAO,QAAQ,KAAK,WAAW,GAAG,QAAQ,GAAG,EAAE,CAAQ;IAClE,MAAM,GAAG,GAAG,CAAC,CAAS,KAAK,OAAO,CAAC,CAAC,GAAG,EAAE,QAAQ,KAAK,UAAU,IAAI,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;IACrF,OAAO;AACL,QAAA,EAAE,EAAE,EAAE,iBAAiB,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,cAAc,EAAE;QACxE,EAAE,EAAE,EAAE,gBAAgB,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,KAAK,UAAU,EAAE;AACx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AC,IAAI,GAAG,CAAC,eAAe,CAAC,YAAY,CAAC,sBAAsB,CAAC,CAAC;AAC7I,IAAA,IAAI,CAAC,OAAO;AACV,QAAA,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAI;AAClB,YAAA,IAAI;gBACF,IAAI,CAAC,CAAC,MAAM,EAAE,iBAAiB,EAAE,CAAC,UAAU,KAAK,QAAQ,EAAE;AACzD,oBAAA,MAAM,CAAC,GAAI,CAAC,CAAC,MAAyB,CAAC,MAAM;AAC7C,oBAAA,IAAI,CAAC;wBAAE,GAAG,CAAC,qBAAqB,EAAE,SAAS,EAAE,CAAC,EAAE,qDAAqD,CAAC;gBACxG;YACF;AAAE,YAAA,MAAM;;YAER;AACF,QAAA,CAAC,CAAC;AACJ,IAAA,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,KAAK,OAAO,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,EAAE;AACrH;AAEA;AACO,MAAM,QAAQ,GAAc,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAoC,CAAC,IAAI;;;;"}
|
|
@@ -3,24 +3,24 @@
|
|
|
3
3
|
var components = require('../components.cjs');
|
|
4
4
|
var bind = require('../chunks/bind-Ui43-n2d.cjs');
|
|
5
5
|
require('./reveal.cjs');
|
|
6
|
-
require('../chunks/base-
|
|
6
|
+
require('../chunks/base-BvpQ4Ggj.cjs');
|
|
7
7
|
require('./text.cjs');
|
|
8
|
-
require('../chunks/core-
|
|
8
|
+
require('../chunks/core-BWO7JKJ5.cjs');
|
|
9
9
|
require('./tokens.cjs');
|
|
10
10
|
require('./interaction.cjs');
|
|
11
11
|
require('./feedback.cjs');
|
|
12
12
|
require('./background.cjs');
|
|
13
|
-
require('../chunks/variants-
|
|
13
|
+
require('../chunks/variants-C8xj8gfd.cjs');
|
|
14
14
|
require('./transitions.cjs');
|
|
15
15
|
require('./physics.cjs');
|
|
16
|
-
require('../chunks/spring-
|
|
16
|
+
require('../chunks/spring-fFkqE9J0.cjs');
|
|
17
17
|
require('./cards.cjs');
|
|
18
18
|
require('./click.cjs');
|
|
19
19
|
require('./ui.cjs');
|
|
20
20
|
require('./page.cjs');
|
|
21
21
|
require('./timeline.cjs');
|
|
22
22
|
require('./gesture.cjs');
|
|
23
|
-
require('../chunks/core-
|
|
23
|
+
require('../chunks/core-CCAM3nKw.cjs');
|
|
24
24
|
require('./svg.cjs');
|
|
25
25
|
require('./webgl.cjs');
|
|
26
26
|
require('./depth.cjs');
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { defineComponents } from '../components.js';
|
|
2
2
|
export { b as bindUsa, u as usaEventName } from '../chunks/bind-B_CTL6Qn.js';
|
|
3
3
|
import './reveal.js';
|
|
4
|
-
import '../chunks/base-
|
|
4
|
+
import '../chunks/base-DbbRUxaa.js';
|
|
5
5
|
import './text.js';
|
|
6
|
-
import '../chunks/core-
|
|
6
|
+
import '../chunks/core-BVTuet9o.js';
|
|
7
7
|
import './tokens.js';
|
|
8
8
|
import './interaction.js';
|
|
9
9
|
import './feedback.js';
|
|
10
10
|
import './background.js';
|
|
11
|
-
import '../chunks/variants-
|
|
11
|
+
import '../chunks/variants-Cal4DB0E.js';
|
|
12
12
|
import './transitions.js';
|
|
13
13
|
import './physics.js';
|
|
14
|
-
import '../chunks/spring-
|
|
14
|
+
import '../chunks/spring-B6w7mVCU.js';
|
|
15
15
|
import './cards.js';
|
|
16
16
|
import './click.js';
|
|
17
17
|
import './ui.js';
|
|
18
18
|
import './page.js';
|
|
19
19
|
import './timeline.js';
|
|
20
20
|
import './gesture.js';
|
|
21
|
-
import '../chunks/core-
|
|
21
|
+
import '../chunks/core-CcaSsbV8.js';
|
|
22
22
|
import './svg.js';
|
|
23
23
|
import './webgl.js';
|
|
24
24
|
import './depth.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var base = require('../chunks/base-
|
|
4
|
-
var variants = require('../chunks/variants-
|
|
3
|
+
var base = require('../chunks/base-BvpQ4Ggj.cjs');
|
|
4
|
+
var variants = require('../chunks/variants-C8xj8gfd.cjs');
|
|
5
5
|
|
|
6
6
|
var css$6 = "usa-aurora{position:relative;display:block;isolation:isolate;overflow:hidden}usa-aurora .usa-aurora-layer{position:absolute;inset:0;z-index:-1;pointer-events:none;opacity:var(--usa-aurora-opacity,0.7);overflow:hidden;contain:strict}usa-aurora .usa-aurora-layer i{position:absolute;display:block;width:70%;aspect-ratio:1;border-radius:50%;background:radial-gradient(closest-side,var(--c),transparent);will-change:transform;animation:usa-aurora-a var(--usa-aurora-speed,18s) ease-in-out infinite alternate}usa-aurora .usa-aurora-layer i:nth-child(1){left:-15%;top:-30%}usa-aurora .usa-aurora-layer i:nth-child(2){right:-20%;top:-10%;animation-name:usa-aurora-b;animation-duration:calc(var(--usa-aurora-speed,18s) * 1.3)}usa-aurora .usa-aurora-layer i:nth-child(3){left:10%;bottom:-45%;animation-name:usa-aurora-c;animation-duration:calc(var(--usa-aurora-speed,18s) * 0.9)}usa-aurora .usa-aurora-layer i:nth-child(4){right:0;bottom:-30%;width:50%;animation-name:usa-aurora-b;animation-direction:alternate-reverse}usa-aurora[paused] .usa-aurora-layer i,usa-aurora[data-offscreen] .usa-aurora-layer i{animation-play-state:paused}@keyframes usa-aurora-a{from{transform:translate3d(0,0,0) scale(1)}to{transform:translate3d(30%,20%,0) scale(1.25)}}@keyframes usa-aurora-b{from{transform:translate3d(0,0,0) scale(1.1)}to{transform:translate3d(-35%,25%,0) scale(0.85)}}@keyframes usa-aurora-c{from{transform:translate3d(0,0,0) rotate(0deg) scale(1)}to{transform:translate3d(25%,-30%,0) rotate(40deg) scale(1.2)}}@media (prefers-reduced-motion:reduce){usa-aurora .usa-aurora-layer i,usa-grain .usa-grain-layer,usa-acrylic::after{animation:none !important}}";
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { f as configureComponents } from '../chunks/base-
|
|
3
|
-
import { s as setVariant } from '../chunks/variants-
|
|
1
|
+
import { v as defineElement, k as caf, r as raf, t as adoptStyles, p as prefersReducedMotion } from '../chunks/base-DbbRUxaa.js';
|
|
2
|
+
export { f as configureComponents } from '../chunks/base-DbbRUxaa.js';
|
|
3
|
+
import { s as setVariant } from '../chunks/variants-Cal4DB0E.js';
|
|
4
4
|
|
|
5
5
|
var css$6 = "usa-aurora{position:relative;display:block;isolation:isolate;overflow:hidden}usa-aurora .usa-aurora-layer{position:absolute;inset:0;z-index:-1;pointer-events:none;opacity:var(--usa-aurora-opacity,0.7);overflow:hidden;contain:strict}usa-aurora .usa-aurora-layer i{position:absolute;display:block;width:70%;aspect-ratio:1;border-radius:50%;background:radial-gradient(closest-side,var(--c),transparent);will-change:transform;animation:usa-aurora-a var(--usa-aurora-speed,18s) ease-in-out infinite alternate}usa-aurora .usa-aurora-layer i:nth-child(1){left:-15%;top:-30%}usa-aurora .usa-aurora-layer i:nth-child(2){right:-20%;top:-10%;animation-name:usa-aurora-b;animation-duration:calc(var(--usa-aurora-speed,18s) * 1.3)}usa-aurora .usa-aurora-layer i:nth-child(3){left:10%;bottom:-45%;animation-name:usa-aurora-c;animation-duration:calc(var(--usa-aurora-speed,18s) * 0.9)}usa-aurora .usa-aurora-layer i:nth-child(4){right:0;bottom:-30%;width:50%;animation-name:usa-aurora-b;animation-direction:alternate-reverse}usa-aurora[paused] .usa-aurora-layer i,usa-aurora[data-offscreen] .usa-aurora-layer i{animation-play-state:paused}@keyframes usa-aurora-a{from{transform:translate3d(0,0,0) scale(1)}to{transform:translate3d(30%,20%,0) scale(1.25)}}@keyframes usa-aurora-b{from{transform:translate3d(0,0,0) scale(1.1)}to{transform:translate3d(-35%,25%,0) scale(0.85)}}@keyframes usa-aurora-c{from{transform:translate3d(0,0,0) rotate(0deg) scale(1)}to{transform:translate3d(25%,-30%,0) rotate(40deg) scale(1.2)}}@media (prefers-reduced-motion:reduce){usa-aurora .usa-aurora-layer i,usa-grain .usa-grain-layer,usa-acrylic::after{animation:none !important}}";
|
|
6
6
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as configureComponents, a as MOTION_SENSITIVITY_LEVELS } from '../chunks/base-
|
|
1
|
+
import { f as configureComponents, a as MOTION_SENSITIVITY_LEVELS } from '../chunks/base-DbbRUxaa.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* use-scroll-animate/components/bridge — native shell bridges (4.7).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var base = require('../chunks/base-
|
|
4
|
-
var spring = require('../chunks/spring-
|
|
3
|
+
var base = require('../chunks/base-BvpQ4Ggj.cjs');
|
|
4
|
+
var spring = require('../chunks/spring-fFkqE9J0.cjs');
|
|
5
5
|
|
|
6
6
|
var css$3 = "usa-card{--usa-card-radius:18px;--usa-card-bg:var(--usa-surface,#1b1e27);--usa-card-glow:var(--usa-accent,#7c5cff);--usa-card-x:50%;--usa-card-y:50%;--usa-card-nx:0;--usa-card-ny:0;position:relative;display:block;border-radius:var(--usa-card-radius);isolation:isolate;-webkit-tap-highlight-color:transparent}usa-card:focus-visible{outline:2px solid var(--usa-card-glow);outline-offset:3px}usa-card[effect~=\"lift\"]{transition:transform 0.45s cubic-bezier(0.34,1.56,0.64,1),box-shadow 0.45s ease}usa-card[effect~=\"lift\"][data-hover],usa-card[effect~=\"lift\"]:focus-visible{transform:translateY(-6px) perspective(900px) rotateX(calc(var(--usa-card-ny) * -4deg)) rotateY(calc(var(--usa-card-nx) * 4deg));box-shadow:0 22px 44px -18px rgb(0 0 0 / 0.55)}usa-card[effect~=\"glass\"]{background:color-mix(in srgb,var(--usa-card-bg) 45%,transparent);border:1px solid rgb(255 255 255 / 0.16);-webkit-backdrop-filter:blur(18px) saturate(1.5);backdrop-filter:blur(18px) saturate(1.5)}usa-card[effect~=\"spotlight\"]::before,usa-card[effect~=\"border-glow\"]::after{content:\"\";position:absolute;inset:0;border-radius:inherit;pointer-events:none;opacity:0;transition:opacity 0.3s ease}usa-card[effect~=\"spotlight\"]::before{z-index:-1;background:radial-gradient(260px circle at var(--usa-card-x) var(--usa-card-y),color-mix(in srgb,var(--usa-card-glow) 28%,transparent),transparent 70%)}usa-card[effect~=\"border-glow\"]::after{padding:1.5px;background:radial-gradient(180px circle at var(--usa-card-x) var(--usa-card-y),var(--usa-card-glow),transparent 70%);-webkit-mask:linear-gradient(#000 0 0) content-box exclude,linear-gradient(#000 0 0);mask:linear-gradient(#000 0 0) content-box exclude,linear-gradient(#000 0 0)}usa-card[data-hover]::before,usa-card[data-hover]::after{opacity:1}@property --usa-card-angle{syntax:\"<angle>\";inherits:false;initial-value:0deg}usa-card[effect~=\"conic-border\"]{border:2px solid transparent;background:linear-gradient(var(--usa-card-bg),var(--usa-card-bg)) padding-box,conic-gradient(from var(--usa-card-angle),var(--usa-card-glow),#22d3ee,#f472b6,var(--usa-card-glow)) border-box;animation:usa-card-spin 4s linear infinite}@keyframes usa-card-spin{to{--usa-card-angle:360deg}}usa-card .usa-card-sheen{position:absolute;inset:0;border-radius:inherit;overflow:hidden;pointer-events:none}usa-card .usa-card-sheen::before{content:\"\";position:absolute;top:0;bottom:0;width:45%;left:-60%;transform:skewX(-20deg);background:linear-gradient(90deg,transparent,rgb(255 255 255 / 0.35),transparent)}usa-card[effect~=\"sheen\"]:hover .usa-card-sheen::before,usa-card[effect~=\"sheen\"]:focus-visible .usa-card-sheen::before{left:130%;transition:left 0.8s cubic-bezier(0.22,1,0.36,1)}usa-card .usa-card-holo{position:absolute;inset:0;border-radius:inherit;pointer-events:none;mix-blend-mode:color-dodge;opacity:0.35;background:linear-gradient(115deg,transparent 20%,#ff7ad9 35%,#7af0ff 45%,#ffe27a 55%,transparent 70%) calc(var(--usa-card-x) * 1.4 - 20%) calc(var(--usa-card-y) * 1.4 - 20%) / 220% 220%;transition:opacity 0.3s ease}usa-card[data-hover] .usa-card-holo{opacity:0.7}usa-card[effect~=\"parallax-layers\"] [data-depth]{transition:transform 0.25s ease-out;will-change:transform}usa-card[effect~=\"flip\"]{perspective:1000px;display:grid}usa-card[effect~=\"flip\"]>[data-front],usa-card[effect~=\"flip\"]>[data-back]{grid-area:1 / 1;backface-visibility:hidden;-webkit-backface-visibility:hidden;border-radius:inherit;transition:transform 0.7s cubic-bezier(0.34,1.3,0.64,1),opacity 0.3s ease}usa-card[effect~=\"flip\"]>[data-back]{transform:rotateY(180deg)}usa-card[effect~=\"flip\"][axis=\"x\"]>[data-back]{transform:rotateX(180deg)}usa-card[effect~=\"flip\"][flipped]>[data-front],usa-card[effect~=\"flip\"]:not([trigger=\"click\"]):hover>[data-front]{transform:rotateY(-180deg)}usa-card[effect~=\"flip\"][flipped]>[data-back],usa-card[effect~=\"flip\"]:not([trigger=\"click\"]):hover>[data-back]{transform:rotateY(0deg)}usa-card[effect~=\"flip\"][axis=\"x\"][flipped]>[data-front],usa-card[effect~=\"flip\"][axis=\"x\"]:not([trigger=\"click\"]):hover>[data-front]{transform:rotateX(180deg)}usa-card[effect~=\"flip\"][axis=\"x\"][flipped]>[data-back],usa-card[effect~=\"flip\"][axis=\"x\"]:not([trigger=\"click\"]):hover>[data-back]{transform:rotateX(0deg)}usa-card[effect~=\"flip\"][trigger=\"click\"]{cursor:pointer}usa-card[effect~=\"expand\"]{cursor:zoom-in}usa-card[effect~=\"expand\"]:not([expanded]) [data-detail]{display:none}usa-card[expanded]{position:fixed;inset:6vh max(4vw,calc(50vw - 420px));z-index:1000;overflow:auto;cursor:default;background:var(--usa-card-bg);box-shadow:0 30px 80px -20px rgb(0 0 0 / 0.6)}.usa-card-backdrop{position:fixed;inset:0;z-index:999;background:rgb(0 0 0 / 0.45)}@media (prefers-reduced-motion:reduce){usa-card,usa-card *,usa-card .usa-card-sheen::before{transition-duration:0.01ms !important;animation:none !important}usa-card[effect~=\"lift\"][data-hover]{transform:none}usa-card[effect~=\"flip\"]>[data-front],usa-card[effect~=\"flip\"]>[data-back]{transform:none !important}usa-card[effect~=\"flip\"][flipped]>[data-front],usa-card[effect~=\"flip\"]:not([flipped])>[data-back]{opacity:0;visibility:hidden}usa-card[effect~=\"flip\"]:not([trigger=\"click\"]):hover>[data-front]{opacity:0;visibility:hidden}usa-card[effect~=\"flip\"]:not([trigger=\"click\"]):hover>[data-back]{opacity:1;visibility:visible}}@media (prefers-reduced-transparency:reduce),(forced-colors:active){usa-card[effect~=\"glass\"]{background:var(--usa-card-bg);-webkit-backdrop-filter:none;backdrop-filter:none}}";
|
|
7
7
|
|
package/dist/components/cards.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { f as configureComponents, p as prefersReducedMotion } from '../chunks/base-
|
|
3
|
-
import { d as springEasing, c as createSpring } from '../chunks/spring-
|
|
1
|
+
import { v as defineElement, r as raf, k as caf, w as EASE_OUT, j as clamp } from '../chunks/base-DbbRUxaa.js';
|
|
2
|
+
export { f as configureComponents, p as prefersReducedMotion } from '../chunks/base-DbbRUxaa.js';
|
|
3
|
+
import { d as springEasing, c as createSpring } from '../chunks/spring-B6w7mVCU.js';
|
|
4
4
|
|
|
5
5
|
var css$3 = "usa-card{--usa-card-radius:18px;--usa-card-bg:var(--usa-surface,#1b1e27);--usa-card-glow:var(--usa-accent,#7c5cff);--usa-card-x:50%;--usa-card-y:50%;--usa-card-nx:0;--usa-card-ny:0;position:relative;display:block;border-radius:var(--usa-card-radius);isolation:isolate;-webkit-tap-highlight-color:transparent}usa-card:focus-visible{outline:2px solid var(--usa-card-glow);outline-offset:3px}usa-card[effect~=\"lift\"]{transition:transform 0.45s cubic-bezier(0.34,1.56,0.64,1),box-shadow 0.45s ease}usa-card[effect~=\"lift\"][data-hover],usa-card[effect~=\"lift\"]:focus-visible{transform:translateY(-6px) perspective(900px) rotateX(calc(var(--usa-card-ny) * -4deg)) rotateY(calc(var(--usa-card-nx) * 4deg));box-shadow:0 22px 44px -18px rgb(0 0 0 / 0.55)}usa-card[effect~=\"glass\"]{background:color-mix(in srgb,var(--usa-card-bg) 45%,transparent);border:1px solid rgb(255 255 255 / 0.16);-webkit-backdrop-filter:blur(18px) saturate(1.5);backdrop-filter:blur(18px) saturate(1.5)}usa-card[effect~=\"spotlight\"]::before,usa-card[effect~=\"border-glow\"]::after{content:\"\";position:absolute;inset:0;border-radius:inherit;pointer-events:none;opacity:0;transition:opacity 0.3s ease}usa-card[effect~=\"spotlight\"]::before{z-index:-1;background:radial-gradient(260px circle at var(--usa-card-x) var(--usa-card-y),color-mix(in srgb,var(--usa-card-glow) 28%,transparent),transparent 70%)}usa-card[effect~=\"border-glow\"]::after{padding:1.5px;background:radial-gradient(180px circle at var(--usa-card-x) var(--usa-card-y),var(--usa-card-glow),transparent 70%);-webkit-mask:linear-gradient(#000 0 0) content-box exclude,linear-gradient(#000 0 0);mask:linear-gradient(#000 0 0) content-box exclude,linear-gradient(#000 0 0)}usa-card[data-hover]::before,usa-card[data-hover]::after{opacity:1}@property --usa-card-angle{syntax:\"<angle>\";inherits:false;initial-value:0deg}usa-card[effect~=\"conic-border\"]{border:2px solid transparent;background:linear-gradient(var(--usa-card-bg),var(--usa-card-bg)) padding-box,conic-gradient(from var(--usa-card-angle),var(--usa-card-glow),#22d3ee,#f472b6,var(--usa-card-glow)) border-box;animation:usa-card-spin 4s linear infinite}@keyframes usa-card-spin{to{--usa-card-angle:360deg}}usa-card .usa-card-sheen{position:absolute;inset:0;border-radius:inherit;overflow:hidden;pointer-events:none}usa-card .usa-card-sheen::before{content:\"\";position:absolute;top:0;bottom:0;width:45%;left:-60%;transform:skewX(-20deg);background:linear-gradient(90deg,transparent,rgb(255 255 255 / 0.35),transparent)}usa-card[effect~=\"sheen\"]:hover .usa-card-sheen::before,usa-card[effect~=\"sheen\"]:focus-visible .usa-card-sheen::before{left:130%;transition:left 0.8s cubic-bezier(0.22,1,0.36,1)}usa-card .usa-card-holo{position:absolute;inset:0;border-radius:inherit;pointer-events:none;mix-blend-mode:color-dodge;opacity:0.35;background:linear-gradient(115deg,transparent 20%,#ff7ad9 35%,#7af0ff 45%,#ffe27a 55%,transparent 70%) calc(var(--usa-card-x) * 1.4 - 20%) calc(var(--usa-card-y) * 1.4 - 20%) / 220% 220%;transition:opacity 0.3s ease}usa-card[data-hover] .usa-card-holo{opacity:0.7}usa-card[effect~=\"parallax-layers\"] [data-depth]{transition:transform 0.25s ease-out;will-change:transform}usa-card[effect~=\"flip\"]{perspective:1000px;display:grid}usa-card[effect~=\"flip\"]>[data-front],usa-card[effect~=\"flip\"]>[data-back]{grid-area:1 / 1;backface-visibility:hidden;-webkit-backface-visibility:hidden;border-radius:inherit;transition:transform 0.7s cubic-bezier(0.34,1.3,0.64,1),opacity 0.3s ease}usa-card[effect~=\"flip\"]>[data-back]{transform:rotateY(180deg)}usa-card[effect~=\"flip\"][axis=\"x\"]>[data-back]{transform:rotateX(180deg)}usa-card[effect~=\"flip\"][flipped]>[data-front],usa-card[effect~=\"flip\"]:not([trigger=\"click\"]):hover>[data-front]{transform:rotateY(-180deg)}usa-card[effect~=\"flip\"][flipped]>[data-back],usa-card[effect~=\"flip\"]:not([trigger=\"click\"]):hover>[data-back]{transform:rotateY(0deg)}usa-card[effect~=\"flip\"][axis=\"x\"][flipped]>[data-front],usa-card[effect~=\"flip\"][axis=\"x\"]:not([trigger=\"click\"]):hover>[data-front]{transform:rotateX(180deg)}usa-card[effect~=\"flip\"][axis=\"x\"][flipped]>[data-back],usa-card[effect~=\"flip\"][axis=\"x\"]:not([trigger=\"click\"]):hover>[data-back]{transform:rotateX(0deg)}usa-card[effect~=\"flip\"][trigger=\"click\"]{cursor:pointer}usa-card[effect~=\"expand\"]{cursor:zoom-in}usa-card[effect~=\"expand\"]:not([expanded]) [data-detail]{display:none}usa-card[expanded]{position:fixed;inset:6vh max(4vw,calc(50vw - 420px));z-index:1000;overflow:auto;cursor:default;background:var(--usa-card-bg);box-shadow:0 30px 80px -20px rgb(0 0 0 / 0.6)}.usa-card-backdrop{position:fixed;inset:0;z-index:999;background:rgb(0 0 0 / 0.45)}@media (prefers-reduced-motion:reduce){usa-card,usa-card *,usa-card .usa-card-sheen::before{transition-duration:0.01ms !important;animation:none !important}usa-card[effect~=\"lift\"][data-hover]{transform:none}usa-card[effect~=\"flip\"]>[data-front],usa-card[effect~=\"flip\"]>[data-back]{transform:none !important}usa-card[effect~=\"flip\"][flipped]>[data-front],usa-card[effect~=\"flip\"]:not([flipped])>[data-back]{opacity:0;visibility:hidden}usa-card[effect~=\"flip\"]:not([trigger=\"click\"]):hover>[data-front]{opacity:0;visibility:hidden}usa-card[effect~=\"flip\"]:not([trigger=\"click\"]):hover>[data-back]{opacity:1;visibility:visible}}@media (prefers-reduced-transparency:reduce),(forced-colors:active){usa-card[effect~=\"glass\"]{background:var(--usa-card-bg);-webkit-backdrop-filter:none;backdrop-filter:none}}";
|
|
6
6
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var base = require('../chunks/base-
|
|
4
|
-
var spring = require('../chunks/spring-
|
|
3
|
+
var base = require('../chunks/base-BvpQ4Ggj.cjs');
|
|
4
|
+
var spring = require('../chunks/spring-fFkqE9J0.cjs');
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Click-effect helpers (v2.5): `burst()`, `confetti()`, `shake()`, `haptic()`.
|
package/dist/components/click.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { p as prefersReducedMotion,
|
|
2
|
-
export { f as configureComponents } from '../chunks/base-
|
|
3
|
-
import { d as springEasing, c as createSpring } from '../chunks/spring-
|
|
1
|
+
import { p as prefersReducedMotion, v as defineElement, w as EASE_OUT, j as clamp, k as caf, n as now, r as raf } from '../chunks/base-DbbRUxaa.js';
|
|
2
|
+
export { f as configureComponents } from '../chunks/base-DbbRUxaa.js';
|
|
3
|
+
import { d as springEasing, c as createSpring } from '../chunks/spring-B6w7mVCU.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Click-effect helpers (v2.5): `burst()`, `confetti()`, `shake()`, `haptic()`.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var base = require('../chunks/base-
|
|
4
|
-
var spring = require('../chunks/spring-
|
|
5
|
-
var core = require('../chunks/core-
|
|
3
|
+
var base = require('../chunks/base-BvpQ4Ggj.cjs');
|
|
4
|
+
var spring = require('../chunks/spring-fFkqE9J0.cjs');
|
|
5
|
+
var core = require('../chunks/core-CCAM3nKw.cjs');
|
|
6
6
|
|
|
7
7
|
var css = "usa-cube{--usa-cube-size:200px;display:block;width:var(--usa-cube-size);height:var(--usa-cube-size);perspective:var(--usa-cube-perspective,900px);touch-action:pan-y;user-select:none;-webkit-user-select:none;position:relative}usa-cube>[data-face]{position:absolute;inset:0;backface-visibility:hidden;transform:translateZ(calc(var(--usa-cube-size) / -2)) rotateX(var(--usa-cube-rx,0deg)) rotateY(var(--usa-cube-ry,0deg)) var(--usa-face) translateZ(calc(var(--usa-cube-size) / 2));transform-origin:50% 50%}usa-cube>[data-face=\"front\"]{--usa-face:rotateY(0deg)}usa-cube>[data-face=\"right\"]{--usa-face:rotateY(90deg)}usa-cube>[data-face=\"back\"]{--usa-face:rotateY(180deg)}usa-cube>[data-face=\"left\"]{--usa-face:rotateY(-90deg)}usa-cube>[data-face=\"top\"]{--usa-face:rotateX(90deg)}usa-cube>[data-face=\"bottom\"]{--usa-face:rotateX(-90deg)}usa-cube:focus-visible{outline:2px solid currentColor;outline-offset:6px}usa-depth{display:block;position:relative;perspective:1000px}usa-depth>*{transform:var(--usa-depth-rot,none);transform-style:preserve-3d}usa-depth [data-depth]{will-change:transform;transition:transform 0.12s linear}@media (prefers-reduced-motion:reduce){usa-depth [data-depth]{transform:none !important}}";
|
|
8
8
|
|