use-scroll-animate 2.6.0 → 2.8.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 +27 -0
- package/README.md +3 -2
- package/README_ja.md +3 -2
- package/README_zh.md +3 -2
- package/dist/chunks/{base-5DFCAnvH.cjs → base-BR6fYLBA.cjs} +23 -2
- package/dist/chunks/base-BR6fYLBA.cjs.map +1 -0
- package/dist/chunks/{base-08OYzphB.js → base-C_w9ibbn.js} +21 -3
- package/dist/chunks/base-C_w9ibbn.js.map +1 -0
- package/dist/chunks/{spring-CpeFkxNd.js → spring-Dc8ZqDWE.js} +3 -3
- package/dist/chunks/spring-Dc8ZqDWE.js.map +1 -0
- package/dist/chunks/{spring-Bi4qY0pL.cjs → spring-DyHe1Hfa.cjs} +3 -3
- package/dist/chunks/spring-DyHe1Hfa.cjs.map +1 -0
- package/dist/chunks/variants-Bbatdq8d.cjs +39 -0
- package/dist/chunks/variants-Bbatdq8d.cjs.map +1 -0
- package/dist/chunks/variants-idgMVXhE.js +35 -0
- package/dist/chunks/variants-idgMVXhE.js.map +1 -0
- package/dist/components/background.cjs +277 -11
- package/dist/components/background.cjs.map +1 -1
- package/dist/components/background.css +2 -0
- package/dist/components/background.d.cts +71 -2
- package/dist/components/background.d.ts +71 -2
- package/dist/components/background.js +274 -13
- package/dist/components/background.js.map +1 -1
- package/dist/components/cards.cjs +2 -2
- package/dist/components/cards.d.cts +8 -0
- package/dist/components/cards.d.ts +8 -0
- package/dist/components/cards.js +3 -3
- package/dist/components/click.cjs +2 -2
- package/dist/components/click.d.cts +8 -0
- package/dist/components/click.d.ts +8 -0
- package/dist/components/click.js +3 -3
- package/dist/components/feedback.cjs +1 -1
- package/dist/components/feedback.d.cts +8 -0
- package/dist/components/feedback.d.ts +8 -0
- package/dist/components/feedback.js +2 -2
- package/dist/components/interaction.cjs +1 -1
- package/dist/components/interaction.d.cts +8 -0
- package/dist/components/interaction.d.ts +8 -0
- package/dist/components/interaction.js +2 -2
- package/dist/components/page.cjs +801 -0
- package/dist/components/page.cjs.map +1 -0
- package/dist/components/page.css +11 -0
- package/dist/components/page.d.cts +275 -0
- package/dist/components/page.d.ts +275 -0
- package/dist/components/page.js +776 -0
- package/dist/components/page.js.map +1 -0
- package/dist/components/physics.cjs +2 -2
- package/dist/components/physics.d.cts +8 -0
- package/dist/components/physics.d.ts +8 -0
- package/dist/components/physics.js +4 -4
- package/dist/components/reveal.cjs +1 -1
- package/dist/components/reveal.d.cts +8 -0
- package/dist/components/reveal.d.ts +8 -0
- package/dist/components/reveal.js +2 -2
- package/dist/components/text.cjs +180 -11
- package/dist/components/text.cjs.map +1 -1
- package/dist/components/text.css +1 -0
- package/dist/components/text.d.cts +62 -2
- package/dist/components/text.d.ts +62 -2
- package/dist/components/text.js +177 -13
- package/dist/components/text.js.map +1 -1
- package/dist/components/transitions.cjs +1 -1
- package/dist/components/transitions.d.cts +8 -0
- package/dist/components/transitions.d.ts +8 -0
- package/dist/components/transitions.js +2 -2
- package/dist/components/ui.cjs +18 -48
- package/dist/components/ui.cjs.map +1 -1
- package/dist/components/ui.d.cts +8 -0
- package/dist/components/ui.d.ts +8 -0
- package/dist/components/ui.js +6 -35
- package/dist/components/ui.js.map +1 -1
- package/dist/components.cjs +45 -8
- package/dist/components.cjs.map +1 -1
- package/dist/components.css +12 -0
- package/dist/components.d.cts +354 -4
- package/dist/components.d.ts +354 -4
- package/dist/components.js +16 -10
- package/dist/components.js.map +1 -1
- package/dist/components.umd.js +2 -2
- package/dist/components.umd.js.map +1 -1
- package/docs/components.md +34 -0
- package/docs/windows-apps.md +11 -0
- package/package.json +13 -2
- package/dist/chunks/base-08OYzphB.js.map +0 -1
- package/dist/chunks/base-5DFCAnvH.cjs.map +0 -1
- package/dist/chunks/spring-Bi4qY0pL.cjs.map +0 -1
- package/dist/chunks/spring-CpeFkxNd.js.map +0 -1
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
.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}
|
|
3
3
|
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}}
|
|
4
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}}
|
|
5
|
+
usa-grid-glow,usa-blobs,usa-water-ripple,usa-dot-network{position:relative;display:block;isolation:isolate;overflow:hidden}usa-grid-glow{--usa-grid:32px;--usa-grid-r:220px;--usa-grid-color:var(--usa-accent,#7c5cff);--usa-grid-x:50%;--usa-grid-y:50%}usa-grid-glow::before,usa-grid-glow::after{content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;background-image:linear-gradient(to right,var(--l) 1px,transparent 1px),linear-gradient(to bottom,var(--l) 1px,transparent 1px);background-size:var(--usa-grid) var(--usa-grid)}usa-grid-glow::before{--l:color-mix(in srgb,currentColor 9%,transparent)}usa-grid-glow::after{--l:var(--usa-grid-color);-webkit-mask:radial-gradient(var(--usa-grid-r) circle at var(--usa-grid-x) var(--usa-grid-y),#000,transparent 70%);mask:radial-gradient(var(--usa-grid-r) circle at var(--usa-grid-x) var(--usa-grid-y),#000,transparent 70%)}usa-blobs .usa-blobs-layer{position:absolute;inset:-20%;z-index:-1;filter:blur(var(--usa-blobs-blur,60px)) saturate(1.3);pointer-events:none}usa-blobs .usa-blobs-layer i{position:absolute;width:45%;aspect-ratio:1;border-radius:42% 58% 60% 40% / 45% 45% 55% 55%;background:var(--c);opacity:0.75;left:calc(10% + var(--i) * 18%);top:calc(10% + var(--i) * 14%);animation:usa-blob calc(14s / var(--usa-blobs-speed,1)) ease-in-out infinite alternate;animation-delay:calc(var(--i) * -3.5s)}@keyframes usa-blob{0%{transform:translate(0,0) rotate(0) scale(1);border-radius:42% 58% 60% 40% / 45% 45% 55% 55%}50%{transform:translate(18%,-12%) rotate(120deg) scale(1.15);border-radius:60% 40% 35% 65% / 55% 60% 40% 45%}100%{transform:translate(-14%,14%) rotate(240deg) scale(0.9);border-radius:38% 62% 55% 45% / 62% 38% 62% 38%}}usa-water-ripple .usa-bg-canvas{position:absolute;inset:0;z-index:1;pointer-events:none;mix-blend-mode:screen}usa-dot-network .usa-bg-canvas{position:absolute;inset:0;z-index:-1;pointer-events:none}@media (prefers-reduced-motion:reduce){usa-blobs .usa-blobs-layer i{animation:none}}
|
|
6
|
+
.usa-fluent{font-family:"Segoe UI Variable","Segoe UI",system-ui,sans-serif;accent-color:var(--usa-accent,#0067c0)}.usa-fluent-mica body{background:linear-gradient(135deg,color-mix(in srgb,var(--usa-accent,#0067c0) 8%,#f3f3f3),#f3f3f3 60%)}@media (prefers-color-scheme:dark){.usa-fluent-mica body{background:linear-gradient(135deg,color-mix(in srgb,var(--usa-accent,#4cc2ff) 10%,#202020),#202020 60%)}}.usa-fluent :is(.usa-acrylic,[data-acrylic]){background:color-mix(in srgb,var(--usa-surface) 70%,transparent);-webkit-backdrop-filter:blur(30px) saturate(1.25);backdrop-filter:blur(30px) saturate(1.25);border:var(--usa-border);border-radius:var(--usa-radius)}.usa-fluent :is(button,[role="button"],[data-fluent-reveal],.usa-fluent-item){position:relative}.usa-fluent [data-reveal]::after{content:"";position:absolute;inset:0;border-radius:inherit;pointer-events:none;padding:1px;background:radial-gradient(90px circle at var(--usa-reveal-x) var(--usa-reveal-y),rgb(255 255 255 / 0.55),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-fluent [data-reveal]{background-image:radial-gradient(120px circle at var(--usa-reveal-x) var(--usa-reveal-y),rgb(255 255 255 / 0.1),transparent 70%)}@media (prefers-reduced-transparency:reduce),(forced-colors:active){.usa-fluent :is(.usa-acrylic,[data-acrylic]){background:var(--usa-surface);-webkit-backdrop-filter:none;backdrop-filter:none}}
|
|
5
7
|
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%)}}
|
|
6
8
|
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}
|
|
7
9
|
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}
|
|
@@ -20,7 +20,15 @@ interface ComponentsConfig {
|
|
|
20
20
|
* `'no-preference'` ignores the OS setting (only for demos — respect your users).
|
|
21
21
|
*/
|
|
22
22
|
reducedMotion?: 'user' | 'reduce' | 'no-preference';
|
|
23
|
+
/**
|
|
24
|
+
* Global motion intensity (v2.7): `'off'` (same as reduced motion),
|
|
25
|
+
* `'low'` (shorter, calmer), `'normal'` (default) or `'high'`. Scales every
|
|
26
|
+
* component animation's duration and sets `--usa-motion` (0 / 0.6 / 1 /
|
|
27
|
+
* 1.25) on `<html>` for your own CSS. See `setMotionIntensity()`.
|
|
28
|
+
*/
|
|
29
|
+
motionIntensity?: MotionIntensity;
|
|
23
30
|
}
|
|
31
|
+
type MotionIntensity = 'off' | 'low' | 'normal' | 'high';
|
|
24
32
|
/** Change global component settings (call before `define*()` for `injectStyles`). */
|
|
25
33
|
declare function configureComponents(options: ComponentsConfig): void;
|
|
26
34
|
/** `true` when animations should be reduced (OS setting or `configureComponents`). */
|
|
@@ -110,6 +118,63 @@ declare function defineMarquee(tag?: string): CustomElementConstructor | undefin
|
|
|
110
118
|
type UsaAcrylicElement = UsaElement;
|
|
111
119
|
declare function defineAcrylic(tag?: string): CustomElementConstructor | undefined;
|
|
112
120
|
|
|
121
|
+
/**
|
|
122
|
+
* `<usa-grid-glow>` — a line grid behind its content that lights up around
|
|
123
|
+
* the pointer. Attributes: `size` (cell px, 32), `color`, `radius` (px, 220).
|
|
124
|
+
* Reduced motion: the grid stays, a soft static glow in the centre.
|
|
125
|
+
*/
|
|
126
|
+
interface UsaGridGlowElement extends UsaElement {
|
|
127
|
+
}
|
|
128
|
+
declare function defineGridGlow(tag?: string): CustomElementConstructor | undefined;
|
|
129
|
+
/**
|
|
130
|
+
* `<usa-blobs>` — soft, slowly morphing colour blobs (fluid gradient
|
|
131
|
+
* backdrop). Attributes: `colors` (comma list), `speed` (1), `blur` (px, 60).
|
|
132
|
+
* Reduced motion: still blobs.
|
|
133
|
+
*/
|
|
134
|
+
interface UsaBlobsElement extends UsaElement {
|
|
135
|
+
}
|
|
136
|
+
declare function defineBlobs(tag?: string): CustomElementConstructor | undefined;
|
|
137
|
+
/**
|
|
138
|
+
* `<usa-water-ripple>` — interactive water ripples on a canvas over its
|
|
139
|
+
* content (pointer moves and taps disturb the surface). Low-resolution height
|
|
140
|
+
* map, paused off-screen. Attributes: `damping` (0.96), `strength` (1),
|
|
141
|
+
* `color` (highlight). Reduced motion: nothing is drawn.
|
|
142
|
+
*/
|
|
143
|
+
interface UsaWaterRippleElement extends UsaElement {
|
|
144
|
+
drop(x: number, y: number, strength?: number): void;
|
|
145
|
+
}
|
|
146
|
+
declare function defineWaterRipple(tag?: string): CustomElementConstructor | undefined;
|
|
147
|
+
/**
|
|
148
|
+
* `<usa-dot-network>` — a grid of dots that swell and link up with lines
|
|
149
|
+
* around the pointer (a living network backdrop). Attributes: `gap` (px,
|
|
150
|
+
* 28), `color`, `radius` (px of influence, 140). Reduced motion: a static
|
|
151
|
+
* dot grid.
|
|
152
|
+
*/
|
|
153
|
+
interface UsaDotNetworkElement extends UsaElement {
|
|
154
|
+
}
|
|
155
|
+
declare function defineDotNetwork(tag?: string): CustomElementConstructor | undefined;
|
|
156
|
+
|
|
157
|
+
interface FluentPresetOptions {
|
|
158
|
+
/** Root to apply to (default `document.documentElement`). */
|
|
159
|
+
root?: HTMLElement;
|
|
160
|
+
/** Reveal highlight on interactive elements (default `true`). */
|
|
161
|
+
reveal?: boolean;
|
|
162
|
+
/** Reveal targets (default buttons, links, `[data-fluent-reveal]`). */
|
|
163
|
+
selector?: string;
|
|
164
|
+
/** Mica-style tinted window background on `<body>` (default `true`). */
|
|
165
|
+
mica?: boolean;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Windows 11 **Fluent preset** (v2.8): applies the `fluent` variant
|
|
169
|
+
* (Segoe UI Variable, Windows accent, 8 px radii), a Mica-style tinted
|
|
170
|
+
* window background, Acrylic on `.usa-acrylic` / `[data-acrylic]`, and
|
|
171
|
+
* Reveal highlight (a light following the pointer on borders and
|
|
172
|
+
* backgrounds of interactive elements). Ideal for WebView2 / Electron /
|
|
173
|
+
* Tauri apps on Windows. Returns a function that removes it.
|
|
174
|
+
* Respects reduced motion / transparency (no Reveal tracking; solid materials).
|
|
175
|
+
*/
|
|
176
|
+
declare function fluentPreset(options?: FluentPresetOptions): () => void;
|
|
177
|
+
|
|
113
178
|
/**
|
|
114
179
|
* use-scroll-animate/components/background — backgrounds & decoration.
|
|
115
180
|
* `<usa-aurora>`, `<usa-particles>`, `<usa-grain>`, `<usa-marquee>`,
|
|
@@ -120,6 +185,10 @@ declare function defineAcrylic(tag?: string): CustomElementConstructor | undefin
|
|
|
120
185
|
declare function defineBackgroundComponents(): void;
|
|
121
186
|
declare global {
|
|
122
187
|
interface HTMLElementTagNameMap {
|
|
188
|
+
'usa-grid-glow': UsaGridGlowElement;
|
|
189
|
+
'usa-blobs': UsaBlobsElement;
|
|
190
|
+
'usa-water-ripple': UsaWaterRippleElement;
|
|
191
|
+
'usa-dot-network': UsaDotNetworkElement;
|
|
123
192
|
'usa-aurora': UsaAuroraElement;
|
|
124
193
|
'usa-particles': UsaParticlesElement;
|
|
125
194
|
'usa-grain': UsaGrainElement;
|
|
@@ -128,5 +197,5 @@ declare global {
|
|
|
128
197
|
}
|
|
129
198
|
}
|
|
130
199
|
|
|
131
|
-
export { configureComponents, defineAcrylic, defineAurora, defineBackgroundComponents, defineGrain, defineMarquee, defineParticles, prefersReducedMotion };
|
|
132
|
-
export type { ComponentsConfig, UsaAcrylicElement, UsaAuroraElement, UsaElement, UsaGrainElement, UsaMarqueeElement, UsaParticlesElement };
|
|
200
|
+
export { configureComponents, defineAcrylic, defineAurora, defineBackgroundComponents, defineBlobs, defineDotNetwork, defineGrain, defineGridGlow, defineMarquee, defineParticles, defineWaterRipple, fluentPreset, prefersReducedMotion };
|
|
201
|
+
export type { ComponentsConfig, FluentPresetOptions, UsaAcrylicElement, UsaAuroraElement, UsaBlobsElement, UsaDotNetworkElement, UsaElement, UsaGrainElement, UsaGridGlowElement, UsaMarqueeElement, UsaParticlesElement, UsaWaterRippleElement };
|
|
@@ -20,7 +20,15 @@ interface ComponentsConfig {
|
|
|
20
20
|
* `'no-preference'` ignores the OS setting (only for demos — respect your users).
|
|
21
21
|
*/
|
|
22
22
|
reducedMotion?: 'user' | 'reduce' | 'no-preference';
|
|
23
|
+
/**
|
|
24
|
+
* Global motion intensity (v2.7): `'off'` (same as reduced motion),
|
|
25
|
+
* `'low'` (shorter, calmer), `'normal'` (default) or `'high'`. Scales every
|
|
26
|
+
* component animation's duration and sets `--usa-motion` (0 / 0.6 / 1 /
|
|
27
|
+
* 1.25) on `<html>` for your own CSS. See `setMotionIntensity()`.
|
|
28
|
+
*/
|
|
29
|
+
motionIntensity?: MotionIntensity;
|
|
23
30
|
}
|
|
31
|
+
type MotionIntensity = 'off' | 'low' | 'normal' | 'high';
|
|
24
32
|
/** Change global component settings (call before `define*()` for `injectStyles`). */
|
|
25
33
|
declare function configureComponents(options: ComponentsConfig): void;
|
|
26
34
|
/** `true` when animations should be reduced (OS setting or `configureComponents`). */
|
|
@@ -110,6 +118,63 @@ declare function defineMarquee(tag?: string): CustomElementConstructor | undefin
|
|
|
110
118
|
type UsaAcrylicElement = UsaElement;
|
|
111
119
|
declare function defineAcrylic(tag?: string): CustomElementConstructor | undefined;
|
|
112
120
|
|
|
121
|
+
/**
|
|
122
|
+
* `<usa-grid-glow>` — a line grid behind its content that lights up around
|
|
123
|
+
* the pointer. Attributes: `size` (cell px, 32), `color`, `radius` (px, 220).
|
|
124
|
+
* Reduced motion: the grid stays, a soft static glow in the centre.
|
|
125
|
+
*/
|
|
126
|
+
interface UsaGridGlowElement extends UsaElement {
|
|
127
|
+
}
|
|
128
|
+
declare function defineGridGlow(tag?: string): CustomElementConstructor | undefined;
|
|
129
|
+
/**
|
|
130
|
+
* `<usa-blobs>` — soft, slowly morphing colour blobs (fluid gradient
|
|
131
|
+
* backdrop). Attributes: `colors` (comma list), `speed` (1), `blur` (px, 60).
|
|
132
|
+
* Reduced motion: still blobs.
|
|
133
|
+
*/
|
|
134
|
+
interface UsaBlobsElement extends UsaElement {
|
|
135
|
+
}
|
|
136
|
+
declare function defineBlobs(tag?: string): CustomElementConstructor | undefined;
|
|
137
|
+
/**
|
|
138
|
+
* `<usa-water-ripple>` — interactive water ripples on a canvas over its
|
|
139
|
+
* content (pointer moves and taps disturb the surface). Low-resolution height
|
|
140
|
+
* map, paused off-screen. Attributes: `damping` (0.96), `strength` (1),
|
|
141
|
+
* `color` (highlight). Reduced motion: nothing is drawn.
|
|
142
|
+
*/
|
|
143
|
+
interface UsaWaterRippleElement extends UsaElement {
|
|
144
|
+
drop(x: number, y: number, strength?: number): void;
|
|
145
|
+
}
|
|
146
|
+
declare function defineWaterRipple(tag?: string): CustomElementConstructor | undefined;
|
|
147
|
+
/**
|
|
148
|
+
* `<usa-dot-network>` — a grid of dots that swell and link up with lines
|
|
149
|
+
* around the pointer (a living network backdrop). Attributes: `gap` (px,
|
|
150
|
+
* 28), `color`, `radius` (px of influence, 140). Reduced motion: a static
|
|
151
|
+
* dot grid.
|
|
152
|
+
*/
|
|
153
|
+
interface UsaDotNetworkElement extends UsaElement {
|
|
154
|
+
}
|
|
155
|
+
declare function defineDotNetwork(tag?: string): CustomElementConstructor | undefined;
|
|
156
|
+
|
|
157
|
+
interface FluentPresetOptions {
|
|
158
|
+
/** Root to apply to (default `document.documentElement`). */
|
|
159
|
+
root?: HTMLElement;
|
|
160
|
+
/** Reveal highlight on interactive elements (default `true`). */
|
|
161
|
+
reveal?: boolean;
|
|
162
|
+
/** Reveal targets (default buttons, links, `[data-fluent-reveal]`). */
|
|
163
|
+
selector?: string;
|
|
164
|
+
/** Mica-style tinted window background on `<body>` (default `true`). */
|
|
165
|
+
mica?: boolean;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Windows 11 **Fluent preset** (v2.8): applies the `fluent` variant
|
|
169
|
+
* (Segoe UI Variable, Windows accent, 8 px radii), a Mica-style tinted
|
|
170
|
+
* window background, Acrylic on `.usa-acrylic` / `[data-acrylic]`, and
|
|
171
|
+
* Reveal highlight (a light following the pointer on borders and
|
|
172
|
+
* backgrounds of interactive elements). Ideal for WebView2 / Electron /
|
|
173
|
+
* Tauri apps on Windows. Returns a function that removes it.
|
|
174
|
+
* Respects reduced motion / transparency (no Reveal tracking; solid materials).
|
|
175
|
+
*/
|
|
176
|
+
declare function fluentPreset(options?: FluentPresetOptions): () => void;
|
|
177
|
+
|
|
113
178
|
/**
|
|
114
179
|
* use-scroll-animate/components/background — backgrounds & decoration.
|
|
115
180
|
* `<usa-aurora>`, `<usa-particles>`, `<usa-grain>`, `<usa-marquee>`,
|
|
@@ -120,6 +185,10 @@ declare function defineAcrylic(tag?: string): CustomElementConstructor | undefin
|
|
|
120
185
|
declare function defineBackgroundComponents(): void;
|
|
121
186
|
declare global {
|
|
122
187
|
interface HTMLElementTagNameMap {
|
|
188
|
+
'usa-grid-glow': UsaGridGlowElement;
|
|
189
|
+
'usa-blobs': UsaBlobsElement;
|
|
190
|
+
'usa-water-ripple': UsaWaterRippleElement;
|
|
191
|
+
'usa-dot-network': UsaDotNetworkElement;
|
|
123
192
|
'usa-aurora': UsaAuroraElement;
|
|
124
193
|
'usa-particles': UsaParticlesElement;
|
|
125
194
|
'usa-grain': UsaGrainElement;
|
|
@@ -128,5 +197,5 @@ declare global {
|
|
|
128
197
|
}
|
|
129
198
|
}
|
|
130
199
|
|
|
131
|
-
export { configureComponents, defineAcrylic, defineAurora, defineBackgroundComponents, defineGrain, defineMarquee, defineParticles, prefersReducedMotion };
|
|
132
|
-
export type { ComponentsConfig, UsaAcrylicElement, UsaAuroraElement, UsaElement, UsaGrainElement, UsaMarqueeElement, UsaParticlesElement };
|
|
200
|
+
export { configureComponents, defineAcrylic, defineAurora, defineBackgroundComponents, defineBlobs, defineDotNetwork, defineGrain, defineGridGlow, defineMarquee, defineParticles, defineWaterRipple, fluentPreset, prefersReducedMotion };
|
|
201
|
+
export type { ComponentsConfig, FluentPresetOptions, UsaAcrylicElement, UsaAuroraElement, UsaBlobsElement, UsaDotNetworkElement, UsaElement, UsaGrainElement, UsaGridGlowElement, UsaMarqueeElement, UsaParticlesElement, UsaWaterRippleElement };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { d as defineElement, e as caf, r as raf } from '../chunks/base-
|
|
2
|
-
export { a as configureComponents
|
|
1
|
+
import { d as defineElement, e as caf, r as raf, h as adoptStyles, p as prefersReducedMotion } from '../chunks/base-C_w9ibbn.js';
|
|
2
|
+
export { a as configureComponents } from '../chunks/base-C_w9ibbn.js';
|
|
3
|
+
import { s as setVariant } from '../chunks/variants-idgMVXhE.js';
|
|
3
4
|
|
|
4
|
-
var css$
|
|
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}}";
|
|
5
6
|
|
|
6
7
|
function defineAurora(tag = 'usa-aurora') {
|
|
7
8
|
return defineElement(tag, (Base) => class UsaAurora extends Base {
|
|
@@ -29,10 +30,10 @@ function defineAurora(tag = 'usa-aurora') {
|
|
|
29
30
|
this.style.setProperty('--usa-aurora-opacity', String(this.num('intensity', 0.7)));
|
|
30
31
|
this.inView((v) => this.toggleAttribute('data-offscreen', !v));
|
|
31
32
|
}
|
|
32
|
-
}, { id: 'aurora', text: css$
|
|
33
|
+
}, { id: 'aurora', text: css$6 });
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
var css$
|
|
36
|
+
var css$5 = "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}";
|
|
36
37
|
|
|
37
38
|
function defineParticles(tag = 'usa-particles') {
|
|
38
39
|
return defineElement(tag, (Base) => class UsaParticles extends Base {
|
|
@@ -191,10 +192,10 @@ function defineParticles(tag = 'usa-particles') {
|
|
|
191
192
|
}
|
|
192
193
|
ctx.globalAlpha = 1;
|
|
193
194
|
}
|
|
194
|
-
}, { id: 'particles', text: css$
|
|
195
|
+
}, { id: 'particles', text: css$5 });
|
|
195
196
|
}
|
|
196
197
|
|
|
197
|
-
var css$
|
|
198
|
+
var css$4 = "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%)}}";
|
|
198
199
|
|
|
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")`;
|
|
200
201
|
function defineGrain(tag = 'usa-grain') {
|
|
@@ -219,10 +220,10 @@ function defineGrain(tag = 'usa-grain') {
|
|
|
219
220
|
s.opacity = String(this.num('opacity', 0.12));
|
|
220
221
|
s.mixBlendMode = this.str('blend', 'overlay');
|
|
221
222
|
}
|
|
222
|
-
}, { id: 'grain', text: css$
|
|
223
|
+
}, { id: 'grain', text: css$4 });
|
|
223
224
|
}
|
|
224
225
|
|
|
225
|
-
var css$
|
|
226
|
+
var css$3 = "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}";
|
|
226
227
|
|
|
227
228
|
function defineMarquee(tag = 'usa-marquee') {
|
|
228
229
|
return defineElement(tag, (Base) => class UsaMarquee extends Base {
|
|
@@ -342,10 +343,10 @@ function defineMarquee(tag = 'usa-marquee') {
|
|
|
342
343
|
else
|
|
343
344
|
super.changed(name);
|
|
344
345
|
}
|
|
345
|
-
}, { id: 'marquee', text: css$
|
|
346
|
+
}, { id: 'marquee', text: css$3 });
|
|
346
347
|
}
|
|
347
348
|
|
|
348
|
-
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}}";
|
|
349
|
+
var css$2 = "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}}";
|
|
349
350
|
|
|
350
351
|
function defineAcrylic(tag = 'usa-acrylic') {
|
|
351
352
|
return defineElement(tag, (Base) => class UsaAcrylic extends Base {
|
|
@@ -366,7 +367,263 @@ function defineAcrylic(tag = 'usa-acrylic') {
|
|
|
366
367
|
this.setAttribute('data-shine', '');
|
|
367
368
|
}
|
|
368
369
|
}
|
|
369
|
-
}, { id: 'acrylic', text: css });
|
|
370
|
+
}, { id: 'acrylic', text: css$2 });
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
var css$1 = "usa-grid-glow,usa-blobs,usa-water-ripple,usa-dot-network{position:relative;display:block;isolation:isolate;overflow:hidden}usa-grid-glow{--usa-grid:32px;--usa-grid-r:220px;--usa-grid-color:var(--usa-accent,#7c5cff);--usa-grid-x:50%;--usa-grid-y:50%}usa-grid-glow::before,usa-grid-glow::after{content:\"\";position:absolute;inset:0;z-index:-1;pointer-events:none;background-image:linear-gradient(to right,var(--l) 1px,transparent 1px),linear-gradient(to bottom,var(--l) 1px,transparent 1px);background-size:var(--usa-grid) var(--usa-grid)}usa-grid-glow::before{--l:color-mix(in srgb,currentColor 9%,transparent)}usa-grid-glow::after{--l:var(--usa-grid-color);-webkit-mask:radial-gradient(var(--usa-grid-r) circle at var(--usa-grid-x) var(--usa-grid-y),#000,transparent 70%);mask:radial-gradient(var(--usa-grid-r) circle at var(--usa-grid-x) var(--usa-grid-y),#000,transparent 70%)}usa-blobs .usa-blobs-layer{position:absolute;inset:-20%;z-index:-1;filter:blur(var(--usa-blobs-blur,60px)) saturate(1.3);pointer-events:none}usa-blobs .usa-blobs-layer i{position:absolute;width:45%;aspect-ratio:1;border-radius:42% 58% 60% 40% / 45% 45% 55% 55%;background:var(--c);opacity:0.75;left:calc(10% + var(--i) * 18%);top:calc(10% + var(--i) * 14%);animation:usa-blob calc(14s / var(--usa-blobs-speed,1)) ease-in-out infinite alternate;animation-delay:calc(var(--i) * -3.5s)}@keyframes usa-blob{0%{transform:translate(0,0) rotate(0) scale(1);border-radius:42% 58% 60% 40% / 45% 45% 55% 55%}50%{transform:translate(18%,-12%) rotate(120deg) scale(1.15);border-radius:60% 40% 35% 65% / 55% 60% 40% 45%}100%{transform:translate(-14%,14%) rotate(240deg) scale(0.9);border-radius:38% 62% 55% 45% / 62% 38% 62% 38%}}usa-water-ripple .usa-bg-canvas{position:absolute;inset:0;z-index:1;pointer-events:none;mix-blend-mode:screen}usa-dot-network .usa-bg-canvas{position:absolute;inset:0;z-index:-1;pointer-events:none}@media (prefers-reduced-motion:reduce){usa-blobs .usa-blobs-layer i{animation:none}}";
|
|
374
|
+
|
|
375
|
+
/** Shared canvas setup: DPR ≤ 2, resize with the host, run only while visible & tab shown. */
|
|
376
|
+
function canvasLoop(host, draw, still) {
|
|
377
|
+
const c = document.createElement('canvas');
|
|
378
|
+
c.className = 'usa-bg-canvas';
|
|
379
|
+
c.setAttribute('aria-hidden', 'true');
|
|
380
|
+
host.prepend(c);
|
|
381
|
+
host.onCleanup(() => c.remove());
|
|
382
|
+
const ctx = c.getContext?.('2d');
|
|
383
|
+
if (!ctx)
|
|
384
|
+
return;
|
|
385
|
+
const dpr = Math.min(2, (typeof window !== 'undefined' && window.devicePixelRatio) || 1);
|
|
386
|
+
let w = 0;
|
|
387
|
+
let h = 0;
|
|
388
|
+
const size = () => {
|
|
389
|
+
const r = host.getBoundingClientRect();
|
|
390
|
+
w = Math.max(1, r.width || 300);
|
|
391
|
+
h = Math.max(1, r.height || 150);
|
|
392
|
+
c.width = w * dpr;
|
|
393
|
+
c.height = h * dpr;
|
|
394
|
+
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
|
|
395
|
+
};
|
|
396
|
+
size();
|
|
397
|
+
const ro = typeof ResizeObserver !== 'undefined' ? new ResizeObserver(size) : null;
|
|
398
|
+
ro?.observe(host);
|
|
399
|
+
host.onCleanup(() => ro?.disconnect());
|
|
400
|
+
let id = 0;
|
|
401
|
+
let on = false;
|
|
402
|
+
const loop = (t) => {
|
|
403
|
+
if (!document.hidden)
|
|
404
|
+
draw(ctx, w, h, t);
|
|
405
|
+
id = raf(loop);
|
|
406
|
+
};
|
|
407
|
+
if (still) {
|
|
408
|
+
draw(ctx, w, h, 0);
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
host.inView((v) => {
|
|
412
|
+
if (v && !on) {
|
|
413
|
+
on = true;
|
|
414
|
+
id = raf(loop);
|
|
415
|
+
}
|
|
416
|
+
else if (!v && on) {
|
|
417
|
+
on = false;
|
|
418
|
+
caf(id);
|
|
419
|
+
}
|
|
420
|
+
});
|
|
421
|
+
host.onCleanup(() => caf(id));
|
|
422
|
+
}
|
|
423
|
+
function defineGridGlow(tag = 'usa-grid-glow') {
|
|
424
|
+
return defineElement(tag, (Base) => class extends Base {
|
|
425
|
+
mount() {
|
|
426
|
+
this.style.setProperty('--usa-grid', `${this.num('size', 32)}px`);
|
|
427
|
+
this.style.setProperty('--usa-grid-r', `${this.num('radius', 220)}px`);
|
|
428
|
+
if (this.str('color'))
|
|
429
|
+
this.style.setProperty('--usa-grid-color', this.str('color'));
|
|
430
|
+
if (this.reduced)
|
|
431
|
+
return;
|
|
432
|
+
let f = 0;
|
|
433
|
+
let x = 0;
|
|
434
|
+
let y = 0;
|
|
435
|
+
this.listen(this, 'pointermove', (e) => {
|
|
436
|
+
const r = this.getBoundingClientRect();
|
|
437
|
+
x = e.clientX - r.left;
|
|
438
|
+
y = e.clientY - r.top;
|
|
439
|
+
if (!f)
|
|
440
|
+
f = raf(() => {
|
|
441
|
+
f = 0;
|
|
442
|
+
this.style.setProperty('--usa-grid-x', `${x}px`);
|
|
443
|
+
this.style.setProperty('--usa-grid-y', `${y}px`);
|
|
444
|
+
});
|
|
445
|
+
});
|
|
446
|
+
this.onCleanup(() => caf(f));
|
|
447
|
+
}
|
|
448
|
+
}, { id: 'bg-fx', text: css$1 });
|
|
449
|
+
}
|
|
450
|
+
function defineBlobs(tag = 'usa-blobs') {
|
|
451
|
+
return defineElement(tag, (Base) => class extends Base {
|
|
452
|
+
mount() {
|
|
453
|
+
this.querySelector(':scope > .usa-blobs-layer')?.remove();
|
|
454
|
+
const colors = this.str('colors', '#7c5cff,#22d3ee,#f472b6,#34d399').split(',');
|
|
455
|
+
const layer = document.createElement('div');
|
|
456
|
+
layer.className = 'usa-blobs-layer';
|
|
457
|
+
layer.setAttribute('aria-hidden', 'true');
|
|
458
|
+
layer.innerHTML = colors.map((c, i) => `<i style="--c:${c.trim()};--i:${i}"></i>`).join('');
|
|
459
|
+
this.prepend(layer);
|
|
460
|
+
this.style.setProperty('--usa-blobs-speed', String(this.num('speed', 1)));
|
|
461
|
+
this.style.setProperty('--usa-blobs-blur', `${this.num('blur', 60)}px`);
|
|
462
|
+
}
|
|
463
|
+
}, { id: 'bg-fx', text: css$1 });
|
|
464
|
+
}
|
|
465
|
+
function defineWaterRipple(tag = 'usa-water-ripple') {
|
|
466
|
+
return defineElement(tag, (Base) => class extends Base {
|
|
467
|
+
constructor() {
|
|
468
|
+
super(...arguments);
|
|
469
|
+
this._drop = null;
|
|
470
|
+
}
|
|
471
|
+
drop(x, y, s = 1) {
|
|
472
|
+
this._drop?.(x, y, s);
|
|
473
|
+
}
|
|
474
|
+
mount() {
|
|
475
|
+
if (this.reduced)
|
|
476
|
+
return;
|
|
477
|
+
const S = 4;
|
|
478
|
+
let cols = 0;
|
|
479
|
+
let rows = 0;
|
|
480
|
+
let a = new Float32Array(0);
|
|
481
|
+
let b = new Float32Array(0);
|
|
482
|
+
const damp = this.num('damping', 0.96);
|
|
483
|
+
const color = this.str('color', '255,255,255');
|
|
484
|
+
this._drop = (x, y, s = 1) => {
|
|
485
|
+
const cx = Math.floor(x / S);
|
|
486
|
+
const cy = Math.floor(y / S);
|
|
487
|
+
if (cx < 1 || cy < 1 || cx >= cols - 1 || cy >= rows - 1)
|
|
488
|
+
return;
|
|
489
|
+
a[cy * cols + cx] += 256 * s * this.num('strength', 1);
|
|
490
|
+
};
|
|
491
|
+
canvasLoop(this, (ctx, w, h) => {
|
|
492
|
+
const nc = Math.ceil(w / S);
|
|
493
|
+
const nr = Math.ceil(h / S);
|
|
494
|
+
if (nc !== cols || nr !== rows) {
|
|
495
|
+
cols = nc;
|
|
496
|
+
rows = nr;
|
|
497
|
+
a = new Float32Array(cols * rows);
|
|
498
|
+
b = new Float32Array(cols * rows);
|
|
499
|
+
}
|
|
500
|
+
ctx.clearRect(0, 0, w, h);
|
|
501
|
+
for (let y = 1; y < rows - 1; y++) {
|
|
502
|
+
for (let x = 1; x < cols - 1; x++) {
|
|
503
|
+
const i = y * cols + x;
|
|
504
|
+
const v = ((a[i - 1] + a[i + 1] + a[i - cols] + a[i + cols]) / 2 - b[i]) * damp;
|
|
505
|
+
b[i] = v;
|
|
506
|
+
if (v > 2 || v < -2) {
|
|
507
|
+
ctx.fillStyle = `rgba(${color},${Math.min(0.5, Math.abs(v) / 300).toFixed(3)})`;
|
|
508
|
+
ctx.fillRect(x * S, y * S, S, S);
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
const t = a;
|
|
513
|
+
a = b;
|
|
514
|
+
b = t;
|
|
515
|
+
}, false);
|
|
516
|
+
this.listen(this, 'pointermove', (e) => {
|
|
517
|
+
const r = this.getBoundingClientRect();
|
|
518
|
+
this.drop(e.clientX - r.left, e.clientY - r.top, 0.35);
|
|
519
|
+
});
|
|
520
|
+
this.listen(this, 'pointerdown', (e) => {
|
|
521
|
+
const r = this.getBoundingClientRect();
|
|
522
|
+
this.drop(e.clientX - r.left, e.clientY - r.top, 1.5);
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
}, { id: 'bg-fx', text: css$1 });
|
|
526
|
+
}
|
|
527
|
+
function defineDotNetwork(tag = 'usa-dot-network') {
|
|
528
|
+
return defineElement(tag, (Base) => class extends Base {
|
|
529
|
+
mount() {
|
|
530
|
+
const gap = Math.max(8, this.num('gap', 28));
|
|
531
|
+
const R = this.num('radius', 140);
|
|
532
|
+
const color = this.str('color', '124,92,255');
|
|
533
|
+
let px = -1e4;
|
|
534
|
+
let py = -1e4;
|
|
535
|
+
this.listen(this, 'pointermove', (e) => {
|
|
536
|
+
const r = this.getBoundingClientRect();
|
|
537
|
+
px = e.clientX - r.left;
|
|
538
|
+
py = e.clientY - r.top;
|
|
539
|
+
});
|
|
540
|
+
this.listen(this, 'pointerleave', () => (px = py = -1e4));
|
|
541
|
+
canvasLoop(this, (ctx, w, h) => {
|
|
542
|
+
ctx.clearRect(0, 0, w, h);
|
|
543
|
+
const near = [];
|
|
544
|
+
for (let y = gap / 2; y < h; y += gap) {
|
|
545
|
+
for (let x = gap / 2; x < w; x += gap) {
|
|
546
|
+
const d = Math.hypot(x - px, y - py);
|
|
547
|
+
const k = d < R ? 1 - d / R : 0;
|
|
548
|
+
const ox = k ? ((x - px) / (d || 1)) * k * 8 : 0;
|
|
549
|
+
const oy = k ? ((y - py) / (d || 1)) * k * 8 : 0;
|
|
550
|
+
ctx.fillStyle = `rgba(${color},${(0.25 + k * 0.75).toFixed(3)})`;
|
|
551
|
+
ctx.beginPath();
|
|
552
|
+
ctx.arc(x + ox, y + oy, 1.2 + k * 2.2, 0, Math.PI * 2);
|
|
553
|
+
ctx.fill();
|
|
554
|
+
if (k > 0.2)
|
|
555
|
+
near.push([x + ox, y + oy, k]);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
ctx.lineWidth = 1;
|
|
559
|
+
for (const [x, y, k] of near) {
|
|
560
|
+
ctx.strokeStyle = `rgba(${color},${(k * 0.5).toFixed(3)})`;
|
|
561
|
+
ctx.beginPath();
|
|
562
|
+
ctx.moveTo(x, y);
|
|
563
|
+
ctx.lineTo(px, py);
|
|
564
|
+
ctx.stroke();
|
|
565
|
+
}
|
|
566
|
+
}, this.reduced);
|
|
567
|
+
}
|
|
568
|
+
}, { id: 'bg-fx', text: css$1 });
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
var css = ".usa-fluent{font-family:\"Segoe UI Variable\",\"Segoe UI\",system-ui,sans-serif;accent-color:var(--usa-accent,#0067c0)}.usa-fluent-mica body{background:linear-gradient(135deg,color-mix(in srgb,var(--usa-accent,#0067c0) 8%,#f3f3f3),#f3f3f3 60%)}@media (prefers-color-scheme:dark){.usa-fluent-mica body{background:linear-gradient(135deg,color-mix(in srgb,var(--usa-accent,#4cc2ff) 10%,#202020),#202020 60%)}}.usa-fluent :is(.usa-acrylic,[data-acrylic]){background:color-mix(in srgb,var(--usa-surface) 70%,transparent);-webkit-backdrop-filter:blur(30px) saturate(1.25);backdrop-filter:blur(30px) saturate(1.25);border:var(--usa-border);border-radius:var(--usa-radius)}.usa-fluent :is(button,[role=\"button\"],[data-fluent-reveal],.usa-fluent-item){position:relative}.usa-fluent [data-reveal]::after{content:\"\";position:absolute;inset:0;border-radius:inherit;pointer-events:none;padding:1px;background:radial-gradient(90px circle at var(--usa-reveal-x) var(--usa-reveal-y),rgb(255 255 255 / 0.55),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-fluent [data-reveal]{background-image:radial-gradient(120px circle at var(--usa-reveal-x) var(--usa-reveal-y),rgb(255 255 255 / 0.1),transparent 70%)}@media (prefers-reduced-transparency:reduce),(forced-colors:active){.usa-fluent :is(.usa-acrylic,[data-acrylic]){background:var(--usa-surface);-webkit-backdrop-filter:none;backdrop-filter:none}}";
|
|
572
|
+
|
|
573
|
+
/**
|
|
574
|
+
* Windows 11 **Fluent preset** (v2.8): applies the `fluent` variant
|
|
575
|
+
* (Segoe UI Variable, Windows accent, 8 px radii), a Mica-style tinted
|
|
576
|
+
* window background, Acrylic on `.usa-acrylic` / `[data-acrylic]`, and
|
|
577
|
+
* Reveal highlight (a light following the pointer on borders and
|
|
578
|
+
* backgrounds of interactive elements). Ideal for WebView2 / Electron /
|
|
579
|
+
* Tauri apps on Windows. Returns a function that removes it.
|
|
580
|
+
* Respects reduced motion / transparency (no Reveal tracking; solid materials).
|
|
581
|
+
*/
|
|
582
|
+
function fluentPreset(options = {}) {
|
|
583
|
+
if (typeof document === 'undefined')
|
|
584
|
+
return () => undefined;
|
|
585
|
+
const root = options.root || document.documentElement;
|
|
586
|
+
adoptStyles('fluent-preset', css);
|
|
587
|
+
setVariant('fluent', root);
|
|
588
|
+
root.classList.add('usa-fluent');
|
|
589
|
+
if (options.mica !== false)
|
|
590
|
+
root.classList.add('usa-fluent-mica');
|
|
591
|
+
const sel = options.selector || 'button, [role="button"], a.usa-fluent-item, [data-fluent-reveal], .usa-fluent-item';
|
|
592
|
+
let frame = 0;
|
|
593
|
+
let last = null;
|
|
594
|
+
let ev = null;
|
|
595
|
+
const apply = () => {
|
|
596
|
+
frame = 0;
|
|
597
|
+
if (!ev)
|
|
598
|
+
return;
|
|
599
|
+
const t = ev.target?.closest?.(sel);
|
|
600
|
+
if (last && last !== t)
|
|
601
|
+
last.removeAttribute('data-reveal');
|
|
602
|
+
last = t;
|
|
603
|
+
if (!t)
|
|
604
|
+
return;
|
|
605
|
+
const r = t.getBoundingClientRect();
|
|
606
|
+
t.style.setProperty('--usa-reveal-x', `${ev.clientX - r.left}px`);
|
|
607
|
+
t.style.setProperty('--usa-reveal-y', `${ev.clientY - r.top}px`);
|
|
608
|
+
t.setAttribute('data-reveal', '');
|
|
609
|
+
};
|
|
610
|
+
const move = (e) => {
|
|
611
|
+
if (e.pointerType === 'touch')
|
|
612
|
+
return;
|
|
613
|
+
ev = e;
|
|
614
|
+
if (!frame)
|
|
615
|
+
frame = raf(apply);
|
|
616
|
+
};
|
|
617
|
+
const reveal = options.reveal !== false && !prefersReducedMotion();
|
|
618
|
+
if (reveal)
|
|
619
|
+
document.addEventListener('pointermove', move, { passive: true });
|
|
620
|
+
return () => {
|
|
621
|
+
document.removeEventListener('pointermove', move);
|
|
622
|
+
caf(frame);
|
|
623
|
+
last?.removeAttribute('data-reveal');
|
|
624
|
+
root.classList.remove('usa-fluent', 'usa-fluent-mica');
|
|
625
|
+
setVariant(null, root);
|
|
626
|
+
};
|
|
370
627
|
}
|
|
371
628
|
|
|
372
629
|
/**
|
|
@@ -381,7 +638,11 @@ function defineBackgroundComponents() {
|
|
|
381
638
|
defineGrain();
|
|
382
639
|
defineMarquee();
|
|
383
640
|
defineAcrylic();
|
|
641
|
+
defineGridGlow();
|
|
642
|
+
defineBlobs();
|
|
643
|
+
defineWaterRipple();
|
|
644
|
+
defineDotNetwork();
|
|
384
645
|
}
|
|
385
646
|
|
|
386
|
-
export { defineAcrylic, defineAurora, defineBackgroundComponents, defineGrain, defineMarquee, defineParticles };
|
|
647
|
+
export { defineAcrylic, defineAurora, defineBackgroundComponents, defineBlobs, defineDotNetwork, defineGrain, defineGridGlow, defineMarquee, defineParticles, defineWaterRipple, fluentPreset, prefersReducedMotion };
|
|
387
648
|
//# sourceMappingURL=background.js.map
|