@actioneer/ads 0.2.3 → 0.3.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/chain-of-thought.d.ts +88 -19
- package/components/ai-elements/chain-of-thought.js +358 -149
- package/components/ai-elements/chart.d.ts +30 -0
- package/components/ai-elements/chart.js +303 -0
- package/components/ai-elements/index.d.ts +2 -1
- package/components/ai-elements/message.d.ts +19 -4
- package/components/ai-elements/message.js +177 -130
- package/components/ai-elements/research-activity.d.ts +45 -0
- package/components/ai-elements/research-activity.js +260 -0
- package/components/ai-elements/task-progress.js +69 -66
- package/components/ai-elements/tool.js +42 -38
- package/components/answer.d.ts +19 -0
- package/components/answer.js +363 -300
- package/components/assistant-ui/attachment.js +5 -1
- package/components/assistant-ui/composer-deep-research.js +44 -29
- package/components/assistant-ui/composer-harness.js +55 -38
- package/components/assistant-ui/composer.js +16 -16
- package/components/assistant-ui/index.d.ts +0 -1
- package/components/assistant-ui/message.d.ts +7 -0
- package/components/assistant-ui/message.js +64 -51
- package/components/assistant-ui/primitives.d.ts +1 -1
- package/components/assistant-ui/thread-context.d.ts +2 -0
- package/components/assistant-ui/thread.js +34 -32
- package/components/brand-texture.d.ts +37 -0
- package/components/brand-texture.js +54 -0
- package/components/chart.d.ts +64 -2
- package/components/chart.js +717 -456
- package/components/code-block.d.ts +36 -0
- package/components/code-block.js +136 -0
- package/components/command-palette.d.ts +43 -0
- package/components/command-palette.js +146 -0
- package/components/drawer.d.ts +1 -1
- package/components/file-dropzone.d.ts +32 -0
- package/components/file-dropzone.js +134 -0
- package/components/index.d.ts +11 -0
- package/components/index.js +480 -430
- package/components/infinite-canvas.d.ts +50 -0
- package/components/infinite-canvas.js +215 -0
- package/components/page-header.d.ts +22 -0
- package/components/page-header.js +52 -0
- package/components/resizable-panel.d.ts +29 -0
- package/components/resizable-panel.js +102 -0
- package/components/reveal.d.ts +36 -0
- package/components/reveal.js +35 -0
- package/components/scroll-area.d.ts +19 -0
- package/components/scroll-area.js +57 -0
- package/components/setting-row.d.ts +35 -0
- package/components/setting-row.js +86 -0
- package/components/sidebar.d.ts +4 -1
- package/components/sidebar.js +134 -132
- package/components/stepper.d.ts +32 -0
- package/components/stepper.js +113 -0
- package/components/table.js +16 -15
- package/components/tabs.js +1 -1
- package/hooks/agents-ui/voice-visualizer-types.js +1 -0
- package/lib/icons.d.ts +24 -0
- package/lib/icons.js +100 -110
- package/lib/motion.d.ts +5 -3
- package/lib/motion.js +46 -20
- package/lib/router.js +19 -0
- package/lib/utils.js +5 -0
- package/llms.txt +143 -39
- package/manifest.json +1232 -100
- package/package.json +2 -2
- package/styles.css +71 -28
- package/theme.css +19 -15
- package/components/ai-elements/reasoning.d.ts +0 -26
- package/components/ai-elements/reasoning.js +0 -131
- package/components/assistant-ui/smart-message-text.d.ts +0 -15
- package/components/assistant-ui/smart-message-text.js +0 -29
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@actioneer/ads",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Actioneer Design System 1.0 — React 19 + Tailwind v4 component library.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"@assistant-ui/react-markdown": "^0.14.5",
|
|
39
39
|
"@hugeicons/core-free-icons": "^4.2.2",
|
|
40
40
|
"@hugeicons/react": "^1.1.9",
|
|
41
|
-
"@openuidev/react-lang": "^0.2.8",
|
|
42
41
|
"@paper-design/shaders": "^0.0.77",
|
|
43
42
|
"@paper-design/shaders-react": "^0.0.77",
|
|
43
|
+
"@xyflow/react": "^12.11.2",
|
|
44
44
|
"class-variance-authority": "^0.7.1",
|
|
45
45
|
"clsx": "^2.1.1",
|
|
46
46
|
"motion": "^12.42.2",
|
package/styles.css
CHANGED
|
@@ -39,23 +39,23 @@
|
|
|
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
|
-
/* ---- Type scale ---- base =
|
|
43
|
-
spacing grid is unaffected; only text sizes are anchored to
|
|
42
|
+
/* ---- Type scale ---- base = 15px (0.9375rem). Root stays 16px so the
|
|
43
|
+
spacing grid is unaffected; only text sizes are anchored to 15px. */
|
|
44
44
|
/* SIX sizes only — a deliberately small ladder (captions → display).
|
|
45
45
|
Don't reintroduce 2xs/3xl/4xl or in-between steps; if a size feels
|
|
46
46
|
missing, the answer is weight/color, not a new size. */
|
|
47
|
-
--text-xs: 0.
|
|
48
|
-
--text-xs--line-height:
|
|
49
|
-
/* text-sm is aliased to text-xs (both
|
|
50
|
-
|
|
51
|
-
pointed at
|
|
52
|
-
Tailwind's default 14px, which would
|
|
53
|
-
--text-sm: 0.
|
|
54
|
-
--text-sm--line-height:
|
|
55
|
-
--text-base: 0.
|
|
56
|
-
--text-base--line-height: 1.
|
|
57
|
-
--text-lg:
|
|
58
|
-
--text-lg--line-height: 1.
|
|
47
|
+
--text-xs: 0.8125rem; /* 13px — the FLOOR: captions, secondary text, table cells, keycaps */
|
|
48
|
+
--text-xs--line-height: 1.125rem;
|
|
49
|
+
/* text-sm is aliased to text-xs (both 13px). The scale is intentionally
|
|
50
|
+
13 · 15 · 17 · 21 · 26 with no in-between tier — keeping the token
|
|
51
|
+
pointed at 13px stops any stray `text-sm` from falling back to
|
|
52
|
+
Tailwind's default 14px, which would land off the scale. */
|
|
53
|
+
--text-sm: 0.8125rem;
|
|
54
|
+
--text-sm--line-height: 1.125rem;
|
|
55
|
+
--text-base: 0.9375rem; /* 15px — BASE body */
|
|
56
|
+
--text-base--line-height: 1.375rem;
|
|
57
|
+
--text-lg: 1.0625rem; /* 17px — emphasized body, section headings */
|
|
58
|
+
--text-lg--line-height: 1.5rem;
|
|
59
59
|
--text-xl: 1.3125rem; /* 21px — page titles */
|
|
60
60
|
--text-xl--line-height: 1.75rem;
|
|
61
61
|
--text-2xl: 1.625rem; /* 26px — display */
|
|
@@ -138,7 +138,8 @@
|
|
|
138
138
|
to these system-wide. JS mirror: src/lib/motion.ts — keep in sync. */
|
|
139
139
|
--ease-out: cubic-bezier(0.23, 1, 0.32, 1); /* entrances, exits, presses */
|
|
140
140
|
--ease-in-out: cubic-bezier(0.77, 0, 0.175, 1); /* on-screen movement / morphs */
|
|
141
|
-
--ease-
|
|
141
|
+
--ease-expo-out: cubic-bezier(0.16, 1, 0.3, 1); /* side-panel and drawer slide */
|
|
142
|
+
--ease-drawer: var(--ease-expo-out); /* backwards-compatible alias */
|
|
142
143
|
--ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1); /* playful overshoot (rare) */
|
|
143
144
|
|
|
144
145
|
/* Durations — every animation/transition timing flows from these.
|
|
@@ -166,6 +167,8 @@
|
|
|
166
167
|
--sidebar-item: 2rem; /* 32px — collapsed rail hit target (square) */
|
|
167
168
|
--sidebar-logo: 1.25rem; /* 20px — brand mark, centered in a --sidebar-item square */
|
|
168
169
|
--sidebar-text-indent: 2.375rem; /* px-3 + icon size-4 + gap-2.5 — history rows align to nav-item text */
|
|
170
|
+
--sidebar-navigation-text-size: 0.8125rem; /* 13px — sidebar actions, items, history, and account text */
|
|
171
|
+
--sidebar-section-label-size: 0.8125rem; /* 13px — section and history labels */
|
|
169
172
|
--panel-header-height: 2.75rem; /* 44px — Panel / toolbar header */
|
|
170
173
|
--aside-width: 20rem; /* 320px — right-hand panel column */
|
|
171
174
|
|
|
@@ -180,6 +183,7 @@
|
|
|
180
183
|
--composer-bg: color-mix(in oklab, var(--muted) 30%, var(--background));
|
|
181
184
|
--composer-radius: var(--radius-2xl);
|
|
182
185
|
--composer-padding: 0.5rem;
|
|
186
|
+
--composer-placeholder-max-h: calc(var(--text-base--line-height) * 2); /* rotating placeholder clamp — two lines of the input's own rhythm, so it can never overlap the accessory row */
|
|
183
187
|
--chat-texture-opacity: 0.06; /* welcome-state halftone wash */
|
|
184
188
|
}
|
|
185
189
|
|
|
@@ -313,10 +317,11 @@
|
|
|
313
317
|
display: none;
|
|
314
318
|
}
|
|
315
319
|
|
|
316
|
-
/*
|
|
317
|
-
the centre out to the corners (clip-path circle)
|
|
318
|
-
rest. `from{}`-only keyframe, so it settles into
|
|
319
|
-
|
|
320
|
+
/* BrandTexture entrance (src/components/brand-texture.tsx): a radial bloom —
|
|
321
|
+
the halftone reveals from the centre out to the corners (clip-path circle)
|
|
322
|
+
while gently scaling up to rest. `from{}`-only keyframe, so it settles into
|
|
323
|
+
the element's own opacity. */
|
|
324
|
+
@keyframes ads-texture-reveal {
|
|
320
325
|
from {
|
|
321
326
|
clip-path: circle(10% at 50% 50%);
|
|
322
327
|
opacity: 0;
|
|
@@ -326,8 +331,8 @@
|
|
|
326
331
|
clip-path: circle(102% at 50% 50%);
|
|
327
332
|
}
|
|
328
333
|
}
|
|
329
|
-
.
|
|
330
|
-
animation:
|
|
334
|
+
.ads-texture-reveal {
|
|
335
|
+
animation: ads-texture-reveal var(--duration-bloom) var(--ease-out) both;
|
|
331
336
|
}
|
|
332
337
|
|
|
333
338
|
/* Paper's WebGL shader owns the halftone animation. The canvas is bounded to
|
|
@@ -371,7 +376,7 @@
|
|
|
371
376
|
animation-direction: reverse;
|
|
372
377
|
}
|
|
373
378
|
@media (prefers-reduced-motion: reduce) {
|
|
374
|
-
.
|
|
379
|
+
.ads-texture-reveal {
|
|
375
380
|
animation: none;
|
|
376
381
|
}
|
|
377
382
|
.voice-surface-drift {
|
|
@@ -379,13 +384,13 @@
|
|
|
379
384
|
}
|
|
380
385
|
}
|
|
381
386
|
|
|
382
|
-
/*
|
|
387
|
+
/* BrandTexture exit — cloud lift. When the conversation starts the
|
|
383
388
|
halftone dissolves from the BOTTOM upward (a soft mask band sweeps up
|
|
384
389
|
through it) while the whole layer drifts up and fades — cloud cover
|
|
385
390
|
breaking and rising, not a curtain covering it. The mask rests fully
|
|
386
391
|
opaque (element aligned with the black end of an oversized gradient), and
|
|
387
392
|
the lifted state slides the element to the transparent end. */
|
|
388
|
-
.
|
|
393
|
+
.ads-texture-lift {
|
|
389
394
|
mask-image: linear-gradient(to top, transparent 0%, transparent 42%, black 58%, black 100%);
|
|
390
395
|
-webkit-mask-image: linear-gradient(to top, transparent 0%, transparent 42%, black 58%, black 100%);
|
|
391
396
|
mask-repeat: no-repeat;
|
|
@@ -400,16 +405,16 @@
|
|
|
400
405
|
translate 1s var(--ease-out),
|
|
401
406
|
opacity 1s var(--ease-out);
|
|
402
407
|
}
|
|
403
|
-
.
|
|
408
|
+
.ads-texture-lifted {
|
|
404
409
|
mask-position: 0% 100%;
|
|
405
410
|
-webkit-mask-position: 0% 100%;
|
|
406
411
|
translate: 0 -3.5rem;
|
|
407
412
|
}
|
|
408
413
|
@media (prefers-reduced-motion: reduce) {
|
|
409
|
-
.
|
|
414
|
+
.ads-texture-lift {
|
|
410
415
|
transition: opacity var(--duration-normal) var(--ease-out);
|
|
411
416
|
}
|
|
412
|
-
.
|
|
417
|
+
.ads-texture-lifted {
|
|
413
418
|
mask-position: 0% 0%;
|
|
414
419
|
-webkit-mask-position: 0% 0%;
|
|
415
420
|
translate: none;
|
|
@@ -470,7 +475,7 @@
|
|
|
470
475
|
background-color: var(--background);
|
|
471
476
|
color: var(--foreground);
|
|
472
477
|
font-family: var(--font-sans);
|
|
473
|
-
font-size: var(--text-base); /*
|
|
478
|
+
font-size: var(--text-base); /* 15px base */
|
|
474
479
|
font-feature-settings: "cv01", "ss01";
|
|
475
480
|
font-synthesis-weight: none;
|
|
476
481
|
}
|
|
@@ -533,6 +538,44 @@
|
|
|
533
538
|
@keyframes ads-shimmer {
|
|
534
539
|
100% { transform: translateX(100%); }
|
|
535
540
|
}
|
|
541
|
+
|
|
542
|
+
/* Reveal — the "data draws itself" entrance (src/components/reveal.tsx).
|
|
543
|
+
The real layout lands instantly; content arrives in hierarchy — shells
|
|
544
|
+
rise, labels/values ink in, visualizations wipe left→right — each slot
|
|
545
|
+
delayed by --reveal-order × --reveal-step. The wipe runs longer than UI
|
|
546
|
+
chrome on purpose: data drawing is explanatory motion, not chrome. */
|
|
547
|
+
@keyframes ads-reveal-ink {
|
|
548
|
+
from { opacity: 0; filter: blur(4px); }
|
|
549
|
+
to { opacity: 1; filter: blur(0); }
|
|
550
|
+
}
|
|
551
|
+
@keyframes ads-reveal-rise {
|
|
552
|
+
from { opacity: 0; transform: translate3d(0, 8px, 0); }
|
|
553
|
+
to { opacity: 1; transform: translate3d(0, 0, 0); }
|
|
554
|
+
}
|
|
555
|
+
@keyframes ads-reveal-wipe {
|
|
556
|
+
from { clip-path: inset(0 100% 0 0); }
|
|
557
|
+
to { clip-path: inset(0 0 0 0); }
|
|
558
|
+
}
|
|
559
|
+
@keyframes ads-reveal-fade {
|
|
560
|
+
from { opacity: 0; }
|
|
561
|
+
to { opacity: 1; }
|
|
562
|
+
}
|
|
563
|
+
.ads-reveal {
|
|
564
|
+
animation: ads-reveal-rise var(--reveal-duration, 0.45s) var(--ease-out) both;
|
|
565
|
+
animation-delay: calc(var(--reveal-step, 70ms) * var(--reveal-order, 0));
|
|
566
|
+
}
|
|
567
|
+
.ads-reveal-ink { animation-name: ads-reveal-ink; }
|
|
568
|
+
.ads-reveal-wipe {
|
|
569
|
+
animation-name: ads-reveal-wipe;
|
|
570
|
+
animation-duration: var(--reveal-duration-draw, 0.9s);
|
|
571
|
+
}
|
|
572
|
+
@media (prefers-reduced-motion: reduce) {
|
|
573
|
+
.ads-reveal,
|
|
574
|
+
.ads-reveal-ink,
|
|
575
|
+
.ads-reveal-wipe {
|
|
576
|
+
animation-name: ads-reveal-fade;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
536
579
|
@keyframes ads-indeterminate {
|
|
537
580
|
0% { transform: translate3d(-100%, 0, 0); }
|
|
538
581
|
60%, 100% { transform: translate3d(250%, 0, 0); }
|
package/theme.css
CHANGED
|
@@ -12,23 +12,23 @@
|
|
|
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
|
-
/* ---- Type scale ---- base =
|
|
16
|
-
spacing grid is unaffected; only text sizes are anchored to
|
|
15
|
+
/* ---- Type scale ---- base = 15px (0.9375rem). Root stays 16px so the
|
|
16
|
+
spacing grid is unaffected; only text sizes are anchored to 15px. */
|
|
17
17
|
/* SIX sizes only — a deliberately small ladder (captions → display).
|
|
18
18
|
Don't reintroduce 2xs/3xl/4xl or in-between steps; if a size feels
|
|
19
19
|
missing, the answer is weight/color, not a new size. */
|
|
20
|
-
--text-xs: 0.
|
|
21
|
-
--text-xs--line-height:
|
|
22
|
-
/* text-sm is aliased to text-xs (both
|
|
23
|
-
|
|
24
|
-
pointed at
|
|
25
|
-
Tailwind's default 14px, which would
|
|
26
|
-
--text-sm: 0.
|
|
27
|
-
--text-sm--line-height:
|
|
28
|
-
--text-base: 0.
|
|
29
|
-
--text-base--line-height: 1.
|
|
30
|
-
--text-lg:
|
|
31
|
-
--text-lg--line-height: 1.
|
|
20
|
+
--text-xs: 0.8125rem; /* 13px — the FLOOR: captions, secondary text, table cells, keycaps */
|
|
21
|
+
--text-xs--line-height: 1.125rem;
|
|
22
|
+
/* text-sm is aliased to text-xs (both 13px). The scale is intentionally
|
|
23
|
+
13 · 15 · 17 · 21 · 26 with no in-between tier — keeping the token
|
|
24
|
+
pointed at 13px stops any stray `text-sm` from falling back to
|
|
25
|
+
Tailwind's default 14px, which would land off the scale. */
|
|
26
|
+
--text-sm: 0.8125rem;
|
|
27
|
+
--text-sm--line-height: 1.125rem;
|
|
28
|
+
--text-base: 0.9375rem; /* 15px — BASE body */
|
|
29
|
+
--text-base--line-height: 1.375rem;
|
|
30
|
+
--text-lg: 1.0625rem; /* 17px — emphasized body, section headings */
|
|
31
|
+
--text-lg--line-height: 1.5rem;
|
|
32
32
|
--text-xl: 1.3125rem; /* 21px — page titles */
|
|
33
33
|
--text-xl--line-height: 1.75rem;
|
|
34
34
|
--text-2xl: 1.625rem; /* 26px — display */
|
|
@@ -111,7 +111,8 @@
|
|
|
111
111
|
to these system-wide. JS mirror: src/lib/motion.ts — keep in sync. */
|
|
112
112
|
--ease-out: cubic-bezier(0.23, 1, 0.32, 1); /* entrances, exits, presses */
|
|
113
113
|
--ease-in-out: cubic-bezier(0.77, 0, 0.175, 1); /* on-screen movement / morphs */
|
|
114
|
-
--ease-
|
|
114
|
+
--ease-expo-out: cubic-bezier(0.16, 1, 0.3, 1); /* side-panel and drawer slide */
|
|
115
|
+
--ease-drawer: var(--ease-expo-out); /* backwards-compatible alias */
|
|
115
116
|
--ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1); /* playful overshoot (rare) */
|
|
116
117
|
|
|
117
118
|
/* Durations — every animation/transition timing flows from these.
|
|
@@ -139,6 +140,8 @@
|
|
|
139
140
|
--sidebar-item: 2rem; /* 32px — collapsed rail hit target (square) */
|
|
140
141
|
--sidebar-logo: 1.25rem; /* 20px — brand mark, centered in a --sidebar-item square */
|
|
141
142
|
--sidebar-text-indent: 2.375rem; /* px-3 + icon size-4 + gap-2.5 — history rows align to nav-item text */
|
|
143
|
+
--sidebar-navigation-text-size: 0.8125rem; /* 13px — sidebar actions, items, history, and account text */
|
|
144
|
+
--sidebar-section-label-size: 0.8125rem; /* 13px — section and history labels */
|
|
142
145
|
--panel-header-height: 2.75rem; /* 44px — Panel / toolbar header */
|
|
143
146
|
--aside-width: 20rem; /* 320px — right-hand panel column */
|
|
144
147
|
|
|
@@ -153,6 +156,7 @@
|
|
|
153
156
|
--composer-bg: color-mix(in oklab, var(--muted) 30%, var(--background));
|
|
154
157
|
--composer-radius: var(--radius-2xl);
|
|
155
158
|
--composer-padding: 0.5rem;
|
|
159
|
+
--composer-placeholder-max-h: calc(var(--text-base--line-height) * 2); /* rotating placeholder clamp — two lines of the input's own rhythm, so it can never overlap the accessory row */
|
|
156
160
|
--chat-texture-opacity: 0.06; /* welcome-state halftone wash */
|
|
157
161
|
}
|
|
158
162
|
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '../collapsible';
|
|
2
|
-
import { ComponentProps, ReactNode } from 'react';
|
|
3
|
-
type ReasoningContextValue = {
|
|
4
|
-
isStreaming: boolean;
|
|
5
|
-
isOpen: boolean;
|
|
6
|
-
setIsOpen: (open: boolean) => void;
|
|
7
|
-
duration: number | undefined;
|
|
8
|
-
};
|
|
9
|
-
export declare const useReasoning: () => ReasoningContextValue;
|
|
10
|
-
export type ReasoningProps = ComponentProps<typeof Collapsible> & {
|
|
11
|
-
isStreaming?: boolean;
|
|
12
|
-
open?: boolean;
|
|
13
|
-
defaultOpen?: boolean;
|
|
14
|
-
onOpenChange?: (open: boolean) => void;
|
|
15
|
-
duration?: number;
|
|
16
|
-
};
|
|
17
|
-
export declare const Reasoning: import('react').MemoExoticComponent<({ className, isStreaming, open, defaultOpen, onOpenChange, duration: durationProp, children, ...props }: ReasoningProps) => import("react").JSX.Element>;
|
|
18
|
-
export type ReasoningTriggerProps = ComponentProps<typeof CollapsibleTrigger> & {
|
|
19
|
-
getThinkingMessage?: (isStreaming: boolean, duration?: number) => ReactNode;
|
|
20
|
-
};
|
|
21
|
-
export declare const ReasoningTrigger: import('react').MemoExoticComponent<({ className, children, getThinkingMessage, ...props }: ReasoningTriggerProps) => import("react").JSX.Element>;
|
|
22
|
-
export type ReasoningContentProps = Omit<ComponentProps<typeof CollapsibleContent>, "children"> & {
|
|
23
|
-
children: ReactNode;
|
|
24
|
-
};
|
|
25
|
-
export declare const ReasoningContent: import('react').MemoExoticComponent<({ className, children, ...props }: ReasoningContentProps) => import("react").JSX.Element>;
|
|
26
|
-
export {};
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as n, jsxs as b, Fragment as y } from "react/jsx-runtime";
|
|
3
|
-
import { Collapsible as D, CollapsibleTrigger as A, CollapsibleContent as E } from "../collapsible.js";
|
|
4
|
-
import { Brain as O, ChevronDown as _ } from "../../lib/icons.js";
|
|
5
|
-
import { cn as p } from "../../lib/cn.js";
|
|
6
|
-
import { createContext as k, memo as g, useState as f, useEffect as N, useRef as M, useCallback as P, useContext as S } from "react";
|
|
7
|
-
function T({
|
|
8
|
-
prop: t,
|
|
9
|
-
defaultProp: e,
|
|
10
|
-
onChange: o
|
|
11
|
-
}) {
|
|
12
|
-
const [s, c] = f(e), a = t !== void 0, u = a ? t : s, i = M(o);
|
|
13
|
-
i.current = o;
|
|
14
|
-
const l = P(
|
|
15
|
-
(r) => {
|
|
16
|
-
var d;
|
|
17
|
-
a || c(r), (d = i.current) == null || d.call(i, r);
|
|
18
|
-
},
|
|
19
|
-
[a]
|
|
20
|
-
);
|
|
21
|
-
return [u, l];
|
|
22
|
-
}
|
|
23
|
-
const w = k(null), j = () => {
|
|
24
|
-
const t = S(w);
|
|
25
|
-
if (!t)
|
|
26
|
-
throw new Error("Reasoning components must be used within Reasoning");
|
|
27
|
-
return t;
|
|
28
|
-
}, z = 1e3, I = 1e3, L = g(
|
|
29
|
-
({
|
|
30
|
-
className: t,
|
|
31
|
-
isStreaming: e = !1,
|
|
32
|
-
open: o,
|
|
33
|
-
defaultOpen: s = !0,
|
|
34
|
-
onOpenChange: c,
|
|
35
|
-
duration: a,
|
|
36
|
-
children: u,
|
|
37
|
-
...i
|
|
38
|
-
}) => {
|
|
39
|
-
const [l, r] = T({
|
|
40
|
-
prop: o,
|
|
41
|
-
defaultProp: s,
|
|
42
|
-
onChange: c
|
|
43
|
-
}), [d, h] = T({
|
|
44
|
-
prop: a,
|
|
45
|
-
defaultProp: void 0
|
|
46
|
-
}), [C, R] = f(!1), [m, x] = f(null);
|
|
47
|
-
return N(() => {
|
|
48
|
-
e ? m === null && x(Date.now()) : m !== null && (h(Math.ceil((Date.now() - m) / I)), x(null));
|
|
49
|
-
}, [e, m, h]), N(() => {
|
|
50
|
-
if (s && !e && l && !C) {
|
|
51
|
-
const v = setTimeout(() => {
|
|
52
|
-
r(!1), R(!0);
|
|
53
|
-
}, z);
|
|
54
|
-
return () => clearTimeout(v);
|
|
55
|
-
}
|
|
56
|
-
}, [e, l, s, r, C]), /* @__PURE__ */ n(
|
|
57
|
-
w.Provider,
|
|
58
|
-
{
|
|
59
|
-
value: { isStreaming: e, isOpen: l, setIsOpen: r, duration: d },
|
|
60
|
-
children: /* @__PURE__ */ n(
|
|
61
|
-
D,
|
|
62
|
-
{
|
|
63
|
-
className: p("mb-4", t),
|
|
64
|
-
onOpenChange: r,
|
|
65
|
-
open: l,
|
|
66
|
-
...i,
|
|
67
|
-
children: u
|
|
68
|
-
}
|
|
69
|
-
)
|
|
70
|
-
}
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
), U = (t, e) => t || e === 0 ? /* @__PURE__ */ n("span", { className: "shimmer text-foreground/40", children: "Thinking…" }) : e === void 0 ? /* @__PURE__ */ n("span", { children: "Thought for a few seconds" }) : /* @__PURE__ */ b("span", { children: [
|
|
74
|
-
"Thought for ",
|
|
75
|
-
/* @__PURE__ */ n("span", { className: "tabular-nums", children: e }),
|
|
76
|
-
" seconds"
|
|
77
|
-
] }), B = g(
|
|
78
|
-
({
|
|
79
|
-
className: t,
|
|
80
|
-
children: e,
|
|
81
|
-
getThinkingMessage: o = U,
|
|
82
|
-
...s
|
|
83
|
-
}) => {
|
|
84
|
-
const { isStreaming: c, isOpen: a, duration: u } = j();
|
|
85
|
-
return /* @__PURE__ */ n(
|
|
86
|
-
A,
|
|
87
|
-
{
|
|
88
|
-
className: p(
|
|
89
|
-
"flex w-full items-center gap-2 text-base text-secondary transition-colors hover:text-foreground",
|
|
90
|
-
t
|
|
91
|
-
),
|
|
92
|
-
...s,
|
|
93
|
-
children: e ?? /* @__PURE__ */ b(y, { children: [
|
|
94
|
-
/* @__PURE__ */ n(O, { className: "size-4" }),
|
|
95
|
-
o(c, u),
|
|
96
|
-
/* @__PURE__ */ n(
|
|
97
|
-
_,
|
|
98
|
-
{
|
|
99
|
-
className: p(
|
|
100
|
-
"size-4 transition-transform duration-(--duration-fast) ease-out motion-reduce:transition-none",
|
|
101
|
-
a ? "rotate-180" : "rotate-0"
|
|
102
|
-
)
|
|
103
|
-
}
|
|
104
|
-
)
|
|
105
|
-
] })
|
|
106
|
-
}
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
), F = g(
|
|
110
|
-
({ className: t, children: e, ...o }) => /* @__PURE__ */ n(
|
|
111
|
-
E,
|
|
112
|
-
{
|
|
113
|
-
className: p(
|
|
114
|
-
"mt-4 text-base text-secondary outline-none",
|
|
115
|
-
"data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 data-[state=closed]:animate-out data-[state=open]:animate-in motion-reduce:animate-none",
|
|
116
|
-
t
|
|
117
|
-
),
|
|
118
|
-
...o,
|
|
119
|
-
children: /* @__PURE__ */ n("div", { className: "leading-relaxed whitespace-pre-wrap", children: e })
|
|
120
|
-
}
|
|
121
|
-
)
|
|
122
|
-
);
|
|
123
|
-
L.displayName = "Reasoning";
|
|
124
|
-
B.displayName = "ReasoningTrigger";
|
|
125
|
-
F.displayName = "ReasoningContent";
|
|
126
|
-
export {
|
|
127
|
-
L as Reasoning,
|
|
128
|
-
F as ReasoningContent,
|
|
129
|
-
B as ReasoningTrigger,
|
|
130
|
-
j as useReasoning
|
|
131
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ComponentProps, ReactNode } from 'react';
|
|
2
|
-
import { Renderer } from '@openuidev/react-lang';
|
|
3
|
-
/**
|
|
4
|
-
* The OpenUI Lang library used to render fenced `openui-lang` answers. ADS
|
|
5
|
-
* ships no default library — the host injects its own component registry via
|
|
6
|
-
* {@link OpenUiLibraryProvider}. Absent a provider, structured answers fall
|
|
7
|
-
* back to Markdown (see {@link SmartMessageText}).
|
|
8
|
-
*/
|
|
9
|
-
type OpenUiLibrary = ComponentProps<typeof Renderer>["library"];
|
|
10
|
-
export declare function OpenUiLibraryProvider({ library, children, }: {
|
|
11
|
-
library: OpenUiLibrary;
|
|
12
|
-
children: ReactNode;
|
|
13
|
-
}): import("react").JSX.Element;
|
|
14
|
-
export declare const SmartMessageText: import('react').MemoExoticComponent<() => import("react").JSX.Element>;
|
|
15
|
-
export {};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
-
import { createContext as c, memo as p, useContext as m } from "react";
|
|
4
|
-
import { useMessagePartText as u } from "@assistant-ui/react";
|
|
5
|
-
import { Renderer as d } from "@openuidev/react-lang";
|
|
6
|
-
import { MarkdownText as l } from "./markdown-text.js";
|
|
7
|
-
const i = c(null);
|
|
8
|
-
function M({
|
|
9
|
-
library: e,
|
|
10
|
-
children: r
|
|
11
|
-
}) {
|
|
12
|
-
return /* @__PURE__ */ t(i.Provider, { value: e, children: r });
|
|
13
|
-
}
|
|
14
|
-
const x = /```openui-lang\r?\n([\s\S]*?)(?:\r?\n```|$)/;
|
|
15
|
-
function f(e) {
|
|
16
|
-
const r = e.match(x);
|
|
17
|
-
return r ? r[1].replace(/```$/, "").trimEnd() : null;
|
|
18
|
-
}
|
|
19
|
-
const g = () => {
|
|
20
|
-
var o;
|
|
21
|
-
const e = u(), r = m(i), s = e.type === "text" ? e.text : "", n = f(s), a = e.status.type === "running";
|
|
22
|
-
return n && r ? /* @__PURE__ */ t("div", { className: "ads-openui my-1", children: /* @__PURE__ */ t(d, { response: n, library: r, isStreaming: a }) }) : (n && typeof process < "u" && ((o = process.env) == null ? void 0 : o.NODE_ENV) !== "production" && console.warn(
|
|
23
|
-
"[ADS] SmartMessageText got an openui-lang answer but no OpenUiLibraryProvider is present; falling back to Markdown. Wrap the Thread in <OpenUiLibraryProvider library={…}>."
|
|
24
|
-
), /* @__PURE__ */ t(l, {}));
|
|
25
|
-
}, P = p(g);
|
|
26
|
-
export {
|
|
27
|
-
M as OpenUiLibraryProvider,
|
|
28
|
-
P as SmartMessageText
|
|
29
|
-
};
|