@tangle-network/ui 11.51.8 → 11.51.10
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 +10 -0
- package/README.md +6 -0
- package/dist/chat/chat-message.js +2 -7
- package/dist/chat/user-message.js +3 -5
- package/dist/files/file-card.js +1 -1
- package/dist/files/file-tree.d.ts +0 -6
- package/dist/files/file-tree.js +2 -6
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/primitives/hover-card.d.ts +22 -13
- package/dist/primitives/hover-card.js +149 -40
- package/dist/primitives/popover.d.ts +3 -1
- package/dist/primitives/popover.js +15 -12
- package/dist/primitives/upload-progress.d.ts +0 -6
- package/dist/primitives/upload-progress.js +2 -6
- package/dist/run/run-group.js +2 -2
- package/dist/run/run-item-primitives.js +2 -2
- package/dist/run/run-row-shell.js +2 -2
- package/dist/run/status-meta.js +1 -1
- package/dist/utils/format.d.ts +14 -12
- package/dist/utils/format.js +50 -30
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +2 -2
- package/package.json +11 -2
- package/src/chat/chat-message.tsx +2 -7
- package/src/chat/user-message.tsx +3 -5
- package/src/files/file-tree.tsx +2 -7
- package/src/primitives/hover-card.tsx +64 -74
- package/src/primitives/popover.tsx +3 -3
- package/src/primitives/upload-progress.tsx +2 -7
- package/src/run/status-meta.tsx +2 -2
- package/src/utils/format.ts +50 -33
- package/src/utils/index.ts +1 -1
- package/src/utils/format.test.ts +0 -58
package/src/utils/format.test.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from "vitest";
|
|
2
|
-
import { formatBytes, formatUptime, plainTextFromMarkdown } from "./format";
|
|
3
|
-
|
|
4
|
-
describe("formatUptime", () => {
|
|
5
|
-
it("renders seconds for short durations", () => {
|
|
6
|
-
expect(formatUptime(0)).toBe("0s");
|
|
7
|
-
expect(formatUptime(7_500)).toBe("7s");
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
it("renders minutes and seconds under an hour", () => {
|
|
11
|
-
expect(formatUptime(90_000)).toBe("1m 30s");
|
|
12
|
-
expect(formatUptime(59 * 60_000 + 12_000)).toBe("59m 12s");
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it("renders hours and minutes under a day", () => {
|
|
16
|
-
expect(formatUptime(3_600_000)).toBe("1h 0m");
|
|
17
|
-
expect(formatUptime(5 * 3_600_000 + 30 * 60_000)).toBe("5h 30m");
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it("renders days and hours for multi-day durations", () => {
|
|
21
|
-
expect(formatUptime(86_400_000)).toBe("1d 0h");
|
|
22
|
-
expect(formatUptime(86_400_000 * 3 + 3_600_000 * 4)).toBe("3d 4h");
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it("handles invalid input", () => {
|
|
26
|
-
expect(formatUptime(Number.NaN)).toBe("—");
|
|
27
|
-
expect(formatUptime(-1)).toBe("—");
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
describe("formatBytes", () => {
|
|
32
|
-
it("renders bytes, KB, MB, GB progressively", () => {
|
|
33
|
-
expect(formatBytes(512)).toBe("512 B");
|
|
34
|
-
expect(formatBytes(2_048)).toBe("2.0 KB");
|
|
35
|
-
expect(formatBytes(5 * 1024 * 1024)).toBe("5.0 MB");
|
|
36
|
-
expect(formatBytes(2.5 * 1024 * 1024 * 1024)).toBe("2.50 GB");
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it("handles invalid input", () => {
|
|
40
|
-
expect(formatBytes(Number.NaN)).toBe("—");
|
|
41
|
-
expect(formatBytes(-1)).toBe("—");
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
describe("plainTextFromMarkdown", () => {
|
|
46
|
-
it("drops emphasis, headings, list markers, code marks and link syntax", () => {
|
|
47
|
-
expect(plainTextFromMarkdown("**Ensuring workspace configuration** I need to check")).toBe("Ensuring workspace configuration I need to check");
|
|
48
|
-
expect(plainTextFromMarkdown("## Plan\n- item one\n- *soft* point")).toBe("Plan\nitem one\nsoft point");
|
|
49
|
-
expect(plainTextFromMarkdown("see [docs](https://example.com) and _this_")).toBe("see docs and this");
|
|
50
|
-
expect(plainTextFromMarkdown("**bold** and __also__ ~~gone~~")).toBe("bold and also gone");
|
|
51
|
-
expect(plainTextFromMarkdown("1. First\n2) Second")).toBe("First\nSecond");
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it("keeps characters that are not markdown marks", () => {
|
|
55
|
-
expect(plainTextFromMarkdown("read `src/a_b.ts` and snake_case_name")).toBe("read src/a_b.ts and snake_case_name");
|
|
56
|
-
expect(plainTextFromMarkdown("2 * 3 * 4 = 24")).toBe("2 * 3 * 4 = 24");
|
|
57
|
-
});
|
|
58
|
-
});
|