@actioneer/ads 0.5.6 → 0.5.8

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 (149) hide show
  1. package/bin/ads-init.mjs +6 -0
  2. package/components/accordion.js +50 -48
  3. package/components/agent-icon.d.ts +12 -0
  4. package/components/agent-icon.js +135 -121
  5. package/components/ai-elements/chain-of-thought-icon.d.ts +10 -12
  6. package/components/ai-elements/chain-of-thought-icon.js +341 -201
  7. package/components/ai-elements/chain-of-thought.d.ts +2 -2
  8. package/components/ai-elements/chain-of-thought.js +108 -108
  9. package/components/ai-elements/chart.js +16 -14
  10. package/components/ai-elements/inline-citation.js +41 -41
  11. package/components/ai-elements/message.js +4 -4
  12. package/components/ai-elements/queue.js +7 -7
  13. package/components/ai-elements/research-activity.js +114 -114
  14. package/components/ai-elements/shimmer.d.ts +2 -2
  15. package/components/ai-elements/speech-input.js +28 -28
  16. package/components/ai-elements/task-progress.js +26 -16
  17. package/components/ai-elements/task.js +17 -17
  18. package/components/ai-elements/tool.js +6 -6
  19. package/components/ai-elements/transcript.js +6 -5
  20. package/components/ai-elements/voice.js +1 -1
  21. package/components/alert.js +10 -10
  22. package/components/answer-sources.d.ts +42 -0
  23. package/components/answer-sources.js +111 -0
  24. package/components/answer.js +115 -114
  25. package/components/assistant-ui/action-bar.js +94 -48
  26. package/components/assistant-ui/attachment.js +131 -103
  27. package/components/assistant-ui/badge.d.ts +1 -1
  28. package/components/assistant-ui/badge.js +17 -17
  29. package/components/assistant-ui/chain-of-thought.d.ts +1 -1
  30. package/components/assistant-ui/composer-add-context.js +9 -9
  31. package/components/assistant-ui/composer-deep-research.js +5 -5
  32. package/components/assistant-ui/composer-harness.js +12 -9
  33. package/components/assistant-ui/composer-trigger-popover.js +45 -34
  34. package/components/assistant-ui/composer.js +59 -59
  35. package/components/assistant-ui/error.js +14 -14
  36. package/components/assistant-ui/file.d.ts +1 -1
  37. package/components/assistant-ui/image.d.ts +1 -1
  38. package/components/assistant-ui/image.js +113 -103
  39. package/components/assistant-ui/markdown-text.js +18 -18
  40. package/components/assistant-ui/message.js +46 -45
  41. package/components/assistant-ui/quote.js +1 -1
  42. package/components/assistant-ui/reasoning.d.ts +1 -1
  43. package/components/assistant-ui/reasoning.js +66 -77
  44. package/components/assistant-ui/suggestions.js +4 -4
  45. package/components/assistant-ui/thread-context.d.ts +2 -0
  46. package/components/assistant-ui/thread.js +41 -40
  47. package/components/assistant-ui/tool-fallback.js +60 -63
  48. package/components/assistant-ui/tool-group.d.ts +1 -1
  49. package/components/assistant-ui/tool-group.js +36 -42
  50. package/components/audio-waveform.js +25 -24
  51. package/components/autocomplete.d.ts +1 -0
  52. package/components/autocomplete.js +45 -43
  53. package/components/avatar.js +30 -30
  54. package/components/badge.d.ts +1 -1
  55. package/components/breadcrumbs.js +2 -2
  56. package/components/button.d.ts +2 -2
  57. package/components/button.js +22 -20
  58. package/components/card.js +8 -8
  59. package/components/carousel.js +105 -104
  60. package/components/chart.js +9 -7
  61. package/components/checkbox.js +74 -38
  62. package/components/chip.d.ts +1 -1
  63. package/components/code-block.js +3 -3
  64. package/components/collapsible.js +67 -23
  65. package/components/connector-card.js +6 -6
  66. package/components/drawer.d.ts +15 -10
  67. package/components/drawer.js +78 -77
  68. package/components/dropdown.d.ts +3 -1
  69. package/components/dropdown.js +88 -79
  70. package/components/empty-state.d.ts +4 -4
  71. package/components/empty-state.js +7 -7
  72. package/components/field.d.ts +4 -0
  73. package/components/field.js +45 -34
  74. package/components/file-dropzone.js +12 -12
  75. package/components/index.d.ts +4 -0
  76. package/components/index.js +584 -553
  77. package/components/infinite-canvas.js +1 -1
  78. package/components/input-field.js +51 -46
  79. package/components/input.js +20 -20
  80. package/components/link.js +9 -9
  81. package/components/modal.js +105 -73
  82. package/components/navbar.d.ts +1 -1
  83. package/components/navbar.js +1 -1
  84. package/components/number-field.js +38 -29
  85. package/components/page-header.js +12 -12
  86. package/components/pagination.js +19 -19
  87. package/components/panel.js +2 -2
  88. package/components/pixel-blast-svg.js +3 -3
  89. package/components/pixel-icon.d.ts +3 -1
  90. package/components/pixel-icon.js +294 -215
  91. package/components/popover.d.ts +1 -1
  92. package/components/popover.js +66 -64
  93. package/components/progress-circle.js +36 -32
  94. package/components/progress.js +28 -24
  95. package/components/radio.js +59 -49
  96. package/components/resizable-panel.js +1 -1
  97. package/components/reveal.d.ts +2 -2
  98. package/components/ripple.d.ts +3 -3
  99. package/components/scroll-area.js +17 -16
  100. package/components/segmented.d.ts +4 -1
  101. package/components/segmented.js +26 -25
  102. package/components/select.d.ts +2 -0
  103. package/components/select.js +61 -57
  104. package/components/setting-row.js +45 -42
  105. package/components/sidebar.d.ts +2 -2
  106. package/components/sidebar.js +131 -127
  107. package/components/skeleton.js +5 -5
  108. package/components/spinner.d.ts +13 -4
  109. package/components/spinner.js +42 -42
  110. package/components/stepper.js +21 -21
  111. package/components/switch.js +52 -32
  112. package/components/table.d.ts +24 -7
  113. package/components/table.js +457 -220
  114. package/components/tabs.js +149 -137
  115. package/components/textarea.js +1 -2
  116. package/components/toast.js +66 -66
  117. package/components/tooltip.js +2 -2
  118. package/components/tree.js +62 -51
  119. package/components/typography.d.ts +2 -1
  120. package/components/typography.js +33 -32
  121. package/components/ui/button.d.ts +2 -2
  122. package/components/ui/button.js +19 -19
  123. package/components/ui/collapsible.d.ts +1 -5
  124. package/components/ui/dialog.d.ts +3 -3
  125. package/components/ui/dialog.js +95 -58
  126. package/components/ui/tooltip.d.ts +2 -2
  127. package/components/ui/tooltip.js +67 -33
  128. package/components/viz-charts.js +95 -95
  129. package/demo/components/add-to-artifact.js +341 -0
  130. package/demo/lib/artifact-library.js +134 -0
  131. package/fonts/aribau-grotesk-medium.woff2 +0 -0
  132. package/fonts/aribau-grotesk-regular.woff2 +0 -0
  133. package/fonts.css +11 -11
  134. package/hooks/agents-ui/use-agent-audio-visualizer-aura.js +17 -16
  135. package/hooks/agents-ui/use-agent-audio-visualizer-wave.js +21 -20
  136. package/lib/icons.d.ts +12 -0
  137. package/lib/icons.js +107 -104
  138. package/lib/motion.d.ts +42 -39
  139. package/lib/motion.js +112 -52
  140. package/lib/spinner-mark.d.ts +9 -0
  141. package/lib/spinner-mark.js +98 -0
  142. package/llms.txt +69 -26
  143. package/manifest.json +344 -42
  144. package/package.json +1 -1
  145. package/styles.css +175 -161
  146. package/theme.css +104 -128
  147. package/components/ui/collapsible.js +0 -35
  148. package/fonts/aribau-grotesk-500.otf +0 -0
  149. package/fonts/aribau-grotesk-600.woff2 +0 -0
