use-scroll-animate 2.1.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +31 -2
  3. package/README_ja.md +19 -0
  4. package/README_zh.md +30 -0
  5. package/dist/chunks/base-CJ7XfidP.cjs +233 -0
  6. package/dist/chunks/base-CJ7XfidP.cjs.map +1 -0
  7. package/dist/chunks/base-CuvCgqLy.js +219 -0
  8. package/dist/chunks/base-CuvCgqLy.js.map +1 -0
  9. package/dist/components/background.cjs +395 -0
  10. package/dist/components/background.cjs.map +1 -0
  11. package/dist/components/background.css +7 -0
  12. package/dist/components/background.d.cts +132 -0
  13. package/dist/components/background.d.ts +132 -0
  14. package/dist/components/background.js +387 -0
  15. package/dist/components/background.js.map +1 -0
  16. package/dist/components/feedback.cjs +444 -0
  17. package/dist/components/feedback.cjs.map +1 -0
  18. package/dist/components/feedback.css +7 -0
  19. package/dist/components/feedback.d.cts +170 -0
  20. package/dist/components/feedback.d.ts +170 -0
  21. package/dist/components/feedback.js +434 -0
  22. package/dist/components/feedback.js.map +1 -0
  23. package/dist/components/interaction.cjs +426 -0
  24. package/dist/components/interaction.cjs.map +1 -0
  25. package/dist/components/interaction.css +8 -0
  26. package/dist/components/interaction.d.cts +142 -0
  27. package/dist/components/interaction.d.ts +142 -0
  28. package/dist/components/interaction.js +417 -0
  29. package/dist/components/interaction.js.map +1 -0
  30. package/dist/components/physics.cjs +664 -0
  31. package/dist/components/physics.cjs.map +1 -0
  32. package/dist/components/physics.css +5 -0
  33. package/dist/components/physics.d.cts +216 -0
  34. package/dist/components/physics.d.ts +216 -0
  35. package/dist/components/physics.js +644 -0
  36. package/dist/components/physics.js.map +1 -0
  37. package/dist/components/reveal.cjs +360 -0
  38. package/dist/components/reveal.cjs.map +1 -0
  39. package/dist/components/reveal.css +5 -0
  40. package/dist/components/reveal.d.cts +132 -0
  41. package/dist/components/reveal.d.ts +132 -0
  42. package/dist/components/reveal.js +350 -0
  43. package/dist/components/reveal.js.map +1 -0
  44. package/dist/components/text.cjs +528 -0
  45. package/dist/components/text.cjs.map +1 -0
  46. package/dist/components/text.css +7 -0
  47. package/dist/components/text.d.cts +164 -0
  48. package/dist/components/text.d.ts +164 -0
  49. package/dist/components/text.js +517 -0
  50. package/dist/components/text.js.map +1 -0
  51. package/dist/components/transitions.cjs +546 -0
  52. package/dist/components/transitions.cjs.map +1 -0
  53. package/dist/components/transitions.css +6 -0
  54. package/dist/components/transitions.d.cts +180 -0
  55. package/dist/components/transitions.d.ts +180 -0
  56. package/dist/components/transitions.js +536 -0
  57. package/dist/components/transitions.js.map +1 -0
  58. package/dist/components.cjs +127 -0
  59. package/dist/components.cjs.map +1 -0
  60. package/dist/components.css +33 -0
  61. package/dist/components.d.cts +919 -0
  62. package/dist/components.d.ts +919 -0
  63. package/dist/components.js +65 -0
  64. package/dist/components.js.map +1 -0
  65. package/dist/components.umd.js +22 -0
  66. package/dist/components.umd.js.map +1 -0
  67. package/docs/API.md +2 -0
  68. package/docs/components.md +169 -0
  69. package/docs/windows-apps.md +108 -0
  70. package/package.json +105 -5
