rift-ds 1.25.0 → 1.27.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 (61) hide show
  1. package/README.md +3 -1
  2. package/bin/templates/app/components/rift/font.css +7 -4
  3. package/chat/ChatThreads.d.ts +3 -1
  4. package/chat/ChatThreads.js +3 -1
  5. package/chat/ChatWidget.css +166 -15
  6. package/chat/ChatWidget.d.ts +1 -1
  7. package/chat/ChatWidget.js +5 -2
  8. package/components/ActionCard/ActionCard.d.ts +1 -1
  9. package/components/ContextMenu/ContextMenu.css +11 -0
  10. package/components/ContextMenu/ContextMenu.d.ts +1 -1
  11. package/components/ContextMenu/ContextMenu.js +3 -1
  12. package/components/DataTable/DataTable.css +24 -4
  13. package/components/DataTable/DataTable.js +41 -40
  14. package/components/DropdownMenu/DropdownMenu.css +38 -0
  15. package/components/DropdownMenu/DropdownMenu.d.ts +4 -0
  16. package/components/DropdownMenu/DropdownMenu.js +11 -5
  17. package/components/DropdownMenu/ShortcutHint.d.ts +9 -0
  18. package/components/DropdownMenu/ShortcutHint.js +6 -0
  19. package/components/InterruptCard/InterruptCard.d.ts +1 -1
  20. package/components/MegaMenu/MegaMenu.css +5 -3
  21. package/components/MegaMenu/MegaMenu.d.ts +4 -1
  22. package/components/MegaMenu/MegaMenu.js +34 -20
  23. package/components/MessageCard/MessageCard.css +17 -6
  24. package/components/MessageCard/MessageCard.d.ts +1 -1
  25. package/components/ShaderScene/ShaderScene.css +11 -3
  26. package/components/ShaderScene/ShaderScene.d.ts +14 -12
  27. package/components/ShaderScene/ShaderScene.js +33 -10
  28. package/components/ShaderScene/assemble.js +2 -0
  29. package/components/ShaderScene/renderer.d.ts +5 -1
  30. package/components/ShaderScene/renderer.js +46 -1
  31. package/components/ShaderScene/scenes.d.ts +57 -1
  32. package/components/ShaderScene/scenes.js +590 -8
  33. package/components/ShaderScene/types.d.ts +13 -0
  34. package/components/ThreadPanel/ThreadPanel.css +29 -0
  35. package/components/ThreadPanel/ThreadPanel.d.ts +2 -0
  36. package/components/ThreadPanel/ThreadPanel.js +13 -2
  37. package/components/registry.json +1 -1
  38. package/components/registry.json.d.ts +1 -1
  39. package/components/registry.json.js +1 -1
  40. package/index.js +2 -1
  41. package/package.json +1 -1
  42. package/tokens/presets/contrast.css +167 -290
  43. package/tokens/presets/coral.css +143 -254
  44. package/tokens/presets/forest.css +180 -310
  45. package/tokens/presets/gold.css +220 -391
  46. package/tokens/presets/marquee.css +150 -253
  47. package/tokens/presets/mono.css +162 -270
  48. package/tokens/presets/pink.css +228 -409
  49. package/tokens/presets/plum.css +228 -367
  50. package/tokens/presets/presets.css +1 -0
  51. package/tokens/presets/terminal.css +170 -301
  52. package/tokens/presets/violet.css +214 -380
  53. package/tokens/presets/warm.css +166 -293
  54. package/tokens/presets/zest.css +191 -335
  55. package/tokens/tokens-dark.css +9 -0
  56. package/tokens/tokens-forced-colors.css +4 -1
  57. package/tokens/tokens-light.css +9 -0
  58. package/tokens/tokens-motion.css +14 -0
  59. package/tokens/tokens-primitives.css +9 -0
  60. package/tokens/tokens-typography.css +9 -0
  61. package/tokens/tokens.css +12 -0
package/README.md CHANGED
@@ -14,6 +14,7 @@ An open source React design system built for AI products and coding agents: comp
14
14
  ## Why Rift DS
15
15
 
16
16
  - **<!-- component-count -->178<!-- /component-count --> components.** Buttons, forms and tables through to charts, navigation and overlays, each typed and documented with live examples. Every one forwards a ref and your own attributes to its element, state you can own works controlled or uncontrolled (a modal opens when your app says so, by design), and every word a component writes has a prop you can localise. The build checks the first two on every component, and the words wherever they sit in markup. React and React DOM are the only required peer dependencies.