@@ -1,11 +1,11 @@
1
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";
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
- }, 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
+ }, 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
- ), V = (
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 = ${M.toFixed(4)};
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 radialShrinkMode = mode3 * (1.0 - blastSuppression);
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.25, 5.6, cellDistance)) * hoverMotion;
280
- float particleSettle = 0.88 + 0.12 * sin(
281
- uHoverTime * 6.4 - cellDistance * 1.28 + random * 2.6
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.132 + 0.018 * sin(uHoverTime * 5.2 + random * 7.0));
290
- float radialShrink = max(
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 -= radialShrinkMode * radialShrink * 0.27;
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.19
336
- + directCell * hoverMotion * (0.025 + 0.015 * sin(uHoverTime * 6.4))
366
+ -particleForce * 0.34
367
+ + directCell * hoverMotion * (0.035 + 0.025 * sin(uHoverTime * 7.2))
337
368
  );
338
- springShape += particleHoverMode * vec2(-particleForce * 0.035, particleForce * 0.05);
369
+ springShape += particleHoverMode * vec2(-particleForce * 0.12, particleForce * 0.18);
339
370
  angle += particleHoverMode * (
340
- (random - 0.5) * particleForce * 0.6
341
- + directCell * hoverMotion * sin(uHoverTime * 5.4) * 0.045
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.06 - radialShrinkMode * 0.1;
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
- vec3(0.08, 0.78, 1.0),
399
- vec3(0.58, 0.24, 1.0),
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 shrinkHoverColor = vec3(0.612, 0.8, 0.576);
405
- vec3 echoColor = vec3(0.612, 0.8, 0.576);
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
- vec3(0.247, 0.478, 0.204),
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.04, directCell * hoverMotion * 0.86), 0.0, 0.94)
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
- ), 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];
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 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]));
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 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);
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 a.map(
482
- (t, l) => [...t].map((h, n) => h === "#" ? 2 : s[l][n] ? 0 : 1)
530
+ return r.map(
531
+ (a, t) => [...a].map((s, u) => s === "#" ? 2 : n[t][u] ? 0 : 1)
483
532
  );
484
533
  }
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;
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 _(a, {
495
- image: l,
496
- width: t,
497
- height: r,
498
- format: a.RGBA,
499
- internalFormat: a.RGBA,
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: a.NEAREST,
502
- magFilter: a.NEAREST,
550
+ minFilter: r.NEAREST,
551
+ magFilter: r.NEAREST,
503
552
  flipY: !1,
504
553
  unpackAlignment: 1
505
554
  });
