@la-batcave/ui 3.1.2
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/README.md +95 -0
- package/dist/Alert.d.ts +27 -0
- package/dist/Alert.js +56 -0
- package/dist/Avatar.d.ts +20 -0
- package/dist/Avatar.js +40 -0
- package/dist/Badge.d.ts +56 -0
- package/dist/Badge.js +74 -0
- package/dist/Button.d.ts +53 -0
- package/dist/Button.js +66 -0
- package/dist/Card.d.ts +18 -0
- package/dist/Card.js +98 -0
- package/dist/CodeBlock.d.ts +45 -0
- package/dist/CodeBlock.js +306 -0
- package/dist/Collapse.d.ts +58 -0
- package/dist/Collapse.js +89 -0
- package/dist/Combobox.d.ts +44 -0
- package/dist/Combobox.js +409 -0
- package/dist/DarkMode.d.ts +59 -0
- package/dist/DarkMode.js +56 -0
- package/dist/DatePicker.d.ts +48 -0
- package/dist/DatePicker.js +2954 -0
- package/dist/Dialog.d.ts +119 -0
- package/dist/Dialog.js +337 -0
- package/dist/Drawer.d.ts +28 -0
- package/dist/Drawer.js +1126 -0
- package/dist/Dropdown.d.ts +23 -0
- package/dist/Dropdown.js +247 -0
- package/dist/EasyForm.d.ts +138 -0
- package/dist/EasyForm.js +286 -0
- package/dist/HoverCard.d.ts +10 -0
- package/dist/HoverCard.js +195 -0
- package/dist/Input.d.ts +230 -0
- package/dist/Input.js +2216 -0
- package/dist/LogViewer.d.ts +57 -0
- package/dist/LogViewer.js +120 -0
- package/dist/Menubar.d.ts +32 -0
- package/dist/Menubar.js +398 -0
- package/dist/Navbar.d.ts +20 -0
- package/dist/Navbar.js +31 -0
- package/dist/Pagination.d.ts +78 -0
- package/dist/Pagination.js +106 -0
- package/dist/Popover.d.ts +11 -0
- package/dist/Popover.js +28 -0
- package/dist/ProgressBar.d.ts +35 -0
- package/dist/ProgressBar.js +210 -0
- package/dist/Resizable.d.ts +23 -0
- package/dist/Resizable.js +1532 -0
- package/dist/Separator.d.ts +4 -0
- package/dist/Separator.js +46 -0
- package/dist/Sheet.d.ts +29 -0
- package/dist/Sheet.js +104 -0
- package/dist/Sidebar.d.ts +117 -0
- package/dist/Sidebar.js +237 -0
- package/dist/Skeleton.d.ts +57 -0
- package/dist/Skeleton.js +47 -0
- package/dist/Table.d.ts +71 -0
- package/dist/Table.js +94 -0
- package/dist/Tabs.d.ts +76 -0
- package/dist/Tabs.js +202 -0
- package/dist/Toast.d.ts +54 -0
- package/dist/Toast.js +827 -0
- package/dist/Tooltip.d.ts +29 -0
- package/dist/Tooltip.js +352 -0
- package/dist/Typography.d.ts +101 -0
- package/dist/Typography.js +123 -0
- package/dist/Widget.d.ts +133 -0
- package/dist/Widget.js +207 -0
- package/dist/_shared/Combination-D_l4PLF_.js +676 -0
- package/dist/_shared/index-B03TCNO5.js +142 -0
- package/dist/_shared/index-B1f-hyuh.js +31 -0
- package/dist/_shared/index-BC7vfx-u.js +13 -0
- package/dist/_shared/index-BrLJJgkl.js +67 -0
- package/dist/_shared/index-C0gNQvxa.js +269 -0
- package/dist/_shared/index-C3aZemLI.js +268 -0
- package/dist/_shared/index-CXeb1OMI.js +198 -0
- package/dist/_shared/index-CukUn3R0.js +626 -0
- package/dist/_shared/index-DLcqcWxM.js +29 -0
- package/dist/_shared/index-DlSuDb9N.js +283 -0
- package/dist/_shared/index-V-Ajw7Ac.js +79 -0
- package/dist/_shared/index-uPOYJZpG.js +34 -0
- package/dist/_shared/index-uu9PT5Nu.js +1588 -0
- package/dist/_shared/utils-eGXXUFl7.js +2935 -0
- package/dist/backgrounds/Aurora.d.ts +7 -0
- package/dist/backgrounds/Aurora.js +126 -0
- package/dist/backgrounds/Iridescence.d.ts +7 -0
- package/dist/backgrounds/Iridescence.js +77 -0
- package/dist/backgrounds/Lightning.d.ts +8 -0
- package/dist/backgrounds/Lightning.js +75 -0
- package/dist/backgrounds/LiquidChrome.d.ts +9 -0
- package/dist/backgrounds/LiquidChrome.js +89 -0
- package/dist/backgrounds/Particles.d.ts +15 -0
- package/dist/backgrounds/Particles.js +137 -0
- package/dist/backgrounds/PixelSnow.d.ts +9 -0
- package/dist/backgrounds/PixelSnow.js +52 -0
- package/dist/backgrounds/Silk.d.ts +8 -0
- package/dist/backgrounds/Silk.js +92 -0
- package/dist/backgrounds/Squares.d.ts +9 -0
- package/dist/backgrounds/Squares.js +75 -0
- package/dist/backgrounds/Threads.d.ts +7 -0
- package/dist/backgrounds/Threads.js +110 -0
- package/dist/backgrounds/Waves.d.ts +14 -0
- package/dist/backgrounds/Waves.js +139 -0
- package/dist/fonts/inter-latin-wght-normal.woff2 +0 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -0
- package/package.json +318 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as A } from "react/jsx-runtime";
|
|
3
|
+
import { useRef as C, useEffect as R } from "react";
|
|
4
|
+
import { Renderer as S, Triangle as B, Color as h, Program as z, Mesh as E } from "ogl";
|
|
5
|
+
const _ = `#version 300 es
|
|
6
|
+
in vec2 position;
|
|
7
|
+
void main() {
|
|
8
|
+
gl_Position = vec4(position, 0.0, 1.0);
|
|
9
|
+
}
|
|
10
|
+
`, b = `#version 300 es
|
|
11
|
+
precision highp float;
|
|
12
|
+
uniform float uTime;
|
|
13
|
+
uniform float uAmplitude;
|
|
14
|
+
uniform vec3 uColorStops[3];
|
|
15
|
+
uniform vec2 uResolution;
|
|
16
|
+
uniform float uBlend;
|
|
17
|
+
out vec4 fragColor;
|
|
18
|
+
vec3 permute(vec3 x) { return mod(((x * 34.0) + 1.0) * x, 289.0); }
|
|
19
|
+
float snoise(vec2 v){
|
|
20
|
+
const vec4 C = vec4(0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439);
|
|
21
|
+
vec2 i = floor(v + dot(v, C.yy));
|
|
22
|
+
vec2 x0 = v - i + dot(i, C.xx);
|
|
23
|
+
vec2 i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);
|
|
24
|
+
vec4 x12 = x0.xyxy + C.xxzz;
|
|
25
|
+
x12.xy -= i1;
|
|
26
|
+
i = mod(i, 289.0);
|
|
27
|
+
vec3 p = permute(permute(i.y + vec3(0.0, i1.y, 1.0)) + i.x + vec3(0.0, i1.x, 1.0));
|
|
28
|
+
vec3 m = max(0.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy), dot(x12.zw,x12.zw)), 0.0);
|
|
29
|
+
m = m * m; m = m * m;
|
|
30
|
+
vec3 x = 2.0 * fract(p * C.www) - 1.0;
|
|
31
|
+
vec3 h = abs(x) - 0.5;
|
|
32
|
+
vec3 ox = floor(x + 0.5);
|
|
33
|
+
vec3 a0 = x - ox;
|
|
34
|
+
m *= 1.79284291400159 - 0.85373472095314 * (a0*a0 + h*h);
|
|
35
|
+
vec3 g;
|
|
36
|
+
g.x = a0.x * x0.x + h.x * x0.y;
|
|
37
|
+
g.yz = a0.yz * x12.xz + h.yz * x12.yw;
|
|
38
|
+
return 130.0 * dot(m, g);
|
|
39
|
+
}
|
|
40
|
+
struct ColorStop { vec3 color; float position; };
|
|
41
|
+
#define COLOR_RAMP(colors, factor, finalColor) { \\
|
|
42
|
+
int index = 0; \\
|
|
43
|
+
for (int i = 0; i < 2; i++) { \\
|
|
44
|
+
ColorStop currentColor = colors[i]; \\
|
|
45
|
+
bool isInBetween = currentColor.position <= factor; \\
|
|
46
|
+
index = int(mix(float(index), float(i), float(isInBetween))); \\
|
|
47
|
+
} \\
|
|
48
|
+
ColorStop currentColor = colors[index]; \\
|
|
49
|
+
ColorStop nextColor = colors[index + 1]; \\
|
|
50
|
+
float range = nextColor.position - currentColor.position; \\
|
|
51
|
+
float lerpFactor = (factor - currentColor.position) / range; \\
|
|
52
|
+
finalColor = mix(currentColor.color, nextColor.color, lerpFactor); \\
|
|
53
|
+
}
|
|
54
|
+
void main() {
|
|
55
|
+
vec2 uv = gl_FragCoord.xy / uResolution;
|
|
56
|
+
ColorStop colors[3];
|
|
57
|
+
colors[0] = ColorStop(uColorStops[0], 0.0);
|
|
58
|
+
colors[1] = ColorStop(uColorStops[1], 0.5);
|
|
59
|
+
colors[2] = ColorStop(uColorStops[2], 1.0);
|
|
60
|
+
vec3 rampColor;
|
|
61
|
+
COLOR_RAMP(colors, uv.x, rampColor);
|
|
62
|
+
float height = snoise(vec2(uv.x * 2.0 + uTime * 0.1, uTime * 0.25)) * 0.5 * uAmplitude;
|
|
63
|
+
height = exp(height);
|
|
64
|
+
height = (uv.y * 2.0 - height + 0.2);
|
|
65
|
+
float intensity = 0.6 * height;
|
|
66
|
+
float midPoint = 0.20;
|
|
67
|
+
float auroraAlpha = smoothstep(midPoint - uBlend * 0.5, midPoint + uBlend * 0.5, intensity);
|
|
68
|
+
vec3 auroraColor = intensity * rampColor;
|
|
69
|
+
fragColor = vec4(auroraColor * auroraAlpha, auroraAlpha);
|
|
70
|
+
}
|
|
71
|
+
`;
|
|
72
|
+
function T({
|
|
73
|
+
colorStops: i = ["#E7BB1D", "#B8941A", "#E7BB1D"],
|
|
74
|
+
amplitude: l = 1,
|
|
75
|
+
blend: u = 0.5,
|
|
76
|
+
speed: f = 1
|
|
77
|
+
}) {
|
|
78
|
+
const x = C(null), p = C({ colorStops: i, amplitude: l, blend: u, speed: f });
|
|
79
|
+
return p.current = { colorStops: i, amplitude: l, blend: u, speed: f }, R(() => {
|
|
80
|
+
const r = x.current;
|
|
81
|
+
if (!r) return;
|
|
82
|
+
const a = new S({ alpha: !0, premultipliedAlpha: !0, antialias: !0 }), o = a.gl;
|
|
83
|
+
o.clearColor(0, 0, 0, 0), o.enable(o.BLEND), o.blendFunc(o.ONE, o.ONE_MINUS_SRC_ALPHA), o.canvas.style.backgroundColor = "transparent";
|
|
84
|
+
let t;
|
|
85
|
+
function s() {
|
|
86
|
+
if (!r) return;
|
|
87
|
+
const n = r.offsetWidth, e = r.offsetHeight;
|
|
88
|
+
a.setSize(n, e), t && (t.uniforms.uResolution.value = [n, e]);
|
|
89
|
+
}
|
|
90
|
+
window.addEventListener("resize", s);
|
|
91
|
+
const c = new B(o);
|
|
92
|
+
c.attributes.uv && delete c.attributes.uv;
|
|
93
|
+
const g = i.map((n) => {
|
|
94
|
+
const e = new h(n);
|
|
95
|
+
return [e.r, e.g, e.b];
|
|
96
|
+
});
|
|
97
|
+
t = new z(o, {
|
|
98
|
+
vertex: _,
|
|
99
|
+
fragment: b,
|
|
100
|
+
uniforms: {
|
|
101
|
+
uTime: { value: 0 },
|
|
102
|
+
uAmplitude: { value: l },
|
|
103
|
+
uColorStops: { value: g },
|
|
104
|
+
uResolution: { value: [r.offsetWidth, r.offsetHeight] },
|
|
105
|
+
uBlend: { value: u }
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
const y = new E(o, { geometry: c, program: t });
|
|
109
|
+
r.appendChild(o.canvas);
|
|
110
|
+
let m = 0;
|
|
111
|
+
const d = (n) => {
|
|
112
|
+
m = requestAnimationFrame(d);
|
|
113
|
+
const e = p.current;
|
|
114
|
+
t.uniforms.uTime.value = n * 0.01 * (e.speed ?? 1) * 0.1, t.uniforms.uAmplitude.value = e.amplitude ?? 1, t.uniforms.uBlend.value = e.blend ?? 0.5, t.uniforms.uColorStops.value = (e.colorStops ?? i).map((w) => {
|
|
115
|
+
const v = new h(w);
|
|
116
|
+
return [v.r, v.g, v.b];
|
|
117
|
+
}), a.render({ scene: y });
|
|
118
|
+
};
|
|
119
|
+
return m = requestAnimationFrame(d), s(), () => {
|
|
120
|
+
cancelAnimationFrame(m), window.removeEventListener("resize", s), r && o.canvas.parentNode === r && r.removeChild(o.canvas), o.getExtension("WEBGL_lose_context")?.loseContext();
|
|
121
|
+
};
|
|
122
|
+
}, [l]), /* @__PURE__ */ A("div", { ref: x, style: { width: "100%", height: "100%" } });
|
|
123
|
+
}
|
|
124
|
+
export {
|
|
125
|
+
T as default
|
|
126
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface IridescenceProps {
|
|
2
|
+
color?: [number, number, number];
|
|
3
|
+
speed?: number;
|
|
4
|
+
amplitude?: number;
|
|
5
|
+
mouseReact?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export default function Iridescence({ color, speed, amplitude, mouseReact }: IridescenceProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as C } from "react/jsx-runtime";
|
|
3
|
+
import { useRef as g, useEffect as R } from "react";
|
|
4
|
+
import { Renderer as A, Triangle as E, Program as M, Color as v, Mesh as S } from "ogl";
|
|
5
|
+
const T = `
|
|
6
|
+
attribute vec2 uv;
|
|
7
|
+
attribute vec2 position;
|
|
8
|
+
varying vec2 vUv;
|
|
9
|
+
void main() { vUv = uv; gl_Position = vec4(position, 0, 1); }
|
|
10
|
+
`, F = `
|
|
11
|
+
precision highp float;
|
|
12
|
+
uniform float uTime;
|
|
13
|
+
uniform vec3 uColor;
|
|
14
|
+
uniform vec3 uResolution;
|
|
15
|
+
uniform vec2 uMouse;
|
|
16
|
+
uniform float uAmplitude;
|
|
17
|
+
uniform float uSpeed;
|
|
18
|
+
varying vec2 vUv;
|
|
19
|
+
void main() {
|
|
20
|
+
float mr = min(uResolution.x, uResolution.y);
|
|
21
|
+
vec2 uv = (vUv.xy * 2.0 - 1.0) * uResolution.xy / mr;
|
|
22
|
+
uv += (uMouse - vec2(0.5)) * uAmplitude;
|
|
23
|
+
float d = -uTime * 0.5 * uSpeed;
|
|
24
|
+
float a = 0.0;
|
|
25
|
+
for (float i = 0.0; i < 8.0; ++i) {
|
|
26
|
+
a += cos(i - d - a * uv.x);
|
|
27
|
+
d += sin(uv.y * i + a);
|
|
28
|
+
}
|
|
29
|
+
d += uTime * 0.5 * uSpeed;
|
|
30
|
+
vec3 col = vec3(cos(uv * vec2(d, a)) * 0.6 + 0.4, cos(a + d) * 0.5 + 0.5);
|
|
31
|
+
col = cos(col * cos(vec3(d, a, 2.5)) * 0.5 + 0.5) * uColor;
|
|
32
|
+
gl_FragColor = vec4(col, 1.0);
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
35
|
+
function _({ color: c = [0.91, 0.73, 0.11], speed: l = 1, amplitude: m = 0.1, mouseReact: u = !0 }) {
|
|
36
|
+
const f = g(null);
|
|
37
|
+
return g({ x: 0.5, y: 0.5 }), R(() => {
|
|
38
|
+
const o = f.current;
|
|
39
|
+
if (!o) return;
|
|
40
|
+
const r = new A(), e = r.gl;
|
|
41
|
+
e.clearColor(0.11, 0.09, 0.09, 1);
|
|
42
|
+
let n;
|
|
43
|
+
function a() {
|
|
44
|
+
r.setSize(o.offsetWidth, o.offsetHeight), n && (n.uniforms.uResolution.value = new v(e.canvas.width, e.canvas.height, e.canvas.width / e.canvas.height));
|
|
45
|
+
}
|
|
46
|
+
window.addEventListener("resize", a), a();
|
|
47
|
+
const p = new E(e);
|
|
48
|
+
n = new M(e, {
|
|
49
|
+
vertex: T,
|
|
50
|
+
fragment: F,
|
|
51
|
+
uniforms: {
|
|
52
|
+
uTime: { value: 0 },
|
|
53
|
+
uColor: { value: new v(...c) },
|
|
54
|
+
uResolution: { value: new v(e.canvas.width, e.canvas.height, e.canvas.width / e.canvas.height) },
|
|
55
|
+
uMouse: { value: new Float32Array([0.5, 0.5]) },
|
|
56
|
+
uAmplitude: { value: m },
|
|
57
|
+
uSpeed: { value: l }
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
const w = new S(e, { geometry: p, program: n });
|
|
61
|
+
let s = 0;
|
|
62
|
+
const d = (t) => {
|
|
63
|
+
s = requestAnimationFrame(d), n.uniforms.uTime.value = t * 1e-3, r.render({ scene: w });
|
|
64
|
+
};
|
|
65
|
+
s = requestAnimationFrame(d), o.appendChild(e.canvas);
|
|
66
|
+
const h = (t) => {
|
|
67
|
+
const i = o.getBoundingClientRect(), x = (t.clientX - i.left) / i.width, y = 1 - (t.clientY - i.top) / i.height;
|
|
68
|
+
n.uniforms.uMouse.value[0] = x, n.uniforms.uMouse.value[1] = y;
|
|
69
|
+
};
|
|
70
|
+
return u && o.addEventListener("mousemove", h), () => {
|
|
71
|
+
cancelAnimationFrame(s), window.removeEventListener("resize", a), u && o.removeEventListener("mousemove", h), o.contains(e.canvas) && o.removeChild(e.canvas), e.getExtension("WEBGL_lose_context")?.loseContext();
|
|
72
|
+
};
|
|
73
|
+
}, [c, l, m, u]), /* @__PURE__ */ C("div", { ref: f, style: { width: "100%", height: "100%" } });
|
|
74
|
+
}
|
|
75
|
+
export {
|
|
76
|
+
_ as default
|
|
77
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface LightningProps {
|
|
2
|
+
hue?: number;
|
|
3
|
+
xOffset?: number;
|
|
4
|
+
speed?: number;
|
|
5
|
+
intensity?: number;
|
|
6
|
+
size?: number;
|
|
7
|
+
}
|
|
8
|
+
export default function Lightning({ hue, xOffset, speed, intensity, size }: LightningProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as U } from "react/jsx-runtime";
|
|
3
|
+
import { useRef as _, useEffect as z } from "react";
|
|
4
|
+
function H({ hue: a = 45, xOffset: c = 0, speed: f = 1, intensity: s = 1, size: u = 1 }) {
|
|
5
|
+
const m = _(null);
|
|
6
|
+
return z(() => {
|
|
7
|
+
const o = m.current;
|
|
8
|
+
if (!o) return;
|
|
9
|
+
const i = () => {
|
|
10
|
+
o.width = o.clientWidth, o.height = o.clientHeight;
|
|
11
|
+
};
|
|
12
|
+
i(), window.addEventListener("resize", i);
|
|
13
|
+
const t = o.getContext("webgl");
|
|
14
|
+
if (!t) return;
|
|
15
|
+
const h = "attribute vec2 aPosition; void main() { gl_Position = vec4(aPosition, 0.0, 1.0); }", d = `
|
|
16
|
+
precision mediump float;
|
|
17
|
+
uniform vec2 iResolution;
|
|
18
|
+
uniform float iTime;
|
|
19
|
+
uniform float uHue;
|
|
20
|
+
uniform float uXOffset;
|
|
21
|
+
uniform float uSpeed;
|
|
22
|
+
uniform float uIntensity;
|
|
23
|
+
uniform float uSize;
|
|
24
|
+
#define OCTAVE_COUNT 10
|
|
25
|
+
vec3 hsv2rgb(vec3 c) {
|
|
26
|
+
vec3 rgb = clamp(abs(mod(c.x*6.0+vec3(0.0,4.0,2.0),6.0)-3.0)-1.0,0.0,1.0);
|
|
27
|
+
return c.z*mix(vec3(1.0),rgb,c.y);
|
|
28
|
+
}
|
|
29
|
+
float hash11(float p) { p=fract(p*.1031); p*=p+33.33; p*=p+p; return fract(p); }
|
|
30
|
+
float hash12(vec2 p) { vec3 p3=fract(vec3(p.xyx)*.1031); p3+=dot(p3,p3.yzx+33.33); return fract((p3.x+p3.y)*p3.z); }
|
|
31
|
+
mat2 rotate2d(float t) { float c=cos(t),s=sin(t); return mat2(c,-s,s,c); }
|
|
32
|
+
float noise(vec2 p) {
|
|
33
|
+
vec2 ip=floor(p),fp=fract(p);
|
|
34
|
+
float a=hash12(ip),b=hash12(ip+vec2(1,0)),c=hash12(ip+vec2(0,1)),d=hash12(ip+vec2(1,1));
|
|
35
|
+
vec2 t=smoothstep(0.0,1.0,fp);
|
|
36
|
+
return mix(mix(a,b,t.x),mix(c,d,t.x),t.y);
|
|
37
|
+
}
|
|
38
|
+
float fbm(vec2 p) {
|
|
39
|
+
float v=0.0,a=0.5;
|
|
40
|
+
for(int i=0;i<OCTAVE_COUNT;++i){v+=a*noise(p);p*=rotate2d(0.45);p*=2.0;a*=0.5;}
|
|
41
|
+
return v;
|
|
42
|
+
}
|
|
43
|
+
void main() {
|
|
44
|
+
vec2 uv=gl_FragCoord.xy/iResolution.xy;
|
|
45
|
+
uv=2.0*uv-1.0;
|
|
46
|
+
uv.x*=iResolution.x/iResolution.y;
|
|
47
|
+
uv.x+=uXOffset;
|
|
48
|
+
uv+=2.0*fbm(uv*uSize+0.8*iTime*uSpeed)-1.0;
|
|
49
|
+
float dist=abs(uv.x);
|
|
50
|
+
vec3 baseColor=hsv2rgb(vec3(uHue/360.0,0.7,0.8));
|
|
51
|
+
vec3 col=baseColor*pow(mix(0.0,0.07,hash11(iTime*uSpeed))/dist,1.0)*uIntensity;
|
|
52
|
+
gl_FragColor=vec4(col,1.0);
|
|
53
|
+
}
|
|
54
|
+
`, l = (F, C) => {
|
|
55
|
+
const n = t.createShader(C);
|
|
56
|
+
return t.shaderSource(n, F), t.compileShader(n), n;
|
|
57
|
+
}, g = l(h, t.VERTEX_SHADER), b = l(d, t.FRAGMENT_SHADER), e = t.createProgram();
|
|
58
|
+
t.attachShader(e, g), t.attachShader(e, b), t.linkProgram(e), t.useProgram(e);
|
|
59
|
+
const x = t.createBuffer();
|
|
60
|
+
t.bindBuffer(t.ARRAY_BUFFER, x), t.bufferData(t.ARRAY_BUFFER, new Float32Array([-1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1]), t.STATIC_DRAW);
|
|
61
|
+
const p = t.getAttribLocation(e, "aPosition");
|
|
62
|
+
t.enableVertexAttribArray(p), t.vertexAttribPointer(p, 2, t.FLOAT, !1, 0, 0);
|
|
63
|
+
const A = t.getUniformLocation(e, "iResolution"), R = t.getUniformLocation(e, "iTime"), S = t.getUniformLocation(e, "uHue"), w = t.getUniformLocation(e, "uXOffset"), y = t.getUniformLocation(e, "uSpeed"), T = t.getUniformLocation(e, "uIntensity"), E = t.getUniformLocation(e, "uSize"), L = performance.now();
|
|
64
|
+
let r = 0;
|
|
65
|
+
const v = () => {
|
|
66
|
+
r = requestAnimationFrame(v), i(), t.viewport(0, 0, o.width, o.height), t.uniform2f(A, o.width, o.height), t.uniform1f(R, (performance.now() - L) / 1e3), t.uniform1f(S, a), t.uniform1f(w, c), t.uniform1f(y, f), t.uniform1f(T, s), t.uniform1f(E, u), t.drawArrays(t.TRIANGLES, 0, 6);
|
|
67
|
+
};
|
|
68
|
+
return r = requestAnimationFrame(v), () => {
|
|
69
|
+
cancelAnimationFrame(r), window.removeEventListener("resize", i);
|
|
70
|
+
};
|
|
71
|
+
}, [a, c, f, s, u]), /* @__PURE__ */ U("canvas", { ref: m, style: { width: "100%", height: "100%", display: "block" } });
|
|
72
|
+
}
|
|
73
|
+
export {
|
|
74
|
+
H as default
|
|
75
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface LiquidChromeProps {
|
|
2
|
+
baseColor?: [number, number, number];
|
|
3
|
+
speed?: number;
|
|
4
|
+
amplitude?: number;
|
|
5
|
+
frequencyX?: number;
|
|
6
|
+
frequencyY?: number;
|
|
7
|
+
interactive?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export default function LiquidChrome({ baseColor, speed, amplitude, frequencyX, frequencyY, interactive }: LiquidChromeProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as F } from "react/jsx-runtime";
|
|
3
|
+
import { useRef as R, useEffect as C } from "react";
|
|
4
|
+
import { Renderer as A, Triangle as E, Program as M, Mesh as T } from "ogl";
|
|
5
|
+
function B({ baseColor: n = [0.11, 0.09, 0.07], speed: v = 0.2, amplitude: c = 0.5, frequencyX: f = 3, frequencyY: m = 2, interactive: r = !0 }) {
|
|
6
|
+
const d = R(null);
|
|
7
|
+
return C(() => {
|
|
8
|
+
const t = d.current;
|
|
9
|
+
if (!t) return;
|
|
10
|
+
const a = new A({ antialias: !0 }), e = a.gl;
|
|
11
|
+
e.clearColor(n[0], n[1], n[2], 1);
|
|
12
|
+
const p = `
|
|
13
|
+
attribute vec2 position;
|
|
14
|
+
attribute vec2 uv;
|
|
15
|
+
varying vec2 vUv;
|
|
16
|
+
void main() { vUv = uv; gl_Position = vec4(position, 0.0, 1.0); }
|
|
17
|
+
`, y = `
|
|
18
|
+
precision highp float;
|
|
19
|
+
uniform float uTime;
|
|
20
|
+
uniform vec3 uResolution;
|
|
21
|
+
uniform vec3 uBaseColor;
|
|
22
|
+
uniform float uAmplitude;
|
|
23
|
+
uniform float uFrequencyX;
|
|
24
|
+
uniform float uFrequencyY;
|
|
25
|
+
uniform vec2 uMouse;
|
|
26
|
+
varying vec2 vUv;
|
|
27
|
+
vec4 renderImage(vec2 uvCoord) {
|
|
28
|
+
vec2 fragCoord = uvCoord * uResolution.xy;
|
|
29
|
+
vec2 uv = (2.0 * fragCoord - uResolution.xy) / min(uResolution.x, uResolution.y);
|
|
30
|
+
for (float i = 1.0; i < 10.0; i++) {
|
|
31
|
+
uv.x += uAmplitude / i * cos(i * uFrequencyX * uv.y + uTime + uMouse.x * 3.14159);
|
|
32
|
+
uv.y += uAmplitude / i * cos(i * uFrequencyY * uv.x + uTime + uMouse.y * 3.14159);
|
|
33
|
+
}
|
|
34
|
+
vec2 diff = (uvCoord - uMouse);
|
|
35
|
+
float dist = length(diff);
|
|
36
|
+
float falloff = exp(-dist * 20.0);
|
|
37
|
+
float ripple = sin(10.0 * dist - uTime * 2.0) * 0.03;
|
|
38
|
+
uv += (diff / (dist + 0.0001)) * ripple * falloff;
|
|
39
|
+
vec3 color = uBaseColor / abs(sin(uTime - uv.y - uv.x));
|
|
40
|
+
return vec4(color, 1.0);
|
|
41
|
+
}
|
|
42
|
+
void main() {
|
|
43
|
+
vec4 col = vec4(0.0);
|
|
44
|
+
int samples = 0;
|
|
45
|
+
for (int i = -1; i <= 1; i++) {
|
|
46
|
+
for (int j = -1; j <= 1; j++) {
|
|
47
|
+
vec2 offset = vec2(float(i), float(j)) * (1.0 / min(uResolution.x, uResolution.y));
|
|
48
|
+
col += renderImage(vUv + offset);
|
|
49
|
+
samples++;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
gl_FragColor = col / float(samples);
|
|
53
|
+
}
|
|
54
|
+
`, w = new E(e), i = new M(e, {
|
|
55
|
+
vertex: p,
|
|
56
|
+
fragment: y,
|
|
57
|
+
uniforms: {
|
|
58
|
+
uTime: { value: 0 },
|
|
59
|
+
uResolution: { value: new Float32Array([e.canvas.width, e.canvas.height, e.canvas.width / e.canvas.height]) },
|
|
60
|
+
uBaseColor: { value: new Float32Array(n) },
|
|
61
|
+
uAmplitude: { value: c },
|
|
62
|
+
uFrequencyX: { value: f },
|
|
63
|
+
uFrequencyY: { value: m },
|
|
64
|
+
uMouse: { value: new Float32Array([0, 0]) }
|
|
65
|
+
}
|
|
66
|
+
}), x = new T(e, { geometry: w, program: i });
|
|
67
|
+
function s() {
|
|
68
|
+
a.setSize(t.offsetWidth, t.offsetHeight);
|
|
69
|
+
const o = i.uniforms.uResolution.value;
|
|
70
|
+
o[0] = e.canvas.width, o[1] = e.canvas.height, o[2] = e.canvas.width / e.canvas.height;
|
|
71
|
+
}
|
|
72
|
+
window.addEventListener("resize", s), s();
|
|
73
|
+
const h = (o) => {
|
|
74
|
+
const u = t.getBoundingClientRect();
|
|
75
|
+
i.uniforms.uMouse.value[0] = (o.clientX - u.left) / u.width, i.uniforms.uMouse.value[1] = 1 - (o.clientY - u.top) / u.height;
|
|
76
|
+
};
|
|
77
|
+
r && t.addEventListener("mousemove", h);
|
|
78
|
+
let l = 0;
|
|
79
|
+
const g = (o) => {
|
|
80
|
+
l = requestAnimationFrame(g), i.uniforms.uTime.value = o * 1e-3 * v, a.render({ scene: x });
|
|
81
|
+
};
|
|
82
|
+
return l = requestAnimationFrame(g), t.appendChild(e.canvas), () => {
|
|
83
|
+
cancelAnimationFrame(l), window.removeEventListener("resize", s), r && t.removeEventListener("mousemove", h), e.canvas.parentElement && e.canvas.parentElement.removeChild(e.canvas), e.getExtension("WEBGL_lose_context")?.loseContext();
|
|
84
|
+
};
|
|
85
|
+
}, [n, v, c, f, m, r]), /* @__PURE__ */ F("div", { ref: d, style: { width: "100%", height: "100%" } });
|
|
86
|
+
}
|
|
87
|
+
export {
|
|
88
|
+
B as default
|
|
89
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface ParticlesProps {
|
|
2
|
+
particleCount?: number;
|
|
3
|
+
particleSpread?: number;
|
|
4
|
+
speed?: number;
|
|
5
|
+
particleColors?: string[];
|
|
6
|
+
moveParticlesOnHover?: boolean;
|
|
7
|
+
particleHoverFactor?: number;
|
|
8
|
+
alphaParticles?: boolean;
|
|
9
|
+
particleBaseSize?: number;
|
|
10
|
+
sizeRandomness?: number;
|
|
11
|
+
cameraDistance?: number;
|
|
12
|
+
disableRotation?: boolean;
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
export default function Particles({ particleCount, particleSpread, speed, particleColors, moveParticlesOnHover, particleHoverFactor, alphaParticles, particleBaseSize, sizeRandomness, cameraDistance, disableRotation, className, }: ParticlesProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as G } from "react/jsx-runtime";
|
|
3
|
+
import { useRef as L, useEffect as N } from "react";
|
|
4
|
+
import { Renderer as W, Camera as X, Geometry as Y, Program as k, Mesh as J } from "ogl";
|
|
5
|
+
const K = ["#ffffff", "#ffffff", "#ffffff"], Q = (e) => {
|
|
6
|
+
e = e.replace(/^#/, ""), e.length === 3 && (e = e.split("").map((r) => r + r).join(""));
|
|
7
|
+
const i = parseInt(e, 16);
|
|
8
|
+
return [(i >> 16 & 255) / 255, (i >> 8 & 255) / 255, (i & 255) / 255];
|
|
9
|
+
}, U = (
|
|
10
|
+
/* glsl */
|
|
11
|
+
`
|
|
12
|
+
attribute vec3 position;
|
|
13
|
+
attribute vec4 random;
|
|
14
|
+
attribute vec3 color;
|
|
15
|
+
uniform mat4 modelMatrix;
|
|
16
|
+
uniform mat4 viewMatrix;
|
|
17
|
+
uniform mat4 projectionMatrix;
|
|
18
|
+
uniform float uTime;
|
|
19
|
+
uniform float uSpread;
|
|
20
|
+
uniform float uBaseSize;
|
|
21
|
+
uniform float uSizeRandomness;
|
|
22
|
+
varying vec4 vRandom;
|
|
23
|
+
varying vec3 vColor;
|
|
24
|
+
void main() {
|
|
25
|
+
vRandom = random;
|
|
26
|
+
vColor = color;
|
|
27
|
+
vec3 pos = position * uSpread;
|
|
28
|
+
pos.z *= 10.0;
|
|
29
|
+
vec4 mPos = modelMatrix * vec4(pos, 1.0);
|
|
30
|
+
float t = uTime;
|
|
31
|
+
mPos.x += sin(t * random.z + 6.28 * random.w) * mix(0.1, 1.5, random.x);
|
|
32
|
+
mPos.y += sin(t * random.y + 6.28 * random.x) * mix(0.1, 1.5, random.w);
|
|
33
|
+
mPos.z += sin(t * random.w + 6.28 * random.y) * mix(0.1, 1.5, random.z);
|
|
34
|
+
vec4 mvPos = viewMatrix * mPos;
|
|
35
|
+
if (uSizeRandomness == 0.0) {
|
|
36
|
+
gl_PointSize = uBaseSize;
|
|
37
|
+
} else {
|
|
38
|
+
gl_PointSize = (uBaseSize * (1.0 + uSizeRandomness * (random.x - 0.5))) / length(mvPos.xyz);
|
|
39
|
+
}
|
|
40
|
+
gl_Position = projectionMatrix * mvPos;
|
|
41
|
+
}
|
|
42
|
+
`
|
|
43
|
+
), V = (
|
|
44
|
+
/* glsl */
|
|
45
|
+
`
|
|
46
|
+
precision highp float;
|
|
47
|
+
uniform float uTime;
|
|
48
|
+
uniform float uAlphaParticles;
|
|
49
|
+
varying vec4 vRandom;
|
|
50
|
+
varying vec3 vColor;
|
|
51
|
+
void main() {
|
|
52
|
+
vec2 uv = gl_PointCoord.xy;
|
|
53
|
+
float d = length(uv - vec2(0.5));
|
|
54
|
+
if(uAlphaParticles < 0.5) {
|
|
55
|
+
if(d > 0.5) discard;
|
|
56
|
+
gl_FragColor = vec4(vColor + 0.2 * sin(uv.yxx + uTime + vRandom.y * 6.28), 1.0);
|
|
57
|
+
} else {
|
|
58
|
+
float circle = smoothstep(0.5, 0.4, d) * 0.8;
|
|
59
|
+
gl_FragColor = vec4(vColor + 0.2 * sin(uv.yxx + uTime + vRandom.y * 6.28), circle);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
`
|
|
63
|
+
);
|
|
64
|
+
function O({
|
|
65
|
+
particleCount: e = 200,
|
|
66
|
+
particleSpread: i = 10,
|
|
67
|
+
speed: r = 0.1,
|
|
68
|
+
particleColors: m,
|
|
69
|
+
moveParticlesOnHover: l = !1,
|
|
70
|
+
particleHoverFactor: u = 1,
|
|
71
|
+
alphaParticles: M = !1,
|
|
72
|
+
particleBaseSize: z = 100,
|
|
73
|
+
sizeRandomness: P = 1,
|
|
74
|
+
cameraDistance: R = 20,
|
|
75
|
+
disableRotation: S = !1,
|
|
76
|
+
className: I = ""
|
|
77
|
+
}) {
|
|
78
|
+
const T = L(null), v = L({ x: 0, y: 0 });
|
|
79
|
+
return N(() => {
|
|
80
|
+
const a = T.current;
|
|
81
|
+
if (!a) return;
|
|
82
|
+
const h = new W({ dpr: Math.min(window.devicePixelRatio, 2), depth: !1, alpha: !0 }), o = h.gl;
|
|
83
|
+
a.appendChild(o.canvas), o.clearColor(0, 0, 0, 0);
|
|
84
|
+
const p = new X(o, { fov: 15 });
|
|
85
|
+
p.position.set(0, 0, R);
|
|
86
|
+
const g = () => {
|
|
87
|
+
h.setSize(a.clientWidth, a.clientHeight), p.perspective({ aspect: o.canvas.width / o.canvas.height });
|
|
88
|
+
};
|
|
89
|
+
window.addEventListener("resize", g, !1), g();
|
|
90
|
+
const A = (t) => {
|
|
91
|
+
const n = a.getBoundingClientRect();
|
|
92
|
+
v.current = {
|
|
93
|
+
x: (t.clientX - n.left) / n.width * 2 - 1,
|
|
94
|
+
y: -((t.clientY - n.top) / n.height * 2 - 1)
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
l && a.addEventListener("mousemove", A);
|
|
98
|
+
const C = new Float32Array(e * 3), F = new Float32Array(e * 4), _ = new Float32Array(e * 3), E = m && m.length > 0 ? m : K;
|
|
99
|
+
for (let t = 0; t < e; t++) {
|
|
100
|
+
let n, f, c, x;
|
|
101
|
+
do
|
|
102
|
+
n = Math.random() * 2 - 1, f = Math.random() * 2 - 1, c = Math.random() * 2 - 1, x = n * n + f * f + c * c;
|
|
103
|
+
while (x > 1 || x === 0);
|
|
104
|
+
const y = Math.cbrt(Math.random());
|
|
105
|
+
C.set([n * y, f * y, c * y], t * 3), F.set([Math.random(), Math.random(), Math.random(), Math.random()], t * 4), _.set(Q(E[Math.floor(Math.random() * E.length)]), t * 3);
|
|
106
|
+
}
|
|
107
|
+
const q = new Y(o, {
|
|
108
|
+
position: { size: 3, data: C },
|
|
109
|
+
random: { size: 4, data: F },
|
|
110
|
+
color: { size: 3, data: _ }
|
|
111
|
+
}), b = new k(o, {
|
|
112
|
+
vertex: U,
|
|
113
|
+
fragment: V,
|
|
114
|
+
uniforms: {
|
|
115
|
+
uTime: { value: 0 },
|
|
116
|
+
uSpread: { value: i },
|
|
117
|
+
uBaseSize: { value: z * Math.min(window.devicePixelRatio, 2) },
|
|
118
|
+
uSizeRandomness: { value: P },
|
|
119
|
+
uAlphaParticles: { value: M ? 1 : 0 }
|
|
120
|
+
},
|
|
121
|
+
transparent: !0,
|
|
122
|
+
depthTest: !1
|
|
123
|
+
}), s = new J(o, { mode: o.POINTS, geometry: q, program: b });
|
|
124
|
+
let w = 0, j = performance.now(), d = 0;
|
|
125
|
+
const B = (t) => {
|
|
126
|
+
w = requestAnimationFrame(B);
|
|
127
|
+
const n = t - j;
|
|
128
|
+
j = t, d += n * r, b.uniforms.uTime.value = d * 1e-3, l && (s.position.x = -v.current.x * u, s.position.y = -v.current.y * u), S || (s.rotation.x = Math.sin(d * 2e-4) * 0.1, s.rotation.y = Math.cos(d * 5e-4) * 0.15, s.rotation.z += 0.01 * r), h.render({ scene: s, camera: p });
|
|
129
|
+
};
|
|
130
|
+
return w = requestAnimationFrame(B), () => {
|
|
131
|
+
window.removeEventListener("resize", g), l && a.removeEventListener("mousemove", A), cancelAnimationFrame(w), a.contains(o.canvas) && a.removeChild(o.canvas);
|
|
132
|
+
};
|
|
133
|
+
}, [e, i, r, l, u, M, z, P, R, S, m]), /* @__PURE__ */ G("div", { ref: T, className: I, style: { position: "relative", width: "100%", height: "100%" } });
|
|
134
|
+
}
|
|
135
|
+
export {
|
|
136
|
+
O as default
|
|
137
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface PixelSnowProps {
|
|
2
|
+
snowColor?: string;
|
|
3
|
+
count?: number;
|
|
4
|
+
speed?: number;
|
|
5
|
+
pixelSize?: number;
|
|
6
|
+
wind?: number;
|
|
7
|
+
opacity?: number;
|
|
8
|
+
}
|
|
9
|
+
export default function PixelSnow({ snowColor, count, speed, pixelSize, wind, opacity, }: PixelSnowProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as x } from "react/jsx-runtime";
|
|
3
|
+
import { useRef as h, useEffect as y } from "react";
|
|
4
|
+
function A({
|
|
5
|
+
snowColor: i = "#E7BB1D",
|
|
6
|
+
count: o = 180,
|
|
7
|
+
speed: d = 0.6,
|
|
8
|
+
pixelSize: r = 3,
|
|
9
|
+
wind: c = 0.3,
|
|
10
|
+
opacity: u = 0.7
|
|
11
|
+
}) {
|
|
12
|
+
const l = h(null), n = h(null), m = h([]);
|
|
13
|
+
return y(() => {
|
|
14
|
+
const e = l.current;
|
|
15
|
+
if (!e) return;
|
|
16
|
+
const a = e.getContext("2d");
|
|
17
|
+
if (!a) return;
|
|
18
|
+
const s = () => {
|
|
19
|
+
e.width = e.offsetWidth, e.height = e.offsetHeight;
|
|
20
|
+
};
|
|
21
|
+
window.addEventListener("resize", s), s(), m.current = Array.from({ length: o }, () => ({
|
|
22
|
+
x: Math.random() * e.width,
|
|
23
|
+
y: Math.random() * e.height,
|
|
24
|
+
size: r * (0.5 + Math.random() * 1),
|
|
25
|
+
speed: d * (0.4 + Math.random() * 0.8),
|
|
26
|
+
drift: (Math.random() - 0.5) * c,
|
|
27
|
+
alpha: 0.3 + Math.random() * u * 0.7,
|
|
28
|
+
phase: Math.random() * Math.PI * 2,
|
|
29
|
+
phaseSpeed: 5e-3 + Math.random() * 0.01
|
|
30
|
+
}));
|
|
31
|
+
let M = 0;
|
|
32
|
+
const w = () => {
|
|
33
|
+
a.clearRect(0, 0, e.width, e.height), M++, m.current.forEach((t) => {
|
|
34
|
+
t.y += t.speed, t.x += t.drift + Math.sin(t.phase + M * t.phaseSpeed) * 0.3, t.y > e.height + t.size && (t.y = -t.size, t.x = Math.random() * e.width), t.x > e.width + t.size && (t.x = -t.size), t.x < -t.size && (t.x = e.width + t.size);
|
|
35
|
+
const g = Math.round(t.x / r) * r, p = Math.round(t.y / r) * r;
|
|
36
|
+
a.globalAlpha = t.alpha, a.fillStyle = i, a.fillRect(g, p, Math.round(t.size), Math.round(t.size));
|
|
37
|
+
}), a.globalAlpha = 1, n.current = requestAnimationFrame(w);
|
|
38
|
+
};
|
|
39
|
+
return n.current = requestAnimationFrame(w), () => {
|
|
40
|
+
window.removeEventListener("resize", s), n.current && cancelAnimationFrame(n.current);
|
|
41
|
+
};
|
|
42
|
+
}, [i, o, d, r, c, u]), /* @__PURE__ */ x(
|
|
43
|
+
"canvas",
|
|
44
|
+
{
|
|
45
|
+
ref: l,
|
|
46
|
+
style: { width: "100%", height: "100%", border: "none", display: "block" }
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
A as default
|
|
52
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface SilkProps {
|
|
2
|
+
speed?: number;
|
|
3
|
+
scale?: number;
|
|
4
|
+
color?: string;
|
|
5
|
+
noiseIntensity?: number;
|
|
6
|
+
rotation?: number;
|
|
7
|
+
}
|
|
8
|
+
export default function Silk({ speed, scale, color, noiseIntensity, rotation, }: SilkProps): import("react/jsx-runtime").JSX.Element;
|