motionary 0.0.0-stage → 6.2.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 +803 -0
- package/LICENSE +21 -0
- package/README.md +218 -2
- package/README_ja.md +219 -0
- package/README_zh.md +219 -0
- package/bin/usa-codemod-5.mjs +79 -0
- package/bin/usa-codemod-6.mjs +146 -0
- package/dist/chunks/base-BaQV-2ha.cjs +436 -0
- package/dist/chunks/base-BaQV-2ha.cjs.map +1 -0
- package/dist/chunks/base-C_3cAoRz.js +404 -0
- package/dist/chunks/base-C_3cAoRz.js.map +1 -0
- package/dist/chunks/bind-B_CTL6Qn.js +22 -0
- package/dist/chunks/bind-B_CTL6Qn.js.map +1 -0
- package/dist/chunks/bind-Ui43-n2d.cjs +25 -0
- package/dist/chunks/bind-Ui43-n2d.cjs.map +1 -0
- package/dist/chunks/core-B5T0dhFH.cjs +920 -0
- package/dist/chunks/core-B5T0dhFH.cjs.map +1 -0
- package/dist/chunks/core-BGAyaY6L.cjs +265 -0
- package/dist/chunks/core-BGAyaY6L.cjs.map +1 -0
- package/dist/chunks/core-D7cVumUu.js +909 -0
- package/dist/chunks/core-D7cVumUu.js.map +1 -0
- package/dist/chunks/core-VEBw36QK.js +260 -0
- package/dist/chunks/core-VEBw36QK.js.map +1 -0
- package/dist/chunks/core-ps8uvYuN.js +181 -0
- package/dist/chunks/core-ps8uvYuN.js.map +1 -0
- package/dist/chunks/core-zq17EeCI.cjs +185 -0
- package/dist/chunks/core-zq17EeCI.cjs.map +1 -0
- package/dist/chunks/fx-Bs6IrV4Q.js +109 -0
- package/dist/chunks/fx-Bs6IrV4Q.js.map +1 -0
- package/dist/chunks/fx-lBGVtQO1.cjs +114 -0
- package/dist/chunks/fx-lBGVtQO1.cjs.map +1 -0
- package/dist/chunks/generative-D2YyhaeO.js +336 -0
- package/dist/chunks/generative-D2YyhaeO.js.map +1 -0
- package/dist/chunks/generative-DzIZq-_g.cjs +348 -0
- package/dist/chunks/generative-DzIZq-_g.cjs.map +1 -0
- package/dist/chunks/gpu-Bu7qwugO.js +380 -0
- package/dist/chunks/gpu-Bu7qwugO.js.map +1 -0
- package/dist/chunks/gpu-CenK2l6b.cjs +387 -0
- package/dist/chunks/gpu-CenK2l6b.cjs.map +1 -0
- package/dist/chunks/index-tags-DucKMQr_.js +26 -0
- package/dist/chunks/index-tags-DucKMQr_.js.map +1 -0
- package/dist/chunks/index-tags-wv0R_vkO.cjs +28 -0
- package/dist/chunks/index-tags-wv0R_vkO.cjs.map +1 -0
- package/dist/chunks/presets-BYBVJVeP.js +226 -0
- package/dist/chunks/presets-BYBVJVeP.js.map +1 -0
- package/dist/chunks/presets-CUHys3sK.cjs +233 -0
- package/dist/chunks/presets-CUHys3sK.cjs.map +1 -0
- package/dist/chunks/registry-CKNLQpwd.js +121 -0
- package/dist/chunks/registry-CKNLQpwd.js.map +1 -0
- package/dist/chunks/registry-DehBVRDV.cjs +131 -0
- package/dist/chunks/registry-DehBVRDV.cjs.map +1 -0
- package/dist/chunks/spring-CbvHfVtP.js +219 -0
- package/dist/chunks/spring-CbvHfVtP.js.map +1 -0
- package/dist/chunks/spring-Dgx187Vh.cjs +232 -0
- package/dist/chunks/spring-Dgx187Vh.cjs.map +1 -0
- package/dist/chunks/stagger-CCFyhzSw.cjs +86 -0
- package/dist/chunks/stagger-CCFyhzSw.cjs.map +1 -0
- package/dist/chunks/stagger-DtMKo2SK.js +84 -0
- package/dist/chunks/stagger-DtMKo2SK.js.map +1 -0
- package/dist/chunks/variants-BhjyddG8.cjs +39 -0
- package/dist/chunks/variants-BhjyddG8.cjs.map +1 -0
- package/dist/chunks/variants-DRlKVHvu.js +35 -0
- package/dist/chunks/variants-DRlKVHvu.js.map +1 -0
- package/dist/components/a11y.cjs +276 -0
- package/dist/components/a11y.cjs.map +1 -0
- package/dist/components/a11y.d.cts +131 -0
- package/dist/components/a11y.d.ts +131 -0
- package/dist/components/a11y.js +259 -0
- package/dist/components/a11y.js.map +1 -0
- package/dist/components/angular.cjs +76 -0
- package/dist/components/angular.cjs.map +1 -0
- package/dist/components/angular.d.cts +1734 -0
- package/dist/components/angular.d.ts +1734 -0
- package/dist/components/angular.js +70 -0
- package/dist/components/angular.js.map +1 -0
- package/dist/components/background.cjs +659 -0
- package/dist/components/background.cjs.map +1 -0
- package/dist/components/background.css +9 -0
- package/dist/components/background.d.cts +166 -0
- package/dist/components/background.d.ts +166 -0
- package/dist/components/background.js +647 -0
- package/dist/components/background.js.map +1 -0
- package/dist/components/bridge.cjs +154 -0
- package/dist/components/bridge.cjs.map +1 -0
- package/dist/components/bridge.d.cts +63 -0
- package/dist/components/bridge.d.ts +63 -0
- package/dist/components/bridge.js +147 -0
- package/dist/components/bridge.js.map +1 -0
- package/dist/components/cards.cjs +561 -0
- package/dist/components/cards.cjs.map +1 -0
- package/dist/components/cards.css +6 -0
- package/dist/components/cards.d.cts +115 -0
- package/dist/components/cards.d.ts +115 -0
- package/dist/components/cards.js +554 -0
- package/dist/components/cards.js.map +1 -0
- package/dist/components/click.cjs +877 -0
- package/dist/components/click.cjs.map +1 -0
- package/dist/components/click.css +9 -0
- package/dist/components/click.d.cts +218 -0
- package/dist/components/click.d.ts +218 -0
- package/dist/components/click.js +863 -0
- package/dist/components/click.js.map +1 -0
- package/dist/components/depth.cjs +250 -0
- package/dist/components/depth.cjs.map +1 -0
- package/dist/components/depth.css +3 -0
- package/dist/components/depth.d.cts +86 -0
- package/dist/components/depth.d.ts +86 -0
- package/dist/components/depth.js +242 -0
- package/dist/components/depth.js.map +1 -0
- package/dist/components/effects.cjs +2258 -0
- package/dist/components/effects.cjs.map +1 -0
- package/dist/components/effects.d.cts +545 -0
- package/dist/components/effects.d.ts +545 -0
- package/dist/components/effects.js +2200 -0
- package/dist/components/effects.js.map +1 -0
- package/dist/components/feedback.cjs +442 -0
- package/dist/components/feedback.cjs.map +1 -0
- package/dist/components/feedback.css +7 -0
- package/dist/components/feedback.d.cts +144 -0
- package/dist/components/feedback.d.ts +144 -0
- package/dist/components/feedback.js +433 -0
- package/dist/components/feedback.js.map +1 -0
- package/dist/components/fx-gpu.cjs +12 -0
- package/dist/components/fx-gpu.cjs.map +1 -0
- package/dist/components/fx-gpu.d.cts +63 -0
- package/dist/components/fx-gpu.d.ts +63 -0
- package/dist/components/fx-gpu.js +5 -0
- package/dist/components/fx-gpu.js.map +1 -0
- package/dist/components/fx.cjs +169 -0
- package/dist/components/fx.cjs.map +1 -0
- package/dist/components/fx.css +3 -0
- package/dist/components/fx.d.cts +114 -0
- package/dist/components/fx.d.ts +114 -0
- package/dist/components/fx.js +156 -0
- package/dist/components/fx.js.map +1 -0
- package/dist/components/fx2.cjs +25 -0
- package/dist/components/fx2.cjs.map +1 -0
- package/dist/components/fx2.d.cts +136 -0
- package/dist/components/fx2.d.ts +136 -0
- package/dist/components/fx2.js +17 -0
- package/dist/components/fx2.js.map +1 -0
- package/dist/components/gesture.cjs +209 -0
- package/dist/components/gesture.cjs.map +1 -0
- package/dist/components/gesture.css +3 -0
- package/dist/components/gesture.d.cts +134 -0
- package/dist/components/gesture.d.ts +134 -0
- package/dist/components/gesture.js +203 -0
- package/dist/components/gesture.js.map +1 -0
- package/dist/components/interaction.cjs +424 -0
- package/dist/components/interaction.cjs.map +1 -0
- package/dist/components/interaction.css +8 -0
- package/dist/components/interaction.d.cts +115 -0
- package/dist/components/interaction.d.ts +115 -0
- package/dist/components/interaction.js +416 -0
- package/dist/components/interaction.js.map +1 -0
- package/dist/components/jsx.cjs +3 -0
- package/dist/components/jsx.cjs.map +1 -0
- package/dist/components/jsx.d.cts +53 -0
- package/dist/components/jsx.d.ts +53 -0
- package/dist/components/jsx.js +2 -0
- package/dist/components/jsx.js.map +1 -0
- package/dist/components/layout.cjs +257 -0
- package/dist/components/layout.cjs.map +1 -0
- package/dist/components/layout.css +3 -0
- package/dist/components/layout.d.cts +99 -0
- package/dist/components/layout.d.ts +99 -0
- package/dist/components/layout.js +249 -0
- package/dist/components/layout.js.map +1 -0
- package/dist/components/lazy.cjs +92 -0
- package/dist/components/lazy.cjs.map +1 -0
- package/dist/components/lazy.d.cts +48 -0
- package/dist/components/lazy.d.ts +48 -0
- package/dist/components/lazy.js +87 -0
- package/dist/components/lazy.js.map +1 -0
- package/dist/components/lite.cjs +11095 -0
- package/dist/components/lite.cjs.map +1 -0
- package/dist/components/lite.d.cts +4 -0
- package/dist/components/lite.d.ts +4 -0
- package/dist/components/lite.js +10827 -0
- package/dist/components/lite.js.map +1 -0
- package/dist/components/packs.cjs +192 -0
- package/dist/components/packs.cjs.map +1 -0
- package/dist/components/packs.css +3 -0
- package/dist/components/packs.d.cts +72 -0
- package/dist/components/packs.d.ts +72 -0
- package/dist/components/packs.js +184 -0
- package/dist/components/packs.js.map +1 -0
- package/dist/components/page.cjs +824 -0
- package/dist/components/page.cjs.map +1 -0
- package/dist/components/page.css +11 -0
- package/dist/components/page.d.cts +249 -0
- package/dist/components/page.d.ts +249 -0
- package/dist/components/page.js +799 -0
- package/dist/components/page.js.map +1 -0
- package/dist/components/perf.cjs +120 -0
- package/dist/components/perf.cjs.map +1 -0
- package/dist/components/perf.d.cts +98 -0
- package/dist/components/perf.d.ts +98 -0
- package/dist/components/perf.js +110 -0
- package/dist/components/perf.js.map +1 -0
- package/dist/components/physics.cjs +448 -0
- package/dist/components/physics.cjs.map +1 -0
- package/dist/components/physics.css +5 -0
- package/dist/components/physics.d.cts +189 -0
- package/dist/components/physics.d.ts +189 -0
- package/dist/components/physics.js +430 -0
- package/dist/components/physics.js.map +1 -0
- package/dist/components/react.cjs +96 -0
- package/dist/components/react.cjs.map +1 -0
- package/dist/components/react.d.cts +18 -0
- package/dist/components/react.d.ts +18 -0
- package/dist/components/react.js +91 -0
- package/dist/components/react.js.map +1 -0
- package/dist/components/reveal.cjs +362 -0
- package/dist/components/reveal.cjs.map +1 -0
- package/dist/components/reveal.css +5 -0
- package/dist/components/reveal.d.cts +105 -0
- package/dist/components/reveal.d.ts +105 -0
- package/dist/components/reveal.js +353 -0
- package/dist/components/reveal.js.map +1 -0
- package/dist/components/solid.cjs +86 -0
- package/dist/components/solid.cjs.map +1 -0
- package/dist/components/solid.d.cts +1751 -0
- package/dist/components/solid.d.ts +1751 -0
- package/dist/components/solid.js +82 -0
- package/dist/components/solid.js.map +1 -0
- package/dist/components/svelte.cjs +68 -0
- package/dist/components/svelte.cjs.map +1 -0
- package/dist/components/svelte.d.cts +1733 -0
- package/dist/components/svelte.d.ts +1733 -0
- package/dist/components/svelte.js +64 -0
- package/dist/components/svelte.js.map +1 -0
- package/dist/components/svg.cjs +359 -0
- package/dist/components/svg.cjs.map +1 -0
- package/dist/components/svg.css +3 -0
- package/dist/components/svg.d.cts +113 -0
- package/dist/components/svg.d.ts +113 -0
- package/dist/components/svg.js +347 -0
- package/dist/components/svg.js.map +1 -0
- package/dist/components/text.cjs +968 -0
- package/dist/components/text.cjs.map +1 -0
- package/dist/components/text.css +8 -0
- package/dist/components/text.d.cts +342 -0
- package/dist/components/text.d.ts +342 -0
- package/dist/components/text.js +947 -0
- package/dist/components/text.js.map +1 -0
- package/dist/components/timeline.cjs +109 -0
- package/dist/components/timeline.cjs.map +1 -0
- package/dist/components/timeline.css +3 -0
- package/dist/components/timeline.d.cts +155 -0
- package/dist/components/timeline.d.ts +155 -0
- package/dist/components/timeline.js +103 -0
- package/dist/components/timeline.js.map +1 -0
- package/dist/components/tokens.cjs +226 -0
- package/dist/components/tokens.cjs.map +1 -0
- package/dist/components/tokens.d.cts +74 -0
- package/dist/components/tokens.d.ts +74 -0
- package/dist/components/tokens.js +211 -0
- package/dist/components/tokens.js.map +1 -0
- package/dist/components/transitions.cjs +430 -0
- package/dist/components/transitions.cjs.map +1 -0
- package/dist/components/transitions.css +5 -0
- package/dist/components/transitions.d.cts +126 -0
- package/dist/components/transitions.d.ts +126 -0
- package/dist/components/transitions.js +423 -0
- package/dist/components/transitions.js.map +1 -0
- package/dist/components/ui.cjs +1050 -0
- package/dist/components/ui.cjs.map +1 -0
- package/dist/components/ui.css +14 -0
- package/dist/components/ui.d.cts +224 -0
- package/dist/components/ui.d.ts +224 -0
- package/dist/components/ui.js +1034 -0
- package/dist/components/ui.js.map +1 -0
- package/dist/components/vue.cjs +67 -0
- package/dist/components/vue.cjs.map +1 -0
- package/dist/components/vue.d.cts +1722 -0
- package/dist/components/vue.d.ts +1722 -0
- package/dist/components/vue.js +64 -0
- package/dist/components/vue.js.map +1 -0
- package/dist/components/webgl.cjs +459 -0
- package/dist/components/webgl.cjs.map +1 -0
- package/dist/components/webgl.css +3 -0
- package/dist/components/webgl.d.cts +133 -0
- package/dist/components/webgl.d.ts +133 -0
- package/dist/components/webgl.js +442 -0
- package/dist/components/webgl.js.map +1 -0
- package/dist/components/widgets.cjs +591 -0
- package/dist/components/widgets.cjs.map +1 -0
- package/dist/components/widgets.d.cts +110 -0
- package/dist/components/widgets.d.ts +110 -0
- package/dist/components/widgets.js +581 -0
- package/dist/components/widgets.js.map +1 -0
- package/dist/components.cjs +351 -0
- package/dist/components.cjs.map +1 -0
- package/dist/components.css +75 -0
- package/dist/components.d.cts +2997 -0
- package/dist/components.d.ts +2997 -0
- package/dist/components.js +106 -0
- package/dist/components.js.map +1 -0
- package/dist/components.umd.js +23 -0
- package/dist/components.umd.js.map +1 -0
- package/dist/element.cjs +97 -0
- package/dist/element.cjs.map +1 -0
- package/dist/element.d.cts +215 -0
- package/dist/element.d.ts +215 -0
- package/dist/element.js +95 -0
- package/dist/element.js.map +1 -0
- package/dist/element.umd.js +2 -0
- package/dist/element.umd.js.map +1 -0
- package/dist/index.cjs +149 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +425 -0
- package/dist/index.d.ts +425 -0
- package/dist/index.js +131 -0
- package/dist/index.js.map +1 -0
- package/dist/index.umd.js +15 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/presets/extended.cjs +243 -0
- package/dist/presets/extended.cjs.map +1 -0
- package/dist/presets/extended.d.cts +37 -0
- package/dist/presets/extended.d.ts +37 -0
- package/dist/presets/extended.js +239 -0
- package/dist/presets/extended.js.map +1 -0
- package/dist/presets-extended.umd.js +2 -0
- package/dist/presets-extended.umd.js.map +1 -0
- package/dist/react.cjs +68 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +158 -0
- package/dist/react.d.ts +158 -0
- package/dist/react.js +65 -0
- package/dist/react.js.map +1 -0
- package/dist/solid.cjs +93 -0
- package/dist/solid.cjs.map +1 -0
- package/dist/solid.d.cts +249 -0
- package/dist/solid.d.ts +249 -0
- package/dist/solid.js +89 -0
- package/dist/solid.js.map +1 -0
- package/dist/svelte.cjs +66 -0
- package/dist/svelte.cjs.map +1 -0
- package/dist/svelte.d.cts +243 -0
- package/dist/svelte.d.ts +243 -0
- package/dist/svelte.js +63 -0
- package/dist/svelte.js.map +1 -0
- package/dist/vue.cjs +62 -0
- package/dist/vue.cjs.map +1 -0
- package/dist/vue.d.cts +158 -0
- package/dist/vue.d.ts +158 -0
- package/dist/vue.js +60 -0
- package/dist/vue.js.map +1 -0
- package/dist/widgets.umd.js +2 -0
- package/dist/widgets.umd.js.map +1 -0
- package/docs/API.md +147 -0
- package/docs/ROADMAP.md +14 -0
- package/docs/accessibility.md +60 -0
- package/docs/components.md +564 -0
- package/docs/deprecations.md +30 -0
- package/docs/frameworks-ssr.md +100 -0
- package/docs/hybrid-apps.md +145 -0
- package/docs/images/showcase-detail.png +0 -0
- package/docs/images/showcase-grid.png +0 -0
- package/docs/images/showcase-mobile.png +0 -0
- package/docs/migration-from-aos.md +67 -0
- package/docs/migration-from-gsap-scrolltrigger.md +80 -0
- package/docs/motion-tokens.css +31 -0
- package/docs/motion-tokens.md +46 -0
- package/docs/motion.tokens.json +132 -0
- package/docs/performance.md +24 -0
- package/docs/presets.md +310 -0
- package/docs/upgrading-3.md +21 -0
- package/docs/upgrading-4.md +65 -0
- package/docs/upgrading-5.md +31 -0
- package/docs/upgrading-6.md +32 -0
- package/docs/windows-apps.md +119 -0
- package/package.json +562 -4
|
@@ -0,0 +1,647 @@
|
|
|
1
|
+
import { x as defineElement, l as caf, r as raf, u as adoptStyles, p as prefersReducedMotion } from '../chunks/base-C_3cAoRz.js';
|
|
2
|
+
import { s as setVariant } from '../chunks/variants-DRlKVHvu.js';
|
|
3
|
+
|
|
4
|
+
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
|
+
function defineAurora(tag = 'usa-aurora') {
|
|
7
|
+
return defineElement(tag, (Base) => class UsaAurora extends Base {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this._layer = null;
|
|
11
|
+
}
|
|
12
|
+
static get observedAttributes() {
|
|
13
|
+
return ['colors', 'speed', 'intensity'];
|
|
14
|
+
}
|
|
15
|
+
mount() {
|
|
16
|
+
if (!this._layer) {
|
|
17
|
+
this._layer = document.createElement('div');
|
|
18
|
+
this._layer.className = 'usa-aurora-layer';
|
|
19
|
+
this._layer.setAttribute('aria-hidden', 'true');
|
|
20
|
+
this._layer.innerHTML = '<i></i><i></i><i></i><i></i>';
|
|
21
|
+
this.prepend(this._layer);
|
|
22
|
+
}
|
|
23
|
+
const colors = this.str('colors', '#7c5cff,#22d3ee,#f472b6,#34d399').split(',').map((c) => c.trim()).filter(Boolean);
|
|
24
|
+
Array.from(this._layer.children).forEach((blob, i) => {
|
|
25
|
+
blob.style.setProperty('--c', colors[i % colors.length]);
|
|
26
|
+
});
|
|
27
|
+
const speed = this.num('speed', 1);
|
|
28
|
+
this.style.setProperty('--usa-aurora-speed', `${(18 / Math.max(0.05, speed)).toFixed(2)}s`);
|
|
29
|
+
this.style.setProperty('--usa-aurora-opacity', String(this.num('intensity', 0.7)));
|
|
30
|
+
this.inView((v) => this.toggleAttribute('data-offscreen', !v));
|
|
31
|
+
}
|
|
32
|
+
}, { id: 'aurora', text: css$6 });
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
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
|
+
function defineParticles(tag = 'usa-particles') {
|
|
38
|
+
return defineElement(tag, (Base) => class UsaParticles extends Base {
|
|
39
|
+
constructor() {
|
|
40
|
+
super(...arguments);
|
|
41
|
+
this._canvas = null;
|
|
42
|
+
this._ctx = null;
|
|
43
|
+
this._ps = [];
|
|
44
|
+
this._frame = 0;
|
|
45
|
+
this._w = 0;
|
|
46
|
+
this._h = 0;
|
|
47
|
+
this._visible = false;
|
|
48
|
+
this._mx = -1e4;
|
|
49
|
+
this._color = '#888';
|
|
50
|
+
this._my = -1e4;
|
|
51
|
+
}
|
|
52
|
+
static get observedAttributes() {
|
|
53
|
+
return ['count', 'color', 'size', 'speed', 'links', 'interactive', 'paused'];
|
|
54
|
+
}
|
|
55
|
+
mount() {
|
|
56
|
+
if (!this._canvas) {
|
|
57
|
+
this._canvas = document.createElement('canvas');
|
|
58
|
+
this._canvas.setAttribute('aria-hidden', 'true');
|
|
59
|
+
this.prepend(this._canvas);
|
|
60
|
+
}
|
|
61
|
+
this._ctx = this._canvas.getContext?.('2d') ?? null;
|
|
62
|
+
if (!this._ctx)
|
|
63
|
+
return;
|
|
64
|
+
this.resize();
|
|
65
|
+
if (typeof ResizeObserver !== 'undefined') {
|
|
66
|
+
const ro = new ResizeObserver(() => {
|
|
67
|
+
this.resize();
|
|
68
|
+
if (!this._frame)
|
|
69
|
+
this.draw();
|
|
70
|
+
});
|
|
71
|
+
ro.observe(this);
|
|
72
|
+
this.onCleanup(() => ro.disconnect());
|
|
73
|
+
}
|
|
74
|
+
this.inView((v) => {
|
|
75
|
+
this._visible = v;
|
|
76
|
+
this.loop();
|
|
77
|
+
});
|
|
78
|
+
this.listen(document, 'visibilitychange', () => this.loop());
|
|
79
|
+
if (this.flag('interactive')) {
|
|
80
|
+
this.listen(window, 'pointermove', (e) => {
|
|
81
|
+
const r = this.getBoundingClientRect();
|
|
82
|
+
this._mx = e.clientX - r.left;
|
|
83
|
+
this._my = e.clientY - r.top;
|
|
84
|
+
}, { passive: true });
|
|
85
|
+
}
|
|
86
|
+
this.draw();
|
|
87
|
+
}
|
|
88
|
+
unmount() {
|
|
89
|
+
caf(this._frame);
|
|
90
|
+
this._frame = 0;
|
|
91
|
+
}
|
|
92
|
+
reset() {
|
|
93
|
+
this._ps = [];
|
|
94
|
+
this.resize();
|
|
95
|
+
this.draw();
|
|
96
|
+
}
|
|
97
|
+
resize() {
|
|
98
|
+
const c = this._canvas;
|
|
99
|
+
if (!c || !this._ctx)
|
|
100
|
+
return;
|
|
101
|
+
const w = this.clientWidth || 300;
|
|
102
|
+
const h = this.clientHeight || 150;
|
|
103
|
+
const dpr = Math.min(2, (typeof devicePixelRatio === 'number' && devicePixelRatio) || 1);
|
|
104
|
+
c.width = Math.round(w * dpr);
|
|
105
|
+
c.height = Math.round(h * dpr);
|
|
106
|
+
this._ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
|
|
107
|
+
this._w = w;
|
|
108
|
+
this._h = h;
|
|
109
|
+
this._color = this.getAttribute('color') || (typeof getComputedStyle === 'function' ? getComputedStyle(this).color : '') || '#888';
|
|
110
|
+
const want = Math.round(Math.min(1, (w * h) / (900 * 500)) * Math.max(1, this.num('count', 60))) || 1;
|
|
111
|
+
const speed = this.num('speed', 0.35);
|
|
112
|
+
const size = this.num('size', 2.2);
|
|
113
|
+
while (this._ps.length < want) {
|
|
114
|
+
const a = Math.random() * Math.PI * 2;
|
|
115
|
+
const s = speed * (0.3 + Math.random() * 0.7);
|
|
116
|
+
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) });
|
|
117
|
+
}
|
|
118
|
+
this._ps.length = want;
|
|
119
|
+
}
|
|
120
|
+
loop() {
|
|
121
|
+
const run = this._visible && !this.reduced && !this.flag('paused') && !(typeof document !== 'undefined' && document.hidden);
|
|
122
|
+
if (run && !this._frame) {
|
|
123
|
+
const tick = () => {
|
|
124
|
+
this.step();
|
|
125
|
+
this.draw();
|
|
126
|
+
this._frame = raf(tick);
|
|
127
|
+
};
|
|
128
|
+
this._frame = raf(tick);
|
|
129
|
+
}
|
|
130
|
+
else if (!run && this._frame) {
|
|
131
|
+
caf(this._frame);
|
|
132
|
+
this._frame = 0;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
step() {
|
|
136
|
+
const { _w: w, _h: h } = this;
|
|
137
|
+
for (const p of this._ps) {
|
|
138
|
+
const dx = p.x - this._mx;
|
|
139
|
+
const dy = p.y - this._my;
|
|
140
|
+
const d2 = dx * dx + dy * dy;
|
|
141
|
+
if (d2 < 8100 && d2 > 0.01) {
|
|
142
|
+
const f = (1 - Math.sqrt(d2) / 90) * 0.6;
|
|
143
|
+
p.x += (dx / Math.sqrt(d2)) * f;
|
|
144
|
+
p.y += (dy / Math.sqrt(d2)) * f;
|
|
145
|
+
}
|
|
146
|
+
p.x += p.vx;
|
|
147
|
+
p.y += p.vy;
|
|
148
|
+
if (p.x < -5)
|
|
149
|
+
p.x = w + 5;
|
|
150
|
+
else if (p.x > w + 5)
|
|
151
|
+
p.x = -5;
|
|
152
|
+
if (p.y < -5)
|
|
153
|
+
p.y = h + 5;
|
|
154
|
+
else if (p.y > h + 5)
|
|
155
|
+
p.y = -5;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
draw() {
|
|
159
|
+
const ctx = this._ctx;
|
|
160
|
+
if (!ctx)
|
|
161
|
+
return;
|
|
162
|
+
const color = this._color;
|
|
163
|
+
ctx.clearRect(0, 0, this._w, this._h);
|
|
164
|
+
ctx.fillStyle = color;
|
|
165
|
+
ctx.strokeStyle = color;
|
|
166
|
+
const ps = this._ps;
|
|
167
|
+
const link = this.num('links', 110);
|
|
168
|
+
if (link > 0) {
|
|
169
|
+
const l2 = link * link;
|
|
170
|
+
ctx.lineWidth = 0.6;
|
|
171
|
+
for (let i = 0; i < ps.length; i++) {
|
|
172
|
+
for (let j = i + 1; j < ps.length; j++) {
|
|
173
|
+
const dx = ps[i].x - ps[j].x;
|
|
174
|
+
const dy = ps[i].y - ps[j].y;
|
|
175
|
+
const d2 = dx * dx + dy * dy;
|
|
176
|
+
if (d2 < l2) {
|
|
177
|
+
ctx.globalAlpha = (1 - d2 / l2) * 0.35;
|
|
178
|
+
ctx.beginPath();
|
|
179
|
+
ctx.moveTo(ps[i].x, ps[i].y);
|
|
180
|
+
ctx.lineTo(ps[j].x, ps[j].y);
|
|
181
|
+
ctx.stroke();
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
ctx.globalAlpha = 0.85;
|
|
187
|
+
for (const p of ps) {
|
|
188
|
+
ctx.beginPath();
|
|
189
|
+
ctx.arc(p.x, p.y, p.r, 0, Math.PI * 2);
|
|
190
|
+
ctx.fill();
|
|
191
|
+
}
|
|
192
|
+
ctx.globalAlpha = 1;
|
|
193
|
+
}
|
|
194
|
+
}, { id: 'particles', text: css$5 });
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
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
|
+
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
|
+
function defineGrain(tag = 'usa-grain') {
|
|
201
|
+
return defineElement(tag, (Base) => class UsaGrain extends Base {
|
|
202
|
+
constructor() {
|
|
203
|
+
super(...arguments);
|
|
204
|
+
this._layer = null;
|
|
205
|
+
}
|
|
206
|
+
static get observedAttributes() {
|
|
207
|
+
return ['opacity', 'blend', 'scale'];
|
|
208
|
+
}
|
|
209
|
+
mount() {
|
|
210
|
+
if (!this._layer) {
|
|
211
|
+
this._layer = document.createElement('div');
|
|
212
|
+
this._layer.className = 'usa-grain-layer';
|
|
213
|
+
this._layer.setAttribute('aria-hidden', 'true');
|
|
214
|
+
this.append(this._layer);
|
|
215
|
+
}
|
|
216
|
+
const s = this._layer.style;
|
|
217
|
+
s.backgroundImage = noise(0.8);
|
|
218
|
+
s.backgroundSize = `${this.num('scale', 180)}px`;
|
|
219
|
+
s.opacity = String(this.num('opacity', 0.12));
|
|
220
|
+
s.mixBlendMode = this.str('blend', 'overlay');
|
|
221
|
+
}
|
|
222
|
+
}, { id: 'grain', text: css$4 });
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
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
|
+
function defineMarquee(tag = 'usa-marquee') {
|
|
228
|
+
return defineElement(tag, (Base) => class UsaMarquee extends Base {
|
|
229
|
+
constructor() {
|
|
230
|
+
super(...arguments);
|
|
231
|
+
this._track = null;
|
|
232
|
+
this._anim = null;
|
|
233
|
+
this._hover = false;
|
|
234
|
+
this._visible = true;
|
|
235
|
+
this._size = 0;
|
|
236
|
+
}
|
|
237
|
+
static get observedAttributes() {
|
|
238
|
+
return ['speed', 'direction', 'gap', 'paused'];
|
|
239
|
+
}
|
|
240
|
+
get vertical() {
|
|
241
|
+
const d = this.str('direction', 'left');
|
|
242
|
+
return d === 'up' || d === 'down';
|
|
243
|
+
}
|
|
244
|
+
mount() {
|
|
245
|
+
if (!this._track) {
|
|
246
|
+
const track = document.createElement('div');
|
|
247
|
+
track.className = 'usa-marquee-track';
|
|
248
|
+
const group = document.createElement('div');
|
|
249
|
+
group.className = 'usa-marquee-group';
|
|
250
|
+
group.append(...Array.from(this.childNodes));
|
|
251
|
+
track.append(group);
|
|
252
|
+
this.append(track);
|
|
253
|
+
this._track = track;
|
|
254
|
+
}
|
|
255
|
+
this.toggleAttribute('data-vertical', this.vertical);
|
|
256
|
+
this.style.setProperty('--usa-marquee-gap', `${this.num('gap', 32)}px`);
|
|
257
|
+
if (this.reduced) {
|
|
258
|
+
this.setAttribute('data-static', '');
|
|
259
|
+
this.syncClones(1);
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
this.removeAttribute('data-static');
|
|
263
|
+
this.build();
|
|
264
|
+
if (typeof ResizeObserver !== 'undefined') {
|
|
265
|
+
const ro = new ResizeObserver(() => this.build());
|
|
266
|
+
ro.observe(this._track.firstElementChild);
|
|
267
|
+
this.onCleanup(() => ro.disconnect());
|
|
268
|
+
}
|
|
269
|
+
this.inView((v) => {
|
|
270
|
+
this._visible = v;
|
|
271
|
+
this.sync();
|
|
272
|
+
});
|
|
273
|
+
this.listen(this, 'pointerenter', () => ((this._hover = true), this.sync()));
|
|
274
|
+
this.listen(this, 'pointerleave', () => ((this._hover = false), this.sync()));
|
|
275
|
+
this.listen(this, 'focusin', () => ((this._hover = true), this.sync()));
|
|
276
|
+
this.listen(this, 'focusout', () => ((this._hover = false), this.sync()));
|
|
277
|
+
}
|
|
278
|
+
unmount() {
|
|
279
|
+
this._anim?.cancel();
|
|
280
|
+
this._anim = null;
|
|
281
|
+
this._size = 0;
|
|
282
|
+
}
|
|
283
|
+
syncClones(n) {
|
|
284
|
+
const track = this._track;
|
|
285
|
+
const group = track.firstElementChild;
|
|
286
|
+
while (track.children.length > n)
|
|
287
|
+
track.lastElementChild.remove();
|
|
288
|
+
while (track.children.length < n) {
|
|
289
|
+
const clone = group.cloneNode(true);
|
|
290
|
+
clone.setAttribute('aria-hidden', 'true');
|
|
291
|
+
clone.setAttribute('inert', '');
|
|
292
|
+
track.append(clone);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
build() {
|
|
296
|
+
const track = this._track;
|
|
297
|
+
const group = track.firstElementChild;
|
|
298
|
+
const vertical = this.vertical;
|
|
299
|
+
const gap = this.num('gap', 32);
|
|
300
|
+
const measured = vertical ? group.offsetHeight : group.offsetWidth;
|
|
301
|
+
if (!measured)
|
|
302
|
+
return; // not laid out yet: the ResizeObserver calls back
|
|
303
|
+
const size = measured + gap;
|
|
304
|
+
if (this._anim && this._size === size)
|
|
305
|
+
return;
|
|
306
|
+
this._size = size;
|
|
307
|
+
const box = (vertical ? this.clientHeight : this.clientWidth) || size;
|
|
308
|
+
// Enough copies to cover the box twice
|
|
309
|
+
this.syncClones(Math.min(50, Math.max(2, Math.ceil(box / size) + 1)));
|
|
310
|
+
const progress = this._anim?.effect?.getComputedTiming().progress ?? 0;
|
|
311
|
+
this._anim?.cancel();
|
|
312
|
+
const axis = vertical ? 'Y' : 'X';
|
|
313
|
+
const reverse = ['right', 'down'].includes(this.str('direction', 'left'));
|
|
314
|
+
const frames = [{ transform: `translate${axis}(0)` }, { transform: `translate${axis}(${-size}px)` }];
|
|
315
|
+
this._anim = this.motion(track, reverse ? frames.reverse() : frames, {
|
|
316
|
+
duration: (Math.max(1, size) / Math.max(1, this.num('speed', 50))) * 1000,
|
|
317
|
+
iterations: Infinity,
|
|
318
|
+
});
|
|
319
|
+
if (this._anim && progress)
|
|
320
|
+
this._anim.currentTime = progress * Number(this._anim.effect?.getTiming().duration || 0);
|
|
321
|
+
this.sync();
|
|
322
|
+
}
|
|
323
|
+
sync() {
|
|
324
|
+
const a = this._anim;
|
|
325
|
+
if (!a)
|
|
326
|
+
return;
|
|
327
|
+
const stop = this.flag('paused') || !this._visible || (this._hover && this.flag('pause-on-hover'));
|
|
328
|
+
if (stop && a.playState === 'running')
|
|
329
|
+
a.pause();
|
|
330
|
+
else if (!stop && a.playState === 'paused')
|
|
331
|
+
a.play();
|
|
332
|
+
}
|
|
333
|
+
pause() {
|
|
334
|
+
this.setAttribute('paused', '');
|
|
335
|
+
}
|
|
336
|
+
resume() {
|
|
337
|
+
this.removeAttribute('paused');
|
|
338
|
+
}
|
|
339
|
+
changed(name) {
|
|
340
|
+
if (name === 'paused')
|
|
341
|
+
this.sync();
|
|
342
|
+
else
|
|
343
|
+
super.changed(name);
|
|
344
|
+
}
|
|
345
|
+
}, { id: 'marquee', text: css$3 });
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
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[kind=\"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
|
+
function defineAcrylic(tag = 'usa-acrylic') {
|
|
351
|
+
return defineElement(tag, (Base) => class UsaAcrylic extends Base {
|
|
352
|
+
static get observedAttributes() {
|
|
353
|
+
return ['tint', 'tint-opacity', 'blur', 'shimmer'];
|
|
354
|
+
}
|
|
355
|
+
mount() {
|
|
356
|
+
const tint = this.getAttribute('tint');
|
|
357
|
+
if (tint)
|
|
358
|
+
this.style.setProperty('--usa-acrylic-tint', tint);
|
|
359
|
+
else
|
|
360
|
+
this.style.removeProperty('--usa-acrylic-tint');
|
|
361
|
+
this.style.setProperty('--usa-acrylic-opacity', `${Math.round(this.num('tint-opacity', 0.55) * 100)}%`);
|
|
362
|
+
this.style.setProperty('--usa-acrylic-blur', `${this.num('blur', 30)}px`);
|
|
363
|
+
if (this.str('shimmer') === 'load' && !this.reduced) {
|
|
364
|
+
this.removeAttribute('data-shine');
|
|
365
|
+
void this.offsetWidth;
|
|
366
|
+
this.setAttribute('data-shine', '');
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}, { id: 'acrylic', text: css$2 });
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
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}}";
|
|
373
|
+
|
|
374
|
+
/** Shared canvas setup: DPR ≤ 2, resize with the host, run only while visible & tab shown. */
|
|
375
|
+
function canvasLoop(host, draw, still) {
|
|
376
|
+
const c = document.createElement('canvas');
|
|
377
|
+
c.className = 'usa-bg-canvas';
|
|
378
|
+
c.setAttribute('aria-hidden', 'true');
|
|
379
|
+
host.prepend(c);
|
|
380
|
+
host.onCleanup(() => c.remove());
|
|
381
|
+
const ctx = c.getContext?.('2d');
|
|
382
|
+
if (!ctx)
|
|
383
|
+
return;
|
|
384
|
+
const dpr = Math.min(2, (typeof window !== 'undefined' && window.devicePixelRatio) || 1);
|
|
385
|
+
let w = 0;
|
|
386
|
+
let h = 0;
|
|
387
|
+
const size = () => {
|
|
388
|
+
const r = host.getBoundingClientRect();
|
|
389
|
+
w = Math.max(1, r.width || 300);
|
|
390
|
+
h = Math.max(1, r.height || 150);
|
|
391
|
+
c.width = w * dpr;
|
|
392
|
+
c.height = h * dpr;
|
|
393
|
+
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
|
|
394
|
+
};
|
|
395
|
+
size();
|
|
396
|
+
const ro = typeof ResizeObserver !== 'undefined' ? new ResizeObserver(size) : null;
|
|
397
|
+
ro?.observe(host);
|
|
398
|
+
host.onCleanup(() => ro?.disconnect());
|
|
399
|
+
let id = 0;
|
|
400
|
+
let on = false;
|
|
401
|
+
const loop = (t) => {
|
|
402
|
+
if (!document.hidden)
|
|
403
|
+
draw(ctx, w, h, t);
|
|
404
|
+
id = raf(loop);
|
|
405
|
+
};
|
|
406
|
+
if (still) {
|
|
407
|
+
draw(ctx, w, h, 0);
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
host.inView((v) => {
|
|
411
|
+
if (v && !on) {
|
|
412
|
+
on = true;
|
|
413
|
+
id = raf(loop);
|
|
414
|
+
}
|
|
415
|
+
else if (!v && on) {
|
|
416
|
+
on = false;
|
|
417
|
+
caf(id);
|
|
418
|
+
}
|
|
419
|
+
});
|
|
420
|
+
host.onCleanup(() => caf(id));
|
|
421
|
+
}
|
|
422
|
+
function defineGridGlow(tag = 'usa-grid-glow') {
|
|
423
|
+
return defineElement(tag, (Base) => class extends Base {
|
|
424
|
+
mount() {
|
|
425
|
+
this.style.setProperty('--usa-grid', `${this.num('size', 32)}px`);
|
|
426
|
+
this.style.setProperty('--usa-grid-r', `${this.num('radius', 220)}px`);
|
|
427
|
+
if (this.str('color'))
|
|
428
|
+
this.style.setProperty('--usa-grid-color', this.str('color'));
|
|
429
|
+
if (this.reduced)
|
|
430
|
+
return;
|
|
431
|
+
let f = 0;
|
|
432
|
+
let x = 0;
|
|
433
|
+
let y = 0;
|
|
434
|
+
this.listen(this, 'pointermove', (e) => {
|
|
435
|
+
const r = this.getBoundingClientRect();
|
|
436
|
+
x = e.clientX - r.left;
|
|
437
|
+
y = e.clientY - r.top;
|
|
438
|
+
if (!f)
|
|
439
|
+
f = raf(() => {
|
|
440
|
+
f = 0;
|
|
441
|
+
this.style.setProperty('--usa-grid-x', `${x}px`);
|
|
442
|
+
this.style.setProperty('--usa-grid-y', `${y}px`);
|
|
443
|
+
});
|
|
444
|
+
});
|
|
445
|
+
this.onCleanup(() => caf(f));
|
|
446
|
+
}
|
|
447
|
+
}, { id: 'bg-fx', text: css$1 });
|
|
448
|
+
}
|
|
449
|
+
function defineBlobs(tag = 'usa-blobs') {
|
|
450
|
+
return defineElement(tag, (Base) => class extends Base {
|
|
451
|
+
mount() {
|
|
452
|
+
this.querySelector(':scope > .usa-blobs-layer')?.remove();
|
|
453
|
+
const colors = this.str('colors', '#7c5cff,#22d3ee,#f472b6,#34d399').split(',');
|
|
454
|
+
const layer = document.createElement('div');
|
|
455
|
+
layer.className = 'usa-blobs-layer';
|
|
456
|
+
layer.setAttribute('aria-hidden', 'true');
|
|
457
|
+
layer.innerHTML = colors.map((c, i) => `<i style="--c:${c.trim()};--i:${i}"></i>`).join('');
|
|
458
|
+
this.prepend(layer);
|
|
459
|
+
this.style.setProperty('--usa-blobs-speed', String(this.num('speed', 1)));
|
|
460
|
+
this.style.setProperty('--usa-blobs-blur', `${this.num('blur', 60)}px`);
|
|
461
|
+
}
|
|
462
|
+
}, { id: 'bg-fx', text: css$1 });
|
|
463
|
+
}
|
|
464
|
+
function defineWaterRipple(tag = 'usa-water-ripple') {
|
|
465
|
+
return defineElement(tag, (Base) => class extends Base {
|
|
466
|
+
constructor() {
|
|
467
|
+
super(...arguments);
|
|
468
|
+
this._drop = null;
|
|
469
|
+
}
|
|
470
|
+
drop(x, y, s = 1) {
|
|
471
|
+
this._drop?.(x, y, s);
|
|
472
|
+
}
|
|
473
|
+
mount() {
|
|
474
|
+
if (this.reduced)
|
|
475
|
+
return;
|
|
476
|
+
const S = 4;
|
|
477
|
+
let cols = 0;
|
|
478
|
+
let rows = 0;
|
|
479
|
+
let a = new Float32Array(0);
|
|
480
|
+
let b = new Float32Array(0);
|
|
481
|
+
const damp = this.num('damping', 0.96);
|
|
482
|
+
const color = this.str('color', '255,255,255');
|
|
483
|
+
this._drop = (x, y, s = 1) => {
|
|
484
|
+
const cx = Math.floor(x / S);
|
|
485
|
+
const cy = Math.floor(y / S);
|
|
486
|
+
if (cx < 1 || cy < 1 || cx >= cols - 1 || cy >= rows - 1)
|
|
487
|
+
return;
|
|
488
|
+
a[cy * cols + cx] += 256 * s * this.num('strength', 1);
|
|
489
|
+
};
|
|
490
|
+
canvasLoop(this, (ctx, w, h) => {
|
|
491
|
+
const nc = Math.ceil(w / S);
|
|
492
|
+
const nr = Math.ceil(h / S);
|
|
493
|
+
if (nc !== cols || nr !== rows) {
|
|
494
|
+
cols = nc;
|
|
495
|
+
rows = nr;
|
|
496
|
+
a = new Float32Array(cols * rows);
|
|
497
|
+
b = new Float32Array(cols * rows);
|
|
498
|
+
}
|
|
499
|
+
ctx.clearRect(0, 0, w, h);
|
|
500
|
+
for (let y = 1; y < rows - 1; y++) {
|
|
501
|
+
for (let x = 1; x < cols - 1; x++) {
|
|
502
|
+
const i = y * cols + x;
|
|
503
|
+
const v = ((a[i - 1] + a[i + 1] + a[i - cols] + a[i + cols]) / 2 - b[i]) * damp;
|
|
504
|
+
b[i] = v;
|
|
505
|
+
if (v > 2 || v < -2) {
|
|
506
|
+
ctx.fillStyle = `rgba(${color},${Math.min(0.5, Math.abs(v) / 300).toFixed(3)})`;
|
|
507
|
+
ctx.fillRect(x * S, y * S, S, S);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
const t = a;
|
|
512
|
+
a = b;
|
|
513
|
+
b = t;
|
|
514
|
+
}, false);
|
|
515
|
+
this.listen(this, 'pointermove', (e) => {
|
|
516
|
+
const r = this.getBoundingClientRect();
|
|
517
|
+
this.drop(e.clientX - r.left, e.clientY - r.top, 0.35);
|
|
518
|
+
});
|
|
519
|
+
this.listen(this, 'pointerdown', (e) => {
|
|
520
|
+
const r = this.getBoundingClientRect();
|
|
521
|
+
this.drop(e.clientX - r.left, e.clientY - r.top, 1.5);
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
}, { id: 'bg-fx', text: css$1 });
|
|
525
|
+
}
|
|
526
|
+
function defineDotNetwork(tag = 'usa-dot-network') {
|
|
527
|
+
return defineElement(tag, (Base) => class extends Base {
|
|
528
|
+
mount() {
|
|
529
|
+
const gap = Math.max(8, this.num('gap', 28));
|
|
530
|
+
const R = this.num('radius', 140);
|
|
531
|
+
const color = this.str('color', '124,92,255');
|
|
532
|
+
let px = -1e4;
|
|
533
|
+
let py = -1e4;
|
|
534
|
+
this.listen(this, 'pointermove', (e) => {
|
|
535
|
+
const r = this.getBoundingClientRect();
|
|
536
|
+
px = e.clientX - r.left;
|
|
537
|
+
py = e.clientY - r.top;
|
|
538
|
+
});
|
|
539
|
+
this.listen(this, 'pointerleave', () => (px = py = -1e4));
|
|
540
|
+
canvasLoop(this, (ctx, w, h) => {
|
|
541
|
+
ctx.clearRect(0, 0, w, h);
|
|
542
|
+
const near = [];
|
|
543
|
+
for (let y = gap / 2; y < h; y += gap) {
|
|
544
|
+
for (let x = gap / 2; x < w; x += gap) {
|
|
545
|
+
const d = Math.hypot(x - px, y - py);
|
|
546
|
+
const k = d < R ? 1 - d / R : 0;
|
|
547
|
+
const ox = k ? ((x - px) / (d || 1)) * k * 8 : 0;
|
|
548
|
+
const oy = k ? ((y - py) / (d || 1)) * k * 8 : 0;
|
|
549
|
+
ctx.fillStyle = `rgba(${color},${(0.25 + k * 0.75).toFixed(3)})`;
|
|
550
|
+
ctx.beginPath();
|
|
551
|
+
ctx.arc(x + ox, y + oy, 1.2 + k * 2.2, 0, Math.PI * 2);
|
|
552
|
+
ctx.fill();
|
|
553
|
+
if (k > 0.2)
|
|
554
|
+
near.push([x + ox, y + oy, k]);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
ctx.lineWidth = 1;
|
|
558
|
+
for (const [x, y, k] of near) {
|
|
559
|
+
ctx.strokeStyle = `rgba(${color},${(k * 0.5).toFixed(3)})`;
|
|
560
|
+
ctx.beginPath();
|
|
561
|
+
ctx.moveTo(x, y);
|
|
562
|
+
ctx.lineTo(px, py);
|
|
563
|
+
ctx.stroke();
|
|
564
|
+
}
|
|
565
|
+
}, this.reduced);
|
|
566
|
+
}
|
|
567
|
+
}, { id: 'bg-fx', text: css$1 });
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
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}}";
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* Windows 11 **Fluent preset** (v2.8): applies the `fluent` variant
|
|
574
|
+
* (Segoe UI Variable, Windows accent, 8 px radii), a Mica-style tinted
|
|
575
|
+
* window background, Acrylic on `.usa-acrylic` / `[data-acrylic]`, and
|
|
576
|
+
* Reveal highlight (a light following the pointer on borders and
|
|
577
|
+
* backgrounds of interactive elements). Ideal for WebView2 / Electron /
|
|
578
|
+
* Tauri apps on Windows. Returns a function that removes it.
|
|
579
|
+
* Respects reduced motion / transparency (no Reveal tracking; solid materials).
|
|
580
|
+
*/
|
|
581
|
+
function fluentPreset(options = {}) {
|
|
582
|
+
if (typeof document === 'undefined')
|
|
583
|
+
return () => undefined;
|
|
584
|
+
const root = options.root || document.documentElement;
|
|
585
|
+
adoptStyles('fluent-preset', css);
|
|
586
|
+
setVariant('fluent', root);
|
|
587
|
+
root.classList.add('usa-fluent');
|
|
588
|
+
if (options.mica !== false)
|
|
589
|
+
root.classList.add('usa-fluent-mica');
|
|
590
|
+
const sel = options.selector || 'button, [role="button"], a.usa-fluent-item, [data-fluent-reveal], .usa-fluent-item';
|
|
591
|
+
let frame = 0;
|
|
592
|
+
let last = null;
|
|
593
|
+
let ev = null;
|
|
594
|
+
const apply = () => {
|
|
595
|
+
frame = 0;
|
|
596
|
+
if (!ev)
|
|
597
|
+
return;
|
|
598
|
+
const t = ev.target?.closest?.(sel);
|
|
599
|
+
if (last && last !== t)
|
|
600
|
+
last.removeAttribute('data-reveal');
|
|
601
|
+
last = t;
|
|
602
|
+
if (!t)
|
|
603
|
+
return;
|
|
604
|
+
const r = t.getBoundingClientRect();
|
|
605
|
+
t.style.setProperty('--usa-reveal-x', `${ev.clientX - r.left}px`);
|
|
606
|
+
t.style.setProperty('--usa-reveal-y', `${ev.clientY - r.top}px`);
|
|
607
|
+
t.setAttribute('data-reveal', '');
|
|
608
|
+
};
|
|
609
|
+
const move = (e) => {
|
|
610
|
+
if (e.pointerType === 'touch')
|
|
611
|
+
return;
|
|
612
|
+
ev = e;
|
|
613
|
+
if (!frame)
|
|
614
|
+
frame = raf(apply);
|
|
615
|
+
};
|
|
616
|
+
const reveal = options.reveal !== false && !prefersReducedMotion();
|
|
617
|
+
if (reveal)
|
|
618
|
+
document.addEventListener('pointermove', move, { passive: true });
|
|
619
|
+
return () => {
|
|
620
|
+
document.removeEventListener('pointermove', move);
|
|
621
|
+
caf(frame);
|
|
622
|
+
last?.removeAttribute('data-reveal');
|
|
623
|
+
root.classList.remove('usa-fluent', 'usa-fluent-mica');
|
|
624
|
+
setVariant(null, root);
|
|
625
|
+
};
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
/**
|
|
629
|
+
* motionary/components/background — backgrounds & decoration.
|
|
630
|
+
* `<usa-aurora>`, `<usa-particles>`, `<usa-grain>`, `<usa-marquee>`,
|
|
631
|
+
* `<usa-acrylic>`.
|
|
632
|
+
*/
|
|
633
|
+
/** Register every component of this category under its default tag. */
|
|
634
|
+
function defineBackgroundComponents() {
|
|
635
|
+
defineAurora();
|
|
636
|
+
defineParticles();
|
|
637
|
+
defineGrain();
|
|
638
|
+
defineMarquee();
|
|
639
|
+
defineAcrylic();
|
|
640
|
+
defineGridGlow();
|
|
641
|
+
defineBlobs();
|
|
642
|
+
defineWaterRipple();
|
|
643
|
+
defineDotNetwork();
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
export { defineAcrylic, defineAurora, defineBackgroundComponents, defineBlobs, defineDotNetwork, defineGrain, defineGridGlow, defineMarquee, defineParticles, defineWaterRipple, fluentPreset };
|
|
647
|
+
//# sourceMappingURL=background.js.map
|