rift-ds 1.25.0 → 1.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +1 -0
  2. package/chat/ChatThreads.d.ts +3 -1
  3. package/chat/ChatThreads.js +3 -1
  4. package/chat/ChatWidget.css +166 -15
  5. package/chat/ChatWidget.d.ts +1 -1
  6. package/chat/ChatWidget.js +5 -2
  7. package/components/ActionCard/ActionCard.d.ts +1 -1
  8. package/components/ContextMenu/ContextMenu.css +11 -0
  9. package/components/ContextMenu/ContextMenu.d.ts +1 -1
  10. package/components/ContextMenu/ContextMenu.js +3 -1
  11. package/components/DropdownMenu/DropdownMenu.css +38 -0
  12. package/components/DropdownMenu/DropdownMenu.d.ts +4 -0
  13. package/components/DropdownMenu/DropdownMenu.js +11 -5
  14. package/components/DropdownMenu/ShortcutHint.d.ts +9 -0
  15. package/components/DropdownMenu/ShortcutHint.js +6 -0
  16. package/components/InterruptCard/InterruptCard.d.ts +1 -1
  17. package/components/MessageCard/MessageCard.css +17 -6
  18. package/components/MessageCard/MessageCard.d.ts +1 -1
  19. package/components/ShaderScene/ShaderScene.d.ts +5 -5
  20. package/components/ShaderScene/ShaderScene.js +33 -10
  21. package/components/ShaderScene/assemble.js +2 -0
  22. package/components/ShaderScene/renderer.d.ts +5 -1
  23. package/components/ShaderScene/renderer.js +46 -1
  24. package/components/ShaderScene/scenes.d.ts +56 -0
  25. package/components/ShaderScene/scenes.js +570 -2
  26. package/components/ShaderScene/types.d.ts +13 -0
  27. package/components/ThreadPanel/ThreadPanel.css +29 -0
  28. package/components/ThreadPanel/ThreadPanel.d.ts +2 -0
  29. package/components/ThreadPanel/ThreadPanel.js +13 -2
  30. package/components/registry.json +1 -1
  31. package/components/registry.json.d.ts +1 -1
  32. package/components/registry.json.js +1 -1
  33. package/index.js +2 -1
  34. package/package.json +1 -1
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.
@@ -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
  },
@@ -211,6 +211,32 @@
211
211
  line-height: 1;
212
212
  }
213
213
 
214
+ /* A row with a description: the label over a caption line, the pair
215
+ stacked and the icon centred on them, the two-line row ThemePicker's
216
+ rows set the pattern for. */
217
+ .ds-dropdown-menu__item-text {
218
+ display: flex;
219
+ flex-direction: column;
220
+ min-width: 0;
221
+ text-align: start;
222
+ }
223
+
224
+ .ds-dropdown-menu__item-title {
225
+ line-height: var(--font-paragraph-sm-line-height);
226
+ }
227
+
228
+ .ds-dropdown-menu__item-description {
229
+ font-size: var(--font-caption-size);
230
+ font-weight: var(--font-caption-weight);
231
+ line-height: var(--font-caption-line-height);
232
+ color: var(--color-text-tertiary);
233
+ }
234
+
235
+ .ds-dropdown-menu__item--destructive .ds-dropdown-menu__item-description {
236
+ color: var(--color-action-destructive-text-secondary);
237
+ opacity: 0.7;
238
+ }
239
+
214
240
  /* Figma: icons are 24px within menu items */
215
241
  .ds-dropdown-menu__item-icon {
216
242
  --icon-size: var(--icon-size-600);
@@ -222,6 +248,18 @@
222
248
  line-height: 1;
223
249
  }
224
250
 
251
+ /* A trailing icon (an external link's open_in_new): the row's quietest
252
+ mark, one step under the leading icon, pushed to the trailing edge. */
253
+ .ds-dropdown-menu__item-icon-right {
254
+ --icon-size: var(--icon-size-500);
255
+ color: var(--color-icon-secondary);
256
+ flex-shrink: 0;
257
+ display: flex;
258
+ align-items: center;
259
+ margin-inline-start: auto;
260
+ line-height: 1;
261
+ }
262
+
225
263
  /* ============================================
226
264
  KEYBOARD SHORTCUT
227
265
  ============================================ */
