@tangle-network/sandbox-ui 0.3.7 → 0.3.11

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 (39) hide show
  1. package/dist/active-sessions-store-CeOmXgv5.d.ts +85 -0
  2. package/dist/artifact-pane-Bh45Ssco.d.ts +24 -0
  3. package/dist/{chat-container-B34uj-J1.d.ts → chat-container-Dn1jWtWo.d.ts} +15 -3
  4. package/dist/chat.d.ts +16 -4
  5. package/dist/chat.js +2 -2
  6. package/dist/{chunk-PXRPYAMM.js → chunk-6H3EFUUC.js} +96 -74
  7. package/dist/{chunk-JF6E2DS5.js → chunk-6NYG2R7V.js} +171 -155
  8. package/dist/{chunk-WUR652Y3.js → chunk-72UEKFZ2.js} +113 -89
  9. package/dist/chunk-BOBXH6CH.js +10981 -0
  10. package/dist/{chunk-ZSNOGOUX.js → chunk-CREVWUCA.js} +541 -76
  11. package/dist/{chunk-5LV6DZZF.js → chunk-FOQTE67I.js} +278 -21
  12. package/dist/chunk-OEX7NZE3.js +321 -0
  13. package/dist/chunk-Q56BYXQF.js +61 -0
  14. package/dist/{chunk-PDV7W4NY.js → chunk-SULQQJPB.js} +1 -56
  15. package/dist/chunk-W4LM3QYZ.js +54 -0
  16. package/dist/document-editor-pane-AFBP2KFT.js +11 -0
  17. package/dist/document-editor-pane-Xnl8SmA7.d.ts +124 -0
  18. package/dist/editor.d.ts +7 -84
  19. package/dist/editor.js +18 -699
  20. package/dist/{expanded-tool-detail-BDi_h_dZ.d.ts → expanded-tool-detail-DM5M_T9h.d.ts} +10 -2
  21. package/dist/{file-tabs-CmaoDVBI.d.ts → file-tabs-BLfxfmAH.d.ts} +1 -22
  22. package/dist/files.d.ts +25 -3
  23. package/dist/files.js +2 -1
  24. package/dist/hooks.d.ts +3 -1
  25. package/dist/hooks.js +6 -1
  26. package/dist/index.d.ts +12 -6
  27. package/dist/index.js +21 -8
  28. package/dist/pages.js +4 -2
  29. package/dist/primitives.js +4 -2
  30. package/dist/run.d.ts +1 -1
  31. package/dist/run.js +1 -1
  32. package/dist/sdk-hooks.d.ts +32 -1
  33. package/dist/sdk-hooks.js +6 -1
  34. package/dist/stores.d.ts +1 -0
  35. package/dist/stores.js +60 -1
  36. package/dist/types.d.ts +2 -0
  37. package/dist/workspace.d.ts +84 -6
  38. package/dist/workspace.js +10 -4
  39. package/package.json +17 -6
@@ -1,3 +1,6 @@
1
+ import {
2
+ ArtifactPane
3
+ } from "./chunk-W4LM3QYZ.js";
1
4
  import {
2
5
  Markdown
3
6
  } from "./chunk-LTFK464G.js";
@@ -5,53 +8,6 @@ import {
5
8
  cn
6
9
  } from "./chunk-RQHJBTEU.js";
7
10
 
8
- // src/workspace/artifact-pane.tsx
9
- import { jsx, jsxs } from "react/jsx-runtime";
10
- function ArtifactPane({
11
- eyebrow,
12
- title,
13
- subtitle,
14
- meta,
15
- headerActions,
16
- tabs,
17
- toolbar,
18
- footer,
19
- emptyState,
20
- children,
21
- className,
22
- contentClassName
23
- }) {
24
- const hasContent = children !== void 0 && children !== null;
25
- return /* @__PURE__ */ jsxs(
26
- "section",
27
- {
28
- className: cn(
29
- "flex h-full min-h-0 flex-col overflow-hidden rounded-[var(--radius-xl)] bg-[linear-gradient(180deg,rgba(255,255,255,0.02),transparent_18%),var(--bg-dark)] text-[var(--text-primary)]",
30
- className
31
- ),
32
- children: [
33
- /* @__PURE__ */ jsxs("header", { className: "border-b border-[var(--border-subtle)] bg-[radial-gradient(circle_at_top_left,rgba(98,114,243,0.12),transparent_34%),linear-gradient(180deg,rgba(255,255,255,0.04),transparent)]", children: [
34
- /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-3 px-4 py-3", children: [
35
- /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
36
- eyebrow && /* @__PURE__ */ jsx("div", { className: "mb-1 inline-flex max-w-full items-center rounded-full border border-[var(--border-accent)] bg-[var(--brand-cool)]/10 px-2.5 py-1 text-[10px] font-semibold uppercase tracking-[0.16em] text-[var(--brand-cool)]", children: eyebrow }),
37
- /* @__PURE__ */ jsx("div", { className: "min-w-0 text-[15px] font-semibold text-[var(--text-primary)]", children: title }),
38
- (subtitle || meta) && /* @__PURE__ */ jsxs("div", { className: "mt-1 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-xs leading-relaxed text-[var(--text-muted)]", children: [
39
- subtitle && /* @__PURE__ */ jsx("span", { className: "truncate", children: subtitle }),
40
- meta && /* @__PURE__ */ jsx("span", { className: "flex items-center gap-2", children: meta })
41
- ] })
42
- ] }),
43
- headerActions && /* @__PURE__ */ jsx("div", { className: "flex shrink-0 items-center gap-1.5", children: headerActions })
44
- ] }),
45
- tabs,
46
- toolbar && /* @__PURE__ */ jsx("div", { className: "border-t border-[var(--border-subtle)] px-3 py-2", children: toolbar })
47
- ] }),
48
- /* @__PURE__ */ jsx("div", { className: cn("min-h-0 flex-1 overflow-auto", contentClassName), children: hasContent ? children : emptyState ? /* @__PURE__ */ jsx("div", { className: "flex h-full items-center justify-center p-6", children: emptyState }) : null }),
49
- footer && /* @__PURE__ */ jsx("footer", { className: "shrink-0 border-t border-[var(--border-subtle)] bg-[var(--bg-card)] px-3 py-2", children: footer })
50
- ]
51
- }
52
- );
53
- }
54
-
55
11
  // src/files/file-tree.tsx