506
555
  }
507
- function Y() {
508
- const a = document.createElement("canvas");
509
- return !!(a.getContext("webgl2") || a.getContext("webgl"));
556
+ function J() {
557
+ const r = document.createElement("canvas");
558
+ return !!(r.getContext("webgl2") || r.getContext("webgl"));
510
559
  }
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]);
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
- }), s;
569
+ }), n;
521
570
  }
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();
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
- }), a.append(r);
591
+ }), r.append(l);
541
592
  }
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({
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 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,
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: c },
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: E.matches ? 0 : 1 },
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: 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]) }
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 K(this.gl, { geometry: r, program: this.program }), this.bindEvents(), this.observe(), this.resize();
692
+ }), this.mesh = new _(this.gl, { geometry: a, program: this.program }), this.bindEvents(), this.observe(), this.resize();
630
693
  }
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}`);
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: l, iconYTop: h, isTileHit: u, tileKey: m };
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: i, iconYTop: s, isTileHit: c, tileKey: r } = this.getPointerHit(
707
+ const { iconX: o, iconYTop: n, isTileHit: c, tileKey: l } = this.getPointerHit(
645
708
  e.clientX,
646
709
  e.clientY
647
710
  );
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);
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 i = this.getPointerHit(e.clientX, e.clientY);
651
- this.hadPointerDown = !0, this.pointerDownSource = i.isTileHit ? [i.iconX, 1 - i.iconYTop] : null;
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,83 @@ class J {
667
730
  ), this.intersectionObserver.observe(this.root);
668
731
  }
669
732
  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;
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 i = Math.min(0.05, Math.max(0, (e - this.lastFrameTime) * 1e-3));
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 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 });
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 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);
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 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);
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 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);
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
- m = window.requestAnimationFrame(d);
777
+ d = window.requestAnimationFrame(v);
704
778
  } else {
705
- const d = a in R ? a : "growth";
706
- $(n, R[d], k[d] || k.growth, 7, y.has(d));
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
- m && window.cancelAnimationFrame(m), u == null || u.destroy(), n.replaceChildren(), n.classList.remove("is-fallback");
789
+ d && window.cancelAnimationFrame(d), m == null || m.destroy(), h.replaceChildren(), h.classList.remove("is-fallback");
710
790
  };
711
- }, [a, e, i, s]), /* @__PURE__ */ G(
791
+ }, [r, e, o, n, c]), /* @__PURE__ */ O(
712
792
  "span",
713
793
  {
714
- ref: h,
794
+ ref: u,
715
795
  "aria-hidden": !0,
716
796
  "data-pixel-icon": !0,
717
- "data-mask": a,
797
+ "data-mask": r,
718
798
  "data-motion": e,
719
- className: N(
799
+ className: q(
720
800
  "pixel-surface pixel-icon relative block outline-none [&_canvas]:block [&_canvas]:size-full",
721
- s && "pixel-icon--hero",
722
- c
801
+ c && "pixel-icon--hero",
802
+ l
723
803
  ),
724
- tabIndex: 0,
725
- ...r
804
+ ...a
726
805
  }
727
806
  );
728
807
  }
729
808
  );
730
- j.displayName = "PixelIcon";
809
+ ee.displayName = "PixelIcon";
731
810
  export {
732
- j as PixelIcon
811
+ ee as PixelIcon
733
812
  };