@@ -4,12 +4,16 @@ export interface DropdownMenuItem {
4
4
  type?: 'item';
5
5
  /** Display label */
6
6
  label: string;
7
+ /** A line under the label, such as what the choice does or means. It wraps the row to two lines in the caption style; the icon stays centred on the pair. */
8
+ description?: string;
7
9
  /** Keyboard shortcut hint as literal text (e.g. "⇧ ⌘ P"). `keys` writes it for the reader's platform instead. */
8
10
  shortcut?: string;
9
11
  /** Keyboard shortcut hint in the shortcut grammar (`mod+shift+p`), written for the reader's platform (⇧⌘P on a Mac, Ctrl+Shift+P elsewhere) and announced through `aria-keyshortcuts`. Display only: bind the action itself with `useShortcut`. Wins over `shortcut`. */
10
12
  keys?: Shortcut;
11
13
  /** Item icon — Material Symbol name (string) or custom element (ReactNode) */
12
14
  icon?: string | React.ReactNode;
15
+ /** A trailing icon after the label, such as `open_in_new` on an item that opens another site. Decorative: say what the item does in its label. A Material Symbol name (string) or a custom element (ReactNode). Ignored on an item that opens a sub-menu. */
16
+ iconRight?: string | React.ReactNode;
13
17
  /** Disabled state */
14
18
  disabled?: boolean;
15
19
  /** Marks a dangerous or irreversible item (delete, remove…): it takes the destructive colour, with the error tint on hover and focus */
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
3
3
  import React, { useState, useCallback, useRef, useId, useEffect } from "react";
4
4
  import { ChosenMark } from "../Dropdown/Dropdown.js";
5
5
  import { CheckboxIndicator } from "../Checkbox/Checkbox.js";
@@ -8,7 +8,7 @@ import { useAnchoredPosition } from "../../behaviors/useAnchoredPosition.js";
8
8
  import { MOTION_HOVER_HIDE_DELAY_MS } from "../../tokens/motion.js";
9
9
  import "./DropdownMenu.css";
10
10
  import "../../fonts/material-symbols.css";
11
- import { MenuKeyLabelsContext, MenuShortcutHint } from "./ShortcutHint.js";
11
+ import { MenuKeyLabelsContext, MenuShortcutHint, MenuIconRight } from "./ShortcutHint.js";
12
12
  import { shortcutAriaAnyPlatform } from "../../behaviors/shortcut-keys.js";
13
13
  import { mirrorClass } from "../../behaviors/direction.js";
14
14
  function collectItems(entries) {
@@ -33,6 +33,10 @@ function itemSemantics(item) {
33
33
  return { role: "menuitem" };
34
34
  }
35
35
  const closesOnSelect = (item) => item.closeOnSelect ?? item.checked === void 0;
36
+ const MenuItemText = ({ baseClass, label, description }) => description ? /* @__PURE__ */ jsxs("span", { className: `${baseClass}__item-text`, children: [
37
+ /* @__PURE__ */ jsx("span", { className: `${baseClass}__item-title`, children: label }),
38
+ /* @__PURE__ */ jsx("span", { className: `${baseClass}__item-description`, children: description })
39
+ ] }) : /* @__PURE__ */ jsx(Fragment, { children: label });
36
40
  const ITEM_SELECTOR = '[role="menuitem"], [role="menuitemradio"], [role="menuitemcheckbox"]';
37
41
  const SubMenuItem = ({ item, baseClass, itemId, focused, size, onActivate }) => {
38
42
  const [subOpen, setSubOpen] = useState(false);
@@ -91,7 +95,7 @@ const SubMenuItem = ({ item, baseClass, itemId, focused, size, onActivate }) =>
91
95
  children: [
92
96
  /* @__PURE__ */ jsxs("span", { className: `${baseClass}__item-label`, children: [
93
97
  item.icon && (typeof item.icon === "string" ? /* @__PURE__ */ jsx("span", { className: `${baseClass}__item-icon material-symbols-rounded ${mirrorClass(item.icon)}`, "aria-hidden": "true", children: item.icon }) : /* @__PURE__ */ jsx("span", { className: `${baseClass}__item-icon`, "aria-hidden": "true", children: item.icon })),
94
- item.label
98
+ /* @__PURE__ */ jsx(MenuItemText, { baseClass, label: item.label, description: item.description })
95
99
  ] }),
96
100
  /* @__PURE__ */ jsx("span", { className: `${baseClass}__submenu-icon material-symbols-rounded ds-mirror-rtl`, "aria-hidden": "true", children: "chevron_right" }),
97
101
  subOpen && item.children && /* @__PURE__ */ jsx(
@@ -182,9 +186,10 @@ const MenuPanel = ({
182
186
  }
183
187
  ),
184
188
  entry.icon && (typeof entry.icon === "string" ? /* @__PURE__ */ jsx("span", { className: `${baseClass}__item-icon material-symbols-rounded ${mirrorClass(entry.icon)}`, "aria-hidden": "true", children: entry.icon }) : /* @__PURE__ */ jsx("span", { className: `${baseClass}__item-icon`, "aria-hidden": "true", children: entry.icon })),
185
- entry.label
189
+ /* @__PURE__ */ jsx(MenuItemText, { baseClass, label: entry.label, description: entry.description })
186
190
  ] }),
187
191
  /* @__PURE__ */ jsx(MenuShortcutHint, { item: entry, className: `${baseClass}__shortcut` }),
192
+ /* @__PURE__ */ jsx(MenuIconRight, { item: entry, baseClass }),
188
193
  entry.selected && /* @__PURE__ */ jsx(ChosenMark, {})
189
194
  ]
190
195
  },
