@tangle-network/ui 11.7.0 → 11.8.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @tangle-network/ui
2
2
 
3
+ ## 11.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 3416c80: `FileArtifactPane` (and `FilePreview`, its body) now previews every file kind a sandbox produces, so a product no longer builds its own image, PDF, CSV, video, audio, or spreadsheet viewers. Pass `blobUrl` (an object URL or remote URL) for binary content and the pane renders an image fit to the pane on a checker ground (click for natural size), a PDF at full pane height, or a video/audio player; pass `content` for CSV and the pane parses quoted commas and line breaks (RFC 4180) into a sticky-header table capped at `CSV_PREVIEW_ROW_LIMIT` (500) rows with a "Showing N of M rows" line; an `.xlsx`/`.xls` file renders a download card with the filename, its size when the new optional `size` prop (bytes) is set, and a Download button wired to `onDownload`. A file with no `blobUrl` and no text content renders one sentence, "This file needs a download link to preview.", with the same Download button. Text, code, JSON, YAML, and markdown render as before. `@tangle-network/ui/files` also exports the pure `resolveFilePreviewKind(filename, mimeType)` helper (`FilePreviewKind`: MIME type wins over extension; anything unmatched is `binary`), `parseCsv`, and `CSV_PREVIEW_ROW_LIMIT`; `detectFileFormat` gains the `video` and `audio` formats and the `avif` image extension.
8
+
3
9
  ## 11.7.0
4
10
 
5
11
  ### Minor Changes
package/dist/chat.js CHANGED
@@ -5,17 +5,18 @@ import {
5
5
  MessageList,
6
6
  ThinkingIndicator,
7
7
  UserMessage
8
- } from "./chunk-VDCZHOOO.js";
9
- import "./chunk-UYTRNR7Z.js";
10
- import "./chunk-CVX53NCC.js";
11
- import "./chunk-XT4JMYVB.js";
12
- import "./chunk-EIUE5GV2.js";
13
- import "./chunk-AAUNOHVL.js";
8
+ } from "./chunk-X53RZSX6.js";
9
+ import "./chunk-565EATZZ.js";
10
+ import "./chunk-OXZRCXJK.js";
11
+ import "./chunk-KNYSKNZX.js";
12
+ import "./chunk-ND3ZFXQK.js";
13
+ import "./chunk-NWECTSOH.js";
14
14
  import "./chunk-L57WRIND.js";
15
15
  import "./chunk-3M7BPSSW.js";
16
16
  import "./chunk-GYPQXTJU.js";
17
+ import "./chunk-4CLN43XT.js";
18
+ import "./chunk-XU3HB5QL.js";
17
19
  import "./chunk-MKTSMWVD.js";
18
- import "./chunk-ZRVH3WCA.js";
19
20
  import "./chunk-P5F43A65.js";
20
21
  import "./chunk-WUQDUBJG.js";
21
22
  import "./chunk-RQHJBTEU.js";
