rift-ds 1.23.0 → 1.24.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.
@@ -18,6 +18,10 @@
18
18
  --ds-chat-width: 420px;
19
19
  /* The gap the panel and the launcher float off the viewport edges. */
20
20
  --ds-chat-inset: 20px;
21
+ /* The artifact card's resting width, held through its open and close
22
+ glide until the reader sizes it with the grip; it never takes more
23
+ than the room the widget measures (--ds-chat-artifact-room). */
24
+ --ds-chat-artifact-rest-width: 520px;
21
25
  /* The floating card's resting height. */
22
26
  --ds-chat-float-height: 640px;
23
27
  }
@@ -243,11 +247,14 @@
243
247
  padding: var(--gap-1000) var(--ds-chat-widget-inset) var(--padding-400);
244
248
  }
245
249
 
246
- /* With widgets the region takes its content's height before the slack is
247
- split, so the composer sits above centre by half the widgets' height
248
- rather than being squeezed against them. */
250
+ /* With widgets the composer holds the same dead centre the starters give
251
+ it: the region keeps the zero basis, so the slack splits evenly and the
252
+ widgets hang below the composer. Its content is its floor (a flex item's
253
+ automatic minimum), so widgets taller than half the slack hold their
254
+ height and the composer rides up only by what they overflow, never
255
+ squeezing them. A scroll layout is the other answer, for widgets that
256
+ run below the fold. */
249
257
  .ds-chat-widget__bottom--widgets {
250
- flex-basis: auto;
251
258
  flex-shrink: 0;
252
259
  }
253
260
 
@@ -998,16 +1005,18 @@ html[data-chat-resizing] .ds-chat-launcher__panel {
998
1005
  /* The inset surface (ChatLauncher's surface="inset"). Docked and as an
999
1006
  overlay, the panel is held off the edges by the shell's gap rather than
1000
1007
  the chat's own, so it lines up with AppLayout's inset content surface.
1001
- Docked, it is also flat: a plane on the app surface colour with no
1002
- shadow, border or blur. The overlay keeps its shadow over the page. */
1008
+ Docked, it is that surface's twin: solid on the app surface colour with
1009
+ the inset shell's raised edge (the hairline and the floating shadow,
1010
+ src/behaviors/shell.css) and no blur. The overlay keeps its shadow over
1011
+ the page. */
1003
1012
  .ds-chat-launcher__panel--inset {
1004
1013
  --ds-chat-inset: var(--ds-shell-inset, 10px); /* AppSidebar.css declares the gap; the fallback mirrors it */
1005
1014
  }
1006
1015
 
1007
1016
  .ds-chat-launcher__panel--flat {
1008
1017
  background: var(--color-bg-app-surface);
1009
- border-color: transparent;
1010
- box-shadow: none;
1018
+ border-color: var(--color-bg-container-border);
1019
+ box-shadow: var(--shadow-floating);
1011
1020
  backdrop-filter: none;
1012
1021
  }
1013
1022
 
