@runtypelabs/persona 4.19.0 → 4.20.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 (57) hide show
  1. package/dist/approval-ui.d.cts +77 -5
  2. package/dist/approval-ui.d.ts +77 -5
  3. package/dist/artifacts-ui.d.cts +77 -5
  4. package/dist/artifacts-ui.d.ts +77 -5
  5. package/dist/codegen.cjs +1 -1
  6. package/dist/codegen.js +1 -1
  7. package/dist/context-mentions.d.cts +77 -5
  8. package/dist/context-mentions.d.ts +77 -5
  9. package/dist/event-stream-view.d.cts +77 -5
  10. package/dist/event-stream-view.d.ts +77 -5
  11. package/dist/forms-ui.d.cts +77 -5
  12. package/dist/forms-ui.d.ts +77 -5
  13. package/dist/index.cjs +50 -50
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.cts +78 -6
  16. package/dist/index.d.ts +78 -6
  17. package/dist/index.global.js +31 -31
  18. package/dist/index.global.js.map +1 -1
  19. package/dist/index.js +50 -50
  20. package/dist/index.js.map +1 -1
  21. package/dist/launcher.global.js.map +1 -1
  22. package/dist/session-reconnect.d.cts +77 -5
  23. package/dist/session-reconnect.d.ts +77 -5
  24. package/dist/smart-dom-reader.d.cts +77 -5
  25. package/dist/smart-dom-reader.d.ts +77 -5
  26. package/dist/theme-editor-preview.cjs +49 -49
  27. package/dist/theme-editor-preview.d.cts +77 -5
  28. package/dist/theme-editor-preview.d.ts +77 -5
  29. package/dist/theme-editor-preview.js +28 -28
  30. package/dist/theme-editor.d.cts +77 -5
  31. package/dist/theme-editor.d.ts +77 -5
  32. package/dist/theme-reference.cjs +1 -1
  33. package/dist/theme-reference.d.cts +46 -5
  34. package/dist/theme-reference.d.ts +46 -5
  35. package/dist/theme-reference.js +1 -1
  36. package/dist/widget.css +1 -1
  37. package/package.json +1 -1
  38. package/src/components/composer-actions.ts +27 -1
  39. package/src/components/composer-model-picker.ts +4 -14
  40. package/src/components/composer-overflow-menu.ts +14 -0
  41. package/src/components/composer-parts.ts +20 -0
  42. package/src/index-core.ts +2 -0
  43. package/src/styles/widget-styles.test.ts +83 -1
  44. package/src/styles/widget.css +50 -14
  45. package/src/theme-reference.ts +1 -1
  46. package/src/types/theme.ts +47 -5
  47. package/src/types.ts +33 -0
  48. package/src/ui.composer-action-visibility.test.ts +202 -0
  49. package/src/ui.composer-models.test.ts +37 -0
  50. package/src/ui.composer-modes.test.ts +82 -0
  51. package/src/ui.composer-overflow.test.ts +78 -0
  52. package/src/utils/__snapshots__/tokens-parity.test.ts.snap +1633 -686
  53. package/src/utils/composer-modes.test.ts +33 -0
  54. package/src/utils/composer-modes.ts +19 -2
  55. package/src/utils/tokens-parity.test.ts +20 -0
  56. package/src/utils/tokens.test.ts +76 -0
  57. package/src/utils/tokens.ts +4 -4
@@ -1224,27 +1224,66 @@ interface ComposerSegmentedTokens {
1224
1224
  itemPadding?: string;
1225
1225
  }
1226
1226
  /**
1227
- * Model picker popover (`composer.modelPicker.presentation: "popover"`).
1227
+ * Model picker chrome (`composer.models`).
1228
+ *
1229
+ * The surface keys (`background`, `hoverBackground`, `borderColor`,
1230
+ * `borderRadius`, `labelColor`) style the CLOSED control, so the native
1231
+ * `<select>` and the `presentation: "popover"` trigger share one vocabulary.
1232
+ * The `menu*`, `rowHoverBackground`, and `descriptionColor` keys style the
1233
+ * popover panel and are inert under the native select, as is `suffixColor`,
1234
+ * which a `<select>` cannot carry either.
1228
1235
  *
1229
1236
  * Every key is optional and unset ones emit nothing: the stylesheet's `var()`
1230
1237
  * fallbacks own the default look, which derives from the surface and ghost
1231
- * button tokens. Inert under the native `<select>` presentation, except
1232
- * `suffixColor`, which the native control cannot carry either.
1238
+ * button tokens.
1233
1239
  */