@@ -0,0 +1,45 @@
1
+ // src/utils/format.ts
2
+ function formatDuration(ms) {
3
+ if (ms < 1e3) return "<1s";
4
+ const seconds = Math.floor(ms / 1e3);
5
+ if (seconds < 60) return `${seconds}s`;
6
+ const minutes = Math.floor(seconds / 60);
7
+ const remaining = seconds % 60;
8
+ return remaining > 0 ? `${minutes}m ${remaining}s` : `${minutes}m`;
9
+ }
10
+ function truncateText(text, max) {
11
+ const cleaned = text.replace(/\s+/g, " ").trim();
12
+ if (cleaned.length <= max) return cleaned;
13
+ return cleaned.slice(0, max).trim() + "...";
14
+ }
15
+ function formatUptime(ms) {
16
+ if (!Number.isFinite(ms) || ms < 0) return "\u2014";
17
+ const totalSeconds = Math.floor(ms / 1e3);
18
+ if (totalSeconds < 60) return `${totalSeconds}s`;
19
+ const minutes = Math.floor(totalSeconds / 60);
20
+ const seconds = totalSeconds % 60;
21
+ if (minutes < 60) return `${minutes}m ${seconds}s`;
22
+ const hours = Math.floor(minutes / 60);
23
+ const remMinutes = minutes % 60;
24
+ if (hours < 24) return `${hours}h ${remMinutes}m`;
25
+ const days = Math.floor(hours / 24);
26
+ const remHours = hours % 24;
27
+ return `${days}d ${remHours}h`;
28
+ }
29
+ function formatBytes(bytes) {
30
+ if (!Number.isFinite(bytes) || bytes < 0) return "\u2014";
31
+ if (bytes < 1024) return `${Math.round(bytes)} B`;
32
+ const kb = bytes / 1024;
33
+ if (kb < 1024) return `${kb < 10 ? kb.toFixed(1) : Math.round(kb)} KB`;
34
+ const mb = kb / 1024;
35
+ if (mb < 1024) return `${mb < 10 ? mb.toFixed(1) : Math.round(mb)} MB`;
36
+ const gb = mb / 1024;
37
+ return `${gb < 10 ? gb.toFixed(2) : gb.toFixed(1)} GB`;
38
+ }
39
+
40
+ export {
41
+ formatDuration,
42
+ truncateText,
43
+ formatUptime,
44
+ formatBytes
45
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getToolCategory
3
- } from "./chunk-EIUE5GV2.js";
3
+ } from "./chunk-ND3ZFXQK.js";
4
4
 
5
5
  // src/hooks/use-run-groups.ts
6
6
  import { useMemo } from "react";
@@ -11,7 +11,7 @@ import {
11
11
  } from "./chunk-OEX7NZE3.js";
12
12
  import {
13
13
  parseToolEvent
14
- } from "./chunk-6RIX7M27.js";
14
+ } from "./chunk-Q7ZR6LSD.js";
15
15
 
16
16
  // src/hooks/use-dropdown-menu.ts
17
17
  import { useEffect, useRef, useState } from "react";
@@ -1,9 +1,8 @@
1
1
  import {
2
- formatDuration,
3
2
  getToolCategory,
4
3
  getToolDisplayMetadata,
5
4
  getToolErrorText
6
- } from "./chunk-EIUE5GV2.js";
5
+ } from "./chunk-ND3ZFXQK.js";
7
6
  import {
8
7
  CommandPreview,
9
8
  DiffPreview,
@@ -12,10 +11,13 @@ import {
12
11
  QuestionPreview,
13
12
  WebSearchPreview,
14
13
  WriteFilePreview
15
- } from "./chunk-AAUNOHVL.js";
14
+ } from "./chunk-NWECTSOH.js";
16
15
  import {
17
16
  TextShimmer
18
17
  } from "./chunk-L57WRIND.js";
18
+ import {
19
+ formatDuration
20
+ } from "./chunk-4CLN43XT.js";
19
21
  import {
20
22
  CodeBlock
21
23
  } from "./chunk-WUQDUBJG.js";
@@ -171,52 +171,9 @@ function getToolErrorText(part, fallback) {
171
171
  return part.state.error || fallback;
172
172
  }
173
173
 
