rift-ds 1.22.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.
- package/README.md +3 -3
- package/behaviors/chat-card.css +135 -0
- package/behaviors/shell.css +119 -0
- package/bin/templates/blocks/components/blocks/AppShell.module.css +69 -15
- package/bin/templates/blocks/components/blocks/AppShell.tsx +45 -30
- package/bin/templates/blocks/registry.json +1 -1
- package/chat/AssistantTurn.js +9 -3
- package/chat/ChatAgentPane.css +6 -6
- package/chat/ChatLauncher.d.ts +3 -3
- package/chat/ChatLauncher.js +3 -5
- package/chat/ChatProvider.d.ts +10 -1
- package/chat/ChatProvider.js +3 -2
- package/chat/ChatWidget.css +272 -8
- package/chat/ChatWidget.d.ts +63 -9
- package/chat/ChatWidget.js +110 -38
- package/chat/DemoWelcome.js +2 -2
- package/chat/actions.d.ts +105 -0
- package/chat/actions.js +47 -0
- package/chat/demo-card-components.d.ts +3 -4
- package/chat/demo-script.js +15 -15
- package/chat/generatedStarters.d.ts +19 -0
- package/chat/generatedStarters.js +49 -0
- package/chat/index.d.ts +7 -3
- package/chat/index.js +25 -2
- package/chat/placement.d.ts +9 -0
- package/chat/placement.js +7 -0
- package/chat/queries.d.ts +6 -0
- package/chat/queries.js +25 -0
- package/chat/questions.d.ts +1 -1
- package/chat/questions.js +1 -1
- package/chat/registry.json.d.ts +5 -3
- package/chat/registry.json.js +1 -1
- package/chat/selection.css +8 -0
- package/chat/selection.d.ts +40 -0
- package/chat/selection.js +140 -0
- package/chat/selectionContext.d.ts +70 -0
- package/chat/selectionContext.js +60 -0
- package/chat/server.d.ts +54 -1
- package/chat/server.js +101 -5
- package/chat/suggestions.d.ts +12 -8
- package/chat/suggestions.js +1 -1
- package/chat/types.d.ts +2 -0
- package/chat/useChat.js +5 -3
- package/components/ActionCard/ActionCard.css +147 -0
- package/components/ActionCard/ActionCard.d.ts +54 -0
- package/components/ActionCard/ActionCard.js +75 -0
- package/components/ActionReadout/ActionReadout.css +47 -0
- package/components/ActionReadout/ActionReadout.d.ts +29 -0
- package/components/ActionReadout/ActionReadout.js +22 -0
- package/components/AgentPlan/AgentPlan.css +18 -8
- package/components/AgentPlan/AgentPlan.js +1 -0
- package/components/AppLayout/AppLayout.css +17 -4
- package/components/AppLayout/AppLayout.d.ts +8 -5
- package/components/AppLayout/AppLayout.js +2 -0
- package/components/AppSidebar/AppSidebar.css +119 -28
- package/components/AppSidebar/AppSidebar.d.ts +10 -5
- package/components/AppSidebar/AppSidebar.js +19 -4
- package/components/ArtifactCard/ArtifactCard.css +11 -10
- package/components/ArtifactCard/ArtifactCard.js +3 -1
- package/components/ChatThread/ChatThread.css +6 -3
- package/components/Chip/Chip.css +9 -1
- package/components/CodeBlock/CodeBlock.css +2 -0
- package/components/CodeDiff/CodeDiff.css +18 -8
- package/components/CodeDiff/CodeDiff.js +1 -0
- package/components/Composer/Composer.css +52 -13
- package/components/Composer/Composer.d.ts +9 -1
- package/components/Composer/Composer.js +19 -1
- package/components/DataTable/FilterEditor.js +4 -2
- package/components/DataTable/filterModel.d.ts +8 -0
- package/components/DataTable/filterModel.js +4 -0
- package/components/DataTable/views.js +2 -2
- package/components/DocumentChip/DocumentChip.css +27 -3
- package/components/EntitySwitcher/EntitySwitcher.css +333 -0
- package/components/EntitySwitcher/EntitySwitcher.d.ts +74 -0
- package/components/EntitySwitcher/EntitySwitcher.js +291 -0
- package/components/InterruptCard/InterruptCard.css +96 -34
- package/components/InterruptCard/InterruptCard.d.ts +20 -3
- package/components/InterruptCard/InterruptCard.js +23 -8
- package/components/MessageCard/MessageCard.css +27 -18
- package/components/MessageCard/MessageCard.js +1 -0
- package/components/PromptSuggestions/PromptSuggestions.css +3 -0
- package/components/Prose/Prose.css +2 -0
- package/components/QuestionCard/QuestionCard.css +9 -5
- package/components/QuestionCard/QuestionCard.js +1 -0
- package/components/SourceTrail/SourceTrail.css +33 -11
- package/components/SourceTrail/SourceTrail.js +3 -2
- package/components/TableToolbar/TableToolbar.css +4 -1
- package/components/TableToolbar/TableToolbar.js +1 -1
- package/components/ThemePicker/ThemePicker.css +6 -0
- package/components/ThemePicker/ThemePicker.js +20 -11
- package/components/ThreadPanel/ThreadPanel.css +65 -36
- package/components/ThreadPanel/ThreadPanel.d.ts +5 -5
- package/components/ThreadPanel/ThreadPanel.js +1 -1
- package/components/ToolCall/ToolCall.css +89 -22
- package/components/ToolCall/ToolCall.js +2 -1
- package/components/UsageCard/UsageCard.css +29 -2
- package/components/UsageCard/UsageCard.js +1 -0
- package/components/registry.json +25 -1
- package/components/registry.json.d.ts +25 -1
- package/components/registry.json.js +1 -1
- package/fonts/presets/bricolage-grotesque-300-800-latin-ext.woff2 +0 -0
- package/fonts/presets/bricolage-grotesque-300-800-latin.woff2 +0 -0
- package/fonts/presets/figtree-300-800-latin-ext.woff2 +0 -0
- package/fonts/presets/figtree-300-800-latin.woff2 +0 -0
- package/index.d.ts +3 -0
- package/index.js +6 -0
- package/package.json +5 -1
- package/tokens/motion.d.ts +2 -0
- package/tokens/motion.js +2 -0
- package/tokens/presets/plum.css +413 -0
- package/tokens/presets/presets.css +1 -0
- package/tokens/registry.json +2 -0
- package/tokens/registry.json.d.ts +2 -0
- package/tokens/registry.json.js +1 -1
- package/tokens/tokens-dark.css +6 -2
- package/tokens/tokens-light.css +6 -2
- package/tokens/tokens-typography.css +8 -2
- package/tokens/values.json.js +1 -1
package/chat/ChatProvider.d.ts
CHANGED
|
@@ -14,6 +14,15 @@ export interface ChatProviderProps {
|
|
|
14
14
|
transport?: ChatTransport;
|
|
15
15
|
/** The endpoint the default transport posts to. */
|
|
16
16
|
endpoint?: string;
|
|
17
|
+
/**
|
|
18
|
+
* What the default transport sends as the request's context, read at each
|
|
19
|
+
* send: the page by default (`window.location.pathname`). A host whose chat
|
|
20
|
+
* follows more than the page (a highlight, a selection) returns its own
|
|
21
|
+
* string, which its handler's `sanitiseContext` checks. Pass a stable
|
|
22
|
+
* function (one that reads the latest state itself), since a new one makes
|
|
23
|
+
* a new transport. Ignored with a `transport`, which carries its own.
|
|
24
|
+
*/
|
|
25
|
+
getContext?: () => string | null;
|
|
17
26
|
/** The seat the panel opens in. */
|
|
18
27
|
defaultPlacement?: ChatPlacement;
|
|
19
28
|
/**
|
|
@@ -57,4 +66,4 @@ export interface ChatProviderProps {
|
|
|
57
66
|
* clicking between pages for free. A hard reload starts clean by design:
|
|
58
67
|
* no storage, no persistence.
|
|
59
68
|
*/
|
|
60
|
-
export declare function ChatProvider({ transport, endpoint, defaultPlacement, followups, fallbackFollowups, feedback, renderers, artifactRenderers, renderLink, isInternalHref, threads: threadsOptions, placeholders, children, }: ChatProviderProps): import("react").JSX.Element;
|
|
69
|
+
export declare function ChatProvider({ transport, endpoint, getContext, defaultPlacement, followups, fallbackFollowups, feedback, renderers, artifactRenderers, renderLink, isInternalHref, threads: threadsOptions, placeholders, children, }: ChatProviderProps): import("react").JSX.Element;
|
package/chat/ChatProvider.js
CHANGED
|
@@ -21,6 +21,7 @@ const defaultRenderLink = (props) => /* @__PURE__ */ jsx(DefaultChatLink, { ...p
|
|
|
21
21
|
function ChatProvider({
|
|
22
22
|
transport,
|
|
23
23
|
endpoint = "/api/chat",
|
|
24
|
+
getContext,
|
|
24
25
|
defaultPlacement = "right",
|
|
25
26
|
followups = "/api/chat/followups",
|
|
26
27
|
fallbackFollowups = DEFAULT_FALLBACK_FOLLOWUPS,
|
|
@@ -35,8 +36,8 @@ function ChatProvider({
|
|
|
35
36
|
}) {
|
|
36
37
|
const [chosenModel, setChosenModel] = useState(null);
|
|
37
38
|
const fallbackTransport = useMemo(
|
|
38
|
-
() => createFetchTransport(endpoint, { getModel: () => chosenModel }),
|
|
39
|
-
[endpoint, chosenModel]
|
|
39
|
+
() => createFetchTransport(endpoint, { getModel: () => chosenModel, getContext }),
|
|
40
|
+
[endpoint, chosenModel, getContext]
|
|
40
41
|
);
|
|
41
42
|
const placeholderCopy = useMemo(
|
|
42
43
|
() => ({ ...DEFAULT_PLACEHOLDER_COPY, ...placeholders }),
|
package/chat/ChatWidget.css
CHANGED
|
@@ -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
|
|
247
|
-
|
|
248
|
-
|
|
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
|
|
1002
|
-
|
|
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:
|
|
1010
|
-
box-shadow:
|
|
1018
|
+
border-color: var(--color-bg-container-border);
|
|
1019
|
+
box-shadow: var(--shadow-floating);
|
|
1011
1020
|
backdrop-filter: none;
|
|
1012
1021
|
}
|
|
1013
1022
|
|
|
@@ -1248,3 +1257,258 @@ html[data-chat-resizing] .ds-chat-launcher__panel--floating .ds-chat-header {
|
|
|
1248
1257
|
border-radius: var(--radius-pill);
|
|
1249
1258
|
box-shadow: var(--shadow-floating);
|
|
1250
1259
|
}
|
|
1260
|
+
|
|
1261
|
+
/* A sent message's context: the note's subject as a compact DocumentChip on the
|
|
1262
|
+
sender's side, over the bubble, where files ride. */
|
|
1263
|
+
.ds-chat-widget__sent-context {
|
|
1264
|
+
display: flex;
|
|
1265
|
+
justify-content: flex-end;
|
|
1266
|
+
min-width: 0;
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
.ds-chat-widget__sent-context .ds-document-chip {
|
|
1270
|
+
max-width: 100%;
|
|
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
|
+
}
|
package/chat/ChatWidget.d.ts
CHANGED
|
@@ -15,6 +15,23 @@ import { ChatThreadsProps } from './ChatThreads';
|
|
|
15
15
|
import { GreetingCopy } from './greeting';
|
|
16
16
|
import { ChatPlacement } from './placement';
|
|
17
17
|
import { ChatModelOption, Starter } from './types';
|
|
18
|
+
/**
|
|
19
|
+
* What the chat is looking at, as the composer's context note shows it. One
|
|
20
|
+
* object, so a host whose context follows the reader changes the label, the
|
|
21
|
+
* line, the icon, the way back and what each sent message carries together.
|
|
22
|
+
*/
|
|
23
|
+
export interface ChatContext {
|
|
24
|
+
/** What it is called: a page title, "ORD-1000116", "3 orders", a passage. The note says it, and a sent message's chip names it. */
|
|
25
|
+
label: string;
|
|
26
|
+
/** The note's whole line, for a host that words it itself. Defaults to `Looking at “<label>”`. */
|
|
27
|
+
note?: string;
|
|
28
|
+
/** The note's icon: a Material Symbol name, or your own element. Defaults to `description`. */
|
|
29
|
+
icon?: string | ReactNode;
|
|
30
|
+
/** Called by the note's clear button, which appears only when this is set: for a context that follows a selection and can go back to the page as a whole. Its name is `contextClearLabel`. */
|
|
31
|
+
onClear?: () => void;
|
|
32
|
+
/** Repeat the context above each message sent while it is set, so the thread keeps what each question was about. `true` draws `label` as a compact DocumentChip wearing `icon`; a function draws what it returns, called at the send, for a chip that does more, such as bringing its context back. A message sent with files keeps its files there instead. */
|
|
33
|
+
sent?: boolean | (() => ReactNode);
|
|
34
|
+
}
|
|
18
35
|
/** A rail slot: the widget's own panel, or a render prop for a custom one. */
|
|
19
36
|
export type RailSlot = boolean | ((ctx: {
|
|
20
37
|
overlay: boolean;
|
|
@@ -29,6 +46,10 @@ export interface ChatAgentOptions {
|
|
|
29
46
|
/** Open the pane at mount, where the panel is wide enough to seat it inline. Off by default: the header button opens it. */
|
|
30
47
|
defaultOpen?: boolean;
|
|
31
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';
|
|
32
53
|
/** Props owned by ChatWidget itself. */
|
|
33
54
|
export interface ChatWidgetProps {
|
|
34
55
|
/** Show the expand toggle. A host whose stage is always a takeover hides it. */
|
|
@@ -41,6 +62,32 @@ export interface ChatWidgetProps {
|
|
|
41
62
|
placementEnabled?: boolean;
|
|
42
63
|
/** Narrow insets for phone-width hosts. */
|
|
43
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;
|
|
44
91
|
/** The host is a phone viewport, where the soft keyboard will claim the
|
|
45
92
|
lower half of the screen the moment the composer is focused. The
|
|
46
93
|
welcome screen stacks instead of centring the composer: greeting in
|
|
@@ -73,6 +120,8 @@ export interface ChatWidgetProps {
|
|
|
73
120
|
starters?: Starter[];
|
|
74
121
|
/** Keys the starters' staged reveal: a new key replays the generation beat, the same key shows the set standing. A host whose starters follow the page passes the pathname. */
|
|
75
122
|
startersKey?: string;
|
|
123
|
+
/** Holds the starters' shimmer while the host is still writing them, for starters a model generates: the set reveals the moment this turns false, without the staged beat. Off by default. */
|
|
124
|
+
startersPending?: boolean;
|
|
76
125
|
/** Replaces the composer's leading actions (the model picker). */
|
|
77
126
|
composerActions?: ReactNode;
|
|
78
127
|
/** The models the picker offers. The pick rides on each send as a wire value; the server resolves it. Omit for no picker. */
|
|
@@ -112,11 +161,15 @@ export interface ChatWidgetProps {
|
|
|
112
161
|
agent?: ChatAgentOptions;
|
|
113
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. */
|
|
114
163
|
artifacts?: boolean;
|
|
115
|
-
/**
|
|
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
|
+
context?: ChatContext | null;
|
|
166
|
+
/** The accessible name of the context note's clear button, shown when `context.onClear` is set. Defaults to "Clear context". */
|
|
167
|
+
contextClearLabel?: string;
|
|
168
|
+
/** The composer's context note, naming what the chat is looking at. @deprecated Use `context` with its `label`. */
|
|
116
169
|
contextLabel?: string | null;
|
|
117
|
-
/** Where the context note sits: `
|
|
170
|
+
/** Where the context note sits: `inside` the composer, at the top of the shell, or `above` it as a bar of its own. Defaults to `inside`, the Composer's own default. A note alone never brings the composer's footer: with nothing else to seat there, it sits over the one-row composer. */
|
|
118
171
|
contextPlacement?: 'above' | 'inside';
|
|
119
|
-
/** The composer's context note, written from `contextLabel
|
|
172
|
+
/** The composer's context note, written from `contextLabel`, for a host still on the label prop; `context` takes its `note` as a line. @deprecated Use `context` with its `note`. */
|
|
120
173
|
contextNote?: (title: string) => string;
|
|
121
174
|
/** The second line of the drop overlay with attachments on, written from the limits: the largest file as text ("50 MB"), the most files per message, and the largest file in bytes for a host that formats sizes itself. Defaults to `Up to <maxSize> each · <maxFiles> files max`. */
|
|
122
175
|
attachHint?: (maxSize: string, maxFiles: number, maxBytes: number) => string;
|
|
@@ -133,14 +186,15 @@ export interface ChatWidgetProps {
|
|
|
133
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." */
|
|
134
187
|
artifactEmptyDescription?: string;
|
|
135
188
|
/** A widget slot on the welcome screen, under the composer and its
|
|
136
|
-
starters. It takes any content and keeps its natural height,
|
|
137
|
-
|
|
138
|
-
|
|
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
|
|
139
192
|
with the first message, like the rest of the welcome dressing. */
|
|
140
193
|
widgets?: ReactNode;
|
|
141
194
|
/** How the widget slot takes its room. `fit` keeps the welcome screen to
|
|
142
|
-
one viewport: the
|
|
143
|
-
|
|
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
|
|
144
198
|
greeting and composer take the opening of the viewport, the widgets
|
|
145
199
|
run on below the fold, and the whole welcome scrolls as one. */
|
|
146
200
|
widgetsLayout?: 'fit' | 'scroll';
|
|
@@ -228,4 +282,4 @@ export interface ChatWidgetProps {
|
|
|
228
282
|
* a stage card, a whole page). It reads all of its state from ChatProvider,
|
|
229
283
|
* so the conversation is the same object wherever it shows.
|
|
230
284
|
*/
|
|
231
|
-
export declare function ChatWidget({ fullscreenEnabled, closeEnabled, placementEnabled, compact, phone, title, flow, placeholder, questionsPlaceholder, showStarters, logo, tagline, starters: startersInput, startersKey, composerActions, models, defaultModel, lockedModelDescription, fileAttachments, maxAttachments, maxAttachmentBytes, mentions, threads, threadsProps, tabs, aside, agent, artifacts, 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;
|