@@ -0,0 +1,219 @@
1
+ /**
2
+ * use-scroll-animate/components — shared base for the `<usa-*>` custom elements.
3
+ *
4
+ * Everything here is lazy: nothing touches `window`, `document`,
5
+ * `HTMLElement` or `matchMedia` at import time, so the components can be
6
+ * imported during SSR (Next, Nuxt, Astro…) and in Electron/Tauri preload
7
+ * scripts. Classes are created the first time a `define*()` function runs.
8
+ */
9
+ const config = { injectStyles: true, reducedMotion: 'user' };
10
+ /** Change global component settings (call before `define*()` for `injectStyles`). */
11
+ function configureComponents(options) {
12
+ Object.assign(config, options);
13
+ }
14
+ const canDefine = () => typeof customElements !== 'undefined' && typeof HTMLElement !== 'undefined';
15
+ /** `true` when animations should be reduced (OS setting or `configureComponents`). */
16
+ function prefersReducedMotion() {
17
+ if (config.reducedMotion !== 'user')
18
+ return config.reducedMotion === 'reduce';
19
+ return typeof matchMedia === 'function' && !!matchMedia('(prefers-reduced-motion: reduce)').matches;
20
+ }
21
+ const injected = new Set();
22
+ /** Add a component's stylesheet to the document once. */
23
+ function adoptStyles(id, css) {
24
+ if (!config.injectStyles || !css || injected.has(id) || typeof document === 'undefined')
25
+ return;
26
+ injected.add(id);
27
+ try {
28
+ if (typeof CSSStyleSheet === 'function' && 'adoptedStyleSheets' in document) {
29
+ const sheet = new CSSStyleSheet();
30
+ sheet.replaceSync(css);
31
+ document.adoptedStyleSheets = [...document.adoptedStyleSheets, sheet];
32
+ return;
33
+ }
34
+ }
35
+ catch {
36
+ /* fall through to <style> */
37
+ }
38
+ const style = document.createElement('style');
39
+ style.setAttribute('data-usa', id);
40
+ style.textContent = css;
41
+ (document.head || document.documentElement).appendChild(style);
42
+ }
43
+ /** Attach `css` to a shadow root (constructable sheet where supported, else `<style>`). */
44
+ function shadowStyles(root, css) {
45
+ try {
46
+ if (typeof CSSStyleSheet === 'function' && 'adoptedStyleSheets' in root) {
47
+ const sheet = new CSSStyleSheet();
48
+ sheet.replaceSync(css);
49
+ root.adoptedStyleSheets = [sheet];
50
+ return;
51
+ }
52
+ }
53
+ catch {
54
+ /* fall through */
55
+ }
56
+ const style = document.createElement('style');
57
+ style.textContent = css;
58
+ root.prepend(style);
59
+ }
60
+ let baseClass = null;
61
+ /** The lazily created base class (needs `HTMLElement`). */
62
+ function getBase() {
63
+ if (baseClass)
64
+ return baseClass;
65
+ class Base extends HTMLElement {
66
+ constructor() {
67
+ super(...arguments);
68
+ this._cleanups = [];
69
+ this._connected = false;
70
+ }
71
+ get reduced() {
72
+ return prefersReducedMotion();
73
+ }
74
+ connectedCallback() {
75
+ if (this._connected)
76
+ return;
77
+ this._connected = true;
78
+ // Upgraded while the parser is still inside us (a <script> in <head>
79
+ // defined the element): children/text are not there yet, so wait.
80
+ if (typeof document !== 'undefined' && document.readyState === 'loading' && !this.nextSibling && !this.childNodes.length) {
81
+ const go = () => {
82
+ if (this._connected && this.isConnected)
83
+ this.mount();
84
+ };
85
+ document.addEventListener('DOMContentLoaded', go, { once: true });
86
+ this._cleanups.push(() => document.removeEventListener('DOMContentLoaded', go));
87
+ return;
88
+ }
89
+ this.mount();
90
+ }
91
+ disconnectedCallback() {
92
+ this._connected = false;
93
+ this.teardown();
94
+ }
95
+ attributeChangedCallback(_name, oldValue, value) {
96
+ if (!this._connected || oldValue === value)
97
+ return;
98
+ this.changed(_name);
99
+ }
100
+ /** Re-mount on attribute change (override for finer updates). */
101
+ changed(_name) {
102
+ this.teardown();
103
+ this.mount();
104
+ }
105
+ teardown() {
106
+ this._cleanups.splice(0).reverse().forEach((fn) => fn());
107
+ this.unmount();
108
+ }
109
+ mount() { }
110
+ unmount() { }
111
+ str(name, fallback = '') {
112
+ const v = this.getAttribute(name);
113
+ return v === null ? fallback : v;
114
+ }
115
+ num(name, fallback) {
116
+ const v = this.getAttribute(name);
117
+ const n = v === null || v.trim() === '' ? NaN : Number(v);
118
+ return Number.isFinite(n) ? n : fallback;
119
+ }
120
+ /** Boolean attribute: present and not `"false"`. */
121
+ flag(name) {
122
+ const v = this.getAttribute(name);
123
+ return v !== null && v !== 'false';
124
+ }
125
+ setFlag(name, on) {
126
+ if (on)
127
+ this.setAttribute(name, '');
128
+ else
129
+ this.removeAttribute(name);
130
+ }
131
+ onCleanup(fn) {
132
+ this._cleanups.push(fn);
133
+ }
134
+ listen(target, type, fn, options) {
135
+ target.addEventListener(type, fn, options);
136
+ this.onCleanup(() => target.removeEventListener(type, fn, options));
137
+ }
138
+ /** Calls `cb(true/false)` as the element enters / leaves the viewport. */
139
+ inView(cb, init, target = this) {
140
+ if (typeof IntersectionObserver === 'undefined') {
141
+ cb(true);
142
+ return;
143
+ }
144
+ const io = new IntersectionObserver((entries) => {
145
+ for (const e of entries)
146
+ cb(e.isIntersecting, e);
147
+ }, init);
148
+ io.observe(target);
149
+ this.onCleanup(() => io.disconnect());
150
+ }
151
+ /** `el.animate()` that returns `null` (and applies the last frame) without WAAPI. */
152
+ motion(el, keyframes, options) {
153
+ if (typeof el.animate !== 'function') {
154
+ applyFrame(el, keyframes[keyframes.length - 1]);
155
+ return null;
156
+ }
157
+ return el.animate(keyframes, options);
158
+ }
159
+ emit(type, detail) {
160
+ return this.dispatchEvent(new CustomEvent(`usa:${type}`, { detail, bubbles: true, cancelable: true }));
161
+ }
162
+ }
163
+ baseClass = Base;
164
+ return baseClass;
165
+ }
166
+ /** Write a keyframe's properties as inline styles (no-WAAPI fallback). */
167
+ function applyFrame(el, frame) {
168
+ if (!frame)
169
+ return;
170
+ for (const [k, v] of Object.entries(frame)) {
171
+ if (k === 'offset' || k === 'easing' || k === 'composite' || v == null)
172
+ continue;
173
+ el.style[k] = String(v);
174
+ }
175
+ }
176
+ /**
177
+ * Register `tag` with the class built by `make(Base)`. Returns the
178
+ * constructor, the already registered one, or `undefined` without DOM.
179
+ */
180
+ function defineElement(tag, make, css) {
181
+ if (!canDefine())
182
+ return undefined;
183
+ adoptStyles('base', BASE_CSS);
184
+ if (css)
185
+ adoptStyles(css.id, css.text);
186
+ const existing = customElements.get(tag);
187
+ if (existing)
188
+ return existing;
189
+ const ctor = make(getBase());
190
+ customElements.define(tag, ctor);
191
+ return ctor;
192
+ }
193
+ const BASE_CSS = '.usa-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}';
194
+ /** A visually hidden copy of `text` for screen readers (the animated copy is `aria-hidden`). */
195
+ function srText(text) {
196
+ const s = document.createElement('span');
197
+ s.className = 'usa-sr';
198
+ s.textContent = text;
199
+ return s;
200
+ }
201
+ /** requestAnimationFrame with a timeout fallback (jsdom / hidden documents). */
202
+ const raf = (cb) => typeof requestAnimationFrame === 'function' ? requestAnimationFrame(cb) : setTimeout(() => cb(Date.now()), 16);
203
+ /** Monotonic time in ms (rAF callback timestamps differ between environments, so loops use this). */
204
+ const now = () => (typeof performance !== 'undefined' ? performance.now() : Date.now());
205
+ const caf = (id) => {
206
+ if (typeof cancelAnimationFrame === 'function')
207
+ cancelAnimationFrame(id);
208
+ else
209
+ clearTimeout(id);
210
+ };
211
+ /** Spring-ish easing used across the components. */
212
+ const EASE_OUT = 'cubic-bezier(0.22, 1, 0.36, 1)';
213
+ const EASE_SPRING = 'cubic-bezier(0.34, 1.56, 0.64, 1)';
214
+ /** Windows Fluent "decelerate" / "point-to-point" curves. */
215
+ const FLUENT_DECELERATE = 'cubic-bezier(0.1, 0.9, 0.2, 1)';
216
+ const clamp = (v, min, max) => Math.min(max, Math.max(min, v));
217
+
218
+ export { EASE_OUT as E, FLUENT_DECELERATE as F, clamp as a, caf as b, configureComponents as c, defineElement as d, EASE_SPRING as e, shadowStyles as f, applyFrame as g, now as n, prefersReducedMotion as p, raf as r, srText as s };
219
+ //# sourceMappingURL=base-CuvCgqLy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-CuvCgqLy.js","sources":["../../src/components/base.ts"],"sourcesContent":["/**\n * use-scroll-animate/components — shared base for the `<usa-*>` custom elements.\n *\n * Everything here is lazy: nothing touches `window`, `document`,\n * `HTMLElement` or `matchMedia` at import time, so the components can be\n * imported during SSR (Next, Nuxt, Astro…) and in Electron/Tauri preload\n * scripts. Classes are created the first time a `define*()` function runs.\n */\n\nexport interface ComponentsConfig {\n /**\n * Inject each component's CSS when it is defined (default `true`). Uses a\n * constructable stylesheet (`document.adoptedStyleSheets`, which a strict\n * `style-src` CSP does not block) and falls back to a `<style>` tag. Set\n * to `false` when you load `use-scroll-animate/components.css` yourself.\n */\n injectStyles?: boolean;\n /**\n * `'user'` (default) follows `prefers-reduced-motion`; `'reduce'` always\n * uses the reduced variants (e.g. a kiosk / battery-saver mode);\n * `'no-preference'` ignores the OS setting (only for demos — respect your users).\n */\n reducedMotion?: 'user' | 'reduce' | 'no-preference';\n}\n\nconst config: Required<ComponentsConfig> = { injectStyles: true, reducedMotion: 'user' };\n\n/** Change global component settings (call before `define*()` for `injectStyles`). */\nexport function configureComponents(options: ComponentsConfig): void {\n Object.assign(config, options);\n}\n\nexport const canDefine = (): boolean => typeof customElements !== 'undefined' && typeof HTMLElement !== 'undefined';\n\n/** `true` when animations should be reduced (OS setting or `configureComponents`). */\nexport function prefersReducedMotion(): boolean {\n if (config.reducedMotion !== 'user') return config.reducedMotion === 'reduce';\n return typeof matchMedia === 'function' && !!matchMedia('(prefers-reduced-motion: reduce)').matches;\n}\n\nconst injected = new Set<string>();\n\n/** Add a component's stylesheet to the document once. */\nexport function adoptStyles(id: string, css: string): void {\n if (!config.injectStyles || !css || injected.has(id) || typeof document === 'undefined') return;\n injected.add(id);\n try {\n if (typeof CSSStyleSheet === 'function' && 'adoptedStyleSheets' in document) {\n const sheet = new CSSStyleSheet();\n sheet.replaceSync(css);\n document.adoptedStyleSheets = [...document.adoptedStyleSheets, sheet];\n return;\n }\n } catch {\n /* fall through to <style> */\n }\n const style = document.createElement('style');\n style.setAttribute('data-usa', id);\n style.textContent = css;\n (document.head || document.documentElement).appendChild(style);\n}\n\n/** Attach `css` to a shadow root (constructable sheet where supported, else `<style>`). */\nexport function shadowStyles(root: ShadowRoot, css: string): void {\n try {\n if (typeof CSSStyleSheet === 'function' && 'adoptedStyleSheets' in root) {\n const sheet = new CSSStyleSheet();\n sheet.replaceSync(css);\n root.adoptedStyleSheets = [sheet];\n return;\n }\n } catch {\n /* fall through */\n }\n const style = document.createElement('style');\n style.textContent = css;\n root.prepend(style);\n}\n\nexport type Cleanup = () => void;\n\n/**\n * Members shared by every `<usa-*>` element. Attribute helpers, a cleanup\n * bag that is emptied on disconnect, and motion helpers that degrade to the\n * final state without WAAPI or under reduced motion.\n */\nexport interface UsaElement extends HTMLElement {\n /** `true` while reduced motion applies to this element. */\n readonly reduced: boolean;\n}\n\nexport interface UsaBase extends UsaElement {\n mount(): void;\n changed(name: string): void;\n unmount(): void;\n str(name: string, fallback?: string): string;\n num(name: string, fallback: number): number;\n flag(name: string): boolean;\n setFlag(name: string, on: boolean): void;\n onCleanup(fn: Cleanup): void;\n listen<K extends keyof HTMLElementEventMap>(\n target: EventTarget,\n type: K | string,\n fn: (e: any) => void,\n options?: AddEventListenerOptions\n ): void;\n inView(cb: (visible: boolean, entry?: IntersectionObserverEntry) => void, init?: IntersectionObserverInit, target?: Element): void;\n motion(el: Element, keyframes: Keyframe[], options: KeyframeAnimationOptions): Animation | null;\n emit(type: string, detail?: unknown): boolean;\n}\n\ntype BaseCtor = new () => UsaBase;\nlet baseClass: BaseCtor | null = null;\n\n/** The lazily created base class (needs `HTMLElement`). */\nexport function getBase(): BaseCtor {\n if (baseClass) return baseClass;\n class Base extends HTMLElement {\n private _cleanups: Cleanup[] = [];\n private _connected = false;\n\n get reduced(): boolean {\n return prefersReducedMotion();\n }\n\n connectedCallback(): void {\n if (this._connected) return;\n this._connected = true;\n // Upgraded while the parser is still inside us (a <script> in <head>\n // defined the element): children/text are not there yet, so wait.\n if (typeof document !== 'undefined' && document.readyState === 'loading' && !this.nextSibling && !this.childNodes.length) {\n const go = () => {\n if (this._connected && this.isConnected) this.mount();\n };\n document.addEventListener('DOMContentLoaded', go, { once: true });\n this._cleanups.push(() => document.removeEventListener('DOMContentLoaded', go));\n return;\n }\n this.mount();\n }\n\n disconnectedCallback(): void {\n this._connected = false;\n this.teardown();\n }\n\n attributeChangedCallback(_name: string, oldValue: string | null, value: string | null): void {\n if (!this._connected || oldValue === value) return;\n this.changed(_name);\n }\n\n /** Re-mount on attribute change (override for finer updates). */\n changed(_name: string): void {\n this.teardown();\n this.mount();\n }\n\n private teardown(): void {\n this._cleanups.splice(0).reverse().forEach((fn) => fn());\n this.unmount();\n }\n\n mount(): void {}\n unmount(): void {}\n\n str(name: string, fallback = ''): string {\n const v = this.getAttribute(name);\n return v === null ? fallback : v;\n }\n\n num(name: string, fallback: number): number {\n const v = this.getAttribute(name);\n const n = v === null || v.trim() === '' ? NaN : Number(v);\n return Number.isFinite(n) ? n : fallback;\n }\n\n /** Boolean attribute: present and not `\"false\"`. */\n flag(name: string): boolean {\n const v = this.getAttribute(name);\n return v !== null && v !== 'false';\n }\n\n setFlag(name: string, on: boolean): void {\n if (on) this.setAttribute(name, '');\n else this.removeAttribute(name);\n }\n\n onCleanup(fn: Cleanup): void {\n this._cleanups.push(fn);\n }\n\n listen(target: EventTarget, type: string, fn: (e: any) => void, options?: AddEventListenerOptions): void {\n target.addEventListener(type, fn, options);\n this.onCleanup(() => target.removeEventListener(type, fn, options));\n }\n\n /** Calls `cb(true/false)` as the element enters / leaves the viewport. */\n inView(cb: (visible: boolean, entry?: IntersectionObserverEntry) => void, init?: IntersectionObserverInit, target: Element = this): void {\n if (typeof IntersectionObserver === 'undefined') {\n cb(true);\n return;\n }\n const io = new IntersectionObserver((entries) => {\n for (const e of entries) cb(e.isIntersecting, e);\n }, init);\n io.observe(target);\n this.onCleanup(() => io.disconnect());\n }\n\n /** `el.animate()` that returns `null` (and applies the last frame) without WAAPI. */\n motion(el: Element, keyframes: Keyframe[], options: KeyframeAnimationOptions): Animation | null {\n if (typeof (el as HTMLElement).animate !== 'function') {\n applyFrame(el as HTMLElement, keyframes[keyframes.length - 1]);\n return null;\n }\n return (el as HTMLElement).animate(keyframes, options);\n }\n\n emit(type: string, detail?: unknown): boolean {\n return this.dispatchEvent(new CustomEvent(`usa:${type}`, { detail, bubbles: true, cancelable: true }));\n }\n }\n baseClass = Base as unknown as BaseCtor;\n return baseClass;\n}\n\n/** Write a keyframe's properties as inline styles (no-WAAPI fallback). */\nexport function applyFrame(el: HTMLElement, frame?: Keyframe): void {\n if (!frame) return;\n for (const [k, v] of Object.entries(frame)) {\n if (k === 'offset' || k === 'easing' || k === 'composite' || v == null) continue;\n (el.style as any)[k] = String(v);\n }\n}\n\n/**\n * Register `tag` with the class built by `make(Base)`. Returns the\n * constructor, the already registered one, or `undefined` without DOM.\n */\nexport function defineElement(\n tag: string,\n make: (Base: BaseCtor) => CustomElementConstructor,\n css?: { id: string; text: string }\n): CustomElementConstructor | undefined {\n if (!canDefine()) return undefined;\n adoptStyles('base', BASE_CSS);\n if (css) adoptStyles(css.id, css.text);\n const existing = customElements.get(tag);\n if (existing) return existing;\n const ctor = make(getBase());\n customElements.define(tag, ctor);\n return ctor;\n}\n\nconst BASE_CSS = '.usa-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}';\n\n/** A visually hidden copy of `text` for screen readers (the animated copy is `aria-hidden`). */\nexport function srText(text: string): HTMLSpanElement {\n const s = document.createElement('span');\n s.className = 'usa-sr';\n s.textContent = text;\n return s;\n}\n\n/** requestAnimationFrame with a timeout fallback (jsdom / hidden documents). */\nexport const raf = (cb: FrameRequestCallback): number =>\n typeof requestAnimationFrame === 'function' ? requestAnimationFrame(cb) : (setTimeout(() => cb(Date.now()), 16) as unknown as number);\n/** Monotonic time in ms (rAF callback timestamps differ between environments, so loops use this). */\nexport const now = (): number => (typeof performance !== 'undefined' ? performance.now() : Date.now());\nexport const caf = (id: number): void => {\n if (typeof cancelAnimationFrame === 'function') cancelAnimationFrame(id);\n else clearTimeout(id);\n};\n\n/** Spring-ish easing used across the components. */\nexport const EASE_OUT = 'cubic-bezier(0.22, 1, 0.36, 1)';\nexport const EASE_SPRING = 'cubic-bezier(0.34, 1.56, 0.64, 1)';\n/** Windows Fluent \"decelerate\" / \"point-to-point\" curves. */\nexport const FLUENT_DECELERATE = 'cubic-bezier(0.1, 0.9, 0.2, 1)';\n\nexport const clamp = (v: number, min: number, max: number): number => Math.min(max, Math.max(min, v));\n"],"names":[],"mappings":"AAAA;;;;;;;AAOG;AAkBH,MAAM,MAAM,GAA+B,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE;AAExF;AACM,SAAU,mBAAmB,CAAC,OAAyB,EAAA;AAC3D,IAAA,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;AAChC;AAEO,MAAM,S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AG,EAAE,CAAC,CAAC;;;;"}
@@ -0,0 +1,395 @@
1
+ 'use strict';
2
+
3
+ var base = require('../chunks/base-CJ7XfidP.cjs');
4
+
5
+ var css$4 = "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
+
7
+ function defineAurora(tag = 'usa-aurora') {
8
+ return base.defineElement(tag, (Base) => class UsaAurora extends Base {
9
+ constructor() {
10
+ super(...arguments);
11
+ this._layer = null;
12
+ }
13
+ static get observedAttributes() {
14
+ return ['colors', 'speed', 'intensity'];
15
+ }
16
+ mount() {
17
+ if (!this._layer) {
18
+ this._layer = document.createElement('div');
19
+ this._layer.className = 'usa-aurora-layer';
20
+ this._layer.setAttribute('aria-hidden', 'true');
21
+ this._layer.innerHTML = '<i></i><i></i><i></i><i></i>';
22
+ this.prepend(this._layer);
23
+ }
24
+ const colors = this.str('colors', '#7c5cff,#22d3ee,#f472b6,#34d399').split(',').map((c) => c.trim()).filter(Boolean);
25
+ Array.from(this._layer.children).forEach((blob, i) => {
26
+ blob.style.setProperty('--c', colors[i % colors.length]);
27
+ });
28
+ const speed = this.num('speed', 1);
29
+ this.style.setProperty('--usa-aurora-speed', `${(18 / Math.max(0.05, speed)).toFixed(2)}s`);
30
+ this.style.setProperty('--usa-aurora-opacity', String(this.num('intensity', 0.7)));
31
+ this.inView((v) => this.toggleAttribute('data-offscreen', !v));
32
+ }
33
+ }, { id: 'aurora', text: css$4 });
34
+ }
35
+
36
+ var css$3 = "usa-particles{position:relative;display:block;min-height:120px;overflow:hidden}usa-particles>canvas{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}";
37
+
38
+ function defineParticles(tag = 'usa-particles') {
39
+ return base.defineElement(tag, (Base) => class UsaParticles extends Base {
40
+ constructor() {
41
+ super(...arguments);
42
+ this._canvas = null;
43
+ this._ctx = null;
44
+ this._ps = [];
45
+ this._frame = 0;
46
+ this._w = 0;
47
+ this._h = 0;
48
+ this._visible = false;
49
+ this._mx = -1e4;
50
+ this._color = '#888';
51
+ this._my = -1e4;
52
+ }
53
+ static get observedAttributes() {
54
+ return ['count', 'color', 'size', 'speed', 'links', 'interactive', 'paused'];
55
+ }
56
+ mount() {
57
+ if (!this._canvas) {
58
+ this._canvas = document.createElement('canvas');
59
+ this._canvas.setAttribute('aria-hidden', 'true');
60
+ this.prepend(this._canvas);
61
+ }
62
+ this._ctx = this._canvas.getContext?.('2d') ?? null;
63
+ if (!this._ctx)
64
+ return;
65
+ this.resize();
66
+ if (typeof ResizeObserver !== 'undefined') {
67
+ const ro = new ResizeObserver(() => {
68
+ this.resize();
69
+ if (!this._frame)
70
+ this.draw();
71
+ });
72
+ ro.observe(this);
73
+ this.onCleanup(() => ro.disconnect());
74
+ }
75
+ this.inView((v) => {
76
+ this._visible = v;
77
+ this.loop();
78
+ });
79
+ this.listen(document, 'visibilitychange', () => this.loop());
80
+ if (this.flag('interactive')) {
81
+ this.listen(window, 'pointermove', (e) => {
82
+ const r = this.getBoundingClientRect();
83
+ this._mx = e.clientX - r.left;
84
+ this._my = e.clientY - r.top;
85
+ }, { passive: true });
86
+ }
87
+ this.draw();
88
+ }
89
+ unmount() {
90
+ base.caf(this._frame);
91
+ this._frame = 0;
92
+ }
93
+ reset() {
94
+ this._ps = [];
95
+ this.resize();
96
+ this.draw();
97
+ }
98
+ resize() {
99
+ const c = this._canvas;
100
+ if (!c || !this._ctx)
101
+ return;
102
+ const w = this.clientWidth || 300;
103
+ const h = this.clientHeight || 150;
104
+ const dpr = Math.min(2, (typeof devicePixelRatio === 'number' && devicePixelRatio) || 1);
105
+ c.width = Math.round(w * dpr);
106
+ c.height = Math.round(h * dpr);
107
+ this._ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
108
+ this._w = w;
109
+ this._h = h;
110
+ this._color = this.getAttribute('color') || (typeof getComputedStyle === 'function' ? getComputedStyle(this).color : '') || '#888';
111
+ const want = Math.round(Math.min(1, (w * h) / (900 * 500)) * Math.max(1, this.num('count', 60))) || 1;
112
+ const speed = this.num('speed', 0.35);
113
+ const size = this.num('size', 2.2);
114
+ while (this._ps.length < want) {
115
+ const a = Math.random() * Math.PI * 2;
116
+ const s = speed * (0.3 + Math.random() * 0.7);
117
+ this._ps.push({ x: Math.random() * w, y: Math.random() * h, vx: Math.cos(a) * s, vy: Math.sin(a) * s, r: 0.6 + Math.random() * (size - 0.6) });
118
+ }
119
+ this._ps.length = want;
120
+ }
121
+ loop() {
122
+ const run = this._visible && !this.reduced && !this.flag('paused') && !(typeof document !== 'undefined' && document.hidden);
123
+ if (run && !this._frame) {
124
+ const tick = () => {
125
+ this.step();
126
+ this.draw();
127
+ this._frame = base.raf(tick);
128
+ };
129
+ this._frame = base.raf(tick);
130
+ }
131
+ else if (!run && this._frame) {
132
+ base.caf(this._frame);
133
+ this._frame = 0;
134
+ }
135
+ }
136
+ step() {
137
+ const { _w: w, _h: h } = this;
138
+ for (const p of this._ps) {
139
+ const dx = p.x - this._mx;
140
+ const dy = p.y - this._my;
141
+ const d2 = dx * dx + dy * dy;
142
+ if (d2 < 8100 && d2 > 0.01) {
143
+ const f = (1 - Math.sqrt(d2) / 90) * 0.6;
144
+ p.x += (dx / Math.sqrt(d2)) * f;
145
+ p.y += (dy / Math.sqrt(d2)) * f;
146
+ }
147
+ p.x += p.vx;
148
+ p.y += p.vy;
149
+ if (p.x < -5)
150
+ p.x = w + 5;
151
+ else if (p.x > w + 5)
152
+ p.x = -5;
153
+ if (p.y < -5)
154
+ p.y = h + 5;
155
+ else if (p.y > h + 5)
156
+ p.y = -5;
157
+ }
158
+ }
159
+ draw() {
160
+ const ctx = this._ctx;
161
+ if (!ctx)
162
+ return;
163
+ const color = this._color;
164
+ ctx.clearRect(0, 0, this._w, this._h);
165
+ ctx.fillStyle = color;
166
+ ctx.strokeStyle = color;
167
+ const ps = this._ps;
168
+ const link = this.num('links', 110);
169
+ if (link > 0) {
170
+ const l2 = link * link;
171
+ ctx.lineWidth = 0.6;
172
+ for (let i = 0; i < ps.length; i++) {
173
+ for (let j = i + 1; j < ps.length; j++) {
174
+ const dx = ps[i].x - ps[j].x;
175
+ const dy = ps[i].y - ps[j].y;
176
+ const d2 = dx * dx + dy * dy;
177
+ if (d2 < l2) {
178
+ ctx.globalAlpha = (1 - d2 / l2) * 0.35;
179
+ ctx.beginPath();
180
+ ctx.moveTo(ps[i].x, ps[i].y);
181
+ ctx.lineTo(ps[j].x, ps[j].y);
182
+ ctx.stroke();
183
+ }
184
+ }
185
+ }
186
+ }
187
+ ctx.globalAlpha = 0.85;
188
+ for (const p of ps) {
189
+ ctx.beginPath();
190
+ ctx.arc(p.x, p.y, p.r, 0, Math.PI * 2);
191
+ ctx.fill();
192
+ }
193
+ ctx.globalAlpha = 1;
194
+ }
195
+ }, { id: 'particles', text: css$3 });
196
+ }
197
+
198
+ var css$2 = "usa-grain{position:relative;display:block;isolation:isolate;overflow:hidden}usa-grain .usa-grain-layer{position:absolute;inset:-100%;z-index:1;pointer-events:none}usa-grain[animated] .usa-grain-layer{animation:usa-grain 0.8s steps(10) infinite}@keyframes usa-grain{0%,100%{transform:translate(0,0)}10%{transform:translate(-5%,-8%)}20%{transform:translate(-12%,4%)}30%{transform:translate(6%,-16%)}40%{transform:translate(-4%,18%)}50%{transform:translate(-12%,8%)}60%{transform:translate(14%,0)}70%{transform:translate(0,12%)}80%{transform:translate(3%,25%)}90%{transform:translate(-8%,8%)}}";
199
+
200
+ const noise = (freq) => `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='256' height='256'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='${freq}' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 1.6 -0.3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E")`;
201
+ function defineGrain(tag = 'usa-grain') {
202
+ return base.defineElement(tag, (Base) => class UsaGrain extends Base {
203
+ constructor() {
204
+ super(...arguments);
205
+ this._layer = null;
206
+ }
207
+ static get observedAttributes() {
208
+ return ['opacity', 'blend', 'scale'];
209
+ }
210
+ mount() {
211
+ if (!this._layer) {
212
+ this._layer = document.createElement('div');
213
+ this._layer.className = 'usa-grain-layer';
214
+ this._layer.setAttribute('aria-hidden', 'true');
215
+ this.append(this._layer);
216
+ }
217
+ const s = this._layer.style;
218
+ s.backgroundImage = noise(0.8);
219
+ s.backgroundSize = `${this.num('scale', 180)}px`;
220
+ s.opacity = String(this.num('opacity', 0.12));
221
+ s.mixBlendMode = this.str('blend', 'overlay');
222
+ }
223
+ }, { id: 'grain', text: css$2 });
224
+ }
225
+
226
+ var css$1 = "usa-marquee{--usa-marquee-gap:32px;display:block;overflow:hidden;contain:content}usa-marquee[fade]{-webkit-mask:linear-gradient(90deg,transparent,#000 10%,#000 90%,transparent);mask:linear-gradient(90deg,transparent,#000 10%,#000 90%,transparent)}usa-marquee[fade][data-vertical]{-webkit-mask:linear-gradient(180deg,transparent,#000 12%,#000 88%,transparent);mask:linear-gradient(180deg,transparent,#000 12%,#000 88%,transparent)}usa-marquee .usa-marquee-track{display:flex;width:max-content;gap:var(--usa-marquee-gap);will-change:transform}usa-marquee .usa-marquee-group{display:flex;flex:none;align-items:center;gap:var(--usa-marquee-gap)}usa-marquee[data-vertical] .usa-marquee-track,usa-marquee[data-vertical] .usa-marquee-group{flex-direction:column;width:auto}usa-marquee[data-vertical]{height:var(--usa-marquee-height,240px)}usa-marquee[data-static]{overflow:auto;scrollbar-width:thin}";
227
+
228
+ function defineMarquee(tag = 'usa-marquee') {
229
+ return base.defineElement(tag, (Base) => class UsaMarquee extends Base {
230
+ constructor() {
231
+ super(...arguments);
232
+ this._track = null;
233
+ this._anim = null;
234
+ this._hover = false;
235
+ this._visible = true;
236
+ this._size = 0;
237
+ }
238
+ static get observedAttributes() {
239
+ return ['speed', 'direction', 'gap', 'paused'];
240
+ }
241
+ get vertical() {
242
+ const d = this.str('direction', 'left');
243
+ return d === 'up' || d === 'down';
244
+ }
245
+ mount() {
246
+ if (!this._track) {
247
+ const track = document.createElement('div');
248
+ track.className = 'usa-marquee-track';
249
+ const group = document.createElement('div');
250
+ group.className = 'usa-marquee-group';
251
+ group.append(...Array.from(this.childNodes));
252
+ track.append(group);
253
+ this.append(track);
254
+ this._track = track;
255
+ }
256
+ this.toggleAttribute('data-vertical', this.vertical);
257
+ this.style.setProperty('--usa-marquee-gap', `${this.num('gap', 32)}px`);
258
+ if (this.reduced) {
259
+ this.setAttribute('data-static', '');
260
+ this.syncClones(1);
261
+ return;
262
+ }
263
+ this.removeAttribute('data-static');
264
+ this.build();
265
+ if (typeof ResizeObserver !== 'undefined') {
266
+ const ro = new ResizeObserver(() => this.build());
267
+ ro.observe(this._track.firstElementChild);
268
+ this.onCleanup(() => ro.disconnect());
269
+ }
270
+ this.inView((v) => {
271
+ this._visible = v;
272
+ this.sync();
273
+ });
274
+ this.listen(this, 'pointerenter', () => ((this._hover = true), this.sync()));
275
+ this.listen(this, 'pointerleave', () => ((this._hover = false), this.sync()));
276
+ this.listen(this, 'focusin', () => ((this._hover = true), this.sync()));
277
+ this.listen(this, 'focusout', () => ((this._hover = false), this.sync()));
278
+ }
279
+ unmount() {
280
+ this._anim?.cancel();
281
+ this._anim = null;
282
+ this._size = 0;
283
+ }
284
+ syncClones(n) {
285
+ const track = this._track;
286
+ const group = track.firstElementChild;
287
+ while (track.children.length > n)
288
+ track.lastElementChild.remove();
289
+ while (track.children.length < n) {
290
+ const clone = group.cloneNode(true);
291
+ clone.setAttribute('aria-hidden', 'true');
292
+ clone.setAttribute('inert', '');
293
+ track.append(clone);
294
+ }
295
+ }
296
+ build() {
297
+ const track = this._track;
298
+ const group = track.firstElementChild;
299
+ const vertical = this.vertical;
300
+ const gap = this.num('gap', 32);
301
+ const measured = vertical ? group.offsetHeight : group.offsetWidth;
302
+ if (!measured)
303
+ return; // not laid out yet: the ResizeObserver calls back
304
+ const size = measured + gap;
305
+ if (this._anim && this._size === size)
306
+ return;
307
+ this._size = size;
308
+ const box = (vertical ? this.clientHeight : this.clientWidth) || size;
309
+ // Enough copies to cover the box twice
310
+ this.syncClones(Math.min(50, Math.max(2, Math.ceil(box / size) + 1)));
311
+ const progress = this._anim?.effect?.getComputedTiming().progress ?? 0;
312
+ this._anim?.cancel();
313
+ const axis = vertical ? 'Y' : 'X';
314
+ const reverse = ['right', 'down'].includes(this.str('direction', 'left'));
315
+ const frames = [{ transform: `translate${axis}(0)` }, { transform: `translate${axis}(${-size}px)` }];
316
+ this._anim = this.motion(track, reverse ? frames.reverse() : frames, {
317
+ duration: (Math.max(1, size) / Math.max(1, this.num('speed', 50))) * 1000,
318
+ iterations: Infinity,
319
+ });
320
+ if (this._anim && progress)
321
+ this._anim.currentTime = progress * Number(this._anim.effect?.getTiming().duration || 0);
322
+ this.sync();
323
+ }
324
+ sync() {
325
+ const a = this._anim;
326
+ if (!a)
327
+ return;
328
+ const stop = this.flag('paused') || !this._visible || (this._hover && this.flag('pause-on-hover'));
329
+ if (stop && a.playState === 'running')
330
+ a.pause();
331
+ else if (!stop && a.playState === 'paused')
332
+ a.play();
333
+ }
334
+ pause() {
335
+ this.setAttribute('paused', '');
336
+ }
337
+ resume() {
338
+ this.removeAttribute('paused');
339
+ }
340
+ changed(name) {
341
+ if (name === 'paused')
342
+ this.sync();
343
+ else
344
+ super.changed(name);
345
+ }
346
+ }, { id: 'marquee', text: css$1 });
347
+ }
348
+
349
+ var css = "usa-acrylic{--usa-acrylic-tint:#f3f3f3;--usa-acrylic-opacity:55%;--usa-acrylic-blur:30px;position:relative;display:block;isolation:isolate;overflow:hidden;background-color:color-mix(in srgb,var(--usa-acrylic-tint) var(--usa-acrylic-opacity),transparent);-webkit-backdrop-filter:blur(var(--usa-acrylic-blur)) saturate(1.6);backdrop-filter:blur(var(--usa-acrylic-blur)) saturate(1.6);border:1px solid color-mix(in srgb,#fff 22%,transparent)}@media (prefers-color-scheme:dark){usa-acrylic{--usa-acrylic-tint:#2c2c2c}}usa-acrylic::before{content:\"\";position:absolute;inset:0;z-index:-1;pointer-events:none;opacity:0.035;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='128' height='128'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E\")}usa-acrylic::after{content:\"\";position:absolute;inset:0;z-index:1;pointer-events:none;transform:translateX(-120%);background:linear-gradient(105deg,transparent 30%,rgb(255 255 255 / 0.28) 50%,transparent 70%)}usa-acrylic[shimmer=\"hover\"]:hover::after,usa-acrylic[data-shine]::after{animation:usa-acrylic-shine 1.1s cubic-bezier(0.22,1,0.36,1) both}@keyframes usa-acrylic-shine{from{transform:translateX(-120%)}to{transform:translateX(120%)}}usa-acrylic[variant=\"mica\"]{--usa-acrylic-opacity:80%;-webkit-backdrop-filter:none;backdrop-filter:none;background:linear-gradient(color-mix(in srgb,var(--usa-acrylic-tint) var(--usa-acrylic-opacity),transparent),color-mix(in srgb,var(--usa-acrylic-tint) var(--usa-acrylic-opacity),transparent)),var(--usa-mica-source,linear-gradient(135deg,#b8c6ff,#ffd6e8));border-color:transparent}@supports not ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))){usa-acrylic{background-color:var(--usa-acrylic-tint)}}@media (prefers-reduced-transparency:reduce){usa-acrylic{background:var(--usa-acrylic-tint);-webkit-backdrop-filter:none;backdrop-filter:none}}@media (forced-colors:active){usa-acrylic{background:Canvas;-webkit-backdrop-filter:none;backdrop-filter:none;border-color:CanvasText}usa-acrylic::before,usa-acrylic::after{display:none}}";
350
+
351
+ function defineAcrylic(tag = 'usa-acrylic') {
352
+ return base.defineElement(tag, (Base) => class UsaAcrylic extends Base {
353
+ static get observedAttributes() {
354
+ return ['tint', 'tint-opacity', 'blur', 'shimmer'];
355
+ }
356
+ mount() {
357
+ const tint = this.getAttribute('tint');
358
+ if (tint)
359
+ this.style.setProperty('--usa-acrylic-tint', tint);
360
+ else
361
+ this.style.removeProperty('--usa-acrylic-tint');
362
+ this.style.setProperty('--usa-acrylic-opacity', `${Math.round(this.num('tint-opacity', 0.55) * 100)}%`);
363
+ this.style.setProperty('--usa-acrylic-blur', `${this.num('blur', 30)}px`);
364
+ if (this.str('shimmer') === 'load' && !this.reduced) {
365
+ this.removeAttribute('data-shine');
366
+ void this.offsetWidth;
367
+ this.setAttribute('data-shine', '');
368
+ }
369
+ }
370
+ }, { id: 'acrylic', text: css });
371
+ }
372
+
373
+ /**
374
+ * use-scroll-animate/components/background — backgrounds & decoration.
375
+ * `<usa-aurora>`, `<usa-particles>`, `<usa-grain>`, `<usa-marquee>`,
376
+ * `<usa-acrylic>`.
377
+ */
378
+ /** Register every component of this category under its default tag. */
379
+ function defineBackgroundComponents() {
380
+ defineAurora();
381
+ defineParticles();
382
+ defineGrain();
383
+ defineMarquee();
384
+ defineAcrylic();
385
+ }
386
+
387
+ exports.configureComponents = base.configureComponents;
388
+ exports.prefersReducedMotion = base.prefersReducedMotion;
389
+ exports.defineAcrylic = defineAcrylic;
390
+ exports.defineAurora = defineAurora;
391
+ exports.defineBackgroundComponents = defineBackgroundComponents;
392
+ exports.defineGrain = defineGrain;
393
+ exports.defineMarquee = defineMarquee;
394
+ exports.defineParticles = defineParticles;
395
+ //# sourceMappingURL=background.cjs.map