174
- // src/utils/format.ts
175
- function formatDuration(ms) {
176
- if (ms < 1e3) return "<1s";
177
- const seconds = Math.floor(ms / 1e3);
178
- if (seconds < 60) return `${seconds}s`;
179
- const minutes = Math.floor(seconds / 60);
180
- const remaining = seconds % 60;
181
- return remaining > 0 ? `${minutes}m ${remaining}s` : `${minutes}m`;
182
- }
183
- function truncateText(text, max) {
184
- const cleaned = text.replace(/\s+/g, " ").trim();
185
- if (cleaned.length <= max) return cleaned;
186
- return cleaned.slice(0, max).trim() + "...";
187
- }
188
- function formatUptime(ms) {
189
- if (!Number.isFinite(ms) || ms < 0) return "\u2014";
190
- const totalSeconds = Math.floor(ms / 1e3);
191
- if (totalSeconds < 60) return `${totalSeconds}s`;
192
- const minutes = Math.floor(totalSeconds / 60);
193
- const seconds = totalSeconds % 60;
194
- if (minutes < 60) return `${minutes}m ${seconds}s`;
195
- const hours = Math.floor(minutes / 60);
196
- const remMinutes = minutes % 60;
197
- if (hours < 24) return `${hours}h ${remMinutes}m`;
198
- const days = Math.floor(hours / 24);
199
- const remHours = hours % 24;
200
- return `${days}d ${remHours}h`;
201
- }
202
- function formatBytes(bytes) {
203
- if (!Number.isFinite(bytes) || bytes < 0) return "\u2014";
204
- if (bytes < 1024) return `${Math.round(bytes)} B`;
205
- const kb = bytes / 1024;
206
- if (kb < 1024) return `${kb < 10 ? kb.toFixed(1) : Math.round(kb)} KB`;
207
- const mb = kb / 1024;
208
- if (mb < 1024) return `${mb < 10 ? mb.toFixed(1) : Math.round(mb)} MB`;
209
- const gb = mb / 1024;
210
- return `${gb < 10 ? gb.toFixed(2) : gb.toFixed(1)} GB`;
211
- }
212
-
213
174
  export {
214
175
  TOOL_CATEGORY_ICONS,
215
176
  getToolCategory,
216
177
  getToolDisplayMetadata,
217
- getToolErrorText,
218
- formatDuration,
219
- truncateText,
220
- formatUptime,
221
- formatBytes
178
+ getToolErrorText
222
179
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getSyntaxLanguage
3
- } from "./chunk-ZRVH3WCA.js";
3
+ } from "./chunk-XU3HB5QL.js";
4
4
  import {
5
5
  CodeBlock,
6
6
  CopyButton
@@ -2,17 +2,17 @@ import {
2
2
  ExpandableContent,
3
3
  InlineToolItem,
4
4
  RunRowShell
5
- } from "./chunk-XT4JMYVB.js";
6
- import {
7
- formatDuration,
8
- truncateText
9
- } from "./chunk-EIUE5GV2.js";
5
+ } from "./chunk-KNYSKNZX.js";
10
6
  import {
11
7
  TextShimmer
12
8
  } from "./chunk-L57WRIND.js";
13
9
  import {
14
10
  OpenUIArtifactRenderer
15
11
  } from "./chunk-3M7BPSSW.js";
12
+ import {
13
+ formatDuration,
14
+ truncateText
15
+ } from "./chunk-4CLN43XT.js";
16
16
  import {
17
17
  Markdown
18
18
  } from "./chunk-P5F43A65.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ToolCallGroup,
3
3
  ToolCallStep
4
- } from "./chunk-XT4JMYVB.js";
4
+ } from "./chunk-KNYSKNZX.js";
5
5
  import {
6
6
  Markdown
7
7
  } from "./chunk-P5F43A65.js";
@@ -2,18 +2,18 @@ import {
2
2
  useAutoScroll,
3
3
  useRunCollapseState,
4
4
  useRunGroups
5
- } from "./chunk-UYTRNR7Z.js";
5
+ } from "./chunk-565EATZZ.js";
6
6
  import {
7
7
  InlineThinkingItem,
8
8
  RunGroup
9
- } from "./chunk-CVX53NCC.js";
9
+ } from "./chunk-OXZRCXJK.js";
10
10
  import {
11
11
  ToolCallGroup,
12
12
  ToolCallStep
13
- } from "./chunk-XT4JMYVB.js";
13
+ } from "./chunk-KNYSKNZX.js";
14
14
  import {
15
15
  getToolDisplayMetadata
16
- } from "./chunk-EIUE5GV2.js";
16
+ } from "./chunk-ND3ZFXQK.js";
17
17
  import {
18
18
  OpenUIArtifactRenderer
19
19
  } from "./chunk-3M7BPSSW.js";