@tangle-network/ui 11.10.0 → 11.11.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/CHANGELOG.md +8 -0
- package/dist/active-sessions-store-Gt1R0rFG.js +262 -0
- package/dist/{active-sessions-store-CeOmXgv5.d.ts → active-sessions-store-nl70ZnMC.d.ts} +40 -41
- package/dist/artifact-pane-BL_DFWNl.d.ts +32 -0
- package/dist/artifact-pane-DMXT9a8U.js +70 -0
- package/dist/auth-DixfCMCk.js +154 -0
- package/dist/auth.d.ts +2 -74
- package/dist/auth.js +2 -16
- package/dist/branding-26d5ARIr.d.ts +14 -0
- package/dist/button-uhNnwdsD.js +78 -0
- package/dist/button-yoIv77e2.d.ts +16 -0
- package/dist/chat-CPLL0Fd9.js +667 -0
- package/dist/chat.d.ts +2 -201
- package/dist/chat.js +2 -31
- package/dist/code-block-B9miUPht.d.ts +23 -0
- package/dist/code-block-CngSn37j.js +165 -0
- package/dist/diff-preview-cySuqowW.js +533 -0
- package/dist/document-editor-pane-BcoABlhn.d.ts +131 -0
- package/dist/document-editor-pane-Cz6oEF1o.js +1287 -0
- package/dist/dropdown-menu-BpcLa5vF.js +101 -0
- package/dist/editor.d.ts +76 -78
- package/dist/editor.js +2 -34
- package/dist/file-format-BgXbr-Ib.js +160 -0
- package/dist/files-CYlOo0mE.js +743 -0
- package/dist/files.d.ts +2 -243
- package/dist/files.js +3 -41
- package/dist/focus-Cw02pNSr.js +56 -0
- package/dist/format-DfcLWqMa.js +54 -0
- package/dist/hooks.d.ts +30 -37
- package/dist/hooks.js +111 -46
- package/dist/index-2UntyjBb.d.ts +52 -0
- package/dist/index-COgqsFAQ.d.ts +42 -0
- package/dist/index-CPDET_s1.d.ts +549 -0
- package/dist/index-CUhfHT_V.d.ts +204 -0
- package/dist/index-Cg6gYAqh.d.ts +73 -0
- package/dist/index-Cq-EJzqW.d.ts +16 -0
- package/dist/index-DhYmSaLF.d.ts +245 -0
- package/dist/index-DjKxO357.d.ts +128 -0
- package/dist/index-b56ew9aF.d.ts +107 -0
- package/dist/index.d.ts +26 -43
- package/dist/index.js +35 -472
- package/dist/markdown-BprL96Gl.js +45 -0
- package/dist/markdown.d.ts +3 -18
- package/dist/markdown.js +3 -15
- package/dist/message-vhUI0c5G.d.ts +16 -0
- package/dist/nav.d.ts +6 -8
- package/dist/nav.js +29 -11
- package/dist/openui-artifact-renderer-D3E5bIAI.d.ts +114 -0
- package/dist/openui-artifact-renderer-DT4xbvWt.js +266 -0
- package/dist/openui.d.ts +2 -115
- package/dist/openui.js +2 -13
- package/dist/parts-5mhy9yJ3.d.ts +37 -0
- package/dist/primitives-DE-blUz-.js +1239 -0
- package/dist/primitives.d.ts +5 -525
- package/dist/primitives.js +9 -212
- package/dist/redaction-CGGB2ENG.js +74 -0
- package/dist/redaction.d.ts +2 -42
- package/dist/redaction.js +2 -7
- package/dist/run-OyWmIDqu.d.ts +41 -0
- package/dist/run-ZsIKPA6J.js +17 -0
- package/dist/run-group-D1InSdQu.js +410 -0
- package/dist/run.d.ts +3 -126
- package/dist/run.js +5 -40
- package/dist/sdk-hooks.d.ts +2 -285
- package/dist/sdk-hooks.js +3 -36
- package/dist/stores.d.ts +13 -14
- package/dist/stores.js +34 -76
- package/dist/table-DHyqDPbU.js +146 -0
- package/dist/tabs-ujuqAdtb.js +40 -0
- package/dist/text-shimmer-BUUo6I-g.js +64 -0
- package/dist/tool-call-feed-BeB1_4pX.d.ts +47 -0
- package/dist/tool-call-feed-C1W1N54c.js +109 -0
- package/dist/tool-call-step-Bi3_YJRV.js +434 -0
- package/dist/tool-display-BAuAVa43.js +158 -0
- package/dist/{tool-display-z4JcDmMQ.d.ts → tool-display-DgmL5rIU.d.ts} +16 -16
- package/dist/tool-previews.d.ts +2 -48
- package/dist/tool-previews.js +2 -23
- package/dist/types.d.ts +6 -19
- package/dist/types.js +0 -1
- package/dist/use-auto-scroll-C5Pjeqon.js +153 -0
- package/dist/use-sse-stream-BjVBDbxK.js +884 -0
- package/dist/use-sse-stream-Dm6R5YWz.d.ts +282 -0
- package/dist/utils-Bl_CZ0Qp.js +37 -0
- package/dist/{chunk-RQHJBTEU.js → utils-C_uf36nf.js} +4 -6
- package/dist/utils.d.ts +2 -104
- package/dist/utils.js +6 -44
- package/package.json +39 -41
- package/dist/artifact-pane-DpuWcAiF.d.ts +0 -33
- package/dist/button-CMQuQEW_.d.ts +0 -17
- package/dist/chunk-34A66VBG.js +0 -214
- package/dist/chunk-3OI2QKFD.js +0 -0
- package/dist/chunk-3XXBZL53.js +0 -174
- package/dist/chunk-42PAH5D2.js +0 -112
- package/dist/chunk-4CLN43XT.js +0 -45
- package/dist/chunk-55WHV7SS.js +0 -1604
- package/dist/chunk-565EATZZ.js +0 -156
- package/dist/chunk-5Z5ZYMOJ.js +0 -0
- package/dist/chunk-6BGQA4BQ.js +0 -0
- package/dist/chunk-BEBXZPHW.js +0 -299
- package/dist/chunk-C5WF4WMV.js +0 -734
- package/dist/chunk-HFL6R6IF.js +0 -37
- package/dist/chunk-HGML45QH.js +0 -104
- package/dist/chunk-HMAPIH7L.js +0 -595
- package/dist/chunk-K5XFRUS4.js +0 -1401
- package/dist/chunk-KFQGHD73.js +0 -198
- package/dist/chunk-L57WRIND.js +0 -59
- package/dist/chunk-LTEKI7YJ.js +0 -59
- package/dist/chunk-M3QZK62R.js +0 -233
- package/dist/chunk-ND3ZFXQK.js +0 -179
- package/dist/chunk-OEX7NZE3.js +0 -321
- package/dist/chunk-OL5GYLHV.js +0 -60
- package/dist/chunk-QGFYBNSO.js +0 -133
- package/dist/chunk-R7B3UWPF.js +0 -550
- package/dist/chunk-R7SUY4E3.js +0 -65
- package/dist/chunk-REJESC5U.js +0 -117
- package/dist/chunk-RQGKSCEZ.js +0 -0
- package/dist/chunk-SNLR2AEA.js +0 -40
- package/dist/chunk-WKWBTL2V.js +0 -15
- package/dist/chunk-X7CU776B.js +0 -1048
- package/dist/chunk-XU3HB5QL.js +0 -127
- package/dist/chunk-YTO5V6QS.js +0 -19
- package/dist/chunk-YU4E5J2N.js +0 -437
- package/dist/chunk-YZ6AK25N.js +0 -886
- package/dist/code-block-0kSpWMnf.d.ts +0 -25
- package/dist/document-editor-pane-IAEQn_Dl.d.ts +0 -128
- package/dist/document-editor-pane-QHDOBA43.js +0 -13
- package/dist/message-BHWbxBtT.d.ts +0 -15
- package/dist/parts-dj7AcUg0.d.ts +0 -36
- package/dist/run-PfLmDAox.d.ts +0 -41
- package/dist/tool-call-feed-D9iofJgW.d.ts +0 -46
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
//#region src/openui/openui-artifact-renderer.d.ts
|
|
3
|
+
type OpenUIPrimitive = string | number | boolean | null | undefined;
|
|
4
|
+
interface OpenUIAction {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
tone?: "default" | "secondary" | "outline" | "ghost" | "destructive";
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
onPress?: () => void;
|
|
10
|
+
}
|
|
11
|
+
interface OpenUIBaseNode {
|
|
12
|
+
id?: string;
|
|
13
|
+
}
|
|
14
|
+
interface OpenUIHeadingNode extends OpenUIBaseNode {
|
|
15
|
+
type: "heading";
|
|
16
|
+
text: string;
|
|
17
|
+
level?: 1 | 2 | 3 | 4;
|
|
18
|
+
kicker?: string;
|
|
19
|
+
meta?: string;
|
|
20
|
+
}
|
|
21
|
+
interface OpenUITextNode extends OpenUIBaseNode {
|
|
22
|
+
type: "text";
|
|
23
|
+
text: string;
|
|
24
|
+
tone?: "default" | "muted" | "success" | "warning" | "error";
|
|
25
|
+
mono?: boolean;
|
|
26
|
+
}
|
|
27
|
+
interface OpenUIBadgeNode extends OpenUIBaseNode {
|
|
28
|
+
type: "badge";
|
|
29
|
+
label: string;
|
|
30
|
+
tone?: "default" | "secondary" | "success" | "warning" | "error" | "info" | "sandbox";
|
|
31
|
+
}
|
|
32
|
+
interface OpenUIStatNode extends OpenUIBaseNode {
|
|
33
|
+
type: "stat";
|
|
34
|
+
label: string;
|
|
35
|
+
value: string;
|
|
36
|
+
change?: string;
|
|
37
|
+
tone?: "default" | "success" | "warning" | "error" | "info";
|
|
38
|
+
}
|
|
39
|
+
interface OpenUIKeyValueNode extends OpenUIBaseNode {
|
|
40
|
+
type: "key_value";
|
|
41
|
+
items: Array<{
|
|
42
|
+
id?: string;
|
|
43
|
+
label: string;
|
|
44
|
+
value: ReactNode | OpenUIPrimitive;
|
|
45
|
+
tone?: "default" | "muted";
|
|
46
|
+
}>;
|
|
47
|
+
}
|
|
48
|
+
interface OpenUICodeNode extends OpenUIBaseNode {
|
|
49
|
+
type: "code";
|
|
50
|
+
code: string;
|
|
51
|
+
language?: string;
|
|
52
|
+
title?: string;
|
|
53
|
+
showLineNumbers?: boolean;
|
|
54
|
+
}
|
|
55
|
+
interface OpenUIMarkdownNode extends OpenUIBaseNode {
|
|
56
|
+
type: "markdown";
|
|
57
|
+
content: string;
|
|
58
|
+
}
|
|
59
|
+
interface OpenUITableNode extends OpenUIBaseNode {
|
|
60
|
+
type: "table";
|
|
61
|
+
columns: Array<{
|
|
62
|
+
key: string;
|
|
63
|
+
header: string;
|
|
64
|
+
align?: "left" | "right";
|
|
65
|
+
}>;
|
|
66
|
+
rows: Array<Record<string, ReactNode | OpenUIPrimitive>>;
|
|
67
|
+
caption?: string;
|
|
68
|
+
}
|
|
69
|
+
interface OpenUIActionsNode extends OpenUIBaseNode {
|
|
70
|
+
type: "actions";
|
|
71
|
+
actions: OpenUIAction[];
|
|
72
|
+
}
|
|
73
|
+
interface OpenUISeparatorNode extends OpenUIBaseNode {
|
|
74
|
+
type: "separator";
|
|
75
|
+
label?: string;
|
|
76
|
+
}
|
|
77
|
+
interface OpenUIStackNode extends OpenUIBaseNode {
|
|
78
|
+
type: "stack";
|
|
79
|
+
direction?: "row" | "column";
|
|
80
|
+
gap?: "sm" | "md" | "lg";
|
|
81
|
+
align?: "start" | "center" | "end" | "stretch";
|
|
82
|
+
wrap?: boolean;
|
|
83
|
+
children: OpenUIComponentNode[];
|
|
84
|
+
}
|
|
85
|
+
interface OpenUIGridNode extends OpenUIBaseNode {
|
|
86
|
+
type: "grid";
|
|
87
|
+
columns?: 1 | 2 | 3 | 4;
|
|
88
|
+
gap?: "sm" | "md" | "lg";
|
|
89
|
+
children: OpenUIComponentNode[];
|
|
90
|
+
}
|
|
91
|
+
interface OpenUICardNode extends OpenUIBaseNode {
|
|
92
|
+
type: "card";
|
|
93
|
+
title?: string;
|
|
94
|
+
description?: string;
|
|
95
|
+
eyebrow?: string;
|
|
96
|
+
badge?: OpenUIBadgeNode;
|
|
97
|
+
actions?: OpenUIAction[];
|
|
98
|
+
children?: OpenUIComponentNode[];
|
|
99
|
+
}
|
|
100
|
+
type OpenUIComponentNode = OpenUIActionsNode | OpenUIBadgeNode | OpenUICardNode | OpenUICodeNode | OpenUIGridNode | OpenUIHeadingNode | OpenUIKeyValueNode | OpenUIMarkdownNode | OpenUISeparatorNode | OpenUIStackNode | OpenUIStatNode | OpenUITableNode | OpenUITextNode;
|
|
101
|
+
interface OpenUIArtifactRendererProps {
|
|
102
|
+
schema: OpenUIComponentNode | OpenUIComponentNode[];
|
|
103
|
+
onAction?: (action: OpenUIAction) => void;
|
|
104
|
+
className?: string;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* OpenUIArtifactRenderer — contained renderer for OpenUI-like structured
|
|
108
|
+
* artifact payloads using sandbox-ui primitives and theme tokens. This is an
|
|
109
|
+
* extension surface for generated inspectors/results, not a replacement for
|
|
110
|
+
* the sandbox shell.
|
|
111
|
+
*/
|
|
112
|
+
declare function OpenUIArtifactRenderer({ schema, onAction, className }: OpenUIArtifactRendererProps): import("react").JSX.Element;
|
|
113
|
+
//#endregion
|
|
114
|
+
export { OpenUITableNode as _, OpenUIBadgeNode as a, OpenUIComponentNode as c, OpenUIKeyValueNode as d, OpenUIMarkdownNode as f, OpenUIStatNode as g, OpenUIStackNode as h, OpenUIArtifactRendererProps as i, OpenUIGridNode as l, OpenUISeparatorNode as m, OpenUIActionsNode as n, OpenUICardNode as o, OpenUIPrimitive as p, OpenUIArtifactRenderer as r, OpenUICodeNode as s, OpenUIAction as t, OpenUIHeadingNode as u, OpenUITextNode as v };
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { t as cn } from "./utils-C_uf36nf.js";
|
|
2
|
+
import { t as Button } from "./button-uhNnwdsD.js";
|
|
3
|
+
import { c as TableRow, d as Card, f as CardContent, g as CardTitle, h as CardHeader, i as TableCell, l as Badge, n as TableBody, o as TableHead, p as CardDescription, s as TableHeader, t as Table } from "./table-DHyqDPbU.js";
|
|
4
|
+
import { t as CodeBlock } from "./code-block-CngSn37j.js";
|
|
5
|
+
import { t as Markdown } from "./markdown-BprL96Gl.js";
|
|
6
|
+
import { Fragment } from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { Minus } from "lucide-react";
|
|
9
|
+
//#region src/openui/openui-artifact-renderer.tsx
|
|
10
|
+
const NODE_TYPES = /* @__PURE__ */ new Set([
|
|
11
|
+
"heading",
|
|
12
|
+
"text",
|
|
13
|
+
"badge",
|
|
14
|
+
"stat",
|
|
15
|
+
"key_value",
|
|
16
|
+
"code",
|
|
17
|
+
"markdown",
|
|
18
|
+
"table",
|
|
19
|
+
"actions",
|
|
20
|
+
"separator",
|
|
21
|
+
"stack",
|
|
22
|
+
"grid",
|
|
23
|
+
"card"
|
|
24
|
+
]);
|
|
25
|
+
const GAP_STYLES = {
|
|
26
|
+
sm: "gap-2",
|
|
27
|
+
md: "gap-4",
|
|
28
|
+
lg: "gap-6"
|
|
29
|
+
};
|
|
30
|
+
const GRID_STYLES = {
|
|
31
|
+
1: "grid-cols-1",
|
|
32
|
+
2: "grid-cols-1 md:grid-cols-2",
|
|
33
|
+
3: "grid-cols-1 md:grid-cols-3",
|
|
34
|
+
4: "grid-cols-1 md:grid-cols-2 xl:grid-cols-4"
|
|
35
|
+
};
|
|
36
|
+
const ALIGN_STYLES = {
|
|
37
|
+
start: "items-start",
|
|
38
|
+
center: "items-center",
|
|
39
|
+
end: "items-end",
|
|
40
|
+
stretch: "items-stretch"
|
|
41
|
+
};
|
|
42
|
+
function formatValue(value) {
|
|
43
|
+
if (value === null || value === void 0) return /* @__PURE__ */ jsx("span", {
|
|
44
|
+
className: "text-muted-foreground",
|
|
45
|
+
children: "—"
|
|
46
|
+
});
|
|
47
|
+
if (typeof value === "boolean") return value ? "Yes" : "No";
|
|
48
|
+
return value;
|
|
49
|
+
}
|
|
50
|
+
function asArray(value) {
|
|
51
|
+
return Array.isArray(value) ? value : [];
|
|
52
|
+
}
|
|
53
|
+
function isOpenUIComponentNode(value) {
|
|
54
|
+
return typeof value === "object" && value !== null && "type" in value && typeof value.type === "string" && NODE_TYPES.has(value.type);
|
|
55
|
+
}
|
|
56
|
+
function renderActions(actions, onAction) {
|
|
57
|
+
if (actions.length === 0) return null;
|
|
58
|
+
return /* @__PURE__ */ jsx("div", {
|
|
59
|
+
className: "flex flex-wrap items-center gap-2",
|
|
60
|
+
children: actions.map((action) => /* @__PURE__ */ jsx(Button, {
|
|
61
|
+
type: "button",
|
|
62
|
+
size: "sm",
|
|
63
|
+
variant: action.tone ?? "outline",
|
|
64
|
+
disabled: action.disabled,
|
|
65
|
+
onClick: () => {
|
|
66
|
+
action.onPress?.();
|
|
67
|
+
onAction?.(action);
|
|
68
|
+
},
|
|
69
|
+
children: action.label
|
|
70
|
+
}, action.id))
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
function renderNode(node, onAction) {
|
|
74
|
+
switch (node.type) {
|
|
75
|
+
case "heading": {
|
|
76
|
+
const level = node.level ?? 2;
|
|
77
|
+
const HeadingTag = `h${level}`;
|
|
78
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
79
|
+
className: "space-y-1",
|
|
80
|
+
children: [
|
|
81
|
+
node.kicker && /* @__PURE__ */ jsx("div", {
|
|
82
|
+
className: "text-[10px] font-semibold uppercase tracking-[0.16em] text-muted-foreground",
|
|
83
|
+
children: node.kicker
|
|
84
|
+
}),
|
|
85
|
+
/* @__PURE__ */ jsx(HeadingTag, {
|
|
86
|
+
className: cn("font-semibold tracking-tight text-foreground", level === 1 && "text-2xl", level === 2 && "text-xl", level === 3 && "text-lg", level === 4 && "text-base"),
|
|
87
|
+
children: node.text
|
|
88
|
+
}),
|
|
89
|
+
node.meta && /* @__PURE__ */ jsx("p", {
|
|
90
|
+
className: "text-sm text-muted-foreground",
|
|
91
|
+
children: node.meta
|
|
92
|
+
})
|
|
93
|
+
]
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
case "text": return /* @__PURE__ */ jsx("p", {
|
|
97
|
+
className: cn("text-sm leading-6 text-foreground", node.tone === "muted" && "text-muted-foreground", node.tone === "success" && "text-[var(--surface-success-text)]", node.tone === "warning" && "text-[var(--surface-warning-text)]", node.tone === "error" && "text-[var(--surface-danger-text)]", node.mono && "font-mono text-[13px]"),
|
|
98
|
+
children: node.text
|
|
99
|
+
});
|
|
100
|
+
case "badge": return /* @__PURE__ */ jsx(Badge, {
|
|
101
|
+
variant: node.tone ?? "outline",
|
|
102
|
+
children: node.label
|
|
103
|
+
});
|
|
104
|
+
case "stat": return /* @__PURE__ */ jsx(Card, {
|
|
105
|
+
variant: "glass",
|
|
106
|
+
className: "border-border shadow-[var(--shadow-card)]",
|
|
107
|
+
children: /* @__PURE__ */ jsxs(CardContent, {
|
|
108
|
+
className: "space-y-2 p-4",
|
|
109
|
+
children: [
|
|
110
|
+
/* @__PURE__ */ jsx("div", {
|
|
111
|
+
className: "text-xs uppercase tracking-[0.12em] text-muted-foreground",
|
|
112
|
+
children: node.label
|
|
113
|
+
}),
|
|
114
|
+
/* @__PURE__ */ jsx("div", {
|
|
115
|
+
className: "text-2xl font-semibold tracking-tight text-foreground",
|
|
116
|
+
children: node.value
|
|
117
|
+
}),
|
|
118
|
+
node.change && /* @__PURE__ */ jsx("div", {
|
|
119
|
+
className: cn("text-xs", node.tone === "success" && "text-[var(--surface-success-text)]", node.tone === "warning" && "text-[var(--surface-warning-text)]", node.tone === "error" && "text-[var(--surface-danger-text)]", node.tone === "info" && "text-[var(--surface-info-text)]", !node.tone || node.tone === "default" ? "text-muted-foreground" : void 0),
|
|
120
|
+
children: node.change
|
|
121
|
+
})
|
|
122
|
+
]
|
|
123
|
+
})
|
|
124
|
+
});
|
|
125
|
+
case "key_value":
|
|
126
|
+
if (asArray(node.items).length === 0) return null;
|
|
127
|
+
return /* @__PURE__ */ jsx("dl", {
|
|
128
|
+
className: "grid gap-3 sm:grid-cols-2",
|
|
129
|
+
children: asArray(node.items).map((item, index) => /* @__PURE__ */ jsxs("div", {
|
|
130
|
+
className: "rounded-[var(--radius-lg)] border border-border bg-card px-4 py-3",
|
|
131
|
+
children: [/* @__PURE__ */ jsx("dt", {
|
|
132
|
+
className: "text-[11px] uppercase tracking-[0.12em] text-muted-foreground",
|
|
133
|
+
children: item.label
|
|
134
|
+
}), /* @__PURE__ */ jsx("dd", {
|
|
135
|
+
className: cn("mt-1 text-sm font-medium text-foreground", item.tone === "muted" && "text-foreground"),
|
|
136
|
+
children: formatValue(item.value)
|
|
137
|
+
})]
|
|
138
|
+
}, item.id ?? `${item.label}-${index}`))
|
|
139
|
+
});
|
|
140
|
+
case "code": return /* @__PURE__ */ jsxs("div", {
|
|
141
|
+
className: "space-y-2",
|
|
142
|
+
children: [node.title && /* @__PURE__ */ jsx("div", {
|
|
143
|
+
className: "text-xs uppercase tracking-[0.12em] text-muted-foreground",
|
|
144
|
+
children: node.title
|
|
145
|
+
}), /* @__PURE__ */ jsx(CodeBlock, {
|
|
146
|
+
code: node.code,
|
|
147
|
+
language: node.language,
|
|
148
|
+
showLineNumbers: node.showLineNumbers,
|
|
149
|
+
className: "border-border bg-background"
|
|
150
|
+
})]
|
|
151
|
+
});
|
|
152
|
+
case "markdown": return /* @__PURE__ */ jsx("div", {
|
|
153
|
+
className: "rounded-[var(--radius-lg)] border border-border bg-card p-5",
|
|
154
|
+
children: /* @__PURE__ */ jsx(Markdown, {
|
|
155
|
+
className: "prose-sm max-w-none",
|
|
156
|
+
children: node.content
|
|
157
|
+
})
|
|
158
|
+
});
|
|
159
|
+
case "table":
|
|
160
|
+
if (asArray(node.columns).length === 0) return null;
|
|
161
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
162
|
+
className: "overflow-hidden rounded-[var(--radius-lg)] border border-border bg-card",
|
|
163
|
+
children: [/* @__PURE__ */ jsxs(Table, { children: [/* @__PURE__ */ jsx(TableHeader, { children: /* @__PURE__ */ jsx(TableRow, {
|
|
164
|
+
className: "border-border",
|
|
165
|
+
children: asArray(node.columns).map((column) => /* @__PURE__ */ jsx(TableHead, {
|
|
166
|
+
className: cn("h-10 text-[11px] uppercase tracking-[0.1em] text-muted-foreground", column.align === "right" && "text-right"),
|
|
167
|
+
children: column.header
|
|
168
|
+
}, column.key))
|
|
169
|
+
}) }), /* @__PURE__ */ jsx(TableBody, { children: asArray(node.rows).map((row, rowIndex) => /* @__PURE__ */ jsx(TableRow, {
|
|
170
|
+
className: "border-border",
|
|
171
|
+
children: asArray(node.columns).map((column) => /* @__PURE__ */ jsx(TableCell, {
|
|
172
|
+
className: cn("py-3 text-sm text-foreground", column.align === "right" && "text-right tabular-nums"),
|
|
173
|
+
children: formatValue(row[column.key])
|
|
174
|
+
}, column.key))
|
|
175
|
+
}, rowIndex)) })] }), node.caption && /* @__PURE__ */ jsx("div", {
|
|
176
|
+
className: "border-t border-border px-4 py-2 text-xs text-muted-foreground",
|
|
177
|
+
children: node.caption
|
|
178
|
+
})]
|
|
179
|
+
});
|
|
180
|
+
case "actions": return renderActions(asArray(node.actions), onAction);
|
|
181
|
+
case "separator": return /* @__PURE__ */ jsxs("div", {
|
|
182
|
+
className: "flex items-center gap-3",
|
|
183
|
+
children: [
|
|
184
|
+
/* @__PURE__ */ jsx("div", { className: "h-px flex-1 bg-border" }),
|
|
185
|
+
node.label && /* @__PURE__ */ jsx("span", {
|
|
186
|
+
className: "text-[10px] uppercase tracking-[0.14em] text-muted-foreground",
|
|
187
|
+
children: node.label
|
|
188
|
+
}),
|
|
189
|
+
/* @__PURE__ */ jsx("div", { className: "h-px flex-1 bg-border" })
|
|
190
|
+
]
|
|
191
|
+
});
|
|
192
|
+
case "stack":
|
|
193
|
+
if (asArray(node.children).length === 0) return null;
|
|
194
|
+
return /* @__PURE__ */ jsx("div", {
|
|
195
|
+
className: cn("flex", node.direction === "row" ? "flex-row" : "flex-col", GAP_STYLES[node.gap ?? "md"], ALIGN_STYLES[node.align ?? "stretch"], node.wrap && "flex-wrap"),
|
|
196
|
+
children: asArray(node.children).map((child, index) => /* @__PURE__ */ jsx(Fragment, { children: renderNode(child, onAction) }, child.id ?? `${child.type}-${index}`))
|
|
197
|
+
});
|
|
198
|
+
case "grid":
|
|
199
|
+
if (asArray(node.children).length === 0) return null;
|
|
200
|
+
return /* @__PURE__ */ jsx("div", {
|
|
201
|
+
className: cn("grid", GRID_STYLES[node.columns ?? 2], GAP_STYLES[node.gap ?? "md"]),
|
|
202
|
+
children: asArray(node.children).map((child, index) => /* @__PURE__ */ jsx(Fragment, { children: renderNode(child, onAction) }, child.id ?? `${child.type}-${index}`))
|
|
203
|
+
});
|
|
204
|
+
case "card": return /* @__PURE__ */ jsxs(Card, {
|
|
205
|
+
variant: "glass",
|
|
206
|
+
className: "border-border shadow-[var(--shadow-card)]",
|
|
207
|
+
children: [(node.eyebrow || node.title || node.description || node.badge || asArray(node.actions).length > 0) && /* @__PURE__ */ jsxs(CardHeader, {
|
|
208
|
+
className: "gap-2 p-4 pb-0",
|
|
209
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
210
|
+
className: "flex items-start justify-between gap-3",
|
|
211
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
212
|
+
className: "min-w-0 flex-1 space-y-1",
|
|
213
|
+
children: [
|
|
214
|
+
node.eyebrow && /* @__PURE__ */ jsx("div", {
|
|
215
|
+
className: "text-[10px] font-semibold uppercase tracking-[0.16em] text-muted-foreground",
|
|
216
|
+
children: node.eyebrow
|
|
217
|
+
}),
|
|
218
|
+
node.title && /* @__PURE__ */ jsx(CardTitle, {
|
|
219
|
+
className: "text-base text-foreground",
|
|
220
|
+
children: node.title
|
|
221
|
+
}),
|
|
222
|
+
node.description && /* @__PURE__ */ jsx(CardDescription, {
|
|
223
|
+
className: "text-muted-foreground",
|
|
224
|
+
children: node.description
|
|
225
|
+
})
|
|
226
|
+
]
|
|
227
|
+
}), node.badge && /* @__PURE__ */ jsx(Badge, {
|
|
228
|
+
variant: node.badge.tone ?? "outline",
|
|
229
|
+
children: node.badge.label
|
|
230
|
+
})]
|
|
231
|
+
}), asArray(node.actions).length > 0 && renderActions(asArray(node.actions), onAction)]
|
|
232
|
+
}), asArray(node.children).length > 0 && /* @__PURE__ */ jsx(CardContent, {
|
|
233
|
+
className: "space-y-4 p-4",
|
|
234
|
+
children: asArray(node.children).map((child, index) => /* @__PURE__ */ jsx(Fragment, { children: renderNode(child, onAction) }, child.id ?? `${child.type}-${index}`))
|
|
235
|
+
})]
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* OpenUIArtifactRenderer — contained renderer for OpenUI-like structured
|
|
241
|
+
* artifact payloads using sandbox-ui primitives and theme tokens. This is an
|
|
242
|
+
* extension surface for generated inspectors/results, not a replacement for
|
|
243
|
+
* the sandbox shell.
|
|
244
|
+
*/
|
|
245
|
+
function OpenUIArtifactRenderer({ schema, onAction, className }) {
|
|
246
|
+
const nodes = (Array.isArray(schema) ? schema : [schema]).filter(isOpenUIComponentNode);
|
|
247
|
+
if (nodes.length === 0) return /* @__PURE__ */ jsx("div", {
|
|
248
|
+
className: cn("flex min-h-[6rem] items-center justify-center rounded-[var(--radius-xl)] border border-dashed border-border bg-card p-5 text-center", className),
|
|
249
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
250
|
+
className: "space-y-2",
|
|
251
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
252
|
+
className: "mx-auto flex h-10 w-10 items-center justify-center rounded-full bg-muted/50 text-muted-foreground",
|
|
253
|
+
children: /* @__PURE__ */ jsx(Minus, { className: "h-4 w-4" })
|
|
254
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
255
|
+
className: "text-sm font-medium text-foreground",
|
|
256
|
+
children: "No view was generated."
|
|
257
|
+
})]
|
|
258
|
+
})
|
|
259
|
+
});
|
|
260
|
+
return /* @__PURE__ */ jsx("div", {
|
|
261
|
+
className: cn("space-y-4", className),
|
|
262
|
+
children: nodes.map((node, index) => /* @__PURE__ */ jsx(Fragment, { children: renderNode(node, onAction) }, node.id ?? `${node.type}-${index}`))
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
//#endregion
|
|
266
|
+
export { OpenUIArtifactRenderer as t };
|
package/dist/openui.d.ts
CHANGED
|
@@ -1,115 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
type OpenUIPrimitive = string | number | boolean | null | undefined;
|
|
5
|
-
interface OpenUIAction {
|
|
6
|
-
id: string;
|
|
7
|
-
label: string;
|
|
8
|
-
tone?: "default" | "secondary" | "outline" | "ghost" | "destructive";
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
onPress?: () => void;
|
|
11
|
-
}
|
|
12
|
-
interface OpenUIBaseNode {
|
|
13
|
-
id?: string;
|
|
14
|
-
}
|
|
15
|
-
interface OpenUIHeadingNode extends OpenUIBaseNode {
|
|
16
|
-
type: "heading";
|
|
17
|
-
text: string;
|
|
18
|
-
level?: 1 | 2 | 3 | 4;
|
|
19
|
-
kicker?: string;
|
|
20
|
-
meta?: string;
|
|
21
|
-
}
|
|
22
|
-
interface OpenUITextNode extends OpenUIBaseNode {
|
|
23
|
-
type: "text";
|
|
24
|
-
text: string;
|
|
25
|
-
tone?: "default" | "muted" | "success" | "warning" | "error";
|
|
26
|
-
mono?: boolean;
|
|
27
|
-
}
|
|
28
|
-
interface OpenUIBadgeNode extends OpenUIBaseNode {
|
|
29
|
-
type: "badge";
|
|
30
|
-
label: string;
|
|
31
|
-
tone?: "default" | "secondary" | "success" | "warning" | "error" | "info" | "sandbox";
|
|
32
|
-
}
|
|
33
|
-
interface OpenUIStatNode extends OpenUIBaseNode {
|
|
34
|
-
type: "stat";
|
|
35
|
-
label: string;
|
|
36
|
-
value: string;
|
|
37
|
-
change?: string;
|
|
38
|
-
tone?: "default" | "success" | "warning" | "error" | "info";
|
|
39
|
-
}
|
|
40
|
-
interface OpenUIKeyValueNode extends OpenUIBaseNode {
|
|
41
|
-
type: "key_value";
|
|
42
|
-
items: Array<{
|
|
43
|
-
id?: string;
|
|
44
|
-
label: string;
|
|
45
|
-
value: ReactNode | OpenUIPrimitive;
|
|
46
|
-
tone?: "default" | "muted";
|
|
47
|
-
}>;
|
|
48
|
-
}
|
|
49
|
-
interface OpenUICodeNode extends OpenUIBaseNode {
|
|
50
|
-
type: "code";
|
|
51
|
-
code: string;
|
|
52
|
-
language?: string;
|
|
53
|
-
title?: string;
|
|
54
|
-
showLineNumbers?: boolean;
|
|
55
|
-
}
|
|
56
|
-
interface OpenUIMarkdownNode extends OpenUIBaseNode {
|
|
57
|
-
type: "markdown";
|
|
58
|
-
content: string;
|
|
59
|
-
}
|
|
60
|
-
interface OpenUITableNode extends OpenUIBaseNode {
|
|
61
|
-
type: "table";
|
|
62
|
-
columns: Array<{
|
|
63
|
-
key: string;
|
|
64
|
-
header: string;
|
|
65
|
-
align?: "left" | "right";
|
|
66
|
-
}>;
|
|
67
|
-
rows: Array<Record<string, ReactNode | OpenUIPrimitive>>;
|
|
68
|
-
caption?: string;
|
|
69
|
-
}
|
|
70
|
-
interface OpenUIActionsNode extends OpenUIBaseNode {
|
|
71
|
-
type: "actions";
|
|
72
|
-
actions: OpenUIAction[];
|
|
73
|
-
}
|
|
74
|
-
interface OpenUISeparatorNode extends OpenUIBaseNode {
|
|
75
|
-
type: "separator";
|
|
76
|
-
label?: string;
|
|
77
|
-
}
|
|
78
|
-
interface OpenUIStackNode extends OpenUIBaseNode {
|
|
79
|
-
type: "stack";
|
|
80
|
-
direction?: "row" | "column";
|
|
81
|
-
gap?: "sm" | "md" | "lg";
|
|
82
|
-
align?: "start" | "center" | "end" | "stretch";
|
|
83
|
-
wrap?: boolean;
|
|
84
|
-
children: OpenUIComponentNode[];
|
|
85
|
-
}
|
|
86
|
-
interface OpenUIGridNode extends OpenUIBaseNode {
|
|
87
|
-
type: "grid";
|
|
88
|
-
columns?: 1 | 2 | 3 | 4;
|
|
89
|
-
gap?: "sm" | "md" | "lg";
|
|
90
|
-
children: OpenUIComponentNode[];
|
|
91
|
-
}
|
|
92
|
-
interface OpenUICardNode extends OpenUIBaseNode {
|
|
93
|
-
type: "card";
|
|
94
|
-
title?: string;
|
|
95
|
-
description?: string;
|
|
96
|
-
eyebrow?: string;
|
|
97
|
-
badge?: OpenUIBadgeNode;
|
|
98
|
-
actions?: OpenUIAction[];
|
|
99
|
-
children?: OpenUIComponentNode[];
|
|
100
|
-
}
|
|
101
|
-
type OpenUIComponentNode = OpenUIActionsNode | OpenUIBadgeNode | OpenUICardNode | OpenUICodeNode | OpenUIGridNode | OpenUIHeadingNode | OpenUIKeyValueNode | OpenUIMarkdownNode | OpenUISeparatorNode | OpenUIStackNode | OpenUIStatNode | OpenUITableNode | OpenUITextNode;
|
|
102
|
-
interface OpenUIArtifactRendererProps {
|
|
103
|
-
schema: OpenUIComponentNode | OpenUIComponentNode[];
|
|
104
|
-
onAction?: (action: OpenUIAction) => void;
|
|
105
|
-
className?: string;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* OpenUIArtifactRenderer — contained renderer for OpenUI-like structured
|
|
109
|
-
* artifact payloads using sandbox-ui primitives and theme tokens. This is an
|
|
110
|
-
* extension surface for generated inspectors/results, not a replacement for
|
|
111
|
-
* the sandbox shell.
|
|
112
|
-
*/
|
|
113
|
-
declare function OpenUIArtifactRenderer({ schema, onAction, className, }: OpenUIArtifactRendererProps): react_jsx_runtime.JSX.Element;
|
|
114
|
-
|
|
115
|
-
export { type OpenUIAction, type OpenUIActionsNode, OpenUIArtifactRenderer, type OpenUIArtifactRendererProps, type OpenUIBadgeNode, type OpenUICardNode, type OpenUICodeNode, type OpenUIComponentNode, type OpenUIGridNode, type OpenUIHeadingNode, type OpenUIKeyValueNode, type OpenUIMarkdownNode, type OpenUIPrimitive, type OpenUISeparatorNode, type OpenUIStackNode, type OpenUIStatNode, type OpenUITableNode, type OpenUITextNode };
|
|
1
|
+
import { _ as OpenUITableNode, a as OpenUIBadgeNode, c as OpenUIComponentNode, d as OpenUIKeyValueNode, f as OpenUIMarkdownNode, g as OpenUIStatNode, h as OpenUIStackNode, i as OpenUIArtifactRendererProps, l as OpenUIGridNode, m as OpenUISeparatorNode, n as OpenUIActionsNode, o as OpenUICardNode, p as OpenUIPrimitive, r as OpenUIArtifactRenderer, s as OpenUICodeNode, t as OpenUIAction, u as OpenUIHeadingNode, v as OpenUITextNode } from "./openui-artifact-renderer-D3E5bIAI.js";
|
|
2
|
+
export { type OpenUIAction, type OpenUIActionsNode, OpenUIArtifactRenderer, type OpenUIArtifactRendererProps, type OpenUIBadgeNode, type OpenUICardNode, type OpenUICodeNode, type OpenUIComponentNode, type OpenUIGridNode, type OpenUIHeadingNode, type OpenUIKeyValueNode, type OpenUIMarkdownNode, type OpenUIPrimitive, type OpenUISeparatorNode, type OpenUIStackNode, type OpenUIStatNode, type OpenUITableNode, type OpenUITextNode };
|
package/dist/openui.js
CHANGED
|
@@ -1,13 +1,2 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
|
|
3
|
-
OpenUIArtifactRenderer
|
|
4
|
-
} from "./chunk-BEBXZPHW.js";
|
|
5
|
-
import "./chunk-M3QZK62R.js";
|
|
6
|
-
import "./chunk-42PAH5D2.js";
|
|
7
|
-
import "./chunk-OL5GYLHV.js";
|
|
8
|
-
import "./chunk-3XXBZL53.js";
|
|
9
|
-
import "./chunk-WKWBTL2V.js";
|
|
10
|
-
import "./chunk-RQHJBTEU.js";
|
|
11
|
-
export {
|
|
12
|
-
OpenUIArtifactRenderer
|
|
13
|
-
};
|
|
1
|
+
import { t as OpenUIArtifactRenderer } from "./openui-artifact-renderer-DT4xbvWt.js";
|
|
2
|
+
export { OpenUIArtifactRenderer };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
//#region src/types/parts.d.ts
|
|
2
|
+
interface TextPart {
|
|
3
|
+
type: 'text';
|
|
4
|
+
text: string;
|
|
5
|
+
/** If true this text was synthesised client-side (e.g. echo of user input). */
|
|
6
|
+
synthetic?: boolean;
|
|
7
|
+
}
|
|
8
|
+
type ToolStatus = 'pending' | 'running' | 'completed' | 'error';
|
|
9
|
+
interface ToolTime {
|
|
10
|
+
start?: number;
|
|
11
|
+
end?: number;
|
|
12
|
+
}
|
|
13
|
+
interface ToolState {
|
|
14
|
+
status: ToolStatus;
|
|
15
|
+
input?: unknown;
|
|
16
|
+
output?: unknown;
|
|
17
|
+
error?: string;
|
|
18
|
+
metadata?: Record<string, unknown>;
|
|
19
|
+
time?: ToolTime;
|
|
20
|
+
}
|
|
21
|
+
interface ToolPart {
|
|
22
|
+
type: 'tool';
|
|
23
|
+
/** Unique ID for this tool invocation. */
|
|
24
|
+
id: string;
|
|
25
|
+
/** Tool name (e.g. "bash", "read", "write", "grep", "glob"). */
|
|
26
|
+
tool: string;
|
|
27
|
+
state: ToolState;
|
|
28
|
+
callID?: string;
|
|
29
|
+
}
|
|
30
|
+
interface ReasoningPart {
|
|
31
|
+
type: 'reasoning';
|
|
32
|
+
text: string;
|
|
33
|
+
time?: ToolTime;
|
|
34
|
+
}
|
|
35
|
+
type SessionPart = TextPart | ToolPart | ReasoningPart;
|
|
36
|
+
//#endregion
|
|
37
|
+
export { ToolState as a, ToolPart as i, SessionPart as n, ToolStatus as o, TextPart as r, ToolTime as s, ReasoningPart as t };
|