@actioneer/ads 0.3.0 → 0.4.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.
- package/components/ai-elements/agent-trace.d.ts +87 -0
- package/components/ai-elements/agent-trace.js +180 -0
- package/components/ai-elements/chain-of-thought.d.ts +25 -5
- package/components/ai-elements/chain-of-thought.js +227 -183
- package/components/ai-elements/index.d.ts +1 -0
- package/components/ai-elements/research-activity.d.ts +17 -0
- package/components/ai-elements/research-activity.js +125 -107
- package/components/ai-elements/task.d.ts +7 -3
- package/components/ai-elements/task.js +84 -52
- package/components/ai-elements/tool.js +19 -19
- package/components/ai-elements/voice.d.ts +28 -12
- package/components/ai-elements/voice.js +270 -649
- package/components/alert.js +28 -16
- package/components/assistant-ui/composer-harness.js +5 -4
- package/components/code-block.d.ts +11 -5
- package/components/code-block.js +161 -62
- package/components/index.js +259 -257
- package/components/scroll-area.js +10 -10
- package/components/sidebar.js +1 -1
- package/components/stepper.d.ts +17 -9
- package/components/stepper.js +85 -96
- package/lib/icons.js +2 -2
- package/lib/motion.d.ts +2 -0
- package/lib/motion.js +21 -20
- package/llms.txt +7 -1
- package/manifest.json +69 -6
- package/package.json +1 -1
- package/styles.css +110 -4
- package/theme.css +12 -4
- package/components/agents-ui/agent-audio-visualizer-aura.d.ts +0 -11
- package/components/agents-ui/agent-audio-visualizer-aura.js +0 -277
- package/components/agents-ui/agent-audio-visualizer-wave.d.ts +0 -12
- package/components/agents-ui/agent-audio-visualizer-wave.js +0 -203
- package/components/agents-ui/react-shader-toy.d.ts +0 -87
- package/components/agents-ui/react-shader-toy.js +0 -531
package/styles.css
CHANGED
|
@@ -34,11 +34,17 @@
|
|
|
34
34
|
*/
|
|
35
35
|
@theme {
|
|
36
36
|
/* ---- Typography ----
|
|
37
|
-
One typeface
|
|
38
|
-
|
|
37
|
+
One brand typeface. Figures inside prose stay in Aribau Grotesk with
|
|
38
|
+
`tabular-nums`; only literal source code steps to the mono stack. */
|
|
39
39
|
--font-sans: "Aribau Grotesk", ui-sans-serif, system-ui, -apple-system,
|
|
40
40
|
"Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
41
41
|
|
|
42
|
+
/* Source code only (CodeBlock, inline Code). ADS ships no mono webfont —
|
|
43
|
+
this resolves to the reader's platform mono, which is what a developer
|
|
44
|
+
already reads code in. Never use it for UI copy or data. */
|
|
45
|
+
--font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
|
|
46
|
+
"Liberation Mono", "Courier New", monospace;
|
|
47
|
+
|
|
42
48
|
/* ---- Type scale ---- base = 15px (0.9375rem). Root stays 16px so the
|
|
43
49
|
spacing grid is unaffected; only text sizes are anchored to 15px. */
|
|
44
50
|
/* SIX sizes only — a deliberately small ladder (captions → display).
|
|
@@ -116,8 +122,8 @@
|
|
|
116
122
|
/* ---- Elevation ---- ONE soft token (Claude-panel style).
|
|
117
123
|
Delineate surfaces with fill color first; add this to gently lift them. */
|
|
118
124
|
--shadow-elevation: 0 0 0 1px rgb(10 10 11 / 0.03),
|
|
119
|
-
0 1px 2px 0 rgb(10 10 11 / 0.
|
|
120
|
-
0 8px
|
|
125
|
+
0 1px 2px 0 rgb(10 10 11 / 0.04),
|
|
126
|
+
0 8px 28px -8px rgb(10 10 11 / 0.09);
|
|
121
127
|
|
|
122
128
|
/* ---- CTA inner glow ---- luminous inset highlight for primary buttons
|
|
123
129
|
(adapted from the "AI button" Figma): a crisp top-edge catch plus a soft
|
|
@@ -141,11 +147,13 @@
|
|
|
141
147
|
--ease-expo-out: cubic-bezier(0.16, 1, 0.3, 1); /* side-panel and drawer slide */
|
|
142
148
|
--ease-drawer: var(--ease-expo-out); /* backwards-compatible alias */
|
|
143
149
|
--ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1); /* playful overshoot (rare) */
|
|
150
|
+
--ease-disclosure: cubic-bezier(0.32, 0.72, 0, 1); /* height reveals — moves off the mark immediately, settles long */
|
|
144
151
|
|
|
145
152
|
/* Durations — every animation/transition timing flows from these.
|
|
146
153
|
UI animations stay under 300ms; exits run faster than enters. */
|
|
147
154
|
--duration-fast: 0.15s; /* menu / popover / tooltip enter */
|
|
148
155
|
--duration-normal: 0.2s; /* state transitions */
|
|
156
|
+
--duration-disclosure: 0.28s; /* collapsible open — travels a real distance */
|
|
149
157
|
--duration-spin: 0.8s; /* rotation loops (spinner) */
|
|
150
158
|
--duration-pulse: 1.5s; /* breathing / shimmer loops */
|
|
151
159
|
--duration-bloom: 0.9s; /* ambient reveals (chat texture bloom, curtain wipe) */
|
|
@@ -692,5 +700,103 @@
|
|
|
692
700
|
animation: none !important;
|
|
693
701
|
}
|
|
694
702
|
}
|
|
703
|
+
|
|
704
|
+
/* Collapsible disclosure (CSS path) — opt-in via .ads-collapsible for simple
|
|
705
|
+
disclosures. ChainOfThoughtContent does NOT use this: it animates with
|
|
706
|
+
Motion so a toggle mid-flight reverses from the current height instead of
|
|
707
|
+
restarting, which CSS keyframes cannot do.
|
|
708
|
+
|
|
709
|
+
Height, opacity and a short rise in ONE animation.
|
|
710
|
+
Two separate `animation` declarations cannot coexist (the shorthand replaces,
|
|
711
|
+
it does not merge), so animating height alongside tw-animate-css's enter/exit
|
|
712
|
+
silently drops the fade and leaves a bare height shutter — which reads as
|
|
713
|
+
rigid no matter how it is timed. Radix publishes the measured height as
|
|
714
|
+
--radix-collapsible-content-height; exits run faster than enters.
|
|
715
|
+
Eased with --ease-disclosure. --ease-out front-loads ~60% of the travel into
|
|
716
|
+
the first third (pop, then settle); --ease-in-out holds ~150ms before moving
|
|
717
|
+
(lag, then rush). A height reveal needs to leave the mark immediately and
|
|
718
|
+
settle long, which is what this curve does. */
|
|
719
|
+
@keyframes ads-collapsible-down {
|
|
720
|
+
from {
|
|
721
|
+
height: 0;
|
|
722
|
+
opacity: 0;
|
|
723
|
+
transform: translate3d(0, -4px, 0);
|
|
724
|
+
}
|
|
725
|
+
to {
|
|
726
|
+
height: var(--radix-collapsible-content-height);
|
|
727
|
+
opacity: 1;
|
|
728
|
+
transform: translate3d(0, 0, 0);
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
@keyframes ads-collapsible-up {
|
|
732
|
+
from {
|
|
733
|
+
height: var(--radix-collapsible-content-height);
|
|
734
|
+
opacity: 1;
|
|
735
|
+
transform: translate3d(0, 0, 0);
|
|
736
|
+
}
|
|
737
|
+
to {
|
|
738
|
+
height: 0;
|
|
739
|
+
opacity: 0;
|
|
740
|
+
transform: translate3d(0, -4px, 0);
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
.ads-collapsible[data-state="open"] {
|
|
744
|
+
animation: ads-collapsible-down var(--duration-disclosure) var(--ease-disclosure);
|
|
745
|
+
}
|
|
746
|
+
.ads-collapsible[data-state="closed"] {
|
|
747
|
+
animation: ads-collapsible-up var(--duration-normal) var(--ease-disclosure);
|
|
748
|
+
}
|
|
749
|
+
@media (prefers-reduced-motion: reduce) {
|
|
750
|
+
.ads-collapsible[data-state="open"],
|
|
751
|
+
.ads-collapsible[data-state="closed"] {
|
|
752
|
+
animation: none;
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
/* Tree connector — the rail that links a group of children back to their
|
|
757
|
+
parent, and the L-shaped elbow that reaches an individual child.
|
|
758
|
+
|
|
759
|
+
Two classes so a rail can pass THROUGH content that is not itself a branch:
|
|
760
|
+
`.ads-tree-rail` draws the vertical only, `.ads-tree-branch` adds the elbow.
|
|
761
|
+
Mixing them keeps the rail unbroken from the parent icon while only the
|
|
762
|
+
rows that are actual children get an elbow.
|
|
763
|
+
|
|
764
|
+
- --tree-rail-lead : how far the FIRST child's rail climbs to meet the
|
|
765
|
+
parent row.
|
|
766
|
+
- --tree-elbow : where the elbow meets the child — its icon centre. */
|
|
767
|
+
.ads-tree-rail,
|
|
768
|
+
.ads-tree-branch {
|
|
769
|
+
position: relative;
|
|
770
|
+
padding-inline-start: 1.25rem;
|
|
771
|
+
}
|
|
772
|
+
.ads-tree-rail::before,
|
|
773
|
+
.ads-tree-branch::before {
|
|
774
|
+
content: "";
|
|
775
|
+
position: absolute;
|
|
776
|
+
inset-block: 0;
|
|
777
|
+
left: 0;
|
|
778
|
+
border-left: 1px solid var(--border-strong);
|
|
779
|
+
}
|
|
780
|
+
.ads-tree-rail:first-child::before,
|
|
781
|
+
.ads-tree-branch:first-child::before {
|
|
782
|
+
top: calc(-1 * var(--tree-rail-lead, 0px));
|
|
783
|
+
}
|
|
784
|
+
/* The last child needs no rail: its elbow (or the content's end) terminates
|
|
785
|
+
the branch, and a rail there pokes through the curve. */
|
|
786
|
+
.ads-tree-rail:last-child::before,
|
|
787
|
+
.ads-tree-branch:last-child::before {
|
|
788
|
+
display: none;
|
|
789
|
+
}
|
|
790
|
+
.ads-tree-branch::after {
|
|
791
|
+
content: "";
|
|
792
|
+
position: absolute;
|
|
793
|
+
left: 0;
|
|
794
|
+
top: 0;
|
|
795
|
+
height: var(--tree-elbow, 1.125rem);
|
|
796
|
+
width: 1rem;
|
|
797
|
+
border-bottom: 1px solid var(--border-strong);
|
|
798
|
+
border-left: 1px solid var(--border-strong);
|
|
799
|
+
border-bottom-left-radius: 9px;
|
|
800
|
+
}
|
|
695
801
|
/* Let the consumer's Tailwind discover the classes ADS components use. */
|
|
696
802
|
@source "./**/*.{js,mjs}";
|
package/theme.css
CHANGED
|
@@ -7,11 +7,17 @@
|
|
|
7
7
|
*/
|
|
8
8
|
@theme {
|
|
9
9
|
/* ---- Typography ----
|
|
10
|
-
One typeface
|
|
11
|
-
|
|
10
|
+
One brand typeface. Figures inside prose stay in Aribau Grotesk with
|
|
11
|
+
`tabular-nums`; only literal source code steps to the mono stack. */
|
|
12
12
|
--font-sans: "Aribau Grotesk", ui-sans-serif, system-ui, -apple-system,
|
|
13
13
|
"Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
14
14
|
|
|
15
|
+
/* Source code only (CodeBlock, inline Code). ADS ships no mono webfont —
|
|
16
|
+
this resolves to the reader's platform mono, which is what a developer
|
|
17
|
+
already reads code in. Never use it for UI copy or data. */
|
|
18
|
+
--font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
|
|
19
|
+
"Liberation Mono", "Courier New", monospace;
|
|
20
|
+
|
|
15
21
|
/* ---- Type scale ---- base = 15px (0.9375rem). Root stays 16px so the
|
|
16
22
|
spacing grid is unaffected; only text sizes are anchored to 15px. */
|
|
17
23
|
/* SIX sizes only — a deliberately small ladder (captions → display).
|
|
@@ -89,8 +95,8 @@
|
|
|
89
95
|
/* ---- Elevation ---- ONE soft token (Claude-panel style).
|
|
90
96
|
Delineate surfaces with fill color first; add this to gently lift them. */
|
|
91
97
|
--shadow-elevation: 0 0 0 1px rgb(10 10 11 / 0.03),
|
|
92
|
-
0 1px 2px 0 rgb(10 10 11 / 0.
|
|
93
|
-
0 8px
|
|
98
|
+
0 1px 2px 0 rgb(10 10 11 / 0.04),
|
|
99
|
+
0 8px 28px -8px rgb(10 10 11 / 0.09);
|
|
94
100
|
|
|
95
101
|
/* ---- CTA inner glow ---- luminous inset highlight for primary buttons
|
|
96
102
|
(adapted from the "AI button" Figma): a crisp top-edge catch plus a soft
|
|
@@ -114,11 +120,13 @@
|
|
|
114
120
|
--ease-expo-out: cubic-bezier(0.16, 1, 0.3, 1); /* side-panel and drawer slide */
|
|
115
121
|
--ease-drawer: var(--ease-expo-out); /* backwards-compatible alias */
|
|
116
122
|
--ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1); /* playful overshoot (rare) */
|
|
123
|
+
--ease-disclosure: cubic-bezier(0.32, 0.72, 0, 1); /* height reveals — moves off the mark immediately, settles long */
|
|
117
124
|
|
|
118
125
|
/* Durations — every animation/transition timing flows from these.
|
|
119
126
|
UI animations stay under 300ms; exits run faster than enters. */
|
|
120
127
|
--duration-fast: 0.15s; /* menu / popover / tooltip enter */
|
|
121
128
|
--duration-normal: 0.2s; /* state transitions */
|
|
129
|
+
--duration-disclosure: 0.28s; /* collapsible open — travels a real distance */
|
|
122
130
|
--duration-spin: 0.8s; /* rotation loops (spinner) */
|
|
123
131
|
--duration-pulse: 1.5s; /* breathing / shimmer loops */
|
|
124
132
|
--duration-bloom: 0.9s; /* ambient reveals (chat texture bloom, curtain wipe) */
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { VoiceVisualizerColor, VoiceVisualizerDriver } from '../../hooks/agents-ui/voice-visualizer-types';
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
export interface AgentAudioVisualizerAuraProps extends Omit<React.ComponentPropsWithoutRef<"div">, "color">, VoiceVisualizerDriver {
|
|
4
|
-
/** Normalized RGB shader color. */
|
|
5
|
-
color?: VoiceVisualizerColor;
|
|
6
|
-
/** Hue variation across aura layers. */
|
|
7
|
-
colorShift?: number;
|
|
8
|
-
themeMode?: "dark" | "light";
|
|
9
|
-
}
|
|
10
|
-
/** Internal ADS port of LiveKit Agents UI's Aura visualizer. */
|
|
11
|
-
export declare const AgentAudioVisualizerAura: React.ForwardRefExoticComponent<AgentAudioVisualizerAuraProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as d } from "react/jsx-runtime";
|
|
3
|
-
import * as x from "react";
|
|
4
|
-
import { ReactShaderToy as y } from "./react-shader-toy.js";
|
|
5
|
-
import { useAgentAudioVisualizerAura as b } from "../../hooks/agents-ui/use-agent-audio-visualizer-aura.js";
|
|
6
|
-
import { cn as S } from "../../lib/cn.js";
|
|
7
|
-
const h = [0.122, 0.835, 0.976], A = `
|
|
8
|
-
const float TAU = 6.283185;
|
|
9
|
-
|
|
10
|
-
// Noise for dithering
|
|
11
|
-
vec2 randFibo(vec2 p) {
|
|
12
|
-
p = fract(p * vec2(443.897, 441.423));
|
|
13
|
-
p += dot(p, p.yx + 19.19);
|
|
14
|
-
return fract((p.xx + p.yx) * p.xy);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// Tonemap
|
|
18
|
-
vec3 Tonemap(vec3 x) {
|
|
19
|
-
x *= 4.0;
|
|
20
|
-
return x / (1.0 + x);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// Luma for alpha
|
|
24
|
-
float luma(vec3 color) {
|
|
25
|
-
return dot(color, vec3(0.299, 0.587, 0.114));
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// RGB to HSV
|
|
29
|
-
vec3 rgb2hsv(vec3 c) {
|
|
30
|
-
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
|
31
|
-
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
|
|
32
|
-
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
|
|
33
|
-
float d = q.x - min(q.w, q.y);
|
|
34
|
-
float e = 1.0e-10;
|
|
35
|
-
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// HSV to RGB
|
|
39
|
-
vec3 hsv2rgb(vec3 c) {
|
|
40
|
-
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
|
41
|
-
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
|
|
42
|
-
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// SDF shapes
|
|
46
|
-
float sdCircle(vec2 st, float r) {
|
|
47
|
-
return length(st) - r;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
float sdLine(vec2 p, float r) {
|
|
51
|
-
float halfLen = r * 2.0;
|
|
52
|
-
vec2 a = vec2(-halfLen, 0.0);
|
|
53
|
-
vec2 b = vec2(halfLen, 0.0);
|
|
54
|
-
vec2 pa = p - a;
|
|
55
|
-
vec2 ba = b - a;
|
|
56
|
-
float h = clamp(dot(pa, ba) / dot(ba, ba), 0.0, 1.0);
|
|
57
|
-
return length(pa - ba * h);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
float getSdf(vec2 st) {
|
|
61
|
-
if(uShape == 1.0) return sdCircle(st, uScale);
|
|
62
|
-
else if(uShape == 2.0) return sdLine(st, uScale);
|
|
63
|
-
return sdCircle(st, uScale); // Default
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
vec2 turb(vec2 pos, float t, float it) {
|
|
67
|
-
// Initial rotation matrix for swirl direction
|
|
68
|
-
mat2 rotation = mat2(0.6, -0.25, 0.25, 0.9);
|
|
69
|
-
// Secondary rotation applied each iteration (approx 53 degree rotation)
|
|
70
|
-
mat2 layerRotation = mat2(0.6, -0.8, 0.8, 0.6);
|
|
71
|
-
|
|
72
|
-
float frequency = mix(2.0, 15.0, uFrequency);
|
|
73
|
-
float amplitude = uAmplitude;
|
|
74
|
-
float frequencyGrowth = 1.4;
|
|
75
|
-
float animTime = t * 0.1 * uSpeed;
|
|
76
|
-
|
|
77
|
-
const int LAYERS = 4;
|
|
78
|
-
for(int i = 0; i < LAYERS; i++) {
|
|
79
|
-
// Calculate wave displacement for this layer
|
|
80
|
-
vec2 rotatedPos = pos * rotation;
|
|
81
|
-
vec2 wave = sin(frequency * rotatedPos + float(i) * animTime + it);
|
|
82
|
-
|
|
83
|
-
// Apply displacement along rotation direction
|
|
84
|
-
pos += (amplitude / frequency) * rotation[0] * wave;
|
|
85
|
-
|
|
86
|
-
// Evolve parameters for next layer
|
|
87
|
-
rotation *= layerRotation;
|
|
88
|
-
amplitude *= mix(1.0, max(wave.x, wave.y), uVariance);
|
|
89
|
-
frequency *= frequencyGrowth;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return pos;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
const float ITERATIONS = 36.0;
|
|
96
|
-
|
|
97
|
-
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
|
|
98
|
-
vec2 uv = fragCoord / iResolution.xy;
|
|
99
|
-
|
|
100
|
-
vec3 pp = vec3(0.0);
|
|
101
|
-
vec3 bloom = vec3(0.0);
|
|
102
|
-
float t = iTime * 0.5;
|
|
103
|
-
vec2 pos = uv - 0.5;
|
|
104
|
-
|
|
105
|
-
vec2 prevPos = turb(pos, t, 0.0 - 1.0 / ITERATIONS);
|
|
106
|
-
float spacing = mix(1.0, TAU, uSpacing);
|
|
107
|
-
|
|
108
|
-
for(float i = 1.0; i < ITERATIONS + 1.0; i++) {
|
|
109
|
-
float iter = i / ITERATIONS;
|
|
110
|
-
vec2 st = turb(pos, t, iter * spacing);
|
|
111
|
-
float d = abs(getSdf(st));
|
|
112
|
-
float pd = distance(st, prevPos);
|
|
113
|
-
prevPos = st;
|
|
114
|
-
float dynamicBlur = exp2(pd * 2.0 * 1.4426950408889634) - 1.0;
|
|
115
|
-
float ds = smoothstep(0.0, uBlur * 0.05 + max(dynamicBlur * uSmoothing, 0.001), d);
|
|
116
|
-
|
|
117
|
-
// Shift color based on iteration using uColorScale
|
|
118
|
-
vec3 color = uColor;
|
|
119
|
-
if(uColorShift > 0.01) {
|
|
120
|
-
vec3 hsv = rgb2hsv(color);
|
|
121
|
-
// Shift hue by iteration
|
|
122
|
-
hsv.x = fract(hsv.x + (1.0 - iter) * uColorShift * 0.3);
|
|
123
|
-
color = hsv2rgb(hsv);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
float invd = 1.0 / max(d + dynamicBlur, 0.001);
|
|
127
|
-
pp += (ds - 1.0) * color;
|
|
128
|
-
bloom += clamp(invd, 0.0, 250.0) * color;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
pp *= 1.0 / ITERATIONS;
|
|
132
|
-
|
|
133
|
-
vec3 color;
|
|
134
|
-
|
|
135
|
-
// Dark mode (default)
|
|
136
|
-
if(uMode < 0.5) {
|
|
137
|
-
// use bloom effect
|
|
138
|
-
bloom = bloom / (bloom + 2e4);
|
|
139
|
-
color = (-pp + bloom * 3.0 * uBloom) * 1.2;
|
|
140
|
-
color += (randFibo(fragCoord).x - 0.5) / 255.0;
|
|
141
|
-
color = Tonemap(color);
|
|
142
|
-
float alpha = luma(color) * uMix;
|
|
143
|
-
fragColor = vec4(color * uMix, alpha);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// Light mode
|
|
147
|
-
else {
|
|
148
|
-
// no bloom effect
|
|
149
|
-
color = -pp;
|
|
150
|
-
color += (randFibo(fragCoord).x - 0.5) / 255.0;
|
|
151
|
-
|
|
152
|
-
// Preserve hue by tone mapping brightness only
|
|
153
|
-
float brightness = length(color);
|
|
154
|
-
vec3 direction = brightness > 0.0 ? color / brightness : color;
|
|
155
|
-
|
|
156
|
-
// Reinhard on brightness
|
|
157
|
-
float factor = 2.0;
|
|
158
|
-
float mappedBrightness = (brightness * factor) / (1.0 + brightness * factor);
|
|
159
|
-
color = direction * mappedBrightness;
|
|
160
|
-
|
|
161
|
-
// Boost saturation to compensate for white background bleed-through
|
|
162
|
-
// When alpha < 1.0, white bleeds through making colors look desaturated
|
|
163
|
-
// So we increase saturation to maintain vibrant appearance
|
|
164
|
-
float gray = dot(color, vec3(0.2, 0.5, 0.1));
|
|
165
|
-
float saturationBoost = 3.0;
|
|
166
|
-
color = mix(vec3(gray), color, saturationBoost);
|
|
167
|
-
|
|
168
|
-
// Clamp between 0-1
|
|
169
|
-
color = clamp(color, 0.0, 1.0);
|
|
170
|
-
|
|
171
|
-
float alpha = mappedBrightness * clamp(uMix, 1.0, 2.0);
|
|
172
|
-
fragColor = vec4(color, alpha);
|
|
173
|
-
}
|
|
174
|
-
}`;
|
|
175
|
-
function g({
|
|
176
|
-
shape: m = 1,
|
|
177
|
-
speed: e = 1,
|
|
178
|
-
amplitude: t = 0.5,
|
|
179
|
-
frequency: a = 0.5,
|
|
180
|
-
scale: r = 0.2,
|
|
181
|
-
blur: l = 1,
|
|
182
|
-
color: i = h,
|
|
183
|
-
colorShift: c = 1,
|
|
184
|
-
brightness: n = 1,
|
|
185
|
-
themeMode: u = "light",
|
|
186
|
-
reduced: s = !1,
|
|
187
|
-
ref: p,
|
|
188
|
-
className: f,
|
|
189
|
-
...v
|
|
190
|
-
}) {
|
|
191
|
-
return /* @__PURE__ */ d("div", { ref: p, className: f, ...v, children: /* @__PURE__ */ d(
|
|
192
|
-
y,
|
|
193
|
-
{
|
|
194
|
-
fs: A,
|
|
195
|
-
className: "size-full",
|
|
196
|
-
devicePixelRatio: 1,
|
|
197
|
-
paused: s || e === 0,
|
|
198
|
-
uniforms: {
|
|
199
|
-
// Aurora wave speed
|
|
200
|
-
uSpeed: { type: "1f", value: e },
|
|
201
|
-
// Edge blur/softness
|
|
202
|
-
uBlur: { type: "1f", value: l },
|
|
203
|
-
// Shape scale
|
|
204
|
-
uScale: { type: "1f", value: r },
|
|
205
|
-
// Shape type: 1=circle, 2=line
|
|
206
|
-
uShape: { type: "1f", value: m },
|
|
207
|
-
// Wave frequency and complexity
|
|
208
|
-
uFrequency: { type: "1f", value: a },
|
|
209
|
-
// Turbulence amplitude
|
|
210
|
-
uAmplitude: { type: "1f", value: t },
|
|
211
|
-
// Light intensity (bloom)
|
|
212
|
-
uBloom: { type: "1f", value: 0 },
|
|
213
|
-
// Brightness of the aurora (0-1)
|
|
214
|
-
uMix: { type: "1f", value: n },
|
|
215
|
-
// Color variation across layers (0-1)
|
|
216
|
-
uSpacing: { type: "1f", value: 0.5 },
|
|
217
|
-
// Color palette offset - shifts colors along the gradient (0-1)
|
|
218
|
-
uColorShift: { type: "1f", value: c },
|
|
219
|
-
// Color variation across layers (0-1)
|
|
220
|
-
uVariance: { type: "1f", value: 0.1 },
|
|
221
|
-
// Smoothing of the aurora (0-1)
|
|
222
|
-
uSmoothing: { type: "1f", value: 1 },
|
|
223
|
-
// Display mode: 0=dark background, 1=light background
|
|
224
|
-
uMode: { type: "1f", value: u === "light" ? 1 : 0 },
|
|
225
|
-
// Color
|
|
226
|
-
uColor: { type: "3fv", value: i }
|
|
227
|
-
},
|
|
228
|
-
onError: (o) => {
|
|
229
|
-
console.error("Shader error:", o);
|
|
230
|
-
},
|
|
231
|
-
onWarning: (o) => {
|
|
232
|
-
console.warn("Shader warning:", o);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
) });
|
|
236
|
-
}
|
|
237
|
-
g.displayName = "AuraShader";
|
|
238
|
-
const w = x.forwardRef(function({
|
|
239
|
-
state: e = "idle",
|
|
240
|
-
volume: t = 0,
|
|
241
|
-
reduced: a = !1,
|
|
242
|
-
color: r = h,
|
|
243
|
-
colorShift: l = 0.05,
|
|
244
|
-
themeMode: i = "light",
|
|
245
|
-
className: c,
|
|
246
|
-
...n
|
|
247
|
-
}, u) {
|
|
248
|
-
const { speed: s, scale: p, amplitude: f, frequency: v, brightness: o } = b({
|
|
249
|
-
state: e,
|
|
250
|
-
volume: t,
|
|
251
|
-
reduced: a
|
|
252
|
-
});
|
|
253
|
-
return /* @__PURE__ */ d(
|
|
254
|
-
g,
|
|
255
|
-
{
|
|
256
|
-
ref: u,
|
|
257
|
-
"aria-hidden": !0,
|
|
258
|
-
"data-state": e,
|
|
259
|
-
blur: 0.2,
|
|
260
|
-
color: r,
|
|
261
|
-
colorShift: l,
|
|
262
|
-
speed: s,
|
|
263
|
-
scale: p,
|
|
264
|
-
themeMode: i,
|
|
265
|
-
amplitude: f,
|
|
266
|
-
frequency: v,
|
|
267
|
-
brightness: o,
|
|
268
|
-
reduced: a,
|
|
269
|
-
className: S("size-full", c),
|
|
270
|
-
...n
|
|
271
|
-
}
|
|
272
|
-
);
|
|
273
|
-
});
|
|
274
|
-
w.displayName = "AgentAudioVisualizerAura";
|
|
275
|
-
export {
|
|
276
|
-
w as AgentAudioVisualizerAura
|
|
277
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { VoiceVisualizerColor, VoiceVisualizerDriver } from '../../hooks/agents-ui/voice-visualizer-types';
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
export interface AgentAudioVisualizerWaveProps extends Omit<React.ComponentPropsWithoutRef<"div">, "color">, VoiceVisualizerDriver {
|
|
4
|
-
/** Normalized RGB shader color. */
|
|
5
|
-
color?: VoiceVisualizerColor;
|
|
6
|
-
/** Hue variation toward the outside of the wave. */
|
|
7
|
-
colorShift?: number;
|
|
8
|
-
lineWidth?: number;
|
|
9
|
-
blur?: number;
|
|
10
|
-
}
|
|
11
|
-
/** Internal ADS port of LiveKit Agents UI's Wave visualizer. */
|
|
12
|
-
export declare const AgentAudioVisualizerWave: React.ForwardRefExoticComponent<AgentAudioVisualizerWaveProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as v } from "react/jsx-runtime";
|
|
3
|
-
import * as g from "react";
|
|
4
|
-
import { ReactShaderToy as y } from "./react-shader-toy.js";
|
|
5
|
-
import { useAgentAudioVisualizerWave as w } from "../../hooks/agents-ui/use-agent-audio-visualizer-wave.js";
|
|
6
|
-
import { cn as b } from "../../lib/cn.js";
|
|
7
|
-
const p = [0.122, 0.835, 0.976], S = `
|
|
8
|
-
const float TAU = 6.28318530718;
|
|
9
|
-
|
|
10
|
-
// Noise for dithering
|
|
11
|
-
vec2 randFibo(vec2 p) {
|
|
12
|
-
p = fract(p * vec2(443.897, 441.423));
|
|
13
|
-
p += dot(p, p.yx + 19.19);
|
|
14
|
-
return fract((p.xx + p.yx) * p.xy);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// Luma for alpha
|
|
18
|
-
float luma(vec3 color) {
|
|
19
|
-
return dot(color, vec3(0.299, 0.587, 0.114));
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// RGB to HSV
|
|
23
|
-
vec3 rgb2hsv(vec3 c) {
|
|
24
|
-
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
|
25
|
-
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
|
|
26
|
-
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
|
|
27
|
-
float d = q.x - min(q.w, q.y);
|
|
28
|
-
float e = 1.0e-10;
|
|
29
|
-
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// HSV to RGB
|
|
33
|
-
vec3 hsv2rgb(vec3 c) {
|
|
34
|
-
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
|
35
|
-
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
|
|
36
|
-
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Bell curve function for attenuation from center with rounded top
|
|
40
|
-
float bellCurve(float distanceFromCenter, float maxDistance) {
|
|
41
|
-
float normalizedDistance = distanceFromCenter / maxDistance;
|
|
42
|
-
// Use cosine with high power for smooth rounded top
|
|
43
|
-
return pow(cos(normalizedDistance * (3.14159265359 / 4.0)), 16.0);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Calculate the sine wave
|
|
47
|
-
float oscilloscopeWave(float x, float centerX, float time) {
|
|
48
|
-
float relativeX = x - centerX;
|
|
49
|
-
float maxDistance = centerX;
|
|
50
|
-
float distanceFromCenter = abs(relativeX);
|
|
51
|
-
|
|
52
|
-
// Apply bell curve for amplitude attenuation
|
|
53
|
-
float bell = bellCurve(distanceFromCenter, maxDistance);
|
|
54
|
-
|
|
55
|
-
// Calculate wave with uniforms and bell curve attenuation
|
|
56
|
-
float wave = sin(relativeX * uFrequency + time * uSpeed) * uAmplitude * bell;
|
|
57
|
-
|
|
58
|
-
return wave;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
|
|
62
|
-
vec2 uv = fragCoord / iResolution.xy;
|
|
63
|
-
vec2 pos = uv - 0.5;
|
|
64
|
-
|
|
65
|
-
// Calculate center and positions
|
|
66
|
-
float centerX = 0.5;
|
|
67
|
-
float centerY = 0.5;
|
|
68
|
-
float x = uv.x;
|
|
69
|
-
float y = uv.y;
|
|
70
|
-
|
|
71
|
-
// Convert line width from pixels to UV space
|
|
72
|
-
// Use the average of width and height to handle aspect ratio
|
|
73
|
-
float pixelSize = 2.0 / (iResolution.x + iResolution.y);
|
|
74
|
-
float lineWidthUV = uLineWidth * pixelSize;
|
|
75
|
-
float smoothingUV = uSmoothing * pixelSize;
|
|
76
|
-
|
|
77
|
-
// Find minimum distance to the wave by sampling nearby points
|
|
78
|
-
// This gives us consistent line width without high-frequency artifacts
|
|
79
|
-
const int NUM_SAMPLES = 50; // Must be const for GLSL loop
|
|
80
|
-
float minDist = 1000.0;
|
|
81
|
-
float sampleRange = 0.02; // Range to search for closest point
|
|
82
|
-
|
|
83
|
-
for(int i = 0; i < NUM_SAMPLES; i++) {
|
|
84
|
-
float offset = (float(i) / float(NUM_SAMPLES - 1) - 0.5) * sampleRange;
|
|
85
|
-
float sampleX = x + offset;
|
|
86
|
-
float waveY = centerY + oscilloscopeWave(sampleX, centerX, iTime);
|
|
87
|
-
|
|
88
|
-
// Calculate distance from current pixel to this point on the wave
|
|
89
|
-
vec2 wavePoint = vec2(sampleX, waveY);
|
|
90
|
-
vec2 currentPoint = vec2(x, y);
|
|
91
|
-
float dist = distance(currentPoint, wavePoint);
|
|
92
|
-
|
|
93
|
-
minDist = min(minDist, dist);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// Solid line with smooth edges using minimum distance
|
|
97
|
-
float line = smoothstep(lineWidthUV + smoothingUV, lineWidthUV - smoothingUV, minDist);
|
|
98
|
-
|
|
99
|
-
vec3 color = uColor;
|
|
100
|
-
if(abs(uColorShift) > 0.01) {
|
|
101
|
-
// Keep the center 50% at base color, then ramp shift across outer 25% on each side.
|
|
102
|
-
float centerBandHalfWidth = 0.2;
|
|
103
|
-
float edgeBandWidth = 0.5;
|
|
104
|
-
float distanceFromCenter = abs(x - centerX);
|
|
105
|
-
float edgeFactor = clamp((distanceFromCenter - centerBandHalfWidth) / edgeBandWidth, 0.0, 1.0);
|
|
106
|
-
vec3 hsv = rgb2hsv(color);
|
|
107
|
-
// Hue shift is zero in the center band and strongest at far edges.
|
|
108
|
-
hsv.x = fract(hsv.x + edgeFactor * uColorShift * 0.3);
|
|
109
|
-
color = hsv2rgb(hsv);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// Apply line intensity
|
|
113
|
-
color *= line;
|
|
114
|
-
|
|
115
|
-
// Add dithering for smoother gradients
|
|
116
|
-
// color += (randFibo(fragCoord).x - 0.5) / 255.0;
|
|
117
|
-
|
|
118
|
-
// Calculate alpha based on line intensity
|
|
119
|
-
float alpha = line * uMix;
|
|
120
|
-
|
|
121
|
-
fragColor = vec4(color * uMix, alpha);
|
|
122
|
-
}`;
|
|
123
|
-
function m({
|
|
124
|
-
speed: a = 10,
|
|
125
|
-
color: t = p,
|
|
126
|
-
colorShift: i = 0.05,
|
|
127
|
-
mix: o = 1,
|
|
128
|
-
amplitude: n = 0.02,
|
|
129
|
-
frequency: r = 20,
|
|
130
|
-
lineWidth: l = 2,
|
|
131
|
-
blur: c = 0.5,
|
|
132
|
-
reduced: s = !1,
|
|
133
|
-
ref: f,
|
|
134
|
-
className: u,
|
|
135
|
-
...d
|
|
136
|
-
}) {
|
|
137
|
-
return /* @__PURE__ */ v("div", { ref: f, className: u, ...d, children: /* @__PURE__ */ v(
|
|
138
|
-
y,
|
|
139
|
-
{
|
|
140
|
-
fs: S,
|
|
141
|
-
className: "size-full",
|
|
142
|
-
devicePixelRatio: 1,
|
|
143
|
-
paused: s || a === 0,
|
|
144
|
-
uniforms: {
|
|
145
|
-
uSpeed: { type: "1f", value: a },
|
|
146
|
-
uAmplitude: { type: "1f", value: n },
|
|
147
|
-
uFrequency: { type: "1f", value: r },
|
|
148
|
-
uMix: { type: "1f", value: o },
|
|
149
|
-
uLineWidth: { type: "1f", value: l },
|
|
150
|
-
uSmoothing: { type: "1f", value: c },
|
|
151
|
-
uColor: { type: "3fv", value: t },
|
|
152
|
-
uColorShift: { type: "1f", value: i }
|
|
153
|
-
},
|
|
154
|
-
onError: (e) => {
|
|
155
|
-
console.error("Shader error:", e);
|
|
156
|
-
},
|
|
157
|
-
onWarning: (e) => {
|
|
158
|
-
console.warn("Shader warning:", e);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
) });
|
|
162
|
-
}
|
|
163
|
-
m.displayName = "WaveShader";
|
|
164
|
-
const C = g.forwardRef(function({
|
|
165
|
-
state: t = "idle",
|
|
166
|
-
volume: i = 0,
|
|
167
|
-
reduced: o = !1,
|
|
168
|
-
color: n = p,
|
|
169
|
-
colorShift: r = 0.05,
|
|
170
|
-
lineWidth: l = 1.5,
|
|
171
|
-
blur: c = 0.5,
|
|
172
|
-
className: s,
|
|
173
|
-
...f
|
|
174
|
-
}, u) {
|
|
175
|
-
const { speed: d, amplitude: e, frequency: h, opacity: x } = w({
|
|
176
|
-
state: t,
|
|
177
|
-
volume: i,
|
|
178
|
-
reduced: o
|
|
179
|
-
});
|
|
180
|
-
return /* @__PURE__ */ v(
|
|
181
|
-
m,
|
|
182
|
-
{
|
|
183
|
-
ref: u,
|
|
184
|
-
"aria-hidden": !0,
|
|
185
|
-
"data-state": t,
|
|
186
|
-
speed: d,
|
|
187
|
-
color: n,
|
|
188
|
-
colorShift: r,
|
|
189
|
-
mix: x,
|
|
190
|
-
amplitude: e,
|
|
191
|
-
frequency: h,
|
|
192
|
-
lineWidth: l,
|
|
193
|
-
blur: c,
|
|
194
|
-
reduced: o,
|
|
195
|
-
className: b("size-full", s),
|
|
196
|
-
...f
|
|
197
|
-
}
|
|
198
|
-
);
|
|
199
|
-
});
|
|
200
|
-
C.displayName = "AgentAudioVisualizerWave";
|
|
201
|
-
export {
|
|
202
|
-
C as AgentAudioVisualizerWave
|
|
203
|
-
};
|