@runtypelabs/persona 3.6.0 → 3.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.
Files changed (50) hide show
  1. package/dist/index.cjs +40 -40
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +73 -4
  4. package/dist/index.d.ts +73 -4
  5. package/dist/index.global.js +69 -69
  6. package/dist/index.global.js.map +1 -1
  7. package/dist/index.js +40 -40
  8. package/dist/index.js.map +1 -1
  9. package/dist/theme-editor.cjs +704 -243
  10. package/dist/theme-editor.d.cts +75 -5
  11. package/dist/theme-editor.d.ts +75 -5
  12. package/dist/theme-editor.js +703 -243
  13. package/dist/theme-reference.cjs +1 -1
  14. package/dist/theme-reference.d.cts +53 -0
  15. package/dist/theme-reference.d.ts +53 -0
  16. package/dist/theme-reference.js +1 -1
  17. package/dist/widget.css +44 -0
  18. package/package.json +1 -1
  19. package/src/components/artifact-card.ts +1 -1
  20. package/src/components/demo-carousel.ts +1 -1
  21. package/src/components/event-stream-view.test.ts +142 -0
  22. package/src/components/event-stream-view.ts +67 -28
  23. package/src/components/header-builder.ts +3 -0
  24. package/src/components/launcher.ts +7 -2
  25. package/src/components/panel.ts +3 -1
  26. package/src/defaults.ts +15 -0
  27. package/src/runtime/host-layout.test.ts +1 -1
  28. package/src/runtime/host-layout.ts +2 -1
  29. package/src/scroll-to-bottom-defaults.test.ts +13 -0
  30. package/src/styles/widget.css +44 -0
  31. package/src/theme-editor/index.ts +1 -0
  32. package/src/theme-editor/role-mappings.ts +12 -0
  33. package/src/theme-editor/sections.test.ts +43 -0
  34. package/src/theme-editor/sections.ts +42 -0
  35. package/src/theme-reference.ts +8 -0
  36. package/src/types/theme.ts +45 -0
  37. package/src/types.ts +31 -4
  38. package/src/ui.overlay-z-index.test.ts +34 -2
  39. package/src/ui.scroll.test.ts +554 -0
  40. package/src/ui.ts +264 -90
  41. package/src/utils/auto-follow.test.ts +110 -0
  42. package/src/utils/auto-follow.ts +112 -0
  43. package/src/utils/constants.ts +13 -0
  44. package/src/utils/dropdown.ts +2 -1
  45. package/src/utils/overlay-host-stacking.test.ts +61 -0
  46. package/src/utils/overlay-host-stacking.ts +38 -0
  47. package/src/utils/scroll-lock.test.ts +64 -0
  48. package/src/utils/scroll-lock.ts +62 -0
  49. package/src/utils/theme.test.ts +34 -0
  50. package/src/utils/tokens.ts +112 -0
package/dist/index.d.cts CHANGED
@@ -381,6 +381,17 @@ interface MessageTokens {
381
381
  /** Assistant bubble box-shadow (token ref or raw CSS, e.g. `none`). */
382
382
  shadow?: string;
383
383
  };
384
+ /** Border color between messages in the thread. */
385
+ border?: TokenReference<'color'>;
386
+ }
387
+ /** Collapsible widget chrome (tool bubbles, reasoning bubbles, approval bubbles). */
388
+ interface CollapsibleWidgetTokens {
389
+ /** Background for content areas. */
390
+ container?: TokenReference<'color'>;
391
+ /** Background for code blocks inside collapsible sections. */
392
+ surface?: TokenReference<'color'>;
393
+ /** Border color for collapsible sections. */
394
+ border?: TokenReference<'color'>;
384
395
  }
385
396
  interface MarkdownTokens {
386
397
  inlineCode: {
@@ -409,6 +420,27 @@ interface MarkdownTokens {
409
420
  fontWeight?: string;
410
421
  };
411
422
  };
423
+ /** Fenced code block styling. */
424
+ codeBlock?: {
425
+ background?: TokenReference<'color'>;
426
+ borderColor?: TokenReference<'color'>;
427
+ textColor?: TokenReference<'color'>;
428
+ };
429
+ /** Table styling. */
430
+ table?: {
431
+ headerBackground?: TokenReference<'color'>;
432
+ borderColor?: TokenReference<'color'>;
433
+ };
434
+ /** Horizontal rule styling. */
435
+ hr?: {
436
+ color?: TokenReference<'color'>;
437
+ };
438
+ /** Blockquote styling. */
439
+ blockquote?: {
440
+ borderColor?: TokenReference<'color'>;
441
+ background?: TokenReference<'color'>;
442
+ textColor?: TokenReference<'color'>;
443
+ };
412
444
  }
