@elabs-ai/components-ai 4.1.0 → 4.2.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 (84) hide show
  1. package/README.md +2 -2
  2. package/dist/index.d.ts +43 -16
  3. package/dist/index.js +1297 -926
  4. package/dist/index.js.map +1 -1
  5. package/package.json +9 -9
  6. package/src/__contract__/audio-visualizer.contract.test.tsx +49 -0
  7. package/src/__contract__/chat-shell.contract.test.tsx +49 -0
  8. package/src/__contract__/grouped-parts.contract.test.tsx +49 -0
  9. package/src/__contract__/image.contract.test.tsx +49 -0
  10. package/src/__contract__/markdown-view.contract.test.tsx +49 -0
  11. package/src/__contract__/message-feedback.contract.test.tsx +49 -0
  12. package/src/__contract__/message-form.contract.test.tsx +49 -0
  13. package/src/__contract__/message-table.contract.test.tsx +49 -0
  14. package/src/__contract__/model-provider-logo.contract.test.tsx +49 -0
  15. package/src/__contract__/persona.contract.test.tsx +49 -0
  16. package/src/__contract__/prompt-input-effort.contract.test.tsx +49 -0
  17. package/src/__contract__/prompt-input-mode.contract.test.tsx +49 -0
  18. package/src/_chat-shell-rail.tsx +2 -2
  19. package/src/_lazy-cjk.test.ts +43 -0
  20. package/src/_lazy-cjk.ts +73 -0
  21. package/src/_lazy-math.test.ts +63 -0
  22. package/src/_lazy-math.ts +90 -0
  23. package/src/_streamdown-i18n.ts +73 -21
  24. package/src/_streamdown-safety.ts +2 -2
  25. package/src/_theme-scope-store.test.ts +83 -0
  26. package/src/_theme-scope-store.ts +103 -0
  27. package/src/agent-event.tsx +1 -1
  28. package/src/agent.tsx +18 -13
  29. package/src/artifact.tsx +2 -2
  30. package/src/asset-preview.test.tsx +40 -0
  31. package/src/asset-preview.tsx +83 -12
  32. package/src/attachments.tsx +7 -4
  33. package/src/code-block.test.tsx +100 -1
  34. package/src/code-block.tsx +166 -103
  35. package/src/commit.tsx +30 -41
  36. package/src/confirmation.tsx +1 -1
  37. package/src/context-panel.tsx +1 -1
  38. package/src/conversation.stories.tsx +23 -0
  39. package/src/conversation.test.tsx +53 -0
  40. package/src/conversation.tsx +32 -7
  41. package/src/diff-view.test.tsx +52 -2
  42. package/src/diff-view.tsx +89 -34
  43. package/src/environment-variables.tsx +20 -37
  44. package/src/file-tree.test.tsx +21 -0
  45. package/src/file-tree.tsx +12 -2
  46. package/src/inline-citation.tsx +5 -5
  47. package/src/jsx-preview.tsx +151 -43
  48. package/src/markdown-view.test.tsx +7 -3
  49. package/src/markdown-view.tsx +8 -1
  50. package/src/message-form.stories.tsx +36 -3
  51. package/src/message-form.test.tsx +8 -2
  52. package/src/message-form.tsx +15 -7
  53. package/src/message-table.stories.tsx +2 -2
  54. package/src/message-table.test.tsx +7 -0
  55. package/src/message-table.tsx +8 -4
  56. package/src/message.test.tsx +73 -3
  57. package/src/message.tsx +36 -12
  58. package/src/model-provider-logo.test.tsx +57 -3
  59. package/src/model-provider-logo.tsx +45 -11
  60. package/src/open-in-chat.tsx +50 -29
  61. package/src/package-info.tsx +12 -12
  62. package/src/prompt-input-slash.stories.tsx +1 -1
  63. package/src/prompt-input.test.tsx +67 -1
  64. package/src/prompt-input.tsx +42 -4
  65. package/src/queue.tsx +4 -4
  66. package/src/reasoning.tsx +17 -6
  67. package/src/sandbox.tsx +3 -3
  68. package/src/schema-display.test.tsx +56 -0
  69. package/src/schema-display.tsx +68 -37
  70. package/src/session-header.tsx +1 -1
  71. package/src/snippet.test.tsx +6 -2
  72. package/src/snippet.tsx +14 -34
  73. package/src/speech-input.test.tsx +109 -0
  74. package/src/speech-input.tsx +31 -3
  75. package/src/stack-trace.tsx +20 -36
  76. package/src/streamdown-i18n.test.tsx +23 -0
  77. package/src/test-results.tsx +47 -27
  78. package/src/token-usage.tsx +6 -6
  79. package/src/tool.test.tsx +65 -0
  80. package/src/tool.tsx +59 -23
  81. package/src/transcription.tsx +1 -1
  82. package/src/voice-selector.tsx +5 -5
  83. package/src/web-preview.test.tsx +51 -1
  84. package/src/web-preview.tsx +39 -8