@@ -393,9 +398,10 @@ const DropdownMenu = React.forwardRef(({
393
398
  }
394
399
  ),
395
400
  entry.icon && (typeof entry.icon === "string" ? /* @__PURE__ */ jsx("span", { className: `${baseClass}__item-icon material-symbols-rounded ${mirrorClass(entry.icon)}`, "aria-hidden": "true", children: entry.icon }) : /* @__PURE__ */ jsx("span", { className: `${baseClass}__item-icon`, "aria-hidden": "true", children: entry.icon })),
396
- entry.label
401
+ /* @__PURE__ */ jsx(MenuItemText, { baseClass, label: entry.label, description: entry.description })
397
402
  ] }),
398
403
  /* @__PURE__ */ jsx(MenuShortcutHint, { item: entry, className: `${baseClass}__shortcut` }),
404
+ /* @__PURE__ */ jsx(MenuIconRight, { item: entry, baseClass }),
399
405
  entry.selected && /* @__PURE__ */ jsx(ChosenMark, {})
400
406
  ]
401
407
  },
@@ -10,3 +10,12 @@ export declare function MenuShortcutHint({ item, className }: {
10
10
  item: DropdownMenuItem;
11
11
  className: string;
12
12
  }): import("react").JSX.Element | null;
13
+ /**
14
+ * A menu row's trailing icon (`iconRight`), after the label and any
15
+ * shortcut hint, shared by DropdownMenu and ContextMenu. Decorative: the
16
+ * label says what the item does.
17
+ */
18
+ export declare function MenuIconRight({ item, baseClass }: {
19
+ item: DropdownMenuItem;
20
+ baseClass: string;
21
+ }): import("react").JSX.Element | null;
@@ -2,6 +2,7 @@
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  import { createContext, useContext } from "react";
4
4
  import { usePlatform } from "../../behaviors/shortcuts.js";
5
+ import { mirrorClass } from "../../behaviors/direction.js";
5
6
  import { formatShortcut } from "../../behaviors/shortcut-keys.js";
6
7
  const MenuKeyLabelsContext = createContext(void 0);