@@ -1260,3 +1269,246 @@ html[data-chat-resizing] .ds-chat-launcher__panel--floating .ds-chat-header {
1260
1269
  .ds-chat-widget__sent-context .ds-document-chip {
1261
1270
  max-width: 100%;
1262
1271
  }
1272
+
1273
+
1274
+ /* ============================================
1275
+ THE TRAILING SEATS AS DRAWERS
1276
+ Both trailing panels (the agent pane and the artifact panel) open and
1277
+ close as a drawer: the card is solid from the first frame to the last,
1278
+ anchored to the seat's trailing edge so it slides in and out whole at
1279
+ the width it will rest at, and the seat hides only once it has shut.
1280
+ Placed last, so these timings win over the seats' own rules above.
1281
+ ============================================ */
1282
+
1283
+ .ds-chat-widget__aside-rail,
1284
+ .ds-chat-widget__artifact-rail {
1285
+ justify-content: flex-end;
1286
+ transition:
1287
+ width var(--motion-duration-slow) var(--motion-ease-emphasized),
1288
+ flex-grow var(--motion-duration-slow) var(--motion-ease-emphasized),
1289
+ flex-basis var(--motion-duration-slow) var(--motion-ease-emphasized),
1290
+ margin var(--motion-duration-slow) var(--motion-ease-emphasized),
1291
+ /* ds-allow(motion): an instant flip held to the glide's end, the visibility idiom applied to opacity */
1292
+ opacity 0s linear var(--motion-duration-slow),
1293
+ visibility 0s linear var(--motion-duration-slow);
1294
+ }
1295
+
1296
+ .ds-chat-widget__aside-rail--open,
1297
+ .ds-chat-widget__artifact-rail--open {
1298
+ transition:
1299
+ width var(--motion-duration-slow) var(--motion-ease-emphasized),
1300
+ flex-grow var(--motion-duration-slow) var(--motion-ease-emphasized),
1301
+ flex-basis var(--motion-duration-slow) var(--motion-ease-emphasized),
1302
+ margin var(--motion-duration-slow) var(--motion-ease-emphasized),
1303
+ /* ds-allow(motion): an instant flip as the seat opens, the visibility idiom applied to opacity */
1304
+ opacity 0s linear 0s,
1305
+ visibility 0s linear 0s;
1306
+ }
1307
+
1308
+ /* A swap (one panel taking the seat as the other gives it up): the card
1309
+ leaving fades out at once as it shrinks, so the swap reads as the new
1310
+ card arriving rather than two cards side by side. A plain close, with
1311
+ nothing arriving, keeps the card solid until the seat has shut. */
1312
+ .ds-chat-widget__rails:has(.ds-chat-widget__artifact-rail--open) > .ds-chat-widget__aside-rail:not(.ds-chat-widget__aside-rail--open),
1313
+ .ds-chat-widget__rails:has(.ds-chat-widget__aside-rail--open) > .ds-chat-widget__artifact-rail:not(.ds-chat-widget__artifact-rail--open) {
1314
+ transition:
1315
+ width var(--motion-duration-slow) var(--motion-ease-emphasized),
1316
+ flex-grow var(--motion-duration-slow) var(--motion-ease-emphasized),
1317
+ flex-basis var(--motion-duration-slow) var(--motion-ease-emphasized),
1318
+ margin var(--motion-duration-slow) var(--motion-ease-emphasized),
1319
+ opacity var(--motion-duration-fast) var(--motion-ease-standard),
1320
+ visibility 0s linear var(--motion-duration-slow);
1321
+ }
1322
+
1323
+ /* The cards hold their resting width and never shrink with the seat: the
1324
+ agent pane the width the widget measured for it, the artifact its
1325
+ resting width or the grip's, either held to the room the row has. */
1326
+ .ds-chat-widget__aside-rail-inner {
1327
+ flex-shrink: 0;
1328
+ min-width: var(--ds-chat-aside-width, max-content);
1329
+ }
1330
+
1331
+ .ds-chat-widget__artifact-rail-inner {
1332
+ flex-shrink: 0;
1333
+ min-width: min(
1334
+ var(--ds-chat-artifact-width, var(--ds-chat-artifact-rest-width)),
1335
+ var(--ds-chat-artifact-room, var(--ds-chat-artifact-rest-width))
1336
+ );
1337
+ }
1338
+
1339
+ /* Before the grip sizes it, the artifact seat opens to its resting width
1340
+ (held to the room), so the open is the same glide every time; the
1341
+ grip's width takes over once the reader drags it, and the expanded
1342
+ state still takes the whole row. */
1343
+ .ds-chat-widget__rails:not([data-artifact-sized], [data-artifact-expanded]) > .ds-chat-widget__artifact-rail--open {
1344
+ flex: 0 1 min(var(--ds-chat-artifact-rest-width), var(--ds-chat-artifact-room, var(--ds-chat-artifact-rest-width)));
1345
+ }
1346
+
1347
+ /* ============================================
1348
+ SHELL MODES (the layout prop)
1349
+ A host where the chat is the page seats it in one of the three app
1350
+ shell modes, from the shell recipe (src/behaviors/shell.css): the
1351
+ widget's outermost element carries data-ds-shell, and these rules read
1352
+ its properties. Below the mobile breakpoint every mode gives way to the
1353
+ plain full-screen chat.
1354
+ ============================================ */
1355
+
1356
+ .ds-chat-widget__rails[data-ds-shell],
1357
+ .ds-chat-widget[data-ds-shell] {
1358
+ /* The seats' inset either side, which the room measurement subtracts. */
1359
+ --ds-chat-artifact-inset: var(--padding-500);
1360
+ background-color: var(--ds-shell-plane);
1361
+ }
1362
+
1363
+ /* The conversation and the room around the trailing panels are the
1364
+ content, on the shell's surface; the history rail takes the plane. */
1365
+ .ds-chat-widget__rails[data-ds-shell] > .ds-chat-widget,
1366
+ .ds-chat-widget[data-ds-shell] {
1367
+ background-color: var(--ds-shell-surface);
1368
+ }
1369
+
1370
+ .ds-chat-widget__rails[data-ds-shell='flush'] {
1371
+ background-color: var(--ds-shell-surface);
1372
+ }
1373
+
1374
+ .ds-chat-widget__rails[data-ds-shell] > .ds-chat-widget__threads-rail {
1375
+ background-color: var(--ds-shell-rail-bg);
1376
+ border-inline-end-color: var(--ds-shell-rail-divider);
1377
+ }
1378
+
1379
+ /* Floating: the history rail lifts off the plane as a glass card, the
1380
+ floating rail's; the trailing panels wear the same raised edge. */
1381
+ .ds-chat-widget__rails[data-ds-shell='floating'] > .ds-chat-widget__threads-rail {
1382
+ margin: var(--ds-shell-float-gap);
1383
+ margin-inline-end: 0;
1384
+ overflow: hidden;
1385
+ background-color: var(--ds-shell-glass);
1386
+ border: var(--border-025) solid var(--ds-shell-edge-border);
1387
+ border-radius: var(--ds-shell-radius);
1388
+ box-shadow: var(--ds-shell-edge-shadow);
1389
+ backdrop-filter: var(--ds-shell-glass-blur);
1390
+ }
1391
+
1392
+ /* Raised trailing panels (floating and inset): the card keeps its
1393
+ hairline and the seat wears the shadow. The seat clips for the glide,
1394
+ which would cut a shadow the card drew; a box never clips its own. */
1395
+ .ds-chat-widget__rails:is([data-ds-shell='floating'], [data-ds-shell='inset']) > .ds-chat-widget__aside-rail,
1396
+ .ds-chat-widget__rails:is([data-ds-shell='floating'], [data-ds-shell='inset']) > .ds-chat-widget__artifact-rail {
1397
+ border-radius: var(--ds-shell-radius);
1398
+ box-shadow: var(--ds-shell-edge-shadow);
1399
+ }
1400
+
1401
+ /* Inset: the history rail runs flush on the plane, and the conversation
1402
+ and each trailing panel are raised surfaces held off the edges by the
1403
+ inset gap. */
1404
+ .ds-chat-widget__rails[data-ds-shell='inset'] {
1405
+ --ds-chat-artifact-inset: var(--ds-shell-gap);
1406
+ }
1407
+
1408
+ .ds-chat-widget__rails[data-ds-shell='inset'] > .ds-chat-widget__threads-rail {
1409
+ border-inline-end-color: transparent;
1410
+ }
1411
+
1412
+ .ds-chat-widget__rails[data-ds-shell='inset'] > .ds-chat-widget {
1413
+ /* The widget's own height is 100%, which the gap would push past the
1414
+ floor; stretched, the margins come out of the row instead. */
1415
+ height: auto;
1416
+ align-self: stretch;
1417
+ margin-block: var(--ds-shell-gap);
1418
+ margin-inline-end: var(--ds-shell-gap);
1419
+ border: var(--border-025) solid var(--ds-shell-surface-border);
1420
+ border-radius: var(--ds-shell-surface-radius);
1421
+ box-shadow: var(--ds-shell-surface-shadow);
1422
+ overflow: hidden;
1423
+ }
1424
+
1425
+ /* The seats hold the gap above and below in both states, so the glide is
1426
+ the width alone. */
1427
+ .ds-chat-widget__rails[data-ds-shell='inset'] > .ds-chat-widget__aside-rail,
1428
+ .ds-chat-widget__rails[data-ds-shell='inset'] > .ds-chat-widget__artifact-rail {
1429
+ margin-block: var(--ds-shell-gap);
1430
+ }
1431
+
1432
+ .ds-chat-widget__rails[data-ds-shell='inset'] > .ds-chat-widget__aside-rail--open,
1433
+ .ds-chat-widget__rails[data-ds-shell='inset'] > .ds-chat-widget__artifact-rail--open {
1434
+ margin-inline-end: var(--ds-shell-gap);
1435
+ }
1436
+
1437
+ .ds-chat-widget__rails[data-ds-shell='inset'] .ds-chat-widget__aside-rail-inner,
1438
+ .ds-chat-widget__rails[data-ds-shell='inset'] .ds-chat-widget__artifact-rail-inner {
1439
+ background-color: var(--ds-shell-surface);
1440
+ }
1441
+
1442
+ /* Inset raises the trailing panel to the frame's top, so the widget's
1443
+ floating header controls sit in the panel's own top row: centred
1444
+ between the card's top edge and the artifact header's divider (the gap,
1445
+ the card's hairline, ArtifactPanel's --padding-300 header padding), and
1446
+ as far in from the end edge. */
1447
+ .ds-chat-widget__rails[data-ds-shell='inset'] > .ds-chat-widget__rail-actions {
1448
+ top: calc(var(--ds-shell-gap) + var(--border-025) + var(--padding-300));
1449
+ inset-inline-end: calc(var(--ds-shell-gap) + var(--border-025) + var(--padding-300));
1450
+ }
1451
+
1452
+ /* The agent pane has no header row, so its card keeps an empty top row of
1453
+ the artifact header's height for the controls, and drops its own close:
1454
+ the header's agent toggle, now in that row, does the same. */
1455
+ .ds-chat-widget__rails[data-ds-shell='inset'] .ds-chat-widget__aside-rail-inner {
1456
+ padding-top: calc(var(--padding-300) * 2 + var(--control-height-default));
1457
+ }
1458
+
1459
+ .ds-chat-widget__rails[data-ds-shell='inset'] .ds-chat-widget__aside-rail-inner .ds-agent-rail__collapse--close {
1460
+ display: none;
1461
+ }
1462
+
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. */
1467
+ .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));
1469
+ }
1470
+
1471
+ .ds-chat-widget__rails[data-ds-shell='inset'] .ds-chat-widget__artifact-rail-inner .ds-artifact-panel__controls > :last-child {
1472
+ display: none;
1473
+ }
1474
+
1475
+ @media (max-width: 768px) {
1476
+ .ds-chat-widget__rails[data-ds-shell] > .ds-chat-widget__threads-rail,
1477
+ .ds-chat-widget__rails[data-ds-shell] > .ds-chat-widget {
1478
+ margin: 0;
1479
+ border-radius: 0;
1480
+ box-shadow: none;
1481
+ }
1482
+
1483
+ .ds-chat-widget__rails[data-ds-shell] > .ds-chat-widget {
1484
+ border: none;
1485
+ }
1486
+ }
1487
+
1488
+ /* The welcome page's bottom fade in a shell mode. Outside one, the
1489
+ scrolling root is a mask over content alone; as a page, the root is the
1490
+ conversation's surface (its fill, hairline and shadow), which a mask
1491
+ would fade at the floor along with the content, showing the plane
1492
+ through. So the mask gives way to a strip held to the floor of the
1493
+ scroller, the surface's own colour rising out of clear: the content
1494
+ still dissolves as it scrolls out, and the surface stays whole. Under
1495
+ the blur backdrop the conversation has no fill or edge, so the mask
1496
+ stays. */
1497
+ .ds-chat-widget__rails[data-ds-shell]:not([data-ds-shell-backdrop='blur']) > .ds-chat-widget[data-widgets='scroll'],
1498
+ .ds-chat-widget[data-ds-shell]:not([data-ds-shell-backdrop='blur'])[data-widgets='scroll'] {
1499
+ -webkit-mask-image: none;
1500
+ mask-image: none;
1501
+ }
1502
+
1503
+ .ds-chat-widget__rails[data-ds-shell]:not([data-ds-shell-backdrop='blur']) > .ds-chat-widget[data-widgets='scroll']::after,
1504
+ .ds-chat-widget[data-ds-shell]:not([data-ds-shell-backdrop='blur'])[data-widgets='scroll']::after {
1505
+ content: '';
1506
+ position: sticky;
1507
+ bottom: 0;
1508
+ flex: none;
1509
+ display: block;
1510
+ height: var(--gap-1000);
1511
+ margin-top: calc(-1 * var(--gap-1000));
1512
+ pointer-events: none;
1513
+ background: linear-gradient(to bottom, transparent, var(--ds-shell-surface));
1514
+ }
@@ -46,6 +46,10 @@ export interface ChatAgentOptions {
46
46
  /** Open the pane at mount, where the panel is wide enough to seat it inline. Off by default: the header button opens it. */
47
47
  defaultOpen?: boolean;
48
48
  }
