@burdenoff/fe-libs 2026.1118.4 → 2026.1118.6
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/dist/platform-pages/AppearanceSettingsPage.d.ts +9 -13
- package/dist/platform-pages/AppearanceSettingsPage.js +7 -4
- package/dist/platform-pages/index.d.ts +1 -1
- package/dist/shared/assistant/home/AssistantHomePage.d.ts +29 -1
- package/dist/shared/assistant/home/AssistantHomePage.js +63 -36
- package/dist/shared/assistant/home/AssistantHomeStart.d.ts +12 -0
- package/dist/shared/assistant/home/AssistantHomeStart.js +24 -15
- package/dist/shared/assistant/home.js +5 -5
- package/dist/shared/assistant/ui/AIAssistantPanel.js +152 -152
- package/dist/shared/assistant/ui/compact/AssistantCompactHeader.d.ts +9 -0
- package/dist/shared/assistant/ui/compact/AssistantCompactHeader.js +62 -52
- package/dist/shared/assistant/ui/compact/AssistantWindowHeader.js +29 -35
- package/dist/shared/assistant/ui/compact/windowTitle.d.ts +32 -9
- package/dist/shared/assistant/ui/compact/windowTitle.js +31 -6
- package/dist/shared/backgrounds/BackgroundEffect.d.ts +7 -0
- package/dist/shared/backgrounds/BackgroundEffect.js +24 -0
- package/dist/shared/backgrounds/BackgroundPicker.d.ts +49 -0
- package/dist/shared/backgrounds/BackgroundPicker.js +133 -0
- package/dist/shared/backgrounds/BackgroundRoot.d.ts +13 -0
- package/dist/shared/backgrounds/BackgroundRoot.js +44 -0
- package/dist/shared/backgrounds/CursorWave.d.ts +19 -0
- package/dist/shared/backgrounds/CursorWave.js +40 -0
- package/dist/shared/backgrounds/DottedWaves.d.ts +20 -0
- package/dist/shared/backgrounds/DottedWaves.js +36 -0
- package/dist/shared/backgrounds/Glimmer.d.ts +18 -0
- package/dist/shared/backgrounds/Glimmer.js +38 -0
- package/dist/shared/backgrounds/backgroundGround.d.ts +5 -0
- package/dist/shared/backgrounds/backgroundGround.js +16 -0
- package/dist/shared/backgrounds/backgroundTypes.d.ts +38 -0
- package/dist/shared/backgrounds/backgroundTypes.js +20 -0
- package/dist/shared/backgrounds/canvasEffect.d.ts +51 -0
- package/dist/shared/backgrounds/canvasEffect.js +97 -0
- package/dist/shared/backgrounds/color.d.ts +56 -0
- package/dist/shared/backgrounds/color.js +153 -0
- package/dist/shared/backgrounds/cursorWavePool.d.ts +7 -0
- package/dist/shared/backgrounds/cursorWavePool.js +14 -0
- package/dist/shared/backgrounds/cursorWaveRenderer.d.ts +43 -0
- package/dist/shared/backgrounds/cursorWaveRenderer.js +146 -0
- package/dist/shared/backgrounds/dottedWavesRenderer.d.ts +72 -0
- package/dist/shared/backgrounds/dottedWavesRenderer.js +176 -0
- package/dist/shared/backgrounds/glimmerRenderer.d.ts +65 -0
- package/dist/shared/backgrounds/glimmerRenderer.js +254 -0
- package/dist/shared/backgrounds/index.d.ts +31 -0
- package/dist/shared/backgrounds/noise.d.ts +19 -0
- package/dist/shared/backgrounds/noise.js +143 -0
- package/dist/shared/backgrounds/originalPalettes.d.ts +36 -0
- package/dist/shared/backgrounds/originalPalettes.js +24 -0
- package/dist/shared/backgrounds/useBackgroundColors.d.ts +40 -0
- package/dist/shared/backgrounds/useBackgroundColors.js +165 -0
- package/dist/shared/backgrounds/useBackgroundPreference.d.ts +26 -0
- package/dist/shared/backgrounds/useBackgroundPreference.js +109 -0
- package/dist/shared-assistant.js +79 -79
- package/dist/shared-backgrounds.d.ts +2 -0
- package/dist/shared-backgrounds.js +16 -0
- package/package.json +9 -1
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { cssRgba as e, mixOklab as t } from "./color.js";
|
|
2
|
+
import { createRandom as n } from "./noise.js";
|
|
3
|
+
// src/shared/backgrounds/glimmerRenderer.ts
|
|
4
|
+
var r = {
|
|
5
|
+
count: 1500,
|
|
6
|
+
size: 1.6,
|
|
7
|
+
sizeVariance: .6,
|
|
8
|
+
brightness: 1,
|
|
9
|
+
spread: 1,
|
|
10
|
+
hollow: .06,
|
|
11
|
+
perspective: .7,
|
|
12
|
+
centerX: .5,
|
|
13
|
+
centerY: .5,
|
|
14
|
+
speed: .5,
|
|
15
|
+
direction: "outward",
|
|
16
|
+
twist: 0,
|
|
17
|
+
turbulence: 0,
|
|
18
|
+
trail: .08,
|
|
19
|
+
glitter: .5,
|
|
20
|
+
glintSize: 1,
|
|
21
|
+
twinkle: .5,
|
|
22
|
+
focus: .62,
|
|
23
|
+
aperture: .45,
|
|
24
|
+
boost: 7,
|
|
25
|
+
parallax: .5,
|
|
26
|
+
waves: !0,
|
|
27
|
+
intro: !0
|
|
28
|
+
}, i = {
|
|
29
|
+
travel: .16,
|
|
30
|
+
nearest: .08,
|
|
31
|
+
farRadius: 1,
|
|
32
|
+
dotScale: 1.9,
|
|
33
|
+
farFade: .3,
|
|
34
|
+
nearFade: .45,
|
|
35
|
+
gain: 1.18,
|
|
36
|
+
axisBias: 1,
|
|
37
|
+
outerShare: .18,
|
|
38
|
+
outerReach: 2,
|
|
39
|
+
blur: 10,
|
|
40
|
+
shutter: .8,
|
|
41
|
+
coreMin: 3.2,
|
|
42
|
+
coreScale: 4.2,
|
|
43
|
+
coreMax: 5,
|
|
44
|
+
minDot: 3.1,
|
|
45
|
+
flashRate: .045,
|
|
46
|
+
flashLength: .32,
|
|
47
|
+
rayLength: 23,
|
|
48
|
+
rayWidth: .42,
|
|
49
|
+
glowScale: 3.2,
|
|
50
|
+
introBoost: 6,
|
|
51
|
+
introSettle: .25,
|
|
52
|
+
introFade: .3,
|
|
53
|
+
waveSpeed: 900,
|
|
54
|
+
waveWidth: 70
|
|
55
|
+
}, a = [
|
|
56
|
+
[
|
|
57
|
+
2.4,
|
|
58
|
+
.3,
|
|
59
|
+
1
|
|
60
|
+
],
|
|
61
|
+
[
|
|
62
|
+
2.3,
|
|
63
|
+
.8,
|
|
64
|
+
.3
|
|
65
|
+
],
|
|
66
|
+
[
|
|
67
|
+
1,
|
|
68
|
+
1,
|
|
69
|
+
1
|
|
70
|
+
]
|
|
71
|
+
], o = 8, s = 64, c = Math.PI * 2, l = (e) => e < 0 ? 0 : e > 1 ? 1 : e;
|
|
72
|
+
function u(r, u = 11) {
|
|
73
|
+
let d = r, f = n(u), p = [], m = 0, h = 0, g = 0, _ = 0, v = -1, y = !1, b = 1, x = -1, S = {
|
|
74
|
+
x: .5,
|
|
75
|
+
y: .5,
|
|
76
|
+
inside: !1
|
|
77
|
+
}, C = {
|
|
78
|
+
x: 0,
|
|
79
|
+
y: 0
|
|
80
|
+
}, w = [], T = null, E = [], D = [], O = null, k = null, A = (e, t) => {
|
|
81
|
+
let n = Math.min(.95, Math.max(0, d.hollow)), r = f() < i.outerShare ? Math.sqrt(1 + f() * (i.outerReach ** 2 - 1)) : Math.sqrt(n * n + f() ** i.axisBias * (1 - n * n)), a = e ?? {
|
|
82
|
+
angle: 0,
|
|
83
|
+
radius: 0,
|
|
84
|
+
depth: 0,
|
|
85
|
+
size: 1,
|
|
86
|
+
tint: 0,
|
|
87
|
+
twinklePhase: 0,
|
|
88
|
+
twinkleRate: 1,
|
|
89
|
+
flashOffset: 0,
|
|
90
|
+
flashPeriod: 1,
|
|
91
|
+
rayAngle: 0,
|
|
92
|
+
wobble: 0
|
|
93
|
+
};
|
|
94
|
+
return a.angle = f() * c, a.radius = r, a.depth = t, a.size = Math.max(.15, 1 + d.sizeVariance * (f() * 2 - 1)), a.tint = f() ** 1.4, a.twinklePhase = f() * c, a.twinkleRate = 1.2 + f() * 2.6, a.flashOffset = f() * 1e3, a.flashPeriod = .6 + f() * .8, a.rayAngle = f() * Math.PI, a.wobble = f() * c, a;
|
|
95
|
+
}, j = () => {
|
|
96
|
+
let e = Math.max(0, Math.min(9e3, Math.round(d.count)));
|
|
97
|
+
for (p.length > e && (p.length = e); p.length < e;) p.push(A(null, f()));
|
|
98
|
+
}, M = () => {
|
|
99
|
+
if (typeof document > "u") return;
|
|
100
|
+
let [n, r] = d.colors;
|
|
101
|
+
D = [], E = [];
|
|
102
|
+
for (let i = 0; i < o; i++) {
|
|
103
|
+
let a = t(n, r, i / 7);
|
|
104
|
+
D.push(a);
|
|
105
|
+
let o = document.createElement("canvas");
|
|
106
|
+
o.width = s, o.height = s;
|
|
107
|
+
let c = o.getContext("2d");
|
|
108
|
+
if (c) {
|
|
109
|
+
let t = c.createRadialGradient(s / 2, s / 2, 0, s / 2, s / 2, s / 2);
|
|
110
|
+
t.addColorStop(0, e(a, 1)), t.addColorStop(.42, e(a, .92)), t.addColorStop(.7, e(a, .38)), t.addColorStop(1, e(a, 0)), c.fillStyle = t, c.fillRect(0, 0, s, s);
|
|
111
|
+
}
|
|
112
|
+
E.push(o);
|
|
113
|
+
}
|
|
114
|
+
let i = document.createElement("canvas");
|
|
115
|
+
i.width = 128, i.height = 128;
|
|
116
|
+
let a = i.getContext("2d");
|
|
117
|
+
if (a) {
|
|
118
|
+
let t = s, r = a.createRadialGradient(t, t, 0, t, t, t);
|
|
119
|
+
r.addColorStop(0, e(n, 1)), r.addColorStop(.55, e(n, 1)), r.addColorStop(.75, e(n, .45)), r.addColorStop(.9, e(n, .1)), r.addColorStop(1, e(n, 0)), a.fillStyle = r, a.fillRect(0, 0, 128, 128);
|
|
120
|
+
}
|
|
121
|
+
O = i;
|
|
122
|
+
let c = document.createElement("canvas");
|
|
123
|
+
c.width = 128, c.height = 128;
|
|
124
|
+
let l = c.getContext("2d");
|
|
125
|
+
if (l) {
|
|
126
|
+
let t = s, r = l.createRadialGradient(t, t, 0, t, t, t);
|
|
127
|
+
r.addColorStop(0, e(n, .4)), r.addColorStop(.2, e(n, .26)), r.addColorStop(.45, e(n, .1)), r.addColorStop(.75, e(n, .03)), r.addColorStop(1, e(n, 0)), l.fillStyle = r, l.fillRect(0, 0, 128, 128);
|
|
128
|
+
}
|
|
129
|
+
k = c;
|
|
130
|
+
};
|
|
131
|
+
j(), M();
|
|
132
|
+
let N = () => {
|
|
133
|
+
p.length === 0 && j(), E.length === 0 && M();
|
|
134
|
+
}, P = (e, t) => {
|
|
135
|
+
let n = 1;
|
|
136
|
+
if (d.intro) {
|
|
137
|
+
let t = e - _;
|
|
138
|
+
n *= 1 + (i.introBoost - 1) * Math.exp(-Math.max(0, t) / i.introSettle);
|
|
139
|
+
}
|
|
140
|
+
let r = y || e < v ? Math.max(1, d.boost) : 1;
|
|
141
|
+
return b += (r - b) * Math.min(1, t * 6), n *= b, d.speed * n;
|
|
142
|
+
};
|
|
143
|
+
return {
|
|
144
|
+
update(e) {
|
|
145
|
+
let t = e.colors[0] !== d.colors[0] || e.colors[1] !== d.colors[1], n = e.hollow !== d.hollow || e.sizeVariance !== d.sizeVariance;
|
|
146
|
+
d = e, n && (p = p.map((e) => A(e, e.depth))), j(), t && M();
|
|
147
|
+
},
|
|
148
|
+
resize(e, t) {
|
|
149
|
+
m = e, h = t, N();
|
|
150
|
+
},
|
|
151
|
+
wave(e = .5, t = .5) {
|
|
152
|
+
T = {
|
|
153
|
+
x: e,
|
|
154
|
+
y: t
|
|
155
|
+
};
|
|
156
|
+
},
|
|
157
|
+
warp(e = 1.2) {
|
|
158
|
+
v = g + e;
|
|
159
|
+
},
|
|
160
|
+
replay() {
|
|
161
|
+
_ = g;
|
|
162
|
+
},
|
|
163
|
+
pointerMove(e, t, n) {
|
|
164
|
+
S.inside = n, !n || m <= 0 || h <= 0 || (S.x = e / m, S.y = t / h);
|
|
165
|
+
},
|
|
166
|
+
pointerDown(e, t) {
|
|
167
|
+
y = !0, d.waves && m > 0 && h > 0 && (T = {
|
|
168
|
+
x: e / m,
|
|
169
|
+
y: t / h
|
|
170
|
+
});
|
|
171
|
+
},
|
|
172
|
+
pointerUp() {
|
|
173
|
+
y = !1;
|
|
174
|
+
},
|
|
175
|
+
pointerLeave() {
|
|
176
|
+
S.inside = !1, y = !1;
|
|
177
|
+
},
|
|
178
|
+
dispose() {
|
|
179
|
+
E = [], O = null, k = null, p = [];
|
|
180
|
+
},
|
|
181
|
+
draw(t, n) {
|
|
182
|
+
if (g = n.time, t.clearRect(0, 0, m, h), N(), m <= 0 || h <= 0 || E.length === 0) return;
|
|
183
|
+
let r = n.time, o = x < 0 ? 0 : Math.max(0, Math.min(.05, r - x));
|
|
184
|
+
x = r, T &&= (w.push({
|
|
185
|
+
x: T.x * m,
|
|
186
|
+
y: T.y * h,
|
|
187
|
+
born: r
|
|
188
|
+
}), w.length > 6 && w.shift(), null);
|
|
189
|
+
let s = n.still, c = s ? 0 : P(r, o), u = d.direction === "inward" ? -1 : 1, f = c * i.travel * o * u, v = S.inside && !s ? S : {
|
|
190
|
+
x: d.centerX,
|
|
191
|
+
y: d.centerY
|
|
192
|
+
}, y = Math.min(1, o * 3);
|
|
193
|
+
C.x += ((v.x - d.centerX) * d.parallax - C.x) * y, C.y += ((v.y - d.centerY) * d.parallax - C.y) * y;
|
|
194
|
+
let b = d.centerX * m, D = d.centerY * h, j = Math.max(.05, d.spread), M = Math.min(m, h) / 2, F = i.farRadius * M * j, I = F, L = 1 - Math.min(1, Math.max(0, d.perspective)) * (1 - i.nearest), R = 1 - .5 * (1 - L), z = 1 - l(d.focus), B = i.blur * Math.max(0, d.aperture), V = d.intro && !s ? l((r - _) / i.introFade) : 1, H = Math.max(0, d.brightness) * V * i.gain, U = s ? 0 : Math.max(0, d.trail), W = s ? 0 : Math.max(0, d.glitter), G = i.rayLength * Math.max(0, d.glintSize), K = s ? [] : w.filter((e) => r - e.born < 2.4);
|
|
195
|
+
K.length !== w.length && (w.length = 0, w.push(...K));
|
|
196
|
+
let q = (e, t) => {
|
|
197
|
+
let n = 1 - t * (1 - L), i = d.twist * t * Math.PI, a = d.turbulence > 0 ? Math.sin(r * .9 + e.wobble) * d.turbulence * .08 : 0, o = e.angle + i + a, s = e.radius / n, c = (1 / n - 1) * .12;
|
|
198
|
+
return {
|
|
199
|
+
x: b + Math.cos(o) * s * F + C.x * m * c,
|
|
200
|
+
y: D + Math.sin(o) * s * I + C.y * h * c,
|
|
201
|
+
z: n
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
t.save(), t.lineCap = "round";
|
|
205
|
+
let J = typeof t.getTransform == "function" && t.getTransform().a || 1;
|
|
206
|
+
for (let n of p) {
|
|
207
|
+
n.depth += f, n.depth >= 1 ? A(n, n.depth - 1) : n.depth < 0 && A(n, n.depth + 1);
|
|
208
|
+
let o = q(n, n.depth);
|
|
209
|
+
if (o.x < -40 || o.y < -40 || o.x > m + 40 || o.y > h + 40) continue;
|
|
210
|
+
let p = R / o.z, g = d.size / 2 * n.size * p * i.dotScale, _ = l(n.depth / i.farFade) * l((1 - n.depth) / i.nearFade), v = s ? n.twinklePhase : r * n.twinkleRate + n.twinklePhase, y = 1 - d.twinkle * .45 * (1 + Math.sin(v)), b = H * _ * y;
|
|
211
|
+
if (b <= .01) continue;
|
|
212
|
+
let x = n.depth > z ? n.depth - z : (z - n.depth) * .35, S = g + B * x * x * 2.2 * p;
|
|
213
|
+
b *= Math.min(1, (g * g + .35) / (S * S + .35));
|
|
214
|
+
let C = 0;
|
|
215
|
+
for (let e of K) {
|
|
216
|
+
let t = (r - e.born) * i.waveSpeed, n = Math.hypot(o.x - e.x, o.y - e.y) - t;
|
|
217
|
+
C = Math.max(C, Math.exp(-(n * n) / (i.waveWidth * i.waveWidth)));
|
|
218
|
+
}
|
|
219
|
+
if (W > 0) {
|
|
220
|
+
let e = i.flashRate * W, t = Math.floor((r + n.flashOffset) * e), a = Math.abs(Math.sin(t * 12.9898 + n.flashOffset * 78.233)) % 1, o = ((r + n.flashOffset) * e - t - a * .7) / (i.flashLength * e);
|
|
221
|
+
o > 0 && o < 1 && (C = Math.max(C, Math.sin(Math.PI * o) ** 2));
|
|
222
|
+
}
|
|
223
|
+
let w = Math.min(7, Math.round(n.tint * 7)), T = E[w], D = Math.max(i.minDot, S * 2.6), j = 0, M = 0;
|
|
224
|
+
if (U > 0 && c > 0) {
|
|
225
|
+
let e = q(n, n.depth - c * i.travel * U * u * i.shutter), t = o.x - e.x, r = o.y - e.y;
|
|
226
|
+
j = Math.hypot(t, r), M = Math.atan2(r, t);
|
|
227
|
+
}
|
|
228
|
+
if (t.globalAlpha = Math.min(1, b), j > .6) {
|
|
229
|
+
let e = Math.cos(M), n = Math.sin(M);
|
|
230
|
+
t.setTransform(e * J, n * J, -n * J, e * J, (o.x - e * j / 2) * J, (o.y - n * j / 2) * J), t.drawImage(T, -(j + D) / 2, -D / 2, j + D, D), t.setTransform(J, 0, 0, J, 0, 0);
|
|
231
|
+
} else t.drawImage(T, o.x - D / 2, o.y - D / 2, D, D);
|
|
232
|
+
if (C > .02 && O) {
|
|
233
|
+
let r = C * H * _, s = G * (.55 + .45 * n.size) * Math.sqrt(p) * (.4 + .6 * C), c = Math.min(i.coreMax, Math.max(i.coreMin, g * i.coreScale)) * (.55 + .45 * C);
|
|
234
|
+
if (t.globalAlpha = Math.min(1, r * 1.15), k) {
|
|
235
|
+
let e = c * i.glowScale;
|
|
236
|
+
t.drawImage(k, o.x - e, o.y - e, e * 2, e * 2);
|
|
237
|
+
}
|
|
238
|
+
t.drawImage(O, o.x - c, o.y - c, c * 2, c * 2);
|
|
239
|
+
let l = Math.max(.45, g * i.rayWidth), u = t.globalAlpha;
|
|
240
|
+
for (let [r, i, c] of a) {
|
|
241
|
+
t.globalAlpha = u * i;
|
|
242
|
+
let a = s * c;
|
|
243
|
+
for (let i = 0; i < 4; i++) {
|
|
244
|
+
let s = n.rayAngle + i * Math.PI / 2, c = Math.cos(s), u = Math.sin(s), f = t.createLinearGradient(o.x, o.y, o.x + c * a, o.y + u * a);
|
|
245
|
+
f.addColorStop(0, e(d.colors[0], 1)), f.addColorStop(.35, e(d.colors[0], .55)), f.addColorStop(1, e(d.colors[0], 0)), t.fillStyle = f, t.beginPath(), t.moveTo(o.x - u * l * r, o.y + c * l * r), t.lineTo(o.x + c * a, o.y + u * a), t.lineTo(o.x + u * l * r, o.y - c * l * r), t.closePath(), t.fill();
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
t.restore();
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
export { r as GLIMMER_DEFAULTS, u as createGlimmerRenderer };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BOFF-15169: animated backgrounds, opt-in (`@burdenoff/fe-libs/shared/backgrounds`).
|
|
3
|
+
*
|
|
4
|
+
* - `DottedWaves`, `Glimmer`, `CursorWave`: full-bleed canvas backgrounds, after the React Bits
|
|
5
|
+
* Pro effects' look and documented parameters (written from scratch), plus `colors` and
|
|
6
|
+
* `strength`. `BackgroundEffect` renders one by name.
|
|
7
|
+
* - `useBackgroundColors`: their colours from the theme (the accent, a custom accent too), the
|
|
8
|
+
* originals' colours, or greys, right on light and dark pages. `useBackgroundGround`: the
|
|
9
|
+
* ground the originals' colours come with (their black on a dark page, white on a light one).
|
|
10
|
+
* - `useBackgroundPreference`: the person's choice, per device (default: Dotted waves, accent,
|
|
11
|
+
* subtle).
|
|
12
|
+
* - `BackgroundPicker`, `BackgroundOptionGroup`: choosing one, with live previews.
|
|
13
|
+
*
|
|
14
|
+
* Nothing changes for a product that does not render them.
|
|
15
|
+
*/
|
|
16
|
+
export * from './backgroundTypes';
|
|
17
|
+
export { DottedWaves, DOTTED_WAVES_STILL_TIME, type DottedWavesHandle, type DottedWavesProps, } from './DottedWaves';
|
|
18
|
+
export { Glimmer, type GlimmerHandle, type GlimmerProps } from './Glimmer';
|
|
19
|
+
export { CursorWave, type CursorWaveHandle, type CursorWaveProps } from './CursorWave';
|
|
20
|
+
export { explicitPool, type CursorWaveColorInput } from './cursorWavePool';
|
|
21
|
+
export { BackgroundEffect, type BackgroundEffectProps } from './BackgroundEffect';
|
|
22
|
+
export { BackgroundOptionGroup, BackgroundPicker, useRovingRadio, type BackgroundOption, type BackgroundOptionGroupProps, type BackgroundPickerProps, } from './BackgroundPicker';
|
|
23
|
+
export { backgroundPalette, readBackgroundTheme, subscribeBackgroundTheme, turnHue, useBackgroundColors, useBackgroundTheme, type BackgroundPalette, type BackgroundTheme, } from './useBackgroundColors';
|
|
24
|
+
export { backgroundGround, useBackgroundGround } from './backgroundGround';
|
|
25
|
+
export { BACKGROUND_PREFERENCE_KEY, DEFAULT_BACKGROUND_PREFERENCE, readBackgroundPreference, useBackgroundPreference, type BackgroundPreference, type BackgroundPreferenceControls, type UseBackgroundPreferenceOptions, } from './useBackgroundPreference';
|
|
26
|
+
export { CURSOR_WAVE_BACKGROUND, CURSOR_WAVE_COLORS, DOTTED_WAVES_BACKGROUND, DOTTED_WAVES_COLORS, GLIMMER_BACKGROUND, GLIMMER_COLORS, ORIGINAL_LIGHT_BACKGROUND, } from './originalPalettes';
|
|
27
|
+
export { DOTTED_WAVES_DEFAULTS, type DottedWavesColorBy, type DottedWavesParams, type DottedWavesPattern, type DottedWavesShape, } from './dottedWavesRenderer';
|
|
28
|
+
export { GLIMMER_DEFAULTS, type GlimmerDirection, type GlimmerParams } from './glimmerRenderer';
|
|
29
|
+
export { CURSOR_WAVE_DEFAULTS, type CursorWaveColor, type CursorWaveParams, type CursorWaveShape, } from './cursorWaveRenderer';
|
|
30
|
+
export { canvasScale, type CanvasFrame, type CanvasRenderer } from './canvasEffect';
|
|
31
|
+
export type { Rgba } from './color';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BOFF-15169: smooth 3D gradient noise (simplex) for the animated backgrounds, and a small
|
|
3
|
+
* deterministic random source, so every effect draws the same field for the same seed (a still
|
|
4
|
+
* frame under reduced motion, a test, a preview and the page agree).
|
|
5
|
+
*
|
|
6
|
+
* Written for these effects from the published simplex-noise construction (skewed simplex
|
|
7
|
+
* lattice, 12 edge gradients, r² = 0.6 kernel); values are in [-1, 1].
|
|
8
|
+
*/
|
|
9
|
+
/** A seeded pseudo-random source (mulberry32): `next()` is uniform in [0, 1). */
|
|
10
|
+
export declare function createRandom(seed: number): () => number;
|
|
11
|
+
/** A 3D simplex noise function for one seed. */
|
|
12
|
+
export type Noise3 = (x: number, y: number, z: number) => number;
|
|
13
|
+
export declare function createNoise3(seed: number): Noise3;
|
|
14
|
+
/**
|
|
15
|
+
* The noise sampled on planes across its lattice rather than along it: x and y are turned so the
|
|
16
|
+
* plane is perpendicular to the lattice's main diagonal (the orientation 2D-plus-time simplex
|
|
17
|
+
* noise uses), so a still 2D field shows round features with no diagonal grain.
|
|
18
|
+
*/
|
|
19
|
+
export declare function planarNoise(noise: Noise3): Noise3;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
// src/shared/backgrounds/noise.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
let t = e >>> 0;
|
|
4
|
+
return () => {
|
|
5
|
+
t = t + 1831565813 >>> 0;
|
|
6
|
+
let e = t;
|
|
7
|
+
return e = Math.imul(e ^ e >>> 15, e | 1), e ^= e + Math.imul(e ^ e >>> 7, e | 61), ((e ^ e >>> 14) >>> 0) / 4294967296;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
var t = [
|
|
11
|
+
[
|
|
12
|
+
1,
|
|
13
|
+
1,
|
|
14
|
+
0
|
|
15
|
+
],
|
|
16
|
+
[
|
|
17
|
+
-1,
|
|
18
|
+
1,
|
|
19
|
+
0
|
|
20
|
+
],
|
|
21
|
+
[
|
|
22
|
+
1,
|
|
23
|
+
-1,
|
|
24
|
+
0
|
|
25
|
+
],
|
|
26
|
+
[
|
|
27
|
+
-1,
|
|
28
|
+
-1,
|
|
29
|
+
0
|
|
30
|
+
],
|
|
31
|
+
[
|
|
32
|
+
1,
|
|
33
|
+
0,
|
|
34
|
+
1
|
|
35
|
+
],
|
|
36
|
+
[
|
|
37
|
+
-1,
|
|
38
|
+
0,
|
|
39
|
+
1
|
|
40
|
+
],
|
|
41
|
+
[
|
|
42
|
+
1,
|
|
43
|
+
0,
|
|
44
|
+
-1
|
|
45
|
+
],
|
|
46
|
+
[
|
|
47
|
+
-1,
|
|
48
|
+
0,
|
|
49
|
+
-1
|
|
50
|
+
],
|
|
51
|
+
[
|
|
52
|
+
0,
|
|
53
|
+
1,
|
|
54
|
+
1
|
|
55
|
+
],
|
|
56
|
+
[
|
|
57
|
+
0,
|
|
58
|
+
-1,
|
|
59
|
+
1
|
|
60
|
+
],
|
|
61
|
+
[
|
|
62
|
+
0,
|
|
63
|
+
1,
|
|
64
|
+
-1
|
|
65
|
+
],
|
|
66
|
+
[
|
|
67
|
+
0,
|
|
68
|
+
-1,
|
|
69
|
+
-1
|
|
70
|
+
]
|
|
71
|
+
], n = 1 / 3, r = 1 / 6;
|
|
72
|
+
function i(i) {
|
|
73
|
+
let a = e(i), o = /* @__PURE__ */ new Uint8Array(512), s = /* @__PURE__ */ new Uint8Array(256);
|
|
74
|
+
for (let e = 0; e < 256; e++) s[e] = e;
|
|
75
|
+
for (let e = 255; e > 0; e--) {
|
|
76
|
+
let t = Math.floor(a() * (e + 1)), n = s[e];
|
|
77
|
+
s[e] = s[t], s[t] = n;
|
|
78
|
+
}
|
|
79
|
+
for (let e = 0; e < 512; e++) o[e] = s[e & 255];
|
|
80
|
+
let c = /* @__PURE__ */ new Uint8Array(512);
|
|
81
|
+
for (let e = 0; e < 512; e++) c[e] = o[e] % 12;
|
|
82
|
+
let l = (e, n, r, i) => {
|
|
83
|
+
let a = .6 - n * n - r * r - i * i;
|
|
84
|
+
if (a < 0) return 0;
|
|
85
|
+
let o = t[e], s = a * a;
|
|
86
|
+
return s * s * (o[0] * n + o[1] * r + o[2] * i);
|
|
87
|
+
};
|
|
88
|
+
return (e, t, i) => {
|
|
89
|
+
let a = (e + t + i) * n, s = Math.floor(e + a), u = Math.floor(t + a), d = Math.floor(i + a), f = (s + u + d) * r, p = e - (s - f), m = t - (u - f), h = i - (d - f), g, _, v, y, b, x;
|
|
90
|
+
p >= m ? m >= h ? [g, _, v, y, b, x] = [
|
|
91
|
+
1,
|
|
92
|
+
0,
|
|
93
|
+
0,
|
|
94
|
+
1,
|
|
95
|
+
1,
|
|
96
|
+
0
|
|
97
|
+
] : p >= h ? [g, _, v, y, b, x] = [
|
|
98
|
+
1,
|
|
99
|
+
0,
|
|
100
|
+
0,
|
|
101
|
+
1,
|
|
102
|
+
0,
|
|
103
|
+
1
|
|
104
|
+
] : [g, _, v, y, b, x] = [
|
|
105
|
+
0,
|
|
106
|
+
0,
|
|
107
|
+
1,
|
|
108
|
+
1,
|
|
109
|
+
0,
|
|
110
|
+
1
|
|
111
|
+
] : m < h ? [g, _, v, y, b, x] = [
|
|
112
|
+
0,
|
|
113
|
+
0,
|
|
114
|
+
1,
|
|
115
|
+
0,
|
|
116
|
+
1,
|
|
117
|
+
1
|
|
118
|
+
] : p < h ? [g, _, v, y, b, x] = [
|
|
119
|
+
0,
|
|
120
|
+
1,
|
|
121
|
+
0,
|
|
122
|
+
0,
|
|
123
|
+
1,
|
|
124
|
+
1
|
|
125
|
+
] : [g, _, v, y, b, x] = [
|
|
126
|
+
0,
|
|
127
|
+
1,
|
|
128
|
+
0,
|
|
129
|
+
1,
|
|
130
|
+
1,
|
|
131
|
+
0
|
|
132
|
+
];
|
|
133
|
+
let S = p - g + r, C = m - _ + r, w = h - v + r, T = p - y + 2 * r, E = m - b + 2 * r, D = h - x + 2 * r, O = p - 1 + 3 * r, k = m - 1 + 3 * r, A = h - 1 + 3 * r, j = s & 255, M = u & 255, N = d & 255;
|
|
134
|
+
return 32 * (l(c[j + o[M + o[N]]], p, m, h) + l(c[j + g + o[M + _ + o[N + v]]], S, C, w) + l(c[j + y + o[M + b + o[N + x]]], T, E, D) + l(c[j + 1 + o[M + 1 + o[N + 1]]], O, k, A));
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function a(e) {
|
|
138
|
+
return (t, n, r) => {
|
|
139
|
+
let i = t + n, a = i * -.211324865405187, o = r * .577350269189626;
|
|
140
|
+
return e(t + a - o, n + a - o, i * .577350269189626 + o);
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
export { i as createNoise3, e as createRandom, a as planarNoise };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BOFF-15169: the originals' own colours, as DATA. The "Original" colour choice draws the
|
|
3
|
+
* effects in exactly the colours their public demos document (Dotted Waves' back and front
|
|
4
|
+
* colours, Glimmer's A and B, Cursor Wave's pool, measured from its frames), so these are plain
|
|
5
|
+
* colour values, not UI styling, and this one data file is exempt from the raw-colour guard (as
|
|
6
|
+
* `src/tag/tagPalette.ts` is). Everything that draws them on a page goes through
|
|
7
|
+
* `useBackgroundColors`, which also gives them their light-page inks.
|
|
8
|
+
*/
|
|
9
|
+
/** Dotted Waves: back, front. */
|
|
10
|
+
export declare const DOTTED_WAVES_COLORS: readonly ["#5227FF", "#B19EEF"];
|
|
11
|
+
/** Dotted Waves' demo background. */
|
|
12
|
+
export declare const DOTTED_WAVES_BACKGROUND = "#0A0A0A";
|
|
13
|
+
/** Glimmer: colours A and B. */
|
|
14
|
+
export declare const GLIMMER_COLORS: readonly ["#FFFFFF", "#B19EEF"];
|
|
15
|
+
/** Glimmer's demo background. */
|
|
16
|
+
export declare const GLIMMER_BACKGROUND = "#0A0A0A";
|
|
17
|
+
/**
|
|
18
|
+
* Cursor Wave's pool, measured from the demo's frames (twelve solids and five gradients): the
|
|
19
|
+
* yellows, oranges, reds, pinks, violets, blues, cyans, greens and the grey it uses.
|
|
20
|
+
*/
|
|
21
|
+
export declare const CURSOR_WAVE_COLORS: readonly (string | {
|
|
22
|
+
stops: readonly [string, string];
|
|
23
|
+
})[];
|
|
24
|
+
/** Cursor Wave's demo background. */
|
|
25
|
+
export declare const CURSOR_WAVE_BACKGROUND = "#080808";
|
|
26
|
+
/**
|
|
27
|
+
* The original colours' ground on a light page: a clean white. The originals' docs name only
|
|
28
|
+
* their dark backgrounds (Dotted Waves #0a0a0a, Cursor Wave #080808, Glimmer transparent), and
|
|
29
|
+
* their colours turn into inks on light backgrounds.
|
|
30
|
+
*/
|
|
31
|
+
export declare const ORIGINAL_LIGHT_BACKGROUND = "#FFFFFF";
|
|
32
|
+
/** The inks greys are drawn from when the theme's text colour cannot be read. */
|
|
33
|
+
export declare const FALLBACK_INK: {
|
|
34
|
+
readonly onDark: "#FFFFFF";
|
|
35
|
+
readonly onLight: "#18181B";
|
|
36
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// src/shared/backgrounds/originalPalettes.ts
|
|
2
|
+
var e = ["#5227FF", "#B19EEF"], t = "#0A0A0A", n = ["#FFFFFF", "#B19EEF"], r = "#0A0A0A", i = [
|
|
3
|
+
"#FACC15",
|
|
4
|
+
"#F97316",
|
|
5
|
+
"#EF4444",
|
|
6
|
+
"#EC4899",
|
|
7
|
+
"#A78BFA",
|
|
8
|
+
"#5472F5",
|
|
9
|
+
"#3B82F6",
|
|
10
|
+
"#60A5FA",
|
|
11
|
+
"#06B6D4",
|
|
12
|
+
"#34D399",
|
|
13
|
+
"#22C55E",
|
|
14
|
+
"#9CA3AF",
|
|
15
|
+
{ stops: ["#FB923C", "#EA580C"] },
|
|
16
|
+
{ stops: ["#38BDF8", "#2563EB"] },
|
|
17
|
+
{ stops: ["#2DD4BF", "#22C55E"] },
|
|
18
|
+
{ stops: ["#F472B6", "#DB2777"] },
|
|
19
|
+
{ stops: ["#818CF8", "#4F46E5"] }
|
|
20
|
+
], a = "#080808", o = "#FFFFFF", s = {
|
|
21
|
+
onDark: "#FFFFFF",
|
|
22
|
+
onLight: "#18181B"
|
|
23
|
+
};
|
|
24
|
+
export { a as CURSOR_WAVE_BACKGROUND, i as CURSOR_WAVE_COLORS, t as DOTTED_WAVES_BACKGROUND, e as DOTTED_WAVES_COLORS, s as FALLBACK_INK, r as GLIMMER_BACKGROUND, n as GLIMMER_COLORS, o as ORIGINAL_LIGHT_BACKGROUND };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { BackgroundColorMode } from './backgroundTypes';
|
|
2
|
+
import { Rgba } from './color';
|
|
3
|
+
import { CursorWaveColor } from './cursorWaveRenderer';
|
|
4
|
+
/** Resolved colours for every effect. */
|
|
5
|
+
export interface BackgroundPalette {
|
|
6
|
+
/** The page reads light (the effects draw inks rather than light). */
|
|
7
|
+
light: boolean;
|
|
8
|
+
/** Dotted Waves: back, front. */
|
|
9
|
+
dottedWaves: readonly [Rgba, Rgba];
|
|
10
|
+
/** Glimmer: colours A and B. */
|
|
11
|
+
glimmer: readonly [Rgba, Rgba];
|
|
12
|
+
/** Cursor Wave: its pool. */
|
|
13
|
+
cursorWave: readonly CursorWaveColor[];
|
|
14
|
+
}
|
|
15
|
+
/** The theme, as far as the palettes need it. */
|
|
16
|
+
export interface BackgroundTheme {
|
|
17
|
+
light: boolean;
|
|
18
|
+
/** The accent the effects take (null: none could be read). */
|
|
19
|
+
accent: Rgba | null;
|
|
20
|
+
/** A second accent beside it (null: one is derived from the first). */
|
|
21
|
+
accentAlt: Rgba | null;
|
|
22
|
+
/** The theme's text colour (null: none could be read). */
|
|
23
|
+
text: Rgba | null;
|
|
24
|
+
}
|
|
25
|
+
/** The colour with its hue turned by `degrees` (OKLab), lightness and chroma kept. */
|
|
26
|
+
export declare function turnHue(color: Rgba, degrees: number): Rgba;
|
|
27
|
+
/** The palette for a mode and a theme (pure: no DOM). */
|
|
28
|
+
export declare function backgroundPalette(mode: BackgroundColorMode, theme: BackgroundTheme): BackgroundPalette;
|
|
29
|
+
/** The theme as the document's root shows it now. */
|
|
30
|
+
export declare function readBackgroundTheme(root: HTMLElement | null): BackgroundTheme;
|
|
31
|
+
/** Calls `onChange` when the theme may have changed. Returns the cleanup. */
|
|
32
|
+
export declare function subscribeBackgroundTheme(root: HTMLElement, onChange: () => void): () => void;
|
|
33
|
+
/** The theme as the document's root shows it, kept current as it changes. */
|
|
34
|
+
export declare function useBackgroundTheme(): BackgroundTheme;
|
|
35
|
+
/**
|
|
36
|
+
* The palette for `mode`, following the theme. `backdrop`: the colour the effect is drawn on, when
|
|
37
|
+
* it has one of its own (an effect's opaque `backgroundColor`); it decides light or dark instead
|
|
38
|
+
* of the page's canvas, as the originals read their own background.
|
|
39
|
+
*/
|
|
40
|
+
export declare function useBackgroundColors(mode: BackgroundColorMode, backdrop?: string): BackgroundPalette;
|