7
8
  function MenuShortcutHint({ item, className }) {
@@ -11,7 +12,12 @@ function MenuShortcutHint({ item, className }) {
11
12
  if (item.shortcut) return /* @__PURE__ */ jsx("span", { className, children: item.shortcut });
12
13
  return null;
13
14
  }
15
+ function MenuIconRight({ item, baseClass }) {
16
+ if (!item.iconRight) return null;
17
+ return typeof item.iconRight === "string" ? /* @__PURE__ */ jsx("span", { className: `${baseClass}__item-icon-right material-symbols-rounded ${mirrorClass(item.iconRight)}`, "aria-hidden": "true", children: item.iconRight }) : /* @__PURE__ */ jsx("span", { className: `${baseClass}__item-icon-right`, "aria-hidden": "true", children: item.iconRight });
18
+ }
14
19
  export {
20
+ MenuIconRight,
15
21
  MenuKeyLabelsContext,
16
22
  MenuShortcutHint
17
23
  };
@@ -37,7 +37,7 @@ type InterruptCardOwnProps = {
37
37
  title: string;
38
38
  /** One line of context under the title. */
39
39
  description?: string;
40
- /** Leading Material Symbol name, or any custom element. No icon by default. */
40
+ /** A Material Symbol name trailing the title, or any custom element. No icon by default. */
41
41
  icon?: string | React.ReactNode;
42
42
  /** The choices, rendered as buttons left to right. */
43
43
  options?: InterruptCardOption[];
@@ -36,21 +36,32 @@
36
36
  margin: var(--padding-300) var(--padding-300) 0;
37
37
  border-radius: var(--radius-300);
38
38
  overflow: hidden;
39
- /* The slot carries its own surface, so drawn media — a chart, an SVG —
40
- reads as the same image-shaped panel a photo would: one step in from
41
- the card's crisp fill, so it shows as a slot in both themes. */
39
+ /* The slot carries its own surface, so drawn media — an SVG, an
40
+ illustration — reads as the same image-shaped panel a photo would: a
41
+ step in from the card's crisp fill, so it shows as a slot in both
42
+ themes. */
42
43
  background-color: var(--color-bg-container-secondary);
43
44
  }
44
45
 
46
+ /* A chart's slot takes the primary container tone instead. The secondary
47
+ tone is the second elevation, a mid grey in dark mode (three steps
48
+ lighter than the card), and a plot drawn straight on it read as a grey
49
+ block with its fill washed out. The primary tone is the surface every
50
+ chart stands on elsewhere (its own panel's fill), a step in from the card
51
+ and nothing like a block. */
52
+ .ds-message-card__media:has(.ds-chart) {
53
+ background-color: var(--color-bg-container-primary);
54
+ }
55
+
45
56
  .ds-message-card__media img {
46
57
  display: block;
47
58
  width: 100%;
48
59
  }
49
60
 
50
61
  /* A Chart in the slot sheds its own panel chrome — the card is already the
51
- panel, and the slot's page tone is the brightest surface in light mode and
52
- the darkest in dark, so the drawing keeps maximum contrast against its
53
- ground instead of sitting on a second container tone. */
62
+ panel, and the slot above gives it the same primary container tone its
63
+ own panel would, so the drawing sits on one surface, not a panel inside a
64
+ slot. */
54
65
  .ds-message-card__media .ds-chart {
55
66
  background-color: transparent;
56
67
  border: none;
@@ -10,7 +10,7 @@ type MessageCardOwnProps = {
10
10
  description?: string;
11
11
  /** Top media slot — an image or chart, inset from the card edges with its own rounded corners. */
12
12
  media?: React.ReactNode;
13
- /** Small leading icon beside the title — a Material Symbol name, or any custom element. */
13
+ /** Small icon trailing the title at the row's end — a Material Symbol name, or any custom element. */
14
14
  icon?: string | React.ReactNode;
15
15
  /** Free-text metadata line, e.g. a domain or date, so callers keep their own formatting. */
16
16
  meta?: string;
@@ -1,7 +1,7 @@
1
1
  import { default as React } from 'react';
2
2
  import { Values } from './types';
3
3
  /** The scenes ShaderScene paints. */
4
- export type ShaderSceneId = 'horizon' | 'rift';
4
+ export type ShaderSceneId = 'horizon' | 'rift' | 'glyphs' | 'prism' | 'meteors' | 'waves' | 'aurora';
5
5
  /**
6
6
  * How the scene resolved, the same three states ShaderField reports.
7
7
  * `pending` while the GL context comes up (bounded by a watchdog), `active`
@@ -18,7 +18,7 @@ export type ShaderScenePassSetting = {
18
18
  };
19
19
  /** Props owned by ShaderScene itself; everything else falls through to the root. */
20
20
  type ShaderSceneOwnProps = {
21
- /** The scene to paint: `horizon`, a planet's limb at night, or `rift`, a glowing tear. */
21
+ /** The scene to paint: `horizon`, a planet's limb at night, `rift`, a glowing tear, `glyphs`, soft light printed in type, `prism`, beams of light split into a spectrum, `meteors`, a shower over a planet's edge, `waves`, a rolling sea of points, or `aurora`, ribbons of colour round a void. */
22
22
  scene?: ShaderSceneId;
23
23
  /**
24
24
  * The scene's settings, merged over its defaults (`SHADER_SCENES` lists each
@@ -56,14 +56,14 @@ type ShaderSceneOwnProps = {
56
56
  export interface ShaderSceneProps extends ShaderSceneOwnProps, Omit<React.ComponentPropsWithRef<'div'>, keyof ShaderSceneOwnProps> {
57
57
  }
58
58
  /**
59
- * ShaderScene paints one of the system's shader scenes, a horizon or a rift,
60
- * in WebGL2, with finishing passes over it (a scrim, a vignette, top and
59
+ * ShaderScene paints one of the system's shader scenes, a horizon, a rift,
60
+ * a field of glyphs, a prism, a meteor shower, a sea of points or an aurora, in WebGL2, with finishing passes over it (a scrim, a vignette, top and
61
61
  * bottom fades to the page, film grain). Its colours are the background
62
62
  * field's roles (`--color-ambient-*`) read from the live cascade at the
63
63
  * scene, so it re-themes with `data-theme`, a preset or any scoped override,
64
64
  * and its fades melt into the page ground.
65
65
  *
66
- * Both scenes are night scenes: they add light over a dark ground. On a light
66
+ * Every scene is a night scene: it adds light over a dark ground. On a light
67
67
  * page each computes its light against a dark ground of its own and lays it
68
68
  * onto the page as a pale tint, so it reads as a soft dawn rather than a dark
69
69
  * block. Nothing here sets `data-theme`, which would hide a preset's colours.