@tangle-network/ui 11.10.0 → 11.11.1

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 (132) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +4 -1
  3. package/dist/active-sessions-store-Gt1R0rFG.js +262 -0
  4. package/dist/{active-sessions-store-CeOmXgv5.d.ts → active-sessions-store-nl70ZnMC.d.ts} +40 -41
  5. package/dist/artifact-pane-BL_DFWNl.d.ts +32 -0
  6. package/dist/artifact-pane-DMXT9a8U.js +70 -0
  7. package/dist/auth-DOETfnd9.js +154 -0
  8. package/dist/auth.d.ts +2 -74
  9. package/dist/auth.js +2 -16
  10. package/dist/branding-26d5ARIr.d.ts +14 -0
  11. package/dist/button-C87nEe2R.js +78 -0
  12. package/dist/button-yoIv77e2.d.ts +16 -0
  13. package/dist/chat-D4jAfEmj.js +667 -0
  14. package/dist/chat.d.ts +2 -201
  15. package/dist/chat.js +2 -31
  16. package/dist/code-block-B36KVUSN.js +165 -0
  17. package/dist/code-block-B9miUPht.d.ts +23 -0
  18. package/dist/diff-preview-BcK3nRXb.js +533 -0
  19. package/dist/document-editor-pane-BcoABlhn.d.ts +131 -0
  20. package/dist/document-editor-pane-BxlPjaTP.js +1287 -0
  21. package/dist/dropdown-menu-BpcLa5vF.js +101 -0
  22. package/dist/editor.d.ts +76 -78
  23. package/dist/editor.js +2 -34
  24. package/dist/file-format-BgXbr-Ib.js +160 -0
  25. package/dist/files-Bug33qCl.js +743 -0
  26. package/dist/files.d.ts +2 -243
  27. package/dist/files.js +3 -41
  28. package/dist/focus-BcE_SHqz.js +57 -0
  29. package/dist/format-DfcLWqMa.js +54 -0
  30. package/dist/hooks.d.ts +30 -37
  31. package/dist/hooks.js +111 -46
  32. package/dist/index-2UntyjBb.d.ts +52 -0
  33. package/dist/index-BgUHilZm.d.ts +108 -0
  34. package/dist/index-COgqsFAQ.d.ts +42 -0
  35. package/dist/index-CPDET_s1.d.ts +549 -0
  36. package/dist/index-CUhfHT_V.d.ts +204 -0
  37. package/dist/index-Cg6gYAqh.d.ts +73 -0
  38. package/dist/index-Cq-EJzqW.d.ts +16 -0
  39. package/dist/index-DhYmSaLF.d.ts +245 -0
  40. package/dist/index-DjKxO357.d.ts +128 -0
  41. package/dist/index.d.ts +26 -43
  42. package/dist/index.js +35 -472
  43. package/dist/markdown-BGqicV82.js +45 -0
  44. package/dist/markdown.d.ts +3 -18
  45. package/dist/markdown.js +3 -15
  46. package/dist/message-vhUI0c5G.d.ts +16 -0
  47. package/dist/nav.d.ts +6 -8
  48. package/dist/nav.js +29 -11
  49. package/dist/openui-artifact-renderer-D3E5bIAI.d.ts +114 -0
  50. package/dist/openui-artifact-renderer-DrU1AdVk.js +266 -0
  51. package/dist/openui.d.ts +2 -115
  52. package/dist/openui.js +2 -13
  53. package/dist/parts-5mhy9yJ3.d.ts +37 -0
  54. package/dist/primitives-Cb8GGVKr.js +1239 -0
  55. package/dist/primitives.d.ts +5 -525
  56. package/dist/primitives.js +9 -212
  57. package/dist/redaction-CGGB2ENG.js +74 -0
  58. package/dist/redaction.d.ts +2 -42
  59. package/dist/redaction.js +2 -7
  60. package/dist/run-OyWmIDqu.d.ts +41 -0
  61. package/dist/run-ZsIKPA6J.js +17 -0
  62. package/dist/run-group-BACLbCFl.js +410 -0
  63. package/dist/run.d.ts +3 -126
  64. package/dist/run.js +5 -40
  65. package/dist/sdk-hooks.d.ts +2 -285
  66. package/dist/sdk-hooks.js +3 -36
  67. package/dist/stores.d.ts +13 -14
  68. package/dist/stores.js +34 -76
  69. package/dist/table-Bss73DhB.js +146 -0
  70. package/dist/tabs-BVHR6NkO.js +40 -0
  71. package/dist/text-shimmer-BUUo6I-g.js +64 -0
  72. package/dist/tool-call-feed-BeB1_4pX.d.ts +47 -0
  73. package/dist/tool-call-feed-Djt2q11V.js +109 -0
  74. package/dist/tool-call-step-DNebqhmX.js +434 -0
  75. package/dist/tool-display-BAuAVa43.js +158 -0
  76. package/dist/{tool-display-z4JcDmMQ.d.ts → tool-display-DgmL5rIU.d.ts} +16 -16
  77. package/dist/tool-previews.d.ts +2 -48
  78. package/dist/tool-previews.js +2 -23
  79. package/dist/types.d.ts +6 -19
  80. package/dist/types.js +0 -1
  81. package/dist/use-auto-scroll-C5Pjeqon.js +153 -0
  82. package/dist/use-sse-stream-BVgO1QBN.js +884 -0
  83. package/dist/use-sse-stream-Dm6R5YWz.d.ts +282 -0
  84. package/dist/utils-Bl_CZ0Qp.js +37 -0
  85. package/dist/{chunk-RQHJBTEU.js → utils-C_uf36nf.js} +4 -6
  86. package/dist/utils.d.ts +2 -104
  87. package/dist/utils.js +6 -44
  88. package/package.json +39 -41
  89. package/src/lib/focus.ts +2 -1
  90. package/dist/artifact-pane-DpuWcAiF.d.ts +0 -33
  91. package/dist/button-CMQuQEW_.d.ts +0 -17
  92. package/dist/chunk-34A66VBG.js +0 -214
  93. package/dist/chunk-3OI2QKFD.js +0 -0
  94. package/dist/chunk-3XXBZL53.js +0 -174
  95. package/dist/chunk-42PAH5D2.js +0 -112
  96. package/dist/chunk-4CLN43XT.js +0 -45
  97. package/dist/chunk-55WHV7SS.js +0 -1604
  98. package/dist/chunk-565EATZZ.js +0 -156
  99. package/dist/chunk-5Z5ZYMOJ.js +0 -0
  100. package/dist/chunk-6BGQA4BQ.js +0 -0
  101. package/dist/chunk-BEBXZPHW.js +0 -299
  102. package/dist/chunk-C5WF4WMV.js +0 -734
  103. package/dist/chunk-HFL6R6IF.js +0 -37
  104. package/dist/chunk-HGML45QH.js +0 -104
  105. package/dist/chunk-HMAPIH7L.js +0 -595
  106. package/dist/chunk-K5XFRUS4.js +0 -1401
  107. package/dist/chunk-KFQGHD73.js +0 -198
  108. package/dist/chunk-L57WRIND.js +0 -59
  109. package/dist/chunk-LTEKI7YJ.js +0 -59
  110. package/dist/chunk-M3QZK62R.js +0 -233
  111. package/dist/chunk-ND3ZFXQK.js +0 -179
  112. package/dist/chunk-OEX7NZE3.js +0 -321
  113. package/dist/chunk-OL5GYLHV.js +0 -60
  114. package/dist/chunk-QGFYBNSO.js +0 -133
  115. package/dist/chunk-R7B3UWPF.js +0 -550
  116. package/dist/chunk-R7SUY4E3.js +0 -65
  117. package/dist/chunk-REJESC5U.js +0 -117
  118. package/dist/chunk-RQGKSCEZ.js +0 -0
  119. package/dist/chunk-SNLR2AEA.js +0 -40
  120. package/dist/chunk-WKWBTL2V.js +0 -15
  121. package/dist/chunk-X7CU776B.js +0 -1048
  122. package/dist/chunk-XU3HB5QL.js +0 -127
  123. package/dist/chunk-YTO5V6QS.js +0 -19
  124. package/dist/chunk-YU4E5J2N.js +0 -437
  125. package/dist/chunk-YZ6AK25N.js +0 -886
  126. package/dist/code-block-0kSpWMnf.d.ts +0 -25
  127. package/dist/document-editor-pane-IAEQn_Dl.d.ts +0 -128
  128. package/dist/document-editor-pane-QHDOBA43.js +0 -13
  129. package/dist/message-BHWbxBtT.d.ts +0 -15
  130. package/dist/parts-dj7AcUg0.d.ts +0 -36
  131. package/dist/run-PfLmDAox.d.ts +0 -41
  132. package/dist/tool-call-feed-D9iofJgW.d.ts +0 -46
