@tsogtoodev/shingen-metal 1.0.0 → 1.0.1
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 +37 -37
- package/dist/index.cjs.js +5 -105
- package/dist/index.d.ts +52 -205
- package/dist/index.es.js +658 -771
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
function
|
|
3
|
-
let
|
|
4
|
-
return
|
|
5
|
-
}
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
const n = Math.max(
|
|
1
|
+
import { defineComponent as ge, ref as V, computed as ut, watch as D, onMounted as Qt, nextTick as Tt, onBeforeUnmount as Zt, openBlock as xe, createElementBlock as ve, normalizeStyle as Et, unref as _e, createElementVNode as et, renderSlot as be, toValue as we } from "vue";
|
|
2
|
+
function ye(t) {
|
|
3
|
+
let e = t.replace("#", "");
|
|
4
|
+
return e.length === 3 && (e = e[0] + e[0] + e[1] + e[1] + e[2] + e[2]), [parseInt(e.slice(0, 2), 16) / 255, parseInt(e.slice(2, 4), 16) / 255, parseInt(e.slice(4, 6), 16) / 255];
|
|
5
|
+
}
|
|
6
|
+
function Me(t, e, o) {
|
|
7
|
+
t /= 255, e /= 255, o /= 255;
|
|
8
|
+
const n = Math.max(t, e, o), a = Math.min(t, e, o), r = n - a;
|
|
9
9
|
let s = 0;
|
|
10
10
|
const c = n === 0 ? 0 : r / n;
|
|
11
|
-
return r !== 0 && (n ===
|
|
11
|
+
return r !== 0 && (n === t ? s = ((e - o) / r + 6) % 6 : n === e ? s = (o - t) / r + 2 : s = (t - e) / r + 4, s /= 6), [s, c, n];
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
const n = Math.floor(
|
|
15
|
-
let l = 0,
|
|
13
|
+
function Re(t, e, o) {
|
|
14
|
+
const n = Math.floor(t * 6), a = t * 6 - n, r = o * (1 - e), s = o * (1 - a * e), c = o * (1 - (1 - a) * e);
|
|
15
|
+
let l = 0, f = 0, d = 0;
|
|
16
16
|
switch (n % 6) {
|
|
17
17
|
case 0:
|
|
18
|
-
l =
|
|
18
|
+
l = o, f = c, d = r;
|
|
19
19
|
break;
|
|
20
20
|
case 1:
|
|
21
|
-
l = s,
|
|
21
|
+
l = s, f = o, d = r;
|
|
22
22
|
break;
|
|
23
23
|
case 2:
|
|
24
|
-
l = r,
|
|
24
|
+
l = r, f = o, d = c;
|
|
25
25
|
break;
|
|
26
26
|
case 3:
|
|
27
|
-
l = r,
|
|
27
|
+
l = r, f = s, d = o;
|
|
28
28
|
break;
|
|
29
29
|
case 4:
|
|
30
|
-
l = c,
|
|
30
|
+
l = c, f = r, d = o;
|
|
31
31
|
break;
|
|
32
32
|
case 5:
|
|
33
|
-
l =
|
|
33
|
+
l = o, f = r, d = s;
|
|
34
34
|
break;
|
|
35
35
|
}
|
|
36
|
-
return [Math.round(l * 255), Math.round(
|
|
36
|
+
return [Math.round(l * 255), Math.round(f * 255), Math.round(d * 255)];
|
|
37
37
|
}
|
|
38
|
-
const
|
|
38
|
+
const Ae = 66, Se = 66, Ce = 1500, Te = 1, kt = 16, Ee = 16, ke = 8, Ie = 96, Le = 2, Oe = {
|
|
39
39
|
name: "chromatic",
|
|
40
40
|
modes: {
|
|
41
41
|
dark: {
|
|
@@ -71,7 +71,7 @@ const Rt = 66, At = 66, Tt = 1500, Ct = 1, Ee = 16, kt = 16, Et = 8, Lt = 96, Ot
|
|
|
71
71
|
shaderOpacity: 1
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
},
|
|
74
|
+
}, Pe = {
|
|
75
75
|
name: "silver",
|
|
76
76
|
modes: {
|
|
77
77
|
dark: {
|
|
@@ -107,7 +107,7 @@ const Rt = 66, At = 66, Tt = 1500, Ct = 1, Ee = 16, kt = 16, Et = 8, Lt = 96, Ot
|
|
|
107
107
|
shaderOpacity: 1
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
},
|
|
110
|
+
}, Fe = {
|
|
111
111
|
name: "gold",
|
|
112
112
|
modes: {
|
|
113
113
|
dark: {
|
|
@@ -143,19 +143,14 @@ const Rt = 66, At = 66, Tt = 1500, Ct = 1, Ee = 16, kt = 16, Et = 8, Lt = 96, Ot
|
|
|
143
143
|
shaderOpacity: 1
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
-
},
|
|
147
|
-
chromatic:
|
|
148
|
-
silver:
|
|
149
|
-
gold:
|
|
150
|
-
}, $
|
|
151
|
-
/* glsl */
|
|
152
|
-
`
|
|
146
|
+
}, Jt = {
|
|
147
|
+
chromatic: Oe,
|
|
148
|
+
silver: Pe,
|
|
149
|
+
gold: Fe
|
|
150
|
+
}, $e = `
|
|
153
151
|
attribute vec2 a_position;
|
|
154
152
|
void main() { gl_Position = vec4(a_position, 0.0, 1.0); }
|
|
155
|
-
`
|
|
156
|
-
), Ht = (
|
|
157
|
-
/* glsl */
|
|
158
|
-
`
|
|
153
|
+
`, He = `
|
|
159
154
|
precision highp float;
|
|
160
155
|
|
|
161
156
|
uniform vec2 u_resolution;
|
|
@@ -207,8 +202,6 @@ const Rt = 66, At = 66, Tt = 1500, Ct = 1, Ee = 16, kt = 16, Et = 8, Lt = 96, Ot
|
|
|
207
202
|
|
|
208
203
|
float nfbm(vec2 p) { return fbm(p, 3.0 + u_complexity * 4.0); }
|
|
209
204
|
|
|
210
|
-
/* 5-stop palette used by effect 1 (Plasma) — direct port of \`palette\` from
|
|
211
|
-
* the canonical engine. Stops at t = 0, 0.25, 0.5, 0.75, 1.0. */
|
|
212
205
|
vec3 palette(float t) {
|
|
213
206
|
t = clamp(t, 0.0, 1.0);
|
|
214
207
|
t = t * t * (3.0 - 2.0 * t);
|
|
@@ -223,10 +216,6 @@ const Rt = 66, At = 66, Tt = 1500, Ct = 1, Ee = 16, kt = 16, Et = 8, Lt = 96, Ot
|
|
|
223
216
|
u_color4 * w4 + u_color5 * w5) / total;
|
|
224
217
|
}
|
|
225
218
|
|
|
226
|
-
/* Per-pixel alpha that re-introduces transparency when the user dials any
|
|
227
|
-
* palette stop's alpha below 1. Same \`paletteAlpha\` from the canonical
|
|
228
|
-
* engine. With every preset shipping all-1 alphas, this returns ~1 for every
|
|
229
|
-
* pixel — but mirroring it keeps custom-preset behaviour identical. */
|
|
230
219
|
float paletteAlpha(float t) {
|
|
231
220
|
t = clamp(t, 0.0, 1.0);
|
|
232
221
|
t = t * t * (3.0 - 2.0 * t);
|
|
@@ -254,8 +243,6 @@ const Rt = 66, At = 66, Tt = 1500, Ct = 1, Ee = 16, kt = 16, Et = 8, Lt = 96, Ot
|
|
|
254
243
|
) * str;
|
|
255
244
|
}
|
|
256
245
|
|
|
257
|
-
/* Plasma: four sine bands warped by an FBM field, mapped through the
|
|
258
|
-
* 5-stop palette. Identical to effect 1 in the canonical engine. */
|
|
259
246
|
vec3 computeEffect(vec2 uv, float aspect, float t, float dist, float cpx) {
|
|
260
247
|
vec2 p = (uv - 0.5) * u_scale;
|
|
261
248
|
p.x *= aspect;
|
|
@@ -277,15 +264,10 @@ const Rt = 66, At = 66, Tt = 1500, Ct = 1, Ee = 16, kt = 16, Et = 8, Lt = 96, Ot
|
|
|
277
264
|
void main() {
|
|
278
265
|
vec2 uv = gl_FragCoord.xy / u_resolution;
|
|
279
266
|
float aspect = u_resolution.x / u_resolution.y;
|
|
280
|
-
float t = u_time;
|
|
267
|
+
float t = u_time;
|
|
281
268
|
float dist = u_distortion;
|
|
282
269
|
float cpx = u_complexity;
|
|
283
270
|
|
|
284
|
-
/* 5-tap cross blur (center + cardinal offsets). The chromatic/silver/gold
|
|
285
|
-
* presets all ship with blur=1 so this path is always active. 5 taps
|
|
286
|
-
* instead of the canonical engine's 9 saves ~44% fragment work; the
|
|
287
|
-
* perceptual difference is nil because the output is already soft from
|
|
288
|
-
* the plasma's low spatial frequency and CSS blur on reflections. */
|
|
289
271
|
vec3 col;
|
|
290
272
|
if (u_blur < 0.01) {
|
|
291
273
|
col = computeEffect(uv, aspect, t, dist, cpx);
|
|
@@ -298,13 +280,8 @@ const Rt = 66, At = 66, Tt = 1500, Ct = 1, Ee = 16, kt = 16, Et = 8, Lt = 96, Ot
|
|
|
298
280
|
col += computeEffect(uv + vec2(0.0, -r), aspect, t, dist, cpx) * 0.15;
|
|
299
281
|
}
|
|
300
282
|
|
|
301
|
-
/* Gamma punch — adds the contrast pop that defines the chromatic
|
|
302
|
-
* highlights. From the canonical engine: \`col = pow(col, vec3(1.3))\`. */
|
|
303
283
|
col = pow(col, vec3(1.3));
|
|
304
284
|
|
|
305
|
-
/* Vignette — soft edge darkening so corners read as recessed. The 40-px
|
|
306
|
-
* scale at the bottom of the formula is hard-coded in the canonical
|
|
307
|
-
* engine; we keep it for visual parity. */
|
|
308
285
|
float edgeDist = min(min(uv.x, 1.0 - uv.x), min(uv.y, 1.0 - uv.y));
|
|
309
286
|
float vigPx = 40.0 / min(u_resolution.x, u_resolution.y);
|
|
310
287
|
float vigRange = vigPx * (1.0 + u_vignette * 3.0);
|
|
@@ -312,9 +289,6 @@ const Rt = 66, At = 66, Tt = 1500, Ct = 1, Ee = 16, kt = 16, Et = 8, Lt = 96, Ot
|
|
|
312
289
|
vig = smoothstep(0.0, 1.0, vig);
|
|
313
290
|
col *= mix(1.0, vig, u_vignette * u_vigOpacity);
|
|
314
291
|
|
|
315
|
-
/* Per-pixel alpha. With all-1 alphas the formula collapses to ~1 but the
|
|
316
|
-
* computation matches the canonical engine so custom presets behave the
|
|
317
|
-
* same. */
|
|
318
292
|
float colorAlpha = (u_alpha1 + u_alpha2 + u_alpha3 + u_alpha4 + u_alpha5) / 5.0;
|
|
319
293
|
if (colorAlpha < 0.999) {
|
|
320
294
|
vec3 c1d = col - u_color1, c2d = col - u_color2, c3d = col - u_color3,
|
|
@@ -330,41 +304,37 @@ const Rt = 66, At = 66, Tt = 1500, Ct = 1, Ee = 16, kt = 16, Et = 8, Lt = 96, Ot
|
|
|
330
304
|
}
|
|
331
305
|
float alpha = colorAlpha;
|
|
332
306
|
|
|
333
|
-
/* Touch the unused-at-effect-1 uniforms so GL drivers that complain about
|
|
334
|
-
* declared-but-unread uniforms (some Mali / Adreno builds do) keep them
|
|
335
|
-
* live. The contribution is provably zero. */
|
|
336
307
|
alpha += 0.0 * (u_softness + u_shape +
|
|
337
308
|
u_alpha6 + u_alpha7 +
|
|
338
309
|
u_color6.x + u_color7.x);
|
|
339
310
|
|
|
340
311
|
gl_FragColor = vec4(col, alpha * u_shaderOpacity);
|
|
341
312
|
}
|
|
342
|
-
|
|
343
|
-
)
|
|
344
|
-
|
|
345
|
-
const n = e.createShader(t);
|
|
313
|
+
`;
|
|
314
|
+
function It(t, e, o) {
|
|
315
|
+
const n = t.createShader(e);
|
|
346
316
|
if (!n) throw new Error("metal-fx: gl.createShader returned null");
|
|
347
|
-
if (
|
|
348
|
-
const
|
|
349
|
-
throw
|
|
317
|
+
if (t.shaderSource(n, o), t.compileShader(n), !t.getShaderParameter(n, t.COMPILE_STATUS)) {
|
|
318
|
+
const a = t.getShaderInfoLog(n);
|
|
319
|
+
throw t.deleteShader(n), new Error(`metal-fx: shader compile failed: ${a ?? "(no info log)"}`);
|
|
350
320
|
}
|
|
351
321
|
return n;
|
|
352
322
|
}
|
|
353
|
-
function
|
|
354
|
-
const n =
|
|
323
|
+
function Ne(t, e, o) {
|
|
324
|
+
const n = t.createProgram();
|
|
355
325
|
if (!n) throw new Error("metal-fx: gl.createProgram returned null");
|
|
356
|
-
if (
|
|
357
|
-
const
|
|
358
|
-
throw
|
|
326
|
+
if (t.attachShader(n, e), t.attachShader(n, o), t.linkProgram(n), !t.getProgramParameter(n, t.LINK_STATUS)) {
|
|
327
|
+
const a = t.getProgramInfoLog(n);
|
|
328
|
+
throw t.deleteProgram(n), new Error(`metal-fx: program link failed: ${a ?? "(no info log)"}`);
|
|
359
329
|
}
|
|
360
330
|
return n;
|
|
361
331
|
}
|
|
362
|
-
const
|
|
363
|
-
let i = null,
|
|
364
|
-
function
|
|
365
|
-
|
|
332
|
+
const te = 140, ee = 40, oe = 1.6, ne = 1.3;
|
|
333
|
+
let i = null, nt = null;
|
|
334
|
+
function We(t) {
|
|
335
|
+
nt = t;
|
|
366
336
|
}
|
|
367
|
-
const
|
|
337
|
+
const Ge = [
|
|
368
338
|
"u_resolution",
|
|
369
339
|
"u_time",
|
|
370
340
|
"u_color1",
|
|
@@ -393,430 +363,427 @@ const Wt = [
|
|
|
393
363
|
"u_blur",
|
|
394
364
|
"u_shaderOpacity"
|
|
395
365
|
];
|
|
396
|
-
function
|
|
397
|
-
|
|
398
|
-
const
|
|
399
|
-
|
|
400
|
-
const
|
|
401
|
-
if (!
|
|
402
|
-
|
|
403
|
-
const r =
|
|
404
|
-
|
|
366
|
+
function Lt(t) {
|
|
367
|
+
t.enable(t.BLEND), t.blendFunc(t.SRC_ALPHA, t.ONE_MINUS_SRC_ALPHA);
|
|
368
|
+
const e = It(t, t.VERTEX_SHADER, $e), o = It(t, t.FRAGMENT_SHADER, He), n = Ne(t, e, o);
|
|
369
|
+
t.useProgram(n);
|
|
370
|
+
const a = t.createBuffer();
|
|
371
|
+
if (!a) throw new Error("metal-fx: gl.createBuffer returned null");
|
|
372
|
+
t.bindBuffer(t.ARRAY_BUFFER, a), t.bufferData(t.ARRAY_BUFFER, new Float32Array([-1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1]), t.STATIC_DRAW);
|
|
373
|
+
const r = t.getAttribLocation(n, "a_position");
|
|
374
|
+
t.enableVertexAttribArray(r), t.vertexAttribPointer(r, 2, t.FLOAT, !1, 0, 0);
|
|
405
375
|
const s = {};
|
|
406
|
-
for (const c of
|
|
407
|
-
return { program: n, buffer:
|
|
376
|
+
for (const c of Ge) s[c] = t.getUniformLocation(n, c);
|
|
377
|
+
return { program: n, buffer: a, uniforms: s };
|
|
408
378
|
}
|
|
409
|
-
function
|
|
379
|
+
function ae() {
|
|
410
380
|
if (i) return i;
|
|
411
|
-
const
|
|
412
|
-
let n,
|
|
413
|
-
if (
|
|
414
|
-
n = new OffscreenCanvas(
|
|
381
|
+
const t = Math.min(Le, typeof window < "u" && window.devicePixelRatio || 1), e = Math.round(Ie * t), o = typeof OffscreenCanvas < "u";
|
|
382
|
+
let n, a;
|
|
383
|
+
if (o)
|
|
384
|
+
n = new OffscreenCanvas(e, e), a = n.getContext("webgl", {
|
|
415
385
|
alpha: !0,
|
|
416
386
|
premultipliedAlpha: !1,
|
|
417
387
|
antialias: !1
|
|
418
388
|
});
|
|
419
389
|
else {
|
|
420
|
-
const
|
|
421
|
-
|
|
390
|
+
const d = document.createElement("canvas");
|
|
391
|
+
d.width = e, d.height = e, a = d.getContext("webgl", {
|
|
422
392
|
alpha: !0,
|
|
423
393
|
premultipliedAlpha: !1,
|
|
424
394
|
antialias: !1,
|
|
425
395
|
preserveDrawingBuffer: !0
|
|
426
|
-
}) ??
|
|
396
|
+
}) ?? d.getContext("experimental-webgl"), n = d;
|
|
427
397
|
}
|
|
428
|
-
if (!
|
|
429
|
-
const { program: r, buffer: s, uniforms: c } =
|
|
430
|
-
|
|
431
|
-
},
|
|
398
|
+
if (!a) throw new Error("metal-fx: WebGL not supported");
|
|
399
|
+
const { program: r, buffer: s, uniforms: c } = Lt(a), l = (d) => {
|
|
400
|
+
d.preventDefault(), i && (i.contextLost = !0);
|
|
401
|
+
}, f = () => {
|
|
432
402
|
if (!i) return;
|
|
433
|
-
const
|
|
434
|
-
i.program =
|
|
403
|
+
const d = Lt(i.gl);
|
|
404
|
+
i.program = d.program, i.buffer = d.buffer, i.uniforms = d.uniforms, i.presetDirty = !0, i.contextLost = !1, nt == null || nt();
|
|
435
405
|
};
|
|
436
|
-
return n.addEventListener("webglcontextlost", l, !1), n.addEventListener("webglcontextrestored",
|
|
406
|
+
return n.addEventListener("webglcontextlost", l, !1), n.addEventListener("webglcontextrestored", f, !1), i = {
|
|
437
407
|
glCanvas: n,
|
|
438
|
-
gl:
|
|
408
|
+
gl: a,
|
|
439
409
|
program: r,
|
|
440
410
|
buffer: s,
|
|
441
411
|
uniforms: c,
|
|
442
|
-
preset:
|
|
412
|
+
preset: Jt.chromatic.modes.dark,
|
|
443
413
|
presetDirty: !0,
|
|
444
414
|
contextLost: !1,
|
|
445
|
-
useOffscreen:
|
|
415
|
+
useOffscreen: o,
|
|
446
416
|
frameBitmap: null,
|
|
447
417
|
startMs: performance.now(),
|
|
448
418
|
pausedMs: 0,
|
|
449
419
|
pausedAtMs: null,
|
|
450
420
|
rafId: 0,
|
|
451
|
-
dpr:
|
|
421
|
+
dpr: t,
|
|
452
422
|
instances: /* @__PURE__ */ new Set(),
|
|
453
423
|
frameCount: 0,
|
|
454
424
|
glowQueue: [],
|
|
455
425
|
glowIdx: 0,
|
|
456
426
|
glowSkip: 0,
|
|
457
|
-
glowPixels: new Uint8Array(
|
|
458
|
-
glowPixelsW:
|
|
459
|
-
glowPixelsH:
|
|
427
|
+
glowPixels: new Uint8Array(e * e * 4),
|
|
428
|
+
glowPixelsW: e,
|
|
429
|
+
glowPixelsH: e
|
|
460
430
|
}, i;
|
|
461
431
|
}
|
|
462
|
-
function
|
|
463
|
-
var
|
|
432
|
+
function De() {
|
|
433
|
+
var a;
|
|
464
434
|
if (!i) return;
|
|
465
|
-
const { gl:
|
|
435
|
+
const { gl: t, program: e, buffer: o, frameBitmap: n } = i;
|
|
466
436
|
try {
|
|
467
|
-
n == null || n.close(),
|
|
437
|
+
n == null || n.close(), t.deleteBuffer(o), t.deleteProgram(e), (a = t.getExtension("WEBGL_lose_context")) == null || a.loseContext();
|
|
468
438
|
} catch {
|
|
469
439
|
}
|
|
470
440
|
i = null;
|
|
471
441
|
}
|
|
472
|
-
let
|
|
473
|
-
function
|
|
442
|
+
let Ot = 0;
|
|
443
|
+
function it() {
|
|
474
444
|
if (!i) return;
|
|
475
|
-
const
|
|
476
|
-
if (
|
|
477
|
-
|
|
478
|
-
const { gl:
|
|
479
|
-
(i.glowPixelsW !== n || i.glowPixelsH !==
|
|
445
|
+
const t = performance.now();
|
|
446
|
+
if (t - Ot < Ce) return;
|
|
447
|
+
Ot = t;
|
|
448
|
+
const { gl: e, glCanvas: o } = i, n = o.width, a = o.height;
|
|
449
|
+
(i.glowPixelsW !== n || i.glowPixelsH !== a) && (i.glowPixelsW = n, i.glowPixelsH = a, i.glowPixels = new Uint8Array(n * a * 4)), e.readPixels(0, 0, n, a, e.RGBA, e.UNSIGNED_BYTE, i.glowPixels);
|
|
480
450
|
}
|
|
481
451
|
const X = { bx: 0, by: 0 };
|
|
482
|
-
function
|
|
452
|
+
function wt(t, e, o) {
|
|
483
453
|
if (!i)
|
|
484
454
|
return X.bx = 0, X.by = 0, X;
|
|
485
|
-
const { glCanvas: n } = i,
|
|
486
|
-
let g = c * (
|
|
487
|
-
g >
|
|
488
|
-
const
|
|
489
|
-
return X.bx = Math.round(m), X.by = Math.round(r - 1 -
|
|
455
|
+
const { glCanvas: n } = i, a = n.width, r = n.height, s = t.dpr, c = t.cssWidth * s, l = t.cssHeight * s, f = te * s, d = ee * s;
|
|
456
|
+
let g = c * (a / f) / t.shaderScale, u = l * (r / d) / t.shaderScale;
|
|
457
|
+
g > a && (g = a), u > r && (u = r);
|
|
458
|
+
const h = (a - g) / 2, p = (r - u) / 2, m = h + e / t.cssWidth * g, S = p + o / t.cssHeight * u;
|
|
459
|
+
return X.bx = Math.round(m), X.by = Math.round(r - 1 - S), X;
|
|
490
460
|
}
|
|
491
461
|
const N = { r: 0, g: 0, b: 0, lum: 0, count: 0 };
|
|
492
|
-
function
|
|
493
|
-
const s = Math.max(1, r | 0), c = Math.max(0, n - s), l = Math.min(
|
|
462
|
+
function re(t, e, o, n, a, r) {
|
|
463
|
+
const s = Math.max(1, r | 0), c = Math.max(0, n - s), l = Math.min(e, n + s + 1), f = Math.max(0, a - s), d = Math.min(o, a + s + 1);
|
|
494
464
|
N.r = 0, N.g = 0, N.b = 0, N.lum = 0, N.count = 0;
|
|
495
|
-
for (let g =
|
|
496
|
-
const u = g *
|
|
497
|
-
for (let
|
|
498
|
-
const
|
|
499
|
-
N.r +=
|
|
465
|
+
for (let g = f; g < d; g++) {
|
|
466
|
+
const u = g * e;
|
|
467
|
+
for (let h = c; h < l; h++) {
|
|
468
|
+
const p = (u + h) * 4;
|
|
469
|
+
N.r += t[p], N.g += t[p + 1], N.b += t[p + 2], N.lum += (0.2126 * t[p] + 0.7152 * t[p + 1] + 0.0722 * t[p + 2]) / 255, N.count++;
|
|
500
470
|
}
|
|
501
471
|
}
|
|
502
472
|
return N;
|
|
503
473
|
}
|
|
504
|
-
const
|
|
505
|
-
function
|
|
474
|
+
const C = { r: 255, g: 255, b: 255 };
|
|
475
|
+
function Pt(t, e, o, n) {
|
|
506
476
|
if (!i) return 0;
|
|
507
|
-
|
|
508
|
-
const
|
|
477
|
+
it();
|
|
478
|
+
const a = wt(t, e, o), r = re(i.glowPixels, i.glowPixelsW, i.glowPixelsH, a.bx, a.by, n);
|
|
509
479
|
return r.count > 0 ? r.lum / r.count : 0;
|
|
510
480
|
}
|
|
511
|
-
function
|
|
481
|
+
function Be(t, e, o, n) {
|
|
512
482
|
if (!i)
|
|
513
|
-
return
|
|
514
|
-
|
|
515
|
-
const
|
|
516
|
-
return r.count === 0 ? (
|
|
483
|
+
return C.r = 255, C.g = 255, C.b = 255, C;
|
|
484
|
+
it();
|
|
485
|
+
const a = wt(t, e, o), r = re(i.glowPixels, i.glowPixelsW, i.glowPixelsH, a.bx, a.by, n);
|
|
486
|
+
return r.count === 0 ? (C.r = 255, C.g = 255, C.b = 255, C) : (C.r = r.r / r.count, C.g = r.g / r.count, C.b = r.b / r.count, C);
|
|
517
487
|
}
|
|
518
|
-
function
|
|
488
|
+
function ze(t, e, o, n) {
|
|
519
489
|
if (!i)
|
|
520
|
-
return
|
|
521
|
-
|
|
522
|
-
const
|
|
523
|
-
let
|
|
524
|
-
|
|
525
|
-
for (let
|
|
526
|
-
const m =
|
|
527
|
-
for (let
|
|
528
|
-
const x = (m +
|
|
529
|
-
|
|
490
|
+
return C.r = 255, C.g = 255, C.b = 255, C;
|
|
491
|
+
it();
|
|
492
|
+
const a = wt(t, e, o), { glowPixels: r, glowPixelsW: s, glowPixelsH: c } = i, l = Math.max(1, n | 0), f = Math.max(0, a.bx - l), d = Math.min(s, a.bx + l + 1), g = Math.max(0, a.by - l), u = Math.min(c, a.by + l + 1);
|
|
493
|
+
let h = -1;
|
|
494
|
+
C.r = 255, C.g = 255, C.b = 255;
|
|
495
|
+
for (let p = g; p < u; p++) {
|
|
496
|
+
const m = p * s;
|
|
497
|
+
for (let S = f; S < d; S++) {
|
|
498
|
+
const x = (m + S) * 4, k = r[x], M = r[x + 1], L = r[x + 2], P = Math.max(k, M, L), w = Math.min(k, M, L), R = (P > 0 ? (P - w) / P : 0) * (0.35 + 0.65 * (P / 255));
|
|
499
|
+
R > h && (h = R, C.r = k, C.g = M, C.b = L);
|
|
530
500
|
}
|
|
531
501
|
}
|
|
532
|
-
return
|
|
502
|
+
return C;
|
|
533
503
|
}
|
|
534
|
-
|
|
504
|
+
We(() => {
|
|
535
505
|
i && i.instances.size > 0 && i.pausedAtMs === null && K();
|
|
536
506
|
});
|
|
537
507
|
typeof document < "u" && document.addEventListener("visibilitychange", () => {
|
|
538
|
-
!i || i.pausedAtMs !== null || i.contextLost || (document.hidden ?
|
|
508
|
+
!i || i.pausedAtMs !== null || i.contextLost || (document.hidden ? yt() : i.instances.size > 0 && K());
|
|
539
509
|
});
|
|
540
|
-
function
|
|
541
|
-
const
|
|
542
|
-
if (!
|
|
543
|
-
const n =
|
|
544
|
-
canvas:
|
|
545
|
-
ctx:
|
|
546
|
-
cssWidth:
|
|
547
|
-
cssHeight:
|
|
548
|
-
cornerRadius:
|
|
549
|
-
kind:
|
|
550
|
-
ringCssPx:
|
|
551
|
-
shaderScale:
|
|
552
|
-
opacityMul:
|
|
510
|
+
function Ue(t) {
|
|
511
|
+
const e = ae(), o = t.hostCanvas.getContext("2d", { alpha: !0 });
|
|
512
|
+
if (!o) throw new Error("metal-fx: canvas 2D context unavailable");
|
|
513
|
+
const n = t.scale ?? 1, a = {
|
|
514
|
+
canvas: t.hostCanvas,
|
|
515
|
+
ctx: o,
|
|
516
|
+
cssWidth: t.cssWidth,
|
|
517
|
+
cssHeight: t.cssHeight,
|
|
518
|
+
cornerRadius: t.cornerRadius,
|
|
519
|
+
kind: t.kind,
|
|
520
|
+
ringCssPx: t.ringCssPx ?? (t.kind === "circle" ? 2 : 1) * n,
|
|
521
|
+
shaderScale: t.shaderScale ?? (t.kind === "circle" ? ne : oe) * n,
|
|
522
|
+
opacityMul: t.opacityMul ?? 1,
|
|
553
523
|
visible: !0,
|
|
554
|
-
paused:
|
|
524
|
+
paused: t.paused ?? !1,
|
|
555
525
|
everCopied: !1,
|
|
556
526
|
dpr: typeof window < "u" && window.devicePixelRatio || 1,
|
|
557
527
|
scale: n,
|
|
558
|
-
onAfterFrame:
|
|
559
|
-
onFirstCopy:
|
|
528
|
+
onAfterFrame: t.onAfterFrame,
|
|
529
|
+
onFirstCopy: t.onFirstCopy
|
|
560
530
|
};
|
|
561
|
-
return
|
|
531
|
+
return ie(a), e.instances.add(a), e.rafId === 0 && e.pausedAtMs === null && K(), a;
|
|
562
532
|
}
|
|
563
|
-
function
|
|
533
|
+
function Xe(t) {
|
|
564
534
|
if (!i) return;
|
|
565
|
-
i.instances.delete(
|
|
566
|
-
const
|
|
567
|
-
|
|
535
|
+
i.instances.delete(t);
|
|
536
|
+
const e = i.glowQueue.indexOf(t);
|
|
537
|
+
e !== -1 && i.glowQueue.splice(e, 1), i.instances.size === 0 && (yt(), De());
|
|
568
538
|
}
|
|
569
|
-
function
|
|
570
|
-
i && (i.glowQueue.includes(
|
|
539
|
+
function qe(t) {
|
|
540
|
+
i && (i.glowQueue.includes(t) || i.glowQueue.push(t));
|
|
571
541
|
}
|
|
572
|
-
function
|
|
542
|
+
function Ye(t) {
|
|
573
543
|
if (!i) return;
|
|
574
|
-
const
|
|
575
|
-
|
|
544
|
+
const e = i.glowQueue.indexOf(t);
|
|
545
|
+
e !== -1 && i.glowQueue.splice(e, 1);
|
|
576
546
|
}
|
|
577
|
-
function
|
|
578
|
-
let
|
|
579
|
-
|
|
547
|
+
function Z(t, e) {
|
|
548
|
+
let o = !1;
|
|
549
|
+
e.cssWidth !== void 0 && e.cssWidth !== t.cssWidth && (t.cssWidth = e.cssWidth, o = !0), e.cssHeight !== void 0 && e.cssHeight !== t.cssHeight && (t.cssHeight = e.cssHeight, o = !0), e.cornerRadius !== void 0 && (t.cornerRadius = e.cornerRadius), e.scale !== void 0 && (t.scale = e.scale), e.kind !== void 0 && e.kind !== t.kind && (t.kind = e.kind, e.shaderScale === void 0 && (t.shaderScale = (e.kind === "circle" ? ne : oe) * t.scale), e.ringCssPx === void 0 && (t.ringCssPx = (e.kind === "circle" ? 2 : 1) * t.scale)), e.shaderScale !== void 0 && (t.shaderScale = e.shaderScale), e.ringCssPx !== void 0 && (t.ringCssPx = e.ringCssPx), e.opacityMul !== void 0 && (t.opacityMul = e.opacityMul), e.paused !== void 0 && e.paused !== t.paused && (t.paused = e.paused, !e.paused && i && i.rafId === 0 && i.pausedAtMs === null && !i.contextLost && K()), o && ie(t);
|
|
580
550
|
}
|
|
581
|
-
function
|
|
582
|
-
|
|
551
|
+
function Ve(t, e) {
|
|
552
|
+
t.visible = e, e && i && i.rafId === 0 && i.pausedAtMs === null && !i.contextLost && K();
|
|
583
553
|
}
|
|
584
|
-
function
|
|
585
|
-
const
|
|
586
|
-
|
|
554
|
+
function je(t, e) {
|
|
555
|
+
const o = ae();
|
|
556
|
+
o.preset = Jt[t].modes[e], o.presetDirty = !0;
|
|
587
557
|
}
|
|
588
|
-
function
|
|
589
|
-
!i || i.pausedAtMs !== null || (i.pausedAtMs = performance.now(),
|
|
558
|
+
function pn() {
|
|
559
|
+
!i || i.pausedAtMs !== null || (i.pausedAtMs = performance.now(), yt());
|
|
590
560
|
}
|
|
591
561
|
function hn() {
|
|
592
562
|
!i || i.pausedAtMs === null || (i.pausedMs += performance.now() - i.pausedAtMs, i.pausedAtMs = null, i.instances.size > 0 && K());
|
|
593
563
|
}
|
|
594
|
-
let
|
|
595
|
-
function
|
|
596
|
-
|
|
564
|
+
let _t = null;
|
|
565
|
+
function Ke(t) {
|
|
566
|
+
_t = t;
|
|
597
567
|
}
|
|
598
|
-
function
|
|
599
|
-
|
|
600
|
-
const
|
|
601
|
-
|
|
568
|
+
function ie(t) {
|
|
569
|
+
t.dpr = typeof window < "u" && window.devicePixelRatio || 1;
|
|
570
|
+
const e = Math.max(1, Math.round(t.cssWidth * t.dpr)), o = Math.max(1, Math.round(t.cssHeight * t.dpr));
|
|
571
|
+
t.canvas.width !== e && (t.canvas.width = e), t.canvas.height !== o && (t.canvas.height = o);
|
|
602
572
|
}
|
|
603
|
-
function
|
|
604
|
-
const { ctx:
|
|
605
|
-
|
|
573
|
+
function Qe(t) {
|
|
574
|
+
const { ctx: e, dpr: o, canvas: n } = t, a = t.ringCssPx * o, r = n.width, s = n.height, c = Math.max(0, (t.cornerRadius - t.ringCssPx) * o);
|
|
575
|
+
e.save(), e.globalCompositeOperation = "destination-out", e.fillStyle = "#000", e.beginPath(), e.roundRect(a, a, r - 2 * a, s - 2 * a, c), e.fill(), e.restore();
|
|
606
576
|
}
|
|
607
|
-
function
|
|
608
|
-
var
|
|
577
|
+
function Ze(t) {
|
|
578
|
+
var h;
|
|
609
579
|
if (!i) return;
|
|
610
|
-
const
|
|
611
|
-
if (n < 1 ||
|
|
612
|
-
const r = i.glCanvas.width, s = i.glCanvas.height, c =
|
|
613
|
-
let
|
|
614
|
-
|
|
615
|
-
const g = Math.max(0, (r -
|
|
616
|
-
if (
|
|
617
|
-
const
|
|
618
|
-
|
|
580
|
+
const e = i.frameBitmap ?? i.glCanvas, o = t.dpr, n = t.canvas.width, a = t.canvas.height;
|
|
581
|
+
if (n < 1 || a < 1) return;
|
|
582
|
+
const r = i.glCanvas.width, s = i.glCanvas.height, c = te * o, l = ee * o;
|
|
583
|
+
let f = n * (r / c) / t.shaderScale, d = a * (s / l) / t.shaderScale;
|
|
584
|
+
f > r && (f = r), d > s && (d = s);
|
|
585
|
+
const g = Math.max(0, (r - f) / 2), u = Math.max(0, (s - d) / 2);
|
|
586
|
+
if (t.ctx.clearRect(0, 0, n, a), t.opacityMul < 1 && (t.ctx.globalAlpha = t.opacityMul), t.ctx.drawImage(e, g, u, f, d, 0, 0, n, a), t.opacityMul < 1 && (t.ctx.globalAlpha = 1), Qe(t), t.onFirstCopy) {
|
|
587
|
+
const p = t.onFirstCopy;
|
|
588
|
+
t.onFirstCopy = void 0, p();
|
|
619
589
|
}
|
|
620
|
-
(
|
|
590
|
+
(h = t.onAfterFrame) == null || h.call(t);
|
|
621
591
|
}
|
|
622
|
-
function
|
|
592
|
+
function Je() {
|
|
623
593
|
if (!i) return;
|
|
624
|
-
const { gl:
|
|
625
|
-
|
|
626
|
-
for (let
|
|
627
|
-
const r =
|
|
594
|
+
const { gl: t, uniforms: e, preset: o, glCanvas: n } = i;
|
|
595
|
+
e.u_resolution && t.uniform2f(e.u_resolution, n.width, n.height);
|
|
596
|
+
for (let a = 0; a < 7; a++) {
|
|
597
|
+
const r = e[`u_color${a + 1}`];
|
|
628
598
|
if (r) {
|
|
629
|
-
const [c, l,
|
|
630
|
-
|
|
599
|
+
const [c, l, f] = ye(o.colors[a]);
|
|
600
|
+
t.uniform3f(r, c, l, f);
|
|
631
601
|
}
|
|
632
|
-
const s =
|
|
633
|
-
s &&
|
|
602
|
+
const s = e[`u_alpha${a + 1}`];
|
|
603
|
+
s && t.uniform1f(s, o.alphas[a]);
|
|
634
604
|
}
|
|
635
|
-
|
|
605
|
+
e.u_intensity && t.uniform1f(e.u_intensity, o.intensity), e.u_scale && t.uniform1f(e.u_scale, o.scale), e.u_direction && t.uniform1f(e.u_direction, o.direction * Math.PI / 180), e.u_softness && t.uniform1f(e.u_softness, o.softness), e.u_distortion && t.uniform1f(e.u_distortion, o.distortion), e.u_complexity && t.uniform1f(e.u_complexity, o.complexity), e.u_shape && t.uniform1f(e.u_shape, o.shape), e.u_vignette && t.uniform1f(e.u_vignette, o.vignette), e.u_vigOpacity && t.uniform1f(e.u_vigOpacity, o.vigOpacity), e.u_blur && t.uniform1f(e.u_blur, o.blur), e.u_shaderOpacity && t.uniform1f(e.u_shaderOpacity, o.shaderOpacity), i.presetDirty = !1;
|
|
636
606
|
}
|
|
637
|
-
function
|
|
607
|
+
function to(t) {
|
|
638
608
|
if (!i) return;
|
|
639
|
-
const { gl:
|
|
640
|
-
|
|
609
|
+
const { gl: e, uniforms: o, preset: n, glCanvas: a } = i, r = (t - i.startMs - i.pausedMs) / 1e3 * n.speed;
|
|
610
|
+
e.viewport(0, 0, a.width, a.height), e.clearColor(0, 0, 0, 0), e.clear(e.COLOR_BUFFER_BIT), i.presetDirty && Je(), o.u_time && e.uniform1f(o.u_time, r), e.drawArrays(e.TRIANGLES, 0, 6), i.frameCount++;
|
|
641
611
|
}
|
|
642
|
-
let
|
|
643
|
-
function
|
|
644
|
-
var
|
|
612
|
+
let Ft = 0;
|
|
613
|
+
function se(t) {
|
|
614
|
+
var o;
|
|
645
615
|
if (!i) return;
|
|
646
616
|
if (i.contextLost) {
|
|
647
617
|
i.rafId = 0;
|
|
648
618
|
return;
|
|
649
619
|
}
|
|
650
|
-
let
|
|
620
|
+
let e = !1;
|
|
651
621
|
for (const n of i.instances)
|
|
652
622
|
if (n.visible && (!n.paused || !n.everCopied)) {
|
|
653
|
-
|
|
623
|
+
e = !0;
|
|
654
624
|
break;
|
|
655
625
|
}
|
|
656
|
-
if (!
|
|
626
|
+
if (!e) {
|
|
657
627
|
i.rafId = 0;
|
|
658
628
|
return;
|
|
659
629
|
}
|
|
660
|
-
if (i.rafId = requestAnimationFrame(
|
|
661
|
-
|
|
630
|
+
if (i.rafId = requestAnimationFrame(se), !(t - Ft < Ae)) {
|
|
631
|
+
Ft = t, to(t), i.useOffscreen && (i.glowQueue.length > 0 && it(), (o = i.frameBitmap) == null || o.close(), i.frameBitmap = i.glCanvas.transferToImageBitmap());
|
|
662
632
|
for (const n of i.instances)
|
|
663
|
-
n.visible && (n.paused && n.everCopied || (
|
|
664
|
-
if (
|
|
633
|
+
n.visible && (n.paused && n.everCopied || (Ze(n), n.everCopied = !0));
|
|
634
|
+
if (_t && i.glowQueue.length > 0 && ++i.glowSkip % Te === 0) {
|
|
665
635
|
const n = i.glowQueue;
|
|
666
636
|
i.glowIdx >= n.length && (i.glowIdx = 0);
|
|
667
|
-
const
|
|
668
|
-
|
|
637
|
+
const a = n[i.glowIdx];
|
|
638
|
+
a.visible && !a.paused && _t(a, t), i.glowIdx++;
|
|
669
639
|
}
|
|
670
640
|
}
|
|
671
641
|
}
|
|
672
642
|
function K() {
|
|
673
|
-
!i || i.rafId !== 0 || (i.rafId = requestAnimationFrame(
|
|
643
|
+
!i || i.rafId !== 0 || (i.rafId = requestAnimationFrame(se));
|
|
674
644
|
}
|
|
675
|
-
function
|
|
645
|
+
function yt() {
|
|
676
646
|
i && (i.rafId !== 0 && cancelAnimationFrame(i.rafId), i.rafId = 0);
|
|
677
647
|
}
|
|
678
|
-
const
|
|
679
|
-
linear: (
|
|
680
|
-
smoothstep: (
|
|
648
|
+
const at = {
|
|
649
|
+
linear: (t) => t,
|
|
650
|
+
smoothstep: (t) => t * t * (3 - 2 * t)
|
|
681
651
|
};
|
|
682
|
-
function
|
|
683
|
-
return { from:
|
|
652
|
+
function q(t, e, o, n = at.linear) {
|
|
653
|
+
return { from: t, to: e, dur: o, ease: n, startMs: -1, val: t, done: !1 };
|
|
684
654
|
}
|
|
685
|
-
function
|
|
686
|
-
|
|
655
|
+
function Y(t, e) {
|
|
656
|
+
t.startMs = e, t.val = t.from, t.done = !1;
|
|
687
657
|
}
|
|
688
|
-
function $
|
|
689
|
-
if (
|
|
690
|
-
const
|
|
691
|
-
return
|
|
658
|
+
function $t(t, e) {
|
|
659
|
+
if (t.done || t.startMs < 0) return t.val;
|
|
660
|
+
const o = Math.min(1, (e - t.startMs) / t.dur);
|
|
661
|
+
return t.val = t.from + (t.to - t.from) * t.ease(o), o >= 1 && (t.done = !0), t.val;
|
|
692
662
|
}
|
|
693
|
-
const
|
|
694
|
-
function
|
|
695
|
-
const n = Math.max(0, Math.min(
|
|
696
|
-
return 2 * Math.max(0,
|
|
663
|
+
const eo = 1.5, tt = 1 / 3, oo = 4 * tt, no = 2 * tt, ao = 2 * tt, ro = 1.35 * tt, io = 13 * tt;
|
|
664
|
+
function Mt(t, e, o) {
|
|
665
|
+
const n = Math.max(0, Math.min(o, Math.min(t, e) / 2));
|
|
666
|
+
return 2 * Math.max(0, t - 2 * n) + 2 * Math.max(0, e - 2 * n) + 2 * Math.PI * n;
|
|
697
667
|
}
|
|
698
|
-
function
|
|
699
|
-
return n === "circle" ? 2 * Math.PI * Math.max(0, Math.min(
|
|
668
|
+
function Rt(t, e, o, n) {
|
|
669
|
+
return n === "circle" ? 2 * Math.PI * Math.max(0, Math.min(o, Math.min(t, e) / 2)) : Mt(t, e, o);
|
|
700
670
|
}
|
|
701
|
-
function
|
|
702
|
-
const l = c || { x: 0, y: 0 },
|
|
671
|
+
function J(t, e, o, n, a, r, s, c) {
|
|
672
|
+
const l = c || { x: 0, y: 0 }, f = Math.max(0, Math.min(n, Math.min(e, o) / 2));
|
|
703
673
|
if (s === "circle") {
|
|
704
|
-
const x = 2 * Math.PI *
|
|
674
|
+
const x = 2 * Math.PI * f;
|
|
705
675
|
if (x <= 1e-4)
|
|
706
|
-
return l.x =
|
|
707
|
-
|
|
708
|
-
const
|
|
709
|
-
return l.x =
|
|
676
|
+
return l.x = e * 0.5, l.y = o * 0.5, l;
|
|
677
|
+
t = (t % x + x) % x;
|
|
678
|
+
const k = -Math.PI / 2 + t / x * Math.PI * 2, M = Math.max(0, f - a + r);
|
|
679
|
+
return l.x = e * 0.5 + M * Math.cos(k), l.y = o * 0.5 + M * Math.sin(k), l;
|
|
710
680
|
}
|
|
711
|
-
const
|
|
712
|
-
|
|
713
|
-
const
|
|
714
|
-
let m =
|
|
715
|
-
if (m <
|
|
716
|
-
return l.x =
|
|
717
|
-
if (m -=
|
|
681
|
+
const d = Math.max(0, e - 2 * f), g = Math.max(0, o - 2 * f), u = Math.PI * f / 2, h = 2 * (d + g) + 4 * u;
|
|
682
|
+
t = (t % h + h) % h;
|
|
683
|
+
const p = Math.max(0, f - a + r);
|
|
684
|
+
let m = t;
|
|
685
|
+
if (m < d)
|
|
686
|
+
return l.x = f + m, l.y = a - r, l;
|
|
687
|
+
if (m -= d, m < u) {
|
|
718
688
|
const x = -Math.PI / 2 + (u > 0 ? m / u : 0) * (Math.PI / 2);
|
|
719
|
-
return l.x =
|
|
689
|
+
return l.x = e - f + p * Math.cos(x), l.y = f + p * Math.sin(x), l;
|
|
720
690
|
}
|
|
721
691
|
if (m -= u, m < g)
|
|
722
|
-
return l.x =
|
|
692
|
+
return l.x = e - a + r, l.y = f + m, l;
|
|
723
693
|
if (m -= g, m < u) {
|
|
724
694
|
const x = (u > 0 ? m / u : 0) * (Math.PI / 2);
|
|
725
|
-
return l.x =
|
|
695
|
+
return l.x = e - f + p * Math.cos(x), l.y = o - f + p * Math.sin(x), l;
|
|
726
696
|
}
|
|
727
|
-
if (m -= u, m <
|
|
728
|
-
return l.x =
|
|
729
|
-
if (m -=
|
|
697
|
+
if (m -= u, m < d)
|
|
698
|
+
return l.x = e - f - m, l.y = o - a + r, l;
|
|
699
|
+
if (m -= d, m < u) {
|
|
730
700
|
const x = Math.PI / 2 + (u > 0 ? m / u : 0) * (Math.PI / 2);
|
|
731
|
-
return l.x =
|
|
701
|
+
return l.x = f + p * Math.cos(x), l.y = o - f + p * Math.sin(x), l;
|
|
732
702
|
}
|
|
733
703
|
if (m -= u, m < g)
|
|
734
|
-
return l.x =
|
|
704
|
+
return l.x = a - r, l.y = o - f - m, l;
|
|
735
705
|
m -= g;
|
|
736
|
-
const
|
|
737
|
-
return l.x =
|
|
706
|
+
const S = Math.PI + (u > 0 ? m / u : 0) * (Math.PI / 2);
|
|
707
|
+
return l.x = f + p * Math.cos(S), l.y = f + p * Math.sin(S), l;
|
|
738
708
|
}
|
|
739
|
-
function
|
|
740
|
-
const
|
|
709
|
+
function Ht(t, e) {
|
|
710
|
+
const o = t * 2 / e;
|
|
741
711
|
let n = "";
|
|
742
|
-
for (let
|
|
743
|
-
const r = -
|
|
744
|
-
n += (
|
|
712
|
+
for (let a = 0; a <= e; a++) {
|
|
713
|
+
const r = -t + a * o;
|
|
714
|
+
n += (a === 0 ? "M " : "L ") + r.toFixed(3) + " 0 ";
|
|
745
715
|
}
|
|
746
716
|
return n;
|
|
747
717
|
}
|
|
748
|
-
const
|
|
749
|
-
function
|
|
750
|
-
return
|
|
718
|
+
const pt = { x: 0, y: 0 }, ht = { x: 0, y: 0 };
|
|
719
|
+
function so(t, e, o, n, a, r) {
|
|
720
|
+
return J(t - 0.1, e, o, n, a, 0, r, pt), J(t + 0.1, e, o, n, a, 0, r, ht), Math.atan2(ht.y - pt.y, ht.x - pt.x);
|
|
751
721
|
}
|
|
752
|
-
function
|
|
753
|
-
const n = Math.max(0, Math.min(1, (
|
|
722
|
+
function Nt(t, e, o) {
|
|
723
|
+
const n = Math.max(0, Math.min(1, (o - t) / (e - t)));
|
|
754
724
|
return n * n * (3 - 2 * n);
|
|
755
725
|
}
|
|
756
|
-
function
|
|
757
|
-
const
|
|
758
|
-
for (let
|
|
759
|
-
const r =
|
|
726
|
+
function lo(t) {
|
|
727
|
+
const e = Rt(t.width, t.height, t.cornerRadius, t.kind), o = eo * (t.scale ?? 1), n = [];
|
|
728
|
+
for (let a = 0; a < kt; a++) {
|
|
729
|
+
const r = a / kt * e, s = J(r, t.width, t.height, t.cornerRadius, o, 0, t.kind);
|
|
760
730
|
n.push({ x: s.x, y: s.y, arc: r });
|
|
761
731
|
}
|
|
762
732
|
return n;
|
|
763
733
|
}
|
|
764
|
-
function
|
|
765
|
-
const { width:
|
|
734
|
+
function co(t, e) {
|
|
735
|
+
const { width: o, height: n, cornerRadius: a } = t, r = t.scale ?? 1, s = t.kind === "circle" ? 2 : 1, c = Math.max(0, a - s), l = (-200 * r).toFixed(0), f = l, d = (540 * r).toFixed(0), g = (440 * r).toFixed(0), u = `x="${l}" y="${f}" width="${d}" height="${g}"`, h = `${u} filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"`, p = (S) => (S * r).toFixed(3), m = (S) => (S * r).toFixed(3);
|
|
766
736
|
return [
|
|
767
737
|
"<defs>",
|
|
768
|
-
`<filter id="${
|
|
769
|
-
`<filter id="${
|
|
770
|
-
`<filter id="${
|
|
771
|
-
`<filter id="${
|
|
772
|
-
`<filter id="${
|
|
773
|
-
`<filter id="${
|
|
774
|
-
`<radialGradient id="${
|
|
775
|
-
`<mask id="${
|
|
776
|
-
`<mask id="${
|
|
738
|
+
`<filter id="${e}_bXl" ${h}><feGaussianBlur stdDeviation="${m(8.4)}"/></filter>`,
|
|
739
|
+
`<filter id="${e}_bLg" ${h}><feGaussianBlur stdDeviation="${m(4.8)}"/></filter>`,
|
|
740
|
+
`<filter id="${e}_bMd" ${h}><feGaussianBlur stdDeviation="${m(2.1)}"/></filter>`,
|
|
741
|
+
`<filter id="${e}_bSm" ${h}><feGaussianBlur stdDeviation="${m(0.9)}"/></filter>`,
|
|
742
|
+
`<filter id="${e}_ebO" ${h}><feGaussianBlur stdDeviation="${m(ao)}"/></filter>`,
|
|
743
|
+
`<filter id="${e}_ebC" ${h}><feGaussianBlur stdDeviation="${m(ro)}"/></filter>`,
|
|
744
|
+
`<radialGradient id="${e}_fg" cx="0.5" cy="0.5" r="0.5"><stop offset="0" stop-color="white"/><stop offset="0.30" stop-color="white"/><stop offset="0.65" stop-color="#404040"/><stop offset="1" stop-color="black"/></radialGradient>`,
|
|
745
|
+
`<mask id="${e}_fm" maskUnits="userSpaceOnUse" ${u}><rect ${u} fill="black"/><circle id="${e}_fc" cx="0" cy="0" r="${(io * r).toFixed(3)}" fill="url(#${e}_fg)"/></mask>`,
|
|
746
|
+
`<mask id="${e}_rm" maskUnits="userSpaceOnUse" ${u}><rect ${u} fill="#808080"/><rect x="0" y="0" width="${o}" height="${n}" rx="${a}" ry="${a}" fill="white"/><rect x="${s}" y="${s}" width="${o - s * 2}" height="${n - s * 2}" rx="${c}" ry="${c}" fill="black"/></mask>`,
|
|
777
747
|
"</defs>",
|
|
778
|
-
|
|
779
|
-
// have zero height, so the mask becomes a sliver. These spacer rects
|
|
780
|
-
// inflate the bbox to the full filter region.
|
|
781
|
-
`<g id="${t}_h" mask="url(#${t}_rm)" opacity="0">`,
|
|
748
|
+
`<g id="${e}_h" mask="url(#${e}_rm)" opacity="0">`,
|
|
782
749
|
`<rect ${u} fill="none" pointer-events="none"/>`,
|
|
783
|
-
`<g id="${
|
|
784
|
-
`<path id="${
|
|
785
|
-
`<path id="${
|
|
786
|
-
`<path id="${
|
|
787
|
-
`<path id="${
|
|
750
|
+
`<g id="${e}_hI" stroke="white">`,
|
|
751
|
+
`<path id="${e}_pXl" stroke-width="${p(26.4)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.385" filter="url(#${e}_bXl)"/>`,
|
|
752
|
+
`<path id="${e}_pLg" stroke-width="${p(15.6)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.595" filter="url(#${e}_bLg)"/>`,
|
|
753
|
+
`<path id="${e}_pMd" stroke-width="${p(7.2)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.70" filter="url(#${e}_bMd)"/>`,
|
|
754
|
+
`<path id="${e}_pSm" stroke-width="${p(3)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.70" filter="url(#${e}_bSm)"/>`,
|
|
788
755
|
"</g></g>",
|
|
789
|
-
`<g id="${
|
|
756
|
+
`<g id="${e}_e" mask="url(#${e}_rm)" opacity="0">`,
|
|
790
757
|
`<rect ${u} fill="none" pointer-events="none"/>`,
|
|
791
|
-
`<g mask="url(#${
|
|
792
|
-
`<g id="${
|
|
793
|
-
`<path id="${
|
|
794
|
-
`<path id="${
|
|
758
|
+
`<g mask="url(#${e}_fm)">`,
|
|
759
|
+
`<g id="${e}_eI" stroke="white">`,
|
|
760
|
+
`<path id="${e}_eO" stroke-width="${p(oo)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.85" filter="url(#${e}_ebO)"/>`,
|
|
761
|
+
`<path id="${e}_eC" stroke-width="${p(no)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="1.0" filter="url(#${e}_ebC)"/>`,
|
|
795
762
|
"</g></g></g>"
|
|
796
763
|
].join("");
|
|
797
764
|
}
|
|
798
|
-
const
|
|
799
|
-
let
|
|
800
|
-
const
|
|
801
|
-
function
|
|
802
|
-
const
|
|
803
|
-
n.setAttribute("class", "metal-fx-glow-svg"), n.setAttribute("preserveAspectRatio", "none"), n.setAttribute("viewBox", `0 0 ${
|
|
804
|
-
const
|
|
805
|
-
for (const x of m) x.setAttribute("d",
|
|
806
|
-
for (const x of
|
|
807
|
-
return s.style.transformOrigin = "0 0", l.style.transformOrigin = "0 0", s.style.willChange = "transform", l.style.willChange = "transform", s.style.transition = "transform 100ms linear", l.style.transition = "transform 100ms linear", r.style.willChange = "opacity", c.style.willChange = "opacity", r.style.transition = "opacity 100ms linear", c.style.transition = "opacity 100ms linear",
|
|
765
|
+
const fo = 875e-5, Wt = 0.08, Gt = 0.32, uo = 0.05, po = 3e3, Dt = 0.85, ot = 0.34, mt = 1500, ho = 15, mo = 75e-4, go = 120, xo = 1.5, vo = 7.8, _o = 9.13952, bo = 1, wo = 1 / 3, yo = 0.8, Mo = 3.51, Bt = 2e3, gt = 400, Ro = 2.625, Ao = 1.008, So = 0.31, le = 140, ce = 40, fe = 20;
|
|
766
|
+
let Co = 0;
|
|
767
|
+
const G = { x: 0, y: 0 };
|
|
768
|
+
function zt(t, e) {
|
|
769
|
+
const o = `mfxg_${++Co}`, n = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
770
|
+
n.setAttribute("class", "metal-fx-glow-svg"), n.setAttribute("preserveAspectRatio", "none"), n.setAttribute("viewBox", `0 0 ${e.width} ${e.height}`), n.innerHTML = co(e, o), t.appendChild(n);
|
|
771
|
+
const a = (x) => n.querySelector(`#${o}_${x}`), r = a("h"), s = a("hI"), c = a("e"), l = a("eI"), f = a("fc"), d = Rt(e.width, e.height, e.cornerRadius, e.kind) / Mt(le, ce, fe), g = Math.max(1, vo * d), u = Math.max(0.6, _o * wo * d), h = Ht(g, Ee), p = Ht(u, ke), m = [a("pXl"), a("pLg"), a("pMd"), a("pSm")], S = [a("eO"), a("eC")];
|
|
772
|
+
for (const x of m) x.setAttribute("d", h);
|
|
773
|
+
for (const x of S) x.setAttribute("d", p);
|
|
774
|
+
return s.style.transformOrigin = "0 0", l.style.transformOrigin = "0 0", s.style.willChange = "transform", l.style.willChange = "transform", s.style.transition = "transform 100ms linear", l.style.transition = "transform 100ms linear", r.style.willChange = "opacity", c.style.willChange = "opacity", r.style.transition = "opacity 100ms linear", c.style.transition = "opacity 100ms linear", f.style.willChange = "transform", {
|
|
808
775
|
svg: n,
|
|
809
776
|
haloGroup: r,
|
|
810
777
|
haloInner: s,
|
|
811
778
|
extraGroup: c,
|
|
812
779
|
extraInner: l,
|
|
813
|
-
fadeCircle:
|
|
814
|
-
width:
|
|
815
|
-
height:
|
|
816
|
-
cornerRadius:
|
|
817
|
-
kind:
|
|
818
|
-
scale:
|
|
819
|
-
perim:
|
|
780
|
+
fadeCircle: f,
|
|
781
|
+
width: e.width,
|
|
782
|
+
height: e.height,
|
|
783
|
+
cornerRadius: e.cornerRadius,
|
|
784
|
+
kind: e.kind,
|
|
785
|
+
scale: e.scale ?? 1,
|
|
786
|
+
perim: lo(e),
|
|
820
787
|
currentIdx: 0,
|
|
821
788
|
appearedAt: 0,
|
|
822
789
|
glowOpacity: 0,
|
|
@@ -833,311 +800,309 @@ function De(e, t) {
|
|
|
833
800
|
lastExtraStroke: ""
|
|
834
801
|
};
|
|
835
802
|
}
|
|
836
|
-
function
|
|
803
|
+
function To(t, e, o, n, a = "dark") {
|
|
837
804
|
var B;
|
|
838
|
-
const { width: r, height: s, cornerRadius: c, perim: l } =
|
|
805
|
+
const { width: r, height: s, cornerRadius: c, perim: l } = t;
|
|
839
806
|
if (l.length === 0) return;
|
|
840
|
-
const
|
|
841
|
-
let
|
|
842
|
-
for (let
|
|
843
|
-
const
|
|
844
|
-
H >
|
|
807
|
+
const f = 2;
|
|
808
|
+
let d = -1, g = t.currentIdx, u = 0;
|
|
809
|
+
for (let E = 0; E < l.length; E++) {
|
|
810
|
+
const O = l[E], H = Pt(e, O.x, O.y, f);
|
|
811
|
+
H > d && (d = H, g = E), E === t.currentIdx && (u = H);
|
|
845
812
|
}
|
|
846
|
-
const
|
|
847
|
-
if (!
|
|
848
|
-
if (
|
|
849
|
-
|
|
850
|
-
else if ((B =
|
|
851
|
-
|
|
852
|
-
const
|
|
853
|
-
|
|
854
|
-
} else m ? (
|
|
855
|
-
|
|
856
|
-
const
|
|
857
|
-
|
|
858
|
-
const
|
|
859
|
-
|
|
860
|
-
const
|
|
861
|
-
|
|
862
|
-
const
|
|
863
|
-
|
|
864
|
-
const
|
|
865
|
-
|
|
866
|
-
r:
|
|
867
|
-
g:
|
|
868
|
-
b:
|
|
869
|
-
},
|
|
870
|
-
const
|
|
871
|
-
let F,
|
|
872
|
-
if (
|
|
873
|
-
F = Math.round(
|
|
813
|
+
const h = t.appearedAt > 0 && o - t.appearedAt < po, p = ot + (Dt - ot) * Nt(Wt, Gt, u), m = !h && d - u > uo;
|
|
814
|
+
if (!t.relocTween || t.relocTween.done)
|
|
815
|
+
if (t.appearedAt === 0)
|
|
816
|
+
t.currentIdx = g, t.appearedAt = o, t.wanderS = 0, t.wanderTargetS = 0, t.wanderFrames = 0, t.relocTween = q(0, p, mt, at.smoothstep), Y(t.relocTween, o);
|
|
817
|
+
else if ((B = t.relocTween) != null && B.done && t.relocTween.to === 0) {
|
|
818
|
+
t.currentIdx = t.relocNextIdx, t.appearedAt = o, t.wanderS = 0, t.wanderTargetS = 0, t.wanderFrames = 0;
|
|
819
|
+
const E = l[t.currentIdx], O = Pt(e, E.x, E.y, f), H = ot + (Dt - ot) * Nt(Wt, Gt, O);
|
|
820
|
+
t.relocTween = q(0, H, mt, at.smoothstep), Y(t.relocTween, o);
|
|
821
|
+
} else m ? (t.relocNextIdx = g, t.relocTween = q(t.glowOpacity, 0, mt, at.smoothstep), Y(t.relocTween, o)) : t.glowOpacity += (p - t.glowOpacity) * fo;
|
|
822
|
+
t.relocTween && (t.glowOpacity = $t(t.relocTween, o)), t.glowOpacity = Math.max(0, Math.min(1, t.glowOpacity));
|
|
823
|
+
const S = Rt(r, s, c, t.kind) / Mt(le, ce, fe), x = ho * S;
|
|
824
|
+
t.wanderFrames++ >= go && (t.wanderTargetS = (Math.random() * 2 - 1) * x, t.wanderFrames = 0), t.wanderS += (t.wanderTargetS - t.wanderS) * mo;
|
|
825
|
+
const k = l[t.currentIdx].arc + t.wanderS, M = xo * t.scale;
|
|
826
|
+
J(k, r, s, c, M, 0, t.kind, G);
|
|
827
|
+
const L = G.x, P = G.y, w = so(k, r, s, c, M, t.kind), b = `translate(${L.toFixed(3)}px,${P.toFixed(3)}px) rotate(${w.toFixed(4)}rad)`;
|
|
828
|
+
t.haloInner.style.transform = b;
|
|
829
|
+
const R = bo * S * t.scale;
|
|
830
|
+
J(k, r, s, c, M, R, t.kind, G), t.extraInner.style.transform = `translate(${G.x.toFixed(3)}px,${G.y.toFixed(3)}px) rotate(${w.toFixed(4)}rad)`, t.fadeCircle.style.transform = `translate(${G.x.toFixed(3)}px,${G.y.toFixed(3)}px)`;
|
|
831
|
+
const A = a === "light", v = A ? ze(e, L, P, f) : Be(e, L, P, f);
|
|
832
|
+
t.tintTween ? t.tintTween.done && (A ? (t.tintFrom = {
|
|
833
|
+
r: t.tintFrom.r + (t.tintTarget.r - t.tintFrom.r) * t.tintTween.val,
|
|
834
|
+
g: t.tintFrom.g + (t.tintTarget.g - t.tintFrom.g) * t.tintTween.val,
|
|
835
|
+
b: t.tintFrom.b + (t.tintTarget.b - t.tintFrom.b) * t.tintTween.val
|
|
836
|
+
}, t.tintTarget = { ...v }, t.tintTween = q(0, 1, gt), Y(t.tintTween, o)) : o >= t.tintHoldUntil && (t.tintFrom = { ...t.tintTarget }, t.tintTarget = { ...v }, t.tintTween = q(0, 1, gt), Y(t.tintTween, o), t.tintHoldUntil = o + Bt)) : (t.tintFrom = { ...v }, t.tintTarget = { ...v }, t.tintTween = q(0, 1, gt), Y(t.tintTween, o), t.tintHoldUntil = A ? 0 : o + Bt), $t(t.tintTween, o);
|
|
837
|
+
const _ = t.tintTween.val;
|
|
838
|
+
let F, I, y;
|
|
839
|
+
if (A)
|
|
840
|
+
F = Math.round(t.tintFrom.r + (t.tintTarget.r - t.tintFrom.r) * _), I = Math.round(t.tintFrom.g + (t.tintTarget.g - t.tintFrom.g) * _), y = Math.round(t.tintFrom.b + (t.tintTarget.b - t.tintFrom.b) * _);
|
|
874
841
|
else {
|
|
875
|
-
const
|
|
876
|
-
F = Math.round(255 * (
|
|
842
|
+
const E = t.tintFrom.r + (t.tintTarget.r - t.tintFrom.r) * _, O = t.tintFrom.g + (t.tintTarget.g - t.tintFrom.g) * _, H = t.tintFrom.b + (t.tintTarget.b - t.tintFrom.b) * _, W = Math.max(E, O, H) || 1;
|
|
843
|
+
F = Math.round(255 * (E / W)), I = Math.round(255 * (O / W)), y = Math.round(255 * (H / W));
|
|
877
844
|
}
|
|
878
|
-
const
|
|
879
|
-
if (
|
|
880
|
-
const
|
|
881
|
-
|
|
882
|
-
} else
|
|
845
|
+
const T = `rgb(${F},${I},${y})`;
|
|
846
|
+
if (T !== t.lastHaloStroke && (t.lastHaloStroke = T, t.haloInner.style.stroke = T), A) {
|
|
847
|
+
const E = Me(F, I, y), [O, H, W] = Re(E[0], Math.min(1, E[1] * Ro), Math.max(So, E[2] * Ao)), z = `rgb(${O},${H},${W})`;
|
|
848
|
+
z !== t.lastExtraStroke && (t.lastExtraStroke = z, t.extraInner.style.stroke = z);
|
|
849
|
+
} else t.lastExtraStroke !== "#ffffff" && (t.lastExtraStroke = "#ffffff", t.extraInner.style.stroke = "#ffffff");
|
|
883
850
|
const $ = Math.max(0, Math.min(1, n));
|
|
884
|
-
|
|
851
|
+
t.haloGroup.style.opacity = (t.glowOpacity * yo * $).toFixed(3), t.extraGroup.style.opacity = Math.min(1, t.glowOpacity * Mo * $).toFixed(3);
|
|
885
852
|
}
|
|
886
|
-
const
|
|
887
|
-
function
|
|
888
|
-
const
|
|
889
|
-
return Math.sqrt(
|
|
853
|
+
const bt = 12, Ut = 32, Xt = 1, qt = 0.55, Eo = 1, ko = 1, Io = 0.85, Lo = 0, Oo = 1.3, Yt = 3.6, Po = 0.7, Fo = 1, $o = 0.52, Ho = 1, No = 0.044, Wo = 235, Go = 2.535, Do = 0.7, Bo = 0.5, zo = /* @__PURE__ */ new Set(["INPUT", "TEXTAREA", "SELECT", "OPTION"]);
|
|
854
|
+
function Uo(t, e) {
|
|
855
|
+
const o = Math.max(t.left - e.right, e.left - t.right, 0), n = Math.max(t.top - e.bottom, e.top - t.bottom, 0);
|
|
856
|
+
return Math.sqrt(o * o + n * n);
|
|
890
857
|
}
|
|
891
|
-
function
|
|
892
|
-
return !(Math.min(
|
|
893
|
-
e.left - t.right,
|
|
858
|
+
function Xo(t, e, o, n) {
|
|
859
|
+
return !(Math.min(t.bottom, e.bottom) - Math.max(t.top, e.top) < o || Math.max(
|
|
894
860
|
t.left - e.right,
|
|
861
|
+
e.left - t.right,
|
|
895
862
|
0
|
|
896
863
|
) > n);
|
|
897
864
|
}
|
|
898
|
-
function
|
|
899
|
-
return Math.min(
|
|
900
|
-
e.top - t.bottom,
|
|
865
|
+
function qo(t, e, o, n) {
|
|
866
|
+
return Math.min(t.right, e.right) - Math.max(t.left, e.left) < o ? !1 : Math.max(
|
|
901
867
|
t.top - e.bottom,
|
|
868
|
+
e.top - t.bottom,
|
|
902
869
|
0
|
|
903
870
|
) <= n;
|
|
904
871
|
}
|
|
905
|
-
function U(
|
|
906
|
-
const s = Math.max(0, Math.min(r, n * 0.5,
|
|
872
|
+
function U(t, e, o, n, a, r) {
|
|
873
|
+
const s = Math.max(0, Math.min(r, n * 0.5, a * 0.5)), c = t.roundRect;
|
|
907
874
|
if (typeof c == "function") {
|
|
908
|
-
c.call(
|
|
875
|
+
c.call(t, e, o, n, a, s);
|
|
909
876
|
return;
|
|
910
877
|
}
|
|
911
|
-
|
|
878
|
+
t.moveTo(e + s, o), t.lineTo(e + n - s, o), t.quadraticCurveTo(e + n, o, e + n, o + s), t.lineTo(e + n, o + a - s), t.quadraticCurveTo(e + n, o + a, e + n - s, o + a), t.lineTo(e + s, o + a), t.quadraticCurveTo(e, o + a, e, o + a - s), t.lineTo(e, o + s), t.quadraticCurveTo(e, o, e + s, o);
|
|
912
879
|
}
|
|
913
|
-
function
|
|
914
|
-
if (!
|
|
915
|
-
|
|
880
|
+
function de(t, e, o, n, a) {
|
|
881
|
+
if (!a.flipX && !a.flipY) {
|
|
882
|
+
t.drawImage(e, 0, 0, o, n, a.x, a.y, a.w, a.h);
|
|
916
883
|
return;
|
|
917
884
|
}
|
|
918
|
-
|
|
919
|
-
|
|
885
|
+
t.save(), a.flipX && (t.translate(a.x + a.w, 0), t.scale(-1, 1)), a.flipY && (t.translate(0, a.y + a.h), t.scale(1, -1)), t.drawImage(
|
|
886
|
+
e,
|
|
920
887
|
0,
|
|
921
888
|
0,
|
|
922
|
-
|
|
889
|
+
o,
|
|
923
890
|
n,
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
),
|
|
929
|
-
}
|
|
930
|
-
const
|
|
931
|
-
function
|
|
932
|
-
if (n <= 2 * s ||
|
|
933
|
-
|
|
891
|
+
a.flipX ? 0 : a.x,
|
|
892
|
+
a.flipY ? 0 : a.y,
|
|
893
|
+
a.w,
|
|
894
|
+
a.h
|
|
895
|
+
), t.restore();
|
|
896
|
+
}
|
|
897
|
+
const Yo = 4;
|
|
898
|
+
function Vo(t, e, o, n, a, r, s) {
|
|
899
|
+
if (n <= 2 * s || a <= 2 * s) {
|
|
900
|
+
t.beginPath(), U(t, e, o, n, a, r), t.clip();
|
|
934
901
|
return;
|
|
935
902
|
}
|
|
936
|
-
|
|
903
|
+
t.beginPath(), U(t, e, o, n, a, r), U(t, e + s, o + s, n - 2 * s, a - 2 * s, Math.max(0, r - s)), t.clip("evenodd");
|
|
937
904
|
}
|
|
938
|
-
function
|
|
939
|
-
const g = Math.max(1, Math.round((
|
|
940
|
-
let u = Math.max(0, s),
|
|
941
|
-
for (let
|
|
905
|
+
function jo(t, e, o, n, a, r, s, c, l, f, d) {
|
|
906
|
+
const g = Math.max(1, Math.round((bt + Yo * 3) * d));
|
|
907
|
+
let u = Math.max(0, s), h = !0;
|
|
908
|
+
for (let p = 0; p < 3 && u > 1e-4; p++) {
|
|
942
909
|
const m = Math.min(1, u);
|
|
943
|
-
|
|
910
|
+
t.save(), Vo(t, f.x, f.y, f.w, f.h, f.r, g), t.globalCompositeOperation = h ? "source-over" : "lighter", h = !1, t.globalAlpha = m, de(t, e, o, n, l), t.globalAlpha = 1, t.globalCompositeOperation = "destination-in", t.fillStyle = c, t.fillRect(0, 0, a, r), t.restore(), u -= m;
|
|
944
911
|
}
|
|
945
912
|
}
|
|
946
|
-
function
|
|
913
|
+
function ue(t, e, o, n, a, r, s) {
|
|
947
914
|
const c = s | 0;
|
|
948
|
-
if (c < 1 || n <= 2 * c ||
|
|
949
|
-
|
|
915
|
+
if (c < 1 || n <= 2 * c || a <= 2 * c) {
|
|
916
|
+
t.beginPath(), U(t, e, o, n, a, r), t.clip();
|
|
950
917
|
return;
|
|
951
918
|
}
|
|
952
|
-
|
|
919
|
+
t.beginPath(), U(t, e, o, n, a, r), U(t, e + c, o + c, n - 2 * c, a - 2 * c, Math.max(0, r - c)), t.clip("evenodd");
|
|
953
920
|
}
|
|
954
|
-
function
|
|
955
|
-
let u = c *
|
|
956
|
-
for (let
|
|
921
|
+
function Ko(t, e, o, n, a, r, s, c, l, f, d, g) {
|
|
922
|
+
let u = c * d, h = !0;
|
|
923
|
+
for (let p = 0; p < 3 && u > 1e-4; p++) {
|
|
957
924
|
const m = Math.min(1, u);
|
|
958
|
-
|
|
925
|
+
t.save(), ue(t, s.x, s.y, s.w, s.h, s.r, l), t.globalCompositeOperation = h ? "source-over" : "lighter", h = !1, t.globalAlpha = m, de(t, e, o, n, g), t.globalAlpha = 1, t.globalCompositeOperation = "destination-in", t.fillStyle = f, t.fillRect(0, 0, a, r), t.restore(), u -= m;
|
|
959
926
|
}
|
|
960
927
|
}
|
|
961
|
-
function
|
|
962
|
-
const l =
|
|
963
|
-
l.addColorStop(0, `rgba(255,255,255,${c.toFixed(3)})`), l.addColorStop(0.5, `rgba(255,255,255,${(c * 0.45).toFixed(3)})`), l.addColorStop(1, "rgba(255,255,255,0)"),
|
|
928
|
+
function Qo(t, e, o, n, a, r, s, c) {
|
|
929
|
+
const l = t.createLinearGradient(n, a, r, s);
|
|
930
|
+
l.addColorStop(0, `rgba(255,255,255,${c.toFixed(3)})`), l.addColorStop(0.5, `rgba(255,255,255,${(c * 0.45).toFixed(3)})`), l.addColorStop(1, "rgba(255,255,255,0)"), t.save(), ue(t, e.x, e.y, e.w, e.h, e.r, o), t.globalCompositeOperation = "lighter", t.lineWidth = o * 2, t.strokeStyle = l, t.beginPath(), U(t, e.x, e.y, e.w, e.h, e.r), t.stroke(), t.restore();
|
|
964
931
|
}
|
|
965
|
-
function
|
|
966
|
-
const
|
|
967
|
-
parseFloat(
|
|
968
|
-
parseFloat(
|
|
969
|
-
parseFloat(
|
|
970
|
-
parseFloat(
|
|
932
|
+
function pe(t) {
|
|
933
|
+
const e = getComputedStyle(t), o = [
|
|
934
|
+
parseFloat(e.borderTopLeftRadius) || 0,
|
|
935
|
+
parseFloat(e.borderTopRightRadius) || 0,
|
|
936
|
+
parseFloat(e.borderBottomRightRadius) || 0,
|
|
937
|
+
parseFloat(e.borderBottomLeftRadius) || 0
|
|
971
938
|
].filter((n) => n > 0);
|
|
972
|
-
return
|
|
973
|
-
}
|
|
974
|
-
function
|
|
975
|
-
const
|
|
976
|
-
parseFloat(
|
|
977
|
-
parseFloat(
|
|
978
|
-
parseFloat(
|
|
979
|
-
parseFloat(
|
|
939
|
+
return o.length ? Math.min.apply(null, o) : 0;
|
|
940
|
+
}
|
|
941
|
+
function he(t) {
|
|
942
|
+
const e = getComputedStyle(t), o = Math.max(
|
|
943
|
+
parseFloat(e.borderTopWidth) || 0,
|
|
944
|
+
parseFloat(e.borderRightWidth) || 0,
|
|
945
|
+
parseFloat(e.borderBottomWidth) || 0,
|
|
946
|
+
parseFloat(e.borderLeftWidth) || 0
|
|
980
947
|
);
|
|
981
|
-
let n = 0,
|
|
982
|
-
const r =
|
|
948
|
+
let n = 0, a = 0;
|
|
949
|
+
const r = e.boxShadow;
|
|
983
950
|
if (r && r !== "none") {
|
|
984
|
-
const
|
|
985
|
-
let
|
|
986
|
-
for (const u of
|
|
987
|
-
const
|
|
988
|
-
if (!
|
|
989
|
-
const
|
|
990
|
-
|
|
951
|
+
const f = r.replace(/rgba?\([^)]*\)/g, (u) => u.replace(/,/g, "\0")).split(/,\s*/);
|
|
952
|
+
let d = 1 / 0, g = 1 / 0;
|
|
953
|
+
for (const u of f) {
|
|
954
|
+
const h = u.match(/-?\d+(?:\.\d+)?px/g);
|
|
955
|
+
if (!h || h.length < 4) continue;
|
|
956
|
+
const p = parseFloat(h[3]);
|
|
957
|
+
p > 0 && (/\binset\b/.test(u) ? p < d && (d = p) : p < g && (g = p));
|
|
991
958
|
}
|
|
992
|
-
Number.isFinite(
|
|
959
|
+
Number.isFinite(d) && (n = d), Number.isFinite(g) && (a = g);
|
|
993
960
|
}
|
|
994
|
-
const s = Math.max(
|
|
995
|
-
return { width: Math.max(
|
|
961
|
+
const s = Math.max(o, a);
|
|
962
|
+
return { width: Math.max(o, n, a) || 1, outerCssPx: s };
|
|
996
963
|
}
|
|
997
|
-
function
|
|
998
|
-
|
|
999
|
-
const
|
|
1000
|
-
|
|
964
|
+
function Vt(t) {
|
|
965
|
+
t.cornerRadius = pe(t.el);
|
|
966
|
+
const e = he(t.el);
|
|
967
|
+
t.hairlineWidth = e.width, t.hairlineOuterCssPx = e.outerCssPx;
|
|
1001
968
|
}
|
|
1002
|
-
function
|
|
1003
|
-
typeof ResizeObserver < "u" && (
|
|
969
|
+
function Zo(t) {
|
|
970
|
+
typeof ResizeObserver < "u" && (t.resizeObserver = new ResizeObserver(() => Vt(t)), t.resizeObserver.observe(t.el)), typeof MutationObserver < "u" && (t.mutationObserver = new MutationObserver(() => Vt(t)), t.mutationObserver.observe(t.el, {
|
|
1004
971
|
attributes: !0,
|
|
1005
972
|
attributeFilter: ["style", "class"]
|
|
1006
973
|
}));
|
|
1007
974
|
}
|
|
1008
|
-
function
|
|
1009
|
-
var
|
|
1010
|
-
(
|
|
975
|
+
function Jo(t) {
|
|
976
|
+
var e, o;
|
|
977
|
+
(e = t.resizeObserver) == null || e.disconnect(), t.resizeObserver = null, (o = t.mutationObserver) == null || o.disconnect(), t.mutationObserver = null;
|
|
1011
978
|
}
|
|
1012
979
|
const j = /* @__PURE__ */ new Set();
|
|
1013
|
-
function
|
|
1014
|
-
if (typeof document > "u" ||
|
|
1015
|
-
for (const
|
|
1016
|
-
if (
|
|
980
|
+
function tn(t, e, o) {
|
|
981
|
+
if (typeof document > "u" || zo.has(t.tagName)) return null;
|
|
982
|
+
for (const h of j)
|
|
983
|
+
if (h.el === t) return h;
|
|
1017
984
|
const n = document.createElement("div");
|
|
1018
985
|
n.setAttribute("data-metal-fx-reflection", ""), n.setAttribute("aria-hidden", "true");
|
|
1019
|
-
const
|
|
1020
|
-
|
|
1021
|
-
const r =
|
|
986
|
+
const a = document.createElement("canvas");
|
|
987
|
+
a.className = "metal-fx-reflection-canvas";
|
|
988
|
+
const r = a.getContext("2d", { alpha: !0 });
|
|
1022
989
|
if (!r) return null;
|
|
1023
990
|
const s = document.createElement("canvas");
|
|
1024
991
|
s.className = "metal-fx-reflection-stroke-canvas";
|
|
1025
992
|
const c = s.getContext("2d", { alpha: !0 });
|
|
1026
993
|
if (!c) return null;
|
|
1027
|
-
n.appendChild(
|
|
1028
|
-
const l = getComputedStyle(
|
|
1029
|
-
let d = !1;
|
|
1030
|
-
l.position === "static" && (e.style.position = "relative", d = !0);
|
|
994
|
+
n.appendChild(a), n.appendChild(s);
|
|
995
|
+
const l = getComputedStyle(t);
|
|
1031
996
|
let f = !1;
|
|
1032
|
-
l.
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
997
|
+
l.position === "static" && (t.style.position = "relative", f = !0);
|
|
998
|
+
let d = !1;
|
|
999
|
+
l.isolation !== "isolate" && (t.style.isolation = "isolate", d = !0), t.setAttribute("data-metal-fx-reflect-host", ""), t.insertBefore(n, t.firstChild);
|
|
1000
|
+
const g = he(t), u = {
|
|
1001
|
+
el: t,
|
|
1002
|
+
anchor: e,
|
|
1003
|
+
anchorEl: o,
|
|
1037
1004
|
wrap: n,
|
|
1038
|
-
canvas:
|
|
1005
|
+
canvas: a,
|
|
1039
1006
|
ctx: r,
|
|
1040
1007
|
strokeCanvas: s,
|
|
1041
1008
|
strokeCtx: c,
|
|
1042
|
-
cornerRadius:
|
|
1009
|
+
cornerRadius: pe(t),
|
|
1043
1010
|
hairlineWidth: g.width,
|
|
1044
1011
|
hairlineOuterCssPx: g.outerCssPx,
|
|
1045
|
-
appliedPositionRelative:
|
|
1046
|
-
appliedIsolation:
|
|
1012
|
+
appliedPositionRelative: f,
|
|
1013
|
+
appliedIsolation: d,
|
|
1047
1014
|
resizeObserver: null,
|
|
1048
1015
|
mutationObserver: null
|
|
1049
1016
|
};
|
|
1050
|
-
return
|
|
1017
|
+
return Zo(u), j.add(u), u;
|
|
1051
1018
|
}
|
|
1052
|
-
function en(
|
|
1053
|
-
for (const
|
|
1054
|
-
if (
|
|
1055
|
-
|
|
1019
|
+
function en(t) {
|
|
1020
|
+
for (const e of j)
|
|
1021
|
+
if (e.el === t) {
|
|
1022
|
+
Jo(e), e.canvas.width = 0, e.canvas.height = 0, e.strokeCanvas.width = 0, e.strokeCanvas.height = 0, e.wrap.parentNode === e.el && e.el.removeChild(e.wrap), e.el.removeAttribute("data-metal-fx-reflect-host"), e.appliedPositionRelative && (e.el.style.position = ""), e.appliedIsolation && (e.el.style.isolation = ""), j.delete(e);
|
|
1056
1023
|
return;
|
|
1057
1024
|
}
|
|
1058
1025
|
}
|
|
1059
|
-
function
|
|
1026
|
+
function on() {
|
|
1060
1027
|
if (j.size === 0) return;
|
|
1061
|
-
const
|
|
1062
|
-
for (const
|
|
1063
|
-
const n =
|
|
1064
|
-
let
|
|
1065
|
-
if (
|
|
1066
|
-
if (!
|
|
1067
|
-
|
|
1028
|
+
const t = typeof window < "u" && window.devicePixelRatio || 1, e = /* @__PURE__ */ new Map();
|
|
1029
|
+
for (const o of j) {
|
|
1030
|
+
const n = o.el.getBoundingClientRect();
|
|
1031
|
+
let a = e.get(o.anchorEl);
|
|
1032
|
+
if (a || (a = o.anchorEl.getBoundingClientRect(), e.set(o.anchorEl, a)), n.width < 1 || n.height < 1 || a.width < 1 || a.height < 1) continue;
|
|
1033
|
+
if (!Xo(a, n, Xt, Ut) && !qo(a, n, Xt, Ut)) {
|
|
1034
|
+
o.canvas.width !== 1 && (o.canvas.width = 1, o.canvas.height = 1), o.strokeCanvas.width !== 1 && (o.strokeCanvas.width = 1, o.strokeCanvas.height = 1);
|
|
1068
1035
|
continue;
|
|
1069
1036
|
}
|
|
1070
|
-
const r =
|
|
1037
|
+
const r = o.anchor.canvas, s = r.width | 0, c = r.height | 0;
|
|
1071
1038
|
if (s < 4 || c < 4) continue;
|
|
1072
|
-
const l = (
|
|
1073
|
-
let
|
|
1074
|
-
|
|
1075
|
-
const M =
|
|
1076
|
-
|
|
1077
|
-
M *
|
|
1078
|
-
), P =
|
|
1039
|
+
const l = (a.left + a.right) * 0.5, f = (a.top + a.bottom) * 0.5, d = (n.left + n.right) * 0.5, g = (n.top + n.bottom) * 0.5, u = l - d, h = f - g, p = Math.max(a.left - n.right, n.left - a.right, 0), m = Math.max(a.top - n.bottom, n.top - a.bottom, 0), S = p >= m, x = Uo(a, n);
|
|
1040
|
+
let k = 1 - Math.min(1, x / bt);
|
|
1041
|
+
k = k * k * (3 - 2 * k);
|
|
1042
|
+
const M = qt + (Eo - qt) * k, L = Math.min(
|
|
1043
|
+
Yt,
|
|
1044
|
+
M * Oo * Po
|
|
1045
|
+
), P = o.anchor.scale ?? 1, w = Math.max(Fo * P, o.hairlineWidth), b = Math.max(1, Math.round(w * t)), R = Math.max(
|
|
1079
1046
|
1,
|
|
1080
|
-
Math.round(Math.max(
|
|
1081
|
-
),
|
|
1082
|
-
|
|
1083
|
-
const v = Math.max(1, Math.round((n.width +
|
|
1084
|
-
|
|
1085
|
-
const F =
|
|
1086
|
-
F.setTransform(1, 0, 0, 1, 0, 0), F.clearRect(0, 0, v,
|
|
1087
|
-
const
|
|
1088
|
-
|
|
1089
|
-
const
|
|
1090
|
-
let
|
|
1091
|
-
|
|
1092
|
-
const
|
|
1093
|
-
|
|
1094
|
-
const H = s /
|
|
1095
|
-
let
|
|
1096
|
-
if (
|
|
1097
|
-
const Q = Math.max(
|
|
1098
|
-
|
|
1047
|
+
Math.round(Math.max(Ho * P, o.hairlineWidth) * t)
|
|
1048
|
+
), A = o.hairlineOuterCssPx;
|
|
1049
|
+
o.wrap.style.inset = `${-A}px`, o.wrap.style.borderRadius = `${Math.max(0, o.cornerRadius)}px`;
|
|
1050
|
+
const v = Math.max(1, Math.round((n.width + A * 2) * t)), _ = Math.max(1, Math.round((n.height + A * 2) * t));
|
|
1051
|
+
o.canvas.width !== v && (o.canvas.width = v), o.canvas.height !== _ && (o.canvas.height = _), o.strokeCanvas.width !== v && (o.strokeCanvas.width = v), o.strokeCanvas.height !== _ && (o.strokeCanvas.height = _);
|
|
1052
|
+
const F = o.ctx;
|
|
1053
|
+
F.setTransform(1, 0, 0, 1, 0, 0), F.clearRect(0, 0, v, _);
|
|
1054
|
+
const I = o.strokeCtx;
|
|
1055
|
+
I.setTransform(1, 0, 0, 1, 0, 0), I.clearRect(0, 0, v, _);
|
|
1056
|
+
const y = Math.min(bt * t, Math.max(v, _));
|
|
1057
|
+
let T, $, B, E;
|
|
1058
|
+
S ? (T = u > 0 ? v : 0, B = u > 0 ? v - y : y, $ = _ * 0.5, E = _ * 0.5) : ($ = h > 0 ? _ : 0, E = h > 0 ? _ - y : y, T = v * 0.5, B = v * 0.5);
|
|
1059
|
+
const O = F.createLinearGradient(T, $, B, E);
|
|
1060
|
+
O.addColorStop(0, `rgba(0,0,0,${ko})`), O.addColorStop(0.5, `rgba(0,0,0,${Io})`), O.addColorStop(1, `rgba(0,0,0,${Lo})`);
|
|
1061
|
+
const H = s / t, W = Math.max(1, Math.round(Wo * Math.max(0.1, H / 140) * t));
|
|
1062
|
+
let z, st, lt, ct, At = !1, St = !1;
|
|
1063
|
+
if (S) {
|
|
1064
|
+
const Q = Math.max(a.top, n.top), dt = Math.min(a.bottom, n.bottom);
|
|
1065
|
+
At = !0, z = u > 0 ? v - W : 0, st = Math.round((Q - n.top + A) * t), lt = W, ct = Math.max(1, Math.round((dt - Q) * t));
|
|
1099
1066
|
} else {
|
|
1100
|
-
const Q = Math.max(
|
|
1101
|
-
|
|
1067
|
+
const Q = Math.max(a.left, n.left), dt = Math.min(a.right, n.right);
|
|
1068
|
+
St = !0, z = Math.round((Q - n.left + A) * t), st = h > 0 ? _ - W : 0, lt = Math.max(1, Math.round((dt - Q) * t)), ct = W;
|
|
1102
1069
|
}
|
|
1103
|
-
const
|
|
1104
|
-
|
|
1105
|
-
|
|
1070
|
+
const Ct = { x: z, y: st, w: lt, h: ct, flipX: At, flipY: St }, ft = { x: 0, y: 0, w: v, h: _, r: Math.max(0, o.cornerRadius * t) }, me = Math.min(
|
|
1071
|
+
Yt,
|
|
1072
|
+
L * Go * Do * Bo
|
|
1106
1073
|
);
|
|
1107
|
-
|
|
1108
|
-
|
|
1074
|
+
jo(F, r, s, c, v, _, me, O, Ct, ft, t), Ko(
|
|
1075
|
+
I,
|
|
1109
1076
|
r,
|
|
1110
1077
|
s,
|
|
1111
1078
|
c,
|
|
1112
1079
|
v,
|
|
1080
|
+
_,
|
|
1081
|
+
ft,
|
|
1082
|
+
L,
|
|
1113
1083
|
b,
|
|
1114
|
-
de,
|
|
1115
1084
|
O,
|
|
1116
|
-
|
|
1085
|
+
$o,
|
|
1086
|
+
Ct
|
|
1087
|
+
), Qo(
|
|
1117
1088
|
I,
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
L,
|
|
1122
|
-
de,
|
|
1123
|
-
S,
|
|
1124
|
-
C,
|
|
1089
|
+
ft,
|
|
1090
|
+
R,
|
|
1091
|
+
T,
|
|
1125
1092
|
$,
|
|
1126
1093
|
B,
|
|
1127
|
-
|
|
1128
|
-
Math.min(0.85,
|
|
1129
|
-
), F.globalCompositeOperation = "source-over",
|
|
1094
|
+
E,
|
|
1095
|
+
Math.min(0.85, No * L)
|
|
1096
|
+
), F.globalCompositeOperation = "source-over", I.globalCompositeOperation = "source-over";
|
|
1130
1097
|
}
|
|
1131
1098
|
}
|
|
1132
|
-
let
|
|
1133
|
-
function
|
|
1134
|
-
|
|
1135
|
-
|
|
1099
|
+
let xt = !1, jt = 0;
|
|
1100
|
+
function nn() {
|
|
1101
|
+
xt || (xt = !0, !(typeof requestAnimationFrame > "u") && requestAnimationFrame((t) => {
|
|
1102
|
+
xt = !1, !(t - jt < Se) && (jt = t, on());
|
|
1136
1103
|
}));
|
|
1137
1104
|
}
|
|
1138
|
-
const
|
|
1139
|
-
/* css */
|
|
1140
|
-
`
|
|
1105
|
+
const Kt = "metal-fx-styles", an = `
|
|
1141
1106
|
.metal-fx-root {
|
|
1142
1107
|
position: relative;
|
|
1143
1108
|
display: inline-flex;
|
|
@@ -1178,7 +1143,6 @@ const Ke = "metal-fx-styles", nn = (
|
|
|
1178
1143
|
.metal-fx-root[data-theme='light']::after {
|
|
1179
1144
|
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
|
|
1180
1145
|
}
|
|
1181
|
-
/* Circle variant gets a thicker outer rim than the button variant. */
|
|
1182
1146
|
.metal-fx-root[data-variant='circle']::after {
|
|
1183
1147
|
box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.1);
|
|
1184
1148
|
}
|
|
@@ -1197,12 +1161,6 @@ const Ke = "metal-fx-styles", nn = (
|
|
|
1197
1161
|
border-radius: inherit;
|
|
1198
1162
|
}
|
|
1199
1163
|
|
|
1200
|
-
/* The inner spacer — defines the inset geometry where the metal ring meets
|
|
1201
|
-
the interior (3 px for Button, 1-2 px for Circle) and carries the Circle dark
|
|
1202
|
-
hairline ('box-shadow: inset' rules below). Intentionally transparent so
|
|
1203
|
-
the wrapper's background propagates through to the punched shader centre,
|
|
1204
|
-
giving consumers a single surface tone to override. See "Single-surface
|
|
1205
|
-
background" in the file header for the rationale. */
|
|
1206
1164
|
.metal-fx-inner {
|
|
1207
1165
|
position: absolute;
|
|
1208
1166
|
inset: 3px;
|
|
@@ -1227,41 +1185,11 @@ const Ke = "metal-fx-styles", nn = (
|
|
|
1227
1185
|
border-radius: var(--mfx-radius, 16px);
|
|
1228
1186
|
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45);
|
|
1229
1187
|
}
|
|
1230
|
-
/* Circle-variant hairline alpha — light mode.
|
|
1231
|
-
Source-of-truth: index.html L2261-2267. The 0.45-alpha black inset that
|
|
1232
|
-
reads as a single-pixel frame against the dark interior is too heavy
|
|
1233
|
-
on a #ffffff inner: it ends up looking like a hard 2-px black ring
|
|
1234
|
-
against the iridescent shader. Suppressed entirely (alpha 0) — the
|
|
1235
|
-
shader's own iridescent rim already defines the silhouette in light
|
|
1236
|
-
mode, so an extra dark hairline only competes with it. The rule is
|
|
1237
|
-
kept (rather than deleted) as a tunable hook in case a future variant
|
|
1238
|
-
wants to re-introduce a soft edge. NOTE: we keep the dark-mode inset
|
|
1239
|
-
and border-radius values because — unlike index.html — our renderer
|
|
1240
|
-
does NOT overscan the canvas in light mode, so there is no 1-px gap
|
|
1241
|
-
between inner element and shader to compensate for. */
|
|
1242
1188
|
.metal-fx-root[data-theme='light'][data-variant='circle'][data-shape='pill'] .metal-fx-inner,
|
|
1243
1189
|
.metal-fx-root[data-theme='light'][data-variant='circle'][data-shape='circle'] .metal-fx-inner {
|
|
1244
1190
|
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0);
|
|
1245
1191
|
}
|
|
1246
1192
|
|
|
1247
|
-
/* ─── Combined glow SVG (z=3) ──────────────────────────────────────────────
|
|
1248
|
-
Single SVG per instance that holds BOTH the wide-halo group
|
|
1249
|
-
(#mfx_haloTravel) and the catch-light group (#mfx_extraTravel), exactly
|
|
1250
|
-
mirroring canonical's _buildGlowSvgInner (index.html L8078). One
|
|
1251
|
-
mix-blend-mode: screen lifts the combined composite onto the shader
|
|
1252
|
-
ring; per-frame opacity attributes on each inner group still drive the
|
|
1253
|
-
independent fade-in / fade-out cycles for the halo and the catch-light.
|
|
1254
|
-
|
|
1255
|
-
Why a single SVG: the circle variant anchors halo + catch-light at the same
|
|
1256
|
-
perimeter point, so they overlap in the bright zone. Two separately-
|
|
1257
|
-
screened SVGs would double-screen the overlap (A + B + C - AB - AC -
|
|
1258
|
-
BC + ABC instead of A + B + C - AB - AC once both groups composite
|
|
1259
|
-
in source-over inside one SVG and then screen against the host once).
|
|
1260
|
-
That overlap looked muted versus canonical specifically on the circle
|
|
1261
|
-
variant where both layers travel together.
|
|
1262
|
-
|
|
1263
|
-
Source-of-truth opacity: #btnGlowSvg drops to 0.7 in dark and 0.2746 in
|
|
1264
|
-
light (index.html L632/L643). */
|
|
1265
1193
|
.metal-fx-glow-svg {
|
|
1266
1194
|
position: absolute;
|
|
1267
1195
|
inset: 0;
|
|
@@ -1273,28 +1201,17 @@ const Ke = "metal-fx-styles", nn = (
|
|
|
1273
1201
|
opacity: 0.7;
|
|
1274
1202
|
}
|
|
1275
1203
|
.metal-fx-root[data-theme='light'] .metal-fx-glow-svg {
|
|
1276
|
-
/* Light-mode 1-px overscan mirrors .btn-glow-svg in metal.html so the
|
|
1277
|
-
halo stays glued to the visible silhouette (the shader ring there sits
|
|
1278
|
-
1 px outside the host's padding box). */
|
|
1279
1204
|
inset: -1px;
|
|
1280
1205
|
width: calc(100% + 2px);
|
|
1281
1206
|
height: calc(100% + 2px);
|
|
1282
1207
|
mix-blend-mode: multiply;
|
|
1283
|
-
/* Source-of-truth: html[data-theme="light"] #btnGlowSvg { opacity: 0.2746 }
|
|
1284
|
-
→ −35 % from 0.4225 from the original 0.7 dark-mode opacity. */
|
|
1285
1208
|
opacity: 0.2746;
|
|
1286
1209
|
filter: saturate(5.355) brightness(0.78);
|
|
1287
1210
|
}
|
|
1288
|
-
/* Circle light-mode small variants (e.g. 36×36 send button): the geometrically
|
|
1289
|
-
shrunk halo loses density when multiplied against #ffffff. Mirror the
|
|
1290
|
-
canonical override at index.html L2316 — bump saturation + drop brightness
|
|
1291
|
-
so the small glow holds together visually. */
|
|
1292
1211
|
.metal-fx-root[data-variant='circle'][data-shape='circle'][data-theme='light'] .metal-fx-glow-svg {
|
|
1293
1212
|
filter: saturate(7.5) brightness(0.6);
|
|
1294
1213
|
}
|
|
1295
1214
|
|
|
1296
|
-
/* The wrapped child — hoisted into z=5 so it sits above every overlay, with
|
|
1297
|
-
normalized chrome so consumer button styles don't fight the metal frame. */
|
|
1298
1215
|
.metal-fx-content {
|
|
1299
1216
|
position: relative;
|
|
1300
1217
|
z-index: 5;
|
|
@@ -1312,30 +1229,6 @@ const Ke = "metal-fx-styles", nn = (
|
|
|
1312
1229
|
border: 0 !important;
|
|
1313
1230
|
outline: 0 !important;
|
|
1314
1231
|
box-shadow: none !important;
|
|
1315
|
-
/* Sizing: we deliberately DO NOT force \`width: 100%; height: 100%\` on the
|
|
1316
|
-
child here. That used to be the contract ("the wrapper is the visible
|
|
1317
|
-
button surface; the child stretches to fill it"), but it created a cyclic
|
|
1318
|
-
percentage dependency: the wrapper is \`inline-flex\` with no intrinsic
|
|
1319
|
-
size, .metal-fx-content is \`width/height: 100%\` of the wrapper, and the
|
|
1320
|
-
child was \`100%\` of .metal-fx-content. With nothing breaking the cycle,
|
|
1321
|
-
icon-only / class-sized children collapsed.
|
|
1322
|
-
|
|
1323
|
-
The new contract: the child sizes itself (intrinsic content, CSS class,
|
|
1324
|
-
or inline style — all work), and the wrapper's \`inline-flex\` wraps it
|
|
1325
|
-
tightly. Consumers who want a metal frame BIGGER than the child (e.g.
|
|
1326
|
-
padding around an icon) size <MetalFx style={{ width, height }}> AND
|
|
1327
|
-
explicitly set width/height on the child to fill (or accept that the
|
|
1328
|
-
child renders at its intrinsic size, centered).
|
|
1329
|
-
|
|
1330
|
-
Typography is intentionally NOT touched. We used to apply
|
|
1331
|
-
\`color: inherit; font: inherit;\` here to "match" the wrapper, but
|
|
1332
|
-
\`font: inherit\` is a shorthand that overrides font-family, font-size,
|
|
1333
|
-
font-weight, AND line-height on the child — which (a) shrank the
|
|
1334
|
-
button height (line-height changes propagate through the flex
|
|
1335
|
-
content box) and (b) scaled em-based icons / font-icons inside the
|
|
1336
|
-
child to whatever the wrapper inherited. The wrapper now stays out
|
|
1337
|
-
of the child's typography entirely; consumers who want typographic
|
|
1338
|
-
normalization can apply it themselves on the child element. */
|
|
1339
1232
|
}
|
|
1340
1233
|
|
|
1341
1234
|
[data-metal-fx-reflection] {
|
|
@@ -1363,50 +1256,45 @@ const Ke = "metal-fx-styles", nn = (
|
|
|
1363
1256
|
display: block;
|
|
1364
1257
|
filter: saturate(1.35) brightness(1.75);
|
|
1365
1258
|
}
|
|
1366
|
-
/* Hosts that participate as reflection targets need positioning + isolation
|
|
1367
|
-
so the wrap composites only against the host (not the parent stack). The
|
|
1368
|
-
wrap injects these inline as well, but stating them here keeps reflections
|
|
1369
|
-
working on hosts that already have other inline styles applied. */
|
|
1370
1259
|
[data-metal-fx-reflect-host] {
|
|
1371
1260
|
isolation: isolate;
|
|
1372
1261
|
}
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
if (
|
|
1378
|
-
|
|
1379
|
-
ve = !0;
|
|
1262
|
+
`;
|
|
1263
|
+
let vt = !1;
|
|
1264
|
+
function rn() {
|
|
1265
|
+
if (vt || typeof document > "u") return;
|
|
1266
|
+
if (document.getElementById(Kt)) {
|
|
1267
|
+
vt = !0;
|
|
1380
1268
|
return;
|
|
1381
1269
|
}
|
|
1382
|
-
const
|
|
1383
|
-
|
|
1384
|
-
}
|
|
1385
|
-
const
|
|
1386
|
-
|
|
1387
|
-
const
|
|
1388
|
-
|
|
1389
|
-
const
|
|
1390
|
-
|
|
1270
|
+
const t = document.createElement("style");
|
|
1271
|
+
t.id = Kt, t.textContent = an, document.head.appendChild(t), vt = !0;
|
|
1272
|
+
}
|
|
1273
|
+
const sn = ["data-variant", "data-shape", "data-theme", "data-paused", "data-normalize"];
|
|
1274
|
+
rn();
|
|
1275
|
+
const ln = { position: "absolute", inset: "0", width: "100%", height: "100%" }, cn = { position: "absolute", inset: "3px" }, fn = { position: "absolute", inset: "0", pointerEvents: "none", zIndex: 3, borderRadius: "inherit" }, rt = /* @__PURE__ */ new Map();
|
|
1276
|
+
Ke((t, e) => {
|
|
1277
|
+
const o = rt.get(t);
|
|
1278
|
+
o && To(o.handles, t, e, t.opacityMul, o.themeRef.current);
|
|
1391
1279
|
});
|
|
1392
|
-
function dn(
|
|
1393
|
-
const
|
|
1280
|
+
function dn(t) {
|
|
1281
|
+
const o = V(((c) => c !== "auto" ? c : typeof window > "u" || !window.matchMedia || window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light")(t()));
|
|
1394
1282
|
let n = null;
|
|
1395
|
-
const
|
|
1396
|
-
n && (
|
|
1283
|
+
const a = () => {
|
|
1284
|
+
n && (o.value = n.matches ? "dark" : "light");
|
|
1397
1285
|
}, r = () => {
|
|
1398
|
-
n == null || n.removeEventListener("change",
|
|
1286
|
+
n == null || n.removeEventListener("change", a), n = null;
|
|
1399
1287
|
}, s = () => {
|
|
1400
|
-
if (r(),
|
|
1401
|
-
|
|
1288
|
+
if (r(), t() !== "auto") {
|
|
1289
|
+
o.value = t();
|
|
1402
1290
|
return;
|
|
1403
1291
|
}
|
|
1404
|
-
typeof window > "u" || !window.matchMedia || (n = window.matchMedia("(prefers-color-scheme: dark)"),
|
|
1292
|
+
typeof window > "u" || !window.matchMedia || (n = window.matchMedia("(prefers-color-scheme: dark)"), a(), n.addEventListener("change", a));
|
|
1405
1293
|
};
|
|
1406
|
-
return
|
|
1294
|
+
return Qt(s), D(t, s), Zt(r), o;
|
|
1407
1295
|
}
|
|
1408
|
-
const
|
|
1409
|
-
__name: "
|
|
1296
|
+
const mn = /* @__PURE__ */ ge({
|
|
1297
|
+
__name: "ShingenMetal",
|
|
1410
1298
|
props: {
|
|
1411
1299
|
variant: { default: "button" },
|
|
1412
1300
|
preset: { default: "chromatic" },
|
|
@@ -1421,185 +1309,184 @@ const pn = /* @__PURE__ */ gt({
|
|
|
1421
1309
|
ringCssPx: {},
|
|
1422
1310
|
scale: { default: 1 }
|
|
1423
1311
|
},
|
|
1424
|
-
setup(
|
|
1425
|
-
const
|
|
1426
|
-
let c = null, l = null,
|
|
1427
|
-
const
|
|
1312
|
+
setup(t, { expose: e }) {
|
|
1313
|
+
const o = t, n = V(null), a = V(null), r = V(null), s = V(null);
|
|
1314
|
+
let c = null, l = null, f = 0;
|
|
1315
|
+
const d = V(!1), g = dn(() => o.theme), u = { get current() {
|
|
1428
1316
|
return g.value;
|
|
1429
|
-
} },
|
|
1430
|
-
|
|
1431
|
-
/** The wrapper element, mirroring the React version's forwarded ref. */
|
|
1317
|
+
} }, h = ut(() => o.variant === "circle" ? "circle" : "pill"), p = ut(() => !o.disableGlow);
|
|
1318
|
+
e({
|
|
1432
1319
|
rootEl: n
|
|
1433
1320
|
});
|
|
1434
|
-
const m = (
|
|
1435
|
-
if (
|
|
1436
|
-
const
|
|
1321
|
+
const m = (w, b) => {
|
|
1322
|
+
if (h.value === "circle") return Math.min(w, b) / 2;
|
|
1323
|
+
const R = typeof o.borderRadius == "number" ? o.borderRadius : (() => {
|
|
1437
1324
|
var v;
|
|
1438
|
-
const
|
|
1439
|
-
if (
|
|
1440
|
-
const
|
|
1441
|
-
if (Number.isFinite(
|
|
1325
|
+
const A = (v = s.value) == null ? void 0 : v.firstElementChild;
|
|
1326
|
+
if (A) {
|
|
1327
|
+
const _ = parseFloat(getComputedStyle(A).borderTopLeftRadius);
|
|
1328
|
+
if (Number.isFinite(_) && _ > 0) return _;
|
|
1442
1329
|
}
|
|
1443
|
-
return
|
|
1330
|
+
return f;
|
|
1444
1331
|
})();
|
|
1445
|
-
return Math.min(
|
|
1332
|
+
return Math.min(R, Math.min(w, b) / 2);
|
|
1446
1333
|
};
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
}, { immediate: !0 }),
|
|
1450
|
-
c &&
|
|
1451
|
-
}),
|
|
1334
|
+
D([() => o.preset, g], ([w, b]) => {
|
|
1335
|
+
je(w, b);
|
|
1336
|
+
}, { immediate: !0 }), D(() => o.paused, (w) => {
|
|
1337
|
+
c && Z(c, { paused: w });
|
|
1338
|
+
}), D([() => o.shaderScale, () => o.ringCssPx, () => o.scale], ([w, b, R]) => {
|
|
1452
1339
|
if (!c) return;
|
|
1453
|
-
const
|
|
1454
|
-
|
|
1340
|
+
const A = {};
|
|
1341
|
+
w !== void 0 && (A.shaderScale = w), b !== void 0 && (A.ringCssPx = b), R !== void 0 && (A.scale = R), Object.keys(A).length > 0 && Z(c, A);
|
|
1455
1342
|
});
|
|
1456
|
-
const
|
|
1457
|
-
c &&
|
|
1343
|
+
const S = () => {
|
|
1344
|
+
c && Z(c, { opacityMul: Math.max(0, Math.min(1, o.strength)) });
|
|
1458
1345
|
};
|
|
1459
|
-
|
|
1346
|
+
D([() => o.strength, () => o.variant], S);
|
|
1460
1347
|
let x = null;
|
|
1461
|
-
const
|
|
1462
|
-
const
|
|
1463
|
-
if (!
|
|
1348
|
+
const k = () => {
|
|
1349
|
+
const w = a.value, b = n.value, R = r.value;
|
|
1350
|
+
if (!w || !b) return;
|
|
1464
1351
|
{
|
|
1465
|
-
const
|
|
1466
|
-
|
|
1352
|
+
const y = getComputedStyle(b), T = parseFloat(y.borderTopLeftRadius);
|
|
1353
|
+
f = Number.isFinite(T) ? T : 0;
|
|
1467
1354
|
}
|
|
1468
|
-
const
|
|
1469
|
-
const
|
|
1470
|
-
return { cssWidth:
|
|
1471
|
-
}, v =
|
|
1472
|
-
c =
|
|
1473
|
-
hostCanvas:
|
|
1355
|
+
const A = () => {
|
|
1356
|
+
const y = b.getBoundingClientRect(), T = Math.max(1, Math.round(y.width)), $ = Math.max(1, Math.round(y.height));
|
|
1357
|
+
return { cssWidth: T, cssHeight: $, cornerRadius: m(T, $) };
|
|
1358
|
+
}, v = A();
|
|
1359
|
+
c = Ue({
|
|
1360
|
+
hostCanvas: w,
|
|
1474
1361
|
cssWidth: v.cssWidth,
|
|
1475
1362
|
cssHeight: v.cssHeight,
|
|
1476
1363
|
cornerRadius: v.cornerRadius,
|
|
1477
|
-
kind:
|
|
1478
|
-
paused:
|
|
1479
|
-
shaderScale:
|
|
1480
|
-
ringCssPx:
|
|
1481
|
-
scale:
|
|
1364
|
+
kind: h.value,
|
|
1365
|
+
paused: o.paused,
|
|
1366
|
+
shaderScale: o.shaderScale,
|
|
1367
|
+
ringCssPx: o.ringCssPx,
|
|
1368
|
+
scale: o.scale,
|
|
1482
1369
|
onFirstCopy: () => {
|
|
1483
|
-
|
|
1370
|
+
d.value = !0;
|
|
1484
1371
|
}
|
|
1485
|
-
}),
|
|
1372
|
+
}), b.style.setProperty("--mfx-radius", `${v.cornerRadius}px`), b.style.borderRadius = `${v.cornerRadius}px`, S(), R && (l = zt(R, {
|
|
1486
1373
|
width: v.cssWidth,
|
|
1487
1374
|
height: v.cssHeight,
|
|
1488
1375
|
cornerRadius: v.cornerRadius,
|
|
1489
|
-
kind:
|
|
1490
|
-
scale:
|
|
1376
|
+
kind: h.value,
|
|
1377
|
+
scale: o.scale
|
|
1491
1378
|
}));
|
|
1492
|
-
let
|
|
1379
|
+
let _ = 0;
|
|
1493
1380
|
const F = new ResizeObserver(() => {
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
const
|
|
1497
|
-
|
|
1498
|
-
width:
|
|
1499
|
-
height:
|
|
1500
|
-
cornerRadius:
|
|
1501
|
-
kind:
|
|
1502
|
-
scale:
|
|
1503
|
-
}),
|
|
1381
|
+
_ === 0 && (_ = requestAnimationFrame(() => {
|
|
1382
|
+
_ = 0;
|
|
1383
|
+
const y = A(), T = c;
|
|
1384
|
+
T && (Z(T, { cssWidth: y.cssWidth, cssHeight: y.cssHeight, cornerRadius: y.cornerRadius }), b.style.setProperty("--mfx-radius", `${y.cornerRadius}px`), b.style.borderRadius = `${y.cornerRadius}px`, R && (R.innerHTML = "", l = zt(R, {
|
|
1385
|
+
width: y.cssWidth,
|
|
1386
|
+
height: y.cssHeight,
|
|
1387
|
+
cornerRadius: y.cornerRadius,
|
|
1388
|
+
kind: h.value,
|
|
1389
|
+
scale: o.scale
|
|
1390
|
+
}), T && l && rt.set(T, { handles: l, themeRef: u })));
|
|
1504
1391
|
}));
|
|
1505
1392
|
});
|
|
1506
|
-
F.observe(
|
|
1507
|
-
let
|
|
1508
|
-
typeof IntersectionObserver < "u" && (
|
|
1509
|
-
(
|
|
1510
|
-
const
|
|
1511
|
-
if (
|
|
1512
|
-
for (const $ of
|
|
1393
|
+
F.observe(b);
|
|
1394
|
+
let I = null;
|
|
1395
|
+
typeof IntersectionObserver < "u" && (I = new IntersectionObserver(
|
|
1396
|
+
(y) => {
|
|
1397
|
+
const T = c;
|
|
1398
|
+
if (T)
|
|
1399
|
+
for (const $ of y) Ve(T, $.isIntersecting);
|
|
1513
1400
|
},
|
|
1514
1401
|
{ rootMargin: "64px" }
|
|
1515
|
-
),
|
|
1516
|
-
F.disconnect(),
|
|
1517
|
-
const
|
|
1518
|
-
|
|
1402
|
+
), I.observe(b)), c && l && (rt.set(c, { handles: l, themeRef: u }), qe(c)), x = () => {
|
|
1403
|
+
F.disconnect(), I == null || I.disconnect(), _ !== 0 && cancelAnimationFrame(_);
|
|
1404
|
+
const y = c;
|
|
1405
|
+
y && (rt.delete(y), Ye(y), Xe(y)), c = null, l = null, R && (R.innerHTML = "");
|
|
1519
1406
|
};
|
|
1520
1407
|
};
|
|
1521
1408
|
let M = null;
|
|
1522
|
-
const
|
|
1409
|
+
const L = () => {
|
|
1523
1410
|
M == null || M(), M = null;
|
|
1524
|
-
const
|
|
1525
|
-
if (!
|
|
1526
|
-
|
|
1527
|
-
const
|
|
1528
|
-
const
|
|
1529
|
-
return
|
|
1411
|
+
const w = c, b = n.value, R = o.reflectionTargets;
|
|
1412
|
+
if (!w || !b || !R || g.value !== "dark") return;
|
|
1413
|
+
w.onAfterFrame = nn;
|
|
1414
|
+
const A = R.flatMap((v) => {
|
|
1415
|
+
const _ = we(v);
|
|
1416
|
+
return _ ? [_] : [];
|
|
1530
1417
|
});
|
|
1531
|
-
for (const v of
|
|
1418
|
+
for (const v of A) tn(v, w, b);
|
|
1532
1419
|
M = () => {
|
|
1533
|
-
|
|
1534
|
-
for (const v of
|
|
1420
|
+
w.onAfterFrame = void 0;
|
|
1421
|
+
for (const v of A) en(v);
|
|
1535
1422
|
};
|
|
1536
1423
|
};
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
}),
|
|
1540
|
-
x == null || x(), x = null, M == null || M(), M = null,
|
|
1541
|
-
}, { flush: "post" }),
|
|
1542
|
-
|
|
1543
|
-
}, { flush: "post" }),
|
|
1424
|
+
Qt(() => {
|
|
1425
|
+
k(), Tt(L);
|
|
1426
|
+
}), D(h, () => {
|
|
1427
|
+
x == null || x(), x = null, M == null || M(), M = null, k(), Tt(L);
|
|
1428
|
+
}, { flush: "post" }), D([() => o.reflectionTargets, g], () => {
|
|
1429
|
+
L();
|
|
1430
|
+
}, { flush: "post" }), Zt(() => {
|
|
1544
1431
|
M == null || M(), M = null, x == null || x(), x = null;
|
|
1545
|
-
}),
|
|
1546
|
-
const
|
|
1547
|
-
if (!
|
|
1548
|
-
const
|
|
1549
|
-
|
|
1432
|
+
}), D([() => o.borderRadius, g, () => o.variant], () => {
|
|
1433
|
+
const w = n.value, b = c;
|
|
1434
|
+
if (!w || !b) return;
|
|
1435
|
+
const R = m(b.cssWidth, b.cssHeight);
|
|
1436
|
+
Z(b, { cornerRadius: R }), w.style.setProperty("--mfx-radius", `${R}px`), w.style.borderRadius = `${R}px`;
|
|
1550
1437
|
}, { flush: "post" });
|
|
1551
|
-
const P =
|
|
1552
|
-
"--mfx-strength": String(Math.min(1, Math.max(0,
|
|
1553
|
-
opacity:
|
|
1554
|
-
visibility:
|
|
1555
|
-
transition:
|
|
1438
|
+
const P = ut(() => ({
|
|
1439
|
+
"--mfx-strength": String(Math.min(1, Math.max(0, o.strength))),
|
|
1440
|
+
opacity: d.value ? 1 : 0,
|
|
1441
|
+
visibility: d.value ? "visible" : "hidden",
|
|
1442
|
+
transition: d.value ? "opacity 0.15s ease-out" : "none"
|
|
1556
1443
|
}));
|
|
1557
|
-
return (
|
|
1444
|
+
return (w, b) => (xe(), ve("div", {
|
|
1558
1445
|
ref_key: "rootRef",
|
|
1559
1446
|
ref: n,
|
|
1560
1447
|
class: "metal-fx-root",
|
|
1561
|
-
"data-variant":
|
|
1562
|
-
"data-shape":
|
|
1563
|
-
"data-theme":
|
|
1564
|
-
"data-paused":
|
|
1565
|
-
"data-normalize":
|
|
1566
|
-
style:
|
|
1448
|
+
"data-variant": t.variant,
|
|
1449
|
+
"data-shape": h.value,
|
|
1450
|
+
"data-theme": _e(g),
|
|
1451
|
+
"data-paused": t.paused ? "true" : void 0,
|
|
1452
|
+
"data-normalize": t.normalizeHostStyles ? "true" : "false",
|
|
1453
|
+
style: Et(P.value)
|
|
1567
1454
|
}, [
|
|
1568
|
-
|
|
1455
|
+
et("canvas", {
|
|
1569
1456
|
ref_key: "canvasRef",
|
|
1570
|
-
ref:
|
|
1457
|
+
ref: a,
|
|
1571
1458
|
class: "metal-fx-canvas",
|
|
1572
|
-
style:
|
|
1459
|
+
style: ln
|
|
1573
1460
|
}, null, 512),
|
|
1574
|
-
|
|
1461
|
+
et("div", {
|
|
1575
1462
|
class: "metal-fx-inner",
|
|
1576
1463
|
"aria-hidden": "true",
|
|
1577
|
-
style:
|
|
1464
|
+
style: cn
|
|
1578
1465
|
}),
|
|
1579
|
-
|
|
1466
|
+
et("div", {
|
|
1580
1467
|
ref_key: "glowHostRef",
|
|
1581
1468
|
ref: r,
|
|
1582
1469
|
"aria-hidden": "true",
|
|
1583
|
-
style:
|
|
1470
|
+
style: Et([fn, p.value ? null : { display: "none" }])
|
|
1584
1471
|
}, null, 4),
|
|
1585
|
-
|
|
1472
|
+
et("div", {
|
|
1586
1473
|
ref_key: "contentRef",
|
|
1587
1474
|
ref: s,
|
|
1588
1475
|
class: "metal-fx-content"
|
|
1589
1476
|
}, [
|
|
1590
|
-
|
|
1477
|
+
be(w.$slots, "default")
|
|
1591
1478
|
], 512)
|
|
1592
|
-
], 12,
|
|
1479
|
+
], 12, sn));
|
|
1593
1480
|
}
|
|
1594
1481
|
});
|
|
1595
1482
|
export {
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1483
|
+
Jt as PRESETS,
|
|
1484
|
+
mn as ShingenMetal,
|
|
1485
|
+
Ue as createInstance,
|
|
1486
|
+
Xe as destroyInstance,
|
|
1487
|
+
ye as hexToRgb,
|
|
1488
|
+
pn as pauseShared,
|
|
1602
1489
|
hn as resumeShared,
|
|
1603
|
-
|
|
1604
|
-
|
|
1490
|
+
je as setSharedPreset,
|
|
1491
|
+
Z as updateInstance
|
|
1605
1492
|
};
|