1234
1240
  interface ComposerModelPickerTokens {
1241
+ /** Closed control fill. @default the ghost button fill (transparent) */
1242
+ background?: TokenReference<'color'>;
1243
+ /** Closed control fill under hover. @default the ghost hover wash */
1244
+ hoverBackground?: TokenReference<'color'>;
1245
+ /**
1246
+ * Closed control outline, drawn as a 1px inset ring so setting it never
1247
+ * resizes the control. @default none
1248
+ */
1249
+ borderColor?: TokenReference<'color'>;
1250
+ /** Closed control corner radius. @default the ghost button radius */
1251
+ borderRadius?: TokenReference<'radius'>;
1235
1252
  /** Panel fill behind the rows. @default semantic.colors.surface */
1236
1253
  menuBackground?: TokenReference<'color'>;
1237
1254
  /** Panel corner radius. @default palette.radius.lg */
1238
1255
  menuBorderRadius?: TokenReference<'radius'>;
1239
1256
  /** Row fill under hover and the focused option. @default the ghost hover wash */
1240
1257
  rowHoverBackground?: TokenReference<'color'>;
1241
- /** Row label and closed-control label color. @default inherited text */
1258
+ /**
1259
+ * Row label color, plus the closed control's text and chevron in both
1260
+ * presentations. @default the ghost button foreground
1261
+ */
1242
1262
  labelColor?: TokenReference<'color'>;
1243
1263
  /** Second line under a row label. @default semantic.colors.textMuted */
1244
1264
  descriptionColor?: TokenReference<'color'>;
1245
1265
  /** `composer.modelPicker.suffix` on the closed control. @default semantic.colors.textMuted */
1246
1266
  suffixColor?: TokenReference<'color'>;
1247
1267
  }
1268
+ /**
1269
+ * Composer overflow `+` menu panel (`composer.actionOverflow`).
1270
+ *
1271
+ * Every key is optional and unset ones emit nothing: the stylesheet's `var()`
1272
+ * fallbacks own the default look. The panel is portaled outside the themed
1273
+ * mount, so the menu forwards the configured values onto it when it opens.
1274
+ */
1275
+ interface ComposerOverflowMenuTokens {
1276
+ /** Panel fill behind the rows. @default semantic.colors.surface */
1277
+ background?: TokenReference<'color'>;
1278
+ /** Panel border color. @default semantic.colors.border */
1279
+ borderColor?: TokenReference<'color'>;
1280
+ /** Panel corner radius. @default palette.radius.lg */
1281
+ borderRadius?: TokenReference<'radius'>;
1282
+ /** Row text and glyph color. @default semantic.colors.text */
1283
+ foreground?: TokenReference<'color'>;
1284
+ /** Panel elevation (raw CSS box-shadow, `none` allowed). @default palette.shadows.md */
1285
+ shadow?: string;
1286
+ }
1248
1287
  /** Composer (message input) chrome. */