49
+ /** The three app shell modes a chat can be seated as a page in, AppLayout's and AppSidebar's (`AppSidebarLayout`), named here so the chat draws on the shell recipe without composing the sidebar. */
50
+ export type ChatLayout = 'flush' | 'floating' | 'inset';
51
+ /** What a chat seated as a page lies on in the flush layout: the solid shell colour, or the glass and a strong blur over what lies behind. */
52
+ export type ChatBackdrop = 'solid' | 'blur';
49
53
  /** Props owned by ChatWidget itself. */
50
54
  export interface ChatWidgetProps {
51
55
  /** Show the expand toggle. A host whose stage is always a takeover hides it. */
@@ -58,6 +62,32 @@ export interface ChatWidgetProps {
58
62
  placementEnabled?: boolean;
59
63
  /** Narrow insets for phone-width hosts. */
60
64
  compact?: boolean;
65
+ /**
66
+ * Seat the widget as a page in one of the three app shell modes, the ones
67
+ * AppLayout draws, for a host where the chat is the page (a chat home)
68
+ * rather than a panel over one. `flush` runs the history rail on the
69
+ * shell colour behind a hairline with the conversation crisp beside it;
70
+ * `floating` lifts the rail into a glass card off the edges; `inset` runs
71
+ * the rail flush on the shell colour and seats the conversation and each
72
+ * trailing panel in raised surfaces. Left out, the widget draws no shell
73
+ * of its own and takes its host's ground, as a docked or floating panel
74
+ * does. A widget narrower than the inline rail's 720px threshold has no
75
+ * room for a raised mode, so floating and inset lay out flush on the
76
+ * solid backdrop there, and below the mobile breakpoint every mode gives
77
+ * way to the plain full-screen chat.
78
+ */
79
+ layout?: ChatLayout;
80
+ /**
81
+ * What the flush layout lies on, a chat's own lever: blur says the chat
82
+ * rests above something, solid that it is the floor of its own page.
83
+ * `blur` (the default, the site chat's takeover look) lays the glass and a
84
+ * strong blur over whatever is behind the widget, the history rail and the
85
+ * conversation clear on it; `solid` sets the rail on the shell colour
86
+ * beside a crisp conversation. App layouts and templates are always the
87
+ * floor, so they have no backdrop. Ignored without `layout`, and by the
88
+ * other modes.
89
+ */
90
+ backdrop?: ChatBackdrop;
61
91
  /** The host is a phone viewport, where the soft keyboard will claim the
62
92
  lower half of the screen the moment the composer is focused. The
63
93
  welcome screen stacks instead of centring the composer: greeting in
@@ -156,14 +186,15 @@ export interface ChatWidgetProps {
156
186
  /** The artifact panel's empty-state description. Defaults to "What the chat makes for you, like a dashboard or a page, opens in this panel." */
157
187
  artifactEmptyDescription?: string;
158
188
  /** A widget slot on the welcome screen, under the composer and its
159
- starters. It takes any content and keeps its natural height, so the
160
- composer rides up by half of it instead of holding dead centre: the
161
- empty chat reads as a home page rather than a blank prompt. It leaves
189
+ starters. It takes any content and keeps its natural height, laid out
190
+ by `widgetsLayout`, so the empty chat reads as a home page rather than
191
+ a blank prompt. It leaves
162
192
  with the first message, like the rest of the welcome dressing. */
163
193
  widgets?: ReactNode;
164
194
  /** How the widget slot takes its room. `fit` keeps the welcome screen to
165
- one viewport: the widgets hold their height and the composer rides up
166
- to make room. `scroll` turns the welcome screen into a page: the
195
+ one viewport: the composer holds dead centre as it does over the
196
+ starters, the widgets hanging below it, and rides up only when they
197
+ need more than half the room. `scroll` turns the welcome screen into a page: the
167
198
  greeting and composer take the opening of the viewport, the widgets
168
199
  run on below the fold, and the whole welcome scrolls as one. */
169
200
  widgetsLayout?: 'fit' | 'scroll';
@@ -251,4 +282,4 @@ export interface ChatWidgetProps {
251
282
  * a stage card, a whole page). It reads all of its state from ChatProvider,
252
283
  * so the conversation is the same object wherever it shows.
253
284
  */
254
- export declare function ChatWidget({ fullscreenEnabled, closeEnabled, placementEnabled, compact, phone, title, flow, placeholder, questionsPlaceholder, showStarters, logo, tagline, starters: startersInput, startersKey, startersPending, composerActions, models, defaultModel, lockedModelDescription, fileAttachments, maxAttachments, maxAttachmentBytes, mentions, threads, threadsProps, tabs, aside, agent, artifacts, context: contextProp, contextClearLabel, contextLabel, contextNote, contextPlacement, attachHint: attachHintText, greetings, placementLabels, agentStatus, artifactPanelTitle, artifactEmptyTitle, artifactEmptyDescription, widgets, widgetsLayout, widgetsWidth, disclaimer, startersLabel, newChatLabel, showAgentLabel, hideAgentLabel, closeAgentLabel, showArtifactLabel, hideArtifactLabel, closeArtifactLabel, placementLabel, enterFullscreenLabel, exitFullscreenLabel, closeLabel, openThreadsLabel, closeThreadsLabel, modelPickerLabel, sendLabel, copyResponseLabel, copiedResponseLabel, copiedAnnouncementLabel, goodResponseLabel, badResponseLabel, followupsLabel, pastedTextLabel, reasoningLabel, tabsProps, composerLabels, attachmentDropZoneLabels, attachmentGroupLabels, chatThreadLabels, modelPickerLabels, artifactPanelLabels, agentRailLabels, questionCardLabels, questionSummaryLabels, codeBlockLabels, promptSuggestionsLabels, }: ChatWidgetProps): import("react").JSX.Element;
285
+ export declare function ChatWidget({ fullscreenEnabled, layout, backdrop, closeEnabled, placementEnabled, compact, phone, title, flow, placeholder, questionsPlaceholder, showStarters, logo, tagline, starters: startersInput, startersKey, startersPending, composerActions, models, defaultModel, lockedModelDescription, fileAttachments, maxAttachments, maxAttachmentBytes, mentions, threads, threadsProps, tabs, aside, agent, artifacts, context: contextProp, contextClearLabel, contextLabel, contextNote, contextPlacement, attachHint: attachHintText, greetings, placementLabels, agentStatus, artifactPanelTitle, artifactEmptyTitle, artifactEmptyDescription, widgets, widgetsLayout, widgetsWidth, disclaimer, startersLabel, newChatLabel, showAgentLabel, hideAgentLabel, closeAgentLabel, showArtifactLabel, hideArtifactLabel, closeArtifactLabel, placementLabel, enterFullscreenLabel, exitFullscreenLabel, closeLabel, openThreadsLabel, closeThreadsLabel, modelPickerLabel, sendLabel, copyResponseLabel, copiedResponseLabel, copiedAnnouncementLabel, goodResponseLabel, badResponseLabel, followupsLabel, pastedTextLabel, reasoningLabel, tabsProps, composerLabels, attachmentDropZoneLabels, attachmentGroupLabels, chatThreadLabels, modelPickerLabels, artifactPanelLabels, agentRailLabels, questionCardLabels, questionSummaryLabels, codeBlockLabels, promptSuggestionsLabels, }: ChatWidgetProps): import("react").JSX.Element;
@@ -26,13 +26,14 @@ import { ChatThreads } from "./ChatThreads.js";
26
26
  import { useChatWidget, ArtifactSeatContext } from "./context.js";
27
27
  import { DEFAULT_GREETING_COPY, subscribeClock, greetingFor, serverGreeting } from "./greeting.js";
28
28
  import { CHAT_PLACEMENTS, chatPlacement } from "./placement.js";
29
- import { ASIDE_WITH_THREADS_MIN_WIDTH, ARTIFACT_MIN_COLUMN_WIDTH, THREADS_RAIL_MIN_WIDTH, ASIDE_RAIL_MIN_WIDTH } from "./queries.js";
29
+ import { ASIDE_WITH_THREADS_MIN_WIDTH, THREADS_RAIL_MIN_WIDTH, ARTIFACT_MIN_COLUMN_WIDTH, ASIDE_RAIL_MIN_WIDTH } from "./queries.js";
30
30
  import { fitsChip } from "./suggestions.js";
31
31
  import { TurnCard } from "./TurnContent.js";
32
32
  import { isBlockingQuestion } from "./questions.js";
33
33
  import { ReplyBody } from "./TurnQuestion.js";
34
34
  import { ResponseActionsLabelsContext } from "./ResponseActions.js";
35
35
  import { FollowupSuggestionsLabelContext } from "./FollowupSuggestions.js";
36
+ import "../behaviors/shell.css";
36
37
  import "./ChatWidget.css";
37
38
  import "../behaviors/direction.css";
38
39
  import { inlineSign } from "../behaviors/direction.js";
@@ -45,6 +46,8 @@ const defaultContextNote = (title) => `Looking at “${title}”`;
45
46
  const withAgentMark = (profile, title) => profile.avatar || profile.avatarSrc ? profile : { ...profile, avatar: /* @__PURE__ */ jsx(PixelAvatar, { name: title, size: "lg", label: title }) };
46
47
  function ChatWidget({
47
48
  fullscreenEnabled = true,
49
+ layout,
50
+ backdrop = "blur",
48
51
  closeEnabled = true,
49
52
  placementEnabled = false,
50
53
  compact = false,
@@ -300,6 +303,17 @@ function ChatWidget({
300
303
  return () => observer.disconnect();
301
304
  }, [hasRails, closeArtifact]);
302
305
  const closeThreads = () => setThreadsOpen(false);
306
+ const [shellNarrow, setShellNarrow] = useState(false);
307
+ useEffect(() => {
308
+ if (!layout || layout === "flush") return;
309
+ const host = railsHostRef.current ?? composerRef.current?.closest(".ds-chat-widget");
310
+ if (!host) return;
311
+ const measure = () => setShellNarrow(host.clientWidth < THREADS_RAIL_MIN_WIDTH);
312
+ measure();
313
+ const observer = new ResizeObserver(measure);
314
+ observer.observe(host);
315
+ return () => observer.disconnect();
316
+ }, [layout, hasRails]);
303
317
  const artifactId = useId();
304
318
  const artifactShown = artifacts && (artifact !== null || artifactEmptyOpen);
305
319
  const [heldArtifact, setHeldArtifact] = useState(artifact);
@@ -371,6 +385,23 @@ function ChatWidget({
371
385
  }, [artifacts, turns, openArtifact]);
372
386
  const trailingUp = artifactInline || Boolean(renderAside) && asideOpen && asideWide;
373
387
  const threadsInline = threadsWide && !(trailingUp && (!asideRoomy || artifactExpanded));
388
+ useEffect(() => {
389
+ if (!artifacts) return;
390
+ const host = railsHostRef.current;
391
+ if (!host) return;
392
+ const measure = () => {
393
+ const threadsRail2 = host.querySelector(":scope > .ds-chat-widget__threads-rail");
394
+ const inset = parseFloat(getComputedStyle(host).getPropertyValue("--ds-chat-artifact-inset")) || 0;
395
+ const room = host.clientWidth - (threadsRail2?.offsetWidth ?? 0) - ARTIFACT_MIN_COLUMN_WIDTH - inset * 2;
396
+ host.style.setProperty("--ds-chat-artifact-room", `${Math.max(0, Math.round(room))}px`);
397
+ };
398
+ measure();
399
+ const observer = new ResizeObserver(measure);
400
+ observer.observe(host);
401
+ const threadsRail = host.querySelector(":scope > .ds-chat-widget__threads-rail");
402
+ if (threadsRail) observer.observe(threadsRail);
403
+ return () => observer.disconnect();
404
+ }, [artifacts, threadsInline]);
374
405
  const asideRailRef = useRef(null);
375
406
  const asideMounted = Boolean(renderAside) && asideWide;
376
407
  useEffect(() => {
@@ -524,10 +555,14 @@ function ChatWidget({
524
555
  rootSettleTimer.current = window.setTimeout(() => setRootScrolling(false), MOTION_SCROLL_SETTLE_MS);
525
556
  };
526
557
  useEffect(() => () => window.clearTimeout(rootSettleTimer.current), []);
558
+ const shellMode = layout && layout !== "flush" && shellNarrow ? "flush" : layout;
559
+ const shellBackdrop = shellMode === layout ? backdrop : "solid";
560
+ const shellAttrs = shellMode ? { "data-ds-shell": shellMode, "data-ds-shell-backdrop": shellMode === "flush" ? shellBackdrop : void 0 } : {};
527
561
  const chatColumn = /* @__PURE__ */ jsxs(
528
562
  ChatRoot,
529
563
  {
530
564
  ...dropProps,
565
+ ...hasRails ? {} : shellAttrs,
531
566
  className: `ds-chat-widget ${renderThreads ? "ds-chat-widget--with-threads" : ""}`,
532
567
  "data-compact": compact || void 0,
533
568
  "data-phone": phone || void 0,
@@ -696,6 +731,7 @@ function ChatWidget({
696
731
  {
697
732
  ref: railsHostRef,
698
733
  className: "ds-chat-widget__rails",
734
+ ...shellAttrs,
699
735
  "data-artifact-expanded": artifactExpanded || void 0,
700
736
  "data-artifact-sized": artifactWidth !== null || artifactResizing || void 0,
701
737
  "data-artifact-resizing": artifactResizing || void 0,
package/chat/index.d.ts CHANGED
@@ -14,7 +14,7 @@
14
14
  * documentation, and validate-chat-widget.mjs holds the two together).
15
15
  */
16
16
  export { ChatProvider, type ChatProviderProps } from './ChatProvider';
17
- export { ChatWidget, type ChatWidgetProps, type ChatAgentOptions, type ChatContext, type RailSlot } from './ChatWidget';
17
+ export { ChatWidget, type ChatWidgetProps, type ChatAgentOptions, type ChatBackdrop, type ChatContext, type ChatLayout, type RailSlot } from './ChatWidget';
18
18
  export { useSelectionFocus, useHeldHighlight, readSelection, describeSelection, CHAT_SOURCE_ATTRIBUTE, HELD_HIGHLIGHT_NAME, type SelectedText, type DescribeSelectionOptions } from './selection';
19
19
  export { sanitiseSelection, selectionLines, DEFAULT_SELECTION_LIMITS, type ChatSelection, type SelectionKind, type SelectionLimits, type SelectionLinesOptions } from './selectionContext';
20
20
  export { useGeneratedStarters, type GeneratedStarters, type GeneratedStartersOptions } from './generatedStarters';
@@ -6,7 +6,7 @@ declare const _default: {
6
6
  "slug": "ai-chat",
7
7
  "label": "AI chat",
8
8
  "category": "ai",
9
- "description": "The whole AI chat: the panel, the streaming replies, the history, the cards and questions a reply can carry and the server handlers, set up with props.",
9
+ "description": "The whole AI chat: the panel, or the page itself in an app shell mode, the streaming replies, the history, the cards and questions a reply can carry and the server handlers, set up with props.",
10
10
  "command": "init chat",
11
11
  "subpaths": {
12
12
  "./chat": "The widget, the provider, the launcher and the engine under them, with the hooks that let it follow the reader and write starters for what they picked.",
@@ -1,5 +1,5 @@
1
1
  const $comment = "The widget registry: the fourth kind of thing the package ships, between the components and the templates. One member by design. `parts` names the library components the widget composes (held to src/components/registry.json by scripts/validate-chat-widget.mjs), `subpaths` the package exports it occupies (held to scripts/package-manifest.mjs), `category` the component category whose section and sidebar group its page joins (held to src/components/registry.json), `peers` the optional peer dependencies each subpath needs (held to package.json). The widget's page under /components, the /docs/chat page, the chat corpus and the MCP tools read this file; never type its facts elsewhere.";
2
- const widgets = [{ "name": "ChatWidget", "slug": "ai-chat", "label": "AI chat", "category": "ai", "description": "The whole AI chat: the panel, the streaming replies, the history, the cards and questions a reply can carry and the server handlers, set up with props.", "command": "init chat", "subpaths": { "./chat": "The widget, the provider, the launcher and the engine under them, with the hooks that let it follow the reader and write starters for what they picked.", "./chat/server": "The streaming chat handler, with an opt-in tool for asking the visitor questions, its follow-ups, starters and feedback siblings, and the checks for what a reader highlighted, for any web-standard route.", "./chat/actions": "The action definitions a page and its route share, their dry run and the mark that says a change was confirmed on its card, with no dependencies.", "./chat/upstash": "Rate limits, a daily budget and the exchange log over Upstash Redis, as the handlers' guardrails.", "./chat/demo": "A scripted conversation with rich cards and fixtures, for a preview that needs no key.", "./chat/chat.css": "The widget's stylesheet." }, "peers": { "./chat": ["react-markdown", "remark-gfm"], "./chat/server": ["@anthropic-ai/sdk"], "./chat/upstash": ["@upstash/ratelimit", "@upstash/redis"], "./chat/demo": ["recharts"] }, "parts": ["AgentRail", "AgentStatus", "AiButton", "ArtifactCard", "ArtifactPanel", "AttachmentDropZone", "AttachmentGroup", "ChatHeader", "ChatMessage", "ChatThread", "CircularButton", "CodeBlock", "Composer", "DocumentChip", "DropdownMenu", "EmptyState", "Mention", "ModelPicker", "PixelAvatar", "PromptSuggestions", "Prose", "QuestionCard", "Reasoning", "ThreadPanel", "ThreadTabs"], "documented": ["ChatWidget", "ChatProvider", "ChatLauncher", "ChatThreads", "ChatTabs", "ChatAgentPane", "ChatArtifactPane", "ChatArtifactCard"] }];
2
+ const widgets = [{ "name": "ChatWidget", "slug": "ai-chat", "label": "AI chat", "category": "ai", "description": "The whole AI chat: the panel, or the page itself in an app shell mode, the streaming replies, the history, the cards and questions a reply can carry and the server handlers, set up with props.", "command": "init chat", "subpaths": { "./chat": "The widget, the provider, the launcher and the engine under them, with the hooks that let it follow the reader and write starters for what they picked.", "./chat/server": "The streaming chat handler, with an opt-in tool for asking the visitor questions, its follow-ups, starters and feedback siblings, and the checks for what a reader highlighted, for any web-standard route.", "./chat/actions": "The action definitions a page and its route share, their dry run and the mark that says a change was confirmed on its card, with no dependencies.", "./chat/upstash": "Rate limits, a daily budget and the exchange log over Upstash Redis, as the handlers' guardrails.", "./chat/demo": "A scripted conversation with rich cards and fixtures, for a preview that needs no key.", "./chat/chat.css": "The widget's stylesheet." }, "peers": { "./chat": ["react-markdown", "remark-gfm"], "./chat/server": ["@anthropic-ai/sdk"], "./chat/upstash": ["@upstash/ratelimit", "@upstash/redis"], "./chat/demo": ["recharts"] }, "parts": ["AgentRail", "AgentStatus", "AiButton", "ArtifactCard", "ArtifactPanel", "AttachmentDropZone", "AttachmentGroup", "ChatHeader", "ChatMessage", "ChatThread", "CircularButton", "CodeBlock", "Composer", "DocumentChip", "DropdownMenu", "EmptyState", "Mention", "ModelPicker", "PixelAvatar", "PromptSuggestions", "Prose", "QuestionCard", "Reasoning", "ThreadPanel", "ThreadTabs"], "documented": ["ChatWidget", "ChatProvider", "ChatLauncher", "ChatThreads", "ChatTabs", "ChatAgentPane", "ChatArtifactPane", "ChatArtifactCard"] }];
3
3
  const registry = {
4
4
  $comment,
5
5
  widgets
@@ -6,7 +6,9 @@
6
6
  .ds-app-layout {
7
7
  display: flex;
8
8
  min-height: 100vh;
9
- background-color: var(--color-bg-page-primary);
9
+ /* The shell recipe's plane (src/behaviors/shell.css), set per layout by
10
+ the data-ds-shell marker on this root. */
11
+ background-color: var(--ds-shell-plane);
10
12
  }
11
13
 
12
14
  /* ============================================
@@ -27,6 +29,12 @@
27
29
  --ds-app-layout-rail: 280px;
28
30
  }
29
31
 
32
+ /* Flush: the content column is the crisp surface, running from the rail's
33
+ divider to the far edge. */
34
+ .ds-app-layout:not(.ds-app-layout--floating, .ds-app-layout--inset) .ds-app-layout__main {
35
+ background-color: var(--ds-shell-surface);
36
+ }
37
+
30
38
  /* Panel mode's collapsed rail is the wider, labelled one. */
31
39
  .ds-app-layout:not(.ds-app-layout--expanded):has(.ds-app-sidebar--panel-mode) {
32
40
  --ds-app-layout-rail: 80px;
@@ -71,7 +79,6 @@
71
79
  .ds-app-layout--inset {
72
80
  height: 100dvh;
73
81
  min-height: 0;
74
- background-color: var(--color-bg-app-shell);
75
82
  }
76
83
 
77
84
  .ds-app-layout--inset .ds-app-layout__main {
@@ -85,8 +92,12 @@
85
92
  min-width: 0;
86
93
  display: flex;
87
94
  overflow: hidden;
88
- background-color: var(--color-bg-app-surface);
89
- border-radius: var(--radius-600);
95
+ /* The raised surface: the floating rail's edge turned around, from the
96
+ shell recipe. */
97
+ background-color: var(--ds-shell-surface);
98
+ border: var(--border-025) solid var(--ds-shell-surface-border);
99
+ border-radius: var(--ds-shell-surface-radius);
100
+ box-shadow: var(--ds-shell-surface-shadow);
90
101
  }
91
102
 
92
103
  .ds-app-layout__scroller {
@@ -140,7 +151,9 @@
140
151
 
141
152
  .ds-app-layout__surface {
142
153
  overflow: visible;
154
+ border: none;
143
155
  border-radius: 0;
156
+ box-shadow: none;
144
157
  }
145
158
 
146
159
  .ds-app-layout__scroller {
@@ -24,11 +24,14 @@ type AppLayoutOwnProps = {
24
24
  /** Page content — centred in the main area */
25
25
  children: React.ReactNode;
26
26
  /**
27
- * How the rail and the content meet the page. `flush` (the default) runs
28
- * the rail edge to edge with the content centred beside it. `floating`
29
- * floats the rail as a glass card, the content still centred. `inset` runs
30
- * the rail flush on the app shell colour and sets the content full width
31
- * in a surface inset from the other edges, which scrolls inside itself.
27
+ * How the rail and the content meet the page, one of the three app shell
28
+ * modes. `flush` (the default) runs the rail edge to edge on the shell
29
+ * colour behind a hairline, the content centred beside it on the crisp
30
+ * app surface, nothing raised. `floating` floats the rail as a glass card,
31
+ * the content still centred. `inset` runs the rail flush on the shell
32
+ * colour and sets the content full width in a raised surface (hairline
33
+ * and floating shadow) inset from the other edges, which scrolls inside
34
+ * itself.
32
35
  */
33
36
  layout?: AppSidebarLayout;
34
37
  /**
@@ -3,6 +3,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
3
3
  import React, { useState, useCallback, useRef, useEffect } from "react";
4
4
  import { AppSidebar } from "../AppSidebar/AppSidebar.js";
5
5
  import { MOTION_SCROLL_SETTLE_MS } from "../../tokens/motion.js";
6
+ import "../../behaviors/shell.css";
6
7
  import "./AppLayout.css";
7
8
  const AppLayout = React.forwardRef(
8
9
  ({
@@ -50,6 +51,7 @@ const AppLayout = React.forwardRef(
50
51
  ref,
51
52
  className: classes,
52
53
  ...theme === "dark" ? { "data-theme": "dark" } : {},
54
+ "data-ds-shell": layout,
53
55
  children: [
54
56
  /* @__PURE__ */ jsx(
55
57
  AppSidebar,