rift-ds 1.23.0 → 1.25.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 +4 -4
- 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/ChatAgentPane.css +6 -6
- package/chat/ChatLauncher.d.ts +3 -3
- package/chat/ChatWidget.css +260 -8
- package/chat/ChatWidget.d.ts +41 -6
- package/chat/ChatWidget.js +49 -2
- package/chat/index.d.ts +1 -1
- package/chat/registry.json.d.ts +1 -1
- package/chat/registry.json.js +1 -1
- 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 +108 -23
- package/components/AppSidebar/AppSidebar.d.ts +8 -5
- package/components/AppSidebar/AppSidebar.js +6 -3
- package/components/Attachment/Attachment.css +8 -0
- package/components/Attachment/AttachmentViewer.js +26 -5
- package/components/Attachment/fileTypes.d.ts +4 -0
- package/components/CurrencyInput/CurrencyInput.css +12 -0
- package/components/CurrencyInput/CurrencyInput.d.ts +51 -0
- package/components/CurrencyInput/CurrencyInput.js +158 -0
- package/components/DataTable/columnTypes.js +4 -16
- package/components/DatePicker/DatePicker.d.ts +2 -0
- package/components/DatePicker/DatePicker.js +44 -131
- package/components/DatePicker/MonthGrid.d.ts +56 -0
- package/components/DatePicker/MonthGrid.js +65 -0
- package/components/DatePicker/calendar.d.ts +42 -0
- package/components/DatePicker/calendar.js +108 -0
- package/components/DateRangePicker/DateRangePicker.css +92 -0
- package/components/DateRangePicker/DateRangePicker.d.ts +86 -0
- package/components/DateRangePicker/DateRangePicker.js +294 -0
- package/components/Deadline/Deadline.css +82 -0
- package/components/Deadline/Deadline.d.ts +44 -0
- package/components/Deadline/Deadline.js +94 -0
- package/components/Deadline/deadlineStatus.d.ts +15 -0
- package/components/Deadline/deadlineStatus.js +13 -0
- package/components/DescriptionList/DescriptionList.css +184 -0
- package/components/DescriptionList/DescriptionList.d.ts +64 -0
- package/components/DescriptionList/DescriptionList.js +100 -0
- package/components/DescriptionList/DescriptionListCopy.d.ts +18 -0
- package/components/DescriptionList/DescriptionListCopy.js +45 -0
- package/components/DocumentViewer/DocumentViewer.css +188 -0
- package/components/DocumentViewer/DocumentViewer.d.ts +59 -0
- package/components/DocumentViewer/DocumentViewer.js +185 -0
- package/components/ErrorSummary/ErrorSummary.css +94 -0
- package/components/ErrorSummary/ErrorSummary.d.ts +34 -0
- package/components/ErrorSummary/ErrorSummary.js +70 -0
- package/components/ErrorSummary/fieldErrors.d.ts +36 -0
- package/components/ErrorSummary/fieldErrors.js +19 -0
- package/components/Field/Field.css +12 -0
- package/components/Field/Field.d.ts +10 -2
- package/components/Field/Field.js +12 -5
- package/components/Heading/Heading.css +129 -0
- package/components/Heading/Heading.d.ts +31 -0
- package/components/Heading/Heading.js +39 -0
- package/components/Input/Input.css +120 -0
- package/components/Input/Input.d.ts +20 -1
- package/components/Input/Input.js +70 -5
- package/components/Link/Link.css +84 -0
- package/components/Link/Link.d.ts +43 -0
- package/components/Link/Link.js +74 -0
- package/components/List/List.css +173 -0
- package/components/List/List.d.ts +44 -0
- package/components/List/List.js +60 -0
- package/components/MaskedInput/MaskedInput.css +16 -0
- package/components/MaskedInput/MaskedInput.d.ts +57 -0
- package/components/MaskedInput/MaskedInput.js +142 -0
- package/components/MaskedInput/mask.d.ts +58 -0
- package/components/MaskedInput/mask.js +106 -0
- package/components/ShaderScene/ShaderScene.css +19 -0
- package/components/ShaderScene/ShaderScene.d.ts +82 -0
- package/components/ShaderScene/ShaderScene.js +144 -0
- package/components/ShaderScene/assemble.d.ts +5 -0
- package/components/ShaderScene/assemble.js +74 -0
- package/components/ShaderScene/common.glsl.d.ts +6 -0
- package/components/ShaderScene/common.glsl.js +49 -0
- package/components/ShaderScene/passes.d.ts +2 -0
- package/components/ShaderScene/passes.js +93 -0
- package/components/ShaderScene/renderer.d.ts +35 -0
- package/components/ShaderScene/renderer.js +125 -0
- package/components/ShaderScene/scenes.d.ts +20 -0
- package/components/ShaderScene/scenes.js +184 -0
- package/components/ShaderScene/types.d.ts +70 -0
- package/components/ShaderScene/types.js +8 -0
- package/components/SignaturePad/SignaturePad.css +141 -0
- package/components/SignaturePad/SignaturePad.d.ts +68 -0
- package/components/SignaturePad/SignaturePad.js +287 -0
- package/components/SignaturePad/signature.d.ts +32 -0
- package/components/SignaturePad/signature.js +46 -0
- package/components/Text/Text.css +129 -0
- package/components/Text/Text.d.ts +36 -0
- package/components/Text/Text.js +36 -0
- 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/Widget/Widget.css +111 -0
- package/components/Widget/Widget.d.ts +15 -1
- package/components/Widget/Widget.js +63 -11
- package/components/Widget/WidgetDisclosure.d.ts +30 -0
- package/components/Widget/WidgetDisclosure.js +52 -0
- package/components/registry.json +112 -3
- package/components/registry.json.d.ts +112 -3
- package/components/registry.json.js +2 -2
- package/format/index.d.ts +15 -0
- package/format/index.js +17 -0
- package/format/money.d.ts +89 -0
- package/format/money.js +187 -0
- package/format/relative.d.ts +49 -0
- package/format/relative.js +50 -0
- package/index.d.ts +13 -0
- package/index.js +46 -0
- package/package.json +9 -2
- package/tokens/motion.d.ts +4 -0
- package/tokens/motion.js +4 -0
- package/tokens/presets/plum.css +234 -240
- package/tokens/tokens-dark.css +2 -2
- package/tokens/tokens-light.css +2 -2
- package/tokens/values.json.js +1 -1
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
|
|
|
@@ -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
|
+
}
|
package/chat/ChatWidget.d.ts
CHANGED
|
@@ -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,
|
|
160
|
-
|
|
161
|
-
|
|
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
|
|
166
|
-
|
|
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';
|
|
@@ -224,6 +255,10 @@ export interface ChatWidgetProps {
|
|
|
224
255
|
composerLabels?: Pick<ComposerProps, 'attachLabel' | 'dropLabel' | 'filesLabel' | 'attachmentTileLabels' | 'stopLabel' | 'aria-label' | 'formatFileAnnouncement' | 'formatMentionAnnouncement'>;
|
|
225
256
|
/** The drop overlay's headline when a file is dragged over the chat with attachments on, over AttachmentDropZone's "Drop files to attach". Its second line is `attachHint`. */
|
|
226
257
|
attachmentDropZoneLabels?: Pick<AttachmentDropZoneProps, 'label'>;
|
|
258
|
+
/** Draws a sent file in the viewer its tile opens, in place of the built-in view: a document renderer of the host's own, a spreadsheet. Return nothing to keep the built-in view, which shows pictures, pasted text, and a PDF or a text file that carries a `fileUrl`. */
|
|
259
|
+
renderAttachmentPreview?: AttachmentGroupProps['renderPreview'];
|
|
260
|
+
/** Called with a sent file when the viewer's Download is pressed. Its presence renders the button. */
|
|
261
|
+
onAttachmentDownload?: AttachmentGroupProps['onDownload'];
|
|
227
262
|
/** The words of the files on a sent message, over AttachmentGroup's English defaults: the list's name ("Attachments"), the overflow buttons ("Show 3 more", "Show fewer"), the tiles' status lines (`attachmentTileLabels`) and the viewer a pressed file opens in (`attachmentViewerLabels`). */
|
|
228
263
|
attachmentGroupLabels?: Pick<AttachmentGroupProps, 'label' | 'showMoreLabel' | 'showLessLabel' | 'attachmentTileLabels' | 'attachmentViewerLabels'>;
|
|
229
264
|
/** The conversation's names, over ChatThread's English defaults: the scrolling region ("Conversation") and the scroll-to-latest control ("Scroll to the latest message"). */
|
|
@@ -251,4 +286,4 @@ export interface ChatWidgetProps {
|
|
|
251
286
|
* a stage card, a whole page). It reads all of its state from ChatProvider,
|
|
252
287
|
* so the conversation is the same object wherever it shows.
|
|
253
288
|
*/
|
|
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;
|
|
289
|
+
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, renderAttachmentPreview, onAttachmentDownload, chatThreadLabels, modelPickerLabels, artifactPanelLabels, agentRailLabels, questionCardLabels, questionSummaryLabels, codeBlockLabels, promptSuggestionsLabels, }: ChatWidgetProps): import("react").JSX.Element;
|
package/chat/ChatWidget.js
CHANGED
|
@@ -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,
|
|
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,
|
|
@@ -117,6 +120,8 @@ function ChatWidget({
|
|
|
117
120
|
composerLabels,
|
|
118
121
|
attachmentDropZoneLabels,
|
|
119
122
|
attachmentGroupLabels,
|
|
123
|
+
renderAttachmentPreview,
|
|
124
|
+
onAttachmentDownload,
|
|
120
125
|
chatThreadLabels,
|
|
121
126
|
modelPickerLabels,
|
|
122
127
|
artifactPanelLabels,
|
|
@@ -300,6 +305,17 @@ function ChatWidget({
|
|
|
300
305
|
return () => observer.disconnect();
|
|
301
306
|
}, [hasRails, closeArtifact]);
|
|
302
307
|
const closeThreads = () => setThreadsOpen(false);
|
|
308
|
+
const [shellNarrow, setShellNarrow] = useState(false);
|
|
309
|
+
useEffect(() => {
|
|
310
|
+
if (!layout || layout === "flush") return;
|
|
311
|
+
const host = railsHostRef.current ?? composerRef.current?.closest(".ds-chat-widget");
|
|
312
|
+
if (!host) return;
|
|
313
|
+
const measure = () => setShellNarrow(host.clientWidth < THREADS_RAIL_MIN_WIDTH);
|
|
314
|
+
measure();
|
|
315
|
+
const observer = new ResizeObserver(measure);
|
|
316
|
+
observer.observe(host);
|
|
317
|
+
return () => observer.disconnect();
|
|
318
|
+
}, [layout, hasRails]);
|
|
303
319
|
const artifactId = useId();
|
|
304
320
|
const artifactShown = artifacts && (artifact !== null || artifactEmptyOpen);
|
|
305
321
|
const [heldArtifact, setHeldArtifact] = useState(artifact);
|
|
@@ -371,6 +387,23 @@ function ChatWidget({
|
|
|
371
387
|
}, [artifacts, turns, openArtifact]);
|
|
372
388
|
const trailingUp = artifactInline || Boolean(renderAside) && asideOpen && asideWide;
|
|
373
389
|
const threadsInline = threadsWide && !(trailingUp && (!asideRoomy || artifactExpanded));
|
|
390
|
+
useEffect(() => {
|
|
391
|
+
if (!artifacts) return;
|
|
392
|
+
const host = railsHostRef.current;
|
|
393
|
+
if (!host) return;
|
|
394
|
+
const measure = () => {
|
|
395
|
+
const threadsRail2 = host.querySelector(":scope > .ds-chat-widget__threads-rail");
|
|
396
|
+
const inset = parseFloat(getComputedStyle(host).getPropertyValue("--ds-chat-artifact-inset")) || 0;
|
|
397
|
+
const room = host.clientWidth - (threadsRail2?.offsetWidth ?? 0) - ARTIFACT_MIN_COLUMN_WIDTH - inset * 2;
|
|
398
|
+
host.style.setProperty("--ds-chat-artifact-room", `${Math.max(0, Math.round(room))}px`);
|
|
399
|
+
};
|
|
400
|
+
measure();
|
|
401
|
+
const observer = new ResizeObserver(measure);
|
|
402
|
+
observer.observe(host);
|
|
403
|
+
const threadsRail = host.querySelector(":scope > .ds-chat-widget__threads-rail");
|
|
404
|
+
if (threadsRail) observer.observe(threadsRail);
|
|
405
|
+
return () => observer.disconnect();
|
|
406
|
+
}, [artifacts, threadsInline]);
|
|
374
407
|
const asideRailRef = useRef(null);
|
|
375
408
|
const asideMounted = Boolean(renderAside) && asideWide;
|
|
376
409
|
useEffect(() => {
|
|
@@ -524,10 +557,14 @@ function ChatWidget({
|
|
|
524
557
|
rootSettleTimer.current = window.setTimeout(() => setRootScrolling(false), MOTION_SCROLL_SETTLE_MS);
|
|
525
558
|
};
|
|
526
559
|
useEffect(() => () => window.clearTimeout(rootSettleTimer.current), []);
|
|
560
|
+
const shellMode = layout && layout !== "flush" && shellNarrow ? "flush" : layout;
|
|
561
|
+
const shellBackdrop = shellMode === layout ? backdrop : "solid";
|
|
562
|
+
const shellAttrs = shellMode ? { "data-ds-shell": shellMode, "data-ds-shell-backdrop": shellMode === "flush" ? shellBackdrop : void 0 } : {};
|
|
527
563
|
const chatColumn = /* @__PURE__ */ jsxs(
|
|
528
564
|
ChatRoot,
|
|
529
565
|
{
|
|
530
566
|
...dropProps,
|
|
567
|
+
...hasRails ? {} : shellAttrs,
|
|
531
568
|
className: `ds-chat-widget ${renderThreads ? "ds-chat-widget--with-threads" : ""}`,
|
|
532
569
|
"data-compact": compact || void 0,
|
|
533
570
|
"data-phone": phone || void 0,
|
|
@@ -607,7 +644,16 @@ function ChatWidget({
|
|
|
607
644
|
ChatMessage,
|
|
608
645
|
{
|
|
609
646
|
role: "user",
|
|
610
|
-
attachments: turn.attachments ? /* @__PURE__ */ jsx(
|
|
647
|
+
attachments: turn.attachments ? /* @__PURE__ */ jsx(
|
|
648
|
+
AttachmentGroup,
|
|
649
|
+
{
|
|
650
|
+
...attachmentGroupLabels,
|
|
651
|
+
align: "end",
|
|
652
|
+
items: turn.attachments,
|
|
653
|
+
renderPreview: renderAttachmentPreview,
|
|
654
|
+
onDownload: onAttachmentDownload
|
|
655
|
+
}
|
|
656
|
+
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
611
657
|
turn.content,
|
|
612
658
|
turnCards(turn).map((card, index) => /* @__PURE__ */ jsx(TurnCard, { card }, index))
|
|
613
659
|
] }),
|
|
@@ -696,6 +742,7 @@ function ChatWidget({
|
|
|
696
742
|
{
|
|
697
743
|
ref: railsHostRef,
|
|
698
744
|
className: "ds-chat-widget__rails",
|
|
745
|
+
...shellAttrs,
|
|
699
746
|
"data-artifact-expanded": artifactExpanded || void 0,
|
|
700
747
|
"data-artifact-sized": artifactWidth !== null || artifactResizing || void 0,
|
|
701
748
|
"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';
|
package/chat/registry.json.d.ts
CHANGED
|
@@ -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.",
|
package/chat/registry.json.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
89
|
-
|
|
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
|
|
28
|
-
* the rail edge to edge
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
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,
|