@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,18 +1,3 @@
1
- import * as React from 'react';
2
- import * as react_jsx_runtime from 'react/jsx-runtime';
3
- import { UrlTransform } from 'react-markdown';
4
- export { C as CodeBlock, a as CodeBlockProps, b as CopyButton } from './code-block-0kSpWMnf.js';
5
-
6
- interface MarkdownProps {
7
- children: string;
8
- className?: string;
9
- /** Transform parsed link and image URLs before sanitisation. */
10
- urlTransform?: UrlTransform;
11
- }
12
- /**
13
- * Renders Markdown content with GFM support, XSS sanitisation, and
14
- * custom code block rendering via our CodeBlock component.
15
- */
16
- declare const Markdown: React.MemoExoticComponent<({ children, className, urlTransform }: MarkdownProps) => react_jsx_runtime.JSX.Element>;
17
-
18
- export { Markdown, type MarkdownProps };
1
+ import { n as CodeBlockProps, r as CopyButton, t as CodeBlock } from "./code-block-B9miUPht.js";
2
+ import { n as MarkdownProps, t as Markdown } from "./index-Cq-EJzqW.js";
3
+ export { CodeBlock, type CodeBlockProps, CopyButton, Markdown, type MarkdownProps };
package/dist/markdown.js CHANGED
@@ -1,15 +1,3 @@
1
- import "./chunk-5Z5ZYMOJ.js";
2
- import {
3
- Markdown
4
- } from "./chunk-OL5GYLHV.js";
5
- import {
6
- CodeBlock,
7
- CopyButton
8
- } from "./chunk-3XXBZL53.js";
9
- import "./chunk-WKWBTL2V.js";
10
- import "./chunk-RQHJBTEU.js";
11
- export {
12
- CodeBlock,
13
- CopyButton,
14
- Markdown
15
- };
1
+ import { n as CopyButton, t as CodeBlock } from "./code-block-B36KVUSN.js";
2
+ import { t as Markdown } from "./markdown-BGqicV82.js";
3
+ export { CodeBlock, CopyButton, Markdown };
@@ -0,0 +1,16 @@
1
+ //#region src/types/message.d.ts
2
+ /** A single message in a chat session. */
3
+ interface SessionMessage {
4
+ id: string;
5
+ role: 'user' | 'assistant' | 'system';
6
+ sessionID?: string;
7
+ time?: {
8
+ created?: number;
9
+ updated?: number;
10
+ completed?: number;
11
+ };
12
+ /** Monotonically increasing insertion index for stable ordering. */
13
+ _insertionIndex?: number;
14
+ }
15
+ //#endregion
16
+ export { SessionMessage as t };
package/dist/nav.d.ts CHANGED
@@ -1,7 +1,5 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { LinkProps, NavLinkProps } from 'react-router';
3
- export { LinkProps, NavLinkProps } from 'react-router';
4
-
1
+ import { LinkProps, LinkProps as LinkProps$1, NavLinkProps, NavLinkProps as NavLinkProps$1 } from "react-router";
2
+ //#region src/nav/index.d.ts
5
3
  /**
6
4
  * Navigation primitives that make agent-app products feel snappy by default.
7
5
  *
@@ -18,8 +16,8 @@ export { LinkProps, NavLinkProps } from 'react-router';
18
16
  * wins (the spread is applied after the default).
19
17
  */
20
18
  /** `react-router` `<Link>` with `prefetch="intent"` on by default. */
21
- declare function Link({ prefetch, ...props }: LinkProps): react_jsx_runtime.JSX.Element;
19
+ export declare function Link({ prefetch, ...props }: LinkProps$1): import("react").JSX.Element;
22
20
  /** `react-router` `<NavLink>` with `prefetch="intent"` on by default. */
23
- declare function NavLink({ prefetch, ...props }: NavLinkProps): react_jsx_runtime.JSX.Element;
24
-
25
- export { Link, NavLink };
21
+ export declare function NavLink({ prefetch, ...props }: NavLinkProps$1): import("react").JSX.Element;
22
+ //#endregion
23
+ export type { LinkProps, NavLinkProps };
package/dist/nav.js CHANGED
@@ -1,16 +1,34 @@
1
- // src/nav/index.tsx
2
- import {
3
- Link as RRLink,
4
- NavLink as RRNavLink
5
- } from "react-router";
6
1
  import { jsx } from "react/jsx-runtime";
2
+ import { Link as Link$1, NavLink as NavLink$1 } from "react-router";
3
+ //#region src/nav/index.tsx
4
+ /**
5
+ * Navigation primitives that make agent-app products feel snappy by default.
6
+ *
7
+ * The dominant source of the "1–2s when I click through pages" latency in the
8
+ * fleet is NOT slow queries (route loaders' D1 indexes already cover their
9
+ * filters) — it is that every click is a COLD loader round-trip the user waits
10
+ * on, because bare `<Link>`s do no prefetching. React Router can fire the
11
+ * target route's loader on hover/focus (`prefetch="intent"`), overlapping the
12
+ * round-trip with the user's mouse travel so the transition feels instant.
13
+ *
14
+ * These wrappers default `prefetch="intent"` so a product gets that behaviour
15
+ * by importing the shared `<Link>` instead of remembering the flag on every
16
+ * nav element. The default is overridable — a caller that passes `prefetch`
17
+ * wins (the spread is applied after the default).
18
+ */
19
+ /** `react-router` `<Link>` with `prefetch="intent"` on by default. */
7
20
  function Link({ prefetch = "intent", ...props }) {
8
- return /* @__PURE__ */ jsx(RRLink, { prefetch, ...props });
21
+ return /* @__PURE__ */ jsx(Link$1, {
22
+ prefetch,
23
+ ...props
24
+ });
9
25
  }
26
+ /** `react-router` `<NavLink>` with `prefetch="intent"` on by default. */
10
27
  function NavLink({ prefetch = "intent", ...props }) {
11
- return /* @__PURE__ */ jsx(RRNavLink, { prefetch, ...props });
28
+ return /* @__PURE__ */ jsx(NavLink$1, {
29
+ prefetch,
30
+ ...props
31
+ });
12
32
  }
13
- export {
14
- Link,
15
- NavLink
16
- };
33
+ //#endregion
34
+ export { Link, NavLink };
@@ -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-C87nEe2R.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-Bss73DhB.js";
4
+ import { t as CodeBlock } from "./code-block-B36KVUSN.js";
5
+ import { t as Markdown } from "./markdown-BGqicV82.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 * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ReactNode } from 'react';
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 "./chunk-RQGKSCEZ.js";
2
- import {
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-DrU1AdVk.js";
2
+ export { OpenUIArtifactRenderer };