@actioneer/ads 0.6.0 → 0.7.0

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