@tangle-network/ui 1.0.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 +12 -0
- package/LICENSE +21 -0
- package/README.md +33 -0
- package/dist/active-sessions-store-CeOmXgv5.d.ts +85 -0
- package/dist/artifact-pane-DvJyPWV4.d.ts +24 -0
- package/dist/auth.d.ts +74 -0
- package/dist/auth.js +15 -0
- package/dist/button-CMQuQEW_.d.ts +17 -0
- package/dist/chat.d.ts +232 -0
- package/dist/chat.js +30 -0
- package/dist/chunk-2NFQRQOD.js +1009 -0
- package/dist/chunk-2VH6PUXD.js +186 -0
- package/dist/chunk-34A66VBG.js +214 -0
- package/dist/chunk-3OI2QKFD.js +0 -0
- package/dist/chunk-4CLN43XT.js +45 -0
- package/dist/chunk-54SQQMMM.js +156 -0
- package/dist/chunk-5Z5ZYMOJ.js +0 -0
- package/dist/chunk-66BNMOVT.js +167 -0
- package/dist/chunk-6BGQA4BQ.js +0 -0
- package/dist/chunk-7UO2ZMRQ.js +133 -0
- package/dist/chunk-BX6AQMUS.js +183 -0
- package/dist/chunk-CD53GZOM.js +59 -0
- package/dist/chunk-CSAIKY36.js +54 -0
- package/dist/chunk-EEE55AVS.js +1201 -0
- package/dist/chunk-GYPQXTJU.js +230 -0
- package/dist/chunk-HFL6R6IF.js +37 -0
- package/dist/chunk-HJKCSXCH.js +737 -0
- package/dist/chunk-LISXUB4D.js +1222 -0
- package/dist/chunk-LQS34IGP.js +0 -0
- package/dist/chunk-MKTSMWVD.js +109 -0
- package/dist/chunk-NKDZ7GZE.js +192 -0
- package/dist/chunk-OEX7NZE3.js +321 -0
- package/dist/chunk-Q56BYXQF.js +61 -0
- package/dist/chunk-Q7EIIWTC.js +0 -0
- package/dist/chunk-REJESC5U.js +117 -0
- package/dist/chunk-RQGKSCEZ.js +0 -0
- package/dist/chunk-RQHJBTEU.js +10 -0
- package/dist/chunk-TMFOPHHN.js +299 -0
- package/dist/chunk-XGKULLYE.js +40 -0
- package/dist/chunk-XIHMJ7ZQ.js +614 -0
- package/dist/chunk-YJ2G3XO5.js +1048 -0
- package/dist/chunk-YNN4O57I.js +754 -0
- package/dist/code-block-DjXf8eOG.d.ts +19 -0
- package/dist/document-editor-pane-A5LT5H4N.js +12 -0
- package/dist/document-editor-pane-DyDEX_Zm.d.ts +124 -0
- package/dist/editor.d.ts +120 -0
- package/dist/editor.js +34 -0
- package/dist/files.d.ts +175 -0
- package/dist/files.js +20 -0
- package/dist/hooks.d.ts +56 -0
- package/dist/hooks.js +41 -0
- package/dist/index.d.ts +43 -0
- package/dist/index.js +446 -0
- package/dist/markdown.d.ts +15 -0
- package/dist/markdown.js +14 -0
- package/dist/message-BHWbxBtT.d.ts +15 -0
- package/dist/openui.d.ts +115 -0
- package/dist/openui.js +12 -0
- package/dist/parts-dj7AcUg0.d.ts +36 -0
- package/dist/primitives.d.ts +332 -0
- package/dist/primitives.js +191 -0
- package/dist/run-PfLmDAox.d.ts +41 -0
- package/dist/run.d.ts +69 -0
- package/dist/run.js +36 -0
- package/dist/sdk-hooks.d.ts +285 -0
- package/dist/sdk-hooks.js +31 -0
- package/dist/stores.d.ts +17 -0
- package/dist/stores.js +76 -0
- package/dist/tool-call-feed-Bs3MyQMT.d.ts +68 -0
- package/dist/tool-display-z4JcDmMQ.d.ts +32 -0
- package/dist/tool-previews.d.ts +48 -0
- package/dist/tool-previews.js +21 -0
- package/dist/types.d.ts +19 -0
- package/dist/types.js +1 -0
- package/dist/utils.d.ts +45 -0
- package/dist/utils.js +32 -0
- package/package.json +193 -0
- package/src/auth/auth.tsx +228 -0
- package/src/auth/index.ts +13 -0
- package/src/auth/login-layout.tsx +46 -0
- package/src/chat/agent-timeline.stories.tsx +429 -0
- package/src/chat/agent-timeline.tsx +360 -0
- package/src/chat/chat-container.tsx +486 -0
- package/src/chat/chat-input.stories.tsx +142 -0
- package/src/chat/chat-input.tsx +389 -0
- package/src/chat/chat-message.stories.tsx +237 -0
- package/src/chat/chat-message.tsx +129 -0
- package/src/chat/index.ts +18 -0
- package/src/chat/message-list.stories.tsx +336 -0
- package/src/chat/message-list.tsx +79 -0
- package/src/chat/thinking-indicator.stories.tsx +56 -0
- package/src/chat/thinking-indicator.tsx +30 -0
- package/src/chat/user-message.stories.tsx +92 -0
- package/src/chat/user-message.tsx +43 -0
- package/src/editor/document-editor-pane.tsx +351 -0
- package/src/editor/editor-provider.tsx +428 -0
- package/src/editor/editor-toolbar.tsx +130 -0
- package/src/editor/index.ts +31 -0
- package/src/editor/markdown-conversion.ts +21 -0
- package/src/editor/markdown-document-editor.tsx +137 -0
- package/src/editor/tiptap-editor.tsx +331 -0
- package/src/editor/use-editor.ts +221 -0
- package/src/files/file-artifact-pane.tsx +183 -0
- package/src/files/file-preview.tsx +342 -0
- package/src/files/file-tabs.tsx +71 -0
- package/src/files/file-tree.tsx +258 -0
- package/src/files/index.ts +17 -0
- package/src/files/rich-file-tree.stories.tsx +104 -0
- package/src/files/rich-file-tree.test.tsx +42 -0
- package/src/files/rich-file-tree.tsx +232 -0
- package/src/hooks/index.ts +10 -0
- package/src/hooks/use-auth.ts +153 -0
- package/src/hooks/use-auto-scroll.ts +59 -0
- package/src/hooks/use-dropdown-menu.ts +40 -0
- package/src/hooks/use-live-time.test.tsx +40 -0
- package/src/hooks/use-live-time.ts +27 -0
- package/src/hooks/use-realtime-session.ts +319 -0
- package/src/hooks/use-run-collapse-state.ts +25 -0
- package/src/hooks/use-run-groups.ts +111 -0
- package/src/hooks/use-sdk-session.ts +575 -0
- package/src/hooks/use-sse-stream.ts +475 -0
- package/src/hooks/use-tool-call-stream.ts +96 -0
- package/src/index.ts +14 -0
- package/src/lib/utils.ts +6 -0
- package/src/markdown/code-block.tsx +198 -0
- package/src/markdown/index.ts +2 -0
- package/src/markdown/markdown.stories.tsx +190 -0
- package/src/markdown/markdown.tsx +62 -0
- package/src/openui/index.ts +20 -0
- package/src/openui/openui-artifact-renderer.tsx +542 -0
- package/src/primitives/artifact-pane.tsx +91 -0
- package/src/primitives/avatar.stories.tsx +95 -0
- package/src/primitives/avatar.tsx +47 -0
- package/src/primitives/badge.stories.tsx +57 -0
- package/src/primitives/badge.tsx +97 -0
- package/src/primitives/button.stories.tsx +48 -0
- package/src/primitives/button.tsx +115 -0
- package/src/primitives/card.stories.tsx +53 -0
- package/src/primitives/card.tsx +98 -0
- package/src/primitives/code-block.stories.tsx +115 -0
- package/src/primitives/code-block.tsx +22 -0
- package/src/primitives/design-tokens.stories.tsx +162 -0
- package/src/primitives/dialog.stories.tsx +176 -0
- package/src/primitives/dialog.tsx +137 -0
- package/src/primitives/drop-zone.stories.tsx +123 -0
- package/src/primitives/drop-zone.tsx +131 -0
- package/src/primitives/dropdown-menu.stories.tsx +122 -0
- package/src/primitives/dropdown-menu.tsx +214 -0
- package/src/primitives/empty-state.stories.tsx +81 -0
- package/src/primitives/empty-state.tsx +40 -0
- package/src/primitives/index.ts +118 -0
- package/src/primitives/input.stories.tsx +113 -0
- package/src/primitives/input.tsx +136 -0
- package/src/primitives/label.stories.tsx +84 -0
- package/src/primitives/label.tsx +24 -0
- package/src/primitives/progress.stories.tsx +93 -0
- package/src/primitives/progress.tsx +50 -0
- package/src/primitives/segmented-control.test.tsx +328 -0
- package/src/primitives/segmented-control.tsx +154 -0
- package/src/primitives/select.stories.tsx +164 -0
- package/src/primitives/select.tsx +158 -0
- package/src/primitives/sidebar-drop-zone.stories.tsx +100 -0
- package/src/primitives/sidebar-drop-zone.tsx +149 -0
- package/src/primitives/skeleton.stories.tsx +79 -0
- package/src/primitives/skeleton.tsx +55 -0
- package/src/primitives/stat-card.stories.tsx +137 -0
- package/src/primitives/stat-card.tsx +97 -0
- package/src/primitives/switch.stories.tsx +85 -0
- package/src/primitives/switch.tsx +28 -0
- package/src/primitives/table.stories.tsx +170 -0
- package/src/primitives/table.tsx +116 -0
- package/src/primitives/tabs.stories.tsx +180 -0
- package/src/primitives/tabs.tsx +71 -0
- package/src/primitives/terminal-display.stories.tsx +191 -0
- package/src/primitives/terminal-display.tsx +189 -0
- package/src/primitives/theme-toggle.stories.tsx +32 -0
- package/src/primitives/theme-toggle.tsx +96 -0
- package/src/primitives/toast.stories.tsx +155 -0
- package/src/primitives/toast.tsx +190 -0
- package/src/primitives/upload-progress.stories.tsx +120 -0
- package/src/primitives/upload-progress.tsx +110 -0
- package/src/run/expanded-tool-detail.stories.tsx +182 -0
- package/src/run/expanded-tool-detail.tsx +186 -0
- package/src/run/index.ts +13 -0
- package/src/run/inline-thinking-item.stories.tsx +136 -0
- package/src/run/inline-thinking-item.tsx +120 -0
- package/src/run/inline-tool-item.stories.tsx +222 -0
- package/src/run/inline-tool-item.tsx +190 -0
- package/src/run/run-group.stories.tsx +322 -0
- package/src/run/run-group.tsx +569 -0
- package/src/run/run-item-primitives.tsx +17 -0
- package/src/run/tool-call-feed.stories.tsx +294 -0
- package/src/run/tool-call-feed.tsx +192 -0
- package/src/run/tool-call-step.stories.tsx +198 -0
- package/src/run/tool-call-step.tsx +240 -0
- package/src/sdk-hooks.ts +38 -0
- package/src/stores/active-sessions-store.ts +455 -0
- package/src/stores/chat-store.ts +43 -0
- package/src/stores/index.ts +2 -0
- package/src/tool-previews/command-preview.tsx +116 -0
- package/src/tool-previews/diff-preview.tsx +85 -0
- package/src/tool-previews/glob-results-preview.tsx +98 -0
- package/src/tool-previews/grep-results-preview.tsx +157 -0
- package/src/tool-previews/index.ts +22 -0
- package/src/tool-previews/preview-primitives.tsx +84 -0
- package/src/tool-previews/question-preview.tsx +101 -0
- package/src/tool-previews/web-search-preview.tsx +117 -0
- package/src/tool-previews/write-file-preview.tsx +80 -0
- package/src/types/branding.ts +11 -0
- package/src/types/index.ts +5 -0
- package/src/types/message.ts +13 -0
- package/src/types/parts.ts +51 -0
- package/src/types/run.ts +56 -0
- package/src/types/tool-display.ts +41 -0
- package/src/utils/copy-text.ts +30 -0
- package/src/utils/format.test.ts +43 -0
- package/src/utils/format.ts +56 -0
- package/src/utils/index.ts +10 -0
- package/src/utils/time-ago.ts +9 -0
- package/src/utils/tool-display.ts +238 -0
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-RQHJBTEU.js";
|
|
4
|
+
|
|
5
|
+
// src/primitives/card.tsx
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
var Card = React.forwardRef(({ className, variant = "default", hover = false, ...props }, ref) => {
|
|
9
|
+
const variants = {
|
|
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
|
+
};
|
|
15
|
+
return /* @__PURE__ */ jsx(
|
|
16
|
+
"div",
|
|
17
|
+
{
|
|
18
|
+
ref,
|
|
19
|
+
className: cn(
|
|
20
|
+
"rounded-[var(--radius-lg)] border text-card-foreground transition-[border-color,box-shadow]",
|
|
21
|
+
"duration-[var(--transition-default)]",
|
|
22
|
+
variants[variant],
|
|
23
|
+
hover && "cursor-pointer hover:border-primary/30",
|
|
24
|
+
className
|
|
25
|
+
),
|
|
26
|
+
...props
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
});
|
|
30
|
+
Card.displayName = "Card";
|
|
31
|
+
var CardHeader = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
32
|
+
"div",
|
|
33
|
+
{
|
|
34
|
+
ref,
|
|
35
|
+
className: cn("flex flex-col space-y-1 p-4", className),
|
|
36
|
+
...props
|
|
37
|
+
}
|
|
38
|
+
));
|
|
39
|
+
CardHeader.displayName = "CardHeader";
|
|
40
|
+
var CardTitle = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
41
|
+
"h3",
|
|
42
|
+
{
|
|
43
|
+
ref,
|
|
44
|
+
className: cn("font-semibold leading-none tracking-tight", className),
|
|
45
|
+
...props
|
|
46
|
+
}
|
|
47
|
+
));
|
|
48
|
+
CardTitle.displayName = "CardTitle";
|
|
49
|
+
var CardDescription = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
50
|
+
"p",
|
|
51
|
+
{
|
|
52
|
+
ref,
|
|
53
|
+
className: cn("text-muted-foreground text-sm", className),
|
|
54
|
+
...props
|
|
55
|
+
}
|
|
56
|
+
));
|
|
57
|
+
CardDescription.displayName = "CardDescription";
|
|
58
|
+
var CardContent = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("p-4 pt-0", className), ...props }));
|
|
59
|
+
CardContent.displayName = "CardContent";
|
|
60
|
+
var CardFooter = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
61
|
+
"div",
|
|
62
|
+
{
|
|
63
|
+
ref,
|
|
64
|
+
className: cn("flex items-center p-6 pt-0", className),
|
|
65
|
+
...props
|
|
66
|
+
}
|
|
67
|
+
));
|
|
68
|
+
CardFooter.displayName = "CardFooter";
|
|
69
|
+
|
|
70
|
+
// src/primitives/badge.tsx
|
|
71
|
+
import { cva } from "class-variance-authority";
|
|
72
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
73
|
+
var badgeVariants = cva(
|
|
74
|
+
"inline-flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 font-medium text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
75
|
+
{
|
|
76
|
+
variants: {
|
|
77
|
+
variant: {
|
|
78
|
+
default: "border-transparent bg-primary text-primary-foreground",
|
|
79
|
+
secondary: "border-transparent bg-secondary text-secondary-foreground",
|
|
80
|
+
destructive: "border-transparent bg-destructive/15 border-destructive/25 text-destructive",
|
|
81
|
+
outline: "text-foreground border-border",
|
|
82
|
+
success: "border-[var(--surface-success-border)] bg-[var(--surface-success-bg)] text-[var(--surface-success-text)]",
|
|
83
|
+
warning: "border-[var(--surface-warning-border)] bg-[var(--surface-warning-bg)] text-[var(--surface-warning-text)]",
|
|
84
|
+
error: "border-[var(--surface-danger-border)] bg-[var(--surface-danger-bg)] text-[var(--surface-danger-text)]",
|
|
85
|
+
info: "border-[var(--surface-info-border)] bg-[var(--surface-info-bg)] text-[var(--surface-info-text)]",
|
|
86
|
+
sandbox: "border-border bg-[var(--accent-surface-soft)] text-[var(--accent-text)]",
|
|
87
|
+
/* Operational status variants */
|
|
88
|
+
running: "border-[var(--surface-teal-border)] bg-[var(--surface-teal-bg)] text-[var(--surface-teal-text)]",
|
|
89
|
+
creating: "border-[var(--surface-violet-border)] bg-[var(--surface-violet-bg)] text-[var(--surface-violet-text)]",
|
|
90
|
+
stopped: "border-[var(--surface-warning-border)] bg-[var(--surface-warning-bg)] text-[var(--surface-warning-text)]",
|
|
91
|
+
warm: "border-[var(--surface-orange-border)] bg-[var(--surface-orange-bg)] text-[var(--surface-orange-text)]",
|
|
92
|
+
cold: "border-[var(--surface-info-border)] bg-[var(--surface-info-bg)] text-[var(--surface-info-text)]",
|
|
93
|
+
deleted: "border-[var(--surface-neutral-border)] bg-[var(--surface-neutral-bg)] text-[var(--surface-neutral-text)]"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
defaultVariants: {
|
|
97
|
+
variant: "default"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
|
+
var statusDotClass = {
|
|
102
|
+
running: "status-dot status-dot-running",
|
|
103
|
+
creating: "status-dot status-dot-creating",
|
|
104
|
+
stopped: "status-dot status-dot-stopped",
|
|
105
|
+
warm: "status-dot status-dot-warm",
|
|
106
|
+
cold: "status-dot status-dot-cold",
|
|
107
|
+
error: "status-dot status-dot-error",
|
|
108
|
+
deleted: "status-dot status-dot-deleted"
|
|
109
|
+
};
|
|
110
|
+
function Badge({ className, variant, dot, children, ...props }) {
|
|
111
|
+
const dotClass = dot && variant ? statusDotClass[variant] : null;
|
|
112
|
+
return /* @__PURE__ */ jsxs("div", { className: cn(badgeVariants({ variant }), className), ...props, children: [
|
|
113
|
+
dotClass && /* @__PURE__ */ jsx2("span", { className: dotClass, "aria-hidden": true }),
|
|
114
|
+
children
|
|
115
|
+
] });
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// src/primitives/table.tsx
|
|
119
|
+
import * as React2 from "react";
|
|
120
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
121
|
+
var Table = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsx3(
|
|
122
|
+
"table",
|
|
123
|
+
{
|
|
124
|
+
ref,
|
|
125
|
+
className: cn("w-full caption-bottom text-sm", className),
|
|
126
|
+
...props
|
|
127
|
+
}
|
|
128
|
+
) }));
|
|
129
|
+
Table.displayName = "Table";
|
|
130
|
+
var TableHeader = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
|
|
131
|
+
TableHeader.displayName = "TableHeader";
|
|
132
|
+
var TableBody = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
|
|
133
|
+
"tbody",
|
|
134
|
+
{
|
|
135
|
+
ref,
|
|
136
|
+
className: cn("[&_tr:last-child]:border-0", className),
|
|
137
|
+
...props
|
|
138
|
+
}
|
|
139
|
+
));
|
|
140
|
+
TableBody.displayName = "TableBody";
|
|
141
|
+
var TableFooter = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
|
|
142
|
+
"tfoot",
|
|
143
|
+
{
|
|
144
|
+
ref,
|
|
145
|
+
className: cn(
|
|
146
|
+
"border-t bg-card font-medium [&>tr]:last:border-b-0",
|
|
147
|
+
className
|
|
148
|
+
),
|
|
149
|
+
...props
|
|
150
|
+
}
|
|
151
|
+
));
|
|
152
|
+
TableFooter.displayName = "TableFooter";
|
|
153
|
+
var TableRow = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
|
|
154
|
+
"tr",
|
|
155
|
+
{
|
|
156
|
+
ref,
|
|
157
|
+
className: cn(
|
|
158
|
+
"border-border border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted/50",
|
|
159
|
+
className
|
|
160
|
+
),
|
|
161
|
+
...props
|
|
162
|
+
}
|
|
163
|
+
));
|
|
164
|
+
TableRow.displayName = "TableRow";
|
|
165
|
+
var TableHead = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
|
|
166
|
+
"th",
|
|
167
|
+
{
|
|
168
|
+
ref,
|
|
169
|
+
className: cn(
|
|
170
|
+
"h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",
|
|
171
|
+
className
|
|
172
|
+
),
|
|
173
|
+
...props
|
|
174
|
+
}
|
|
175
|
+
));
|
|
176
|
+
TableHead.displayName = "TableHead";
|
|
177
|
+
var TableCell = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
|
|
178
|
+
"td",
|
|
179
|
+
{
|
|
180
|
+
ref,
|
|
181
|
+
className: cn("p-4 align-middle [&:has([role=checkbox])]:pr-0", className),
|
|
182
|
+
...props
|
|
183
|
+
}
|
|
184
|
+
));
|
|
185
|
+
TableCell.displayName = "TableCell";
|
|
186
|
+
var TableCaption = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
|
|
187
|
+
"caption",
|
|
188
|
+
{
|
|
189
|
+
ref,
|
|
190
|
+
className: cn("mt-4 text-muted-foreground text-sm", className),
|
|
191
|
+
...props
|
|
192
|
+
}
|
|
193
|
+
));
|
|
194
|
+
TableCaption.displayName = "TableCaption";
|
|
195
|
+
|
|
196
|
+
// src/primitives/code-block.tsx
|
|
197
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
198
|
+
function InlineCode({ className, children, ...props }) {
|
|
199
|
+
return /* @__PURE__ */ jsx4(
|
|
200
|
+
"code",
|
|
201
|
+
{
|
|
202
|
+
className: cn(
|
|
203
|
+
"rounded border border-border bg-card px-1.5 py-0.5 font-mono text-[0.85em] text-[var(--code-keyword)]",
|
|
204
|
+
className
|
|
205
|
+
),
|
|
206
|
+
...props,
|
|
207
|
+
children
|
|
208
|
+
}
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export {
|
|
213
|
+
Card,
|
|
214
|
+
CardHeader,
|
|
215
|
+
CardTitle,
|
|
216
|
+
CardDescription,
|
|
217
|
+
CardContent,
|
|
218
|
+
CardFooter,
|
|
219
|
+
badgeVariants,
|
|
220
|
+
Badge,
|
|
221
|
+
Table,
|
|
222
|
+
TableHeader,
|
|
223
|
+
TableBody,
|
|
224
|
+
TableFooter,
|
|
225
|
+
TableRow,
|
|
226
|
+
TableHead,
|
|
227
|
+
TableCell,
|
|
228
|
+
TableCaption,
|
|
229
|
+
InlineCode
|
|
230
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// src/stores/chat-store.ts
|
|
2
|
+
import { atom, map } from "nanostores";
|
|
3
|
+
var messagesAtom = atom([]);
|
|
4
|
+
var partMapAtom = map({});
|
|
5
|
+
var isStreamingAtom = atom(false);
|
|
6
|
+
var insertionCounter = 0;
|
|
7
|
+
function addMessage(msg) {
|
|
8
|
+
const withIndex = { ...msg, _insertionIndex: insertionCounter++ };
|
|
9
|
+
messagesAtom.set([...messagesAtom.get(), withIndex]);
|
|
10
|
+
}
|
|
11
|
+
function addParts(messageId, parts) {
|
|
12
|
+
const current = partMapAtom.get();
|
|
13
|
+
const existing = current[messageId] ?? [];
|
|
14
|
+
partMapAtom.setKey(messageId, [...existing, ...parts]);
|
|
15
|
+
}
|
|
16
|
+
function updatePart(messageId, partIndex, part) {
|
|
17
|
+
const current = partMapAtom.get();
|
|
18
|
+
const existing = [...current[messageId] ?? []];
|
|
19
|
+
existing[partIndex] = part;
|
|
20
|
+
partMapAtom.setKey(messageId, existing);
|
|
21
|
+
}
|
|
22
|
+
function clearChat() {
|
|
23
|
+
messagesAtom.set([]);
|
|
24
|
+
partMapAtom.set({});
|
|
25
|
+
isStreamingAtom.set(false);
|
|
26
|
+
insertionCounter = 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export {
|
|
30
|
+
messagesAtom,
|
|
31
|
+
partMapAtom,
|
|
32
|
+
isStreamingAtom,
|
|
33
|
+
addMessage,
|
|
34
|
+
addParts,
|
|
35
|
+
updatePart,
|
|
36
|
+
clearChat
|
|
37
|
+
};
|