413
445
  interface VoiceTokens {
414
446
  recording: {
@@ -528,6 +560,13 @@ interface LabelButtonTokens {
528
560
  fontSize?: string;
529
561
  gap?: string;
530
562
  }
563
+ /** Scroll-to-bottom pill chrome shared by transcript + event stream. */
564
+ interface ScrollToBottomTokens extends ComponentTokenSet {
565
+ size?: string;
566
+ gap?: string;
567
+ fontSize?: string;
568
+ iconSize?: string;
569
+ }
531
570
  /** Toggle group chrome (used by createToggleGroup). */
532
571
  interface ToggleGroupTokens {
533
572
  /** Gap between toggle buttons. Default: 0 (connected). */
@@ -554,6 +593,8 @@ interface ComponentTokens {
554
593
  iconButton?: IconButtonTokens;
555
594
  /** Label button styling tokens. */
556
595
  labelButton?: LabelButtonTokens;
596
+ /** Scroll-to-bottom indicator styling tokens. */
597
+ scrollToBottom?: ScrollToBottomTokens;
557
598
  /** Toggle group styling tokens. */
558
599
  toggleGroup?: ToggleGroupTokens;
559
600
  /** Artifact toolbar, tab strip, and pane chrome. */
@@ -562,6 +603,8 @@ interface ComponentTokens {
562
603
  tab?: ArtifactTabTokens;
563
604
  pane?: ArtifactPaneTokens;
564
605
  };
606
+ /** Collapsible widget chrome (tool/reasoning/approval bubbles). */
607
+ collapsibleWidget?: CollapsibleWidgetTokens;
565
608
  }
566
609
  interface PaletteExtras {
567
610
  transitions?: Record<string, string>;
@@ -1114,10 +1157,31 @@ type AgentWidgetArtifactsFeature = {
1114
1157
  defaultRenderer: () => HTMLElement;
1115
1158
  }) => HTMLElement | null;
1116
1159
  };
1160
+ type AgentWidgetScrollToBottomFeature = {
1161
+ /**
1162
+ * When true, Persona shows a scroll-to-bottom affordance when the user breaks
1163
+ * away from the latest transcript or event stream content.
1164
+ * @default true
1165
+ */
1166
+ enabled?: boolean;
1167
+ /**
1168
+ * Lucide icon name used for the affordance.
1169
+ * @default "arrow-down"
1170
+ */
1171
+ iconName?: string;
1172
+ /**
1173
+ * Optional label text shown next to the icon. Set to an empty string for an
1174
+ * icon-only affordance.
1175
+ * @default ""
1176
+ */
1177
+ label?: string;
1178
+ };
1117
1179
  type AgentWidgetFeatureFlags = {
1118
1180
  showReasoning?: boolean;
1119
1181
  showToolCalls?: boolean;
1120
1182
  showEventStreamToggle?: boolean;
1183
+ /** Shared transcript + event stream scroll-to-bottom affordance. */
1184
+ scrollToBottom?: AgentWidgetScrollToBottomFeature;
1121
1185
  /** Configuration for the Event Stream inspector view */
1122
1186
  eventStream?: EventStreamConfig;
1123
1187
  /** Optional artifact sidebar (split pane / mobile drawer) */
@@ -1340,11 +1404,16 @@ type AgentWidgetLauncherConfig = {
1340
1404
  */
1341
1405
  mobileBreakpoint?: number;
1342
1406
  /**
1343
- * CSS z-index applied to the widget wrapper when it is in a positioned mode
1344
- * (floating panel, mobile fullscreen, or sidebar). Increase this value if
1345
- * other elements on the host page appear on top of the widget.
1407
+ * CSS z-index applied to the widget wrapper and launcher button in all
1408
+ * positioned modes (floating panel, mobile fullscreen, sidebar, docked
1409
+ * mobile fullscreen). Increase this value if other elements on the host
1410
+ * page appear on top of the widget.
1411
+ *
1412
+ * In viewport-covering modes (sidebar, mobile fullscreen), the widget
1413
+ * also elevates the host element's stacking context and locks
1414
+ * document scroll to prevent background scrolling.
1346
1415
  *
1347
- * @default 9999 in overlay modes (mobile fullscreen / sidebar); 50 for the regular floating panel
1416
+ * @default 100000
1348
1417
  */
1349
1418
  zIndex?: number;
1350
1419
  callToActionIconText?: string;
package/dist/index.d.ts CHANGED
@@ -381,6 +381,17 @@ interface MessageTokens {
381
381
  /** Assistant bubble box-shadow (token ref or raw CSS, e.g. `none`). */
382
382
  shadow?: string;
383
383
  };
384
+ /** Border color between messages in the thread. */
385
+ border?: TokenReference<'color'>;
386
+ }
387
+ /** Collapsible widget chrome (tool bubbles, reasoning bubbles, approval bubbles). */
388
+ interface CollapsibleWidgetTokens {
389
+ /** Background for content areas. */
390
+ container?: TokenReference<'color'>;
391
+ /** Background for code blocks inside collapsible sections. */
392
+ surface?: TokenReference<'color'>;
393
+ /** Border color for collapsible sections. */
394
+ border?: TokenReference<'color'>;
384
395
  }
385
396
  interface MarkdownTokens {
386
397
  inlineCode: {
@@ -409,6 +420,27 @@ interface MarkdownTokens {
409
420
  fontWeight?: string;
410
421
  };
411
422
  };
423
+ /** Fenced code block styling. */
424
+ codeBlock?: {
425
+ background?: TokenReference<'color'>;
426
+ borderColor?: TokenReference<'color'>;
427
+ textColor?: TokenReference<'color'>;
428
+ };
429
+ /** Table styling. */
430
+ table?: {
431
+ headerBackground?: TokenReference<'color'>;
432
+ borderColor?: TokenReference<'color'>;
433
+ };
434
+ /** Horizontal rule styling. */
435
+ hr?: {
436
+ color?: TokenReference<'color'>;
437
+ };
438
+ /** Blockquote styling. */
439
+ blockquote?: {
440
+ borderColor?: TokenReference<'color'>;
441
+ background?: TokenReference<'color'>;
442
+ textColor?: TokenReference<'color'>;
443
+ };
412
444
  }
413
445
  interface VoiceTokens {
414
446
  recording: {
@@ -528,6 +560,13 @@ interface LabelButtonTokens {
528
560
  fontSize?: string;
529
561
  gap?: string;
530
562
  }
563
+ /** Scroll-to-bottom pill chrome shared by transcript + event stream. */
564
+ interface ScrollToBottomTokens extends ComponentTokenSet {
565
+ size?: string;
566
+ gap?: string;
567
+ fontSize?: string;
568
+ iconSize?: string;
569
+ }
531
570
  /** Toggle group chrome (used by createToggleGroup). */
532
571
  interface ToggleGroupTokens {
533
572
  /** Gap between toggle buttons. Default: 0 (connected). */
@@ -554,6 +593,8 @@ interface ComponentTokens {
554
593
  iconButton?: IconButtonTokens;
555
594
  /** Label button styling tokens. */
556
595
  labelButton?: LabelButtonTokens;
596
+ /** Scroll-to-bottom indicator styling tokens. */
597
+ scrollToBottom?: ScrollToBottomTokens;
557
598
  /** Toggle group styling tokens. */
558
599
  toggleGroup?: ToggleGroupTokens;
559
600
  /** Artifact toolbar, tab strip, and pane chrome. */
@@ -562,6 +603,8 @@ interface ComponentTokens {
562
603
  tab?: ArtifactTabTokens;
563
604
  pane?: ArtifactPaneTokens;
564
605
  };
606
+ /** Collapsible widget chrome (tool/reasoning/approval bubbles). */
607
+ collapsibleWidget?: CollapsibleWidgetTokens;
565
608
  }
566
609
  interface PaletteExtras {
567
610
  transitions?: Record<string, string>;
@@ -1114,10 +1157,31 @@ type AgentWidgetArtifactsFeature = {
1114
1157
  defaultRenderer: () => HTMLElement;
1115
1158
  }) => HTMLElement | null;
1116
1159
  };
1160
+ type AgentWidgetScrollToBottomFeature = {
1161
+ /**
1162
+ * When true, Persona shows a scroll-to-bottom affordance when the user breaks
1163
+ * away from the latest transcript or event stream content.
1164
+ * @default true
1165
+ */
1166
+ enabled?: boolean;
1167
+ /**
1168
+ * Lucide icon name used for the affordance.
1169
+ * @default "arrow-down"
1170
+ */
1171
+ iconName?: string;
1172
+ /**
1173
+ * Optional label text shown next to the icon. Set to an empty string for an
1174
+ * icon-only affordance.
1175
+ * @default ""
1176
+ */
1177
+ label?: string;
1178
+ };
1117
1179
  type AgentWidgetFeatureFlags = {
1118
1180
  showReasoning?: boolean;
1119
1181
  showToolCalls?: boolean;
1120
1182
  showEventStreamToggle?: boolean;
1183
+ /** Shared transcript + event stream scroll-to-bottom affordance. */
1184
+ scrollToBottom?: AgentWidgetScrollToBottomFeature;
1121
1185
  /** Configuration for the Event Stream inspector view */
1122
1186
  eventStream?: EventStreamConfig;
1123
1187
  /** Optional artifact sidebar (split pane / mobile drawer) */
@@ -1340,11 +1404,16 @@ type AgentWidgetLauncherConfig = {
1340
1404
  */
1341
1405
  mobileBreakpoint?: number;
1342
1406
  /**
1343
- * CSS z-index applied to the widget wrapper when it is in a positioned mode
1344
- * (floating panel, mobile fullscreen, or sidebar). Increase this value if
1345
- * other elements on the host page appear on top of the widget.
1407
+ * CSS z-index applied to the widget wrapper and launcher button in all
1408
+ * positioned modes (floating panel, mobile fullscreen, sidebar, docked
1409
+ * mobile fullscreen). Increase this value if other elements on the host
1410
+ * page appear on top of the widget.
1411
+ *
1412
+ * In viewport-covering modes (sidebar, mobile fullscreen), the widget
1413
+ * also elevates the host element's stacking context and locks
1414
+ * document scroll to prevent background scrolling.
1346
1415
  *
1347
- * @default 9999 in overlay modes (mobile fullscreen / sidebar); 50 for the regular floating panel
1416
+ * @default 100000
1348
1417
  */
1349
1418
  zIndex?: number;
1350
1419
  callToActionIconText?: string;