@tangle-network/ui 11.24.0 → 11.26.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.
Files changed (56) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +22 -0
  3. package/dist/chat/agent-timeline.d.ts +13 -1
  4. package/dist/chat/agent-timeline.js +25 -4
  5. package/dist/chat/chat-message.d.ts +13 -1
  6. package/dist/chat/chat-message.js +9 -5
  7. package/dist/chat/message-author.d.ts +24 -0
  8. package/dist/chat/message-author.js +53 -0
  9. package/dist/chat/user-message.d.ts +12 -2
  10. package/dist/chat/user-message.js +52 -16
  11. package/dist/chat.d.ts +3 -1
  12. package/dist/chat.js +2 -1
  13. package/dist/editor/editor-peers.js +1 -21
  14. package/dist/files/file-card.d.ts +30 -0
  15. package/dist/files/file-card.js +162 -0
  16. package/dist/files/file-list.d.ts +25 -0
  17. package/dist/files/file-list.js +88 -0
  18. package/dist/files/file-preview.js +16 -62
  19. package/dist/files/pdf-loader.d.ts +22 -0
  20. package/dist/files/pdf-loader.js +82 -0
  21. package/dist/files/pdf-viewer.d.ts +32 -0
  22. package/dist/files/pdf-viewer.js +567 -0
  23. package/dist/files.d.ts +5 -1
  24. package/dist/files.js +5 -1
  25. package/dist/index.d.ts +9 -4
  26. package/dist/index.js +6 -1
  27. package/dist/lib/optional-peer.js +29 -0
  28. package/dist/primitives.d.ts +2 -2
  29. package/dist/types/message.d.ts +19 -0
  30. package/dist/types.d.ts +2 -2
  31. package/package.json +7 -2
  32. package/src/chat/agent-timeline.tsx +33 -3
  33. package/src/chat/chat-message.tsx +37 -10
  34. package/src/chat/index.ts +2 -0
  35. package/src/chat/message-author.stories.tsx +170 -0
  36. package/src/chat/message-author.test.tsx +189 -0
  37. package/src/chat/message-author.tsx +52 -0
  38. package/src/chat/user-message.tsx +63 -8
  39. package/src/editor/editor-peers.ts +3 -25
  40. package/src/files/file-artifact-pane.test.tsx +12 -2
  41. package/src/files/file-card.test.tsx +62 -0
  42. package/src/files/file-card.tsx +210 -0
  43. package/src/files/file-list.stories.tsx +121 -0
  44. package/src/files/file-list.test.tsx +81 -0
  45. package/src/files/file-list.tsx +167 -0
  46. package/src/files/file-preview.tsx +25 -94
  47. package/src/files/index.ts +9 -0
  48. package/src/files/pdf-loader.test.ts +130 -0
  49. package/src/files/pdf-loader.ts +169 -0
  50. package/src/files/pdf-viewer.stories.tsx +81 -0
  51. package/src/files/pdf-viewer.test.tsx +245 -0
  52. package/src/files/pdf-viewer.tsx +677 -0
  53. package/src/files/pdfjs-worker.d.ts +3 -0
  54. package/src/lib/optional-peer.ts +30 -0
  55. package/src/markdown/code-block.test.tsx +2 -1
  56. package/src/types/message.ts +20 -0
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Shared handling for optional peers that an entry reaches through a dynamic
3
+ * `import()`: `./editor` for tiptap, yjs and Hocuspocus, `./files` for
4
+ * pdfjs-dist. `scripts/validate-dist.mjs` holds the rules these helpers serve.
5
+ */
6
+
7
+ /** The messages a bundler or a runtime gives for a module it cannot resolve. */
8
+ const RESOLUTION_FAILURE =
9
+ /could not resolve|cannot find (?:module|package)|can't resolve|failed to resolve|module not found/i;
10
+
11
+ /**
12
+ * True when the rejection says the package is not installed. Only such an
13
+ * error gets the install list: a transient chunk-fetch failure that reads as
14
+ * "install the peers" sends the reader to the wrong fix. An error this
15
+ * predicate does not match keeps its own message, so it can only
16
+ * under-report.
17
+ */
18
+ export function isMissingPeerError(error: unknown): boolean {
19
+ return error instanceof Error && RESOLUTION_FAILURE.test(error.message);
20
+ }
21
+
22
+ /**
23
+ * Hands an `import()` rejection on unchanged. esbuild reports an unresolvable
24
+ * literal `import()` as a build error and defers it to run time only when the
25
+ * call carries a `.catch()`, so every peer import attaches this handler. It
26
+ * changes nothing at run time.
27
+ */
28
+ export function rethrow(error: unknown): never {
29
+ throw error;
30
+ }
@@ -17,7 +17,8 @@ describe("CodeBlock scoped semantic colors", () => {
17
17
  it("keeps code readable before the renderer loads, then applies live semantic colors and line numbers", async () => {
18
18
  const { container } = render(<CodeBlock code={'const message = "hello";'} language="javascript" showLineNumbers />);
19
19
  expect(container.querySelector("pre code")?.textContent).toBe('const message = "hello";');
20
- await waitFor(() => expect(container.innerHTML).toContain("var(--syntax-keyword, currentColor)"));
20
+ // The highlighter loads asynchronously; under a full parallel run it can take longer than waitFor's 1s default.
21
+ await waitFor(() => expect(container.innerHTML).toContain("var(--syntax-keyword, currentColor)"), { timeout: 10_000 });
21
22
  expect(container.innerHTML).toContain("var(--syntax-string, currentColor)");
22
23
  expect(container.innerHTML).toContain("var(--syntax-comment, currentColor)");
23
24
  expect(container.querySelector(".react-syntax-highlighter-line-number")).not.toBeNull();
@@ -11,3 +11,23 @@ export interface SessionMessage {
11
11
  /** Monotonically increasing insertion index for stable ordering. */
12
12
  _insertionIndex?: number;
13
13
  }
14
+
15
+ /**
16
+ * Who wrote a chat message, for a transcript with more than one person beside
17
+ * the agent: a client, an attorney and the agent in one thread.
18
+ */
19
+ export interface ChatAuthor {
20
+ /**
21
+ * Stable participant id. A transcript's `viewerId` is compared with it to
22
+ * tell the reader's own messages apart, and it keys the avatar's tone.
23
+ */
24
+ id: string;
25
+ name: string;
26
+ /**
27
+ * The participant's part in the conversation, shown as a tag beside the
28
+ * name, such as "Attorney". Unrelated to the message's `role`.
29
+ */
30
+ role?: string;
31
+ /** Falls back to initials when absent or when the image fails to load. */
32
+ avatarUrl?: string;
33
+ }