@@ -1,156 +0,0 @@
1
- import {
2
- getToolCategory
3
- } from "./chunk-ND3ZFXQK.js";
4
-
5
- // src/hooks/use-run-groups.ts
6
- import { useMemo } from "react";
7
- function computeRunStats(messages, partMap) {
8
- const stats = {
9
- toolCount: 0,
10
- messageCount: messages.length,
11
- thinkingDurationMs: 0,
12
- textPartCount: 0,
13
- toolCategories: /* @__PURE__ */ new Set()
14
- };
15
- for (const msg of messages) {
16
- const parts = partMap[msg.id] ?? [];
17
- for (const part of parts) {
18
- switch (part.type) {
19
- case "tool":
20
- stats.toolCount++;
21
- stats.toolCategories.add(getToolCategory(part.tool));
22
- break;
23
- case "text":
24
- if (!part.synthetic) stats.textPartCount++;
25
- break;
26
- case "reasoning": {
27
- const start = part.time?.start;
28
- const end = part.time?.end;
29
- if (start && end) stats.thinkingDurationMs += end - start;
30
- break;
31
- }
32
- }
33
- }
34
- }
35
- return stats;
36
- }
37
- function getLastTextContent(messages, partMap) {
38
- for (let i = messages.length - 1; i >= 0; i--) {
39
- const parts = partMap[messages[i].id] ?? [];
40
- for (let j = parts.length - 1; j >= 0; j--) {
41
- const part = parts[j];
42
- if (part.type === "text" && !part.synthetic && part.text.trim()) {
43
- return part.text.trim();
44
- }
45
- }
46
- }
47
- return null;
48
- }
49
- function useRunGroups({
50
- messages,
51
- partMap,
52
- isStreaming
53
- }) {
54
- return useMemo(() => {
55
- const groups = [];
56
- let currentRunMessages = [];
57
- function flushRun(streaming) {
58
- if (currentRunMessages.length === 0) return;
59
- const msgs = [...currentRunMessages];
60
- const stats = computeRunStats(msgs, partMap);
61
- const summaryText = getLastTextContent(msgs, partMap);
62
- const isComplete = !streaming;
63
- groups.push({
64
- type: "run",
65
- run: {
66
- id: msgs[0].id,
67
- messages: msgs,
68
- isComplete,
69
- isStreaming: streaming,
70
- stats,
71
- summaryText,
72
- finalTextPart: null
73
- }
74
- });
75
- currentRunMessages = [];
76
- }
77
- for (let i = 0; i < messages.length; i++) {
78
- const msg = messages[i];
79
- if (msg.role === "user") {
80
- flushRun(false);
81
- groups.push({ type: "user", message: msg });
82
- } else {
83
- currentRunMessages.push(msg);
84
- }
85
- }
86
- if (currentRunMessages.length > 0) {
87
- flushRun(isStreaming);
88
- }
89
- return groups;
90
- }, [messages, partMap, isStreaming]);
91
- }
92
-
93
- // src/hooks/use-run-collapse-state.ts
94
- import { useCallback, useState } from "react";
95
- function useRunCollapseState(runs) {
96
- const [collapsedMap, setCollapsedMap] = useState({});
97
- const isCollapsed = useCallback(
98
- (runId) => {
99
- return collapsedMap[runId] ?? false;
100
- },
101
- [collapsedMap]
102
- );
103
- const toggleCollapse = useCallback((runId) => {
104
- setCollapsedMap((prev) => ({ ...prev, [runId]: !prev[runId] }));
105
- }, []);
106
- return { isCollapsed, toggleCollapse };
107
- }
108
-
109
- // src/hooks/use-auto-scroll.ts
110
- import {
111
- useCallback as useCallback2,
112
- useEffect,
113
- useRef,
114
- useState as useState2
115
- } from "react";
116
- var BOTTOM_THRESHOLD = 40;
117
- function useAutoScroll(containerRef, deps = []) {
118
- const [isAtBottom, setIsAtBottom] = useState2(true);
119
- const userScrolledUp = useRef(false);
120
- const checkBottom = useCallback2(() => {
121
- const el = containerRef.current;
122
- if (!el) return true;
123
- return el.scrollHeight - el.scrollTop - el.clientHeight < BOTTOM_THRESHOLD;
124
- }, [containerRef]);
125
- useEffect(() => {
126
- const el = containerRef.current;
127
- if (!el) return;
128
- const onScroll = () => {
129
- const atBottom = checkBottom();
130
- setIsAtBottom(atBottom);
131
- userScrolledUp.current = !atBottom;
132
- };
133
- el.addEventListener("scroll", onScroll, { passive: true });
134
- return () => el.removeEventListener("scroll", onScroll);
135
- }, [containerRef, checkBottom]);
136
- useEffect(() => {
137
- if (userScrolledUp.current) return;
138
- const el = containerRef.current;
139
- if (!el) return;
140
- el.scrollTop = el.scrollHeight;
141
- }, deps);
142
- const scrollToBottom = useCallback2(() => {
143
- const el = containerRef.current;
144
- if (!el) return;
145
- userScrolledUp.current = false;
146
- el.scrollTo({ top: el.scrollHeight, behavior: "smooth" });
147
- setIsAtBottom(true);
148
- }, [containerRef]);
149
- return { isAtBottom, scrollToBottom };
150
- }
151
-
152
- export {
153
- useRunGroups,
154
- useRunCollapseState,
155
- useAutoScroll
156
- };
File without changes
File without changes
@@ -1,299 +0,0 @@
1
- import {
2
- Badge,
3
- Card,
4
- CardContent,
5
- CardDescription,
6
- CardHeader,
7
- CardTitle,
8
- Table,
9
- TableBody,
10
- TableCell,
11
- TableHead,
12
- TableHeader,
13
- TableRow
14
- } from "./chunk-M3QZK62R.js";
15
- import {
16
- Button
17
- } from "./chunk-42PAH5D2.js";
18
- import {
19
- Markdown
20
- } from "./chunk-OL5GYLHV.js";
21
- import {
22
- CodeBlock
23
- } from "./chunk-3XXBZL53.js";
24
- import {
25
- cn
26
- } from "./chunk-RQHJBTEU.js";
27
-
28
- // src/openui/openui-artifact-renderer.tsx
29
- import { Fragment } from "react";
30
- import { Minus } from "lucide-react";
31
- import { jsx, jsxs } from "react/jsx-runtime";
32
- var NODE_TYPES = /* @__PURE__ */ new Set([
33
- "heading",
34
- "text",
35
- "badge",
36
- "stat",
37
- "key_value",
38
- "code",
39
- "markdown",
40
- "table",
41
- "actions",
42
- "separator",
43
- "stack",
44
- "grid",
45
- "card"
46
- ]);
47
- var GAP_STYLES = {
48
- sm: "gap-2",
49
- md: "gap-4",
50
- lg: "gap-6"
51
- };
52
- var GRID_STYLES = {
53
- 1: "grid-cols-1",
54
- 2: "grid-cols-1 md:grid-cols-2",
55
- 3: "grid-cols-1 md:grid-cols-3",
56
- 4: "grid-cols-1 md:grid-cols-2 xl:grid-cols-4"
57
- };
58
- var ALIGN_STYLES = {
59
- start: "items-start",
60
- center: "items-center",
61
- end: "items-end",
62
- stretch: "items-stretch"
63
- };
64
- function formatValue(value) {
65
- if (value === null || value === void 0) {
66
- return /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "\u2014" });
67
- }
68
- if (typeof value === "boolean") {
69
- return value ? "Yes" : "No";
70
- }
71
- return value;
72
- }
73
- function asArray(value) {
74
- return Array.isArray(value) ? value : [];
75
- }
76
- function isOpenUIComponentNode(value) {
77
- return typeof value === "object" && value !== null && "type" in value && typeof value.type === "string" && NODE_TYPES.has(value.type);
78
- }
79
- function renderActions(actions, onAction) {
80
- if (actions.length === 0) return null;
81
- return /* @__PURE__ */ jsx("div", { className: "flex flex-wrap items-center gap-2", children: actions.map((action) => /* @__PURE__ */ jsx(
82
- Button,
83
- {
84
- type: "button",
85
- size: "sm",
86
- variant: action.tone ?? "outline",
87
- disabled: action.disabled,
88
- onClick: () => {
89
- action.onPress?.();
90
- onAction?.(action);
91
- },
92
- children: action.label
93
- },
94
- action.id
95
- )) });
96
- }
97
- function renderNode(node, onAction) {
98
- switch (node.type) {
99
- case "heading": {
100
- const level = node.level ?? 2;
101
- const HeadingTag = `h${level}`;
102
- return /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
103
- node.kicker && /* @__PURE__ */ jsx("div", { className: "text-[10px] font-semibold uppercase tracking-[0.16em] text-muted-foreground", children: node.kicker }),
104
- /* @__PURE__ */ jsx(
105
- HeadingTag,
106
- {
107
- className: cn(
108
- "font-semibold tracking-tight text-foreground",
109
- level === 1 && "text-2xl",
110
- level === 2 && "text-xl",
111
- level === 3 && "text-lg",
112
- level === 4 && "text-base"
113
- ),
114
- children: node.text
115
- }
116
- ),
117
- node.meta && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: node.meta })
118
- ] });
119
- }
120
- case "text":
121
- return /* @__PURE__ */ jsx(
122
- "p",
123
- {
124
- className: cn(
125
- "text-sm leading-6 text-foreground",
126
- node.tone === "muted" && "text-muted-foreground",
127
- node.tone === "success" && "text-[var(--surface-success-text)]",
128
- node.tone === "warning" && "text-[var(--surface-warning-text)]",
129
- node.tone === "error" && "text-[var(--surface-danger-text)]",
130
- node.mono && "font-mono text-[13px]"
131
- ),
132
- children: node.text
133
- }
134
- );
135
- case "badge":
136
- return /* @__PURE__ */ jsx(Badge, { variant: node.tone ?? "outline", children: node.label });
137
- case "stat":
138
- return /* @__PURE__ */ jsx(Card, { variant: "glass", className: "border-border shadow-[var(--shadow-card)]", children: /* @__PURE__ */ jsxs(CardContent, { className: "space-y-2 p-4", children: [
139
- /* @__PURE__ */ jsx("div", { className: "text-xs uppercase tracking-[0.12em] text-muted-foreground", children: node.label }),
140
- /* @__PURE__ */ jsx("div", { className: "text-2xl font-semibold tracking-tight text-foreground", children: node.value }),
141
- node.change && /* @__PURE__ */ jsx(
142
- "div",
143
- {
144
- className: cn(
145
- "text-xs",
146
- node.tone === "success" && "text-[var(--surface-success-text)]",
147
- node.tone === "warning" && "text-[var(--surface-warning-text)]",
148
- node.tone === "error" && "text-[var(--surface-danger-text)]",
149
- node.tone === "info" && "text-[var(--surface-info-text)]",
150
- !node.tone || node.tone === "default" ? "text-muted-foreground" : void 0
151
- ),
152
- children: node.change
153
- }
154
- )
155
- ] }) });
156
- case "key_value":
157
- if (asArray(node.items).length === 0) {
158
- return null;
159
- }
160
- return /* @__PURE__ */ jsx("dl", { className: "grid gap-3 sm:grid-cols-2", children: asArray(node.items).map((item, index) => /* @__PURE__ */ jsxs(
161
- "div",
162
- {
163
- className: "rounded-[var(--radius-lg)] border border-border bg-card px-4 py-3",
164
- children: [
165
- /* @__PURE__ */ jsx("dt", { className: "text-[11px] uppercase tracking-[0.12em] text-muted-foreground", children: item.label }),
166
- /* @__PURE__ */ jsx(
167
- "dd",
168
- {
169
- className: cn(
170
- "mt-1 text-sm font-medium text-foreground",
171
- item.tone === "muted" && "text-foreground"
172
- ),
173
- children: formatValue(item.value)
174
- }
175
- )
176
- ]
177
- },
178
- item.id ?? `${item.label}-${index}`
179
- )) });
180
- case "code":
181
- return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
182
- node.title && /* @__PURE__ */ jsx("div", { className: "text-xs uppercase tracking-[0.12em] text-muted-foreground", children: node.title }),
183
- /* @__PURE__ */ jsx(
184
- CodeBlock,
185
- {
186
- code: node.code,
187
- language: node.language,
188
- showLineNumbers: node.showLineNumbers,
189
- className: "border-border bg-background"
190
- }
191
- )
192
- ] });
193
- case "markdown":
194
- return /* @__PURE__ */ jsx("div", { className: "rounded-[var(--radius-lg)] border border-border bg-card p-5", children: /* @__PURE__ */ jsx(Markdown, { className: "prose-sm max-w-none", children: node.content }) });
195
- case "table":
196
- if (asArray(node.columns).length === 0) {
197
- return null;
198
- }
199
- return /* @__PURE__ */ jsxs("div", { className: "overflow-hidden rounded-[var(--radius-lg)] border border-border bg-card", children: [
200
- /* @__PURE__ */ jsxs(Table, { children: [
201
- /* @__PURE__ */ jsx(TableHeader, { children: /* @__PURE__ */ jsx(TableRow, { className: "border-border", children: asArray(node.columns).map((column) => /* @__PURE__ */ jsx(
202
- TableHead,
203
- {
204
- className: cn(
205
- "h-10 text-[11px] uppercase tracking-[0.1em] text-muted-foreground",
206
- column.align === "right" && "text-right"
207
- ),
208
- children: column.header
209
- },
210
- column.key
211
- )) }) }),
212
- /* @__PURE__ */ jsx(TableBody, { children: asArray(node.rows).map((row, rowIndex) => /* @__PURE__ */ jsx(TableRow, { className: "border-border", children: asArray(node.columns).map((column) => /* @__PURE__ */ jsx(
213
- TableCell,
214
- {
215
- className: cn(
216
- "py-3 text-sm text-foreground",
217
- column.align === "right" && "text-right tabular-nums"
218
- ),
219
- children: formatValue(row[column.key])
220
- },
221
- column.key
222
- )) }, rowIndex)) })
223
- ] }),
224
- node.caption && /* @__PURE__ */ jsx("div", { className: "border-t border-border px-4 py-2 text-xs text-muted-foreground", children: node.caption })
225
- ] });
226
- case "actions":
227
- return renderActions(asArray(node.actions), onAction);
228
- case "separator":
229
- return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
230
- /* @__PURE__ */ jsx("div", { className: "h-px flex-1 bg-border" }),
231
- node.label && /* @__PURE__ */ jsx("span", { className: "text-[10px] uppercase tracking-[0.14em] text-muted-foreground", children: node.label }),
232
- /* @__PURE__ */ jsx("div", { className: "h-px flex-1 bg-border" })
233
- ] });
234
- case "stack":
235
- if (asArray(node.children).length === 0) {
236
- return null;
237
- }
238
- return /* @__PURE__ */ jsx(
239
- "div",
240
- {
241
- className: cn(
242
- "flex",
243
- node.direction === "row" ? "flex-row" : "flex-col",
244
- GAP_STYLES[node.gap ?? "md"],
245
- ALIGN_STYLES[node.align ?? "stretch"],
246
- node.wrap && "flex-wrap"
247
- ),
248
- children: asArray(node.children).map((child, index) => /* @__PURE__ */ jsx(Fragment, { children: renderNode(child, onAction) }, child.id ?? `${child.type}-${index}`))
249
- }
250
- );
251
- case "grid":
252
- if (asArray(node.children).length === 0) {
253
- return null;
254
- }
255
- return /* @__PURE__ */ jsx("div", { className: cn("grid", GRID_STYLES[node.columns ?? 2], GAP_STYLES[node.gap ?? "md"]), children: asArray(node.children).map((child, index) => /* @__PURE__ */ jsx(Fragment, { children: renderNode(child, onAction) }, child.id ?? `${child.type}-${index}`)) });
256
- case "card":
257
- return /* @__PURE__ */ jsxs(Card, { variant: "glass", className: "border-border shadow-[var(--shadow-card)]", children: [
258
- (node.eyebrow || node.title || node.description || node.badge || asArray(node.actions).length > 0) && /* @__PURE__ */ jsxs(CardHeader, { className: "gap-2 p-4 pb-0", children: [
259
- /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-3", children: [
260
- /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1 space-y-1", children: [
261
- node.eyebrow && /* @__PURE__ */ jsx("div", { className: "text-[10px] font-semibold uppercase tracking-[0.16em] text-muted-foreground", children: node.eyebrow }),
262
- node.title && /* @__PURE__ */ jsx(CardTitle, { className: "text-base text-foreground", children: node.title }),
263
- node.description && /* @__PURE__ */ jsx(CardDescription, { className: "text-muted-foreground", children: node.description })
264
- ] }),
265
- node.badge && /* @__PURE__ */ jsx(Badge, { variant: node.badge.tone ?? "outline", children: node.badge.label })
266
- ] }),
267
- asArray(node.actions).length > 0 && renderActions(asArray(node.actions), onAction)
268
- ] }),
269
- asArray(node.children).length > 0 && /* @__PURE__ */ jsx(CardContent, { className: "space-y-4 p-4", children: asArray(node.children).map((child, index) => /* @__PURE__ */ jsx(Fragment, { children: renderNode(child, onAction) }, child.id ?? `${child.type}-${index}`)) })
270
- ] });
271
- }
272
- }
273
- function OpenUIArtifactRenderer({
274
- schema,
275
- onAction,
276
- className
277
- }) {
278
- const nodes = (Array.isArray(schema) ? schema : [schema]).filter(isOpenUIComponentNode);
279
- if (nodes.length === 0) {
280
- return /* @__PURE__ */ jsx(
281
- "div",
282
- {
283
- className: cn(
284
- "flex min-h-[6rem] items-center justify-center rounded-[var(--radius-xl)] border border-dashed border-border bg-card p-5 text-center",
285
- className
286
- ),
287
- children: /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
288
- /* @__PURE__ */ jsx("div", { className: "mx-auto flex h-10 w-10 items-center justify-center rounded-full bg-muted/50 text-muted-foreground", children: /* @__PURE__ */ jsx(Minus, { className: "h-4 w-4" }) }),
289
- /* @__PURE__ */ jsx("div", { className: "text-sm font-medium text-foreground", children: "No view was generated." })
290
- ] })
291
- }
292
- );
293
- }
294
- return /* @__PURE__ */ jsx("div", { className: cn("space-y-4", className), children: nodes.map((node, index) => /* @__PURE__ */ jsx(Fragment, { children: renderNode(node, onAction) }, node.id ?? `${node.type}-${index}`)) });
295
- }
296
-
297
- export {
298
- OpenUIArtifactRenderer
299
- };