@voriel_salut/ds 0.1.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/LICENSE +24 -0
- package/README.md +141 -0
- package/THIRD_PARTY_NOTICES.md +54 -0
- package/dist/AGENTS.md +58 -0
- package/dist/index.d.ts +229 -0
- package/dist/index.js +1066 -0
- package/dist/manifest.json +1008 -0
- package/dist/styles.css +9 -0
- package/dist/theme.css +855 -0
- package/package.json +99 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1066 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e, cn as t } from "cn";
|
|
3
|
+
import * as n from "react";
|
|
4
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
import { cva as a } from "class-variance-authority";
|
|
6
|
+
import { Dialog as o, Label as s, Slot as c, Tabs as l, Tooltip as u } from "radix-ui";
|
|
7
|
+
import { XIcon as d } from "lucide-react";
|
|
8
|
+
//#region src/components/air-style/air-style.tsx
|
|
9
|
+
function f({ label: e, src: n, sources: a = [], className: o, ...s }) {
|
|
10
|
+
return /* @__PURE__ */ i("span", {
|
|
11
|
+
"data-slot": "air-style",
|
|
12
|
+
className: t("flex min-w-0 flex-col gap-2 text-foreground", o),
|
|
13
|
+
...s,
|
|
14
|
+
children: [/* @__PURE__ */ r("span", {
|
|
15
|
+
"data-slot": "air-style-media",
|
|
16
|
+
className: "block w-full rounded-2xl border-2 border-border bg-muted p-4 shadow-sm md:p-6",
|
|
17
|
+
children: /* @__PURE__ */ i("picture", {
|
|
18
|
+
className: "block aspect-square w-32 max-w-full",
|
|
19
|
+
children: [a.map((e) => /* @__PURE__ */ r("source", {
|
|
20
|
+
srcSet: e.srcSet,
|
|
21
|
+
media: e.media,
|
|
22
|
+
sizes: e.sizes
|
|
23
|
+
}, e.srcSet)), /* @__PURE__ */ r("img", {
|
|
24
|
+
src: n,
|
|
25
|
+
alt: "",
|
|
26
|
+
"aria-hidden": "true",
|
|
27
|
+
className: "size-full object-cover object-center"
|
|
28
|
+
})]
|
|
29
|
+
})
|
|
30
|
+
}), /* @__PURE__ */ r("span", {
|
|
31
|
+
"data-slot": "air-style-label",
|
|
32
|
+
className: "line-clamp-2 overflow-clip px-1 text-xs leading-4 font-medium text-pretty md:text-[0.8125rem]",
|
|
33
|
+
children: e
|
|
34
|
+
})]
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/components/ui/badge.tsx
|
|
39
|
+
var p = a("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border-2 border-border px-2 py-0.5 text-xs font-semibold whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!", {
|
|
40
|
+
variants: { variant: {
|
|
41
|
+
default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
|
|
42
|
+
secondary: "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
|
|
43
|
+
accent: "bg-accent text-accent-foreground [a]:hover:bg-accent/80",
|
|
44
|
+
destructive: "bg-destructive text-destructive-foreground focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/80",
|
|
45
|
+
outline: "bg-background text-foreground [a]:hover:bg-accent [a]:hover:text-accent-foreground",
|
|
46
|
+
ghost: "border-transparent hover:bg-accent hover:text-accent-foreground",
|
|
47
|
+
link: "border-transparent text-primary underline-offset-4 hover:underline"
|
|
48
|
+
} },
|
|
49
|
+
defaultVariants: { variant: "default" }
|
|
50
|
+
});
|
|
51
|
+
function m({ className: e, variant: n = "default", asChild: i = !1, ...a }) {
|
|
52
|
+
let o = i ? c.Root : "span";
|
|
53
|
+
return /* @__PURE__ */ r(o, {
|
|
54
|
+
"data-slot": "badge",
|
|
55
|
+
"data-variant": n,
|
|
56
|
+
className: t(p({ variant: n }), e),
|
|
57
|
+
...a
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/components/ui/button.tsx
|
|
62
|
+
var h = "border-border shadow-sm active:not-aria-[haspopup]:translate-x-1 active:not-aria-[haspopup]:translate-y-1 active:not-aria-[haspopup]:shadow-none", g = a("group/button inline-flex shrink-0 items-center justify-center rounded-lg border-2 border-transparent bg-clip-padding text-sm font-semibold whitespace-nowrap transition-all outline-none select-none focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
|
|
63
|
+
variants: {
|
|
64
|
+
variant: {
|
|
65
|
+
default: t(h, "bg-primary text-primary-foreground hover:bg-primary/90"),
|
|
66
|
+
secondary: t(h, "bg-secondary text-secondary-foreground hover:bg-secondary/90"),
|
|
67
|
+
accent: t(h, "bg-accent text-accent-foreground hover:bg-accent/90"),
|
|
68
|
+
outline: t(h, "bg-background hover:bg-accent hover:text-accent-foreground aria-expanded:bg-accent aria-expanded:text-accent-foreground"),
|
|
69
|
+
ghost: "hover:bg-accent hover:text-accent-foreground aria-expanded:bg-accent aria-expanded:text-accent-foreground",
|
|
70
|
+
destructive: t(h, "bg-destructive text-destructive-foreground hover:bg-destructive/90 focus-visible:ring-destructive/40"),
|
|
71
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
72
|
+
},
|
|
73
|
+
size: {
|
|
74
|
+
default: "h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
75
|
+
xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
|
|
76
|
+
sm: "h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
|
|
77
|
+
lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
78
|
+
icon: "size-8",
|
|
79
|
+
"icon-xs": "size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3",
|
|
80
|
+
"icon-sm": "size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg",
|
|
81
|
+
"icon-lg": "size-9"
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
defaultVariants: {
|
|
85
|
+
variant: "default",
|
|
86
|
+
size: "default"
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
function _({ className: e, variant: n = "default", size: i = "default", asChild: a = !1, ...o }) {
|
|
90
|
+
let s = a ? c.Root : "button";
|
|
91
|
+
return /* @__PURE__ */ r(s, {
|
|
92
|
+
"data-slot": "button",
|
|
93
|
+
"data-variant": n,
|
|
94
|
+
"data-size": i,
|
|
95
|
+
className: t(g({
|
|
96
|
+
variant: n,
|
|
97
|
+
size: i,
|
|
98
|
+
className: e
|
|
99
|
+
})),
|
|
100
|
+
...o
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
//#endregion
|
|
104
|
+
//#region src/components/ui/card.tsx
|
|
105
|
+
function v({ className: e, size: n = "default", ...i }) {
|
|
106
|
+
return /* @__PURE__ */ r("div", {
|
|
107
|
+
"data-slot": "card",
|
|
108
|
+
"data-size": n,
|
|
109
|
+
className: t("group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground border-2 border-border shadow-md [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl", e),
|
|
110
|
+
...i
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
function y({ className: e, ...n }) {
|
|
114
|
+
return /* @__PURE__ */ r("div", {
|
|
115
|
+
"data-slot": "card-header",
|
|
116
|
+
className: t("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)", e),
|
|
117
|
+
...n
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
function ee({ className: e, ...n }) {
|
|
121
|
+
return /* @__PURE__ */ r("div", {
|
|
122
|
+
"data-slot": "card-title",
|
|
123
|
+
className: t("font-heading text-base leading-snug font-bold group-data-[size=sm]/card:text-sm", e),
|
|
124
|
+
...n
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
function b({ className: e, ...n }) {
|
|
128
|
+
return /* @__PURE__ */ r("div", {
|
|
129
|
+
"data-slot": "card-description",
|
|
130
|
+
className: t("text-sm text-muted-foreground", e),
|
|
131
|
+
...n
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
function x({ className: e, ...n }) {
|
|
135
|
+
return /* @__PURE__ */ r("div", {
|
|
136
|
+
"data-slot": "card-action",
|
|
137
|
+
className: t("col-start-2 row-span-2 row-start-1 self-start justify-self-end", e),
|
|
138
|
+
...n
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
function S({ className: e, ...n }) {
|
|
142
|
+
return /* @__PURE__ */ r("div", {
|
|
143
|
+
"data-slot": "card-content",
|
|
144
|
+
className: t("px-(--card-spacing)", e),
|
|
145
|
+
...n
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
function C({ className: e, ...n }) {
|
|
149
|
+
return /* @__PURE__ */ r("div", {
|
|
150
|
+
"data-slot": "card-footer",
|
|
151
|
+
className: t("flex items-center rounded-b-xl border-t-2 bg-muted/50 p-(--card-spacing)", e),
|
|
152
|
+
...n
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
//#endregion
|
|
156
|
+
//#region src/components/ui/dialog.tsx
|
|
157
|
+
function w({ ...e }) {
|
|
158
|
+
return /* @__PURE__ */ r(o.Root, {
|
|
159
|
+
"data-slot": "dialog",
|
|
160
|
+
...e
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
function T({ ...e }) {
|
|
164
|
+
return /* @__PURE__ */ r(o.Trigger, {
|
|
165
|
+
"data-slot": "dialog-trigger",
|
|
166
|
+
...e
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
function E({ ...e }) {
|
|
170
|
+
return /* @__PURE__ */ r(o.Portal, {
|
|
171
|
+
"data-slot": "dialog-portal",
|
|
172
|
+
...e
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
function te({ ...e }) {
|
|
176
|
+
return /* @__PURE__ */ r(o.Close, {
|
|
177
|
+
"data-slot": "dialog-close",
|
|
178
|
+
...e
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
function D({ className: e, ...n }) {
|
|
182
|
+
return /* @__PURE__ */ r(o.Overlay, {
|
|
183
|
+
"data-slot": "dialog-overlay",
|
|
184
|
+
className: t("fixed inset-0 isolate z-50 bg-black/40 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0", e),
|
|
185
|
+
...n
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
function O({ className: e, children: n, showCloseButton: a = !0, ...s }) {
|
|
189
|
+
return /* @__PURE__ */ i(E, { children: [/* @__PURE__ */ r(D, {}), /* @__PURE__ */ i(o.Content, {
|
|
190
|
+
"data-slot": "dialog-content",
|
|
191
|
+
className: t("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground border-2 border-border shadow-lg duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", e),
|
|
192
|
+
...s,
|
|
193
|
+
children: [n, a && /* @__PURE__ */ r(o.Close, {
|
|
194
|
+
"data-slot": "dialog-close",
|
|
195
|
+
asChild: !0,
|
|
196
|
+
children: /* @__PURE__ */ i(_, {
|
|
197
|
+
variant: "ghost",
|
|
198
|
+
className: "absolute top-2 right-2",
|
|
199
|
+
size: "icon-sm",
|
|
200
|
+
children: [/* @__PURE__ */ r(d, {}), /* @__PURE__ */ r("span", {
|
|
201
|
+
className: "sr-only",
|
|
202
|
+
children: "Close"
|
|
203
|
+
})]
|
|
204
|
+
})
|
|
205
|
+
})]
|
|
206
|
+
})] });
|
|
207
|
+
}
|
|
208
|
+
function k({ className: e, ...n }) {
|
|
209
|
+
return /* @__PURE__ */ r("div", {
|
|
210
|
+
"data-slot": "dialog-header",
|
|
211
|
+
className: t("flex flex-col gap-2", e),
|
|
212
|
+
...n
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
function A({ className: e, showCloseButton: n = !1, children: a, ...s }) {
|
|
216
|
+
return /* @__PURE__ */ i("div", {
|
|
217
|
+
"data-slot": "dialog-footer",
|
|
218
|
+
className: t("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t-2 bg-muted/50 p-4 sm:flex-row sm:justify-end", e),
|
|
219
|
+
...s,
|
|
220
|
+
children: [a, n && /* @__PURE__ */ r(o.Close, {
|
|
221
|
+
asChild: !0,
|
|
222
|
+
children: /* @__PURE__ */ r(_, {
|
|
223
|
+
variant: "outline",
|
|
224
|
+
children: "Close"
|
|
225
|
+
})
|
|
226
|
+
})]
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
function j({ className: e, ...n }) {
|
|
230
|
+
return /* @__PURE__ */ r(o.Title, {
|
|
231
|
+
"data-slot": "dialog-title",
|
|
232
|
+
className: t("font-heading text-base leading-none font-bold", e),
|
|
233
|
+
...n
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
function ne({ className: e, ...n }) {
|
|
237
|
+
return /* @__PURE__ */ r(o.Description, {
|
|
238
|
+
"data-slot": "dialog-description",
|
|
239
|
+
className: t("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground", e),
|
|
240
|
+
...n
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
//#endregion
|
|
244
|
+
//#region src/lib/css-color.ts
|
|
245
|
+
var M = null;
|
|
246
|
+
function re(e, t) {
|
|
247
|
+
M ??= document.createElement("canvas").getContext("2d", { willReadFrequently: !0 });
|
|
248
|
+
let n = e.style.color;
|
|
249
|
+
e.style.color = t;
|
|
250
|
+
let r = getComputedStyle(e).color;
|
|
251
|
+
e.style.color = n, M.clearRect(0, 0, 1, 1), M.fillStyle = "#000", M.fillStyle = r, M.fillRect(0, 0, 1, 1);
|
|
252
|
+
let [i, a, o] = M.getImageData(0, 0, 1, 1).data;
|
|
253
|
+
return [
|
|
254
|
+
i / 255,
|
|
255
|
+
a / 255,
|
|
256
|
+
o / 255
|
|
257
|
+
];
|
|
258
|
+
}
|
|
259
|
+
//#endregion
|
|
260
|
+
//#region src/components/shader-background/mesh-drift.frag?raw
|
|
261
|
+
var N = "// \"Mesh drift\" — made with the 21st.dev Shader Builder\n// From \"Shader R\" by Leandro Araujo, MIT License\n// (https://21st.dev/@ola.leandroaraujo/components/shader-r). See THIRD_PARTY_NOTICES.md.\n// Packed WebGL1 uniforms (the shader exposes readable u_* aliases as macros):\n// u_colors[8] (first 4 used)\n// vec3(0.012, 0.071, 0.055)\n// vec3(0.055, 0.486, 0.353)\n// vec3(0.486, 0.898, 0.467)\n// vec3(0.957, 1.000, 0.780)\n// u_scene = vec4(canvas width, canvas height, seconds * 0.73, 4.0)\n// u_shape = vec4(1.16, 0.34, 0.50, 0.00)\n// u_surface = vec4(2.40, 1.16, 0.00, 1.00)\n// u_finish = vec4(0.00, 0.00, 0.000, 0.09)\n// u_transform = vec4(1453.0, 0.00, 0.00, 0.0)\n// u_space = vec4(0.00, 0.00, pointer x, pointer y)\n// u_cursor = vec4(presence, 2.0, 0.65, 0.46)\n\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n\nuniform vec3 u_colors[8];\n// Seven packed vectors + eight colour vectors = 15 fragment uniform vectors,\n// one below WebGL1's guaranteed minimum. Macros preserve the public u_* API.\nuniform vec4 u_scene; // resolution.xy, time, colour count\nuniform vec4 u_shape; // scale, intensity, paramA, warp\nuniform vec4 u_surface; // detail, contrast, brightness, saturation\nuniform vec4 u_finish; // hue, vignette, blur, grain\nuniform vec4 u_transform; // seed, rotation, drift, OKLab toggle\nuniform vec4 u_space; // offset.xy, pointer.xy\nuniform vec4 u_cursor;\n\n#define u_resolution u_scene.xy\n#define u_time u_scene.z\n#define u_colorCount u_scene.w\n#define u_scale u_shape.x\n#define u_intensity u_shape.y\n#define u_paramA u_shape.z\n#define u_warp u_shape.w\n#define u_detail u_surface.x\n#define u_contrast u_surface.y\n#define u_brightness u_surface.z\n#define u_saturation u_surface.w\n#define u_hue u_finish.x\n#define u_vignette u_finish.y\n#define u_blur u_finish.z\n#define u_grain u_finish.w\n#ifdef GL_FRAGMENT_PRECISION_HIGH\n#define u_seed u_transform.x\n#else\n// Keep hash inputs inside mediump's guaranteed ±2^14 range.\n#define u_seed mod(u_transform.x, 31.0)\n#endif\n#define u_rotate u_transform.y\n#define u_drift u_transform.z\n#define u_oklab u_transform.w\n#define u_offset u_space.xy\n#define u_mouse u_space.zw\n#define u_cursorPresence u_cursor.x\n#define u_cursorEffect u_cursor.y\n#define u_cursorStrength u_cursor.z\n#define u_cursorRadius u_cursor.w\n\nfloat hash21(vec2 p) {\n#ifndef GL_FRAGMENT_PRECISION_HIGH\n p = mod(p, 31.0);\n#endif\n p = fract(p * vec2(234.34, 435.345));\n p += dot(p, p + 34.23);\n return fract(p.x * p.y);\n}\n\n// Even, un-structured white noise for film grain (Dave Hoskins hash12). The\n// multiply hash above is fine for value noise but shows a faint axis-aligned\n// mesh at integer fragment coords, which reads as a net over flat areas.\nfloat grainHash(vec2 p) {\n vec3 p3 = fract(vec3(p.xyx) * 0.1031);\n p3 += dot(p3, p3.yzx + 33.33);\n return fract((p3.x + p3.y) * p3.z);\n}\n\nvec2 hash22(vec2 p) {\n#ifndef GL_FRAGMENT_PRECISION_HIGH\n p = mod(p, 31.0);\n#endif\n float n = sin(dot(p, vec2(41.0, 289.0)));\n return fract(vec2(15731.743, 7892.321) * n);\n}\n\nfloat noise(vec2 p) {\n vec2 i = floor(p);\n vec2 f = fract(p);\n vec2 u = f * f * (3.0 - 2.0 * f);\n return mix(\n mix(hash21(i), hash21(i + vec2(1.0, 0.0)), u.x),\n mix(hash21(i + vec2(0.0, 1.0)), hash21(i + vec2(1.0, 1.0)), u.x),\n u.y);\n}\n\nfloat fbm(vec2 p) {\n float v = 0.0;\n float a = 0.5;\n for (int i = 0; i < 5; i++) {\n v += a * noise(p);\n p = p * 2.03 + vec2(17.0, 9.2);\n a *= 0.5;\n }\n return v;\n}\n\n// --- OKLab colour mixing (perceptual), gated by u_oklab -----------------------\nvec3 srgbToLinear(vec3 c) {\n return mix(c / 12.92, pow((c + 0.055) / 1.055, vec3(2.4)),\n step(0.04045, c));\n}\nvec3 linearToSrgb(vec3 c) {\n // max() guards the sRGB branch: out-of-gamut OKLab interpolations can send a\n // channel negative, and pow(negative, …) is NaN which mix()/step() would\n // then propagate. The linear branch clips such channels to 0 downstream.\n return mix(c * 12.92, 1.055 * pow(max(c, vec3(0.0)), vec3(1.0 / 2.4)) - 0.055,\n step(0.0031308, c));\n}\nvec3 linToOklab(vec3 c) {\n float l = 0.4122214708 * c.r + 0.5363325363 * c.g + 0.0514459929 * c.b;\n float m = 0.2119034982 * c.r + 0.6806995451 * c.g + 0.1073969566 * c.b;\n float s = 0.0883024619 * c.r + 0.2817188376 * c.g + 0.6299787005 * c.b;\n l = pow(max(l, 0.0), 1.0 / 3.0);\n m = pow(max(m, 0.0), 1.0 / 3.0);\n s = pow(max(s, 0.0), 1.0 / 3.0);\n return vec3(\n 0.2104542553 * l + 0.7936177850 * m - 0.0040720468 * s,\n 1.9779984951 * l - 2.4285922050 * m + 0.4505937099 * s,\n 0.0259040371 * l + 0.7827717662 * m - 0.8086757660 * s);\n}\nvec3 oklabToLin(vec3 c) {\n float l = c.x + 0.3963377774 * c.y + 0.2158037573 * c.z;\n float m = c.x - 0.1055613458 * c.y - 0.0638541728 * c.z;\n float s = c.x - 0.0894841775 * c.y - 1.2914855480 * c.z;\n l = l * l * l; m = m * m * m; s = s * s * s;\n return vec3(\n 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s,\n -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s,\n -0.0041960863 * l - 0.7034186147 * m + 1.7076147010 * s);\n}\nvec3 mixColour(vec3 a, vec3 b, float t) {\n if (u_oklab > 0.5) {\n vec3 la = linToOklab(srgbToLinear(a));\n vec3 lb = linToOklab(srgbToLinear(b));\n return clamp(linearToSrgb(oklabToLin(mix(la, lb, t))), 0.0, 1.0);\n }\n return mix(a, b, t);\n}\n\n// Mix through the recipe colours; x is clamped to 0..1. WebGL1 forbids\n// dynamic uniform indexing in fragment shaders, hence the constant loop.\nvec3 palette(float x) {\n float n = max(u_colorCount - 1.0, 1.0);\n float f = clamp(x, 0.0, 1.0) * n;\n vec3 col = u_colors[0];\n for (int i = 0; i < 7; i++) {\n if (float(i) < n)\n col = mixColour(col, u_colors[i + 1],\n smoothstep(0.0, 1.0, clamp(f - float(i), 0.0, 1.0)));\n }\n return col;\n}\n\nvec3 hueRotate(vec3 col, float a) {\n const mat3 toYIQ = mat3(0.299, 0.596, 0.211,\n 0.587, -0.274, -0.523,\n 0.114, -0.322, 0.312);\n const mat3 toRGB = mat3(1.0, 1.0, 1.0,\n 0.956, -0.272, -1.106,\n 0.621, -0.647, 1.703);\n vec3 yiq = toYIQ * col;\n float ca = cos(a), sa = sin(a);\n yiq = vec3(yiq.x, yiq.y * ca - yiq.z * sa, yiq.y * sa + yiq.z * ca);\n return toRGB * yiq;\n}\n\nvec3 shade(vec2 uv, vec2 p, float t) {\n vec3 acc = u_colors[0] * 0.15;\n float total = 0.15;\n for (int i = 0; i < 8; i++) {\n if (float(i) >= u_colorCount) break;\n float fi = float(i);\n vec2 c = vec2(\n sin(t * (0.21 + fi * 0.071) + fi * 2.4 + u_seed),\n cos(t * (0.17 + fi * 0.093) + fi * 1.7)) * (0.45 + u_intensity * 0.35);\n float w = exp(-dot(p - c, p - c) * 6.0);\n acc += u_colors[i] * w;\n total += w;\n }\n return acc / total;\n}\n\nvoid main() {\n vec2 uv = gl_FragCoord.xy / u_resolution.xy;\n vec2 screenUv = uv;\n vec2 p = (gl_FragCoord.xy - 0.5 * u_resolution.xy)\n / min(u_resolution.x, u_resolution.y);\n float cursorMask = 0.0;\n\n // Cursor modes 1–3 are local distortions. Push shifts the same screen-space\n // coordinates before field transforms, so Zoom/Rotate don't change its feel.\n if (u_cursorPresence > 0.001) {\n // u_mouse is normalized to -1..1 in canvas space. Convert it to the same\n // aspect-corrected screen space as p so effects stay under the cursor.\n vec2 cursor = (0.5 * u_mouse * u_resolution.xy)\n / min(u_resolution.x, u_resolution.y);\n vec2 cursorDelta = p - cursor;\n if (u_cursorEffect < 0.5) {\n p += cursor * u_cursorPresence * u_cursorStrength * 0.55;\n } else {\n float cursorDistance = length(cursorDelta);\n vec2 cursorDirection = cursorDelta / max(cursorDistance, 0.0001);\n cursorMask = u_cursorPresence\n * (1.0 - smoothstep(0.0, u_cursorRadius, cursorDistance));\n if (u_cursorEffect < 1.5) {\n p -= cursorDirection * cursorMask * u_cursorStrength * 0.24;\n } else if (u_cursorEffect < 2.5) {\n float cursorAngle = cursorMask * u_cursorStrength * 2.2;\n float cc = cos(cursorAngle), cs = sin(cursorAngle);\n p = cursor + mat2(cc, -cs, cs, cc) * cursorDelta;\n } else if (u_cursorEffect < 3.5) {\n float ripple = sin(\n cursorDistance / max(u_cursorRadius, 0.001) * 18.0 - u_time * 5.0);\n p -= cursorDirection * ripple * cursorMask * u_cursorStrength * 0.07;\n }\n }\n }\n\n // Keep presets that read uv (rather than p) in the same warped space.\n uv = p * min(u_resolution.x, u_resolution.y) / u_resolution.xy + 0.5;\n p *= u_scale;\n // Field transform: rotate, pan, pointer push, slow drift.\n if (abs(u_rotate) > 0.0001) {\n float cr = cos(u_rotate), sr = sin(u_rotate);\n p = mat2(cr, -sr, sr, cr) * p;\n }\n p += u_offset;\n if (u_drift > 0.0001)\n p += u_drift * vec2(sin(u_time * 0.31), cos(u_time * 0.23));\n // Organic domain warp.\n if (u_warp > 0.0) {\n p += u_warp * (vec2(\n fbm(p * u_detail + u_seed),\n fbm(p * u_detail + vec2(5.2, 1.3))) - 0.5);\n }\n // Shade, with an optional soft 5-tap blur.\n vec3 col;\n if (u_blur > 0.0) {\n float e = u_blur;\n float pe = e * u_scale;\n vec2 uvE = vec2(e) * min(u_resolution.x, u_resolution.y) / u_resolution.xy;\n col = shade(uv, p, u_time) * 0.36;\n col += shade(uv + vec2(uvE.x, 0.0), p + vec2(pe, 0.0), u_time) * 0.16;\n col += shade(uv - vec2(uvE.x, 0.0), p - vec2(pe, 0.0), u_time) * 0.16;\n col += shade(uv + vec2(0.0, uvE.y), p + vec2(0.0, pe), u_time) * 0.16;\n col += shade(uv - vec2(0.0, uvE.y), p - vec2(0.0, pe), u_time) * 0.16;\n } else {\n col = shade(uv, p, u_time);\n }\n // Post: contrast, saturation, hue, brightness, vignette, grain.\n if (abs(u_contrast - 1.0) > 0.0001)\n col = (col - 0.5) * u_contrast + 0.5;\n if (abs(u_saturation - 1.0) > 0.0001) {\n float luma = dot(col, vec3(0.299, 0.587, 0.114));\n col = mix(vec3(luma), col, u_saturation);\n }\n if (abs(u_hue) > 0.0001)\n col = hueRotate(col, u_hue);\n if (abs(u_brightness) > 0.0001)\n col += u_brightness;\n if (u_vignette > 0.0001) {\n float vd = length(screenUv - 0.5) * 1.41421356;\n col *= 1.0 - u_vignette * smoothstep(0.35, 1.0, vd);\n }\n if (u_cursorPresence > 0.001 && u_cursorEffect > 3.5)\n col += (vec3(0.18) + col * 0.12) * cursorMask * u_cursorStrength;\n if (u_grain > 0.0001)\n col += (grainHash(\n gl_FragCoord.xy + vec2(u_seed * 17.0, u_seed * 31.0)) - 0.5) * u_grain;\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n}\n", P = [
|
|
262
|
+
"--shader-1",
|
|
263
|
+
"--shader-2",
|
|
264
|
+
"--shader-3",
|
|
265
|
+
"--shader-4"
|
|
266
|
+
], F = "\nattribute vec2 a_position;\nvoid main() { gl_Position = vec4(a_position, 0.0, 1.0); }\n", I = {
|
|
267
|
+
u_shape: [
|
|
268
|
+
1.16,
|
|
269
|
+
.34,
|
|
270
|
+
.5,
|
|
271
|
+
0
|
|
272
|
+
],
|
|
273
|
+
u_surface: [
|
|
274
|
+
2.4,
|
|
275
|
+
1.16,
|
|
276
|
+
0,
|
|
277
|
+
1
|
|
278
|
+
],
|
|
279
|
+
u_finish: [
|
|
280
|
+
0,
|
|
281
|
+
0,
|
|
282
|
+
0,
|
|
283
|
+
.09
|
|
284
|
+
],
|
|
285
|
+
u_transform: [
|
|
286
|
+
1453,
|
|
287
|
+
0,
|
|
288
|
+
0,
|
|
289
|
+
0
|
|
290
|
+
],
|
|
291
|
+
u_space: [
|
|
292
|
+
0,
|
|
293
|
+
0,
|
|
294
|
+
0,
|
|
295
|
+
0
|
|
296
|
+
],
|
|
297
|
+
u_cursor: [
|
|
298
|
+
0,
|
|
299
|
+
2,
|
|
300
|
+
.65,
|
|
301
|
+
.46
|
|
302
|
+
]
|
|
303
|
+
};
|
|
304
|
+
function L(e, t, n) {
|
|
305
|
+
let r = e.createShader(t);
|
|
306
|
+
return r ? (e.shaderSource(r, n), e.compileShader(r), e.getShaderParameter(r, e.COMPILE_STATUS) ? r : (console.error("shader-background:", e.getShaderInfoLog(r)), null)) : null;
|
|
307
|
+
}
|
|
308
|
+
function R({ className: e, ...i }) {
|
|
309
|
+
let a = n.useRef(null);
|
|
310
|
+
return n.useEffect(() => {
|
|
311
|
+
let e = a.current, t = e.getContext("webgl", {
|
|
312
|
+
antialias: !1,
|
|
313
|
+
premultipliedAlpha: !1
|
|
314
|
+
});
|
|
315
|
+
if (!t) return;
|
|
316
|
+
let n = L(t, t.VERTEX_SHADER, F), r = L(t, t.FRAGMENT_SHADER, N), i = n && r ? t.createProgram() : null;
|
|
317
|
+
if (!i || !n || !r || (t.attachShader(i, n), t.attachShader(i, r), t.linkProgram(i), !t.getProgramParameter(i, t.LINK_STATUS))) return;
|
|
318
|
+
t.useProgram(i), t.bindBuffer(t.ARRAY_BUFFER, t.createBuffer()), t.bufferData(t.ARRAY_BUFFER, new Float32Array([
|
|
319
|
+
-1,
|
|
320
|
+
-1,
|
|
321
|
+
3,
|
|
322
|
+
-1,
|
|
323
|
+
-1,
|
|
324
|
+
3
|
|
325
|
+
]), t.STATIC_DRAW);
|
|
326
|
+
let o = t.getAttribLocation(i, "a_position");
|
|
327
|
+
t.enableVertexAttribArray(o), t.vertexAttribPointer(o, 2, t.FLOAT, !1, 0, 0);
|
|
328
|
+
for (let [e, n] of Object.entries(I)) t.uniform4fv(t.getUniformLocation(i, e), n);
|
|
329
|
+
let s = t.getUniformLocation(i, "u_scene"), c = t.getUniformLocation(i, "u_colors"), l = () => {
|
|
330
|
+
let n = /* @__PURE__ */ new Float32Array(24);
|
|
331
|
+
P.forEach((t, r) => {
|
|
332
|
+
n.set(re(e, `var(${t})`), r * 3);
|
|
333
|
+
}), t.uniform3fv(c, n);
|
|
334
|
+
};
|
|
335
|
+
l();
|
|
336
|
+
let u = () => {
|
|
337
|
+
let n = Math.min(window.devicePixelRatio || 1, 2);
|
|
338
|
+
e.width = Math.max(1, Math.round(e.clientWidth * n)), e.height = Math.max(1, Math.round(e.clientHeight * n)), t.viewport(0, 0, e.width, e.height);
|
|
339
|
+
};
|
|
340
|
+
u();
|
|
341
|
+
let d = window.matchMedia("(prefers-reduced-motion: reduce)"), f = performance.now(), p = 0, m = (n) => {
|
|
342
|
+
let r = d.matches ? 0 : (n - f) / 1e3;
|
|
343
|
+
t.uniform4f(s, e.width, e.height, r * .73, P.length), t.drawArrays(t.TRIANGLES, 0, 3);
|
|
344
|
+
}, h = (e) => {
|
|
345
|
+
m(e), p = document.hidden || d.matches ? 0 : requestAnimationFrame(h);
|
|
346
|
+
}, g = () => {
|
|
347
|
+
cancelAnimationFrame(p), p = requestAnimationFrame(h);
|
|
348
|
+
};
|
|
349
|
+
g();
|
|
350
|
+
let _ = new ResizeObserver(() => {
|
|
351
|
+
u(), g();
|
|
352
|
+
});
|
|
353
|
+
_.observe(e);
|
|
354
|
+
let v = new MutationObserver(() => {
|
|
355
|
+
l(), g();
|
|
356
|
+
});
|
|
357
|
+
return v.observe(document.documentElement, {
|
|
358
|
+
attributes: !0,
|
|
359
|
+
attributeFilter: ["class"]
|
|
360
|
+
}), document.addEventListener("visibilitychange", g), d.addEventListener("change", g), () => {
|
|
361
|
+
cancelAnimationFrame(p), _.disconnect(), v.disconnect(), document.removeEventListener("visibilitychange", g), d.removeEventListener("change", g), t.getExtension("WEBGL_lose_context")?.loseContext();
|
|
362
|
+
};
|
|
363
|
+
}, []), /* @__PURE__ */ r("div", {
|
|
364
|
+
"data-slot": "shader-background",
|
|
365
|
+
"aria-hidden": "true",
|
|
366
|
+
className: t("pointer-events-none absolute inset-0 -z-10 bg-(--shader-1)", e),
|
|
367
|
+
...i,
|
|
368
|
+
children: /* @__PURE__ */ r("canvas", {
|
|
369
|
+
ref: a,
|
|
370
|
+
className: "block size-full"
|
|
371
|
+
})
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
//#endregion
|
|
375
|
+
//#region src/components/ui/halftone-nebula.tsx
|
|
376
|
+
var z = {
|
|
377
|
+
pixel: 6,
|
|
378
|
+
dotMin: .12,
|
|
379
|
+
dotMax: .56,
|
|
380
|
+
levels: 7,
|
|
381
|
+
scale: 1.7,
|
|
382
|
+
warp: 1.5,
|
|
383
|
+
drift: .035,
|
|
384
|
+
density: .5,
|
|
385
|
+
threshold: .54,
|
|
386
|
+
softness: .5,
|
|
387
|
+
band: .5,
|
|
388
|
+
bandAngle: 1.05,
|
|
389
|
+
bandOffset: .42,
|
|
390
|
+
bandWidth: .34,
|
|
391
|
+
haze: .8,
|
|
392
|
+
stars: 1,
|
|
393
|
+
twinkle: 1.4,
|
|
394
|
+
starDrift: 1.2,
|
|
395
|
+
sparkles: 9,
|
|
396
|
+
seed: 11,
|
|
397
|
+
spikeWidth: 1,
|
|
398
|
+
planet: !0,
|
|
399
|
+
planetX: .26,
|
|
400
|
+
planetY: .36,
|
|
401
|
+
planetRadius: .075,
|
|
402
|
+
parallax: 1,
|
|
403
|
+
lens: .55,
|
|
404
|
+
lensRadius: 170,
|
|
405
|
+
lensPush: .3,
|
|
406
|
+
rippleSpeed: 420,
|
|
407
|
+
speed: 1,
|
|
408
|
+
vignette: .5,
|
|
409
|
+
grain: .035,
|
|
410
|
+
voidColor: "var(--shader-1)",
|
|
411
|
+
hazeColor: "var(--background)",
|
|
412
|
+
duskColor: "var(--muted)",
|
|
413
|
+
wineColor: "var(--shader-2)",
|
|
414
|
+
crimsonColor: "color-mix(in oklch, var(--shader-2), var(--shader-3))",
|
|
415
|
+
hotColor: "var(--shader-3)",
|
|
416
|
+
starColor: "var(--shader-4)"
|
|
417
|
+
}, B = {
|
|
418
|
+
brand: {},
|
|
419
|
+
crimson: {
|
|
420
|
+
voidColor: "#050309",
|
|
421
|
+
hazeColor: "#161a38",
|
|
422
|
+
duskColor: "#3b1646",
|
|
423
|
+
wineColor: "#5c0d31",
|
|
424
|
+
crimsonColor: "#c01245",
|
|
425
|
+
hotColor: "#ff1f5a",
|
|
426
|
+
starColor: "#f6e2e8"
|
|
427
|
+
},
|
|
428
|
+
ultraviolet: {
|
|
429
|
+
voidColor: "#050309",
|
|
430
|
+
hazeColor: "#10183f",
|
|
431
|
+
duskColor: "#2a1a5e",
|
|
432
|
+
wineColor: "#3d1478",
|
|
433
|
+
crimsonColor: "#7b2cf0",
|
|
434
|
+
hotColor: "#c77dff",
|
|
435
|
+
starColor: "#eef0ff",
|
|
436
|
+
bandAngle: 2.2,
|
|
437
|
+
bandOffset: .3,
|
|
438
|
+
planetX: .74,
|
|
439
|
+
planetY: .3,
|
|
440
|
+
seed: 4
|
|
441
|
+
},
|
|
442
|
+
abyssal: {
|
|
443
|
+
voidColor: "#02060a",
|
|
444
|
+
hazeColor: "#0a1f2e",
|
|
445
|
+
duskColor: "#0d2f3f",
|
|
446
|
+
wineColor: "#0a4453",
|
|
447
|
+
crimsonColor: "#0f8f9f",
|
|
448
|
+
hotColor: "#3ff2e0",
|
|
449
|
+
starColor: "#e4fffb",
|
|
450
|
+
band: .5,
|
|
451
|
+
bandAngle: -.4,
|
|
452
|
+
bandOffset: -.2,
|
|
453
|
+
planetX: .7,
|
|
454
|
+
planetY: .66,
|
|
455
|
+
seed: 23
|
|
456
|
+
},
|
|
457
|
+
solar: {
|
|
458
|
+
voidColor: "#070403",
|
|
459
|
+
hazeColor: "#231208",
|
|
460
|
+
duskColor: "#3d1a07",
|
|
461
|
+
wineColor: "#6e2406",
|
|
462
|
+
crimsonColor: "#d8520c",
|
|
463
|
+
hotColor: "#ffb020",
|
|
464
|
+
starColor: "#fff3d6",
|
|
465
|
+
warp: 1.9,
|
|
466
|
+
band: .72,
|
|
467
|
+
bandAngle: .4,
|
|
468
|
+
planetRadius: .1,
|
|
469
|
+
seed: 5
|
|
470
|
+
},
|
|
471
|
+
phosphor: {
|
|
472
|
+
voidColor: "#020502",
|
|
473
|
+
hazeColor: "#08170c",
|
|
474
|
+
duskColor: "#0c2412",
|
|
475
|
+
wineColor: "#0e3d18",
|
|
476
|
+
crimsonColor: "#1f9d3a",
|
|
477
|
+
hotColor: "#6dff7a",
|
|
478
|
+
starColor: "#e6ffe8",
|
|
479
|
+
pixel: 5,
|
|
480
|
+
levels: 5,
|
|
481
|
+
planet: !1,
|
|
482
|
+
sparkles: 6,
|
|
483
|
+
seed: 31
|
|
484
|
+
}
|
|
485
|
+
}, V = 16, H = 4, ie = [
|
|
486
|
+
["pixel", "f"],
|
|
487
|
+
["dotMin", "f"],
|
|
488
|
+
["dotMax", "f"],
|
|
489
|
+
["levels", "f"],
|
|
490
|
+
["scale", "f"],
|
|
491
|
+
["warp", "f"],
|
|
492
|
+
["drift", "f"],
|
|
493
|
+
["density", "f"],
|
|
494
|
+
["threshold", "f"],
|
|
495
|
+
["softness", "f"],
|
|
496
|
+
["band", "f"],
|
|
497
|
+
["bandAngle", "f"],
|
|
498
|
+
["bandOffset", "f"],
|
|
499
|
+
["bandWidth", "f"],
|
|
500
|
+
["haze", "f"],
|
|
501
|
+
["stars", "f"],
|
|
502
|
+
["twinkle", "f"],
|
|
503
|
+
["starDrift", "f"],
|
|
504
|
+
["spikeWidth", "f"],
|
|
505
|
+
["parallax", "f"],
|
|
506
|
+
["lens", "f"],
|
|
507
|
+
["lensRadius", "f"],
|
|
508
|
+
["lensPush", "f"],
|
|
509
|
+
["rippleSpeed", "f"],
|
|
510
|
+
["vignette", "f"],
|
|
511
|
+
["grain", "f"],
|
|
512
|
+
["voidColor", "c"],
|
|
513
|
+
["hazeColor", "c"],
|
|
514
|
+
["duskColor", "c"],
|
|
515
|
+
["wineColor", "c"],
|
|
516
|
+
["crimsonColor", "c"],
|
|
517
|
+
["hotColor", "c"],
|
|
518
|
+
["starColor", "c"]
|
|
519
|
+
], ae = (e) => "u" + e[0].toUpperCase() + e.slice(1), U = (e) => e === "c" ? "vec3" : e === "i" || e === "b" ? "int" : "float", W = (e) => e.map(([e, t]) => "uniform " + U(t) + " " + ae(e) + ";").join("\n"), oe = "#version 300 es\nvoid main(){\n vec2 p = vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2));\n gl_Position = vec4(p * 2.0 - 1.0, 0.0, 1.0);\n}", se = `#version 300 es
|
|
520
|
+
precision highp float;
|
|
521
|
+
uniform vec2 uRes;
|
|
522
|
+
uniform float uDpr;
|
|
523
|
+
uniform float uTime;
|
|
524
|
+
uniform vec2 uPointer;
|
|
525
|
+
uniform float uPointerOn;
|
|
526
|
+
uniform vec2 uLook;
|
|
527
|
+
uniform int uSparkCount;
|
|
528
|
+
uniform vec4 uSpark[${V}];
|
|
529
|
+
uniform vec4 uSparkB[${V}];
|
|
530
|
+
uniform vec4 uRipple[${H}];
|
|
531
|
+
uniform vec4 uPlanet;
|
|
532
|
+
${W(ie)}
|
|
533
|
+
out vec4 frag;
|
|
534
|
+
|
|
535
|
+
float hash12(vec2 p){
|
|
536
|
+
vec3 p3 = fract(vec3(p.xyx) * 0.1031);
|
|
537
|
+
p3 += dot(p3, p3.yzx + 33.33);
|
|
538
|
+
return fract((p3.x + p3.y) * p3.z);
|
|
539
|
+
}
|
|
540
|
+
float vnoise(vec2 p){
|
|
541
|
+
vec2 i = floor(p), f = fract(p);
|
|
542
|
+
f = f * f * (3.0 - 2.0 * f);
|
|
543
|
+
float a = hash12(i), b = hash12(i + vec2(1.0, 0.0));
|
|
544
|
+
float c = hash12(i + vec2(0.0, 1.0)), d = hash12(i + vec2(1.0, 1.0));
|
|
545
|
+
return mix(mix(a, b, f.x), mix(c, d, f.x), f.y);
|
|
546
|
+
}
|
|
547
|
+
float fbm(vec2 p){
|
|
548
|
+
float s = 0.0, a = 0.5;
|
|
549
|
+
mat2 r = mat2(0.8, -0.6, 0.6, 0.8);
|
|
550
|
+
for (int i = 0; i < 5; i++) { s += a * vnoise(p); p = r * p * 2.03 + 17.1; a *= 0.5; }
|
|
551
|
+
return s / 0.96875;
|
|
552
|
+
}
|
|
553
|
+
float bayer4(vec2 c){
|
|
554
|
+
vec2 m = mod(c, 4.0);
|
|
555
|
+
int i = int(m.x) + int(m.y) * 4;
|
|
556
|
+
int b[16] = int[16](0, 8, 2, 10, 12, 4, 14, 6, 3, 11, 1, 9, 15, 7, 13, 5);
|
|
557
|
+
return (float(b[i]) + 0.5) / 16.0;
|
|
558
|
+
}
|
|
559
|
+
vec3 ramp(float d, vec3 haze){
|
|
560
|
+
vec3 c = mix(uVoidColor, haze, smoothstep(0.0, 0.22, d));
|
|
561
|
+
c = mix(c, uWineColor, smoothstep(0.18, 0.44, d));
|
|
562
|
+
c = mix(c, uCrimsonColor, smoothstep(0.42, 0.72, d));
|
|
563
|
+
return mix(c, uHotColor, smoothstep(0.7, 0.96, d));
|
|
564
|
+
}
|
|
565
|
+
vec2 shift(float depth){
|
|
566
|
+
return floor(uLook * uParallax * depth * 28.0);
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
// Density of the gas at a CSS-pixel position: x = density, y = haze, z = tone.
|
|
570
|
+
vec3 field(vec2 pos, vec2 resCss){
|
|
571
|
+
float minSide = min(resCss.x, resCss.y);
|
|
572
|
+
vec2 uv = (pos - 0.5 * resCss) / minSide;
|
|
573
|
+
vec2 p = uv * uScale + uLook * uParallax * 0.05;
|
|
574
|
+
|
|
575
|
+
vec2 toP = pos - uPointer;
|
|
576
|
+
float lamp = exp(-dot(toP, toP) / (uLensRadius * uLensRadius)) * uPointerOn;
|
|
577
|
+
p += toP / minSide * lamp * uLensPush * uScale;
|
|
578
|
+
|
|
579
|
+
float ring = 0.0;
|
|
580
|
+
for (int i = 0; i < ${H}; i++) {
|
|
581
|
+
vec4 r = uRipple[i];
|
|
582
|
+
float age = uTime - r.z;
|
|
583
|
+
if (r.w <= 0.0 || age < 0.0 || age > 2.4) continue;
|
|
584
|
+
vec2 dv = pos - r.xy;
|
|
585
|
+
float dist = length(dv);
|
|
586
|
+
float w = 14.0 + age * 26.0;
|
|
587
|
+
float k = exp(-pow((dist - age * uRippleSpeed) / w, 2.0)) * (1.0 - age / 2.4) * r.w;
|
|
588
|
+
ring += k;
|
|
589
|
+
p += dv / max(dist, 1.0) * k * 0.12;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
float t = uTime * uDrift;
|
|
593
|
+
vec2 q = vec2(fbm(p + vec2(0.0, t * 0.7)), fbm(p + vec2(5.2, 1.3) - t * 0.5));
|
|
594
|
+
float n = fbm(p + uWarp * q + vec2(t * 0.4, -t * 0.25));
|
|
595
|
+
|
|
596
|
+
vec2 dir = vec2(cos(uBandAngle), sin(uBandAngle));
|
|
597
|
+
float along = dot(uv, dir);
|
|
598
|
+
float across = dot(uv, vec2(-dir.y, dir.x)) - uBandOffset - 0.22 * sin(along * 2.3 + t * 3.0) - (q.x - 0.5) * 0.35;
|
|
599
|
+
float river = exp(-across * across / (uBandWidth * uBandWidth));
|
|
600
|
+
|
|
601
|
+
float raw = n + river * uBand * 0.5 + (uDensity - 0.5) * 0.5;
|
|
602
|
+
float d = smoothstep(uThreshold, uThreshold + uSoftness, raw);
|
|
603
|
+
d = clamp(d + lamp * uLens * 0.45 + ring * 0.55, 0.0, 1.0);
|
|
604
|
+
|
|
605
|
+
for (int i = 0; i < ${V}; i++) {
|
|
606
|
+
if (i >= uSparkCount) break;
|
|
607
|
+
vec4 s = uSpark[i];
|
|
608
|
+
vec4 b = uSparkB[i];
|
|
609
|
+
float grow = smoothstep(0.0, 0.6, uTime - s.w);
|
|
610
|
+
float dist = length(pos - s.xy - shift(1.2));
|
|
611
|
+
d += exp(-dist / max(b.w * 2.2 * (1.0 + b.z * 0.6), 1.0)) * 0.55 * grow;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
float hz = smoothstep(0.25, 0.75, n + river * 0.25) * uHaze;
|
|
615
|
+
float tone = fbm(p * 0.45 + vec2(11.0, -3.0) + t * 0.2);
|
|
616
|
+
return vec3(clamp(d, 0.0, 1.0), hz, tone);
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
void main(){
|
|
620
|
+
vec2 resCss = uRes / uDpr;
|
|
621
|
+
vec2 css = gl_FragCoord.xy / uDpr;
|
|
622
|
+
float px = max(uPixel, 1.0);
|
|
623
|
+
vec2 cell = floor(css / px);
|
|
624
|
+
vec2 cellC = (cell + 0.5) * px;
|
|
625
|
+
vec2 f = fract(css / px) - 0.5;
|
|
626
|
+
float L = max(uLevels, 2.0);
|
|
627
|
+
float dith = bayer4(cell);
|
|
628
|
+
|
|
629
|
+
// ---- the gas, printed as a halftone ---------------------------------------
|
|
630
|
+
vec3 g = field(cellC, resCss);
|
|
631
|
+
vec3 hazeCol = mix(uHazeColor, uDuskColor, smoothstep(0.38, 0.62, g.z));
|
|
632
|
+
float dq = clamp(floor(g.x * L + dith) / L, 0.0, 1.0);
|
|
633
|
+
float hq = floor(g.y * 3.0 + dith) / 3.0;
|
|
634
|
+
vec3 bg = mix(uVoidColor, hazeCol, hq * 0.7);
|
|
635
|
+
bg = mix(bg, ramp(dq * 0.7, hazeCol) * 0.42, smoothstep(0.0, 0.3, dq));
|
|
636
|
+
float r = mix(uDotMin, uDotMax, sqrt(dq));
|
|
637
|
+
float dotMask = step(length(f), r);
|
|
638
|
+
vec3 dotCol = dq < 0.01 ? mix(uVoidColor, hazeCol, 0.35 + hq * 0.5) : ramp(min(dq + 0.1, 1.0), hazeCol);
|
|
639
|
+
vec3 col = mix(bg, dotCol, dotMask);
|
|
640
|
+
|
|
641
|
+
// ---- pixel stars, three parallax depths ------------------------------------
|
|
642
|
+
vec3 starAcc = vec3(0.0);
|
|
643
|
+
float starA = 0.0;
|
|
644
|
+
for (int l = 0; l < 3; l++) {
|
|
645
|
+
float fl = float(l);
|
|
646
|
+
float depth = 0.3 + fl * 0.4;
|
|
647
|
+
float gpx = px * (l == 2 ? 2.0 : 1.0);
|
|
648
|
+
vec2 sp = css + shift(depth) + vec2(0.0, floor(uTime * uStarDrift * depth));
|
|
649
|
+
vec2 id = floor(sp / gpx);
|
|
650
|
+
vec2 fr = fract(sp / gpx) - 0.5;
|
|
651
|
+
float prob = uStars * (l == 0 ? 0.009 : l == 1 ? 0.014 : 0.01);
|
|
652
|
+
float h = hash12(id + fl * 71.3);
|
|
653
|
+
if (h > 1.0 - prob) {
|
|
654
|
+
float h2 = hash12(id * 1.7 + 3.1 + fl);
|
|
655
|
+
float tw = 0.45 + 0.55 * (0.5 + 0.5 * sin(uTime * uTwinkle * (0.6 + h2 * 2.5) + h2 * 40.0));
|
|
656
|
+
float rad = l == 2 ? 0.42 : 0.26 + h2 * 0.22;
|
|
657
|
+
float m = step(length(fr), rad);
|
|
658
|
+
vec3 c = (l == 0 || h2 > 0.82) ? uStarColor : uHotColor;
|
|
659
|
+
starAcc = max(starAcc, c * m * tw);
|
|
660
|
+
starA = max(starA, m * tw);
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
col = mix(col, starAcc / max(starA, 1e-3), starA * (1.0 - g.x * 0.55));
|
|
664
|
+
|
|
665
|
+
// ---- the planet, same halftone, lit from the upper left --------------------
|
|
666
|
+
if (uPlanet.w > 0.5) {
|
|
667
|
+
vec2 pc = uPlanet.xy + shift(0.8);
|
|
668
|
+
float R = uPlanet.z;
|
|
669
|
+
vec2 dc = cellC - pc;
|
|
670
|
+
if (length(dc) < R) {
|
|
671
|
+
vec2 n2 = dc / R;
|
|
672
|
+
float z = sqrt(max(1.0 - dot(n2, n2), 0.0));
|
|
673
|
+
float lit = clamp(dot(vec3(n2, z), normalize(vec3(-0.45, 0.55, 0.7))), 0.0, 1.0);
|
|
674
|
+
float surf = fbm(vec2(n2.x * 1.4 + uTime * 0.015, n2.y * 4.2) * 1.6 + 9.0);
|
|
675
|
+
float pd = clamp(lit * 1.05 - smoothstep(0.55, 0.75, surf) * 0.45 * (1.0 - lit * 0.5) + 0.05, 0.0, 1.0);
|
|
676
|
+
float pq = floor(pd * L + dith) / L;
|
|
677
|
+
vec3 pbg = mix(mix(uVoidColor, uWineColor, 0.35), uWineColor, pq);
|
|
678
|
+
float pr = mix(0.2, 0.62, sqrt(pq));
|
|
679
|
+
vec3 pdot = ramp(min(pq * 0.85 + 0.25, 1.0), hazeCol);
|
|
680
|
+
col = mix(pbg, pdot, step(length(f), pr));
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
// ---- sparkle stars: chunky core, needle spikes -----------------------------
|
|
685
|
+
vec2 sh = shift(1.2);
|
|
686
|
+
for (int i = 0; i < ${V}; i++) {
|
|
687
|
+
if (i >= uSparkCount) break;
|
|
688
|
+
vec4 s = uSpark[i];
|
|
689
|
+
vec4 b = uSparkB[i];
|
|
690
|
+
float age = uTime - s.w;
|
|
691
|
+
if (age < 0.0) continue;
|
|
692
|
+
float grow = smoothstep(0.0, 0.55, age) * (1.0 + 0.3 * exp(-age * 3.0) * sin(age * 13.0));
|
|
693
|
+
float tw = 0.84 + 0.16 * sin(uTime * uTwinkle * 1.7 + b.y);
|
|
694
|
+
float flare = 1.0 + b.z * 0.6;
|
|
695
|
+
float reach = s.z * grow * tw * flare;
|
|
696
|
+
float core = b.w * grow * flare;
|
|
697
|
+
vec3 tint = mix(uHotColor, uStarColor, b.x);
|
|
698
|
+
vec2 c = s.xy + sh;
|
|
699
|
+
vec2 d = css - c;
|
|
700
|
+
float th = uSpikeWidth * 0.5 + 0.25;
|
|
701
|
+
float hx = step(abs(d.y), th) * pow(max(1.0 - abs(d.x) / max(reach, 1.0), 0.0), 1.1);
|
|
702
|
+
float vy = step(abs(d.x), th) * pow(max(1.0 - abs(d.y) / max(reach, 1.0), 0.0), 1.1);
|
|
703
|
+
// A short second pair of spikes, turned 45deg, only on the big ones.
|
|
704
|
+
vec2 rd = vec2(d.x + d.y, d.x - d.y) * 0.7071;
|
|
705
|
+
float diag = step(0.5, core / px - 1.5) * 0.45 * max(
|
|
706
|
+
step(abs(rd.y), th) * pow(max(1.0 - abs(rd.x) / max(reach * 0.22, 1.0), 0.0), 2.0),
|
|
707
|
+
step(abs(rd.x), th) * pow(max(1.0 - abs(rd.y) / max(reach * 0.22, 1.0), 0.0), 2.0));
|
|
708
|
+
col = mix(col, tint, clamp(max(max(hx, vy), diag), 0.0, 1.0));
|
|
709
|
+
// The core snaps to the cell grid, so it reads as a pixel-art disc.
|
|
710
|
+
float hp = px * 0.5;
|
|
711
|
+
vec2 dcell = (floor(css / hp) + 0.5) * hp - (floor(c / hp) + 0.5) * hp;
|
|
712
|
+
float disc = step(length(dcell), core);
|
|
713
|
+
float glow = exp(-length(d) / max(core * 1.4, 1.0)) * (1.0 - disc);
|
|
714
|
+
col += tint * glow * 0.35;
|
|
715
|
+
col = mix(col, tint, disc);
|
|
716
|
+
float cross = max(step(abs(d.y), th) * step(abs(d.x), core * 0.85),
|
|
717
|
+
step(abs(d.x), th) * step(abs(d.y), core * 0.85));
|
|
718
|
+
col = mix(col, uStarColor, cross * disc * 0.9);
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
// ---- post -----------------------------------------------------------------
|
|
722
|
+
vec2 vu = gl_FragCoord.xy / uRes - 0.5;
|
|
723
|
+
col *= 1.0 - uVignette * smoothstep(0.35, 0.95, length(vu * vec2(uRes.x / uRes.y, 1.0) * 1.1));
|
|
724
|
+
col += (hash12(floor(css) + fract(uTime) * 91.0) - 0.5) * uGrain;
|
|
725
|
+
frag = vec4(max(col, vec3(0.0)), 1.0);
|
|
726
|
+
}`;
|
|
727
|
+
function G(e) {
|
|
728
|
+
let t = e >>> 0;
|
|
729
|
+
return () => {
|
|
730
|
+
t = t + 1831565813 >>> 0;
|
|
731
|
+
let e = t;
|
|
732
|
+
return e = Math.imul(e ^ e >>> 15, e | 1), e ^= e + Math.imul(e ^ e >>> 7, e | 61), ((e ^ e >>> 14) >>> 0) / 4294967296;
|
|
733
|
+
};
|
|
734
|
+
}
|
|
735
|
+
function ce(e, t) {
|
|
736
|
+
let n = G(e), r = [], i = Math.max(0, Math.min(Math.floor(t), V));
|
|
737
|
+
for (let e = 0; e < i; e++) {
|
|
738
|
+
let t = e === 0, i = e === 1, a = .5, o = .5;
|
|
739
|
+
for (let e = 0; e < 40 && (a = .08 + .84 * n(), o = t ? .58 + .28 * n() : .08 + .84 * n(), !r.every((e) => Math.hypot(e.x - a, e.y - o) > (t ? .2 : .13))); e++);
|
|
740
|
+
r.push({
|
|
741
|
+
x: a,
|
|
742
|
+
y: o,
|
|
743
|
+
reach: t ? .2 + .05 * n() : i ? .08 + .03 * n() : .025 + .055 * n(),
|
|
744
|
+
core: t ? .024 : i ? .011 : .004 + .006 * n(),
|
|
745
|
+
tint: +!!i,
|
|
746
|
+
phase: n() * 6.283,
|
|
747
|
+
born: -10,
|
|
748
|
+
user: !1
|
|
749
|
+
});
|
|
750
|
+
}
|
|
751
|
+
return r;
|
|
752
|
+
}
|
|
753
|
+
function le(e, t, n = V) {
|
|
754
|
+
if (e.length < n) return [...e, t];
|
|
755
|
+
let r = e.findIndex((e) => e.user);
|
|
756
|
+
return r === -1 ? e : [
|
|
757
|
+
...e.slice(0, r),
|
|
758
|
+
...e.slice(r + 1),
|
|
759
|
+
t
|
|
760
|
+
];
|
|
761
|
+
}
|
|
762
|
+
function ue(e) {
|
|
763
|
+
let t = .5 + .32 * Math.sin(e * .21) + .1 * Math.sin(e * .077 + 1.3), n = .5 + .26 * Math.cos(e * .17) + .12 * Math.cos(e * .053 + 4.2);
|
|
764
|
+
return [Math.min(Math.max(t, .05), .95), Math.min(Math.max(n, .05), .95)];
|
|
765
|
+
}
|
|
766
|
+
function K({ height: e, preset: a = "brand", params: o, interactive: s = !0, touch: c = "scroll", maxDpr: l = 2, children: u, className: d, style: f, ...p }) {
|
|
767
|
+
let m = n.useRef(null), h = n.useRef(null), g = n.useRef(null), [_, v] = n.useState(!1), [y, ee] = n.useState(0), [b, x] = n.useState(!1);
|
|
768
|
+
n.useEffect(() => {
|
|
769
|
+
let e = window.matchMedia("(prefers-reduced-motion: reduce)"), t = () => x(e.matches);
|
|
770
|
+
return t(), e.addEventListener("change", t), () => e.removeEventListener("change", t);
|
|
771
|
+
}, []);
|
|
772
|
+
let S = n.useMemo(() => ({
|
|
773
|
+
...z,
|
|
774
|
+
...B[a] ?? {},
|
|
775
|
+
...o ?? {}
|
|
776
|
+
}), [a, o]), C = n.useRef(S);
|
|
777
|
+
return n.useLayoutEffect(() => {
|
|
778
|
+
C.current = S;
|
|
779
|
+
}, [S]), n.useEffect(() => {
|
|
780
|
+
let e = m.current, t = h.current, n = g.current;
|
|
781
|
+
if (!e || !t || !n) return;
|
|
782
|
+
let r = t.getContext("webgl2", {
|
|
783
|
+
antialias: !1,
|
|
784
|
+
alpha: !1,
|
|
785
|
+
depth: !1,
|
|
786
|
+
powerPreference: "high-performance"
|
|
787
|
+
});
|
|
788
|
+
if (!r) {
|
|
789
|
+
v(!0);
|
|
790
|
+
return;
|
|
791
|
+
}
|
|
792
|
+
let i = (e, t) => {
|
|
793
|
+
let n = r.createShader(e);
|
|
794
|
+
return n ? (r.shaderSource(n, t), r.compileShader(n), r.getShaderParameter(n, r.COMPILE_STATUS) ? n : (console.error("halftone-nebula:", r.getShaderInfoLog(n)), r.deleteShader(n), null)) : null;
|
|
795
|
+
}, a = i(r.VERTEX_SHADER, oe), o = i(r.FRAGMENT_SHADER, se), c = a && o ? r.createProgram() : null;
|
|
796
|
+
if (!c || !a || !o) {
|
|
797
|
+
v(!0);
|
|
798
|
+
return;
|
|
799
|
+
}
|
|
800
|
+
if (r.attachShader(c, a), r.attachShader(c, o), r.linkProgram(c), r.deleteShader(a), r.deleteShader(o), !r.getProgramParameter(c, r.LINK_STATUS)) {
|
|
801
|
+
console.error("halftone-nebula:", r.getProgramInfoLog(c)), r.deleteProgram(c), v(!0);
|
|
802
|
+
return;
|
|
803
|
+
}
|
|
804
|
+
let u = /* @__PURE__ */ new Map(), d = (e) => {
|
|
805
|
+
let t = u.get(e);
|
|
806
|
+
return t || (t = re(n, e), u.set(e, t)), t;
|
|
807
|
+
}, f = (e) => r.getUniformLocation(c, e), p = ie.map(([e, t]) => [
|
|
808
|
+
f(ae(e)),
|
|
809
|
+
e,
|
|
810
|
+
t
|
|
811
|
+
]), _ = {
|
|
812
|
+
res: f("uRes"),
|
|
813
|
+
dpr: f("uDpr"),
|
|
814
|
+
time: f("uTime"),
|
|
815
|
+
pointer: f("uPointer"),
|
|
816
|
+
pointerOn: f("uPointerOn"),
|
|
817
|
+
look: f("uLook"),
|
|
818
|
+
sparkCount: f("uSparkCount"),
|
|
819
|
+
spark: f("uSpark"),
|
|
820
|
+
sparkB: f("uSparkB"),
|
|
821
|
+
ripple: f("uRipple"),
|
|
822
|
+
planet: f("uPlanet")
|
|
823
|
+
}, y = r.createVertexArray(), x = 1, S = 1, w = 1, T = () => {
|
|
824
|
+
w = Math.min(window.devicePixelRatio || 1, Math.max(l, .5)), x = Math.max(t.clientWidth, 1), S = Math.max(t.clientHeight, 1);
|
|
825
|
+
let e = Math.floor(x * w), n = Math.floor(S * w);
|
|
826
|
+
(t.width !== e || t.height !== n) && (t.width = e, t.height = n), b && X();
|
|
827
|
+
}, E = ce(C.current.seed, C.current.sparkles), te = C.current.seed + ":" + C.current.sparkles, D = new Float32Array(V), O = /* @__PURE__ */ new Float32Array(64), k = /* @__PURE__ */ new Float32Array(64), A = /* @__PURE__ */ new Float32Array(16), j = 0, ne = performance.now(), M = () => b ? 14 : (performance.now() - ne) / 1e3 * C.current.speed, N = 0, P = .5, F = .5, I = .5, L = .5, R = 0, z = 0, B = 0, U = !1, W = -1e9, G = (e) => {
|
|
828
|
+
let n = t.getBoundingClientRect();
|
|
829
|
+
return [Math.min(Math.max((e.clientX - n.left) / Math.max(n.width, 1), 0), 1), Math.min(Math.max(1 - (e.clientY - n.top) / Math.max(n.height, 1), 0), 1)];
|
|
830
|
+
}, K = (e) => {
|
|
831
|
+
s && ([P, F] = G(e), U = !0, W = performance.now() / 1e3);
|
|
832
|
+
}, q = () => {
|
|
833
|
+
U = !1;
|
|
834
|
+
}, J = (e) => {
|
|
835
|
+
if (!s || e.button > 0 || e.target?.closest("a,button,input,textarea,select,label,[role=button]")) return;
|
|
836
|
+
let [t, n] = G(e);
|
|
837
|
+
P = t, F = n, U = !0, W = performance.now() / 1e3;
|
|
838
|
+
let r = M(), i = Math.random();
|
|
839
|
+
E = le(E, {
|
|
840
|
+
x: t,
|
|
841
|
+
y: n,
|
|
842
|
+
reach: .045 + .08 * i,
|
|
843
|
+
core: .006 + .008 * i,
|
|
844
|
+
tint: +(Math.random() < .2),
|
|
845
|
+
phase: Math.random() * 6.283,
|
|
846
|
+
born: b ? r - 10 : r,
|
|
847
|
+
user: !0
|
|
848
|
+
}), A.set([
|
|
849
|
+
t * x,
|
|
850
|
+
n * S,
|
|
851
|
+
r,
|
|
852
|
+
+!b
|
|
853
|
+
], j * 4), j = (j + 1) % H, b && X();
|
|
854
|
+
};
|
|
855
|
+
e.addEventListener("pointermove", K), e.addEventListener("pointerdown", J), e.addEventListener("pointerleave", q), e.addEventListener("pointercancel", q);
|
|
856
|
+
let Y = (e) => {
|
|
857
|
+
e.preventDefault(), cancelAnimationFrame(Z), Z = 0;
|
|
858
|
+
}, de = () => ee((e) => e + 1);
|
|
859
|
+
t.addEventListener("webglcontextlost", Y), t.addEventListener("webglcontextrestored", de);
|
|
860
|
+
let X = () => {
|
|
861
|
+
let e = C.current, n = e.seed + ":" + e.sparkles;
|
|
862
|
+
n !== te && (E = [...ce(e.seed, e.sparkles), ...E.filter((e) => e.user)].slice(0, V), te = n);
|
|
863
|
+
let i = M(), a = Math.min(Math.max(i - N, 0), .1);
|
|
864
|
+
N = i;
|
|
865
|
+
let o = !U || performance.now() / 1e3 - W > 6, [l, u] = ue(i * .6), f = o ? l : P, m = o ? u : F, h = b ? 1 : 1 - Math.exp(-a * (o ? 1.5 : 7));
|
|
866
|
+
I += (f - I) * h, L += (m - L) * h, R += ((f - .5) * 2 - R) * h, z += ((m - .5) * 2 - z) * h, B += ((s && !b ? o ? .55 : 1 : 0) - B) * (b ? 1 : 1 - Math.exp(-a * 3));
|
|
867
|
+
let g = Math.min(x, S), v = Math.min(E.length, V);
|
|
868
|
+
for (let e = 0; e < v; e++) {
|
|
869
|
+
let t = E[e], n = t.reach * g, r = Math.hypot(t.x * x - I * x, t.y * S - L * S), i = s && !b ? Math.exp(-(r * r) / Math.max(n * n * .6, 400)) : 0;
|
|
870
|
+
D[e] += (i - D[e]) * (b ? 1 : 1 - Math.exp(-a * 6)), O.set([
|
|
871
|
+
t.x * x,
|
|
872
|
+
t.y * S,
|
|
873
|
+
n,
|
|
874
|
+
t.born
|
|
875
|
+
], e * 4), k.set([
|
|
876
|
+
t.tint,
|
|
877
|
+
t.phase,
|
|
878
|
+
D[e],
|
|
879
|
+
Math.max(t.core * g, 1.5)
|
|
880
|
+
], e * 4);
|
|
881
|
+
}
|
|
882
|
+
r.useProgram(c), r.bindVertexArray(y), r.bindFramebuffer(r.FRAMEBUFFER, null), r.viewport(0, 0, t.width, t.height);
|
|
883
|
+
for (let [t, n, i] of p) {
|
|
884
|
+
let a = e[n];
|
|
885
|
+
i === "c" ? r.uniform3fv(t, d(a)) : i === "i" || i === "b" ? r.uniform1i(t, Number(a) | 0) : r.uniform1f(t, a);
|
|
886
|
+
}
|
|
887
|
+
r.uniform2f(_.res, t.width, t.height), r.uniform1f(_.dpr, t.width / x), r.uniform1f(_.time, i), r.uniform2f(_.pointer, I * x, L * S), r.uniform1f(_.pointerOn, B), r.uniform2f(_.look, R, z), r.uniform1i(_.sparkCount, v), r.uniform4fv(_.spark, O), r.uniform4fv(_.sparkB, k), r.uniform4fv(_.ripple, A), r.uniform4f(_.planet, e.planetX * x, e.planetY * S, e.planetRadius * g, +!!e.planet), r.drawArrays(r.TRIANGLES, 0, 3);
|
|
888
|
+
}, Z = 0, Q = !0, fe = () => {
|
|
889
|
+
Z = 0, X(), Q && !document.hidden && (Z = requestAnimationFrame(fe));
|
|
890
|
+
}, $ = () => {
|
|
891
|
+
!b && !Z && Q && !document.hidden && (Z = requestAnimationFrame(fe));
|
|
892
|
+
}, pe = new IntersectionObserver((e) => {
|
|
893
|
+
Q = e.some((e) => e.isIntersecting), $();
|
|
894
|
+
});
|
|
895
|
+
pe.observe(e), document.addEventListener("visibilitychange", $), T();
|
|
896
|
+
let me = new ResizeObserver(T);
|
|
897
|
+
return me.observe(t), X(), b || $(), () => {
|
|
898
|
+
cancelAnimationFrame(Z), me.disconnect(), pe.disconnect(), document.removeEventListener("visibilitychange", $), e.removeEventListener("pointermove", K), e.removeEventListener("pointerdown", J), e.removeEventListener("pointerleave", q), e.removeEventListener("pointercancel", q), t.removeEventListener("webglcontextlost", Y), t.removeEventListener("webglcontextrestored", de), r.deleteVertexArray(y), r.deleteProgram(c);
|
|
899
|
+
};
|
|
900
|
+
}, [
|
|
901
|
+
s,
|
|
902
|
+
b,
|
|
903
|
+
y,
|
|
904
|
+
l
|
|
905
|
+
]), /* @__PURE__ */ i("section", {
|
|
906
|
+
ref: m,
|
|
907
|
+
"data-slot": "halftone-nebula",
|
|
908
|
+
className: t("relative w-full overflow-hidden", s && "cursor-crosshair", c === "draw" ? "touch-none" : "touch-pan-y", d),
|
|
909
|
+
style: {
|
|
910
|
+
height: e,
|
|
911
|
+
background: S.voidColor,
|
|
912
|
+
...f
|
|
913
|
+
},
|
|
914
|
+
...p,
|
|
915
|
+
children: [
|
|
916
|
+
/* @__PURE__ */ r("span", {
|
|
917
|
+
ref: g,
|
|
918
|
+
className: "dark",
|
|
919
|
+
hidden: !0
|
|
920
|
+
}),
|
|
921
|
+
_ ? /* @__PURE__ */ r("div", {
|
|
922
|
+
className: "dark absolute inset-0",
|
|
923
|
+
style: { background: `radial-gradient(60% 45% at 12% 88%, ${S.hotColor} 0%, ${S.crimsonColor} 22%, ${S.wineColor} 50%, transparent 75%),radial-gradient(45% 30% at 22% 22%, ${S.wineColor} 0%, transparent 70%),radial-gradient(40% 30% at 80% 30%, ${S.duskColor} 0%, transparent 70%),` + S.voidColor }
|
|
924
|
+
}) : /* @__PURE__ */ r("canvas", {
|
|
925
|
+
ref: h,
|
|
926
|
+
"aria-hidden": "true",
|
|
927
|
+
className: "absolute inset-0 block h-full w-full"
|
|
928
|
+
}),
|
|
929
|
+
u ? /* @__PURE__ */ r("div", {
|
|
930
|
+
className: "pointer-events-none relative z-10 flex h-full w-full flex-col",
|
|
931
|
+
children: u
|
|
932
|
+
}) : null
|
|
933
|
+
]
|
|
934
|
+
});
|
|
935
|
+
}
|
|
936
|
+
//#endregion
|
|
937
|
+
//#region src/components/hero/hero.tsx
|
|
938
|
+
var q = {
|
|
939
|
+
planetX: .8,
|
|
940
|
+
planetY: .72
|
|
941
|
+
};
|
|
942
|
+
function J({ title: e, description: n, eyebrow: a, background: o = "mesh", children: s, className: c, ...l }) {
|
|
943
|
+
let u = t("dark relative isolate overflow-hidden border-2 border-border text-foreground", c), d = /* @__PURE__ */ i("div", {
|
|
944
|
+
className: "flex min-h-[28rem] flex-col items-start justify-center gap-6 px-6 py-16 md:px-12 md:py-24",
|
|
945
|
+
children: [
|
|
946
|
+
a,
|
|
947
|
+
/* @__PURE__ */ r("h1", {
|
|
948
|
+
className: "max-w-3xl font-heading text-4xl font-bold tracking-tight md:text-6xl",
|
|
949
|
+
children: e
|
|
950
|
+
}),
|
|
951
|
+
n && /* @__PURE__ */ r("p", {
|
|
952
|
+
className: "max-w-xl text-base text-foreground/85 md:text-lg",
|
|
953
|
+
children: n
|
|
954
|
+
}),
|
|
955
|
+
s && /* @__PURE__ */ r("div", {
|
|
956
|
+
className: "pointer-events-auto flex flex-wrap gap-3",
|
|
957
|
+
children: s
|
|
958
|
+
})
|
|
959
|
+
]
|
|
960
|
+
});
|
|
961
|
+
return o === "nebula" ? /* @__PURE__ */ i(K, {
|
|
962
|
+
"data-slot": "hero",
|
|
963
|
+
params: q,
|
|
964
|
+
className: u,
|
|
965
|
+
...l,
|
|
966
|
+
children: [/* @__PURE__ */ r("div", { className: "absolute inset-0 bg-linear-to-r from-(--shader-1)/90 via-(--shader-1)/50 to-transparent" }), /* @__PURE__ */ r("div", {
|
|
967
|
+
className: "relative",
|
|
968
|
+
children: d
|
|
969
|
+
})]
|
|
970
|
+
}) : /* @__PURE__ */ i("section", {
|
|
971
|
+
"data-slot": "hero",
|
|
972
|
+
className: u,
|
|
973
|
+
...l,
|
|
974
|
+
children: [/* @__PURE__ */ r(R, {}), d]
|
|
975
|
+
});
|
|
976
|
+
}
|
|
977
|
+
//#endregion
|
|
978
|
+
//#region src/components/ui/input.tsx
|
|
979
|
+
function Y({ className: e, type: n, ...i }) {
|
|
980
|
+
return /* @__PURE__ */ r("input", {
|
|
981
|
+
type: n,
|
|
982
|
+
"data-slot": "input",
|
|
983
|
+
className: t("h-8 w-full min-w-0 rounded-lg border-2 border-border bg-input shadow-xs px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40", e),
|
|
984
|
+
...i
|
|
985
|
+
});
|
|
986
|
+
}
|
|
987
|
+
//#endregion
|
|
988
|
+
//#region src/components/ui/label.tsx
|
|
989
|
+
function de({ className: e, ...n }) {
|
|
990
|
+
return /* @__PURE__ */ r(s.Root, {
|
|
991
|
+
"data-slot": "label",
|
|
992
|
+
className: t("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50", e),
|
|
993
|
+
...n
|
|
994
|
+
});
|
|
995
|
+
}
|
|
996
|
+
//#endregion
|
|
997
|
+
//#region src/components/ui/tabs.tsx
|
|
998
|
+
function X({ className: e, orientation: n = "horizontal", ...i }) {
|
|
999
|
+
return /* @__PURE__ */ r(l.Root, {
|
|
1000
|
+
"data-slot": "tabs",
|
|
1001
|
+
"data-orientation": n,
|
|
1002
|
+
className: t("group/tabs flex gap-2 data-horizontal:flex-col", e),
|
|
1003
|
+
...i
|
|
1004
|
+
});
|
|
1005
|
+
}
|
|
1006
|
+
var Z = a("group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-9 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none", {
|
|
1007
|
+
variants: { variant: {
|
|
1008
|
+
default: "border-2 border-border bg-muted",
|
|
1009
|
+
line: "gap-1 bg-transparent"
|
|
1010
|
+
} },
|
|
1011
|
+
defaultVariants: { variant: "default" }
|
|
1012
|
+
});
|
|
1013
|
+
function Q({ className: e, variant: n = "default", ...i }) {
|
|
1014
|
+
return /* @__PURE__ */ r(l.List, {
|
|
1015
|
+
"data-slot": "tabs-list",
|
|
1016
|
+
"data-variant": n,
|
|
1017
|
+
className: t(Z({ variant: n }), e),
|
|
1018
|
+
...i
|
|
1019
|
+
});
|
|
1020
|
+
}
|
|
1021
|
+
function fe({ className: e, ...n }) {
|
|
1022
|
+
return /* @__PURE__ */ r(l.Trigger, {
|
|
1023
|
+
"data-slot": "tabs-trigger",
|
|
1024
|
+
className: t("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-semibold whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", "group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent", "group-data-[variant=default]/tabs-list:data-active:bg-primary group-data-[variant=default]/tabs-list:data-active:text-primary-foreground data-active:text-foreground", "after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100", e),
|
|
1025
|
+
...n
|
|
1026
|
+
});
|
|
1027
|
+
}
|
|
1028
|
+
function $({ className: e, ...n }) {
|
|
1029
|
+
return /* @__PURE__ */ r(l.Content, {
|
|
1030
|
+
"data-slot": "tabs-content",
|
|
1031
|
+
className: t("flex-1 text-sm outline-none", e),
|
|
1032
|
+
...n
|
|
1033
|
+
});
|
|
1034
|
+
}
|
|
1035
|
+
//#endregion
|
|
1036
|
+
//#region src/components/ui/tooltip.tsx
|
|
1037
|
+
function pe({ delayDuration: e = 0, ...t }) {
|
|
1038
|
+
return /* @__PURE__ */ r(u.Provider, {
|
|
1039
|
+
"data-slot": "tooltip-provider",
|
|
1040
|
+
delayDuration: e,
|
|
1041
|
+
...t
|
|
1042
|
+
});
|
|
1043
|
+
}
|
|
1044
|
+
function me({ ...e }) {
|
|
1045
|
+
return /* @__PURE__ */ r(u.Root, {
|
|
1046
|
+
"data-slot": "tooltip",
|
|
1047
|
+
...e
|
|
1048
|
+
});
|
|
1049
|
+
}
|
|
1050
|
+
function he({ ...e }) {
|
|
1051
|
+
return /* @__PURE__ */ r(u.Trigger, {
|
|
1052
|
+
"data-slot": "tooltip-trigger",
|
|
1053
|
+
...e
|
|
1054
|
+
});
|
|
1055
|
+
}
|
|
1056
|
+
function ge({ className: e, sideOffset: n = 0, children: a, ...o }) {
|
|
1057
|
+
return /* @__PURE__ */ r(u.Portal, { children: /* @__PURE__ */ i(u.Content, {
|
|
1058
|
+
"data-slot": "tooltip-content",
|
|
1059
|
+
sideOffset: n,
|
|
1060
|
+
className: t("z-50 inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs font-medium text-background shadow-xs has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", e),
|
|
1061
|
+
...o,
|
|
1062
|
+
children: [a, /* @__PURE__ */ r(u.Arrow, { className: "z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground" })]
|
|
1063
|
+
}) });
|
|
1064
|
+
}
|
|
1065
|
+
//#endregion
|
|
1066
|
+
export { f as AirStyle, m as Badge, _ as Button, v as Card, x as CardAction, S as CardContent, b as CardDescription, C as CardFooter, y as CardHeader, ee as CardTitle, w as Dialog, te as DialogClose, O as DialogContent, ne as DialogDescription, A as DialogFooter, k as DialogHeader, D as DialogOverlay, E as DialogPortal, j as DialogTitle, T as DialogTrigger, K as HalftoneNebula, J as Hero, Y as Input, de as Label, z as NEBULA_DEFAULTS, B as NEBULA_PRESETS, R as ShaderBackground, X as Tabs, $ as TabsContent, Q as TabsList, fe as TabsTrigger, me as Tooltip, ge as TooltipContent, pe as TooltipProvider, he as TooltipTrigger, p as badgeVariants, g as buttonVariants, e as cn, Z as tabsListVariants };
|