17
+ - **A matching <!-- figma-kit-link -->[Figma kit](https://www.figma.com/community/file/1701820123445795117)<!-- /figma-kit-link -->.** Every component has a page in it, with a sticker sheet of its states, built on variables named after the same tokens. Duplicate it from the Figma Community to design with the same system.
17
18
  - **AI patterns, the whole chat and templates, ready to use.** Composer, streaming chat thread, tool calls, reasoning and thread panel are in the box, the complete AI chat ships assembled as one widget that one command scaffolds, and the docs site has complete template screens built from them.
18
19
  - **Fully themeable.** The shipped themes are complete looks to start from, each in light and dark. One `data-brand` attribute applies a theme, and a few CSS overrides make your own.
19
20
  - **Ready for coding agents.** One command installs the agent skills, and a public MCP endpoint serves every component's props, so your agent builds with the library as it actually is. No key, no account.
@@ -21,7 +22,7 @@ An open source React design system built for AI products and coding agents: comp
21
22
 
22
23
  ## Documentation
23
24
 
24
- Everything deep lives on the docs site: **[rift-ds.com](https://rift-ds.com/)**, with live examples, foundations, templates, the playground, and the **[get-started guide](https://rift-ds.com/docs/get-started)**. **[Storybook](https://storybook.rift-ds.com/?path=/docs/rift-ds--docs)** is the interactive component explorer.
25
+ Everything deep lives on the docs site: **[rift-ds.com](https://rift-ds.com/)**, with live examples, foundations, templates, the playground, and the **[get-started guide](https://rift-ds.com/docs/get-started)**. **[Storybook](https://storybook.rift-ds.com/?path=/docs/rift-ds--docs)** is the interactive component explorer. What changed in each version, and anything you need to do when you upgrade, is in the **[release notes](https://rift-ds.com/releases)**, also published as [GitHub releases](https://github.com/robritacca-dotcom/rift-ds/releases).
25
26
 
26
27
  ## Install
27
28
 
@@ -102,6 +103,7 @@ import 'rift-ds/tokens/presets/presets.css';
102
103
  - **Dark mode**: `data-theme="dark"` on the root element; light is the default.
103
104
  - **Page colours**: the token stylesheet defines custom properties and styles no element, so paint the page once: set `background: var(--color-bg-page-primary)`, `color: var(--color-text-primary)` and `font-family: var(--font-family-primary)` on `body`. Without it a dark theme lands as dark components on a white page.
104
105
  - **Your own brand**: every semantic token chains to a primitive, so overriding one primitive re-themes everything built on it. The [playground](https://rift-ds.com/playground) restyles the system live and copies out a complete, paste-ready override.
106
+ - **One part of a shipped theme**: the token and theme stylesheets sit in cascade layers (`rift.tokens`, then `rift.preset`), so any rule of your own outranks them whatever its selector. A plain `:root { --font-family-primary: … }` keeps a preset's colours with your face, in light and dark alike. To set a default that a preset still replaces, declare it inside `@layer rift.tokens { … }`.
105
107
  - **Fonts**: the base theme bundles no text face, and the whole scale chains to `--font-family-primary` (split heading and body faces via `--font-family-heading` and `--font-family-body`); point them at any font you load. Only the preset stylesheets carry faces, each self-hosting its own, and only the presets you import pull them in.
106
108
  - **Icons**: a Material Symbols Rounded variable font is bundled and components import it themselves, with every Google axis exposed as a custom property. Every icon prop also takes your own element, so any icon set drops in.
107
109
 
@@ -1,7 +1,10 @@
1
1
  /* Points the library's primary face at the one font.ts loads. The class
2
2
  that defines --font-rift-primary sits on <html>, which is :root, so the
3
- variable resolves here. A shipped theme (data-brand on <html>) sets its
4
- own face and wins over this rule. */
5
- :root {
6
- --font-family-primary: var(--font-rift-primary), 'Nunito Sans', sans-serif;
3
+ variable resolves here. The rule sits in the library's base token layer,
4
+ so a shipped theme (data-brand on <html>) still sets its own face over
5
+ it. Move it out of the layer to keep this face under every theme. */
6
+ @layer rift.tokens {
7
+ :root {
8
+ --font-family-primary: var(--font-rift-primary), 'Nunito Sans', sans-serif;
9
+ }
7
10
  }
@@ -13,6 +13,8 @@ export interface ChatThreadsProps {
13
13
  profile?: ThreadPanelProfile;
14
14
  /** Rendered in the rail's footer in both seats (above the profile row on the inline rail; the sheet has none): a theme toggle, a link out. Fades out while the inline rail is collapsed. */
15
15
  footerSlot?: ReactNode;
16
+ /** Rendered in the inline rail's footer while it is collapsed, in `footerSlot`'s place: the same controls at their smallest, stacked on the rail's axis, crossfading with the full form. The sheet never collapses, so it never shows. */
17
+ collapsedFooterSlot?: ReactNode;
16
18
  /** Whether the inline rail can collapse to its icon strip. */
17
19
  collapsible?: boolean;
18
20
  /**
@@ -40,4 +42,4 @@ export interface ChatThreadsProps {
40
42
  * thread lifecycle (`useThreads`). The widget seats it inline on a wide
41
43
  * host and as a slide-over sheet on a narrow one, and tells it which.
42
44
  */
43
- export declare function ChatThreads({ overlay, close, logo, logoText, profile, footerSlot, collapsible, defaultExpanded, historyLabel, threadPanelLabels, actionLabels, }: ChatThreadsProps): import("react").JSX.Element;
45
+ export declare function ChatThreads({ overlay, close, logo, logoText, profile, footerSlot, collapsedFooterSlot, collapsible, defaultExpanded, historyLabel, threadPanelLabels, actionLabels, }: ChatThreadsProps): import("react").JSX.Element;
@@ -10,6 +10,7 @@ function ChatThreads({
10
10
  logoText,
11
11
  profile,
12
12
  footerSlot,
13
+ collapsedFooterSlot,
13
14
  collapsible = true,
14
15
  defaultExpanded = false,
15
16
  historyLabel = "Chat history",
@@ -67,7 +68,8 @@ function ChatThreads({
67
68
  expanded: overlay || !collapsible ? true : expanded,
68
69
  onExpandedChange: overlay || !collapsible ? void 0 : setExpanded,
69
70
  profile: overlay ? void 0 : profile,
70
- footerSlot
71
+ footerSlot,
72
+ collapsedFooterSlot: overlay ? void 0 : collapsedFooterSlot
71
73
  }
72
74
  );
73
75
  }
@@ -247,6 +247,77 @@
247
247
  padding: var(--gap-1000) var(--ds-chat-widget-inset) var(--padding-400);
248
248
  }
249
249
 
250
+ /* ============================================
251
+ THE WELCOME'S ENTRANCE
252
+ A fresh welcome arrives rather than appears: the composer rises in at
253
+ once, the thing to type into first; then the greeting, and then the
254
+ widget board's tiles pop in one after another, a dashboard assembling
255
+ itself. The overlay and the slot mount afresh on every new chat, so it
256
+ plays each time. The greeting and the tiles wait a short beat first
257
+ (--ds-chat-widget-welcome-hold, the deliberate duration by default), the
258
+ composer alone standing on the ground, so the ground itself (a shader
259
+ scene, the page) registers before the board lands on it; a host sets
260
+ the property on the widget or an ancestor to lengthen the wait or zero
261
+ it. The composer is read through the overlay's presence, since it stays
262
+ mounted into the conversation. Every length is a motion token or a
263
+ multiple of one, so reduced motion collapses the sequence to an instant.
264
+ The fill is backwards only: hidden through the hold, and once in, no
265
+ filled frame is left behind, so no transform lingers to become a
266
+ containing block under the composer's popovers.
267
+ ============================================ */
268
+
269
+ .ds-chat-widget:has(.ds-chat-widget__welcome) .ds-chat-widget__composer {
270
+ animation: ds-chat-widget-welcome-in var(--motion-duration-slower) var(--motion-ease-entrance) backwards;
271
+ }
272
+
273
+ .ds-chat-widget__greeting {
274
+ animation: ds-chat-widget-welcome-in var(--motion-duration-slow) var(--motion-ease-entrance) backwards;
275
+ animation-delay: var(--ds-chat-widget-welcome-hold, var(--motion-duration-deliberate));
276
+ }
277
+
278
+ @keyframes ds-chat-widget-welcome-in {
279
+ from {
280
+ opacity: 0;
281
+ transform: translateY(var(--gap-200));
282
+ }
283
+ to {
284
+ opacity: 1;
285
+ transform: none;
286
+ }
287
+ }
288
+
289
+ /* The tiles, each a quick step after the last, starting as the greeting
290
+ is still rising, on the same structural duration as the greeting, so
291
+ the board snaps together; anything in the slot that is not a tile grid
292
+ arrives as one piece. */
293
+ .ds-chat-widget__widgets .ds-widget-grid > *,
294
+ .ds-chat-widget__widgets > :not(.ds-widget-grid) {
295
+ --ds-chat-widget-tile: 0;
296
+ animation: ds-chat-widget-tile-in var(--motion-duration-slow) var(--motion-ease-entrance) backwards;
297
+ animation-delay: calc(
298
+ var(--ds-chat-widget-welcome-hold, var(--motion-duration-deliberate)) + var(--motion-duration-base) +
299
+ var(--ds-chat-widget-tile) * var(--motion-duration-fast) * 0.6
300
+ );
301
+ }
302
+
303
+ .ds-chat-widget__widgets .ds-widget-grid > :nth-child(2) { --ds-chat-widget-tile: 1; }
304
+ .ds-chat-widget__widgets .ds-widget-grid > :nth-child(3) { --ds-chat-widget-tile: 2; }
305
+ .ds-chat-widget__widgets .ds-widget-grid > :nth-child(4) { --ds-chat-widget-tile: 3; }
306
+ .ds-chat-widget__widgets .ds-widget-grid > :nth-child(5) { --ds-chat-widget-tile: 4; }
307
+ .ds-chat-widget__widgets .ds-widget-grid > :nth-child(6) { --ds-chat-widget-tile: 5; }
308
+ .ds-chat-widget__widgets .ds-widget-grid > :nth-child(n + 7) { --ds-chat-widget-tile: 6; }
309
+
310
+ @keyframes ds-chat-widget-tile-in {
311
+ from {
312
+ opacity: 0;
313
+ transform: translateY(var(--gap-400)) scale(0.94);
314
+ }
315
+ to {
316
+ opacity: 1;
317
+ transform: none;
318
+ }
319
+ }
320
+
250
321
  /* With widgets the composer holds the same dead centre the starters give
251
322
  it: the region keeps the zero basis, so the slack splits evenly and the
252
323
  widgets hang below the composer. Its content is its floor (a flex item's
@@ -769,11 +840,12 @@
769
840
  gives it back before the conversation drops under its floor (the 320px
770
841
  mirrors ARTIFACT_MIN_COLUMN_WIDTH in queries.ts). */
771
842
  .ds-chat-widget__rails[data-artifact-sized] > .ds-chat-widget__artifact-rail--open {
772
- flex: 0 1 var(--ds-chat-artifact-width);
843
+ flex: 0 1 min(var(--ds-chat-artifact-width), var(--ds-chat-artifact-room, var(--ds-chat-artifact-width)));
773
844
  }
774
845
 
775
846
  .ds-chat-widget__rails[data-artifact-sized] > .ds-chat-widget {
776
- flex: 1 0 320px;
847
+ flex: 1 0 0;
848
+ min-width: 320px;
777
849
  }
778
850
 
779
851
  /* The pointer drives the width frame by frame, so the glides stand down
@@ -830,16 +902,44 @@
830
902
  background: var(--color-text-secondary);
831
903
  }
832
904
 
833
- /* Expanded, the artifact has the widget: the conversation and the history
834
- leave the row (and with them the tab order), and the card takes an inset
835
- on its leading edge too. */
836
- .ds-chat-widget__rails[data-artifact-expanded] > .ds-chat-widget,
837
- .ds-chat-widget__rails[data-artifact-expanded] > .ds-chat-widget__threads-rail {
838
- display: none;
905
+ /* Expanded, the artifact takes the conversation's room: the conversation
906
+ folds to nothing beside it (fading first, so its reflow is never seen,
907
+ then leaving the tab order once the fold has finished) while the card
908
+ glides across and takes an inset on its leading edge too. The history
909
+ rail keeps its place. Collapsing runs the same glide back, the
910
+ conversation fading in once it has its room again.
911
+ Only the two grow shares move (the conversation's from 1 to 0, the
912
+ card's from 0 to 1, in the expanded seat rule further down); both bases hold
913
+ still, since a basis gliding against a share bows the split and the
914
+ conversation swells before it folds. The grip's floor for the
915
+ conversation steps aside at once on the way out and returns only once
916
+ the way back has finished, so it never shoves the glide. */
917
+ .ds-chat-widget__rails > .ds-chat-widget {
918
+ transition:
919
+ flex-grow var(--motion-duration-slow) var(--motion-ease-emphasized),
920
+ opacity var(--motion-duration-base) var(--motion-ease-standard) calc(var(--motion-duration-slow) - var(--motion-duration-base)),
921
+ /* ds-allow(motion): an instant step for the conversation's floor, the visibility idiom applied to min-width */
922
+
923
+ min-width 0s linear var(--motion-duration-slow),
924
+ visibility 0s linear 0s;
925
+ }
926
+
927
+ .ds-chat-widget__rails[data-artifact-expanded] > .ds-chat-widget {
928
+ flex-grow: 0;
929
+ min-width: 0;
930
+ opacity: 0;
931
+ visibility: hidden;
932
+ overflow: hidden;
933
+ transition:
934
+ flex-grow var(--motion-duration-slow) var(--motion-ease-emphasized),
935
+ opacity var(--motion-duration-fast) var(--motion-ease-standard),
936
+ /* ds-allow(motion): an instant step for the conversation's floor, the visibility idiom applied to min-width */
937
+
938
+ min-width 0s linear 0s,
939
+ visibility 0s linear var(--motion-duration-slow);
839
940
  }
840
941
 
841
942
  .ds-chat-widget__rails[data-artifact-expanded] > .ds-chat-widget__artifact-rail--open {
842
- flex: 1 1 0;
843
943
  margin-inline-start: var(--padding-500);
844
944
  }
845
945
 
@@ -1340,10 +1440,16 @@ html[data-chat-resizing] .ds-chat-launcher__panel--floating .ds-chat-header {
1340
1440
  (held to the room), so the open is the same glide every time; the
1341
1441
  grip's width takes over once the reader drags it, and the expanded
1342
1442
  state still takes the whole row. */
1343
- .ds-chat-widget__rails:not([data-artifact-sized], [data-artifact-expanded]) > .ds-chat-widget__artifact-rail--open {
1443
+ .ds-chat-widget__rails:not([data-artifact-sized]) > .ds-chat-widget__artifact-rail--open {
1344
1444
  flex: 0 1 min(var(--ds-chat-artifact-rest-width), var(--ds-chat-artifact-room, var(--ds-chat-artifact-rest-width)));
1345
1445
  }
1346
1446
 
1447
+ /* Expanded, the seat keeps its basis (resting or the grip's) and takes a
1448
+ grow share, so the glide is the shares trading and nothing else. */
1449
+ .ds-chat-widget__rails[data-artifact-expanded] > .ds-chat-widget__artifact-rail--open {
1450
+ flex-grow: 1;
1451
+ }
1452
+
1347
1453
  /* ============================================
1348
1454
  SHELL MODES (the layout prop)
1349
1455
  A host where the chat is the page seats it in one of the three app
@@ -1422,6 +1528,15 @@ html[data-chat-resizing] .ds-chat-launcher__panel--floating .ds-chat-header {
1422
1528
  overflow: hidden;
1423
1529
  }
1424
1530
 
1531
+ /* The raised surface clips to its corners, but the scrolling welcome page
1532
+ is the surface itself scrolling (the scroll layout above makes the root
1533
+ the scroller), so inset keeps the clip on the inline axis and lets the
1534
+ block axis scroll; otherwise a long dashboard sits cut off at the foot
1535
+ with no way to reach the rest of it. */
1536
+ .ds-chat-widget__rails[data-ds-shell='inset'] > .ds-chat-widget[data-widgets='scroll'] {
1537
+ overflow-y: auto;
1538
+ }
1539
+
1425
1540
  /* The seats hold the gap above and below in both states, so the glide is
1426
1541
  the width alone. */
1427
1542
  .ds-chat-widget__rails[data-ds-shell='inset'] > .ds-chat-widget__aside-rail,
@@ -1434,6 +1549,39 @@ html[data-chat-resizing] .ds-chat-launcher__panel--floating .ds-chat-header {
1434
1549
  margin-inline-end: var(--ds-shell-gap);
1435
1550
  }
1436
1551
 
1552
+ /* Expanded, the raised conversation folds its gap and hairline away with
1553
+ its width, and the card takes the conversation's exact seat: flush to
1554
+ the history rail, as the conversation was, with no inset of its own. */
1555
+ .ds-chat-widget__rails[data-ds-shell='inset'] > .ds-chat-widget {
1556
+ transition:
1557
+ flex-grow var(--motion-duration-slow) var(--motion-ease-emphasized),
1558
+ margin var(--motion-duration-slow) var(--motion-ease-emphasized),
1559
+ border-width var(--motion-duration-slow) var(--motion-ease-emphasized),
1560
+ opacity var(--motion-duration-base) var(--motion-ease-standard) calc(var(--motion-duration-slow) - var(--motion-duration-base)),
1561
+ /* ds-allow(motion): an instant step for the conversation's floor, the visibility idiom applied to min-width */
1562
+
1563
+ min-width 0s linear var(--motion-duration-slow),
1564
+ visibility 0s linear 0s;
1565
+ }
1566
+
1567
+ .ds-chat-widget__rails[data-ds-shell='inset'][data-artifact-expanded] > .ds-chat-widget {
1568
+ margin-inline-end: 0;
1569
+ border-inline-width: 0;
1570
+ transition:
1571
+ flex-grow var(--motion-duration-slow) var(--motion-ease-emphasized),
1572
+ margin var(--motion-duration-slow) var(--motion-ease-emphasized),
1573
+ border-width var(--motion-duration-slow) var(--motion-ease-emphasized),
1574
+ opacity var(--motion-duration-fast) var(--motion-ease-standard),
1575
+ /* ds-allow(motion): an instant step for the conversation's floor, the visibility idiom applied to min-width */
1576
+
1577
+ min-width 0s linear 0s,
1578
+ visibility 0s linear var(--motion-duration-slow);
1579
+ }
1580
+
1581
+ .ds-chat-widget__rails[data-ds-shell='inset'][data-artifact-expanded] > .ds-chat-widget__artifact-rail--open {
1582
+ margin-inline-start: 0;
1583
+ }
1584
+
1437
1585
  .ds-chat-widget__rails[data-ds-shell='inset'] .ds-chat-widget__aside-rail-inner,
1438
1586
  .ds-chat-widget__rails[data-ds-shell='inset'] .ds-chat-widget__artifact-rail-inner {
1439
1587
  background-color: var(--ds-shell-surface);
@@ -1460,12 +1608,15 @@ html[data-chat-resizing] .ds-chat-launcher__panel--floating .ds-chat-header {
1460
1608
  display: none;
1461
1609
  }
1462
1610
 
1463
- /* The artifact header keeps room at its end for the two controls (a
1464
- default control each and their gap), so its own view toggle and expand
1465
- sit beside them and never pass under them as the card arrives; its close
1466
- is the header toggle's action, so it goes. */
1611
+ /* The artifact header keeps room at its end for the floating controls (as
1612
+ many default controls as the cluster holds, each with the controls' own
1613
+ gap), so its view toggle and expand sit beside them as one cluster and
1614
+ never pass under them as the card arrives; its close is the header
1615
+ toggle's action, so it goes. */
1467
1616
  .ds-chat-widget__rails[data-ds-shell='inset'] .ds-chat-widget__artifact-rail-inner .ds-artifact-panel__header {
1468
- padding-inline-end: calc(var(--padding-300) * 2 + var(--control-height-default) * 2 + var(--gap-100));
1617
+ padding-inline-end: calc(
1618
+ var(--padding-300) + var(--ds-chat-action-count, 2) * (var(--control-height-default) + var(--gap-100))
1619
+ );
1469
1620
  }
1470
1621
 
1471
1622
  .ds-chat-widget__rails[data-ds-shell='inset'] .ds-chat-widget__artifact-rail-inner .ds-artifact-panel__controls > :last-child {
@@ -159,7 +159,7 @@ export interface ChatWidgetProps {
159
159
  }) => ReactNode;
160
160
  /** The built-in agent pane: who the agent is and what it has been doing. Seated like `aside`. */
161
161
  agent?: ChatAgentOptions;
162
- /** Seat the artifact panel: a reply that carries an artifact draws a tile in the thread, and the tile (or the header's artifact button) opens the artifact beside the conversation on a wide host and as a bottom sheet on a narrow one. The trailing seat holds one panel at a time, so an open artifact stands in for the agent pane. Off, none of it exists: no header button, no tile, no panel. */
162
+ /** Seat the artifact panel: a reply that carries an artifact draws a tile in the thread, and the tile (or the header's artifact button) opens the artifact beside the conversation on a wide host and as a bottom sheet on a narrow one. The trailing seat holds one panel at a time, so an open artifact stands in for the agent pane. The panel's expand toggle gives it the conversation's room, never the history's: the history rail keeps its place, and Escape steps back. Off, none of it exists: no header button, no tile, no panel. */
163
163
  artifacts?: boolean;
164
164
  /** What the chat is looking at, named on the composer's context note: a page, a selection, a passage. Omit for none. A host whose context follows the reader (rows they ticked, text they highlighted) updates it as they go, and can offer a way back and repeat it on each message sent. */
165
165
  context?: ChatContext | null;
@@ -386,7 +386,7 @@ function ChatWidget({
386
386
  }
387
387
  }, [artifacts, turns, openArtifact]);
388
388
  const trailingUp = artifactInline || Boolean(renderAside) && asideOpen && asideWide;
389
- const threadsInline = threadsWide && !(trailingUp && (!asideRoomy || artifactExpanded));
389
+ const threadsInline = threadsWide && !(trailingUp && !asideRoomy);
390
390
  useEffect(() => {
391
391
  if (!artifacts) return;
392
392
  const host = railsHostRef.current;
@@ -746,7 +746,10 @@ function ChatWidget({
746
746
  "data-artifact-expanded": artifactExpanded || void 0,
747
747
  "data-artifact-sized": artifactWidth !== null || artifactResizing || void 0,
748
748
  "data-artifact-resizing": artifactResizing || void 0,
749
- style: artifactWidth !== null ? { "--ds-chat-artifact-width": `${artifactWidth}px` } : void 0,
749
+ style: {
750
+ "--ds-chat-action-count": actionCount,
751
+ ...artifactWidth !== null ? { "--ds-chat-artifact-width": `${artifactWidth}px` } : {}
752
+ },
750
753
  onKeyDown: (event) => {
751
754
  if (event.key === "Escape" && artifactExpanded && !event.defaultPrevented) {
752
755
  event.stopPropagation();
@@ -10,7 +10,7 @@ type ActionCardOwnProps = {
10
10
  detail?: React.ReactNode;
11
11
  /** What the change will do, a line each, as ActionReadout lists what one did: shown over Confirm, then kept, under the receipt, by the confirmed record. A dismissed or undone card is one row and shows none. Write them for the state the card is in. */
12
12
  facts?: ActionReadoutFact[];
13
- /** The leading mark: a Material Symbol name, or your own element. */
13
+ /** The mark trailing the title: a Material Symbol name, or your own element. */
14
14
  icon?: string | React.ReactNode;
15
15
  /** Where the change stands. Fully controlled by design: the host makes the change, so it owns whether it was made. `proposed` offers Confirm and Dismiss; the others are the card's record. Defaults to `proposed`. */
16
16
  status?: ActionCardStatus;
@@ -163,6 +163,17 @@
163
163
  line-height: 1;
164
164
  }
165
165
 
166
+ /* A trailing icon (an external link's open_in_new), as in DropdownMenu. */
167
+ .ds-context-menu__item-icon-right {
168
+ --icon-size: var(--icon-size-500);
169
+ color: var(--color-icon-secondary);
170
+ flex-shrink: 0;
171
+ display: flex;
172
+ align-items: center;
173
+ margin-inline-start: auto;
174
+ line-height: 1;
175
+ }
176
+
166
177
  /* ============================================
167
178
  KEYBOARD SHORTCUT
168
179
  ============================================ */
@@ -3,7 +3,7 @@ import { DropdownMenuEntry } from '../DropdownMenu/DropdownMenu';
3
3
  import { ShortcutKeyLabels } from '../../behaviors/shortcut-keys';
4
4
  /** Props owned by ContextMenu itself — everything else falls through to the wrapper div. */
5
5
  type ContextMenuOwnProps = {
6
- /** Menu entries — the same model as DropdownMenu (items, groups, separators) */
6
+ /** Menu entries — DropdownMenu's model (items, groups, separators). A context menu draws an item's label, icon, shortcut, selected and destructive states; it does not draw `description` or `checked`, and `closeOnSelect` is not read. */
7
7
  items: DropdownMenuEntry[];
8
8
  /** Component size */
9
9
  size?: 'default' | 'compact';
@@ -6,7 +6,7 @@ import { useLayer } from "../../behaviors/useLayer.js";
6
6
  import { MOTION_HOVER_HIDE_DELAY_MS } from "../../tokens/motion.js";
7
7
  import "./ContextMenu.css";
8
8
  import "../../fonts/material-symbols.css";
9
- import { MenuKeyLabelsContext, MenuShortcutHint } from "../DropdownMenu/ShortcutHint.js";
9
+ import { MenuKeyLabelsContext, MenuShortcutHint, MenuIconRight } from "../DropdownMenu/ShortcutHint.js";
10
10
  import { shortcutAriaAnyPlatform } from "../../behaviors/shortcut-keys.js";
11
11
  import { mirrorClass } from "../../behaviors/direction.js";
12
12
  function collectItems(entries) {
@@ -152,6 +152,7 @@ const SubEntry = ({
152
152
  entry.label
153
153
  ] }),
154
154
  /* @__PURE__ */ jsx(MenuShortcutHint, { item: entry, className: `${baseClass}__shortcut` }),
155
+ /* @__PURE__ */ jsx(MenuIconRight, { item: entry, baseClass }),
155
156
  entry.selected && /* @__PURE__ */ jsx(ChosenMark, {})
156
157
  ]
157
158
  }
@@ -361,6 +362,7 @@ const ContextMenu = React.forwardRef(
361
362
  entry.label
362
363
  ] }),
363
364
  /* @__PURE__ */ jsx(MenuShortcutHint, { item: entry, className: `${baseClass}__shortcut` }),
365
+ /* @__PURE__ */ jsx(MenuIconRight, { item: entry, baseClass }),
364
366
  entry.selected && /* @__PURE__ */ jsx(ChosenMark, {})
365
367
  ]
366
368
  },
@@ -120,9 +120,13 @@
120
120
  ============================================ */
121
121
 
122
122
  /* The frame holds the guide and drop lines, and is the scroll container
123
- a sticky header and pinned columns stick to. */
123
+ a sticky header and pinned columns stick to. It is also the
124
+ inline-size container a details panel takes its width from (see
125
+ DETAILS below), so the visible width reaches the panel through the
126
+ stylesheet, never through a render. */
124
127
  .ds-data-table__frame {
125
128
  position: relative;
129
+ container-type: inline-size;
126
130
  }
127
131
 
128
132
  /* Fixed widths: every column holds its own width exactly, and a filler
@@ -138,8 +142,13 @@
138
142
  /* Under fixed widths a cell clips what does not fit, so a narrow column
139
143
  never draws over its neighbour. Menus and tooltips inside are fixed
140
144
  panels and escape the clip. A pinned edge cell clips its content box
141
- instead, since its scrolling-edge shadow is drawn outside the cell. */
142
- .ds-data-table__grid--fixed .ds-table__body .ds-table__cell:not(.ds-data-table__cell--pinned-edge),
145
+ instead, since its scrolling-edge shadow is drawn outside the cell. The
146
+ details cell is left out: a clipping cell would be the scroll container
147
+ its sticky panel holds to, and the panel would scroll away with the
148
+ columns; the panel clips its own body instead. */
149
+ .ds-data-table__grid--fixed
150
+ .ds-table__body
151
+ .ds-table__cell:not(.ds-data-table__cell--pinned-edge, .ds-data-table__detail-cell),
143
152
  .ds-data-table__grid--fixed .ds-data-table__cell--pinned-edge > .ds-table__cell-content {
144
153
  overflow: hidden;
145
154
  }
@@ -917,7 +926,8 @@
917
926
  }
918
927
 
919
928
  /* Every other column: its label, then its value, on a line of its own. */
920
- .ds-data-table__grid--stacked .ds-table__cell:not(.ds-table__cell--row-header, .ds-data-table__utility, .ds-data-table__actions) {
929
+ .ds-data-table__grid--stacked
930
+ .ds-table__cell:not(.ds-table__cell--row-header, .ds-data-table__utility, .ds-data-table__actions, .ds-data-table__detail-cell) {
921
931
  order: 2;
922
932
  display: grid;
923
933
  flex-basis: 100%;
@@ -1161,10 +1171,15 @@
1161
1171
  background-color: var(--color-table-body-bg);
1162
1172
  }
1163
1173
 
1174
+ /* The panel is as wide as the visible table, not the whole scrolling
1175
+ grid: the frame's content box, read as its container's inline size
1176
+ (inside the frame's border and any scrollbar), so a pinned, scrolling or
1177
+ virtualised grid keeps its details in view at every width. */
1164
1178
  .ds-data-table__detail {
1165
1179
  position: sticky;
1166
1180
  inset-inline-start: 0;
1167
1181
  display: grid;
1182
+ width: 100cqi;
1168
1183
  grid-template-rows: 1fr;
1169
1184
  max-width: 100%;
1170
1185
  animation: ds-data-table-detail-open var(--motion-duration-base) var(--motion-ease-standard);
@@ -1197,6 +1212,11 @@
1197
1212
  flex-basis: 100%;
1198
1213
  }
1199
1214
 
1215
+ /* A card is narrower than the frame, so its details take the card's width. */
1216
+ .ds-data-table__grid--stacked .ds-data-table__detail {
1217
+ width: auto;
1218
+ }
1219
+
1200
1220
  /* ============================================
1201
1221
  SCALE
1202
1222
  A virtualised body's spacer rows hold the
@@ -104,7 +104,6 @@ const VIRTUAL_THRESHOLD = 200;
104
104
  const VIRTUAL_HEIGHT = 640;
105
105
  const ESTIMATED_ROW_HEIGHT = { default: 52, compact: 40 };
106
106
  const VIRTUAL_OVERSCAN = 8;
107
- const UTILITY_BORDER = 1;
108
107
  const SORT_RANK_WIDTH = 12;
109
108
  const MENU_BUTTON_WIDTH = 36;
110
109
  const FILTER_MARK_WIDTH = 24;
@@ -434,23 +433,17 @@ function DataTable({
434
433
  ].filter((key, index, all) => all.indexOf(key) === index);
435
434
  const rootRef = useRef(null);
436
435
  const tableId = useId();
437
- const [narrowWidth, setNarrowWidth] = useState(0);
438
- const [tableWidth, setTableWidth] = useState(0);
439
- const hasDetails = Boolean(renderDetail);
440
- useLayoutEffect(() => {
441
- const el = rootRef.current;
442
- if (!el || !hasDetails) return;
443
- const observer = new ResizeObserver(([entry]) => setTableWidth(Math.round(entry.contentRect.width / 8) * 8));
444
- observer.observe(el);
445
- return () => observer.disconnect();
446
- }, [hasDetails]);
447
- const narrow = narrowWidth > 0;
436
+ const [narrow, setNarrow] = useState(false);
448
437
  useLayoutEffect(() => {
449
438
  const el = rootRef.current;
450
439
  if (!el) return;
440
+ let last = false;
451
441
  const observer = new ResizeObserver(([entry]) => {
452
442
  const width = entry.contentRect.width;
453
- setNarrowWidth(width > 0 && width < BREAKPOINT_PHONE_PX ? Math.round(width / 8) * 8 : 0);
443
+ const next = width > 0 && width < BREAKPOINT_PHONE_PX;
444
+ if (next === last) return;
445
+ last = next;
446
+ setNarrow(next);
454
447
  });
455
448
  observer.observe(el);
456
449
  return () => observer.disconnect();
@@ -717,33 +710,48 @@ function DataTable({
717
710
  };
718
711
  const clampWidth = (col, width) => Math.round(Math.min(col.maxWidth ?? Number.MAX_SAFE_INTEGER, Math.max(minWidthOf(col), width)));
719
712
  const PHONE_PINNED_SHARE = 0.4;
720
- const widthOf = (key, widths = widthsState) => {
713
+ const cappedKey = narrow && !stacked && rowHeaderKey && regionOf(rowHeaderKey) === "start" ? rowHeaderKey : void 0;
714
+ const plainWidthOf = (key, widths) => {
721
715
  const col = byKey.get(key);
722
- const width = clampWidth(col, widths[key] ?? declaredOf(key) ?? measured[key] ?? minWidthOf(col));
723
- if (narrow && !stacked && key === rowHeaderKey && regionOf(key) === "start")
724
- return Math.min(width, Math.max(minWidthOf(col), Math.round(narrowWidth * PHONE_PINNED_SHARE)));
725
- return width;
716
+ return clampWidth(col, widths[key] ?? declaredOf(key) ?? measured[key] ?? minWidthOf(col));
717
+ };
718
+ const widthCss = (key, widths) => {
719
+ const width = plainWidthOf(key, widths);
720
+ if (key !== cappedKey) return `${width}px`;
721
+ const floor = Math.min(width, minWidthOf(byKey.get(key)));
722
+ return `min(${width}px, max(${floor}px, ${PHONE_PINNED_SHARE * 100}cqi))`;
723
+ };
724
+ const widthOf = (key, widths = widthsState) => {
725
+ const width = plainWidthOf(key, widths);
726
+ if (key !== cappedKey) return width;
727
+ const frame = tableEl?.parentElement?.clientWidth ?? 0;
728
+ return Math.min(width, Math.max(minWidthOf(byKey.get(key)), Math.round(frame * PHONE_PINNED_SHARE)));
726
729
  };
727
730
  const layoutVars = (widths) => {
728
731
  const vars = {};
729
- let total = utilityKeys.length * UTILITY_COLUMN_WIDTH;
732
+ const sumOf = (keys, start, extra) => {
733
+ let px = start;
734
+ const terms = [];
735
+ keys.forEach((key) => {
736
+ if (key === cappedKey) terms.push(widthCss(key, widths));
737
+ else px += plainWidthOf(key, widths);
738
+ });
739
+ if (extra) terms.push(extra);
740
+ return terms.length ? `calc(${[`${px}px`, ...terms].join(" + ")})` : `${px}px`;
741
+ };
742
+ const actions = showActions ? "var(--ds-dt-w-actions)" : void 0;
743
+ const utility = utilityKeys.length * UTILITY_COLUMN_WIDTH;
730
744
  visibleKeys.forEach((key) => {
731
- const w = widthOf(key, widths);
732
- vars[`--ds-dt-w-${indexOfKey.get(key)}`] = `${w}px`;
733
- total += w;
745
+ vars[`--ds-dt-w-${indexOfKey.get(key)}`] = widthCss(key, widths);
734
746
  });
735
- let offset = utilityKeys.length * UTILITY_COLUMN_WIDTH;
736
- startKeys.forEach((key) => {
737
- vars[`--ds-dt-off-${indexOfKey.get(key)}`] = `${offset}px`;
738
- offset += widthOf(key, widths);
747
+ startKeys.forEach((key, index) => {
748
+ vars[`--ds-dt-off-${indexOfKey.get(key)}`] = sumOf(startKeys.slice(0, index), utility);
739
749
  });
740
- const plusActions = (px) => showActions ? `calc(${px}px + var(--ds-dt-w-actions))` : `${px}px`;
741
- let fromEnd = 0;
742
- [...endKeys].reverse().forEach((key) => {
743
- vars[`--ds-dt-off-${indexOfKey.get(key)}`] = plusActions(fromEnd);
744
- fromEnd += widthOf(key, widths);
750
+ const fromEnd = [...endKeys].reverse();
751
+ fromEnd.forEach((key, index) => {
752
+ vars[`--ds-dt-off-${indexOfKey.get(key)}`] = sumOf(fromEnd.slice(0, index), 0, actions);
745
753
  });
746
- vars["--ds-dt-total"] = plusActions(total);
754
+ vars["--ds-dt-total"] = sumOf(visibleKeys, utility, actions);
747
755
  return vars;
748
756
  };
749
757
  const writeVars = (vars) => {
@@ -2250,14 +2258,7 @@ function DataTable({
2250
2258
  ref: slot ? slot.measure : void 0,
2251
2259
  "data-index": slot?.index,
2252
2260
  "aria-rowindex": slot ? slot.index + 2 : void 0,
2253
- children: /* @__PURE__ */ jsx("td", { id: detailId, colSpan: columnCount, className: `ds-table__cell ${baseClass}__detail-cell`, children: /* @__PURE__ */ jsx(
2254
- "div",
2255
- {
2256
- className: `${baseClass}__detail`,
2257
- style: tableWidth && !stacked ? { width: tableWidth - 2 * UTILITY_BORDER } : void 0,
2258
- children: /* @__PURE__ */ jsx("div", { className: `${baseClass}__detail-body`, children: renderDetail(row) })
2259
- }
2260
- ) })
2261
+ children: /* @__PURE__ */ jsx("td", { id: detailId, colSpan: columnCount, className: `ds-table__cell ${baseClass}__detail-cell`, children: /* @__PURE__ */ jsx("div", { className: `${baseClass}__detail`, children: /* @__PURE__ */ jsx("div", { className: `${baseClass}__detail-body`, children: renderDetail(row) }) }) })
2261
2262
  },
2262
2263
  `${row.id}:detail`
2263
2264
  );