56
12
  import { useState } from "react";
57
13
  import {
@@ -65,7 +21,7 @@ import {
65
21
  ChevronRight,
66
22
  FileJson
67
23
  } from "lucide-react";
68
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
24
+ import { jsx, jsxs } from "react/jsx-runtime";
69
25
  function isNodeVisible(node, visibility) {
70
26
  if (!visibility) return true;
71
27
  if (visibility.hiddenPaths?.includes(node.path)) {
@@ -153,8 +109,8 @@ function TreeNode({ node, depth, selectedPath, onSelect, defaultExpanded }) {
153
109
  };
154
110
  const Icon = isDir ? expanded ? FolderOpen : Folder : getFileIcon(node.name);
155
111
  const iconColor = isDir ? "text-[var(--brand-cool)]" : getFileColor(node.name);
156
- return /* @__PURE__ */ jsxs2("div", { children: [
157
- /* @__PURE__ */ jsxs2(
112
+ return /* @__PURE__ */ jsxs("div", { children: [
113
+ /* @__PURE__ */ jsxs(
158
114
  "button",
159
115
  {
160
116
  onClick: handleClick,
@@ -166,7 +122,7 @@ function TreeNode({ node, depth, selectedPath, onSelect, defaultExpanded }) {
166
122
  ),
167
123
  style: { paddingLeft: `${depth * 16 + 8}px` },
168
124
  children: [
169
- isDir && /* @__PURE__ */ jsx2(
125
+ isDir && /* @__PURE__ */ jsx(
170
126
  ChevronRight,
171
127
  {
172
128
  className: cn(
@@ -175,17 +131,17 @@ function TreeNode({ node, depth, selectedPath, onSelect, defaultExpanded }) {
175
131
  )
176
132
  }
177
133
  ),
178
- !isDir && /* @__PURE__ */ jsx2("span", { className: "w-3" }),
179
- /* @__PURE__ */ jsx2(Icon, { className: cn("h-4 w-4 shrink-0", iconColor) }),
180
- /* @__PURE__ */ jsx2("span", { className: "truncate", children: node.name }),
181
- node.size !== void 0 && !isDir && /* @__PURE__ */ jsx2("span", { className: "text-[var(--text-muted)] text-xs ml-auto tabular-nums", children: formatSize(node.size) })
134
+ !isDir && /* @__PURE__ */ jsx("span", { className: "w-3" }),
135
+ /* @__PURE__ */ jsx(Icon, { className: cn("h-4 w-4 shrink-0", iconColor) }),
136
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: node.name }),
137
+ node.size !== void 0 && !isDir && /* @__PURE__ */ jsx("span", { className: "text-[var(--text-muted)] text-xs ml-auto tabular-nums", children: formatSize(node.size) })
182
138
  ]
183
139
  }
184
140
  ),
185
- isDir && expanded && node.children && /* @__PURE__ */ jsx2("div", { children: node.children.sort((a, b) => {
141
+ isDir && expanded && node.children && /* @__PURE__ */ jsx("div", { children: node.children.sort((a, b) => {
186
142
  if (a.type !== b.type) return a.type === "directory" ? -1 : 1;
187
143
  return a.name.localeCompare(b.name);
188
- }).map((child) => /* @__PURE__ */ jsx2(
144
+ }).map((child) => /* @__PURE__ */ jsx(
189
145
  TreeNode,
190
146
  {
191
147
  node: child,
@@ -215,10 +171,10 @@ function FileTree({
215
171
  if (!visibleRoot) {
216
172
  return null;
217
173
  }
218
- return /* @__PURE__ */ jsx2("div", { className: cn("text-sm font-[var(--font-sans)]", className), children: visibleRoot.children ? visibleRoot.children.sort((a, b) => {
174
+ return /* @__PURE__ */ jsx("div", { className: cn("text-sm font-[var(--font-sans)]", className), children: visibleRoot.children ? visibleRoot.children.sort((a, b) => {
219
175
  if (a.type !== b.type) return a.type === "directory" ? -1 : 1;
220
176
  return a.name.localeCompare(b.name);
221
- }).map((child) => /* @__PURE__ */ jsx2(
177
+ }).map((child) => /* @__PURE__ */ jsx(
222
178
  TreeNode,
223
179
  {
224
180
  node: child,
@@ -228,7 +184,7 @@ function FileTree({
228
184
  defaultExpanded
229
185
  },
230
186
  child.path
231
- )) : /* @__PURE__ */ jsx2(
187
+ )) : /* @__PURE__ */ jsx(
232
188
  TreeNode,
233
189
  {
234
190
  node: visibleRoot,
@@ -246,7 +202,7 @@ import {
246
202
  X,
247
203
  FileText as FileText2
248
204
  } from "lucide-react";
249
- import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
205
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
250
206
  function getPreviewType(filename, mimeType) {
251
207
  const ext = filename.split(".").pop()?.toLowerCase() || "";
252
208
  if (mimeType?.startsWith("application/pdf") || ext === "pdf") return "pdf";
@@ -287,26 +243,26 @@ function getPreviewLabel(previewType) {
287
243
  function CodePreview({ content, filename }) {
288
244
  const lines = content.split("\n");
289
245
  const language = filename.split(".").pop()?.toUpperCase() || "TXT";
290
- return /* @__PURE__ */ jsxs3("div", { className: "relative bg-[var(--bg-input)] rounded-[var(--radius-md)] border border-[var(--border-subtle)] overflow-hidden", children: [
291
- /* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between gap-3 border-b border-[var(--border-subtle)] px-4 py-2.5", children: [
292
- /* @__PURE__ */ jsxs3("div", { className: "flex gap-1.5", children: [
293
- /* @__PURE__ */ jsx3("div", { className: "w-3 h-3 rounded-full bg-[#FF5F57]" }),
294
- /* @__PURE__ */ jsx3("div", { className: "w-3 h-3 rounded-full bg-[#FEBC2E]" }),
295
- /* @__PURE__ */ jsx3("div", { className: "w-3 h-3 rounded-full bg-[#8E59FF]" })
246
+ return /* @__PURE__ */ jsxs2("div", { className: "relative bg-[var(--bg-input)] rounded-[var(--radius-md)] border border-[var(--border-subtle)] overflow-hidden", children: [
247
+ /* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between gap-3 border-b border-[var(--border-subtle)] px-4 py-2.5", children: [
248
+ /* @__PURE__ */ jsxs2("div", { className: "flex gap-1.5", children: [
249
+ /* @__PURE__ */ jsx2("div", { className: "w-3 h-3 rounded-full bg-[#FF5F57]" }),
250
+ /* @__PURE__ */ jsx2("div", { className: "w-3 h-3 rounded-full bg-[#FEBC2E]" }),
251
+ /* @__PURE__ */ jsx2("div", { className: "w-3 h-3 rounded-full bg-[#8E59FF]" })
296
252
  ] }),
297
- /* @__PURE__ */ jsx3("div", { className: "ml-2 min-w-0 flex-1 truncate text-xs font-[var(--font-mono)] text-[var(--text-muted)]", children: filename }),
298
- /* @__PURE__ */ jsxs3("div", { className: "inline-flex items-center gap-2 rounded-[var(--radius-full)] border border-[var(--border-subtle)] bg-[var(--bg-card)] px-2.5 py-1 text-[10px] font-semibold uppercase tracking-[0.12em] text-[var(--text-muted)]", children: [
299
- /* @__PURE__ */ jsx3("span", { children: language }),
300
- /* @__PURE__ */ jsx3("span", { className: "h-1 w-1 rounded-full bg-[var(--border-hover)]" }),
301
- /* @__PURE__ */ jsxs3("span", { children: [
253
+ /* @__PURE__ */ jsx2("div", { className: "ml-2 min-w-0 flex-1 truncate text-xs font-[var(--font-mono)] text-[var(--text-muted)]", children: filename }),
254
+ /* @__PURE__ */ jsxs2("div", { className: "inline-flex items-center gap-2 rounded-[var(--radius-full)] border border-[var(--border-subtle)] bg-[var(--bg-card)] px-2.5 py-1 text-[10px] font-semibold uppercase tracking-[0.12em] text-[var(--text-muted)]", children: [
255
+ /* @__PURE__ */ jsx2("span", { children: language }),
256
+ /* @__PURE__ */ jsx2("span", { className: "h-1 w-1 rounded-full bg-[var(--border-hover)]" }),
257
+ /* @__PURE__ */ jsxs2("span", { children: [
302
258
  lines.length,
303
259
  " lines"
304
260
  ] })
305
261
  ] })
306
262
  ] }),
307
- /* @__PURE__ */ jsx3("div", { className: "overflow-auto max-h-[70vh]", children: /* @__PURE__ */ jsx3("table", { className: "w-full", children: /* @__PURE__ */ jsx3("tbody", { children: lines.map((line, i) => /* @__PURE__ */ jsxs3("tr", { className: "hover:bg-[var(--bg-hover)]/50", children: [
308
- /* @__PURE__ */ jsx3("td", { className: "text-right pr-4 pl-4 py-0 select-none text-[var(--text-muted)] text-xs font-[var(--font-mono)] w-10 align-top leading-[1.55]", children: i + 1 }),
309
- /* @__PURE__ */ jsx3("td", { className: "pr-4 py-0 font-[var(--font-mono)] text-[13px] text-[var(--text-secondary)] leading-[1.55] whitespace-pre", children: line || " " })
263
+ /* @__PURE__ */ jsx2("div", { className: "overflow-auto max-h-[70vh]", children: /* @__PURE__ */ jsx2("table", { className: "w-full", children: /* @__PURE__ */ jsx2("tbody", { children: lines.map((line, i) => /* @__PURE__ */ jsxs2("tr", { className: "hover:bg-[var(--bg-hover)]/50", children: [
264
+ /* @__PURE__ */ jsx2("td", { className: "text-right pr-4 pl-4 py-0 select-none text-[var(--text-muted)] text-xs font-[var(--font-mono)] w-10 align-top leading-[1.55]", children: i + 1 }),
265
+ /* @__PURE__ */ jsx2("td", { className: "pr-4 py-0 font-[var(--font-mono)] text-[13px] text-[var(--text-secondary)] leading-[1.55] whitespace-pre", children: line || " " })
310
266
  ] }, i)) }) }) })
311
267
  ] });
312
268
  }
@@ -343,8 +299,8 @@ function CsvPreview({ content }) {
343
299
  const rows = lines.slice(1).map(
344
300
  (line) => parseCsvRow(line).map((cell) => cell.replace(/^"|"$/g, ""))
345
301
  );
346
- return /* @__PURE__ */ jsx3("div", { className: "overflow-auto max-h-[70vh] rounded-[var(--radius-md)] border border-[var(--border-subtle)]", children: /* @__PURE__ */ jsxs3("table", { className: "w-full text-sm", children: [
347
- /* @__PURE__ */ jsx3("thead", { children: /* @__PURE__ */ jsx3("tr", { className: "bg-[var(--bg-elevated)] sticky top-0", children: headers.map((h, i) => /* @__PURE__ */ jsx3(
302
+ return /* @__PURE__ */ jsx2("div", { className: "overflow-auto max-h-[70vh] rounded-[var(--radius-md)] border border-[var(--border-subtle)]", children: /* @__PURE__ */ jsxs2("table", { className: "w-full text-sm", children: [
303
+ /* @__PURE__ */ jsx2("thead", { children: /* @__PURE__ */ jsx2("tr", { className: "bg-[var(--bg-elevated)] sticky top-0", children: headers.map((h, i) => /* @__PURE__ */ jsx2(
348
304
  "th",
349
305
  {
350
306
  className: "px-3 py-2 text-left text-xs font-semibold text-[var(--text-secondary)] border-b border-[var(--border-subtle)] whitespace-nowrap",
@@ -352,7 +308,7 @@ function CsvPreview({ content }) {
352
308
  },
353
309
  i
354
310
  )) }) }),
355
- /* @__PURE__ */ jsx3("tbody", { children: rows.map((row, i) => /* @__PURE__ */ jsx3("tr", { className: "border-b border-[var(--border-subtle)] hover:bg-[var(--bg-hover)]/50", children: row.map((cell, j) => /* @__PURE__ */ jsx3(
311
+ /* @__PURE__ */ jsx2("tbody", { children: rows.map((row, i) => /* @__PURE__ */ jsx2("tr", { className: "border-b border-[var(--border-subtle)] hover:bg-[var(--bg-hover)]/50", children: row.map((cell, j) => /* @__PURE__ */ jsx2(
356
312
  "td",
357
313
  {
358
314
  className: "px-3 py-1.5 text-[var(--text-secondary)] font-[var(--font-mono)] text-xs whitespace-nowrap",
@@ -363,10 +319,10 @@ function CsvPreview({ content }) {
363
319
  ] }) });
364
320
  }
365
321
  function ImagePreview({ src, filename }) {
366
- return /* @__PURE__ */ jsx3("div", { className: "flex items-center justify-center p-4 bg-[var(--bg-input)] rounded-[var(--radius-md)] border border-[var(--border-subtle)]", children: /* @__PURE__ */ jsx3("img", { src, alt: filename, className: "max-w-full max-h-[70vh] object-contain rounded" }) });
322
+ return /* @__PURE__ */ jsx2("div", { className: "flex items-center justify-center p-4 bg-[var(--bg-input)] rounded-[var(--radius-md)] border border-[var(--border-subtle)]", children: /* @__PURE__ */ jsx2("img", { src, alt: filename, className: "max-w-full max-h-[70vh] object-contain rounded" }) });
367
323
  }
368
324
  function PdfPreview({ blobUrl, filename }) {
369
- return /* @__PURE__ */ jsx3("div", { className: "rounded-[var(--radius-md)] border border-[var(--border-subtle)] overflow-hidden bg-[var(--bg-input)]", children: /* @__PURE__ */ jsx3(
325
+ return /* @__PURE__ */ jsx2("div", { className: "rounded-[var(--radius-md)] border border-[var(--border-subtle)] overflow-hidden bg-[var(--bg-input)]", children: /* @__PURE__ */ jsx2(
370
326
  "iframe",
371
327
  {
372
328
  src: blobUrl,
@@ -376,31 +332,31 @@ function PdfPreview({ blobUrl, filename }) {
376
332
  ) });
377
333
  }
378
334
  function TextPreview({ content }) {
379
- return /* @__PURE__ */ jsx3("pre", { className: "bg-[var(--bg-input)] rounded-[var(--radius-md)] border border-[var(--border-subtle)] p-4 overflow-auto max-h-[70vh] text-sm text-[var(--text-secondary)] font-[var(--font-mono)] leading-[1.55]", children: content });
335
+ return /* @__PURE__ */ jsx2("pre", { className: "bg-[var(--bg-input)] rounded-[var(--radius-md)] border border-[var(--border-subtle)] p-4 overflow-auto max-h-[70vh] text-sm text-[var(--text-secondary)] font-[var(--font-mono)] leading-[1.55]", children: content });
380
336
  }
381
337
  function UnsupportedPreview({
382
338
  filename,
383
339
  title,
384
340
  description
385
341
  }) {
386
- return /* @__PURE__ */ jsxs3("div", { className: "flex flex-col items-center justify-center rounded-[var(--radius-md)] border border-dashed border-[var(--border-subtle)] bg-[var(--bg-input)] px-6 py-16 text-center text-[var(--text-muted)]", children: [
387
- /* @__PURE__ */ jsx3(FileText2, { className: "mb-3 h-12 w-12 opacity-30" }),
388
- /* @__PURE__ */ jsx3("p", { className: "text-sm text-[var(--text-secondary)]", children: title }),
389
- /* @__PURE__ */ jsx3("p", { className: "mt-1 max-w-md text-xs", children: description }),
390
- /* @__PURE__ */ jsx3("p", { className: "mt-4 text-[11px] uppercase tracking-[0.12em]", children: filename })
342
+ return /* @__PURE__ */ jsxs2("div", { className: "flex flex-col items-center justify-center rounded-[var(--radius-md)] border border-dashed border-[var(--border-subtle)] bg-[var(--bg-input)] px-6 py-16 text-center text-[var(--text-muted)]", children: [
343
+ /* @__PURE__ */ jsx2(FileText2, { className: "mb-3 h-12 w-12 opacity-30" }),
344
+ /* @__PURE__ */ jsx2("p", { className: "text-sm text-[var(--text-secondary)]", children: title }),
345
+ /* @__PURE__ */ jsx2("p", { className: "mt-1 max-w-md text-xs", children: description }),
346
+ /* @__PURE__ */ jsx2("p", { className: "mt-4 text-[11px] uppercase tracking-[0.12em]", children: filename })
391
347
  ] });
392
348
  }
393
349
  function MarkdownPreview({ content }) {
394
- return /* @__PURE__ */ jsx3("div", { className: "rounded-[var(--radius-md)] border border-[var(--border-subtle)] bg-[var(--bg-input)] p-5", children: /* @__PURE__ */ jsx3(Markdown, { className: "prose-sm max-w-none", children: content }) });
350
+ return /* @__PURE__ */ jsx2("div", { className: "rounded-[var(--radius-md)] border border-[var(--border-subtle)] bg-[var(--bg-input)] p-5", children: /* @__PURE__ */ jsx2(Markdown, { className: "prose-sm max-w-none", children: content }) });
395
351
  }
396
352
  function EmptyPreview({ filename }) {
397
- return /* @__PURE__ */ jsxs3("div", { className: "flex flex-col items-center justify-center py-16 text-[var(--text-muted)]", children: [
398
- /* @__PURE__ */ jsx3(FileText2, { className: "h-12 w-12 mb-3 opacity-30" }),
399
- /* @__PURE__ */ jsxs3("p", { className: "text-sm", children: [
353
+ return /* @__PURE__ */ jsxs2("div", { className: "flex flex-col items-center justify-center py-16 text-[var(--text-muted)]", children: [
354
+ /* @__PURE__ */ jsx2(FileText2, { className: "h-12 w-12 mb-3 opacity-30" }),
355
+ /* @__PURE__ */ jsxs2("p", { className: "text-sm", children: [
400
356
  "Cannot preview ",
401
357
  filename
402
358
  ] }),
403
- /* @__PURE__ */ jsx3("p", { className: "text-xs mt-1", children: "Download to view this file" })
359
+ /* @__PURE__ */ jsx2("p", { className: "text-xs mt-1", children: "Download to view this file" })
404
360
  ] });
405
361
  }
406
362
  function FilePreview({
@@ -416,41 +372,41 @@ function FilePreview({
416
372
  const previewType = getPreviewType(filename, mimeType);
417
373
  const previewLabel = getPreviewLabel(previewType);
418
374
  const hasRenderableSource = Boolean(content) || Boolean(blobUrl) || previewType === "unknown" || previewType === "spreadsheet";
419
- return /* @__PURE__ */ jsxs3("div", { className: cn("flex flex-col h-full", className), children: [
420
- !hideHeader && /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-2 px-3 py-2 border-b border-[var(--border-subtle)] shrink-0", children: [
421
- /* @__PURE__ */ jsxs3("div", { className: "min-w-0 flex-1", children: [
422
- /* @__PURE__ */ jsx3("div", { className: "truncate text-sm font-medium text-[var(--text-primary)]", children: filename }),
423
- /* @__PURE__ */ jsx3("div", { className: "mt-0.5 text-[11px] uppercase tracking-[0.12em] text-[var(--text-muted)]", children: previewLabel })
375
+ return /* @__PURE__ */ jsxs2("div", { className: cn("flex flex-col h-full", className), children: [
376
+ !hideHeader && /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2 px-3 py-2 border-b border-[var(--border-subtle)] shrink-0", children: [
377
+ /* @__PURE__ */ jsxs2("div", { className: "min-w-0 flex-1", children: [
378
+ /* @__PURE__ */ jsx2("div", { className: "truncate text-sm font-medium text-[var(--text-primary)]", children: filename }),
379
+ /* @__PURE__ */ jsx2("div", { className: "mt-0.5 text-[11px] uppercase tracking-[0.12em] text-[var(--text-muted)]", children: previewLabel })
424
380
  ] }),
425
- onDownload && /* @__PURE__ */ jsx3(
381
+ onDownload && /* @__PURE__ */ jsx2(
426
382
  "button",
427
383
  {
428
384
  type: "button",
429
385
  onClick: onDownload,
430
386
  "aria-label": `Download ${filename}`,
431
387
  className: "p-1.5 rounded-[var(--radius-sm)] hover:bg-[var(--bg-hover)] text-[var(--text-muted)] hover:text-[var(--text-secondary)] transition-colors",
432
- children: /* @__PURE__ */ jsx3(Download, { className: "h-4 w-4" })
388
+ children: /* @__PURE__ */ jsx2(Download, { className: "h-4 w-4" })
433
389
  }
434
390
  ),
435
- onClose && /* @__PURE__ */ jsx3(
391
+ onClose && /* @__PURE__ */ jsx2(
436
392
  "button",
437
393
  {
438
394
  type: "button",
439
395
  onClick: onClose,
440
396
  "aria-label": `Close ${filename}`,
441
397
  className: "p-1.5 rounded-[var(--radius-sm)] hover:bg-[var(--bg-hover)] text-[var(--text-muted)] hover:text-[var(--text-secondary)] transition-colors",
442
- children: /* @__PURE__ */ jsx3(X, { className: "h-4 w-4" })
398
+ children: /* @__PURE__ */ jsx2(X, { className: "h-4 w-4" })
443
399
  }
444
400
  )
445
401
  ] }),
446
- /* @__PURE__ */ jsxs3("div", { className: "flex-1 overflow-auto p-3", children: [
447
- previewType === "pdf" && blobUrl && /* @__PURE__ */ jsx3(PdfPreview, { blobUrl, filename }),
448
- previewType === "image" && blobUrl && /* @__PURE__ */ jsx3(ImagePreview, { src: blobUrl, filename }),
449
- previewType === "csv" && content && /* @__PURE__ */ jsx3(CsvPreview, { content }),
450
- (previewType === "code" || previewType === "json" || previewType === "yaml") && content && /* @__PURE__ */ jsx3(CodePreview, { content, filename }),
451
- previewType === "text" && content && /* @__PURE__ */ jsx3(TextPreview, { content }),
452
- previewType === "markdown" && content && /* @__PURE__ */ jsx3(MarkdownPreview, { content }),
453
- previewType === "spreadsheet" && /* @__PURE__ */ jsx3(
402
+ /* @__PURE__ */ jsxs2("div", { className: "flex-1 overflow-auto p-3", children: [
403
+ previewType === "pdf" && blobUrl && /* @__PURE__ */ jsx2(PdfPreview, { blobUrl, filename }),
404
+ previewType === "image" && blobUrl && /* @__PURE__ */ jsx2(ImagePreview, { src: blobUrl, filename }),
405
+ previewType === "csv" && content && /* @__PURE__ */ jsx2(CsvPreview, { content }),
406
+ (previewType === "code" || previewType === "json" || previewType === "yaml") && content && /* @__PURE__ */ jsx2(CodePreview, { content, filename }),
407
+ previewType === "text" && content && /* @__PURE__ */ jsx2(TextPreview, { content }),
408
+ previewType === "markdown" && content && /* @__PURE__ */ jsx2(MarkdownPreview, { content }),
409
+ previewType === "spreadsheet" && /* @__PURE__ */ jsx2(
454
410
  UnsupportedPreview,
455
411
  {
456
412
  filename,
@@ -458,8 +414,8 @@ function FilePreview({
458
414
  description: "Download the workbook or convert it to CSV when you need an inline preview."
459
415
  }
460
416
  ),
461
- previewType === "unknown" && /* @__PURE__ */ jsx3(EmptyPreview, { filename }),
462
- !hasRenderableSource && /* @__PURE__ */ jsx3(
417
+ previewType === "unknown" && /* @__PURE__ */ jsx2(EmptyPreview, { filename }),
418
+ !hasRenderableSource && /* @__PURE__ */ jsx2(
463
419
  UnsupportedPreview,
464
420
  {
465
421
  filename,
@@ -473,7 +429,7 @@ function FilePreview({
473
429
 
474
430
  // src/files/file-tabs.tsx
475
431
  import { X as X2, FileText as FileText3, FileCode as FileCode2, FileSpreadsheet as FileSpreadsheet2 } from "lucide-react";
476
- import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
432
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
477
433
  function getTabIcon(name) {
478
434
  const ext = name.split(".").pop()?.toLowerCase() || "";
479
435
  if (["pdf"].includes(ext)) return FileText3;
@@ -482,10 +438,10 @@ function getTabIcon(name) {
482
438
  }
483
439
  function FileTabs({ tabs, activeId, onSelect, onClose, className }) {
484
440
  if (tabs.length === 0) return null;
485
- return /* @__PURE__ */ jsx4("div", { className: cn("flex items-center border-b border-[var(--border-subtle)] bg-[var(--bg-dark)] overflow-x-auto", className), children: tabs.map((tab) => {
441
+ return /* @__PURE__ */ jsx3("div", { className: cn("flex items-center border-b border-[var(--border-subtle)] bg-[var(--bg-dark)] overflow-x-auto", className), children: tabs.map((tab) => {
486
442
  const isActive = tab.id === activeId;
487
443
  const Icon = getTabIcon(tab.name);
488
- return /* @__PURE__ */ jsxs4(
444
+ return /* @__PURE__ */ jsxs3(
489
445
  "div",
490
446
  {
491
447
  className: cn(
@@ -493,27 +449,27 @@ function FileTabs({ tabs, activeId, onSelect, onClose, className }) {
493
449
  isActive ? "bg-[var(--bg-card)] text-[var(--text-primary)] border-b-2 border-b-[var(--brand-cool)]" : "text-[var(--text-muted)] hover:bg-[var(--bg-elevated)]"
494
450
  ),
495
451
  children: [
496
- /* @__PURE__ */ jsxs4(
452
+ /* @__PURE__ */ jsxs3(
497
453
  "button",
498
454
  {
499
455
  type: "button",
500
456
  onClick: () => onSelect(tab.id),
501
457
  className: "flex min-w-0 items-center gap-1.5 px-3 py-1.5 text-xs transition-colors hover:text-[var(--text-secondary)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--brand-cool)]/60",
502
458
  children: [
503
- /* @__PURE__ */ jsx4(Icon, { className: "h-3 w-3 shrink-0" }),
504
- /* @__PURE__ */ jsx4("span", { className: "max-w-[120px] truncate", children: tab.name }),
505
- tab.dirty && /* @__PURE__ */ jsx4("span", { className: "h-1.5 w-1.5 rounded-full bg-[var(--brand-cool)]" })
459
+ /* @__PURE__ */ jsx3(Icon, { className: "h-3 w-3 shrink-0" }),
460
+ /* @__PURE__ */ jsx3("span", { className: "max-w-[120px] truncate", children: tab.name }),
461
+ tab.dirty && /* @__PURE__ */ jsx3("span", { className: "h-1.5 w-1.5 rounded-full bg-[var(--brand-cool)]" })
506
462
  ]
507
463
  }
508
464
  ),
509
- /* @__PURE__ */ jsx4(
465
+ /* @__PURE__ */ jsx3(
510
466
  "button",
511
467
  {
512
468
  type: "button",
513
469
  "aria-label": `Close ${tab.name}`,
514
470
  onClick: () => onClose(tab.id),
515
471
  className: "mr-1 rounded p-0.5 opacity-0 transition-opacity hover:bg-[var(--bg-hover)] focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--brand-cool)]/60 group-hover:opacity-100",
516
- children: /* @__PURE__ */ jsx4(X2, { className: "h-2.5 w-2.5" })
472
+ children: /* @__PURE__ */ jsx3(X2, { className: "h-2.5 w-2.5" })
517
473
  }
518
474
  )
519
475
  ]
@@ -524,8 +480,13 @@ function FileTabs({ tabs, activeId, onSelect, onClose, className }) {
524
480
  }
525
481
 
526
482
  // src/files/file-artifact-pane.tsx
483
+ import { lazy, Suspense } from "react";
527
484
  import { Download as Download2, X as X3 } from "lucide-react";
528
- import { Fragment, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
485
+ import { Fragment, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
486
+ var LazyDocumentEditorPane = lazy(async () => {
487
+ const module = await import("./document-editor-pane-AFBP2KFT.js");
488
+ return { default: module.DocumentEditorPane };
489
+ });
529
490
  function FileArtifactPane({
530
491
  filename,
531
492
  content,
@@ -542,10 +503,95 @@ function FileArtifactPane({
542
503
  meta,
543
504
  toolbar,
544
505
  footer,
545
- className
506
+ className,
507
+ editor
546
508
  }) {
547
509
  const showTabs = tabs.length > 0 && onTabSelect && onTabClose;
548
- return /* @__PURE__ */ jsx5(
510
+ const paneTabs = showTabs ? /* @__PURE__ */ jsx4(
511
+ FileTabs,
512
+ {
513
+ tabs,
514
+ activeId: activeTabId,
515
+ onSelect: onTabSelect,
516
+ onClose: onTabClose
517
+ }
518
+ ) : void 0;
519
+ const isMarkdown = mimeType === "text/markdown" || filename.toLowerCase().endsWith(".md") || path?.toLowerCase().endsWith(".md");
520
+ const isEditableMarkdown = isMarkdown && editor?.enabled;
521
+ const headerActions = /* @__PURE__ */ jsxs4(Fragment, { children: [
522
+ onDownload && /* @__PURE__ */ jsx4(
523
+ "button",
524
+ {
525
+ type: "button",
526
+ "aria-label": `Download ${filename}`,
527
+ onClick: onDownload,
528
+ className: "rounded-[var(--radius-sm)] p-1.5 text-[var(--text-muted)] transition-colors hover:bg-[var(--bg-hover)] hover:text-[var(--text-secondary)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--brand-cool)]/60",
529
+ children: /* @__PURE__ */ jsx4(Download2, { className: "h-4 w-4" })
530
+ }
531
+ ),
532
+ onClose && /* @__PURE__ */ jsx4(
533
+ "button",
534
+ {
535
+ type: "button",
536
+ "aria-label": `Close ${filename}`,
537
+ onClick: onClose,
538
+ className: "rounded-[var(--radius-sm)] p-1.5 text-[var(--text-muted)] transition-colors hover:bg-[var(--bg-hover)] hover:text-[var(--text-secondary)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--brand-cool)]/60",
539
+ children: /* @__PURE__ */ jsx4(X3, { className: "h-4 w-4" })
540
+ }
541
+ )
542
+ ] });
543
+ if (isEditableMarkdown) {
544
+ return /* @__PURE__ */ jsx4(
545
+ Suspense,
546
+ {
547
+ fallback: /* @__PURE__ */ jsx4(
548
+ ArtifactPane,
549
+ {
550
+ eyebrow,
551
+ title: filename,
552
+ subtitle: path,
553
+ meta,
554
+ toolbar,
555
+ footer,
556
+ className,
557
+ tabs: paneTabs,
558
+ headerActions,
559
+ children: /* @__PURE__ */ jsx4("div", { className: "flex min-h-[20rem] items-center justify-center rounded-[var(--radius-lg)] border border-dashed border-[var(--border-subtle)] bg-[var(--bg-card)]/40 text-sm text-[var(--text-muted)]", children: "Loading editor\u2026" })
560
+ }
561
+ ),
562
+ children: /* @__PURE__ */ jsx4(
563
+ LazyDocumentEditorPane,
564
+ {
565
+ eyebrow,
566
+ title: filename,
567
+ subtitle: path,
568
+ meta,
569
+ toolbar,
570
+ footer,
571
+ className,
572
+ tabs: paneTabs,
573
+ headerActions,
574
+ markdown: content ?? "",
575
+ mode: editor.mode,
576
+ defaultMode: editor.defaultMode,
577
+ onModeChange: editor.onModeChange,
578
+ backend: editor.backend,
579
+ collaboration: editor.collaboration,
580
+ placeholder: editor.placeholder,
581
+ autoFocus: editor.autoFocus,
582
+ readOnly: editor.readOnly,
583
+ saving: editor.saving,
584
+ saveLabel: editor.saveLabel,
585
+ onChange: editor.onChange,
586
+ onSave: editor.onSave,
587
+ previewClassName: editor.previewClassName,
588
+ editorClassName: editor.editorClassName
589
+ }
590
+ )
591
+ }
592
+ );
593
+ }
594
+ return /* @__PURE__ */ jsx4(
549
595
  ArtifactPane,
550
596
  {
551
597
  eyebrow,
@@ -555,38 +601,9 @@ function FileArtifactPane({
555
601
  toolbar,
556
602
  footer,
557
603
  className,
558
- tabs: showTabs ? /* @__PURE__ */ jsx5(
559
- FileTabs,
560
- {
561
- tabs,
562
- activeId: activeTabId,
563
- onSelect: onTabSelect,
564
- onClose: onTabClose
565
- }
566
- ) : void 0,
567
- headerActions: /* @__PURE__ */ jsxs5(Fragment, { children: [
568
- onDownload && /* @__PURE__ */ jsx5(
569
- "button",
570
- {
571
- type: "button",
572
- "aria-label": `Download ${filename}`,
573
- onClick: onDownload,
574
- className: "rounded-[var(--radius-sm)] p-1.5 text-[var(--text-muted)] transition-colors hover:bg-[var(--bg-hover)] hover:text-[var(--text-secondary)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--brand-cool)]/60",
575
- children: /* @__PURE__ */ jsx5(Download2, { className: "h-4 w-4" })
576
- }
577
- ),
578
- onClose && /* @__PURE__ */ jsx5(
579
- "button",
580
- {
581
- type: "button",
582
- "aria-label": `Close ${filename}`,
583
- onClick: onClose,
584
- className: "rounded-[var(--radius-sm)] p-1.5 text-[var(--text-muted)] transition-colors hover:bg-[var(--bg-hover)] hover:text-[var(--text-secondary)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--brand-cool)]/60",
585
- children: /* @__PURE__ */ jsx5(X3, { className: "h-4 w-4" })
586
- }
587
- )
588
- ] }),
589
- children: /* @__PURE__ */ jsx5(
604
+ tabs: paneTabs,
605
+ headerActions,
606
+ children: /* @__PURE__ */ jsx4(
590
607
  FilePreview,
591
608
  {
592
609
  filename,
@@ -601,7 +618,6 @@ function FileArtifactPane({
601
618
  }
602
619
 
603
620
  export {
604
- ArtifactPane,
605
621
  filterFileTree,
606
622
  FileTree,
607
623
  FilePreview,