@tangle-network/ui 11.11.8 → 11.13.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 +24 -0
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/auth/auth.d.ts +53 -0
- package/dist/{auth-DOETfnd9.js → auth/auth.js} +7 -37
- package/dist/auth/login-layout.d.ts +20 -0
- package/dist/auth/login-layout.js +36 -0
- package/dist/auth.d.ts +2 -1
- package/dist/auth.js +2 -1
- package/dist/chat/agent-timeline.d.ts +83 -0
- package/dist/chat/agent-timeline.js +236 -0
- package/dist/chat/chat-container.d.ts +51 -0
- package/dist/chat/chat-container.js +309 -0
- package/dist/chat/chat-message.d.ts +22 -0
- package/dist/chat/chat-message.js +38 -0
- package/dist/chat/message-list.d.ts +32 -0
- package/dist/chat/message-list.js +37 -0
- package/dist/chat/thinking-indicator.d.ts +6 -0
- package/dist/chat/thinking-indicator.js +38 -0
- package/dist/chat/user-message.d.ts +21 -0
- package/dist/chat/user-message.js +42 -0
- package/dist/chat.d.ts +6 -1
- package/dist/chat.js +6 -1
- package/dist/editor/document-editor-pane.d.ts +37 -0
- package/dist/editor/document-editor-pane.js +199 -0
- package/dist/editor/editor-lazy.js +37 -0
- package/dist/editor/editor-loading.js +21 -0
- package/dist/editor/editor-peers.d.ts +6 -0
- package/dist/editor/editor-peers.js +155 -0
- package/dist/{document-editor-pane-DHM8DDhb.d.ts → editor/editor-provider.d.ts} +10 -47
- package/dist/editor/editor-provider.js +253 -0
- package/dist/editor/editor-toolbar.d.ts +11 -0
- package/dist/editor/editor-toolbar.js +106 -0
- package/dist/editor/markdown-conversion.js +23 -0
- package/dist/editor/markdown-document-editor.js +103 -0
- package/dist/editor/tiptap-editor.d.ts +45 -0
- package/dist/editor/tiptap-editor.js +271 -0
- package/dist/editor/use-editor.d.ts +67 -0
- package/dist/editor/use-editor.js +158 -0
- package/dist/editor.d.ts +6 -119
- package/dist/editor.js +5 -1
- package/dist/files/file-artifact-pane.d.ts +47 -0
- package/dist/files/file-artifact-pane.js +114 -0
- package/dist/files/file-format.d.ts +51 -0
- package/dist/{file-format-BgXbr-Ib.js → files/file-format.js} +1 -1
- package/dist/files/file-preview.d.ts +27 -0
- package/dist/files/file-preview.js +359 -0
- package/dist/files/file-tabs.d.ts +19 -0
- package/dist/files/file-tabs.js +48 -0
- package/dist/files/file-tree.d.ts +31 -0
- package/dist/files/file-tree.js +135 -0
- package/dist/files/rich-file-tree.d.ts +62 -0
- package/dist/files/rich-file-tree.js +122 -0
- package/dist/files.d.ts +6 -1
- package/dist/files.js +6 -2
- package/dist/hooks/use-auth.d.ts +40 -0
- package/dist/hooks/use-auth.js +91 -0
- package/dist/hooks/use-auto-scroll.d.ts +11 -0
- package/dist/hooks/use-auto-scroll.js +48 -0
- package/dist/hooks/use-dropdown-menu.d.ts +12 -0
- package/dist/hooks/use-dropdown-menu.js +31 -0
- package/dist/hooks/use-live-time.d.ts +7 -0
- package/dist/hooks/use-live-time.js +22 -0
- package/dist/hooks/use-realtime-session.d.ts +32 -0
- package/dist/hooks/use-realtime-session.js +235 -0
- package/dist/hooks/use-run-collapse-state.d.ts +13 -0
- package/dist/hooks/use-run-collapse-state.js +24 -0
- package/dist/hooks/use-run-groups.d.ts +11 -0
- package/dist/hooks/use-run-groups.js +85 -0
- package/dist/hooks/use-sdk-session.d.ts +59 -0
- package/dist/hooks/use-sdk-session.js +322 -0
- package/dist/hooks/use-sse-stream.d.ts +124 -0
- package/dist/hooks/use-sse-stream.js +229 -0
- package/dist/hooks/use-tool-call-stream.d.ts +23 -0
- package/dist/hooks/use-tool-call-stream.js +75 -0
- package/dist/hooks.d.ts +11 -49
- package/dist/hooks.js +10 -110
- package/dist/index.d.ts +99 -25
- package/dist/index.js +86 -36
- package/dist/lib/focus.d.ts +55 -0
- package/dist/{focus-BcE_SHqz.js → lib/focus.js} +1 -1
- package/dist/lib/utils.d.ts +4 -0
- package/dist/{utils-C_uf36nf.js → lib/utils.js} +1 -1
- package/dist/{code-block-B9miUPht.d.ts → markdown/code-block.d.ts} +5 -6
- package/dist/{code-block-B36KVUSN.js → markdown/code-block.js} +22 -47
- package/dist/{markdown-C0atSabr.d.ts → markdown/markdown.d.ts} +4 -5
- package/dist/{markdown-Db08KAYF.js → markdown/markdown.js} +3 -3
- package/dist/markdown.d.ts +2 -2
- package/dist/markdown.js +2 -2
- package/dist/{openui-artifact-renderer-fkBQaoLO.d.ts → openui/openui-artifact-renderer.d.ts} +20 -21
- package/dist/{openui-artifact-renderer-DG_i2lOR.js → openui/openui-artifact-renderer.js} +9 -7
- package/dist/{schema-BpW9rSSG.js → openui/schema-compiled.js} +2 -354
- package/dist/{schema-DAstk-J4.d.ts → openui/schema-data.d.ts} +3 -24
- package/dist/openui/schema-data.js +206 -0
- package/dist/openui-schema.d.ts +22 -3
- package/dist/openui-schema.js +138 -1
- package/dist/openui.d.ts +3 -2
- package/dist/openui.js +3 -2
- package/dist/{artifact-pane-BL_DFWNl.d.ts → primitives/artifact-pane.d.ts} +3 -4
- package/dist/{artifact-pane-DMXT9a8U.js → primitives/artifact-pane.js} +2 -2
- package/dist/primitives/avatar.d.ts +8 -0
- package/dist/primitives/avatar.js +25 -0
- package/dist/primitives/badge.d.ts +22 -0
- package/dist/primitives/badge.js +47 -0
- package/dist/{button-yoIv77e2.d.ts → primitives/button.d.ts} +2 -2
- package/dist/primitives/button.js +113 -0
- package/dist/primitives/card.d.ts +18 -0
- package/dist/primitives/card.js +52 -0
- package/dist/primitives/code-block.d.ts +6 -0
- package/dist/primitives/code-block.js +13 -0
- package/dist/primitives/dialog.d.ts +23 -0
- package/dist/primitives/dialog.js +59 -0
- package/dist/primitives/drop-zone.d.ts +23 -0
- package/dist/primitives/drop-zone.js +104 -0
- package/dist/primitives/dropdown-menu.d.ts +29 -0
- package/dist/{dropdown-menu-BpcLa5vF.js → primitives/dropdown-menu.js} +2 -23
- package/dist/primitives/empty-state.d.ts +11 -0
- package/dist/primitives/empty-state.js +32 -0
- package/dist/primitives/heading.d.ts +23 -0
- package/dist/primitives/heading.js +38 -0
- package/dist/primitives/input.d.ts +23 -0
- package/dist/primitives/input.js +110 -0
- package/dist/primitives/label.d.ts +6 -0
- package/dist/primitives/label.js +16 -0
- package/dist/primitives/metric-strip.d.ts +48 -0
- package/dist/primitives/metric-strip.js +52 -0
- package/dist/primitives/page-header.d.ts +25 -0
- package/dist/primitives/page-header.js +47 -0
- package/dist/primitives/page-shell.d.ts +14 -0
- package/dist/primitives/page-shell.js +17 -0
- package/dist/primitives/progress.d.ts +9 -0
- package/dist/primitives/progress.js +29 -0
- package/dist/primitives/segmented-control.d.ts +40 -0
- package/dist/primitives/segmented-control.js +57 -0
- package/dist/primitives/select.d.ts +15 -0
- package/dist/primitives/select.js +74 -0
- package/dist/primitives/sidebar-drop-zone.d.ts +21 -0
- package/dist/primitives/sidebar-drop-zone.js +88 -0
- package/dist/primitives/skeleton.d.ts +10 -0
- package/dist/primitives/skeleton.js +50 -0
- package/dist/primitives/stat-card.d.ts +16 -0
- package/dist/primitives/stat-card.js +60 -0
- package/dist/primitives/status-pill.d.ts +44 -0
- package/dist/primitives/status-pill.js +119 -0
- package/dist/primitives/switch.d.ts +6 -0
- package/dist/primitives/switch.js +16 -0
- package/dist/primitives/table.d.ts +22 -0
- package/dist/primitives/table.js +63 -0
- package/dist/primitives/tabs.d.ts +13 -0
- package/dist/{tabs-BVHR6NkO.js → primitives/tabs.js} +3 -3
- package/dist/primitives/terminal-display.d.ts +25 -0
- package/dist/primitives/terminal-display.js +109 -0
- package/dist/primitives/text-shimmer.d.ts +16 -0
- package/dist/{text-shimmer-BUUo6I-g.js → primitives/text-shimmer.js} +2 -2
- package/dist/primitives/theme-toggle.d.ts +11 -0
- package/dist/primitives/theme-toggle.js +154 -0
- package/dist/primitives/toast.d.ts +29 -0
- package/dist/primitives/toast.js +142 -0
- package/dist/primitives/toolbar.d.ts +55 -0
- package/dist/primitives/toolbar.js +37 -0
- package/dist/primitives/upload-progress.d.ts +23 -0
- package/dist/primitives/upload-progress.js +72 -0
- package/dist/primitives.d.ts +35 -5
- package/dist/primitives.js +35 -9
- package/dist/{index-COgqsFAQ.d.ts → redaction/redacted-document.d.ts} +6 -7
- package/dist/{redaction-CGGB2ENG.js → redaction/redacted-document.js} +2 -2
- package/dist/redaction.d.ts +1 -1
- package/dist/redaction.js +1 -1
- package/dist/run/expandable-content.js +41 -0
- package/dist/run/expanded-tool-detail.d.ts +12 -0
- package/dist/run/expanded-tool-detail.js +163 -0
- package/dist/run/inline-thinking-item.d.ts +11 -0
- package/dist/run/inline-thinking-item.js +60 -0
- package/dist/run/inline-tool-item.d.ts +25 -0
- package/dist/run/inline-tool-item.js +63 -0
- package/dist/run/run-group.d.ts +26 -0
- package/dist/{run-group-BWGeesgs.js → run/run-group.js} +9 -60
- package/dist/run/run-item-primitives.d.ts +5 -0
- package/dist/{run-ZsIKPA6J.js → run/run-item-primitives.js} +2 -2
- package/dist/run/run-row-shell.d.ts +53 -0
- package/dist/run/run-row-shell.js +114 -0
- package/dist/{tool-call-feed-BeB1_4pX.d.ts → run/tool-call-feed.d.ts} +7 -12
- package/dist/{tool-call-feed-BpmMLpPX.js → run/tool-call-feed.js} +4 -4
- package/dist/run/tool-call-step.d.ts +5 -0
- package/dist/run/tool-call-step.js +82 -0
- package/dist/run.d.ts +8 -2
- package/dist/run.js +7 -4
- package/dist/sdk-hooks.d.ts +8 -1
- package/dist/sdk-hooks.js +8 -2
- package/dist/stores/active-sessions-store.d.ts +83 -0
- package/dist/{active-sessions-store-Gt1R0rFG.js → stores/active-sessions-store.js} +1 -1
- package/dist/stores/chat-store.d.ts +14 -0
- package/dist/stores/chat-store.js +33 -0
- package/dist/stores.d.ts +3 -16
- package/dist/stores.js +2 -33
- package/dist/tool-previews/command-preview.d.ts +11 -0
- package/dist/tool-previews/command-preview.js +91 -0
- package/dist/tool-previews/diff-preview.d.ts +7 -0
- package/dist/tool-previews/diff-preview.js +76 -0
- package/dist/tool-previews/glob-results-preview.d.ts +7 -0
- package/dist/tool-previews/glob-results-preview.js +53 -0
- package/dist/tool-previews/grep-results-preview.d.ts +7 -0
- package/dist/tool-previews/grep-results-preview.js +99 -0
- package/dist/tool-previews/preview-primitives.js +58 -0
- package/dist/tool-previews/question-preview.d.ts +7 -0
- package/dist/tool-previews/question-preview.js +63 -0
- package/dist/tool-previews/web-search-preview.d.ts +7 -0
- package/dist/tool-previews/web-search-preview.js +78 -0
- package/dist/tool-previews/write-file-preview.d.ts +11 -0
- package/dist/tool-previews/write-file-preview.js +52 -0
- package/dist/tool-previews.d.ts +7 -1
- package/dist/tool-previews.js +7 -1
- package/dist/{branding-26d5ARIr.d.ts → types/branding.d.ts} +2 -3
- package/dist/{message-vhUI0c5G.d.ts → types/message.d.ts} +2 -3
- package/dist/{parts-5mhy9yJ3.d.ts → types/parts.d.ts} +8 -9
- package/dist/{run-OyWmIDqu.d.ts → types/run.d.ts} +9 -10
- package/dist/{tool-display-DgmL5rIU.d.ts → types/tool-display.d.ts} +5 -6
- package/dist/types.d.ts +5 -5
- package/dist/utils/copy-text.d.ts +7 -0
- package/dist/{utils-Bl_CZ0Qp.js → utils/copy-text.js} +1 -11
- package/dist/utils/format.d.ts +22 -0
- package/dist/{format-DfcLWqMa.js → utils/format.js} +1 -1
- package/dist/utils/time-ago.d.ts +3 -0
- package/dist/utils/time-ago.js +11 -0
- package/dist/utils/tool-display.d.ts +16 -0
- package/dist/{tool-display-BAuAVa43.js → utils/tool-display.js} +1 -1
- package/dist/utils.d.ts +6 -1
- package/dist/utils.js +6 -5
- package/package.json +2 -2
- package/src/editor/document-editor-pane.tsx +4 -1
- package/src/files/file-artifact-pane.test.tsx +23 -0
- package/src/files/file-artifact-pane.tsx +3 -0
- package/src/files/rich-file-tree.stories.tsx +1 -1
- package/src/files/rich-file-tree.tsx +12 -9
- package/src/markdown/code-block.test.tsx +46 -2
- package/src/markdown/code-block.tsx +23 -60
- package/src/markdown/markdown.test.tsx +3 -2
- package/src/primitives/button.stories.tsx +37 -1
- package/src/primitives/button.test.tsx +230 -0
- package/src/primitives/button.tsx +62 -14
- package/src/primitives/card-anatomy.stories.tsx +51 -0
- package/src/primitives/card.test.tsx +71 -0
- package/src/primitives/card.tsx +25 -13
- package/src/primitives/heading.stories.tsx +35 -0
- package/src/primitives/heading.test.tsx +56 -0
- package/src/primitives/heading.tsx +76 -0
- package/src/primitives/index.ts +8 -0
- package/src/primitives/input.stories.tsx +28 -0
- package/src/primitives/input.test.tsx +161 -0
- package/src/primitives/input.tsx +34 -28
- package/src/primitives/page-header.stories.tsx +51 -0
- package/src/primitives/page-header.test.tsx +48 -0
- package/src/primitives/page-header.tsx +35 -35
- package/src/primitives/page-shell.stories.tsx +89 -0
- package/src/primitives/page-shell.test.tsx +24 -0
- package/src/primitives/page-shell.tsx +26 -0
- package/src/primitives/table-wrapper.stories.tsx +54 -0
- package/src/primitives/table.test.tsx +72 -0
- package/src/primitives/table.tsx +33 -12
- package/src/primitives/theme-toggle.test.tsx +167 -0
- package/src/primitives/theme-toggle.tsx +111 -39
- package/dist/active-sessions-store-nl70ZnMC.d.ts +0 -84
- package/dist/button-C87nEe2R.js +0 -78
- package/dist/chat-DDvF2oGQ.js +0 -672
- package/dist/diff-preview-BcK3nRXb.js +0 -533
- package/dist/document-editor-pane-CsFbH2qo.js +0 -1279
- package/dist/files--Unn___t.js +0 -752
- package/dist/index-2UntyjBb.d.ts +0 -52
- package/dist/index-BgUHilZm.d.ts +0 -108
- package/dist/index-CPDET_s1.d.ts +0 -549
- package/dist/index-Cg6gYAqh.d.ts +0 -73
- package/dist/index-Cs7j8V7l.d.ts +0 -203
- package/dist/index-CyGSLGVF.d.ts +0 -234
- package/dist/index-DjKxO357.d.ts +0 -128
- package/dist/primitives-Bx59fT-U.js +0 -1239
- package/dist/table-Bss73DhB.js +0 -146
- package/dist/tool-call-step-DNebqhmX.js +0 -434
- package/dist/use-auto-scroll-C5Pjeqon.js +0 -153
- package/dist/use-sse-stream-DjqRuDft.js +0 -884
- package/dist/use-sse-stream-Dm6R5YWz.d.ts +0 -282
package/dist/openui-schema.js
CHANGED
|
@@ -1,2 +1,139 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { OPENUI_NODE_JSON_SCHEMA, OPENUI_NODE_TYPES } from "./openui/schema-data.js";
|
|
2
|
+
import { schema_compiled_exports } from "./openui/schema-compiled.js";
|
|
3
|
+
//#region src/openui/schema.ts
|
|
4
|
+
const nodeTypes = new Set(OPENUI_NODE_TYPES);
|
|
5
|
+
/** Find an unsupported node at any depth before the renderer can omit it. */
|
|
6
|
+
function findUnsupportedOpenUINode(value) {
|
|
7
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
8
|
+
let count = 0;
|
|
9
|
+
function visit(candidate, path, depth) {
|
|
10
|
+
if (depth > 32 || ++count > 1e3) return {
|
|
11
|
+
path,
|
|
12
|
+
message: "OpenUI exceeds the 32-level or 1000-node limit."
|
|
13
|
+
};
|
|
14
|
+
if (!candidate || typeof candidate !== "object" || Array.isArray(candidate)) return {
|
|
15
|
+
path,
|
|
16
|
+
message: "Expected an OpenUI node object."
|
|
17
|
+
};
|
|
18
|
+
if (seen.has(candidate)) return {
|
|
19
|
+
path,
|
|
20
|
+
message: "OpenUI nodes must not contain cycles."
|
|
21
|
+
};
|
|
22
|
+
seen.add(candidate);
|
|
23
|
+
const record = candidate;
|
|
24
|
+
if (typeof record.type !== "string" || !nodeTypes.has(record.type)) return {
|
|
25
|
+
path,
|
|
26
|
+
message: `Unsupported OpenUI node type: ${String(record.type)}.`
|
|
27
|
+
};
|
|
28
|
+
if (record.type === "stack" || record.type === "grid" || record.type === "card") {
|
|
29
|
+
if (Array.isArray(record.children)) for (const [index, child] of record.children.entries()) {
|
|
30
|
+
const issue = visit(child, `${path}.children[${index}]`, depth + 1);
|
|
31
|
+
if (issue) return issue;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (record.type === "card" && record.badge !== void 0) return visit(record.badge, `${path}.badge`, depth + 1);
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
if (Array.isArray(value)) {
|
|
38
|
+
for (const [index, candidate] of value.entries()) {
|
|
39
|
+
const issue = visit(candidate, `$[${index}]`, 0);
|
|
40
|
+
if (issue) return issue;
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
return visit(value, "$", 0);
|
|
45
|
+
}
|
|
46
|
+
/** Validate one model-authored JSON node before a product persists or spends on it. */
|
|
47
|
+
function validateOpenUIJsonNode(value) {
|
|
48
|
+
if (Array.isArray(value)) return {
|
|
49
|
+
ok: false,
|
|
50
|
+
issue: {
|
|
51
|
+
path: "$",
|
|
52
|
+
message: "Expected one OpenUI node object; use validateOpenUIJsonArtifact for arrays."
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const unsupported = findUnsupportedOpenUINode(value);
|
|
56
|
+
if (unsupported) return {
|
|
57
|
+
ok: false,
|
|
58
|
+
issue: unsupported
|
|
59
|
+
};
|
|
60
|
+
const result = validateNode(value, "$", 0);
|
|
61
|
+
return result.ok ? {
|
|
62
|
+
ok: true,
|
|
63
|
+
value
|
|
64
|
+
} : result;
|
|
65
|
+
}
|
|
66
|
+
/** Validate the renderer's single-node or nonempty node-array artifact shape. */
|
|
67
|
+
function validateOpenUIJsonArtifact(value) {
|
|
68
|
+
if (!Array.isArray(value)) return validateOpenUIJsonNode(value);
|
|
69
|
+
if (value.length === 0) return {
|
|
70
|
+
ok: false,
|
|
71
|
+
issue: {
|
|
72
|
+
path: "$",
|
|
73
|
+
message: "An OpenUI artifact needs at least one node."
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
const unsupported = findUnsupportedOpenUINode(value);
|
|
77
|
+
if (unsupported) return {
|
|
78
|
+
ok: false,
|
|
79
|
+
issue: unsupported
|
|
80
|
+
};
|
|
81
|
+
for (const [index, node] of value.entries()) {
|
|
82
|
+
const result = validateOpenUIJsonNode(node);
|
|
83
|
+
if (!result.ok) return {
|
|
84
|
+
ok: false,
|
|
85
|
+
issue: {
|
|
86
|
+
...result.issue,
|
|
87
|
+
path: `$[${index}]${result.issue.path.slice(1)}`
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
ok: true,
|
|
93
|
+
value
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function validateNode(record, path, depth) {
|
|
97
|
+
if (depth > 32) return {
|
|
98
|
+
ok: false,
|
|
99
|
+
issue: {
|
|
100
|
+
path,
|
|
101
|
+
message: "OpenUI exceeds the 32-level limit."
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
if (record.type === "stack" || record.type === "grid" || record.type === "card") {
|
|
105
|
+
if (Array.isArray(record.children)) for (const [index, child] of record.children.entries()) {
|
|
106
|
+
const result = validateNode(child, `${path}.children[${index}]`, depth + 1);
|
|
107
|
+
if (!result.ok) return result;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if (record.type === "card" && record.badge && typeof record.badge === "object") {
|
|
111
|
+
const result = validateNode(record.badge, `${path}.badge`, depth + 1);
|
|
112
|
+
if (!result.ok) return result;
|
|
113
|
+
}
|
|
114
|
+
const validator = schema_compiled_exports[record.type];
|
|
115
|
+
if (!validator(record)) {
|
|
116
|
+
const error = validator.errors?.[0];
|
|
117
|
+
const field = error?.keyword === "required" ? String(error.params.missingProperty) : error?.keyword === "additionalProperties" ? String(error.params.additionalProperty) : null;
|
|
118
|
+
return {
|
|
119
|
+
ok: false,
|
|
120
|
+
issue: {
|
|
121
|
+
path: `${path}${`${error?.instancePath ?? ""}${field ? `/${field}` : ""}`.replaceAll(/\/(\d+)/g, "[$1]").replaceAll("/", ".")}`,
|
|
122
|
+
message: error?.message ?? "Invalid OpenUI node."
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
if (record.type === "table") {
|
|
127
|
+
const columns = new Set(record.columns.map((column) => column.key));
|
|
128
|
+
for (const [index, row] of record.rows.entries()) for (const key of Object.keys(row)) if (!columns.has(key)) return {
|
|
129
|
+
ok: false,
|
|
130
|
+
issue: {
|
|
131
|
+
path: `${path}.rows[${index}].${key}`,
|
|
132
|
+
message: `Table cell ${key} has no displayed column.`
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
return { ok: true };
|
|
137
|
+
}
|
|
138
|
+
//#endregion
|
|
2
139
|
export { OPENUI_NODE_JSON_SCHEMA, OPENUI_NODE_TYPES, findUnsupportedOpenUINode, validateOpenUIJsonArtifact, validateOpenUIJsonNode };
|
package/dist/openui.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { OpenUIAction, OpenUIActionsNode, OpenUIArtifactRenderer, OpenUIArtifactRendererProps, OpenUIBadgeNode, OpenUICardNode, OpenUICodeNode, OpenUIComponentNode, OpenUIGridNode, OpenUIHeadingNode, OpenUIKeyValueNode, OpenUIMarkdownNode, OpenUIPrimitive, OpenUISeparatorNode, OpenUIStackNode, OpenUIStatNode, OpenUITableNode, OpenUITextNode } from "./openui/openui-artifact-renderer.js";
|
|
2
|
+
import { OPENUI_NODE_JSON_SCHEMA, OPENUI_NODE_TYPES } from "./openui/schema-data.js";
|
|
3
|
+
import { OpenUISchemaIssue, OpenUISchemaValidation, findUnsupportedOpenUINode, validateOpenUIJsonArtifact, validateOpenUIJsonNode } from "./openui-schema.js";
|
|
3
4
|
export { OPENUI_NODE_JSON_SCHEMA, OPENUI_NODE_TYPES, 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 OpenUISchemaIssue, type OpenUISchemaValidation, type OpenUISeparatorNode, type OpenUIStackNode, type OpenUIStatNode, type OpenUITableNode, type OpenUITextNode, findUnsupportedOpenUINode, validateOpenUIJsonArtifact, validateOpenUIJsonNode };
|
package/dist/openui.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { OPENUI_NODE_JSON_SCHEMA, OPENUI_NODE_TYPES } from "./openui/schema-data.js";
|
|
2
|
+
import { findUnsupportedOpenUINode, validateOpenUIJsonArtifact, validateOpenUIJsonNode } from "./openui-schema.js";
|
|
3
|
+
import { OpenUIArtifactRenderer } from "./openui/openui-artifact-renderer.js";
|
|
3
4
|
export { OPENUI_NODE_JSON_SCHEMA, OPENUI_NODE_TYPES, OpenUIArtifactRenderer, findUnsupportedOpenUINode, validateOpenUIJsonArtifact, validateOpenUIJsonNode };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
//#region src/primitives/artifact-pane.d.ts
|
|
3
|
-
interface ArtifactPaneProps {
|
|
3
|
+
export interface ArtifactPaneProps {
|
|
4
4
|
eyebrow?: ReactNode;
|
|
5
5
|
title: ReactNode;
|
|
6
6
|
subtitle?: ReactNode;
|
|
@@ -27,6 +27,5 @@ interface ArtifactPaneProps {
|
|
|
27
27
|
* ArtifactPane — shared frame for files, previews, documents, inspectors, and
|
|
28
28
|
* other artifact-like surfaces inside sandbox applications.
|
|
29
29
|
*/
|
|
30
|
-
declare function ArtifactPane({ eyebrow, title, subtitle, meta, headerActions, tabs, toolbar, footer, emptyState, children, className, contentClassName, headerClassName, hideTitleBlock }: ArtifactPaneProps): import("react").JSX.Element;
|
|
31
|
-
//#endregion
|
|
32
|
-
export { ArtifactPaneProps as n, ArtifactPane as t };
|
|
30
|
+
export declare function ArtifactPane({ eyebrow, title, subtitle, meta, headerActions, tabs, toolbar, footer, emptyState, children, className, contentClassName, headerClassName, hideTitleBlock }: ArtifactPaneProps): import("react").JSX.Element;
|
|
31
|
+
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
//#region src/primitives/artifact-pane.tsx
|
|
4
4
|
/**
|
|
@@ -67,4 +67,4 @@ function ArtifactPane({ eyebrow, title, subtitle, meta, headerActions, tabs, too
|
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
69
|
//#endregion
|
|
70
|
-
export { ArtifactPane
|
|
70
|
+
export { ArtifactPane };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
|
3
|
+
//#region src/primitives/avatar.d.ts
|
|
4
|
+
declare const Avatar: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
5
|
+
declare const AvatarImage: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarImageProps & React.RefAttributes<HTMLImageElement>, "ref"> & React.RefAttributes<HTMLImageElement>>;
|
|
6
|
+
declare const AvatarFallback: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarFallbackProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { Avatar, AvatarFallback, AvatarImage };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
|
5
|
+
//#region src/primitives/avatar.tsx
|
|
6
|
+
const Avatar = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(AvatarPrimitive.Root, {
|
|
7
|
+
ref,
|
|
8
|
+
className: cn("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full", className),
|
|
9
|
+
...props
|
|
10
|
+
}));
|
|
11
|
+
Avatar.displayName = AvatarPrimitive.Root.displayName;
|
|
12
|
+
const AvatarImage = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(AvatarPrimitive.Image, {
|
|
13
|
+
ref,
|
|
14
|
+
className: cn("aspect-square h-full w-full", className),
|
|
15
|
+
...props
|
|
16
|
+
}));
|
|
17
|
+
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
|
|
18
|
+
const AvatarFallback = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(AvatarPrimitive.Fallback, {
|
|
19
|
+
ref,
|
|
20
|
+
className: cn("flex h-full w-full items-center justify-center rounded-full bg-muted font-medium text-sm", className),
|
|
21
|
+
...props
|
|
22
|
+
}));
|
|
23
|
+
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { Avatar, AvatarFallback, AvatarImage };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { VariantProps } from "class-variance-authority";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
//#region src/primitives/badge.d.ts
|
|
4
|
+
declare const badgeVariants: (props?: ({
|
|
5
|
+
variant?: "cold" | "creating" | "default" | "deleted" | "destructive" | "error" | "info" | "outline" | "running" | "sandbox" | "secondary" | "stopped" | "success" | "warm" | "warning" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
export type BadgeVariant = "default" | "secondary" | "destructive" | "outline" | "success" | "warning" | "error" | "info" | "sandbox" | "running" | "creating" | "stopped" | "warm" | "cold" | "deleted" | null;
|
|
8
|
+
export interface BadgeProps extends VariantProps<typeof badgeVariants> {
|
|
9
|
+
variant?: BadgeVariant;
|
|
10
|
+
className?: string;
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
dot?: boolean;
|
|
13
|
+
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
14
|
+
style?: React.CSSProperties;
|
|
15
|
+
id?: string;
|
|
16
|
+
role?: React.AriaRole;
|
|
17
|
+
title?: string;
|
|
18
|
+
[key: string]: unknown;
|
|
19
|
+
}
|
|
20
|
+
declare function Badge({ className, variant, dot, children, ...props }: BadgeProps): React.JSX.Element;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { Badge, badgeVariants };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { focusRing } from "../lib/focus.js";
|
|
2
|
+
import { cn } from "../lib/utils.js";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/primitives/badge.tsx
|
|
6
|
+
const badgeVariants = cva(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 font-medium text-xs transition-colors ${focusRing}`, {
|
|
7
|
+
variants: { variant: {
|
|
8
|
+
default: "border-transparent bg-primary text-primary-foreground",
|
|
9
|
+
secondary: "border-transparent bg-secondary text-secondary-foreground",
|
|
10
|
+
destructive: "border-transparent bg-destructive/15 border-destructive/25 text-destructive",
|
|
11
|
+
outline: "text-foreground border-border",
|
|
12
|
+
success: "border-[var(--surface-success-border)] bg-[var(--surface-success-bg)] text-[var(--surface-success-text)]",
|
|
13
|
+
warning: "border-[var(--surface-warning-border)] bg-[var(--surface-warning-bg)] text-[var(--surface-warning-text)]",
|
|
14
|
+
error: "border-[var(--surface-danger-border)] bg-[var(--surface-danger-bg)] text-[var(--surface-danger-text)]",
|
|
15
|
+
info: "border-[var(--surface-info-border)] bg-[var(--surface-info-bg)] text-[var(--surface-info-text)]",
|
|
16
|
+
sandbox: "border-border bg-[var(--accent-surface-soft)] text-[var(--accent-text)]",
|
|
17
|
+
running: "border-[var(--surface-teal-border)] bg-[var(--surface-teal-bg)] text-[var(--surface-teal-text)]",
|
|
18
|
+
creating: "border-[var(--surface-violet-border)] bg-[var(--surface-violet-bg)] text-[var(--surface-violet-text)]",
|
|
19
|
+
stopped: "border-[var(--surface-warning-border)] bg-[var(--surface-warning-bg)] text-[var(--surface-warning-text)]",
|
|
20
|
+
warm: "border-[var(--surface-orange-border)] bg-[var(--surface-orange-bg)] text-[var(--surface-orange-text)]",
|
|
21
|
+
cold: "border-[var(--surface-info-border)] bg-[var(--surface-info-bg)] text-[var(--surface-info-text)]",
|
|
22
|
+
deleted: "border-[var(--surface-neutral-border)] bg-[var(--surface-neutral-bg)] text-[var(--surface-neutral-text)]"
|
|
23
|
+
} },
|
|
24
|
+
defaultVariants: { variant: "default" }
|
|
25
|
+
});
|
|
26
|
+
const statusDotClass = {
|
|
27
|
+
running: "status-dot status-dot-running",
|
|
28
|
+
creating: "status-dot status-dot-creating",
|
|
29
|
+
stopped: "status-dot status-dot-stopped",
|
|
30
|
+
warm: "status-dot status-dot-warm",
|
|
31
|
+
cold: "status-dot status-dot-cold",
|
|
32
|
+
error: "status-dot status-dot-error",
|
|
33
|
+
deleted: "status-dot status-dot-deleted"
|
|
34
|
+
};
|
|
35
|
+
function Badge({ className, variant, dot, children, ...props }) {
|
|
36
|
+
const dotClass = dot && variant ? statusDotClass[variant] : null;
|
|
37
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
38
|
+
className: cn(badgeVariants({ variant }), className),
|
|
39
|
+
...props,
|
|
40
|
+
children: [dotClass && /* @__PURE__ */ jsx("span", {
|
|
41
|
+
className: dotClass,
|
|
42
|
+
"aria-hidden": true
|
|
43
|
+
}), children]
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
export { Badge, badgeVariants };
|
|
@@ -4,7 +4,7 @@ declare const buttonVariants: (props?: ({
|
|
|
4
4
|
variant?: "default" | "destructive" | "ghost" | "link" | "outline" | "sandbox" | "secondary" | null | undefined;
|
|
5
5
|
size?: "default" | "icon" | "lg" | "sm" | "xl" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
-
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
7
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
8
8
|
variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | "sandbox" | null;
|
|
9
9
|
size?: "default" | "sm" | "lg" | "xl" | "icon" | null;
|
|
10
10
|
asChild?: boolean;
|
|
@@ -13,4 +13,4 @@ interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
13
13
|
}
|
|
14
14
|
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
15
15
|
//#endregion
|
|
16
|
-
export {
|
|
16
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { focusRing } from "../lib/focus.js";
|
|
2
|
+
import { cn } from "../lib/utils.js";
|
|
3
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
//#region src/primitives/button.tsx
|
|
8
|
+
const buttonVariants = cva(`inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg font-medium text-sm transition-all ${focusRing} disabled:pointer-events-none disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 motion-reduce:transition-none motion-reduce:active:scale-100 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`, {
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90 active:scale-[0.97] duration-[var(--transition-fast)]",
|
|
12
|
+
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90 active:scale-[0.97] duration-[var(--transition-fast)]",
|
|
13
|
+
outline: "border border-border bg-card hover:bg-muted active:scale-[0.97] duration-[var(--transition-fast)] text-foreground",
|
|
14
|
+
secondary: "bg-muted border border-border text-foreground hover:bg-muted/80 active:scale-[0.97] duration-[var(--transition-fast)]",
|
|
15
|
+
ghost: "hover:bg-muted hover:text-foreground duration-[var(--transition-fast)] text-muted-foreground border border-transparent",
|
|
16
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
17
|
+
sandbox: "bg-[var(--btn-primary-bg)] text-[var(--btn-primary-text)] border border-[var(--border-accent)] hover:bg-[var(--btn-primary-hover)] active:scale-[0.97] duration-[var(--transition-fast)]"
|
|
18
|
+
},
|
|
19
|
+
size: {
|
|
20
|
+
default: "h-[var(--control-height)] px-4 py-2",
|
|
21
|
+
sm: "h-8 rounded-md px-3 text-xs",
|
|
22
|
+
lg: "h-11 rounded-lg px-7 text-sm",
|
|
23
|
+
xl: "h-13 rounded-xl px-9 text-base",
|
|
24
|
+
icon: "h-[var(--control-height)] w-[var(--control-height)]"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
defaultVariants: {
|
|
28
|
+
variant: "default",
|
|
29
|
+
size: "default"
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
function preventActivation(event) {
|
|
33
|
+
event.preventDefault();
|
|
34
|
+
event.stopPropagation();
|
|
35
|
+
}
|
|
36
|
+
function disabledHandlers(props) {
|
|
37
|
+
const guardKey = (handler) => (event) => {
|
|
38
|
+
if (event.key === "Enter" || event.key === " ") preventActivation(event);
|
|
39
|
+
else handler?.(event);
|
|
40
|
+
};
|
|
41
|
+
return {
|
|
42
|
+
onClickCapture: preventActivation,
|
|
43
|
+
onAuxClickCapture: preventActivation,
|
|
44
|
+
onDoubleClickCapture: preventActivation,
|
|
45
|
+
onPointerDownCapture: preventActivation,
|
|
46
|
+
onPointerUpCapture: preventActivation,
|
|
47
|
+
onMouseDownCapture: preventActivation,
|
|
48
|
+
onMouseUpCapture: preventActivation,
|
|
49
|
+
onKeyDownCapture: guardKey(props.onKeyDownCapture),
|
|
50
|
+
onKeyUpCapture: guardKey(props.onKeyUpCapture)
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
const Button = React.forwardRef(({ className, variant, size, asChild = false, loading = false, disabled, children, ...props }, ref) => {
|
|
54
|
+
if (asChild) {
|
|
55
|
+
const child = React.isValidElement(children) ? children : null;
|
|
56
|
+
const isDisabled = disabled || loading || child?.props.disabled;
|
|
57
|
+
return /* @__PURE__ */ jsx(Slot, {
|
|
58
|
+
className: cn(buttonVariants({
|
|
59
|
+
variant,
|
|
60
|
+
size,
|
|
61
|
+
className
|
|
62
|
+
})),
|
|
63
|
+
ref,
|
|
64
|
+
...props,
|
|
65
|
+
...isDisabled ? disabledHandlers(props) : {},
|
|
66
|
+
children: child ? React.cloneElement(child, {
|
|
67
|
+
...loading ? { "aria-busy": true } : {},
|
|
68
|
+
...isDisabled ? {
|
|
69
|
+
"aria-disabled": true,
|
|
70
|
+
...child.type === "button" ? { disabled: true } : { tabIndex: -1 },
|
|
71
|
+
...child.type === "a" ? {
|
|
72
|
+
href: void 0,
|
|
73
|
+
role: child.props.role ?? props.role ?? "link"
|
|
74
|
+
} : {},
|
|
75
|
+
...disabledHandlers(child.props)
|
|
76
|
+
} : {}
|
|
77
|
+
}) : children
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
81
|
+
className: cn(buttonVariants({
|
|
82
|
+
variant,
|
|
83
|
+
size,
|
|
84
|
+
className
|
|
85
|
+
})),
|
|
86
|
+
ref,
|
|
87
|
+
...props,
|
|
88
|
+
disabled: disabled || loading,
|
|
89
|
+
"aria-busy": loading || props["aria-busy"],
|
|
90
|
+
children: [loading && /* @__PURE__ */ jsxs("svg", {
|
|
91
|
+
className: "mr-2 -ml-1 h-4 w-4 animate-spin motion-reduce:animate-none",
|
|
92
|
+
"aria-hidden": "true",
|
|
93
|
+
focusable: "false",
|
|
94
|
+
fill: "none",
|
|
95
|
+
viewBox: "0 0 24 24",
|
|
96
|
+
children: [/* @__PURE__ */ jsx("circle", {
|
|
97
|
+
className: "opacity-25",
|
|
98
|
+
cx: "12",
|
|
99
|
+
cy: "12",
|
|
100
|
+
r: "10",
|
|
101
|
+
stroke: "currentColor",
|
|
102
|
+
strokeWidth: "4"
|
|
103
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
104
|
+
className: "opacity-75",
|
|
105
|
+
fill: "currentColor",
|
|
106
|
+
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
107
|
+
})]
|
|
108
|
+
}), children]
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
Button.displayName = "Button";
|
|
112
|
+
//#endregion
|
|
113
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
//#region src/primitives/card.d.ts
|
|
3
|
+
declare const Card: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
|
|
4
|
+
variant?: "default" | "glass" | "sandbox" | "elevated";
|
|
5
|
+
/** Decorative border feedback only. Put actions in a native button or link. */
|
|
6
|
+
hover?: boolean;
|
|
7
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
declare const CardHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
export interface CardTitleProps extends React.HTMLAttributes<HTMLHeadingElement> {
|
|
10
|
+
/** Heading level appropriate to the surrounding document; h3 remains the default. */
|
|
11
|
+
as?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
|
|
12
|
+
}
|
|
13
|
+
declare const CardTitle: React.ForwardRefExoticComponent<CardTitleProps & React.RefAttributes<HTMLHeadingElement>>;
|
|
14
|
+
declare const CardDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
15
|
+
declare const CardContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
16
|
+
declare const CardFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
import { Heading } from "./heading.js";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/primitives/card.tsx
|
|
6
|
+
const Card = React.forwardRef(({ className, variant = "default", hover = false, ...props }, ref) => {
|
|
7
|
+
return /* @__PURE__ */ jsx("div", {
|
|
8
|
+
ref,
|
|
9
|
+
className: cn("rounded-[var(--radius-lg)] border text-card-foreground transition-[border-color,box-shadow]", "duration-[var(--transition-default)]", {
|
|
10
|
+
default: "bg-card border-border",
|
|
11
|
+
elevated: "bg-muted/50 border-border shadow-[var(--shadow-card)]",
|
|
12
|
+
glass: "bg-card/80 backdrop-blur-xl border-border shadow-[var(--shadow-card)]",
|
|
13
|
+
sandbox: "bg-muted/50 border-primary/20 shadow-[var(--shadow-accent)]"
|
|
14
|
+
}[variant], hover && "hover:border-[var(--border-strong)]", className),
|
|
15
|
+
...props
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
Card.displayName = "Card";
|
|
19
|
+
const CardHeader = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
20
|
+
ref,
|
|
21
|
+
className: cn("flex flex-col space-y-1 p-4", className),
|
|
22
|
+
...props
|
|
23
|
+
}));
|
|
24
|
+
CardHeader.displayName = "CardHeader";
|
|
25
|
+
const CardTitle = React.forwardRef(({ className, as = "h3", ...props }, ref) => /* @__PURE__ */ jsx(Heading, {
|
|
26
|
+
ref,
|
|
27
|
+
variant: "subsection",
|
|
28
|
+
as,
|
|
29
|
+
className,
|
|
30
|
+
...props
|
|
31
|
+
}));
|
|
32
|
+
CardTitle.displayName = "CardTitle";
|
|
33
|
+
const CardDescription = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("p", {
|
|
34
|
+
ref,
|
|
35
|
+
className: cn("text-muted-foreground text-sm", className),
|
|
36
|
+
...props
|
|
37
|
+
}));
|
|
38
|
+
CardDescription.displayName = "CardDescription";
|
|
39
|
+
const CardContent = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
40
|
+
ref,
|
|
41
|
+
className: cn("p-4 [&:not(:first-child)]:pt-0", className),
|
|
42
|
+
...props
|
|
43
|
+
}));
|
|
44
|
+
CardContent.displayName = "CardContent";
|
|
45
|
+
const CardFooter = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
46
|
+
ref,
|
|
47
|
+
className: cn("flex flex-wrap items-center gap-2 p-4 [&:not(:first-child)]:pt-0", className),
|
|
48
|
+
...props
|
|
49
|
+
}));
|
|
50
|
+
CardFooter.displayName = "CardFooter";
|
|
51
|
+
//#endregion
|
|
52
|
+
export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CodeBlock, CodeBlockProps, CopyButton } from "../markdown/code-block.js";
|
|
2
|
+
//#region src/primitives/code-block.d.ts
|
|
3
|
+
export interface InlineCodeProps extends React.HTMLAttributes<HTMLElement> {}
|
|
4
|
+
export declare function InlineCode({ className, children, ...props }: InlineCodeProps): import("react").JSX.Element;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { CodeBlock, type CodeBlockProps, CopyButton };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
import { CodeBlock, CopyButton } from "../markdown/code-block.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/primitives/code-block.tsx
|
|
5
|
+
function InlineCode({ className, children, ...props }) {
|
|
6
|
+
return /* @__PURE__ */ jsx("code", {
|
|
7
|
+
className: cn("rounded border border-border bg-muted px-1.5 py-0.5 font-mono text-[0.85em] text-foreground", className),
|
|
8
|
+
...props,
|
|
9
|
+
children
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { CodeBlock, CopyButton, InlineCode };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
3
|
+
//#region src/primitives/dialog.d.ts
|
|
4
|
+
declare const Dialog: React.FC<DialogPrimitive.DialogProps>;
|
|
5
|
+
declare const DialogTrigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
6
|
+
declare const DialogPortal: React.FC<DialogPrimitive.DialogPortalProps>;
|
|
7
|
+
declare const DialogClose: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
8
|
+
declare const DialogOverlay: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
declare const DialogContent: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
10
|
+
variant?: "default" | "sandbox";
|
|
11
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
+
declare function DialogHeader({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
13
|
+
declare namespace DialogHeader {
|
|
14
|
+
var displayName: string;
|
|
15
|
+
}
|
|
16
|
+
declare function DialogFooter({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
17
|
+
declare namespace DialogFooter {
|
|
18
|
+
var displayName: string;
|
|
19
|
+
}
|
|
20
|
+
declare const DialogTitle: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
21
|
+
declare const DialogDescription: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { focusRing } from "../lib/focus.js";
|
|
2
|
+
import { cn } from "../lib/utils.js";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
6
|
+
import { X } from "lucide-react";
|
|
7
|
+
//#region src/primitives/dialog.tsx
|
|
8
|
+
const Dialog = DialogPrimitive.Root;
|
|
9
|
+
const DialogTrigger = DialogPrimitive.Trigger;
|
|
10
|
+
const DialogPortal = DialogPrimitive.Portal;
|
|
11
|
+
const DialogClose = DialogPrimitive.Close;
|
|
12
|
+
const DialogOverlay = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(DialogPrimitive.Overlay, {
|
|
13
|
+
ref,
|
|
14
|
+
className: cn("fixed inset-0 z-50 bg-black/40", "data-[state=closed]:animate-out data-[state=open]:animate-in", "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", className),
|
|
15
|
+
...props
|
|
16
|
+
}));
|
|
17
|
+
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
18
|
+
const DialogContent = React.forwardRef(({ className, children, variant = "default", ...props }, ref) => {
|
|
19
|
+
return /* @__PURE__ */ jsxs(DialogPortal, { children: [/* @__PURE__ */ jsx(DialogOverlay, {}), /* @__PURE__ */ jsxs(DialogPrimitive.Content, {
|
|
20
|
+
ref,
|
|
21
|
+
className: cn("fixed top-[50%] left-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%]", "gap-4 rounded-lg border bg-card p-6 shadow-lg duration-200", "data-[state=closed]:animate-out data-[state=open]:animate-in", "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95", "data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%]", "data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]", {
|
|
22
|
+
default: "border-border",
|
|
23
|
+
sandbox: "border-[var(--border-accent)] shadow-[var(--shadow-accent)]"
|
|
24
|
+
}[variant], className),
|
|
25
|
+
...props,
|
|
26
|
+
children: [children, /* @__PURE__ */ jsxs(DialogPrimitive.Close, {
|
|
27
|
+
className: cn("absolute top-4 right-4 rounded-sm opacity-70 transition-[opacity,box-shadow] hover:opacity-100 focus-visible:opacity-100 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", focusRing),
|
|
28
|
+
children: [/* @__PURE__ */ jsx(X, { className: "h-4 w-4" }), /* @__PURE__ */ jsx("span", {
|
|
29
|
+
className: "sr-only",
|
|
30
|
+
children: "Close"
|
|
31
|
+
})]
|
|
32
|
+
})]
|
|
33
|
+
})] });
|
|
34
|
+
});
|
|
35
|
+
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
36
|
+
const DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
37
|
+
className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className),
|
|
38
|
+
...props
|
|
39
|
+
});
|
|
40
|
+
DialogHeader.displayName = "DialogHeader";
|
|
41
|
+
const DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
42
|
+
className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
|
|
43
|
+
...props
|
|
44
|
+
});
|
|
45
|
+
DialogFooter.displayName = "DialogFooter";
|
|
46
|
+
const DialogTitle = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(DialogPrimitive.Title, {
|
|
47
|
+
ref,
|
|
48
|
+
className: cn("font-semibold text-lg leading-none tracking-tight", className),
|
|
49
|
+
...props
|
|
50
|
+
}));
|
|
51
|
+
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
52
|
+
const DialogDescription = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(DialogPrimitive.Description, {
|
|
53
|
+
ref,
|
|
54
|
+
className: cn("text-muted-foreground text-sm", className),
|
|
55
|
+
...props
|
|
56
|
+
}));
|
|
57
|
+
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
58
|
+
//#endregion
|
|
59
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
//#region src/primitives/drop-zone.d.ts
|
|
3
|
+
export interface DropZoneProps {
|
|
4
|
+
/** Called with dropped files */
|
|
5
|
+
onDrop: (files: File[]) => void;
|
|
6
|
+
/** Accepted file types (e.g. ".pdf,.csv,.xlsx") */
|
|
7
|
+
accept?: string;
|
|
8
|
+
/** Whether drop zone is active */
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
/** Custom overlay content (replaces default) */
|
|
11
|
+
overlay?: ReactNode;
|
|
12
|
+
/** Overlay title */
|
|
13
|
+
title?: string;
|
|
14
|
+
/** Overlay description */
|
|
15
|
+
description?: string;
|
|
16
|
+
/** Overlay icon (Material Symbols name or ReactNode) */
|
|
17
|
+
icon?: string | ReactNode;
|
|
18
|
+
/** Children wrapped by the drop zone */
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function DropZone({ onDrop, accept, disabled, overlay, title, description, icon, children, className }: DropZoneProps): import("react").JSX.Element;
|
|
23
|
+
//#endregion
|