@actioneer/ads 0.5.6 → 0.5.7
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/components/agent-icon.js +3 -2
- package/components/ai-elements/chain-of-thought-icon.d.ts +10 -12
- package/components/ai-elements/chain-of-thought-icon.js +341 -201
- package/components/ai-elements/chain-of-thought.d.ts +1 -1
- package/components/answer-sources.d.ts +42 -0
- package/components/answer-sources.js +111 -0
- package/components/assistant-ui/attachment.js +39 -39
- package/components/assistant-ui/composer-harness.js +5 -4
- package/components/assistant-ui/thread-context.d.ts +2 -0
- package/components/assistant-ui/thread.js +41 -40
- package/components/avatar.js +14 -14
- package/components/dropdown.d.ts +1 -1
- package/components/dropdown.js +1 -1
- package/components/empty-state.d.ts +4 -4
- package/components/index.d.ts +1 -0
- package/components/index.js +408 -403
- package/components/infinite-canvas.js +1 -1
- package/components/pixel-icon.d.ts +3 -1
- package/components/pixel-icon.js +294 -214
- package/components/segmented.d.ts +4 -1
- package/components/segmented.js +9 -8
- package/components/sidebar.d.ts +2 -2
- package/components/switch.js +22 -4
- package/components/table.d.ts +15 -7
- package/components/table.js +313 -199
- package/components/textarea.js +1 -2
- package/components/tooltip.js +1 -1
- package/components/ui/tooltip.js +5 -5
- package/lib/icons.d.ts +8 -0
- package/lib/icons.js +103 -101
- package/llms.txt +17 -8
- package/manifest.json +107 -14
- package/package.json +1 -1
- package/styles.css +42 -47
- package/theme.css +24 -45
package/components/pixel-icon.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
import { jsx as
|
|
6
|
-
import * as
|
|
7
|
-
import { Renderer as
|
|
8
|
-
import { cn as
|
|
2
|
+
var G = Object.defineProperty;
|
|
3
|
+
var I = (r, e, o) => e in r ? G(r, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : r[e] = o;
|
|
4
|
+
var i = (r, e, o) => I(r, typeof e != "symbol" ? e + "" : e, o);
|
|
5
|
+
import { jsx as O } from "react/jsx-runtime";
|
|
6
|
+
import * as P from "react";
|
|
7
|
+
import { Renderer as z, Triangle as K, Program as U, Mesh as _, Texture as N } from "ogl";
|
|
8
|
+
import { cn as q } from "../lib/cn.js";
|
|
9
9
|
const R = {
|
|
10
10
|
growth: [
|
|
11
11
|
"...##....##....##",
|
|
@@ -76,24 +76,53 @@ const R = {
|
|
|
76
76
|
"..#...#..#..##.",
|
|
77
77
|
"..#####..###...",
|
|
78
78
|
"..............."
|
|
79
|
+
],
|
|
80
|
+
artifacts: [
|
|
81
|
+
"...............",
|
|
82
|
+
"...............",
|
|
83
|
+
"..#####.#####..",
|
|
84
|
+
"..#####.#####..",
|
|
85
|
+
"..#####.#####..",
|
|
86
|
+
"..#####.#####..",
|
|
87
|
+
"..#####.#####..",
|
|
88
|
+
"...............",
|
|
89
|
+
"..#####.#####..",
|
|
90
|
+
"..#####.#####..",
|
|
91
|
+
"..#####.#####..",
|
|
92
|
+
"..#####.#####..",
|
|
93
|
+
"..#####.#####..",
|
|
94
|
+
"...............",
|
|
95
|
+
"..............."
|
|
79
96
|
]
|
|
80
|
-
},
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
],
|
|
92
|
-
|
|
93
|
-
"
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
+
}, D = [
|
|
98
|
+
"var(--color-ink-950)",
|
|
99
|
+
"var(--color-ink-950)",
|
|
100
|
+
"var(--color-ink-900)",
|
|
101
|
+
"var(--color-ink-900)",
|
|
102
|
+
"var(--color-ink-850)",
|
|
103
|
+
"var(--color-ink-850)",
|
|
104
|
+
"var(--color-ink-800)",
|
|
105
|
+
"var(--color-ink-800)",
|
|
106
|
+
"var(--color-ink-700)",
|
|
107
|
+
"var(--color-ink-700)"
|
|
108
|
+
], V = [
|
|
109
|
+
"var(--color-warning-700)",
|
|
110
|
+
"var(--color-warning-700)",
|
|
111
|
+
"var(--color-warning-600)",
|
|
112
|
+
"var(--color-amber-deep)",
|
|
113
|
+
"var(--color-warning-500)",
|
|
114
|
+
"var(--color-amber-base)",
|
|
115
|
+
"var(--color-amber-base)",
|
|
116
|
+
"var(--color-chart-2)",
|
|
117
|
+
"var(--color-amber-soft)",
|
|
118
|
+
"var(--color-amber-soft)"
|
|
119
|
+
], A = {
|
|
120
|
+
growth: D,
|
|
121
|
+
"document-agent": D,
|
|
122
|
+
search: D,
|
|
123
|
+
books: D,
|
|
124
|
+
artifacts: V
|
|
125
|
+
}, F = /* @__PURE__ */ new Set(), X = ["#c7cad0", "#d0d3d8", "#d8dade", "#dfe1e4", "#e6e7e9"], S = 0, Y = (
|
|
97
126
|
/* glsl */
|
|
98
127
|
`
|
|
99
128
|
attribute vec2 uv;
|
|
@@ -106,7 +135,7 @@ const R = {
|
|
|
106
135
|
gl_Position = vec4(position, 0.0, 1.0);
|
|
107
136
|
}
|
|
108
137
|
`
|
|
109
|
-
),
|
|
138
|
+
), W = (
|
|
110
139
|
/* glsl */
|
|
111
140
|
`
|
|
112
141
|
precision highp float;
|
|
@@ -138,6 +167,8 @@ const R = {
|
|
|
138
167
|
uniform vec3 uColor7;
|
|
139
168
|
uniform vec3 uColor8;
|
|
140
169
|
uniform vec3 uColor9;
|
|
170
|
+
uniform vec3 uInteractionColor;
|
|
171
|
+
uniform float uUseInteractionColor;
|
|
141
172
|
|
|
142
173
|
varying vec2 vUv;
|
|
143
174
|
|
|
@@ -166,7 +197,7 @@ const R = {
|
|
|
166
197
|
}
|
|
167
198
|
|
|
168
199
|
void main() {
|
|
169
|
-
const float padding = ${
|
|
200
|
+
const float padding = ${S.toFixed(4)};
|
|
170
201
|
vec2 iconUv = (vUv - padding) / (1.0 - padding * 2.0);
|
|
171
202
|
|
|
172
203
|
if (iconUv.x < 0.0 || iconUv.x > 1.0 || iconUv.y < 0.0 || iconUv.y > 1.0) {
|
|
@@ -203,7 +234,7 @@ const R = {
|
|
|
203
234
|
float mode5 = 1.0 - step(0.5, abs(uMode - 5.0));
|
|
204
235
|
float hoverMotion = uHover * uMotion * symbolCell;
|
|
205
236
|
float blastSuppression = uBlast * (1.0 - smoothstep(0.98, 1.35, uBlastTime));
|
|
206
|
-
float
|
|
237
|
+
float radialGrowMode = mode3 * (1.0 - blastSuppression);
|
|
207
238
|
float particleHoverMode = mode5;
|
|
208
239
|
|
|
209
240
|
vec2 pointerCell = floor(uPointer * uGrid);
|
|
@@ -276,9 +307,9 @@ const R = {
|
|
|
276
307
|
scatterReach * scatterSignal
|
|
277
308
|
);
|
|
278
309
|
|
|
279
|
-
float particleReach = (1.0 - smoothstep(0.
|
|
280
|
-
float particleSettle = 0.
|
|
281
|
-
uHoverTime *
|
|
310
|
+
float particleReach = (1.0 - smoothstep(0.15, 8.0, cellDistance)) * hoverMotion;
|
|
311
|
+
float particleSettle = 0.72 + 0.28 * sin(
|
|
312
|
+
uHoverTime * 7.2 - cellDistance * 1.42 + random * 3.1
|
|
282
313
|
);
|
|
283
314
|
float particleForce = particleReach * particleSettle;
|
|
284
315
|
float particleAngle = random * 6.2831853;
|
|
@@ -286,8 +317,8 @@ const R = {
|
|
|
286
317
|
vec2 particleAway = normalize((cellCenter - uPointer) * uGrid + particleJitter);
|
|
287
318
|
vec2 particleOffset = particleAway
|
|
288
319
|
* particleForce
|
|
289
|
-
* (0.
|
|
290
|
-
float
|
|
320
|
+
* (0.255 + 0.045 * sin(uHoverTime * 6.1 + random * 7.0));
|
|
321
|
+
float radialGrow = max(
|
|
291
322
|
directCell * hoverMotion,
|
|
292
323
|
(1.0 - smoothstep(0.15, 2.85, cellDistance)) * hoverMotion
|
|
293
324
|
);
|
|
@@ -297,7 +328,7 @@ const R = {
|
|
|
297
328
|
float angle = 0.0;
|
|
298
329
|
vec2 tileOffset = vec2(0.0);
|
|
299
330
|
|
|
300
|
-
tileScale
|
|
331
|
+
tileScale += radialGrowMode * radialGrow * 0.15;
|
|
301
332
|
|
|
302
333
|
tileScale += mode0 * (directCell * hoverMotion * 0.075 + colorRipple * 0.045);
|
|
303
334
|
|
|
@@ -332,17 +363,17 @@ const R = {
|
|
|
332
363
|
angle += mode4 * (random - 0.5) * signalScatter * 0.62;
|
|
333
364
|
|
|
334
365
|
tileScale += particleHoverMode * (
|
|
335
|
-
-particleForce * 0.
|
|
336
|
-
+ directCell * hoverMotion * (0.
|
|
366
|
+
-particleForce * 0.34
|
|
367
|
+
+ directCell * hoverMotion * (0.035 + 0.025 * sin(uHoverTime * 7.2))
|
|
337
368
|
);
|
|
338
|
-
springShape += particleHoverMode * vec2(-particleForce * 0.
|
|
369
|
+
springShape += particleHoverMode * vec2(-particleForce * 0.12, particleForce * 0.18);
|
|
339
370
|
angle += particleHoverMode * (
|
|
340
|
-
(random - 0.5) * particleForce *
|
|
341
|
-
+ directCell * hoverMotion * sin(uHoverTime *
|
|
371
|
+
(random - 0.5) * particleForce * 1.5
|
|
372
|
+
+ directCell * hoverMotion * sin(uHoverTime * 6.2) * 0.13
|
|
342
373
|
);
|
|
343
374
|
tileOffset += particleHoverMode * particleOffset;
|
|
344
375
|
|
|
345
|
-
float minimumTileScale = 0.64 - particleHoverMode * 0.
|
|
376
|
+
float minimumTileScale = 0.64 - particleHoverMode * 0.16 - radialGrowMode * 0.1;
|
|
346
377
|
tileScale = clamp(tileScale, minimumTileScale, 0.97) * intro;
|
|
347
378
|
springShape = max(springShape, vec2(0.72));
|
|
348
379
|
|
|
@@ -395,17 +426,26 @@ const R = {
|
|
|
395
426
|
+ frameColor * frameCell;
|
|
396
427
|
|
|
397
428
|
vec3 rippleColor = mix(
|
|
398
|
-
|
|
399
|
-
|
|
429
|
+
palette(1.0),
|
|
430
|
+
palette(4.0),
|
|
400
431
|
0.5 + 0.5 * sin(uHoverTime * 2.6 + cellDistance * 0.32)
|
|
401
432
|
);
|
|
402
433
|
vec3 elasticColor = vec3(1.0, 0.46, 0.1);
|
|
403
434
|
vec3 magneticColor = vec3(0.08, 0.76, 0.64);
|
|
404
|
-
vec3
|
|
405
|
-
|
|
435
|
+
vec3 interactionColor = mix(
|
|
436
|
+
vec3(0.612, 0.8, 0.576),
|
|
437
|
+
uInteractionColor,
|
|
438
|
+
uUseInteractionColor
|
|
439
|
+
);
|
|
440
|
+
vec3 interactionBlastColor = mix(
|
|
441
|
+
vec3(0.247, 0.478, 0.204),
|
|
442
|
+
uInteractionColor,
|
|
443
|
+
uUseInteractionColor
|
|
444
|
+
);
|
|
445
|
+
vec3 echoColor = interactionColor;
|
|
406
446
|
vec3 blastColor = mix(
|
|
407
447
|
vec3(1.0),
|
|
408
|
-
|
|
448
|
+
interactionBlastColor,
|
|
409
449
|
smoothstep(0.0, 0.42, uBlastTime)
|
|
410
450
|
);
|
|
411
451
|
vec3 scatterColor = mix(
|
|
@@ -430,11 +470,6 @@ const R = {
|
|
|
430
470
|
magneticColor,
|
|
431
471
|
mode2 * clamp(max(magneticField * 0.72, directCell * hoverMotion * 0.72), 0.0, 0.82)
|
|
432
472
|
);
|
|
433
|
-
color = mix(
|
|
434
|
-
color,
|
|
435
|
-
shrinkHoverColor,
|
|
436
|
-
radialShrinkMode * clamp(radialShrink * 0.98, 0.0, 0.98)
|
|
437
|
-
);
|
|
438
473
|
color = mix(
|
|
439
474
|
color,
|
|
440
475
|
echoColor,
|
|
@@ -454,133 +489,149 @@ const R = {
|
|
|
454
489
|
color,
|
|
455
490
|
particleColor,
|
|
456
491
|
particleHoverMode
|
|
457
|
-
* clamp(max(particleForce * 1.
|
|
492
|
+
* clamp(max(particleForce * 1.25, directCell * hoverMotion), 0.0, 0.98)
|
|
458
493
|
);
|
|
459
494
|
|
|
460
495
|
float cellOpacity = mix(0.1, 1.0, iconCell);
|
|
461
496
|
gl_FragColor = vec4(color, outerBox * diagonalStroke * presence * intro * cellOpacity);
|
|
462
497
|
}
|
|
463
498
|
`
|
|
464
|
-
),
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
499
|
+
), y = typeof window < "u" ? window.matchMedia("(prefers-reduced-motion: reduce)") : {
|
|
500
|
+
matches: !1
|
|
501
|
+
};
|
|
502
|
+
function f(r) {
|
|
503
|
+
const e = Number.parseInt(r.slice(1), 16);
|
|
504
|
+
return [
|
|
505
|
+
(e >> 16 & 255) / 255,
|
|
506
|
+
(e >> 8 & 255) / 255,
|
|
507
|
+
(e & 255) / 255
|
|
508
|
+
];
|
|
468
509
|
}
|
|
469
|
-
function
|
|
470
|
-
|
|
471
|
-
|
|
510
|
+
function E(r, e) {
|
|
511
|
+
var n;
|
|
512
|
+
const o = (n = r.match(/^var\((--[^)]+)\)$/)) == null ? void 0 : n[1];
|
|
513
|
+
return o ? getComputedStyle(e).getPropertyValue(o).trim() : r;
|
|
514
|
+
}
|
|
515
|
+
function L(r) {
|
|
516
|
+
const e = r.length, o = r[0].length, n = Array.from(
|
|
517
|
+
{ length: e },
|
|
518
|
+
() => Array(o).fill(!1)
|
|
519
|
+
), c = [], l = (a, t) => {
|
|
520
|
+
a < 0 || a >= e || t < 0 || t >= o || n[a][t] || r[a][t] === "#" || (n[a][t] = !0, c.push([a, t]));
|
|
472
521
|
};
|
|
473
|
-
for (let
|
|
474
|
-
|
|
475
|
-
for (let
|
|
476
|
-
|
|
477
|
-
for (let
|
|
478
|
-
const [
|
|
479
|
-
|
|
522
|
+
for (let a = 0; a < o; a += 1)
|
|
523
|
+
l(0, a), l(e - 1, a);
|
|
524
|
+
for (let a = 0; a < e; a += 1)
|
|
525
|
+
l(a, 0), l(a, o - 1);
|
|
526
|
+
for (let a = 0; a < c.length; a += 1) {
|
|
527
|
+
const [t, s] = c[a];
|
|
528
|
+
l(t - 1, s), l(t + 1, s), l(t, s - 1), l(t, s + 1);
|
|
480
529
|
}
|
|
481
|
-
return
|
|
482
|
-
(
|
|
530
|
+
return r.map(
|
|
531
|
+
(a, t) => [...a].map((s, u) => s === "#" ? 2 : n[t][u] ? 0 : 1)
|
|
483
532
|
);
|
|
484
533
|
}
|
|
485
|
-
function
|
|
486
|
-
const
|
|
487
|
-
for (let
|
|
488
|
-
const
|
|
489
|
-
for (let
|
|
490
|
-
const m = (
|
|
491
|
-
|
|
534
|
+
function $(r, e, o, n, c) {
|
|
535
|
+
const l = e.length, a = e[0].length, t = new Uint8Array(a * l * 4);
|
|
536
|
+
for (let s = 0; s < l; s += 1) {
|
|
537
|
+
const u = l - 1 - s;
|
|
538
|
+
for (let h = 0; h < a; h += 1) {
|
|
539
|
+
const m = (s * a + h) * 4, d = n[u][h], v = d === 2 || c && d === 0;
|
|
540
|
+
t[m] = v ? 255 : 0, t[m + 1] = v ? (h * 3 + s * 7 + o) % 10 : 0, t[m + 2] = d === 2 ? 255 : d === 1 ? 128 : 0, t[m + 3] = 255;
|
|
492
541
|
}
|
|
493
542
|
}
|
|
494
|
-
return new
|
|
495
|
-
image:
|
|
496
|
-
width:
|
|
497
|
-
height:
|
|
498
|
-
format:
|
|
499
|
-
internalFormat:
|
|
543
|
+
return new N(r, {
|
|
544
|
+
image: t,
|
|
545
|
+
width: a,
|
|
546
|
+
height: l,
|
|
547
|
+
format: r.RGBA,
|
|
548
|
+
internalFormat: r.RGBA,
|
|
500
549
|
generateMipmaps: !1,
|
|
501
|
-
minFilter:
|
|
502
|
-
magFilter:
|
|
550
|
+
minFilter: r.NEAREST,
|
|
551
|
+
magFilter: r.NEAREST,
|
|
503
552
|
flipY: !1,
|
|
504
553
|
unpackAlignment: 1
|
|
505
554
|
});
|
|
506
555
|
}
|
|
507
|
-
function
|
|
508
|
-
const
|
|
509
|
-
return !!(
|
|
556
|
+
function J() {
|
|
557
|
+
const r = document.createElement("canvas");
|
|
558
|
+
return !!(r.getContext("webgl2") || r.getContext("webgl"));
|
|
510
559
|
}
|
|
511
|
-
function
|
|
512
|
-
const e =
|
|
513
|
-
let
|
|
514
|
-
return
|
|
515
|
-
[...
|
|
516
|
-
if (
|
|
517
|
-
const
|
|
518
|
-
m < c && (c = m,
|
|
560
|
+
function j(r) {
|
|
561
|
+
const e = r[0].length, o = r.length;
|
|
562
|
+
let n = [0.5, 0.5], c = 1 / 0;
|
|
563
|
+
return r.forEach((l, a) => {
|
|
564
|
+
[...l].forEach((t, s) => {
|
|
565
|
+
if (t !== "#") return;
|
|
566
|
+
const u = (s + 0.5) / e, h = 1 - (a + 0.5) / o, m = (u - 0.5) ** 2 + (h - 0.5) ** 2;
|
|
567
|
+
m < c && (c = m, n = [u, h]);
|
|
519
568
|
});
|
|
520
|
-
}),
|
|
569
|
+
}), n;
|
|
521
570
|
}
|
|
522
|
-
function
|
|
523
|
-
|
|
524
|
-
const
|
|
525
|
-
if (!
|
|
526
|
-
|
|
527
|
-
const
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
const
|
|
533
|
-
|
|
534
|
-
const
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
571
|
+
function Q(r, e, o, n, c) {
|
|
572
|
+
r.classList.add("is-fallback");
|
|
573
|
+
const l = document.createElement("canvas"), a = 600, t = 63, s = (a - t * 2) / e[0].length, u = l.getContext("2d");
|
|
574
|
+
if (!u) return;
|
|
575
|
+
l.width = a, l.height = a;
|
|
576
|
+
const h = L(e), m = o.map(
|
|
577
|
+
(d) => E(d, r)
|
|
578
|
+
);
|
|
579
|
+
e.forEach((d, v) => {
|
|
580
|
+
[...d].forEach((C, b) => {
|
|
581
|
+
const p = h[v][b];
|
|
582
|
+
if (p === 1 || !c && p !== 2) return;
|
|
583
|
+
const x = (b * 3 + (e.length - 1 - v) * 7 + n) % o.length, k = p === 2 ? m : X, T = s * 0.08, w = t + b * s + T, B = t + v * s + T, g = s - T * 2;
|
|
584
|
+
u.save(), u.beginPath(), u.rect(w, B, g, g), u.clip(), u.globalAlpha = p === 2 ? 1 : 0.1, u.strokeStyle = k[x];
|
|
585
|
+
const H = r.classList.contains("pixel-icon--hero") ? 0.095 : 0.13;
|
|
586
|
+
u.lineWidth = Math.max(1.5, g * H);
|
|
587
|
+
for (let M = -g; M < g * 2; M += g * 0.16)
|
|
588
|
+
u.beginPath(), u.moveTo(w + M, B), u.lineTo(w + M - g, B + g), u.stroke();
|
|
589
|
+
u.restore();
|
|
539
590
|
});
|
|
540
|
-
}),
|
|
591
|
+
}), r.append(l);
|
|
541
592
|
}
|
|
542
|
-
class
|
|
543
|
-
constructor(e,
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
this.root = e, this.surface = e.closest(".pixel-surface") || e, this.maskName = e.dataset.mask && e.dataset.mask in R ? e.dataset.mask : "growth", this.rows = R[this.maskName], this.boxed =
|
|
593
|
+
class Z {
|
|
594
|
+
constructor(e, o, n, c) {
|
|
595
|
+
i(this, "root");
|
|
596
|
+
i(this, "surface");
|
|
597
|
+
i(this, "maskName");
|
|
598
|
+
i(this, "rows");
|
|
599
|
+
i(this, "boxed");
|
|
600
|
+
i(this, "cellKinds");
|
|
601
|
+
i(this, "seed");
|
|
602
|
+
i(this, "palette");
|
|
603
|
+
i(this, "focusPoint");
|
|
604
|
+
i(this, "hoverTarget", 0);
|
|
605
|
+
i(this, "hover", 0);
|
|
606
|
+
i(this, "hoverAge", 0);
|
|
607
|
+
i(this, "hoveredTileKey", null);
|
|
608
|
+
i(this, "intro");
|
|
609
|
+
i(this, "pointerTarget", [0.5, 0.5]);
|
|
610
|
+
i(this, "pointer", [0.5, 0.5]);
|
|
611
|
+
i(this, "pointerTileKey", null);
|
|
612
|
+
i(this, "pointerDownSource", null);
|
|
613
|
+
i(this, "hadPointerDown", !1);
|
|
614
|
+
i(this, "blastPointer", [0.5, 0.5]);
|
|
615
|
+
i(this, "blastAge", 2);
|
|
616
|
+
i(this, "blastActive", 0);
|
|
617
|
+
i(this, "visible", !0);
|
|
618
|
+
i(this, "startedAt");
|
|
619
|
+
i(this, "lastFrameTime");
|
|
620
|
+
i(this, "motionMode");
|
|
621
|
+
i(this, "canvas");
|
|
622
|
+
i(this, "renderer");
|
|
623
|
+
i(this, "gl");
|
|
624
|
+
i(this, "program");
|
|
625
|
+
i(this, "mesh");
|
|
626
|
+
i(this, "resizeObserver");
|
|
627
|
+
i(this, "intersectionObserver");
|
|
628
|
+
i(this, "onPointerLeave");
|
|
629
|
+
i(this, "onPointerMove");
|
|
630
|
+
i(this, "onPointerDown");
|
|
631
|
+
i(this, "onFocus");
|
|
632
|
+
i(this, "onBlur");
|
|
633
|
+
i(this, "onClick");
|
|
634
|
+
this.root = e, this.surface = e.closest(".pixel-surface") || e, this.maskName = e.dataset.mask && e.dataset.mask in R ? e.dataset.mask : "growth", this.rows = R[this.maskName], this.boxed = F.has(this.maskName), this.cellKinds = L(this.rows), this.seed = o * 13 + 7, this.palette = A[this.maskName] || A.growth, this.focusPoint = j(this.rows), this.intro = y.matches ? 1 : 0, this.startedAt = performance.now(), this.lastFrameTime = this.startedAt, this.motionMode = e.classList.contains("pixel-icon--hero") ? 3 : n, this.canvas = document.createElement("canvas"), this.canvas.setAttribute("aria-hidden", "true"), e.append(this.canvas), this.renderer = new z({
|
|
584
635
|
canvas: this.canvas,
|
|
585
636
|
dpr: Math.min(window.devicePixelRatio || 1, 2),
|
|
586
637
|
alpha: !0,
|
|
@@ -589,16 +640,24 @@ class J {
|
|
|
589
640
|
premultipliedAlpha: !1,
|
|
590
641
|
powerPreference: "high-performance"
|
|
591
642
|
}), this.gl = this.renderer.gl, this.gl.clearColor(0, 0, 0, 0);
|
|
592
|
-
const
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
643
|
+
const l = $(
|
|
644
|
+
this.gl,
|
|
645
|
+
this.rows,
|
|
646
|
+
this.seed,
|
|
647
|
+
this.cellKinds,
|
|
648
|
+
this.boxed
|
|
649
|
+
), a = new K(this.gl), t = this.palette.map(
|
|
650
|
+
(u) => E(u, e)
|
|
651
|
+
), s = c ? E(c, e) : null;
|
|
652
|
+
this.program = new U(this.gl, {
|
|
653
|
+
vertex: Y,
|
|
654
|
+
fragment: W,
|
|
596
655
|
transparent: !0,
|
|
597
656
|
depthTest: !1,
|
|
598
657
|
depthWrite: !1,
|
|
599
658
|
cullFace: !1,
|
|
600
659
|
uniforms: {
|
|
601
|
-
tMask: { value:
|
|
660
|
+
tMask: { value: l },
|
|
602
661
|
uGrid: { value: [this.rows[0].length, this.rows.length] },
|
|
603
662
|
uPointer: { value: this.pointer },
|
|
604
663
|
uBlastPointer: { value: this.blastPointer },
|
|
@@ -608,47 +667,51 @@ class J {
|
|
|
608
667
|
uBlastTime: { value: this.blastAge },
|
|
609
668
|
uBlast: { value: 0 },
|
|
610
669
|
uIntro: { value: this.intro },
|
|
611
|
-
uMotion: { value:
|
|
670
|
+
uMotion: { value: y.matches ? 0 : 1 },
|
|
612
671
|
uSequence: { value: e.dataset.motion === "sequence" ? 1 : 0 },
|
|
613
672
|
uSeed: { value: this.seed * 0.17 },
|
|
614
673
|
uStripeFrequency: { value: 4.455 },
|
|
615
674
|
uGapInner: { value: 0.13 },
|
|
616
675
|
uGapOuter: { value: 0.19 },
|
|
617
676
|
uMode: { value: this.motionMode },
|
|
618
|
-
uColor0: { value:
|
|
619
|
-
uColor1: { value:
|
|
620
|
-
uColor2: { value:
|
|
621
|
-
uColor3: { value:
|
|
622
|
-
uColor4: { value:
|
|
623
|
-
uColor5: { value:
|
|
624
|
-
uColor6: { value:
|
|
625
|
-
uColor7: { value:
|
|
626
|
-
uColor8: { value:
|
|
627
|
-
uColor9: { value:
|
|
677
|
+
uColor0: { value: f(t[0]) },
|
|
678
|
+
uColor1: { value: f(t[1]) },
|
|
679
|
+
uColor2: { value: f(t[2]) },
|
|
680
|
+
uColor3: { value: f(t[3]) },
|
|
681
|
+
uColor4: { value: f(t[4]) },
|
|
682
|
+
uColor5: { value: f(t[5]) },
|
|
683
|
+
uColor6: { value: f(t[6]) },
|
|
684
|
+
uColor7: { value: f(t[7]) },
|
|
685
|
+
uColor8: { value: f(t[8]) },
|
|
686
|
+
uColor9: { value: f(t[9]) },
|
|
687
|
+
uInteractionColor: {
|
|
688
|
+
value: s ? f(s) : [0, 0, 0]
|
|
689
|
+
},
|
|
690
|
+
uUseInteractionColor: { value: s ? 1 : 0 }
|
|
628
691
|
}
|
|
629
|
-
}), this.mesh = new
|
|
692
|
+
}), this.mesh = new _(this.gl, { geometry: a, program: this.program }), this.bindEvents(), this.observe(), this.resize();
|
|
630
693
|
}
|
|
631
|
-
getPointerHit(e,
|
|
632
|
-
const
|
|
633
|
-
let
|
|
634
|
-
if (
|
|
635
|
-
const d = this.rows[0].length, v = this.rows.length,
|
|
636
|
-
|
|
694
|
+
getPointerHit(e, o) {
|
|
695
|
+
const n = this.root.getBoundingClientRect(), c = 1 - S * 2, l = (e - n.left) / n.width, a = (o - n.top) / n.height, t = (l - S) / c, s = (a - S) / c, u = t >= 0 && t < 1 && s >= 0 && s < 1;
|
|
696
|
+
let h = !1, m = null;
|
|
697
|
+
if (u) {
|
|
698
|
+
const d = this.rows[0].length, v = this.rows.length, C = t * d, b = s * v, p = Math.floor(C), x = Math.floor(b), k = C - p, T = b - x;
|
|
699
|
+
h = Math.abs(k - 0.5) <= 0.43 && Math.abs(T - 0.5) <= 0.43 && this.cellKinds[x][p] === 2, h && (m = `${x}:${p}`);
|
|
637
700
|
}
|
|
638
|
-
return { iconX:
|
|
701
|
+
return { iconX: t, iconYTop: s, isTileHit: h, tileKey: m };
|
|
639
702
|
}
|
|
640
703
|
bindEvents() {
|
|
641
704
|
this.onPointerLeave = () => {
|
|
642
705
|
this.hoverTarget = 0, this.pointerTarget[0] = 0.5, this.pointerTarget[1] = 0.5, this.hoverAge = 0, this.hoveredTileKey = null, this.pointerTileKey = null, this.pointerDownSource = null, this.hadPointerDown = !1, this.surface.classList.remove("is-over-tile");
|
|
643
706
|
}, this.onPointerMove = (e) => {
|
|
644
|
-
const { iconX:
|
|
707
|
+
const { iconX: o, iconYTop: n, isTileHit: c, tileKey: l } = this.getPointerHit(
|
|
645
708
|
e.clientX,
|
|
646
709
|
e.clientY
|
|
647
710
|
);
|
|
648
|
-
|
|
711
|
+
l !== this.hoveredTileKey && (this.hoverAge = 0), this.hoveredTileKey = l, this.pointerTileKey = l, this.hoverTarget = c ? 1 : 0, this.surface.classList.toggle("is-over-tile", c), c ? (this.pointerTarget[0] = o, this.pointerTarget[1] = 1 - n) : (this.pointerTarget[0] = 0.5, this.pointerTarget[1] = 0.5);
|
|
649
712
|
}, this.onPointerDown = (e) => {
|
|
650
|
-
const
|
|
651
|
-
this.hadPointerDown = !0, this.pointerDownSource =
|
|
713
|
+
const o = this.getPointerHit(e.clientX, e.clientY);
|
|
714
|
+
this.hadPointerDown = !0, this.pointerDownSource = o.isTileHit ? [o.iconX, 1 - o.iconYTop] : null;
|
|
652
715
|
}, this.onFocus = () => {
|
|
653
716
|
this.hadPointerDown || (this.hoverTarget = 1, this.hoverAge = 0, this.hoveredTileKey = "focus", this.pointerTarget[0] = this.focusPoint[0], this.pointerTarget[1] = this.focusPoint[1]);
|
|
654
717
|
}, this.onBlur = () => {
|
|
@@ -667,67 +730,84 @@ class J {
|
|
|
667
730
|
), this.intersectionObserver.observe(this.root);
|
|
668
731
|
}
|
|
669
732
|
resize() {
|
|
670
|
-
const e = this.root.getBoundingClientRect(),
|
|
671
|
-
this.renderer.setSize(
|
|
733
|
+
const e = this.root.getBoundingClientRect(), o = Math.max(1, Math.round(Math.min(e.width, e.height))), n = Math.max(this.rows[0].length, this.rows.length), c = o * (1 - S * 2) / n, l = Math.min(1, Math.max(0, (c - 12) / 4.5));
|
|
734
|
+
this.renderer.setSize(o, o), this.program.uniforms.uStripeFrequency.value = 2 + (4.455 - 2) * l, this.program.uniforms.uGapInner.value = 0.13, this.program.uniforms.uGapOuter.value = 0.2 + (0.19 - 0.2) * l;
|
|
672
735
|
}
|
|
673
736
|
update(e) {
|
|
674
|
-
const
|
|
737
|
+
const o = Math.min(
|
|
738
|
+
0.05,
|
|
739
|
+
Math.max(0, (e - this.lastFrameTime) * 1e-3)
|
|
740
|
+
);
|
|
675
741
|
if (this.lastFrameTime = e, !this.visible) return;
|
|
676
|
-
const
|
|
677
|
-
this.hoverAge = this.hoverTarget > 0 ? this.hoverAge +
|
|
742
|
+
const n = (e - this.startedAt) * 1e-3, c = y.matches ? 0 : 1;
|
|
743
|
+
this.hoverAge = this.hoverTarget > 0 ? this.hoverAge + o : 0, this.blastActive > 0 && (this.blastAge += o, this.blastAge >= 1.35 && (this.blastActive = 0)), this.hover += (this.hoverTarget - this.hover) * (this.hoverTarget > this.hover ? 0.1 : 0.07), this.pointer[0] += (this.pointerTarget[0] - this.pointer[0]) * 0.1, this.pointer[1] += (this.pointerTarget[1] - this.pointer[1]) * 0.1, this.intro = c ? Math.min(1, n / 1.7) : 1, this.program.uniforms.uTime.value = n, this.program.uniforms.uHoverTime.value = this.hoverAge, this.program.uniforms.uHover.value = this.hover, this.program.uniforms.uBlastTime.value = this.blastAge, this.program.uniforms.uBlast.value = this.blastActive, this.program.uniforms.uIntro.value = this.intro, this.program.uniforms.uMotion.value = c, this.renderer.render({ scene: this.mesh });
|
|
678
744
|
}
|
|
679
745
|
destroy() {
|
|
680
|
-
var
|
|
681
|
-
(
|
|
746
|
+
var o, n;
|
|
747
|
+
(o = this.resizeObserver) == null || o.disconnect(), (n = this.intersectionObserver) == null || n.disconnect(), this.surface.removeEventListener("pointerleave", this.onPointerLeave), this.surface.removeEventListener("pointermove", this.onPointerMove), this.surface.removeEventListener("pointerdown", this.onPointerDown), this.surface.removeEventListener("focus", this.onFocus), this.surface.removeEventListener("blur", this.onBlur), this.surface.removeEventListener("click", this.onClick);
|
|
682
748
|
const e = this.gl.getExtension("WEBGL_lose_context");
|
|
683
749
|
e == null || e.loseContext();
|
|
684
750
|
}
|
|
685
751
|
}
|
|
686
|
-
const
|
|
687
|
-
({
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
752
|
+
const ee = P.forwardRef(
|
|
753
|
+
({
|
|
754
|
+
mask: r = "growth",
|
|
755
|
+
motion: e = "sequence",
|
|
756
|
+
motionMode: o = 3,
|
|
757
|
+
interactionColor: n,
|
|
758
|
+
hero: c = !1,
|
|
759
|
+
className: l,
|
|
760
|
+
...a
|
|
761
|
+
}, t) => {
|
|
762
|
+
const s = P.useRef(null), u = P.useCallback(
|
|
763
|
+
(h) => {
|
|
764
|
+
s.current = h, typeof t == "function" ? t(h) : t && (t.current = h);
|
|
691
765
|
},
|
|
692
766
|
[t]
|
|
693
767
|
);
|
|
694
|
-
return
|
|
695
|
-
const
|
|
696
|
-
if (!
|
|
697
|
-
let
|
|
698
|
-
if (
|
|
699
|
-
|
|
700
|
-
const
|
|
701
|
-
|
|
768
|
+
return P.useEffect(() => {
|
|
769
|
+
const h = s.current;
|
|
770
|
+
if (!h) return;
|
|
771
|
+
let m = null, d = 0;
|
|
772
|
+
if (J()) {
|
|
773
|
+
m = new Z(h, 0, o, n);
|
|
774
|
+
const v = (C) => {
|
|
775
|
+
m == null || m.update(C), d = window.requestAnimationFrame(v);
|
|
702
776
|
};
|
|
703
|
-
|
|
777
|
+
d = window.requestAnimationFrame(v);
|
|
704
778
|
} else {
|
|
705
|
-
const
|
|
706
|
-
|
|
779
|
+
const v = r in R ? r : "growth";
|
|
780
|
+
Q(
|
|
781
|
+
h,
|
|
782
|
+
R[v],
|
|
783
|
+
A[v] || A.growth,
|
|
784
|
+
7,
|
|
785
|
+
F.has(v)
|
|
786
|
+
);
|
|
707
787
|
}
|
|
708
788
|
return () => {
|
|
709
|
-
|
|
789
|
+
d && window.cancelAnimationFrame(d), m == null || m.destroy(), h.replaceChildren(), h.classList.remove("is-fallback");
|
|
710
790
|
};
|
|
711
|
-
}, [
|
|
791
|
+
}, [r, e, o, n, c]), /* @__PURE__ */ O(
|
|
712
792
|
"span",
|
|
713
793
|
{
|
|
714
|
-
ref:
|
|
794
|
+
ref: u,
|
|
715
795
|
"aria-hidden": !0,
|
|
716
796
|
"data-pixel-icon": !0,
|
|
717
|
-
"data-mask":
|
|
797
|
+
"data-mask": r,
|
|
718
798
|
"data-motion": e,
|
|
719
|
-
className:
|
|
799
|
+
className: q(
|
|
720
800
|
"pixel-surface pixel-icon relative block outline-none [&_canvas]:block [&_canvas]:size-full",
|
|
721
|
-
|
|
722
|
-
|
|
801
|
+
c && "pixel-icon--hero",
|
|
802
|
+
l
|
|
723
803
|
),
|
|
724
804
|
tabIndex: 0,
|
|
725
|
-
...
|
|
805
|
+
...a
|
|
726
806
|
}
|
|
727
807
|
);
|
|
728
808
|
}
|
|
729
809
|
);
|
|
730
|
-
|
|
810
|
+
ee.displayName = "PixelIcon";
|
|
731
811
|
export {
|
|
732
|
-
|
|
812
|
+
ee as PixelIcon
|
|
733
813
|
};
|