@actioneer/ads 0.5.4 → 0.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/accordion.js +15 -15
- package/components/agent-icon.d.ts +64 -0
- package/components/agent-icon.js +251 -0
- package/components/ai-elements/agent-trace.d.ts +8 -1
- package/components/ai-elements/agent-trace.js +164 -129
- package/components/ai-elements/chain-of-thought-icon.d.ts +42 -0
- package/components/ai-elements/chain-of-thought-icon.js +283 -0
- package/components/ai-elements/chain-of-thought.js +7 -7
- package/components/ai-elements/chart.js +38 -35
- package/components/ai-elements/index.d.ts +1 -0
- package/components/ai-elements/inline-citation.js +40 -40
- package/components/ai-elements/message.js +5 -5
- package/components/ai-elements/queue.js +1 -1
- package/components/ai-elements/research-activity.d.ts +2 -0
- package/components/ai-elements/research-activity.js +79 -81
- package/components/ai-elements/task-progress.js +2 -2
- package/components/ai-elements/tool.d.ts +4 -2
- package/components/ai-elements/tool.js +74 -54
- package/components/ai-elements/transcript.js +1 -1
- package/components/alert.js +1 -1
- package/components/answer.d.ts +2644 -311
- package/components/answer.js +1776 -371
- package/components/assistant-ui/answer-tool-ui.js +27 -28
- package/components/assistant-ui/chain-of-thought.d.ts +7 -2
- package/components/assistant-ui/composer-harness.js +20 -16
- package/components/assistant-ui/follow-up-suggestions.d.ts +5 -1
- package/components/assistant-ui/follow-up-suggestions.js +47 -19
- package/components/assistant-ui/reasoning.js +35 -31
- package/components/assistant-ui/tool-fallback.js +125 -122
- package/components/assistant-ui/tool-group.d.ts +3 -1
- package/components/assistant-ui/tool-group.js +48 -43
- package/components/audio-waveform.js +14 -14
- package/components/autocomplete.js +52 -48
- package/components/avatar.js +58 -44
- package/components/badge.js +3 -3
- package/components/brand-texture.js +1 -1
- package/components/breadcrumbs.d.ts +27 -1
- package/components/breadcrumbs.js +94 -42
- package/components/button.js +15 -15
- package/components/carousel.js +10 -10
- package/components/chart.js +77 -77
- package/components/chip.js +3 -3
- package/components/code-block.d.ts +39 -17
- package/components/code-block.js +153 -104
- package/components/command-palette.js +27 -25
- package/components/connector-card.js +2 -2
- package/components/dropdown.js +65 -61
- package/components/empty-state.js +15 -15
- package/components/field.js +16 -16
- package/components/index.d.ts +4 -0
- package/components/index.js +525 -478
- package/components/infinite-canvas.js +60 -60
- package/components/kbd.js +6 -6
- package/components/link.js +6 -6
- package/components/modal.js +22 -20
- package/components/page-header.js +1 -1
- package/components/pagination.js +22 -22
- package/components/pixel-blast-svg.js +1 -1
- package/components/pixel-icon.d.ts +31 -0
- package/components/pixel-icon.js +733 -0
- package/components/popover.js +46 -42
- package/components/ripple.d.ts +29 -0
- package/components/ripple.js +17 -0
- package/components/segmented.js +24 -23
- package/components/select.js +71 -67
- package/components/selection-action-bar.js +22 -22
- package/components/sidebar.d.ts +11 -3
- package/components/sidebar.js +161 -148
- package/components/stepper.d.ts +2 -0
- package/components/stepper.js +80 -43
- package/components/table.d.ts +7 -0
- package/components/table.js +223 -155
- package/components/tabs.d.ts +3 -1
- package/components/tabs.js +165 -144
- package/components/textarea.js +10 -8
- package/components/toast.js +48 -46
- package/components/tooltip.js +61 -59
- package/components/tree.js +44 -41
- package/components/typography.d.ts +1 -1
- package/components/typography.js +25 -25
- package/components/viz-charts.js +133 -133
- package/fonts/aribau-grotesk-500.otf +0 -0
- package/fonts/aribau-grotesk-600.woff2 +0 -0
- package/fonts.css +6 -4
- package/lib/icons.d.ts +411 -402
- package/lib/icons.js +109 -107
- package/llms.txt +98 -8
- package/manifest.json +1012 -96
- package/package.json +5 -5
- package/styles.css +206 -81
- package/theme.css +200 -77
- package/fonts/aribau-grotesk-400.otf +0 -0
- package/fonts/aribau-grotesk-700.otf +0 -0
|
@@ -0,0 +1,733 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var H = Object.defineProperty;
|
|
3
|
+
var L = (a, e, i) => e in a ? H(a, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : a[e] = i;
|
|
4
|
+
var o = (a, e, i) => L(a, typeof e != "symbol" ? e + "" : e, i);
|
|
5
|
+
import { jsx as G } from "react/jsx-runtime";
|
|
6
|
+
import * as D from "react";
|
|
7
|
+
import { Renderer as O, Triangle as I, Program as z, Mesh as K, Texture as _ } from "ogl";
|
|
8
|
+
import { cn as N } from "../lib/cn.js";
|
|
9
|
+
const R = {
|
|
10
|
+
growth: [
|
|
11
|
+
"...##....##....##",
|
|
12
|
+
"..###...###...###",
|
|
13
|
+
".####..####..####",
|
|
14
|
+
"#####.#####.#####",
|
|
15
|
+
".................",
|
|
16
|
+
"...##....##....##",
|
|
17
|
+
"..###...###...###",
|
|
18
|
+
".####..####..####",
|
|
19
|
+
"#####.#####.#####",
|
|
20
|
+
"#####.#####.#####",
|
|
21
|
+
".................",
|
|
22
|
+
"...##....##....##",
|
|
23
|
+
".####..####..####",
|
|
24
|
+
"#####.#####.#####",
|
|
25
|
+
"#####.#####.#####"
|
|
26
|
+
],
|
|
27
|
+
// Pixel-sampled from Phosphor's official fill SVGs:
|
|
28
|
+
// Folder Simple, Magnifying Glass, and Books.
|
|
29
|
+
"document-agent": [
|
|
30
|
+
"...............",
|
|
31
|
+
"...............",
|
|
32
|
+
".#####.........",
|
|
33
|
+
".######........",
|
|
34
|
+
".#############.",
|
|
35
|
+
".#############.",
|
|
36
|
+
".#############.",
|
|
37
|
+
".#############.",
|
|
38
|
+
".#############.",
|
|
39
|
+
".#############.",
|
|
40
|
+
".#############.",
|
|
41
|
+
".#############.",
|
|
42
|
+
".#############.",
|
|
43
|
+
"...............",
|
|
44
|
+
"..............."
|
|
45
|
+
],
|
|
46
|
+
search: [
|
|
47
|
+
"...............",
|
|
48
|
+
"...#######.....",
|
|
49
|
+
"..##.....##....",
|
|
50
|
+
".##.#####.##...",
|
|
51
|
+
".#.#######.#...",
|
|
52
|
+
".#.#######.#...",
|
|
53
|
+
".#.#######.#...",
|
|
54
|
+
".#.#######.#...",
|
|
55
|
+
".#.#######.#...",
|
|
56
|
+
".##.#####.#....",
|
|
57
|
+
"..##.....##....",
|
|
58
|
+
"...######..#...",
|
|
59
|
+
"............#..",
|
|
60
|
+
".............#.",
|
|
61
|
+
"..............."
|
|
62
|
+
],
|
|
63
|
+
books: [
|
|
64
|
+
"...............",
|
|
65
|
+
"..##########...",
|
|
66
|
+
"..#...##...#...",
|
|
67
|
+
"..###########..",
|
|
68
|
+
"..#######...#..",
|
|
69
|
+
"..#####.#####..",
|
|
70
|
+
"..#####.#####..",
|
|
71
|
+
"..#####.######.",
|
|
72
|
+
"..#####.######.",
|
|
73
|
+
"..#####.######.",
|
|
74
|
+
"..#####..#####.",
|
|
75
|
+
"..#####..##..#.",
|
|
76
|
+
"..#...#..#..##.",
|
|
77
|
+
"..#####..###...",
|
|
78
|
+
"..............."
|
|
79
|
+
]
|
|
80
|
+
}, A = [
|
|
81
|
+
"#1e3a16",
|
|
82
|
+
"#254a1d",
|
|
83
|
+
"#2c5724",
|
|
84
|
+
"#316c26",
|
|
85
|
+
"#3f7a34",
|
|
86
|
+
"#548c41",
|
|
87
|
+
"#6da24e",
|
|
88
|
+
"#77b76b",
|
|
89
|
+
"#9ccc93",
|
|
90
|
+
"#cae8c5"
|
|
91
|
+
], k = {
|
|
92
|
+
growth: A,
|
|
93
|
+
"document-agent": A,
|
|
94
|
+
search: A,
|
|
95
|
+
books: A
|
|
96
|
+
}, y = /* @__PURE__ */ new Set(), U = ["#c7cad0", "#d0d3d8", "#d8dade", "#dfe1e4", "#e6e7e9"], M = 0, q = (
|
|
97
|
+
/* glsl */
|
|
98
|
+
`
|
|
99
|
+
attribute vec2 uv;
|
|
100
|
+
attribute vec2 position;
|
|
101
|
+
|
|
102
|
+
varying vec2 vUv;
|
|
103
|
+
|
|
104
|
+
void main() {
|
|
105
|
+
vUv = uv;
|
|
106
|
+
gl_Position = vec4(position, 0.0, 1.0);
|
|
107
|
+
}
|
|
108
|
+
`
|
|
109
|
+
), V = (
|
|
110
|
+
/* glsl */
|
|
111
|
+
`
|
|
112
|
+
precision highp float;
|
|
113
|
+
|
|
114
|
+
uniform sampler2D tMask;
|
|
115
|
+
uniform vec2 uGrid;
|
|
116
|
+
uniform vec2 uPointer;
|
|
117
|
+
uniform vec2 uBlastPointer;
|
|
118
|
+
uniform float uTime;
|
|
119
|
+
uniform float uHoverTime;
|
|
120
|
+
uniform float uHover;
|
|
121
|
+
uniform float uBlastTime;
|
|
122
|
+
uniform float uBlast;
|
|
123
|
+
uniform float uIntro;
|
|
124
|
+
uniform float uMotion;
|
|
125
|
+
uniform float uSequence;
|
|
126
|
+
uniform float uSeed;
|
|
127
|
+
uniform float uStripeFrequency;
|
|
128
|
+
uniform float uGapInner;
|
|
129
|
+
uniform float uGapOuter;
|
|
130
|
+
uniform float uMode;
|
|
131
|
+
uniform vec3 uColor0;
|
|
132
|
+
uniform vec3 uColor1;
|
|
133
|
+
uniform vec3 uColor2;
|
|
134
|
+
uniform vec3 uColor3;
|
|
135
|
+
uniform vec3 uColor4;
|
|
136
|
+
uniform vec3 uColor5;
|
|
137
|
+
uniform vec3 uColor6;
|
|
138
|
+
uniform vec3 uColor7;
|
|
139
|
+
uniform vec3 uColor8;
|
|
140
|
+
uniform vec3 uColor9;
|
|
141
|
+
|
|
142
|
+
varying vec2 vUv;
|
|
143
|
+
|
|
144
|
+
float hash21(vec2 p) {
|
|
145
|
+
p = fract(p * vec2(123.34, 456.21));
|
|
146
|
+
p += dot(p, p + 45.32 + uSeed);
|
|
147
|
+
return fract(p.x * p.y);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
vec3 palette(float index) {
|
|
151
|
+
if (index < 0.5) return uColor0;
|
|
152
|
+
if (index < 1.5) return uColor1;
|
|
153
|
+
if (index < 2.5) return uColor2;
|
|
154
|
+
if (index < 3.5) return uColor3;
|
|
155
|
+
if (index < 4.5) return uColor4;
|
|
156
|
+
if (index < 5.5) return uColor5;
|
|
157
|
+
if (index < 6.5) return uColor6;
|
|
158
|
+
if (index < 7.5) return uColor7;
|
|
159
|
+
if (index < 8.5) return uColor8;
|
|
160
|
+
return uColor9;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
float wrappedDistance(float a, float b) {
|
|
164
|
+
float distanceValue = abs(a - b);
|
|
165
|
+
return min(distanceValue, 1.0 - distanceValue);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
void main() {
|
|
169
|
+
const float padding = ${M.toFixed(4)};
|
|
170
|
+
vec2 iconUv = (vUv - padding) / (1.0 - padding * 2.0);
|
|
171
|
+
|
|
172
|
+
if (iconUv.x < 0.0 || iconUv.x > 1.0 || iconUv.y < 0.0 || iconUv.y > 1.0) {
|
|
173
|
+
gl_FragColor = vec4(0.0);
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
vec2 gridPosition = iconUv * uGrid;
|
|
178
|
+
vec2 cell = floor(gridPosition);
|
|
179
|
+
vec2 cellUv = fract(gridPosition);
|
|
180
|
+
vec2 cellCenter = (cell + 0.5) / uGrid;
|
|
181
|
+
vec4 maskSample = texture2D(tMask, cellCenter);
|
|
182
|
+
float presence = step(0.5, maskSample.r);
|
|
183
|
+
float iconCell = step(0.75, maskSample.b);
|
|
184
|
+
float frameCell = 1.0 - iconCell;
|
|
185
|
+
float symbolCell = iconCell;
|
|
186
|
+
|
|
187
|
+
if (presence < 0.5) {
|
|
188
|
+
gl_FragColor = vec4(0.0);
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
float random = hash21(cell);
|
|
193
|
+
float centerDistance = length(cellCenter - 0.5) * 1.25;
|
|
194
|
+
float sequencePosition = clamp((cellCenter.x + cellCenter.y) * 0.5, 0.0, 1.0);
|
|
195
|
+
float introOrder = mix(centerDistance * 0.48, sequencePosition * 0.54, uSequence);
|
|
196
|
+
float intro = smoothstep(introOrder, introOrder + 0.24, uIntro);
|
|
197
|
+
|
|
198
|
+
float mode0 = 1.0 - step(0.5, abs(uMode - 0.0));
|
|
199
|
+
float mode1 = 1.0 - step(0.5, abs(uMode - 1.0));
|
|
200
|
+
float mode2 = 1.0 - step(0.5, abs(uMode - 2.0));
|
|
201
|
+
float mode3 = 1.0 - step(0.5, abs(uMode - 3.0));
|
|
202
|
+
float mode4 = 1.0 - step(0.5, abs(uMode - 4.0));
|
|
203
|
+
float mode5 = 1.0 - step(0.5, abs(uMode - 5.0));
|
|
204
|
+
float hoverMotion = uHover * uMotion * symbolCell;
|
|
205
|
+
float blastSuppression = uBlast * (1.0 - smoothstep(0.98, 1.35, uBlastTime));
|
|
206
|
+
float radialShrinkMode = mode3 * (1.0 - blastSuppression);
|
|
207
|
+
float particleHoverMode = mode5;
|
|
208
|
+
|
|
209
|
+
vec2 pointerCell = floor(uPointer * uGrid);
|
|
210
|
+
float directCell = 1.0 - step(0.25, length(cell - pointerCell));
|
|
211
|
+
float cellDistance = length((cellCenter - uPointer) * uGrid);
|
|
212
|
+
float neighborFalloff = (1.0 - smoothstep(0.55, 1.65, cellDistance)) * 0.18;
|
|
213
|
+
float localInfluence = max(directCell, neighborFalloff) * hoverMotion;
|
|
214
|
+
float nearField = exp(-cellDistance * 0.42) * hoverMotion;
|
|
215
|
+
|
|
216
|
+
float bouncePhase = uHoverTime * 8.4 + random * 1.2;
|
|
217
|
+
float bounceSine = sin(bouncePhase);
|
|
218
|
+
float liftPulse = pow(max(0.0, bounceSine), 2.0);
|
|
219
|
+
float elasticBounce = localInfluence * liftPulse;
|
|
220
|
+
float elasticLanding = pow(max(0.0, -bounceSine), 6.0) * localInfluence;
|
|
221
|
+
|
|
222
|
+
float maxGrid = max(uGrid.x, uGrid.y);
|
|
223
|
+
float rippleRadius = mod(uHoverTime * 5.8, maxGrid * 0.95 + 2.0);
|
|
224
|
+
float rippleRing = exp(-pow((cellDistance - rippleRadius) / 0.78, 2.0)) * hoverMotion;
|
|
225
|
+
float rippleEcho = exp(-pow((cellDistance - (rippleRadius - 2.7)) / 0.62, 2.0))
|
|
226
|
+
* step(2.7, rippleRadius)
|
|
227
|
+
* hoverMotion;
|
|
228
|
+
float colorRipple = max(directCell * hoverMotion, max(rippleRing, rippleEcho * 0.68));
|
|
229
|
+
|
|
230
|
+
float magneticPulse = 0.68 + 0.32 * sin(uHoverTime * 6.2 - cellDistance * 0.72);
|
|
231
|
+
float magneticField = nearField * magneticPulse;
|
|
232
|
+
vec2 pullVector = uPointer - cellCenter;
|
|
233
|
+
float pullAngle = atan(pullVector.y, pullVector.x);
|
|
234
|
+
|
|
235
|
+
float blastDistance = length((cellCenter - uBlastPointer) * uGrid);
|
|
236
|
+
float echoRadius = uBlastTime * 5.2;
|
|
237
|
+
float echoLifetime = (1.0 - smoothstep(1.04, 1.35, uBlastTime)) * uBlast * uMotion;
|
|
238
|
+
float echoRing0 = exp(-pow((blastDistance - echoRadius) / 0.48, 2.0));
|
|
239
|
+
float echoRing1 = exp(-pow((blastDistance - (echoRadius - 2.4)) / 0.42, 2.0))
|
|
240
|
+
* step(2.4, echoRadius);
|
|
241
|
+
float echoRing2 = exp(-pow((blastDistance - (echoRadius - 4.8)) / 0.38, 2.0))
|
|
242
|
+
* step(4.8, echoRadius);
|
|
243
|
+
float radialEcho = max(echoRing0, max(echoRing1 * 0.78, echoRing2 * 0.58))
|
|
244
|
+
* echoLifetime;
|
|
245
|
+
|
|
246
|
+
float blastRadius = uBlastTime * 10.5;
|
|
247
|
+
float blastRing = exp(-pow((blastDistance - blastRadius) / 0.7, 2.0))
|
|
248
|
+
* exp(-uBlastTime * 0.58)
|
|
249
|
+
* uBlast
|
|
250
|
+
* uMotion;
|
|
251
|
+
float blastCore = exp(-blastDistance * 0.72)
|
|
252
|
+
* exp(-uBlastTime * 5.4)
|
|
253
|
+
* uBlast
|
|
254
|
+
* uMotion;
|
|
255
|
+
float localBlastAge = max(0.0, uBlastTime - blastDistance / 10.5);
|
|
256
|
+
float blastArrived = step(blastDistance / 10.5, uBlastTime);
|
|
257
|
+
float blastReach = 1.0 - smoothstep(0.0, 8.5, blastDistance);
|
|
258
|
+
float blastShake = sin(localBlastAge * 35.0 + random * 19.0)
|
|
259
|
+
* exp(-localBlastAge * 5.0)
|
|
260
|
+
* blastArrived
|
|
261
|
+
* blastReach
|
|
262
|
+
* uBlast
|
|
263
|
+
* uMotion;
|
|
264
|
+
float blastRandomAngle = random * 6.2831853 + 1.7;
|
|
265
|
+
vec2 blastRandomDirection = vec2(cos(blastRandomAngle), sin(blastRandomAngle));
|
|
266
|
+
vec2 blastAway = normalize(
|
|
267
|
+
(cellCenter - uBlastPointer) * uGrid + blastRandomDirection * 0.045
|
|
268
|
+
);
|
|
269
|
+
vec2 blastOffset = blastAway * (blastRing * 0.15 + blastCore * 0.08)
|
|
270
|
+
+ blastRandomDirection * blastShake * 0.085;
|
|
271
|
+
|
|
272
|
+
float scatterReach = (1.0 - smoothstep(0.0, 5.8, cellDistance)) * hoverMotion;
|
|
273
|
+
float scatterSignal = pow(max(0.0, sin(uHoverTime * 12.0 + random * 19.0 - cellDistance)), 5.0);
|
|
274
|
+
float signalScatter = max(
|
|
275
|
+
directCell * hoverMotion * abs(sin(uHoverTime * 9.0 + random * 4.0)),
|
|
276
|
+
scatterReach * scatterSignal
|
|
277
|
+
);
|
|
278
|
+
|
|
279
|
+
float particleReach = (1.0 - smoothstep(0.25, 5.6, cellDistance)) * hoverMotion;
|
|
280
|
+
float particleSettle = 0.88 + 0.12 * sin(
|
|
281
|
+
uHoverTime * 6.4 - cellDistance * 1.28 + random * 2.6
|
|
282
|
+
);
|
|
283
|
+
float particleForce = particleReach * particleSettle;
|
|
284
|
+
float particleAngle = random * 6.2831853;
|
|
285
|
+
vec2 particleJitter = vec2(cos(particleAngle), sin(particleAngle)) * 0.08;
|
|
286
|
+
vec2 particleAway = normalize((cellCenter - uPointer) * uGrid + particleJitter);
|
|
287
|
+
vec2 particleOffset = particleAway
|
|
288
|
+
* particleForce
|
|
289
|
+
* (0.132 + 0.018 * sin(uHoverTime * 5.2 + random * 7.0));
|
|
290
|
+
float radialShrink = max(
|
|
291
|
+
directCell * hoverMotion,
|
|
292
|
+
(1.0 - smoothstep(0.15, 2.85, cellDistance)) * hoverMotion
|
|
293
|
+
);
|
|
294
|
+
|
|
295
|
+
float tileScale = 0.82;
|
|
296
|
+
vec2 springShape = vec2(1.0);
|
|
297
|
+
float angle = 0.0;
|
|
298
|
+
vec2 tileOffset = vec2(0.0);
|
|
299
|
+
|
|
300
|
+
tileScale -= radialShrinkMode * radialShrink * 0.27;
|
|
301
|
+
|
|
302
|
+
tileScale += mode0 * (directCell * hoverMotion * 0.075 + colorRipple * 0.045);
|
|
303
|
+
|
|
304
|
+
tileScale += mode1 * (elasticBounce * 0.13 - elasticLanding * 0.14);
|
|
305
|
+
springShape += mode1 * vec2(
|
|
306
|
+
-elasticBounce * 0.03 + elasticLanding * 0.16,
|
|
307
|
+
elasticBounce * 0.03 - elasticLanding * 0.14
|
|
308
|
+
);
|
|
309
|
+
angle += mode1 * cos(bouncePhase) * localInfluence * 0.18;
|
|
310
|
+
|
|
311
|
+
tileScale += mode2 * magneticField * 0.115;
|
|
312
|
+
springShape += mode2 * vec2(-magneticField * 0.035, magneticField * 0.065);
|
|
313
|
+
angle += mode2 * (
|
|
314
|
+
sin(pullAngle * 2.0) * magneticField * 0.16
|
|
315
|
+
+ directCell * hoverMotion * sin(uHoverTime * 7.0) * 0.09
|
|
316
|
+
);
|
|
317
|
+
|
|
318
|
+
tileScale += mode3 * radialEcho * 0.145;
|
|
319
|
+
springShape += mode3 * vec2(-radialEcho * 0.055, radialEcho * 0.08);
|
|
320
|
+
angle += mode3 * sin(blastDistance * 1.8 + uBlastTime * 3.0) * radialEcho * 0.12;
|
|
321
|
+
tileScale += mode3 * (
|
|
322
|
+
blastRing * 0.19 - blastCore * 0.13 + abs(blastShake) * 0.055
|
|
323
|
+
);
|
|
324
|
+
springShape += mode3 * vec2(-blastRing * 0.055, blastRing * 0.075);
|
|
325
|
+
angle += mode3 * (
|
|
326
|
+
blastShake * 0.34 + (random - 0.5) * blastRing * 0.32
|
|
327
|
+
);
|
|
328
|
+
tileOffset += mode3 * blastOffset;
|
|
329
|
+
|
|
330
|
+
tileScale += mode4 * (signalScatter * 0.145 - scatterReach * (1.0 - scatterSignal) * 0.025);
|
|
331
|
+
springShape += mode4 * vec2(signalScatter * 0.08, -signalScatter * 0.075);
|
|
332
|
+
angle += mode4 * (random - 0.5) * signalScatter * 0.62;
|
|
333
|
+
|
|
334
|
+
tileScale += particleHoverMode * (
|
|
335
|
+
-particleForce * 0.19
|
|
336
|
+
+ directCell * hoverMotion * (0.025 + 0.015 * sin(uHoverTime * 6.4))
|
|
337
|
+
);
|
|
338
|
+
springShape += particleHoverMode * vec2(-particleForce * 0.035, particleForce * 0.05);
|
|
339
|
+
angle += particleHoverMode * (
|
|
340
|
+
(random - 0.5) * particleForce * 0.6
|
|
341
|
+
+ directCell * hoverMotion * sin(uHoverTime * 5.4) * 0.045
|
|
342
|
+
);
|
|
343
|
+
tileOffset += particleHoverMode * particleOffset;
|
|
344
|
+
|
|
345
|
+
float minimumTileScale = 0.64 - particleHoverMode * 0.06 - radialShrinkMode * 0.1;
|
|
346
|
+
tileScale = clamp(tileScale, minimumTileScale, 0.97) * intro;
|
|
347
|
+
springShape = max(springShape, vec2(0.72));
|
|
348
|
+
|
|
349
|
+
float cosine = cos(angle);
|
|
350
|
+
float sine = sin(angle);
|
|
351
|
+
mat2 rotation = mat2(cosine, -sine, sine, cosine);
|
|
352
|
+
vec2 local = (cellUv - 0.5 - tileOffset) / (max(tileScale, 0.001) * springShape);
|
|
353
|
+
vec2 shapeLocal = rotation * local;
|
|
354
|
+
float boxDistance = max(abs(shapeLocal.x), abs(shapeLocal.y));
|
|
355
|
+
float outerBox = 1.0 - smoothstep(0.47, 0.5, boxDistance);
|
|
356
|
+
|
|
357
|
+
if (outerBox < 0.01) {
|
|
358
|
+
gl_FragColor = vec4(0.0);
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
vec2 hatchUv = local + 0.5;
|
|
363
|
+
vec2 baseStrokeDirection = normalize(vec2(1.0, 1.0));
|
|
364
|
+
vec2 pointerVector = uPointer - 0.5;
|
|
365
|
+
float pointerLength = length(pointerVector);
|
|
366
|
+
vec2 pointerDirection = pointerVector / max(pointerLength, 0.001);
|
|
367
|
+
if (dot(pointerDirection, baseStrokeDirection) < 0.0) {
|
|
368
|
+
pointerDirection *= -1.0;
|
|
369
|
+
}
|
|
370
|
+
float steering = uHover
|
|
371
|
+
* uMotion
|
|
372
|
+
* symbolCell
|
|
373
|
+
* (1.0 - mode3)
|
|
374
|
+
* smoothstep(0.055, 0.5, pointerLength)
|
|
375
|
+
* 0.92;
|
|
376
|
+
vec2 strokeDirection = normalize(mix(baseStrokeDirection, pointerDirection, steering));
|
|
377
|
+
vec2 strokeNormal = vec2(strokeDirection.y, -strokeDirection.x);
|
|
378
|
+
|
|
379
|
+
float phase = 0.0;
|
|
380
|
+
float drift = 0.0;
|
|
381
|
+
float hatchCoordinate = dot(hatchUv - 0.5, strokeNormal) * uStripeFrequency + phase + drift;
|
|
382
|
+
float hatchDistance = abs(fract(hatchCoordinate) - 0.5);
|
|
383
|
+
float transparentGap = 1.0 - smoothstep(uGapInner, uGapOuter, hatchDistance);
|
|
384
|
+
float diagonalStroke = 1.0 - transparentGap;
|
|
385
|
+
|
|
386
|
+
float shadeIndex = floor(maskSample.g * 255.0 + 0.5);
|
|
387
|
+
float shadeTone = shadeIndex / 9.0;
|
|
388
|
+
vec3 iconColor = palette(shadeIndex);
|
|
389
|
+
vec3 frameColor = mix(
|
|
390
|
+
vec3(0.78, 0.79, 0.815),
|
|
391
|
+
vec3(0.9, 0.91, 0.925),
|
|
392
|
+
shadeTone
|
|
393
|
+
);
|
|
394
|
+
vec3 color = iconColor * iconCell
|
|
395
|
+
+ frameColor * frameCell;
|
|
396
|
+
|
|
397
|
+
vec3 rippleColor = mix(
|
|
398
|
+
vec3(0.08, 0.78, 1.0),
|
|
399
|
+
vec3(0.58, 0.24, 1.0),
|
|
400
|
+
0.5 + 0.5 * sin(uHoverTime * 2.6 + cellDistance * 0.32)
|
|
401
|
+
);
|
|
402
|
+
vec3 elasticColor = vec3(1.0, 0.46, 0.1);
|
|
403
|
+
vec3 magneticColor = vec3(0.08, 0.76, 0.64);
|
|
404
|
+
vec3 shrinkHoverColor = vec3(0.612, 0.8, 0.576);
|
|
405
|
+
vec3 echoColor = vec3(0.612, 0.8, 0.576);
|
|
406
|
+
vec3 blastColor = mix(
|
|
407
|
+
vec3(1.0),
|
|
408
|
+
vec3(0.247, 0.478, 0.204),
|
|
409
|
+
smoothstep(0.0, 0.42, uBlastTime)
|
|
410
|
+
);
|
|
411
|
+
vec3 scatterColor = mix(
|
|
412
|
+
vec3(1.0, 0.2, 0.55),
|
|
413
|
+
vec3(0.08, 0.82, 1.0),
|
|
414
|
+
step(0.5, random)
|
|
415
|
+
);
|
|
416
|
+
vec3 particleColor = mix(
|
|
417
|
+
vec3(0.0, 0.9, 0.96),
|
|
418
|
+
vec3(0.62, 0.18, 1.0),
|
|
419
|
+
clamp(cellDistance / 5.6 + (random - 0.5) * 0.22, 0.0, 1.0)
|
|
420
|
+
);
|
|
421
|
+
|
|
422
|
+
color = mix(color, rippleColor, mode0 * clamp(colorRipple * 0.94, 0.0, 0.94));
|
|
423
|
+
color = mix(
|
|
424
|
+
color,
|
|
425
|
+
elasticColor,
|
|
426
|
+
mode1 * directCell * hoverMotion * (0.68 + 0.24 * abs(sin(uHoverTime * 8.4)))
|
|
427
|
+
);
|
|
428
|
+
color = mix(
|
|
429
|
+
color,
|
|
430
|
+
magneticColor,
|
|
431
|
+
mode2 * clamp(max(magneticField * 0.72, directCell * hoverMotion * 0.72), 0.0, 0.82)
|
|
432
|
+
);
|
|
433
|
+
color = mix(
|
|
434
|
+
color,
|
|
435
|
+
shrinkHoverColor,
|
|
436
|
+
radialShrinkMode * clamp(radialShrink * 0.98, 0.0, 0.98)
|
|
437
|
+
);
|
|
438
|
+
color = mix(
|
|
439
|
+
color,
|
|
440
|
+
echoColor,
|
|
441
|
+
mode3 * clamp(radialEcho * 0.96, 0.0, 0.96)
|
|
442
|
+
);
|
|
443
|
+
color = mix(
|
|
444
|
+
color,
|
|
445
|
+
blastColor,
|
|
446
|
+
mode3 * clamp(max(max(blastRing, blastCore) * 1.12, abs(blastShake) * 0.34), 0.0, 0.98)
|
|
447
|
+
);
|
|
448
|
+
color = mix(
|
|
449
|
+
color,
|
|
450
|
+
scatterColor,
|
|
451
|
+
mode4 * clamp(max(signalScatter * 0.98, directCell * hoverMotion * 0.7), 0.0, 0.98)
|
|
452
|
+
);
|
|
453
|
+
color = mix(
|
|
454
|
+
color,
|
|
455
|
+
particleColor,
|
|
456
|
+
particleHoverMode
|
|
457
|
+
* clamp(max(particleForce * 1.04, directCell * hoverMotion * 0.86), 0.0, 0.94)
|
|
458
|
+
);
|
|
459
|
+
|
|
460
|
+
float cellOpacity = mix(0.1, 1.0, iconCell);
|
|
461
|
+
gl_FragColor = vec4(color, outerBox * diagonalStroke * presence * intro * cellOpacity);
|
|
462
|
+
}
|
|
463
|
+
`
|
|
464
|
+
), E = typeof window < "u" ? window.matchMedia("(prefers-reduced-motion: reduce)") : { matches: !1 };
|
|
465
|
+
function p(a) {
|
|
466
|
+
const e = Number.parseInt(a.slice(1), 16);
|
|
467
|
+
return [(e >> 16 & 255) / 255, (e >> 8 & 255) / 255, (e & 255) / 255];
|
|
468
|
+
}
|
|
469
|
+
function B(a) {
|
|
470
|
+
const e = a.length, i = a[0].length, s = Array.from({ length: e }, () => Array(i).fill(!1)), c = [], r = (t, l) => {
|
|
471
|
+
t < 0 || t >= e || l < 0 || l >= i || s[t][l] || a[t][l] === "#" || (s[t][l] = !0, c.push([t, l]));
|
|
472
|
+
};
|
|
473
|
+
for (let t = 0; t < i; t += 1)
|
|
474
|
+
r(0, t), r(e - 1, t);
|
|
475
|
+
for (let t = 0; t < e; t += 1)
|
|
476
|
+
r(t, 0), r(t, i - 1);
|
|
477
|
+
for (let t = 0; t < c.length; t += 1) {
|
|
478
|
+
const [l, h] = c[t];
|
|
479
|
+
r(l - 1, h), r(l + 1, h), r(l, h - 1), r(l, h + 1);
|
|
480
|
+
}
|
|
481
|
+
return a.map(
|
|
482
|
+
(t, l) => [...t].map((h, n) => h === "#" ? 2 : s[l][n] ? 0 : 1)
|
|
483
|
+
);
|
|
484
|
+
}
|
|
485
|
+
function X(a, e, i, s, c) {
|
|
486
|
+
const r = e.length, t = e[0].length, l = new Uint8Array(t * r * 4);
|
|
487
|
+
for (let h = 0; h < r; h += 1) {
|
|
488
|
+
const n = r - 1 - h;
|
|
489
|
+
for (let u = 0; u < t; u += 1) {
|
|
490
|
+
const m = (h * t + u) * 4, d = s[n][u], v = d === 2 || c && d === 0;
|
|
491
|
+
l[m] = v ? 255 : 0, l[m + 1] = v ? (u * 3 + h * 7 + i) % 10 : 0, l[m + 2] = d === 2 ? 255 : d === 1 ? 128 : 0, l[m + 3] = 255;
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
return new _(a, {
|
|
495
|
+
image: l,
|
|
496
|
+
width: t,
|
|
497
|
+
height: r,
|
|
498
|
+
format: a.RGBA,
|
|
499
|
+
internalFormat: a.RGBA,
|
|
500
|
+
generateMipmaps: !1,
|
|
501
|
+
minFilter: a.NEAREST,
|
|
502
|
+
magFilter: a.NEAREST,
|
|
503
|
+
flipY: !1,
|
|
504
|
+
unpackAlignment: 1
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
function Y() {
|
|
508
|
+
const a = document.createElement("canvas");
|
|
509
|
+
return !!(a.getContext("webgl2") || a.getContext("webgl"));
|
|
510
|
+
}
|
|
511
|
+
function W(a) {
|
|
512
|
+
const e = a[0].length, i = a.length;
|
|
513
|
+
let s = [0.5, 0.5], c = 1 / 0;
|
|
514
|
+
return a.forEach((r, t) => {
|
|
515
|
+
[...r].forEach((l, h) => {
|
|
516
|
+
if (l !== "#") return;
|
|
517
|
+
const n = (h + 0.5) / e, u = 1 - (t + 0.5) / i, m = (n - 0.5) ** 2 + (u - 0.5) ** 2;
|
|
518
|
+
m < c && (c = m, s = [n, u]);
|
|
519
|
+
});
|
|
520
|
+
}), s;
|
|
521
|
+
}
|
|
522
|
+
function $(a, e, i, s, c) {
|
|
523
|
+
a.classList.add("is-fallback");
|
|
524
|
+
const r = document.createElement("canvas"), t = 600, l = 63, h = (t - l * 2) / e[0].length, n = r.getContext("2d");
|
|
525
|
+
if (!n) return;
|
|
526
|
+
r.width = t, r.height = t;
|
|
527
|
+
const u = B(e);
|
|
528
|
+
e.forEach((m, d) => {
|
|
529
|
+
[...m].forEach((v, b) => {
|
|
530
|
+
const g = u[d][b];
|
|
531
|
+
if (g === 1 || !c && g !== 2) return;
|
|
532
|
+
const x = (b * 3 + (e.length - 1 - d) * 7 + s) % i.length, C = g === 2 ? i : U, S = h * 0.08, T = l + b * h + S, w = l + d * h + S, f = h - S * 2;
|
|
533
|
+
n.save(), n.beginPath(), n.rect(T, w, f, f), n.clip(), n.globalAlpha = g === 2 ? 1 : 0.1, n.strokeStyle = C[x];
|
|
534
|
+
const F = a.classList.contains("pixel-icon--hero") ? 0.095 : 0.13;
|
|
535
|
+
n.lineWidth = Math.max(1.5, f * F);
|
|
536
|
+
for (let P = -f; P < f * 2; P += f * 0.16)
|
|
537
|
+
n.beginPath(), n.moveTo(T + P, w), n.lineTo(T + P - f, w + f), n.stroke();
|
|
538
|
+
n.restore();
|
|
539
|
+
});
|
|
540
|
+
}), a.append(r);
|
|
541
|
+
}
|
|
542
|
+
class J {
|
|
543
|
+
constructor(e, i, s) {
|
|
544
|
+
o(this, "root");
|
|
545
|
+
o(this, "surface");
|
|
546
|
+
o(this, "maskName");
|
|
547
|
+
o(this, "rows");
|
|
548
|
+
o(this, "boxed");
|
|
549
|
+
o(this, "cellKinds");
|
|
550
|
+
o(this, "seed");
|
|
551
|
+
o(this, "palette");
|
|
552
|
+
o(this, "focusPoint");
|
|
553
|
+
o(this, "hoverTarget", 0);
|
|
554
|
+
o(this, "hover", 0);
|
|
555
|
+
o(this, "hoverAge", 0);
|
|
556
|
+
o(this, "hoveredTileKey", null);
|
|
557
|
+
o(this, "intro");
|
|
558
|
+
o(this, "pointerTarget", [0.5, 0.5]);
|
|
559
|
+
o(this, "pointer", [0.5, 0.5]);
|
|
560
|
+
o(this, "pointerTileKey", null);
|
|
561
|
+
o(this, "pointerDownSource", null);
|
|
562
|
+
o(this, "hadPointerDown", !1);
|
|
563
|
+
o(this, "blastPointer", [0.5, 0.5]);
|
|
564
|
+
o(this, "blastAge", 2);
|
|
565
|
+
o(this, "blastActive", 0);
|
|
566
|
+
o(this, "visible", !0);
|
|
567
|
+
o(this, "startedAt");
|
|
568
|
+
o(this, "lastFrameTime");
|
|
569
|
+
o(this, "motionMode");
|
|
570
|
+
o(this, "canvas");
|
|
571
|
+
o(this, "renderer");
|
|
572
|
+
o(this, "gl");
|
|
573
|
+
o(this, "program");
|
|
574
|
+
o(this, "mesh");
|
|
575
|
+
o(this, "resizeObserver");
|
|
576
|
+
o(this, "intersectionObserver");
|
|
577
|
+
o(this, "onPointerLeave");
|
|
578
|
+
o(this, "onPointerMove");
|
|
579
|
+
o(this, "onPointerDown");
|
|
580
|
+
o(this, "onFocus");
|
|
581
|
+
o(this, "onBlur");
|
|
582
|
+
o(this, "onClick");
|
|
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 = y.has(this.maskName), this.cellKinds = B(this.rows), this.seed = i * 13 + 7, this.palette = k[this.maskName] || k.growth, this.focusPoint = W(this.rows), this.intro = E.matches ? 1 : 0, this.startedAt = performance.now(), this.lastFrameTime = this.startedAt, this.motionMode = e.classList.contains("pixel-icon--hero") ? 3 : s, this.canvas = document.createElement("canvas"), this.canvas.setAttribute("aria-hidden", "true"), e.append(this.canvas), this.renderer = new O({
|
|
584
|
+
canvas: this.canvas,
|
|
585
|
+
dpr: Math.min(window.devicePixelRatio || 1, 2),
|
|
586
|
+
alpha: !0,
|
|
587
|
+
depth: !1,
|
|
588
|
+
antialias: !1,
|
|
589
|
+
premultipliedAlpha: !1,
|
|
590
|
+
powerPreference: "high-performance"
|
|
591
|
+
}), this.gl = this.renderer.gl, this.gl.clearColor(0, 0, 0, 0);
|
|
592
|
+
const c = X(this.gl, this.rows, this.seed, this.cellKinds, this.boxed), r = new I(this.gl);
|
|
593
|
+
this.program = new z(this.gl, {
|
|
594
|
+
vertex: q,
|
|
595
|
+
fragment: V,
|
|
596
|
+
transparent: !0,
|
|
597
|
+
depthTest: !1,
|
|
598
|
+
depthWrite: !1,
|
|
599
|
+
cullFace: !1,
|
|
600
|
+
uniforms: {
|
|
601
|
+
tMask: { value: c },
|
|
602
|
+
uGrid: { value: [this.rows[0].length, this.rows.length] },
|
|
603
|
+
uPointer: { value: this.pointer },
|
|
604
|
+
uBlastPointer: { value: this.blastPointer },
|
|
605
|
+
uTime: { value: 0 },
|
|
606
|
+
uHoverTime: { value: 0 },
|
|
607
|
+
uHover: { value: 0 },
|
|
608
|
+
uBlastTime: { value: this.blastAge },
|
|
609
|
+
uBlast: { value: 0 },
|
|
610
|
+
uIntro: { value: this.intro },
|
|
611
|
+
uMotion: { value: E.matches ? 0 : 1 },
|
|
612
|
+
uSequence: { value: e.dataset.motion === "sequence" ? 1 : 0 },
|
|
613
|
+
uSeed: { value: this.seed * 0.17 },
|
|
614
|
+
uStripeFrequency: { value: 4.455 },
|
|
615
|
+
uGapInner: { value: 0.13 },
|
|
616
|
+
uGapOuter: { value: 0.19 },
|
|
617
|
+
uMode: { value: this.motionMode },
|
|
618
|
+
uColor0: { value: p(this.palette[0]) },
|
|
619
|
+
uColor1: { value: p(this.palette[1]) },
|
|
620
|
+
uColor2: { value: p(this.palette[2]) },
|
|
621
|
+
uColor3: { value: p(this.palette[3]) },
|
|
622
|
+
uColor4: { value: p(this.palette[4]) },
|
|
623
|
+
uColor5: { value: p(this.palette[5]) },
|
|
624
|
+
uColor6: { value: p(this.palette[6]) },
|
|
625
|
+
uColor7: { value: p(this.palette[7]) },
|
|
626
|
+
uColor8: { value: p(this.palette[8]) },
|
|
627
|
+
uColor9: { value: p(this.palette[9]) }
|
|
628
|
+
}
|
|
629
|
+
}), this.mesh = new K(this.gl, { geometry: r, program: this.program }), this.bindEvents(), this.observe(), this.resize();
|
|
630
|
+
}
|
|
631
|
+
getPointerHit(e, i) {
|
|
632
|
+
const s = this.root.getBoundingClientRect(), c = 1 - M * 2, r = (e - s.left) / s.width, t = (i - s.top) / s.height, l = (r - M) / c, h = (t - M) / c, n = l >= 0 && l < 1 && h >= 0 && h < 1;
|
|
633
|
+
let u = !1, m = null;
|
|
634
|
+
if (n) {
|
|
635
|
+
const d = this.rows[0].length, v = this.rows.length, b = l * d, g = h * v, x = Math.floor(b), C = Math.floor(g), S = b - x, T = g - C;
|
|
636
|
+
u = Math.abs(S - 0.5) <= 0.43 && Math.abs(T - 0.5) <= 0.43 && this.cellKinds[C][x] === 2, u && (m = `${C}:${x}`);
|
|
637
|
+
}
|
|
638
|
+
return { iconX: l, iconYTop: h, isTileHit: u, tileKey: m };
|
|
639
|
+
}
|
|
640
|
+
bindEvents() {
|
|
641
|
+
this.onPointerLeave = () => {
|
|
642
|
+
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
|
+
}, this.onPointerMove = (e) => {
|
|
644
|
+
const { iconX: i, iconYTop: s, isTileHit: c, tileKey: r } = this.getPointerHit(
|
|
645
|
+
e.clientX,
|
|
646
|
+
e.clientY
|
|
647
|
+
);
|
|
648
|
+
r !== this.hoveredTileKey && (this.hoverAge = 0), this.hoveredTileKey = r, this.pointerTileKey = r, this.hoverTarget = c ? 1 : 0, this.surface.classList.toggle("is-over-tile", c), c ? (this.pointerTarget[0] = i, this.pointerTarget[1] = 1 - s) : (this.pointerTarget[0] = 0.5, this.pointerTarget[1] = 0.5);
|
|
649
|
+
}, this.onPointerDown = (e) => {
|
|
650
|
+
const i = this.getPointerHit(e.clientX, e.clientY);
|
|
651
|
+
this.hadPointerDown = !0, this.pointerDownSource = i.isTileHit ? [i.iconX, 1 - i.iconYTop] : null;
|
|
652
|
+
}, this.onFocus = () => {
|
|
653
|
+
this.hadPointerDown || (this.hoverTarget = 1, this.hoverAge = 0, this.hoveredTileKey = "focus", this.pointerTarget[0] = this.focusPoint[0], this.pointerTarget[1] = this.focusPoint[1]);
|
|
654
|
+
}, this.onBlur = () => {
|
|
655
|
+
this.hoverTarget = 0, this.hoverAge = 0, this.hoveredTileKey = null;
|
|
656
|
+
}, this.onClick = () => {
|
|
657
|
+
const e = this.hadPointerDown ? this.pointerDownSource : this.focusPoint;
|
|
658
|
+
this.hadPointerDown = !1, this.pointerDownSource = null, this.motionMode === 3 && e && (this.blastPointer[0] = e[0], this.blastPointer[1] = e[1], this.blastAge = 0, this.blastActive = 1);
|
|
659
|
+
}, this.surface.addEventListener("pointerleave", this.onPointerLeave), this.surface.addEventListener("pointermove", this.onPointerMove), this.surface.addEventListener("pointerdown", this.onPointerDown), this.surface.addEventListener("focus", this.onFocus), this.surface.addEventListener("blur", this.onBlur), this.surface.addEventListener("click", this.onClick);
|
|
660
|
+
}
|
|
661
|
+
observe() {
|
|
662
|
+
this.resizeObserver = new ResizeObserver(() => this.resize()), this.resizeObserver.observe(this.root), this.intersectionObserver = new IntersectionObserver(
|
|
663
|
+
([e]) => {
|
|
664
|
+
this.visible = e.isIntersecting;
|
|
665
|
+
},
|
|
666
|
+
{ rootMargin: "160px" }
|
|
667
|
+
), this.intersectionObserver.observe(this.root);
|
|
668
|
+
}
|
|
669
|
+
resize() {
|
|
670
|
+
const e = this.root.getBoundingClientRect(), i = Math.max(1, Math.round(Math.min(e.width, e.height))), s = Math.max(this.rows[0].length, this.rows.length), c = i * (1 - M * 2) / s, r = Math.min(1, Math.max(0, (c - 12) / 4.5));
|
|
671
|
+
this.renderer.setSize(i, i), this.program.uniforms.uStripeFrequency.value = 2 + (4.455 - 2) * r, this.program.uniforms.uGapInner.value = 0.13, this.program.uniforms.uGapOuter.value = 0.2 + (0.19 - 0.2) * r;
|
|
672
|
+
}
|
|
673
|
+
update(e) {
|
|
674
|
+
const i = Math.min(0.05, Math.max(0, (e - this.lastFrameTime) * 1e-3));
|
|
675
|
+
if (this.lastFrameTime = e, !this.visible) return;
|
|
676
|
+
const s = (e - this.startedAt) * 1e-3, c = E.matches ? 0 : 1;
|
|
677
|
+
this.hoverAge = this.hoverTarget > 0 ? this.hoverAge + i : 0, this.blastActive > 0 && (this.blastAge += i, 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, s / 1.7) : 1, this.program.uniforms.uTime.value = s, 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
|
+
}
|
|
679
|
+
destroy() {
|
|
680
|
+
var i, s;
|
|
681
|
+
(i = this.resizeObserver) == null || i.disconnect(), (s = this.intersectionObserver) == null || s.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
|
+
const e = this.gl.getExtension("WEBGL_lose_context");
|
|
683
|
+
e == null || e.loseContext();
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
const j = D.forwardRef(
|
|
687
|
+
({ mask: a = "growth", motion: e = "sequence", motionMode: i = 3, hero: s = !1, className: c, ...r }, t) => {
|
|
688
|
+
const l = D.useRef(null), h = D.useCallback(
|
|
689
|
+
(n) => {
|
|
690
|
+
l.current = n, typeof t == "function" ? t(n) : t && (t.current = n);
|
|
691
|
+
},
|
|
692
|
+
[t]
|
|
693
|
+
);
|
|
694
|
+
return D.useEffect(() => {
|
|
695
|
+
const n = l.current;
|
|
696
|
+
if (!n) return;
|
|
697
|
+
let u = null, m = 0;
|
|
698
|
+
if (Y()) {
|
|
699
|
+
u = new J(n, 0, i);
|
|
700
|
+
const d = (v) => {
|
|
701
|
+
u == null || u.update(v), m = window.requestAnimationFrame(d);
|
|
702
|
+
};
|
|
703
|
+
m = window.requestAnimationFrame(d);
|
|
704
|
+
} else {
|
|
705
|
+
const d = a in R ? a : "growth";
|
|
706
|
+
$(n, R[d], k[d] || k.growth, 7, y.has(d));
|
|
707
|
+
}
|
|
708
|
+
return () => {
|
|
709
|
+
m && window.cancelAnimationFrame(m), u == null || u.destroy(), n.replaceChildren(), n.classList.remove("is-fallback");
|
|
710
|
+
};
|
|
711
|
+
}, [a, e, i, s]), /* @__PURE__ */ G(
|
|
712
|
+
"span",
|
|
713
|
+
{
|
|
714
|
+
ref: h,
|
|
715
|
+
"aria-hidden": !0,
|
|
716
|
+
"data-pixel-icon": !0,
|
|
717
|
+
"data-mask": a,
|
|
718
|
+
"data-motion": e,
|
|
719
|
+
className: N(
|
|
720
|
+
"pixel-surface pixel-icon relative block outline-none [&_canvas]:block [&_canvas]:size-full",
|
|
721
|
+
s && "pixel-icon--hero",
|
|
722
|
+
c
|
|
723
|
+
),
|
|
724
|
+
tabIndex: 0,
|
|
725
|
+
...r
|
|
726
|
+
}
|
|
727
|
+
);
|
|
728
|
+
}
|
|
729
|
+
);
|
|
730
|
+
j.displayName = "PixelIcon";
|
|
731
|
+
export {
|
|
732
|
+
j as PixelIcon
|
|
733
|
+
};
|