1249
1288
  interface ComposerChromeTokens {
1250
1289
  /** Box-shadow on the composer form (raw CSS, e.g. `none`). */
@@ -1279,8 +1318,10 @@ interface ComposerChromeTokens {
1279
1318
  overlayBand?: string;
1280
1319
  /** Segmented mode-group track. */
1281
1320
  segmented?: ComposerSegmentedTokens;
1282
- /** Model picker popover chrome. */
1321
+ /** Model picker chrome (closed control plus popover panel). */
1283
1322
  modelPicker?: ComposerModelPickerTokens;
1323
+ /** Overflow `+` menu panel chrome. */
1324
+ overflowMenu?: ComposerOverflowMenuTokens;
1284
1325
  }
1285
1326
  /**
1286
1327
  * Motion timing shared by every composer animation.
@@ -5717,6 +5758,15 @@ type ComposerActionPlacement = "start" | "end";
5717
5758
  * it, `"overflow"` and `"auto"` both render in the bar.
5718
5759
  */
5719
5760
  type ComposerActionPresentation = "bar" | "overflow" | "auto";
5761
+ /**
5762
+ * When a composer action is mounted, as a function of the draft.
5763
+ *
5764
+ * - `"always"` (default): the control is always mounted.
5765
+ * - `"when-empty"`: hidden as soon as the draft holds text or an attachment,
5766
+ * and while a response streams.
5767
+ * - `"when-text"`: the inverse, on the same draft state the send control reads.
5768
+ */
5769
+ type ComposerActionVisibility = "always" | "when-empty" | "when-text";
5720
5770
  /**
5721
5771
  * Fields shared by every composer action.
5722
5772
  *
@@ -5732,6 +5782,13 @@ type ComposerActionBase = {
5732
5782
  presentation?: ComposerActionPresentation;
5733
5783
  order?: number;
5734
5784
  visible?: boolean | ((state: Readonly<ComposerState>) => boolean);
5785
+ /**
5786
+ * Draft-driven visibility, on the same state `sendButton.visibility` reads.
5787
+ * Hidden removes the control from layout and tab order. Combined with
5788
+ * `visible`: both must pass.
5789
+ * @default "always"
5790
+ */
5791
+ visibility?: ComposerActionVisibility;
5735
5792
  disabled?: boolean | ((state: Readonly<ComposerState>) => boolean);
5736
5793
  /** Disable while a response streams, through the composer's own mechanism. */
5737
5794
  disableWhenStreaming?: boolean;
@@ -5878,6 +5935,15 @@ type ComposerMode = {
5878
5935
  * row, never in the overflow menu.
5879
5936
  */
5880
5937
  type ComposerModeGroupPresentation = "buttons" | "segmented";
5938
+ /**
5939
+ * Whether a group's active modes also render as removable chips.
5940
+ *
5941
+ * - `"auto"` (default): one chip per active mode, except under `"segmented"`
5942
+ * presentation, where the track already shows the state.
5943
+ * - `"hidden"`: no chips for this group under any presentation. The pressed bar
5944
+ * button carries the state, and deselection stays on the button.
5945
+ */
5946
+ type ComposerModeChipVisibility = "auto" | "hidden";
5881
5947
  /**
5882
5948
  * Selection policy for a set of modes. `"single"` deselects siblings when one
5883
5949
  * is chosen; `"multiple"` toggles independently.
@@ -5887,6 +5953,12 @@ type ComposerModeGroup = {
5887
5953
  selection: "single" | "multiple";
5888
5954
  /** @default "buttons" */
5889
5955
  presentation?: ComposerModeGroupPresentation;
5956
+ /**
5957
+ * Chip row policy for this group's active modes. The chip row itself is
5958
+ * derived from its children, so a group with no other chips leaves no gap.
5959
+ * @default "auto"
5960
+ */
5961
+ chipVisibility?: ComposerModeChipVisibility;
5890
5962
  /**
5891
5963
  * Accessible name for a segmented track. With it the track is a labelled
5892
5964
  * `role="group"`; without it the segments stand on their own names.
@@ -1224,27 +1224,66 @@ interface ComposerSegmentedTokens {
1224
1224
  itemPadding?: string;
1225
1225
  }
1226
1226
  /**
1227
- * Model picker popover (`composer.modelPicker.presentation: "popover"`).
1227
+ * Model picker chrome (`composer.models`).
1228
+ *
1229
+ * The surface keys (`background`, `hoverBackground`, `borderColor`,
1230
+ * `borderRadius`, `labelColor`) style the CLOSED control, so the native
1231
+ * `<select>` and the `presentation: "popover"` trigger share one vocabulary.
1232
+ * The `menu*`, `rowHoverBackground`, and `descriptionColor` keys style the
1233
+ * popover panel and are inert under the native select, as is `suffixColor`,
1234
+ * which a `<select>` cannot carry either.
1228
1235
  *
1229
1236
  * Every key is optional and unset ones emit nothing: the stylesheet's `var()`
1230
1237
  * fallbacks own the default look, which derives from the surface and ghost
1231
- * button tokens. Inert under the native `<select>` presentation, except
1232
- * `suffixColor`, which the native control cannot carry either.
1238
+ * button tokens.
1233
1239
  */
1234
1240
  interface ComposerModelPickerTokens {
1241
+ /** Closed control fill. @default the ghost button fill (transparent) */
1242
+ background?: TokenReference<'color'>;
1243
+ /** Closed control fill under hover. @default the ghost hover wash */
1244
+ hoverBackground?: TokenReference<'color'>;
1245
+ /**
1246
+ * Closed control outline, drawn as a 1px inset ring so setting it never
1247
+ * resizes the control. @default none
1248
+ */
1249
+ borderColor?: TokenReference<'color'>;
1250
+ /** Closed control corner radius. @default the ghost button radius */
1251
+ borderRadius?: TokenReference<'radius'>;
1235
1252
  /** Panel fill behind the rows. @default semantic.colors.surface */
1236
1253
  menuBackground?: TokenReference<'color'>;
1237
1254
  /** Panel corner radius. @default palette.radius.lg */
1238
1255
  menuBorderRadius?: TokenReference<'radius'>;
1239
1256
  /** Row fill under hover and the focused option. @default the ghost hover wash */
1240
1257
  rowHoverBackground?: TokenReference<'color'>;
1241
- /** Row label and closed-control label color. @default inherited text */
1258
+ /**
1259
+ * Row label color, plus the closed control's text and chevron in both
1260
+ * presentations. @default the ghost button foreground
1261
+ */
1242
1262
  labelColor?: TokenReference<'color'>;
1243
1263
  /** Second line under a row label. @default semantic.colors.textMuted */
1244
1264
  descriptionColor?: TokenReference<'color'>;
1245
1265
  /** `composer.modelPicker.suffix` on the closed control. @default semantic.colors.textMuted */
1246
1266
  suffixColor?: TokenReference<'color'>;
1247
1267
  }
1268
+ /**
1269
+ * Composer overflow `+` menu panel (`composer.actionOverflow`).
1270
+ *
1271
+ * Every key is optional and unset ones emit nothing: the stylesheet's `var()`
1272
+ * fallbacks own the default look. The panel is portaled outside the themed
1273
+ * mount, so the menu forwards the configured values onto it when it opens.
1274
+ */
1275
+ interface ComposerOverflowMenuTokens {
1276
+ /** Panel fill behind the rows. @default semantic.colors.surface */
1277
+ background?: TokenReference<'color'>;
1278
+ /** Panel border color. @default semantic.colors.border */
1279
+ borderColor?: TokenReference<'color'>;
1280
+ /** Panel corner radius. @default palette.radius.lg */
1281
+ borderRadius?: TokenReference<'radius'>;
1282
+ /** Row text and glyph color. @default semantic.colors.text */
1283
+ foreground?: TokenReference<'color'>;
1284
+ /** Panel elevation (raw CSS box-shadow, `none` allowed). @default palette.shadows.md */
1285
+ shadow?: string;
1286
+ }
1248
1287
  /** Composer (message input) chrome. */
1249
1288
  interface ComposerChromeTokens {
1250
1289
  /** Box-shadow on the composer form (raw CSS, e.g. `none`). */
@@ -1279,8 +1318,10 @@ interface ComposerChromeTokens {
1279
1318
  overlayBand?: string;
1280
1319
  /** Segmented mode-group track. */
1281
1320
  segmented?: ComposerSegmentedTokens;
1282
- /** Model picker popover chrome. */
1321
+ /** Model picker chrome (closed control plus popover panel). */
1283
1322
  modelPicker?: ComposerModelPickerTokens;
1323
+ /** Overflow `+` menu panel chrome. */
1324
+ overflowMenu?: ComposerOverflowMenuTokens;
1284
1325
  }
1285
1326
  /**
1286
1327
  * Motion timing shared by every composer animation.
@@ -5717,6 +5758,15 @@ type ComposerActionPlacement = "start" | "end";
5717
5758
  * it, `"overflow"` and `"auto"` both render in the bar.
5718
5759
  */
5719
5760
  type ComposerActionPresentation = "bar" | "overflow" | "auto";
5761
+ /**
5762
+ * When a composer action is mounted, as a function of the draft.
5763
+ *
5764
+ * - `"always"` (default): the control is always mounted.
5765
+ * - `"when-empty"`: hidden as soon as the draft holds text or an attachment,
5766
+ * and while a response streams.
5767
+ * - `"when-text"`: the inverse, on the same draft state the send control reads.
5768
+ */
5769
+ type ComposerActionVisibility = "always" | "when-empty" | "when-text";
5720
5770
  /**
5721
5771
  * Fields shared by every composer action.
5722
5772
  *
@@ -5732,6 +5782,13 @@ type ComposerActionBase = {
5732
5782
  presentation?: ComposerActionPresentation;
5733
5783
  order?: number;
5734
5784
  visible?: boolean | ((state: Readonly<ComposerState>) => boolean);
5785
+ /**
5786
+ * Draft-driven visibility, on the same state `sendButton.visibility` reads.
5787
+ * Hidden removes the control from layout and tab order. Combined with
5788
+ * `visible`: both must pass.
5789
+ * @default "always"
5790
+ */
5791
+ visibility?: ComposerActionVisibility;
5735
5792
  disabled?: boolean | ((state: Readonly<ComposerState>) => boolean);
5736
5793
  /** Disable while a response streams, through the composer's own mechanism. */
5737
5794
  disableWhenStreaming?: boolean;
@@ -5878,6 +5935,15 @@ type ComposerMode = {
5878
5935
  * row, never in the overflow menu.
5879
5936
  */
5880
5937
  type ComposerModeGroupPresentation = "buttons" | "segmented";
5938
+ /**
5939
+ * Whether a group's active modes also render as removable chips.
5940
+ *
5941
+ * - `"auto"` (default): one chip per active mode, except under `"segmented"`
5942
+ * presentation, where the track already shows the state.
5943
+ * - `"hidden"`: no chips for this group under any presentation. The pressed bar
5944
+ * button carries the state, and deselection stays on the button.
5945
+ */
5946
+ type ComposerModeChipVisibility = "auto" | "hidden";
5881
5947
  /**
5882
5948
  * Selection policy for a set of modes. `"single"` deselects siblings when one
5883
5949
  * is chosen; `"multiple"` toggles independently.
@@ -5887,6 +5953,12 @@ type ComposerModeGroup = {
5887
5953
  selection: "single" | "multiple";
5888
5954
  /** @default "buttons" */
5889
5955
  presentation?: ComposerModeGroupPresentation;
5956
+ /**
5957
+ * Chip row policy for this group's active modes. The chip row itself is
5958
+ * derived from its children, so a group with no other chips leaves no gap.
5959
+ * @default "auto"
5960
+ */
5961
+ chipVisibility?: ComposerModeChipVisibility;
5890
5962
  /**
5891
5963
  * Accessible name for a segmented track. With it the track is a labelled
5892
5964
  * `role="group"`; without it the segments stand on their own names.
@@ -1226,27 +1226,66 @@ interface ComposerSegmentedTokens {
1226
1226
  itemPadding?: string;
1227
1227
  }
1228
1228
  /**
1229
- * Model picker popover (`composer.modelPicker.presentation: "popover"`).
1229
+ * Model picker chrome (`composer.models`).
1230
+ *
1231
+ * The surface keys (`background`, `hoverBackground`, `borderColor`,
1232
+ * `borderRadius`, `labelColor`) style the CLOSED control, so the native
1233
+ * `<select>` and the `presentation: "popover"` trigger share one vocabulary.
1234
+ * The `menu*`, `rowHoverBackground`, and `descriptionColor` keys style the
1235
+ * popover panel and are inert under the native select, as is `suffixColor`,
1236
+ * which a `<select>` cannot carry either.
1230
1237
  *
1231
1238
  * Every key is optional and unset ones emit nothing: the stylesheet's `var()`
1232
1239
  * fallbacks own the default look, which derives from the surface and ghost
1233
- * button tokens. Inert under the native `<select>` presentation, except
1234
- * `suffixColor`, which the native control cannot carry either.
1240
+ * button tokens.
1235
1241
  */
1236
1242
  interface ComposerModelPickerTokens {
1243
+ /** Closed control fill. @default the ghost button fill (transparent) */
1244
+ background?: TokenReference<'color'>;
1245
+ /** Closed control fill under hover. @default the ghost hover wash */
1246
+ hoverBackground?: TokenReference<'color'>;
1247
+ /**
1248
+ * Closed control outline, drawn as a 1px inset ring so setting it never
1249
+ * resizes the control. @default none
1250
+ */
1251
+ borderColor?: TokenReference<'color'>;
1252
+ /** Closed control corner radius. @default the ghost button radius */
1253
+ borderRadius?: TokenReference<'radius'>;
1237
1254
  /** Panel fill behind the rows. @default semantic.colors.surface */
1238
1255
  menuBackground?: TokenReference<'color'>;
1239
1256
  /** Panel corner radius. @default palette.radius.lg */
1240
1257
  menuBorderRadius?: TokenReference<'radius'>;
1241
1258
  /** Row fill under hover and the focused option. @default the ghost hover wash */
1242
1259
  rowHoverBackground?: TokenReference<'color'>;
1243
- /** Row label and closed-control label color. @default inherited text */
1260
+ /**
1261
+ * Row label color, plus the closed control's text and chevron in both
1262
+ * presentations. @default the ghost button foreground
1263
+ */
1244
1264
  labelColor?: TokenReference<'color'>;
1245
1265
  /** Second line under a row label. @default semantic.colors.textMuted */
1246
1266
  descriptionColor?: TokenReference<'color'>;
1247
1267
  /** `composer.modelPicker.suffix` on the closed control. @default semantic.colors.textMuted */
1248
1268
  suffixColor?: TokenReference<'color'>;
1249
1269
  }
1270
+ /**
1271
+ * Composer overflow `+` menu panel (`composer.actionOverflow`).
1272
+ *
1273
+ * Every key is optional and unset ones emit nothing: the stylesheet's `var()`
1274
+ * fallbacks own the default look. The panel is portaled outside the themed
1275
+ * mount, so the menu forwards the configured values onto it when it opens.
1276
+ */
1277
+ interface ComposerOverflowMenuTokens {
1278
+ /** Panel fill behind the rows. @default semantic.colors.surface */
1279
+ background?: TokenReference<'color'>;
1280
+ /** Panel border color. @default semantic.colors.border */
1281
+ borderColor?: TokenReference<'color'>;
1282
+ /** Panel corner radius. @default palette.radius.lg */
1283
+ borderRadius?: TokenReference<'radius'>;
1284
+ /** Row text and glyph color. @default semantic.colors.text */
1285
+ foreground?: TokenReference<'color'>;
1286
+ /** Panel elevation (raw CSS box-shadow, `none` allowed). @default palette.shadows.md */
1287
+ shadow?: string;
1288
+ }
1250
1289
  /** Composer (message input) chrome. */
1251
1290
  interface ComposerChromeTokens {
1252
1291
  /** Box-shadow on the composer form (raw CSS, e.g. `none`). */
@@ -1281,8 +1320,10 @@ interface ComposerChromeTokens {
1281
1320
  overlayBand?: string;
1282
1321
  /** Segmented mode-group track. */
1283
1322
  segmented?: ComposerSegmentedTokens;
1284
- /** Model picker popover chrome. */
1323
+ /** Model picker chrome (closed control plus popover panel). */
1285
1324
  modelPicker?: ComposerModelPickerTokens;
1325
+ /** Overflow `+` menu panel chrome. */
1326
+ overflowMenu?: ComposerOverflowMenuTokens;
1286
1327
  }
1287
1328
  /**
1288
1329
  * Motion timing shared by every composer animation.
@@ -5719,6 +5760,15 @@ type ComposerActionPlacement = "start" | "end";
5719
5760
  * it, `"overflow"` and `"auto"` both render in the bar.
5720
5761
  */
5721
5762
  type ComposerActionPresentation = "bar" | "overflow" | "auto";
5763
+ /**
5764
+ * When a composer action is mounted, as a function of the draft.
5765
+ *
5766
+ * - `"always"` (default): the control is always mounted.
5767
+ * - `"when-empty"`: hidden as soon as the draft holds text or an attachment,
5768
+ * and while a response streams.
5769
+ * - `"when-text"`: the inverse, on the same draft state the send control reads.
5770
+ */
5771
+ type ComposerActionVisibility = "always" | "when-empty" | "when-text";
5722
5772
  /**
5723
5773
  * Fields shared by every composer action.
5724
5774
  *
@@ -5734,6 +5784,13 @@ type ComposerActionBase = {
5734
5784
  presentation?: ComposerActionPresentation;
5735
5785
  order?: number;
5736
5786
  visible?: boolean | ((state: Readonly<ComposerState>) => boolean);
5787
+ /**
5788
+ * Draft-driven visibility, on the same state `sendButton.visibility` reads.
5789
+ * Hidden removes the control from layout and tab order. Combined with
5790
+ * `visible`: both must pass.
5791
+ * @default "always"
5792
+ */
5793
+ visibility?: ComposerActionVisibility;
5737
5794
  disabled?: boolean | ((state: Readonly<ComposerState>) => boolean);
5738
5795
  /** Disable while a response streams, through the composer's own mechanism. */
5739
5796
  disableWhenStreaming?: boolean;
@@ -5880,6 +5937,15 @@ type ComposerMode = {
5880
5937
  * row, never in the overflow menu.
5881
5938
  */
5882
5939
  type ComposerModeGroupPresentation = "buttons" | "segmented";
5940
+ /**
5941
+ * Whether a group's active modes also render as removable chips.
5942
+ *
5943
+ * - `"auto"` (default): one chip per active mode, except under `"segmented"`
5944
+ * presentation, where the track already shows the state.
5945
+ * - `"hidden"`: no chips for this group under any presentation. The pressed bar
5946
+ * button carries the state, and deselection stays on the button.
5947
+ */
5948
+ type ComposerModeChipVisibility = "auto" | "hidden";
5883
5949
  /**
5884
5950
  * Selection policy for a set of modes. `"single"` deselects siblings when one
5885
5951
  * is chosen; `"multiple"` toggles independently.
@@ -5889,6 +5955,12 @@ type ComposerModeGroup = {
5889
5955
  selection: "single" | "multiple";
5890
5956
  /** @default "buttons" */
5891
5957
  presentation?: ComposerModeGroupPresentation;
5958
+ /**
5959
+ * Chip row policy for this group's active modes. The chip row itself is
5960
+ * derived from its children, so a group with no other chips leaves no gap.
5961
+ * @default "auto"
5962
+ */
5963
+ chipVisibility?: ComposerModeChipVisibility;
5892
5964
  /**
5893
5965
  * Accessible name for a segmented track. With it the track is a labelled
5894
5966
  * `role="group"`; without it the segments stand on their own names.
@@ -1226,27 +1226,66 @@ interface ComposerSegmentedTokens {
1226
1226
  itemPadding?: string;
1227
1227
  }
1228
1228
  /**
1229
- * Model picker popover (`composer.modelPicker.presentation: "popover"`).
1229
+ * Model picker chrome (`composer.models`).
1230
+ *
1231
+ * The surface keys (`background`, `hoverBackground`, `borderColor`,
1232
+ * `borderRadius`, `labelColor`) style the CLOSED control, so the native
1233
+ * `<select>` and the `presentation: "popover"` trigger share one vocabulary.
1234
+ * The `menu*`, `rowHoverBackground`, and `descriptionColor` keys style the
1235
+ * popover panel and are inert under the native select, as is `suffixColor`,
1236
+ * which a `<select>` cannot carry either.
1230
1237
  *
1231
1238
  * Every key is optional and unset ones emit nothing: the stylesheet's `var()`
1232
1239
  * fallbacks own the default look, which derives from the surface and ghost
1233
- * button tokens. Inert under the native `<select>` presentation, except
1234
- * `suffixColor`, which the native control cannot carry either.
1240
+ * button tokens.
1235
1241
  */
1236
1242
  interface ComposerModelPickerTokens {
1243
+ /** Closed control fill. @default the ghost button fill (transparent) */
1244
+ background?: TokenReference<'color'>;
1245
+ /** Closed control fill under hover. @default the ghost hover wash */
1246
+ hoverBackground?: TokenReference<'color'>;
1247
+ /**
1248
+ * Closed control outline, drawn as a 1px inset ring so setting it never
1249
+ * resizes the control. @default none
1250
+ */
1251
+ borderColor?: TokenReference<'color'>;
1252
+ /** Closed control corner radius. @default the ghost button radius */
1253
+ borderRadius?: TokenReference<'radius'>;
1237
1254
  /** Panel fill behind the rows. @default semantic.colors.surface */
1238
1255
  menuBackground?: TokenReference<'color'>;
1239
1256
  /** Panel corner radius. @default palette.radius.lg */
1240
1257
  menuBorderRadius?: TokenReference<'radius'>;
1241
1258
  /** Row fill under hover and the focused option. @default the ghost hover wash */
1242
1259
  rowHoverBackground?: TokenReference<'color'>;
1243
- /** Row label and closed-control label color. @default inherited text */
1260
+ /**
1261
+ * Row label color, plus the closed control's text and chevron in both
1262
+ * presentations. @default the ghost button foreground
1263
+ */
1244
1264
  labelColor?: TokenReference<'color'>;
1245
1265
  /** Second line under a row label. @default semantic.colors.textMuted */
1246
1266
  descriptionColor?: TokenReference<'color'>;
1247
1267
  /** `composer.modelPicker.suffix` on the closed control. @default semantic.colors.textMuted */
1248
1268
  suffixColor?: TokenReference<'color'>;
1249
1269
  }
1270
+ /**
1271
+ * Composer overflow `+` menu panel (`composer.actionOverflow`).
1272
+ *
1273
+ * Every key is optional and unset ones emit nothing: the stylesheet's `var()`
1274
+ * fallbacks own the default look. The panel is portaled outside the themed
1275
+ * mount, so the menu forwards the configured values onto it when it opens.
1276
+ */
1277
+ interface ComposerOverflowMenuTokens {
1278
+ /** Panel fill behind the rows. @default semantic.colors.surface */
1279
+ background?: TokenReference<'color'>;
1280
+ /** Panel border color. @default semantic.colors.border */
1281
+ borderColor?: TokenReference<'color'>;
1282
+ /** Panel corner radius. @default palette.radius.lg */
1283
+ borderRadius?: TokenReference<'radius'>;
1284
+ /** Row text and glyph color. @default semantic.colors.text */
1285
+ foreground?: TokenReference<'color'>;
1286
+ /** Panel elevation (raw CSS box-shadow, `none` allowed). @default palette.shadows.md */
1287
+ shadow?: string;
1288
+ }
1250
1289
  /** Composer (message input) chrome. */
1251
1290
  interface ComposerChromeTokens {
1252
1291
  /** Box-shadow on the composer form (raw CSS, e.g. `none`). */
@@ -1281,8 +1320,10 @@ interface ComposerChromeTokens {
1281
1320
  overlayBand?: string;
1282
1321
  /** Segmented mode-group track. */
1283
1322
  segmented?: ComposerSegmentedTokens;
1284
- /** Model picker popover chrome. */
1323
+ /** Model picker chrome (closed control plus popover panel). */
1285
1324
  modelPicker?: ComposerModelPickerTokens;
1325
+ /** Overflow `+` menu panel chrome. */
1326
+ overflowMenu?: ComposerOverflowMenuTokens;
1286
1327
  }
1287
1328
  /**
1288
1329
  * Motion timing shared by every composer animation.
@@ -5719,6 +5760,15 @@ type ComposerActionPlacement = "start" | "end";
5719
5760
  * it, `"overflow"` and `"auto"` both render in the bar.
5720
5761
  */
5721
5762
  type ComposerActionPresentation = "bar" | "overflow" | "auto";
5763
+ /**
5764
+ * When a composer action is mounted, as a function of the draft.
5765
+ *
5766
+ * - `"always"` (default): the control is always mounted.
5767
+ * - `"when-empty"`: hidden as soon as the draft holds text or an attachment,
5768
+ * and while a response streams.
5769
+ * - `"when-text"`: the inverse, on the same draft state the send control reads.
5770
+ */
5771
+ type ComposerActionVisibility = "always" | "when-empty" | "when-text";
5722
5772
  /**
5723
5773
  * Fields shared by every composer action.
5724
5774
  *
@@ -5734,6 +5784,13 @@ type ComposerActionBase = {
5734
5784
  presentation?: ComposerActionPresentation;
5735
5785
  order?: number;
5736
5786
  visible?: boolean | ((state: Readonly<ComposerState>) => boolean);
5787
+ /**
5788
+ * Draft-driven visibility, on the same state `sendButton.visibility` reads.
5789
+ * Hidden removes the control from layout and tab order. Combined with
5790
+ * `visible`: both must pass.
5791
+ * @default "always"
5792
+ */
5793
+ visibility?: ComposerActionVisibility;
5737
5794
  disabled?: boolean | ((state: Readonly<ComposerState>) => boolean);
5738
5795
  /** Disable while a response streams, through the composer's own mechanism. */
5739
5796
  disableWhenStreaming?: boolean;
@@ -5880,6 +5937,15 @@ type ComposerMode = {
5880
5937
  * row, never in the overflow menu.
5881
5938
  */
5882
5939
  type ComposerModeGroupPresentation = "buttons" | "segmented";
5940
+ /**
5941
+ * Whether a group's active modes also render as removable chips.
5942
+ *
5943
+ * - `"auto"` (default): one chip per active mode, except under `"segmented"`
5944
+ * presentation, where the track already shows the state.
5945
+ * - `"hidden"`: no chips for this group under any presentation. The pressed bar
5946
+ * button carries the state, and deselection stays on the button.
5947
+ */
5948
+ type ComposerModeChipVisibility = "auto" | "hidden";
5883
5949
  /**
5884
5950
  * Selection policy for a set of modes. `"single"` deselects siblings when one
5885
5951
  * is chosen; `"multiple"` toggles independently.
@@ -5889,6 +5955,12 @@ type ComposerModeGroup = {
5889
5955
  selection: "single" | "multiple";
5890
5956
  /** @default "buttons" */
5891
5957
  presentation?: ComposerModeGroupPresentation;
5958
+ /**
5959
+ * Chip row policy for this group's active modes. The chip row itself is
5960
+ * derived from its children, so a group with no other chips leaves no gap.
5961
+ * @default "auto"
5962
+ */
5963
+ chipVisibility?: ComposerModeChipVisibility;
5892
5964
  /**
5893
5965
  * Accessible name for a segmented track. With it the track is a labelled
5894
5966
  * `role="group"`; without it the segments stand on their own names.
package/dist/codegen.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var w=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var R=(e,i)=>{for(var r in i)w(e,r,{get:i[r],enumerable:!0})},W=(e,i,r,s)=>{if(i&&typeof i=="object"||typeof i=="function")for(let a of T(i))!M.call(e,a)&&a!==r&&w(e,a,{get:()=>i[a],enumerable:!(s=_(i,a))||s.enumerable});return e};var H=e=>W(w({},"__esModule",{value:!0}),e);var z={};R(z,{generateCodeSnippet:()=>P});module.exports=H(z);var S="4.19.0";var j=S;function $(e){return e?.cdnBase?.trim().replace(/\/+$/,"").replace(/[\\'"<>`]/g,r=>`%${r.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")}`)||`https://cdn.jsdelivr.net/npm/@runtypelabs/persona@${j}/dist`}function u(e){if(e!==void 0)return typeof e=="string"?e:Array.isArray(e)?`[${e.map(i=>i.toString()).join(", ")}]`:e.toString()}function q(e){if(e)return{getHeaders:u(e.getHeaders),onFeedback:u(e.onFeedback),onCopy:u(e.onCopy),requestMiddleware:u(e.requestMiddleware),actionHandlers:u(e.actionHandlers),actionParsers:u(e.actionParsers),postprocessMessage:u(e.postprocessMessage),contextProviders:u(e.contextProviders),streamParser:u(e.streamParser)}}var A=`({ text, message }: any) => {
1
+ "use strict";var w=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var R=(e,i)=>{for(var r in i)w(e,r,{get:i[r],enumerable:!0})},W=(e,i,r,s)=>{if(i&&typeof i=="object"||typeof i=="function")for(let a of T(i))!M.call(e,a)&&a!==r&&w(e,a,{get:()=>i[a],enumerable:!(s=_(i,a))||s.enumerable});return e};var H=e=>W(w({},"__esModule",{value:!0}),e);var z={};R(z,{generateCodeSnippet:()=>P});module.exports=H(z);var S="4.20.0";var j=S;function $(e){return e?.cdnBase?.trim().replace(/\/+$/,"").replace(/[\\'"<>`]/g,r=>`%${r.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")}`)||`https://cdn.jsdelivr.net/npm/@runtypelabs/persona@${j}/dist`}function u(e){if(e!==void 0)return typeof e=="string"?e:Array.isArray(e)?`[${e.map(i=>i.toString()).join(", ")}]`:e.toString()}function q(e){if(e)return{getHeaders:u(e.getHeaders),onFeedback:u(e.onFeedback),onCopy:u(e.onCopy),requestMiddleware:u(e.requestMiddleware),actionHandlers:u(e.actionHandlers),actionParsers:u(e.actionParsers),postprocessMessage:u(e.postprocessMessage),contextProviders:u(e.contextProviders),streamParser:u(e.streamParser)}}var A=`({ text, message }: any) => {
2
2
  const jsonSource = (message as any).rawContent || text || message.content;
3
3
  if (!jsonSource || typeof jsonSource !== 'string') return null;
4
4
  let cleanJson = jsonSource
package/dist/codegen.js CHANGED
@@ -1,4 +1,4 @@
1
- var x="4.19.0";var S=x;function w(e){return e?.cdnBase?.trim().replace(/\/+$/,"").replace(/[\\'"<>`]/g,r=>`%${r.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")}`)||`https://cdn.jsdelivr.net/npm/@runtypelabs/persona@${S}/dist`}function u(e){if(e!==void 0)return typeof e=="string"?e:Array.isArray(e)?`[${e.map(i=>i.toString()).join(", ")}]`:e.toString()}function I(e){if(e)return{getHeaders:u(e.getHeaders),onFeedback:u(e.onFeedback),onCopy:u(e.onCopy),requestMiddleware:u(e.requestMiddleware),actionHandlers:u(e.actionHandlers),actionParsers:u(e.actionParsers),postprocessMessage:u(e.postprocessMessage),contextProviders:u(e.contextProviders),streamParser:u(e.streamParser)}}var j=`({ text, message }: any) => {
1
+ var x="4.20.0";var S=x;function w(e){return e?.cdnBase?.trim().replace(/\/+$/,"").replace(/[\\'"<>`]/g,r=>`%${r.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")}`)||`https://cdn.jsdelivr.net/npm/@runtypelabs/persona@${S}/dist`}function u(e){if(e!==void 0)return typeof e=="string"?e:Array.isArray(e)?`[${e.map(i=>i.toString()).join(", ")}]`:e.toString()}function I(e){if(e)return{getHeaders:u(e.getHeaders),onFeedback:u(e.onFeedback),onCopy:u(e.onCopy),requestMiddleware:u(e.requestMiddleware),actionHandlers:u(e.actionHandlers),actionParsers:u(e.actionParsers),postprocessMessage:u(e.postprocessMessage),contextProviders:u(e.contextProviders),streamParser:u(e.streamParser)}}var j=`({ text, message }: any) => {
2
2
  const jsonSource = (message as any).rawContent || text || message.content;
3
3
  if (!jsonSource || typeof jsonSource !== 'string') return null;
4
4
  let cleanJson = jsonSource