package/README.md CHANGED
@@ -115,7 +115,7 @@ it regardless of what your app's manifest says. A hoisting layout
115
115
  additionally makes `import("mermaid")` resolve, so the runtime capability-gap
116
116
  panel never renders for you; skipping the peer still means you never have to
117
117
  declare `mermaid` yourself, and a genuinely unresolved engine still fails
118
- actionably rather than crashing. `pnpm optional-peers:check` (issue #94)
118
+ actionably rather than crashing. `pnpm check --rule optional-peer-transitives` (issue #94)
119
119
  tracks this as a defeated optional peer and will fail the day it is fixed
120
120
  upstream.
121
121
 
@@ -178,6 +178,6 @@ Heavy engines load on demand rather than riding in your entry chunk:
178
178
  `preloadMermaid()` to warm it early on a surface you know renders diagrams.
179
179
  - **The Rive WebGL2 runtime** loads only when a `Persona` mounts.
180
180
 
181
- Both are enforced by `pnpm heavy-deps:check`. See ADR 0019. The remaining eager
181
+ Both are enforced by `pnpm check --rule eager-heavy-deps`. See ADR 0019. The remaining eager
182
182
  engines (React Flow, xterm, media-chrome) are tracked in that gate's baseline
183
183
  (the React Flow canvas set is a separate, intentional surface — see ADR 0018).
package/dist/index.d.ts CHANGED
@@ -702,7 +702,7 @@ interface TokenizedCode {
702
702
  fg: string;
703
703
  bg: string;
704
704
  }
705
- declare const highlightCode: (code: string, language: BundledLanguage, callback?: (result: TokenizedCode) => void, el?: Element | null) => TokenizedCode | null;
705
+ declare const highlightCode: (code: string, language: BundledLanguage, callback?: (result: TokenizedCode) => void, el?: Element | null, skipCache?: boolean) => TokenizedCode | null;
706
706
  declare const CodeBlockContainer: ({ className, language, style, ...props }: HTMLAttributes<HTMLDivElement> & {
707
707
  language: string;
708
708
  }) => react.JSX.Element;
@@ -710,11 +710,12 @@ declare const CodeBlockHeader: ({ children, className, ...props }: HTMLAttribute
710
710
  declare const CodeBlockTitle: ({ children, className, ...props }: HTMLAttributes<HTMLDivElement>) => react.JSX.Element;
711
711
  declare const CodeBlockFilename: ({ children, className, ...props }: HTMLAttributes<HTMLSpanElement>) => react.JSX.Element;
712
712
  declare const CodeBlockActions: ({ children, className, ...props }: HTMLAttributes<HTMLDivElement>) => react.JSX.Element;
713
- declare const CodeBlockContent: ({ code, language, showLineNumbers, wrap, }: {
713
+ declare const CodeBlockContent: ({ code, language, showLineNumbers, wrap, isStreaming, }: {
714
714
  code: string;
715
715
  language: BundledLanguage;
716
716
  showLineNumbers?: boolean;
717
717
  wrap?: boolean;
718
+ isStreaming?: boolean;
718
719
  }) => react.JSX.Element;
719
720
  declare const CodeBlock: ({ code, language, showLineNumbers, wrap, isStreaming, className, children, ...props }: CodeBlockProps) => react.JSX.Element;
720
721
  type CodeBlockCopyButtonProps = ComponentProps<typeof Button> & {
@@ -766,7 +767,7 @@ type CommitCopyButtonProps = ComponentProps<typeof Button> & {
766
767
  onError?: (error: Error) => void;
767
768
  timeout?: number;
768
769
  };
769
- declare const CommitCopyButton: ({ hash, onCopy, onError, timeout, children, className, ...props }: CommitCopyButtonProps) => react.JSX.Element;
770
+ declare const CommitCopyButton: ({ hash, onCopy, onError, timeout, children, className, "aria-label": ariaLabel, ...props }: CommitCopyButtonProps) => react.JSX.Element;
770
771
  type CommitContentProps = ComponentProps<typeof CollapsibleContent>;
771
772
  declare const CommitContent: ({ className, children, ...props }: CommitContentProps) => react.JSX.Element;
772
773
  type CommitFilesProps = HTMLAttributes<HTMLDivElement>;
@@ -1490,8 +1491,19 @@ declare const Connection: ConnectionLineComponent;
1490
1491
  type ControlsProps = ComponentProps<typeof Controls$1>;
1491
1492
  declare const Controls: (props: ControlsProps) => react.JSX.Element;
1492
1493
 
1493
- type ConversationProps = ComponentProps<typeof StickToBottom>;
1494
- declare const Conversation: ({ className, ...props }: ConversationProps) => react.JSX.Element;
1494
+ type ConversationProps = ComponentProps<typeof StickToBottom> & {
1495
+ /**
1496
+ * The assistant response is still arriving (loading-states.md
1497
+ * `isStreaming`). `role="log"` otherwise announces every incoming token to
1498
+ * assistive tech as it streams in — deafening. While `true`, `aria-live`
1499
+ * is suppressed (`"off"`) and `aria-busy` is set; once streaming ends,
1500
+ * `aria-live` returns to `"polite"` so the settled content is what
1501
+ * actually gets announced.
1502
+ * @default false
1503
+ */
1504
+ isStreaming?: boolean;
1505
+ };
1506
+ declare const Conversation: ({ className, isStreaming, ...props }: ConversationProps) => react.JSX.Element;
1495
1507
  type ConversationContentProps = ComponentProps<typeof StickToBottom.Content>;
1496
1508
  declare const ConversationContent: ({ className, scrollClassName, ...props }: ConversationContentProps) => react.JSX.Element;
1497
1509
  type ConversationEmptyStateProps = ComponentProps<"div"> & {
@@ -1590,7 +1602,7 @@ type EnvironmentVariableCopyButtonProps = ComponentProps<typeof Button> & {
1590
1602
  timeout?: number;
1591
1603
  copyFormat?: "name" | "value" | "export";
1592
1604
  };
1593
- declare const EnvironmentVariableCopyButton: ({ onCopy, onError, timeout, copyFormat, children, className, ...props }: EnvironmentVariableCopyButtonProps) => react.JSX.Element;
1605
+ declare const EnvironmentVariableCopyButton: ({ onCopy, onError, timeout, copyFormat, children, className, "aria-label": ariaLabel, ...props }: EnvironmentVariableCopyButtonProps) => react.JSX.Element;
1594
1606
  type EnvironmentVariableRequiredProps = ComponentProps<typeof Badge>;
1595
1607
  declare const EnvironmentVariableRequired: ({ className, children, ...props }: EnvironmentVariableRequiredProps) => react.JSX.Element;
1596
1608
 
@@ -2239,7 +2251,7 @@ type MessageBranchProps = HTMLAttributes<HTMLDivElement> & {
2239
2251
  };
2240
2252
  declare const MessageBranch: ({ branch: branchProp, defaultBranch, onBranchChange, className, ...props }: MessageBranchProps) => react.JSX.Element;
2241
2253
  type MessageBranchContentProps = HTMLAttributes<HTMLDivElement>;
2242
- declare const MessageBranchContent: ({ children, ...props }: MessageBranchContentProps) => react.JSX.Element[];
2254
+ declare const MessageBranchContent: ({ children, id, ...props }: MessageBranchContentProps) => react.JSX.Element[];
2243
2255
  type MessageBranchSelectorProps = ComponentProps<typeof ButtonGroup>;
2244
2256
  declare const MessageBranchSelector: ({ className, ...props }: MessageBranchSelectorProps) => react.JSX.Element | null;
2245
2257
  type MessageBranchPreviousProps = ComponentProps<typeof Button>;
@@ -3386,6 +3398,8 @@ interface MessageFormProviderProps {
3386
3398
  /** In-flight submit: controls disabled, the submit button shows a spinner. */
3387
3399
  submitting?: boolean;
3388
3400
  /** The spec is still streaming in (renders a skeleton when no fields yet). */
3401
+ isStreaming?: boolean;
3402
+ /** @deprecated Use `isStreaming`. */
3389
3403
  streaming?: boolean;
3390
3404
  children: ReactNode;
3391
3405
  }
@@ -3393,7 +3407,7 @@ interface MessageFormProviderProps {
3393
3407
  * Lifts the form values. Controlled (pass `values`) or uncontrolled.
3394
3408
  * Derives `isControlled = values !== undefined` and never flips modes.
3395
3409
  */
3396
- declare function MessageFormProvider({ spec, values: valuesProp, onChange, onSubmit, disabled, submitted, submitting, streaming, children, }: MessageFormProviderProps): react.JSX.Element;
3410
+ declare function MessageFormProvider({ spec, values: valuesProp, onChange, onSubmit, disabled, submitted, submitting, isStreaming, streaming, children, }: MessageFormProviderProps): react.JSX.Element;
3397
3411
  interface MessageFormFieldProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
3398
3412
  /** The field's `name` (its key in the spec + values). */
3399
3413
  name: string;
@@ -3455,6 +3469,8 @@ interface MessageFormProps extends Omit<HTMLAttributes<HTMLDivElement>, "onSubmi
3455
3469
  /** In-flight submit: controls disabled, spinner on submit. */
3456
3470
  submitting?: boolean;
3457
3471
  /** The spec is still streaming (renders a skeleton when no fields yet). */
3472
+ isStreaming?: boolean;
3473
+ /** @deprecated Use `isStreaming`. */
3458
3474
  streaming?: boolean;
3459
3475
  }
3460
3476
  /**
@@ -3497,11 +3513,11 @@ declare const columnSpecSchema: z.ZodObject<{
3497
3513
  }, "strip", z.ZodTypeAny, {
3498
3514
  key: string;
3499
3515
  label?: string | undefined;
3500
- format?: "number" | "text" | "percent" | "currency" | "date" | "badge" | undefined;
3516
+ format?: "number" | "text" | "percent" | "currency" | "badge" | "date" | undefined;
3501
3517
  }, {
3502
3518
  key: string;
3503
3519
  label?: string | undefined;
3504
- format?: "number" | "text" | "percent" | "currency" | "date" | "badge" | undefined;
3520
+ format?: "number" | "text" | "percent" | "currency" | "badge" | "date" | undefined;
3505
3521
  }>;
3506
3522
  type ColumnSpec = z.infer<typeof columnSpecSchema>;
3507
3523
  /** A single row: an object keyed by column `key`. */
@@ -3524,11 +3540,11 @@ declare const tableSpecSchema: z.ZodObject<{
3524
3540
  }, "strip", z.ZodTypeAny, {
3525
3541
  key: string;
3526
3542
  label?: string | undefined;
3527
- format?: "number" | "text" | "percent" | "currency" | "date" | "badge" | undefined;
3543
+ format?: "number" | "text" | "percent" | "currency" | "badge" | "date" | undefined;
3528
3544
  }, {
3529
3545
  key: string;
3530
3546
  label?: string | undefined;
3531
- format?: "number" | "text" | "percent" | "currency" | "date" | "badge" | undefined;
3547
+ format?: "number" | "text" | "percent" | "currency" | "badge" | "date" | undefined;
3532
3548
  }>, "many">;
3533
3549
  /** Row objects keyed by column `key`. */
3534
3550
  rows: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">;
@@ -3538,7 +3554,7 @@ declare const tableSpecSchema: z.ZodObject<{
3538
3554
  columns: {
3539
3555
  key: string;
3540
3556
  label?: string | undefined;
3541
- format?: "number" | "text" | "percent" | "currency" | "date" | "badge" | undefined;
3557
+ format?: "number" | "text" | "percent" | "currency" | "badge" | "date" | undefined;
3542
3558
  }[];
3543
3559
  rows: Record<string, unknown>[];
3544
3560
  title?: string | undefined;
@@ -3547,7 +3563,7 @@ declare const tableSpecSchema: z.ZodObject<{
3547
3563
  columns: {
3548
3564
  key: string;
3549
3565
  label?: string | undefined;
3550
- format?: "number" | "text" | "percent" | "currency" | "date" | "badge" | undefined;
3566
+ format?: "number" | "text" | "percent" | "currency" | "badge" | "date" | undefined;
3551
3567
  }[];
3552
3568
  rows: Record<string, unknown>[];
3553
3569
  title?: string | undefined;
@@ -3627,6 +3643,8 @@ interface MessageTableProps extends Omit<HTMLAttributes<HTMLDivElement>, "title"
3627
3643
  /** Per-cell render override for custom composition. */
3628
3644
  renderCell?: RenderCell;
3629
3645
  /** The spec is still streaming (columns-but-no-rows shows skeleton rows). */
3646
+ isStreaming?: boolean;
3647
+ /** @deprecated Use `isStreaming`. */
3630
3648
  streaming?: boolean;
3631
3649
  }
3632
3650
  /**
@@ -4443,7 +4461,7 @@ type StackTraceCopyButtonProps = ComponentProps<typeof Button> & {
4443
4461
  onError?: (error: Error) => void;
4444
4462
  timeout?: number;
4445
4463
  };
4446
- declare const StackTraceCopyButton: react.MemoExoticComponent<({ onCopy, onError, timeout, className, children, ...props }: StackTraceCopyButtonProps) => react.JSX.Element>;
4464
+ declare const StackTraceCopyButton: react.MemoExoticComponent<({ onCopy, onError, timeout, className, children, "aria-label": ariaLabel, ...props }: StackTraceCopyButtonProps) => react.JSX.Element>;
4447
4465
  type StackTraceExpandButtonProps = ComponentProps<"div">;
4448
4466
  declare const StackTraceExpandButton: react.MemoExoticComponent<({ className, ...props }: StackTraceExpandButtonProps) => react.JSX.Element>;
4449
4467
  type StackTraceContentProps = ComponentProps<typeof CollapsibleContent> & {
@@ -4937,8 +4955,17 @@ type WebPreviewBodyProps = Omit<ComponentProps<"iframe">, "loading"> & {
4937
4955
  * @default false
4938
4956
  */
4939
4957
  loading?: boolean | ReactNode;
4958
+ /**
4959
+ * Adds `allow-same-origin` to the iframe sandbox. **Opt-in, off by
4960
+ * default**: combined with `allow-scripts`, a same-origin previewed page
4961
+ * can script its way out of the sandbox restrictions entirely (its own
4962
+ * `<iframe>` reads as unsandboxed once it shares the origin). Only enable
4963
+ * this for content you trust to be same-origin-safe.
4964
+ * @default false
4965
+ */
4966
+ allowSameOrigin?: boolean;
4940
4967
  };
4941
- declare const WebPreviewBody: ({ className, loading, src, ...props }: WebPreviewBodyProps) => react.JSX.Element;
4968
+ declare const WebPreviewBody: ({ className, loading, src, allowSameOrigin, ...props }: WebPreviewBodyProps) => react.JSX.Element;
4942
4969
  type WebPreviewConsoleProps = ComponentProps<"div"> & {
4943
4970
  logs?: {
4944
4971
  level: "log" | "warn" | "error";