astryx-dracula 0.5.0 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/BRAND.md +3 -3
  2. package/README.md +7 -4
  3. package/USAGE.md +49 -49
  4. package/astryx-dracula.d.ts +2 -2
  5. package/astryx-dracula.js +25 -9
  6. package/astryx-dracula.variants.d.ts +2 -2
  7. package/astryx.integration.mjs +1 -1
  8. package/icons.mjs +21 -17
  9. package/icons.tsx +69 -62
  10. package/package.json +125 -120
  11. package/shared/auth-chrome-config.ts +6 -6
  12. package/shared/auth-chrome.tsx +143 -144
  13. package/shared/auth-copy.ts +14 -14
  14. package/shared/chaptered-doc-config.ts +48 -51
  15. package/shared/chaptered-doc.tsx +267 -289
  16. package/shared/chart-hues.ts +25 -10
  17. package/shared/chart-labels.tsx +31 -30
  18. package/shared/chart-legend.tsx +55 -56
  19. package/shared/chart-panel-style.ts +3 -3
  20. package/shared/data-bar.tsx +97 -102
  21. package/shared/format-money.ts +1 -1
  22. package/shared/gallery-image.ts +6 -6
  23. package/shared/login-demo.ts +1 -1
  24. package/shared/metric-card.tsx +101 -105
  25. package/shared/metric-delta.tsx +28 -27
  26. package/shared/order-desk.tsx +205 -216
  27. package/shared/revenue-chart.tsx +145 -165
  28. package/shared/scene-castle.tsx +206 -291
  29. package/shared/scene-frame.tsx +33 -32
  30. package/shared/scene-hues.ts +17 -17
  31. package/shared/scene-tile.tsx +88 -92
  32. package/shared/settings-data.ts +119 -125
  33. package/shared/settings-rows.tsx +122 -159
  34. package/shared/sparkline.tsx +75 -88
  35. package/shared/sso-icons.tsx +10 -22
  36. package/shared/stars.tsx +16 -25
  37. package/templates/ai-chat-landing.template.mjs +5 -4
  38. package/templates/ai-chat-landing.tsx +473 -460
  39. package/templates/ai-chat.template.mjs +5 -4
  40. package/templates/ai-chat.tsx +543 -612
  41. package/templates/blank.template.mjs +5 -4
  42. package/templates/blank.tsx +18 -14
  43. package/templates/centered-hero.template.mjs +5 -4
  44. package/templates/centered-hero.tsx +55 -68
  45. package/templates/classic-gallery.template.mjs +5 -4
  46. package/templates/classic-gallery.tsx +97 -104
  47. package/templates/contact-form.template.mjs +5 -4
  48. package/templates/contact-form.tsx +247 -282
  49. package/templates/dashboard-portfolio.template.mjs +5 -4
  50. package/templates/dashboard-portfolio.tsx +717 -548
  51. package/templates/dashboard.template.mjs +5 -4
  52. package/templates/dashboard.tsx +596 -567
  53. package/templates/detail-page.template.mjs +5 -4
  54. package/templates/detail-page.tsx +546 -603
  55. package/templates/documentation-design.template.mjs +5 -4
  56. package/templates/documentation-design.tsx +231 -243
  57. package/templates/documentation-technical.template.mjs +5 -4
  58. package/templates/documentation-technical.tsx +236 -239
  59. package/templates/documentation.template.mjs +5 -4
  60. package/templates/documentation.tsx +267 -279
  61. package/templates/editor.template.mjs +5 -4
  62. package/templates/editor.tsx +844 -877
  63. package/templates/file-explorer.template.mjs +5 -4
  64. package/templates/file-explorer.tsx +566 -590
  65. package/templates/form-two-column.template.mjs +5 -4
  66. package/templates/form-two-column.tsx +195 -210
  67. package/templates/gallery-hero.template.mjs +5 -4
  68. package/templates/gallery-hero.tsx +93 -114
  69. package/templates/ide.template.mjs +5 -4
  70. package/templates/ide.tsx +407 -453
  71. package/templates/incident-console.template.mjs +5 -4
  72. package/templates/incident-console.tsx +593 -575
  73. package/templates/kanban-board.template.mjs +5 -4
  74. package/templates/kanban-board.tsx +665 -683
  75. package/templates/library.template.mjs +5 -4
  76. package/templates/library.tsx +409 -430
  77. package/templates/login-card.template.mjs +5 -4
  78. package/templates/login-card.tsx +63 -72
  79. package/templates/login-split.template.mjs +5 -4
  80. package/templates/login-split.tsx +192 -193
  81. package/templates/login-sso.template.mjs +5 -4
  82. package/templates/login-sso.tsx +257 -258
  83. package/templates/login.template.mjs +5 -4
  84. package/templates/login.tsx +53 -49
  85. package/templates/messaging-shell.template.mjs +5 -4
  86. package/templates/messaging-shell.tsx +556 -574
  87. package/templates/mixed-gallery.template.mjs +5 -4
  88. package/templates/mixed-gallery.tsx +60 -58
  89. package/templates/payment-form.template.mjs +5 -4
  90. package/templates/payment-form.tsx +882 -991
  91. package/templates/product-detail.template.mjs +5 -4
  92. package/templates/product-detail.tsx +261 -272
  93. package/templates/product-gallery.template.mjs +5 -4
  94. package/templates/product-gallery.tsx +126 -137
  95. package/templates/product-tour.template.mjs +5 -4
  96. package/templates/product-tour.tsx +741 -773
  97. package/templates/settings-dialog.template.mjs +5 -4
  98. package/templates/settings-dialog.tsx +688 -717
  99. package/templates/settings-sidebar.template.mjs +5 -4
  100. package/templates/settings-sidebar.tsx +762 -807
  101. package/templates/settings.template.mjs +5 -4
  102. package/templates/settings.tsx +289 -304
  103. package/templates/shell-nav.template.mjs +5 -4
  104. package/templates/shell-nav.tsx +212 -219
  105. package/templates/shell-side-nav.template.mjs +5 -4
  106. package/templates/shell-side-nav.tsx +135 -157
  107. package/templates/shell-top-nav.template.mjs +5 -4
  108. package/templates/shell-top-nav.tsx +182 -203
  109. package/templates/side-gallery.template.mjs +5 -4
  110. package/templates/side-gallery.tsx +85 -90
  111. package/templates/table-grouped.template.mjs +5 -4
  112. package/templates/table-grouped.tsx +1000 -1053
  113. package/templates/table-page-chart.template.mjs +5 -4
  114. package/templates/table-page-chart.tsx +400 -398
  115. package/templates/table-page-heatmap-status.template.mjs +5 -4
  116. package/templates/table-page-heatmap-status.tsx +483 -512
  117. package/templates/table-page-shoe-store-heatmap.template.mjs +5 -4
  118. package/templates/table-page-shoe-store-heatmap.tsx +748 -746
  119. package/templates/table-page.template.mjs +5 -4
  120. package/templates/table-page.tsx +396 -405
  121. package/templates/table.template.mjs +5 -4
  122. package/templates/table.tsx +92 -93
  123. package/templates/tech-report.template.mjs +5 -4
  124. package/templates/tech-report.tsx +1316 -1304
  125. package/templates/theme-showcase.template.mjs +5 -4
  126. package/templates/theme-showcase.tsx +871 -951
  127. package/theme.css +35 -77
  128. package/theme.css.d.ts +9 -0
  129. package/tokens.css +373 -380
@@ -1,56 +1,42 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
- // XLE (canonical structure, validated with `bunx astryx layout check`):
3
- // L > LC[p=0] > H > (SI[fill] > ChL > ChML > (ChM > ChB)*4 + ChC"Ask a follow up...") + (C.transparent > Tbar + S.section > MD) ;; Dlg#artifact[variant=fullscreen] > L > (DH"JWT Token Refresh" + (LC[p=0] > S.section > MD))
4
-
5
- import {useState, type CSSProperties} from 'react';
6
-
7
- import {
8
- HStack,
9
- VStack,
10
- StackItem,
11
- Layout,
12
- LayoutContent,
13
- } from '@astryxdesign/core/Layout';
14
- import {Text, Heading} from '@astryxdesign/core/Text';
15
- import {
16
- ChatComposer,
17
- ChatComposerInput,
18
- ChatLayout,
19
- ChatMessage,
20
- ChatMessageBubble,
21
- ChatMessageList,
22
- ChatMessageMetadata,
23
- ChatSystemMessage,
24
- ChatTokenizedText,
25
- ChatToolCalls,
26
- } from '@astryxdesign/core/Chat';
27
- import {Avatar} from '@astryxdesign/core/Avatar';
28
- import {Card} from '@astryxdesign/core/Card';
29
- import {ClickableCard} from '@astryxdesign/core/ClickableCard';
30
- import {Section} from '@astryxdesign/core/Section';
31
- import {Markdown} from '@astryxdesign/core/Markdown';
32
- import {CodeBlock} from '@astryxdesign/core/CodeBlock';
33
- import {Timestamp} from '@astryxdesign/core/Timestamp';
34
- import {Token} from '@astryxdesign/core/Token';
35
- import {Button} from '@astryxdesign/core/Button';
36
- import {Icon} from '@astryxdesign/core/Icon';
37
- import {Dialog, DialogHeader} from '@astryxdesign/core/Dialog';
38
- import {VisuallyHidden} from '@astryxdesign/core/VisuallyHidden';
39
- import {DropdownMenu} from '@astryxdesign/core/DropdownMenu';
40
- import {MoreMenu} from '@astryxdesign/core/MoreMenu';
41
- import {Toolbar} from '@astryxdesign/core/Toolbar';
42
- import {useResizable, ResizeHandle} from '@astryxdesign/core/Resizable';
43
- import {useMediaQuery} from '@astryxdesign/core/hooks';
44
-
2
+ // XLE (canonical structure of the tree below; the CLI had no XLE validator
3
+ // after `astryx layout` was removed in 0.7.0, so this is a reading aid and a
4
+ // human drift check — update it with the file, never alone):
5
+ // L > LC[p=0] > H > (V > ChL > (VH"Night thread"[as=h1] + ChML > (ChSM"Today" + (ChM > ChBu)*8 + ChSM"Changes sealed in the crypt") + ChC"Ask the night anything...")) + (RH + C.transparent > Tbar + S.transparent > (V[g=2] > Hd"JWT Token Refresh: Design & Rollout"[level=2 t=display-2] + MD)) ;; Dlg#artifact[variant=fullscreen] > L > (DH"JWT Token Refresh" + (LC[p=0] > S.transparent > (V[g=2] > Hd"JWT Token Refresh: Design & Rollout"[level=2 t=display-2] + MD)))
6
+
7
+ import { Avatar } from "@astryxdesign/core/Avatar";
8
+ import { Button } from "@astryxdesign/core/Button";
9
+ import { Card } from "@astryxdesign/core/Card";
45
10
  import {
46
- FileText,
47
- Copy,
48
- Share2,
49
- AtSign,
50
- Paperclip,
51
- X,
52
- ChevronRight,
53
- } from 'lucide-react';
11
+ ChatComposer,
12
+ ChatComposerInput,
13
+ ChatLayout,
14
+ ChatMessage,
15
+ ChatMessageBubble,
16
+ ChatMessageList,
17
+ ChatMessageMetadata,
18
+ ChatSystemMessage,
19
+ ChatTokenizedText,
20
+ ChatToolCalls,
21
+ } from "@astryxdesign/core/Chat";
22
+ import { ClickableCard } from "@astryxdesign/core/ClickableCard";
23
+ import { CodeBlock } from "@astryxdesign/core/CodeBlock";
24
+ import { Dialog, DialogHeader } from "@astryxdesign/core/Dialog";
25
+ import { DropdownMenu } from "@astryxdesign/core/DropdownMenu";
26
+ import { useMediaQuery } from "@astryxdesign/core/hooks";
27
+ import { Icon } from "@astryxdesign/core/Icon";
28
+ import { HStack, Layout, LayoutContent, StackItem, VStack } from "@astryxdesign/core/Layout";
29
+ import { Markdown } from "@astryxdesign/core/Markdown";
30
+ import { MoreMenu } from "@astryxdesign/core/MoreMenu";
31
+ import { ResizeHandle, useResizable } from "@astryxdesign/core/Resizable";
32
+ import { Section } from "@astryxdesign/core/Section";
33
+ import { Heading, Text } from "@astryxdesign/core/Text";
34
+ import { Timestamp } from "@astryxdesign/core/Timestamp";
35
+ import { Token } from "@astryxdesign/core/Token";
36
+ import { Toolbar } from "@astryxdesign/core/Toolbar";
37
+ import { VisuallyHidden } from "@astryxdesign/core/VisuallyHidden";
38
+ import { AtSign, ChevronRight, Copy, FileText, Paperclip, Share2, X } from "lucide-react";
39
+ import { type CSSProperties, useState } from "react";
54
40
 
55
41
  // Below this container width the split-pane collapses to a single chat column
56
42
  // and the artifact opens as a full-screen dialog instead. Single source:
@@ -60,55 +46,53 @@ import {
60
46
  // the 640px default artifact panel.
61
47
  const MOBILE_MAX_WIDTH = 1023;
62
48
  const root: CSSProperties = {
63
- // The viewer owns its chrome: the root fills the viewport and the message
64
- // list plus artifact body scroll inside it (editor pattern).
65
- height: '100dvh',
66
- width: '100%',
49
+ // The viewer owns its chrome: the root fills the viewport and the message
50
+ // list plus artifact body scroll inside it (editor pattern).
51
+ height: "100dvh",
52
+ width: "100%",
67
53
  };
68
54
  const chatColumn: CSSProperties = {
69
- flex: 1,
70
- width: '100%',
71
- minWidth: 0,
72
- height: '100%',
55
+ flex: 1,
56
+ width: "100%",
57
+ minWidth: 0,
58
+ height: "100%",
73
59
  };
74
60
  const chatLayout: CSSProperties = {
75
- flex: 1,
76
- minHeight: 0,
61
+ flex: 1,
62
+ minHeight: 0,
77
63
  };
78
64
  // ChatMessage already separates its children by --spacing-2, so this doubles
79
65
  // that step to set the attached document apart from its bubble. --space-gap
80
66
  // (24px) is a layout gutter, not an in-message rhythm.
81
67
  const artifactCard: CSSProperties = {
82
- marginBlockStart: 'var(--spacing-2)',
68
+ marginBlockStart: "var(--spacing-2)",
83
69
  };
84
70
  const artifactScroll: CSSProperties = {
85
- flex: 1,
86
- overflowY: 'auto',
71
+ flex: 1,
72
+ overflowY: "auto",
87
73
  };
88
74
  const articleBody: CSSProperties = {
89
- maxWidth: 720,
90
- marginInline: 'auto',
75
+ maxWidth: 720,
76
+ marginInline: "auto",
91
77
  };
92
78
 
93
79
  // Width for the artifact panel. Plain style object — the panel unmounts below
94
80
  // the breakpoint (see useMediaQuery in the component), so no container query
95
81
  // or <style> tag is needed to hide it.
96
82
  const artifactPanelWidthVar = (size: number | string): CSSProperties =>
97
- ({
98
- width: typeof size === 'number' ? `${size}px` : size,
99
- flexShrink: 0,
100
- overflow: 'hidden',
101
- }) as CSSProperties;
83
+ ({
84
+ width: typeof size === "number" ? `${size}px` : size,
85
+ flexShrink: 0,
86
+ overflow: "hidden",
87
+ }) as CSSProperties;
102
88
 
103
89
  // Artifact content
104
90
 
105
- const MENTION_TOKENS = [
106
- {value: '@agent', label: '@Agent', variant: 'cyan' as const},
107
- ];
91
+ const MENTION_TOKENS = [{ value: "@agent", label: "@Agent", variant: "cyan" as const }];
108
92
 
109
- const ARTIFACT_TITLE = 'JWT Token Refresh: Design & Rollout';
93
+ const ARTIFACT_TITLE = "JWT Token Refresh: Design & Rollout";
110
94
 
111
- const ARTIFACT_SUBTITLE = 'Grimoire · Sealed just now';
95
+ const ARTIFACT_SUBTITLE = "Grimoire · Sealed just now";
112
96
 
113
97
  const ARTIFACT_CONTENT = `## Overview
114
98
 
@@ -155,272 +139,266 @@ The refresh path is covered end to end:
155
139
  // Copy/Share live in both surfaces: desktop toolbar buttons and the mobile
156
140
  // overflow menu. One items array so the two can't drift.
157
141
  const ARTIFACT_ACTION_ITEMS = [
158
- {label: 'Copy', icon: Copy},
159
- {label: 'Share', icon: Share2},
142
+ { label: "Copy", icon: Copy },
143
+ { label: "Share", icon: Share2 },
160
144
  ] as const;
161
145
 
162
146
  // Header actions: version menu, copy, share. Pass `onClose` for the desktop
163
147
  // close button. A fragment so each control is a direct child of the toolbar.
164
- function ArtifactActions({onClose}: {onClose?: () => void}) {
165
- return (
166
- <>
167
- <DropdownMenu
168
- button={{
169
- label: 'v2',
170
- variant: 'ghost',
171
- size: 'sm',
172
- }}
173
- items={[{label: 'v2 (current)'}, {label: 'v1'}]}
174
- />
175
- {ARTIFACT_ACTION_ITEMS.map(item => (
176
- <Button
177
- key={item.label}
178
- label={item.label}
179
- variant="ghost"
180
- size="sm"
181
- icon={<Icon icon={item.icon} size="sm" />}
182
- isIconOnly
183
- />
184
- ))}
185
- {onClose != null && (
186
- <Button
187
- label="Close document"
188
- variant="ghost"
189
- size="sm"
190
- icon={<Icon icon={X} size="sm" />}
191
- isIconOnly
192
- onClick={onClose}
193
- />
194
- )}
195
- </>
196
- );
148
+ function ArtifactActions({ onClose }: { onClose?: () => void }) {
149
+ return (
150
+ <>
151
+ <DropdownMenu
152
+ button={{
153
+ label: "v2",
154
+ variant: "ghost",
155
+ size: "sm",
156
+ }}
157
+ items={[{ label: "v2 (current)" }, { label: "v1" }]}
158
+ />
159
+ {ARTIFACT_ACTION_ITEMS.map((item) => (
160
+ <Button
161
+ key={item.label}
162
+ label={item.label}
163
+ variant="ghost"
164
+ size="sm"
165
+ icon={<Icon icon={item.icon} size="sm" />}
166
+ isIconOnly
167
+ />
168
+ ))}
169
+ {onClose != null && (
170
+ <Button
171
+ label="Close document"
172
+ variant="ghost"
173
+ size="sm"
174
+ icon={<Icon icon={X} size="sm" />}
175
+ isIconOnly
176
+ onClick={onClose}
177
+ />
178
+ )}
179
+ </>
180
+ );
197
181
  }
198
182
 
199
183
  // Mobile variant: the actions collapse into an overflow menu.
200
184
  function MobileArtifactActions() {
201
- return (
202
- <MoreMenu
203
- label="Document actions"
204
- size="sm"
205
- items={[
206
- {
207
- type: 'section',
208
- title: 'Version',
209
- items: [{label: 'v2 (current)'}, {label: 'v1'}],
210
- },
211
- {type: 'divider'},
212
- ...ARTIFACT_ACTION_ITEMS,
213
- ]}
214
- />
215
- );
185
+ return (
186
+ <MoreMenu
187
+ label="Document actions"
188
+ size="sm"
189
+ items={[
190
+ {
191
+ type: "section",
192
+ title: "Version",
193
+ items: [{ label: "v2 (current)" }, { label: "v1" }],
194
+ },
195
+ { type: "divider" },
196
+ ...ARTIFACT_ACTION_ITEMS,
197
+ ]}
198
+ />
199
+ );
216
200
  }
217
201
 
218
202
  // Scrollable artifact content — the formatted document, no heading. The
219
203
  // desktop panel renders ArtifactBody above it; the mobile dialog renders its
220
204
  // title in DialogHeader instead, so both share this rather than a flag prop.
221
205
  function ArtifactContent() {
222
- return <Markdown>{ARTIFACT_CONTENT}</Markdown>;
206
+ return <Markdown>{ARTIFACT_CONTENT}</Markdown>;
223
207
  }
224
208
  // Desktop body: in-body heading plus the shared content.
225
209
  function ArtifactBody() {
226
- return (
227
- <Section
228
- variant="transparent"
229
- style={artifactScroll}
230
- role="region"
231
- aria-label={ARTIFACT_TITLE}
232
- tabIndex={0}>
233
- <VStack gap={2} style={articleBody}>
234
- <Heading level={2} type="display-2">
235
- {ARTIFACT_TITLE}
236
- </Heading>
237
- <ArtifactContent />
238
- </VStack>
239
- </Section>
240
- );
210
+ return (
211
+ <Section
212
+ variant="transparent"
213
+ style={artifactScroll}
214
+ role="region"
215
+ aria-label={ARTIFACT_TITLE}
216
+ tabIndex={0}
217
+ >
218
+ <VStack gap={2} style={articleBody}>
219
+ <Heading level={2} type="display-2">
220
+ {ARTIFACT_TITLE}
221
+ </Heading>
222
+ <ArtifactContent />
223
+ </VStack>
224
+ </Section>
225
+ );
241
226
  }
242
227
 
243
228
  // In-message card that opens the artifact panel/dialog.
244
- function ArtifactCard({onOpen}: {onOpen: () => void}) {
245
- return (
246
- <ClickableCard
247
- label={`Open ${ARTIFACT_TITLE}`}
248
- onClick={onOpen}
249
- variant="muted"
250
- padding={3}
251
- maxWidth={360}
252
- style={artifactCard}>
253
- <HStack gap={3} vAlign="center" width="100%">
254
- <Icon icon={FileText} size="md" color="secondary" />
255
- <StackItem size="fill">
256
- <VStack gap={0}>
257
- <Text type="label" weight="semibold">
258
- {ARTIFACT_TITLE}
259
- </Text>
260
- <Text type="supporting" color="secondary">
261
- Grimoire
262
- </Text>
263
- </VStack>
264
- </StackItem>
265
- <Icon icon={ChevronRight} size="sm" color="secondary" />
266
- </HStack>
267
- </ClickableCard>
268
- );
229
+ function ArtifactCard({ onOpen }: { onOpen: () => void }) {
230
+ return (
231
+ <ClickableCard
232
+ label={`Open ${ARTIFACT_TITLE}`}
233
+ onClick={onOpen}
234
+ variant="muted"
235
+ padding={3}
236
+ maxWidth={360}
237
+ style={artifactCard}
238
+ >
239
+ <HStack gap={3} vAlign="center" width="100%">
240
+ <Icon icon={FileText} size="md" color="secondary" />
241
+ <StackItem size="fill">
242
+ <VStack gap={0}>
243
+ <Text type="label" weight="semibold">
244
+ {ARTIFACT_TITLE}
245
+ </Text>
246
+ <Text type="supporting" color="secondary">
247
+ Grimoire
248
+ </Text>
249
+ </VStack>
250
+ </StackItem>
251
+ <Icon icon={ChevronRight} size="sm" color="secondary" />
252
+ </HStack>
253
+ </ClickableCard>
254
+ );
269
255
  }
270
256
 
271
257
  // Main component
272
258
 
273
259
  export default function AiChat() {
274
- const [composerMode, setComposerMode] = useState('ask');
275
- // Mobile shows the artifact as a full-screen dialog; desktop as a side panel.
276
- const [isArtifactDialogOpen, setIsArtifactDialogOpen] = useState(false);
277
- const [isArtifactOpen, setIsArtifactOpen] = useState(true);
278
- const artifactResize = useResizable({
279
- defaultSize: 640,
280
- minSize: 480,
281
- maxSize: 960,
282
- autoSaveId: 'ai-chat-artifact-panel',
283
- });
284
-
285
- // Single source for the breakpoint: the media query both gates the panel
286
- // below and routes openArtifact, so the split-pane and the dialog target
287
- // can't disagree about which surface is live.
288
- const isMobileWidth = useMediaQuery(`(max-width: ${MOBILE_MAX_WIDTH}px)`);
289
- const openArtifact = () => {
290
- if (isMobileWidth) {
291
- setIsArtifactDialogOpen(true);
292
- } else {
293
- setIsArtifactOpen(true);
294
- }
295
- };
296
-
297
- return (
298
- <VStack style={root}>
299
- <Layout
300
- height="fill"
301
- content={
302
- <LayoutContent padding={0}>
303
- <HStack height="100%">
304
- {/* Chat column — flexes to fill the space the artifact leaves */}
305
- <VStack style={chatColumn}>
306
- <ChatLayout
307
- density="spacious"
308
- style={chatLayout}
309
- composer={
310
- <ChatComposer
311
- onSubmit={() => {}}
312
- placeholder={
313
- composerMode === 'ask'
314
- ? 'Ask the night anything...'
315
- : 'Describe the rite...'
316
- }
317
- input={<ChatComposerInput />}
318
- headerActions={
319
- <>
320
- <Button
321
- label="Mention"
322
- variant="ghost"
323
- size="sm"
324
- icon={<Icon icon={AtSign} size="sm" />}
325
- isIconOnly
326
- />
327
- <Button
328
- label="Attach"
329
- variant="ghost"
330
- size="sm"
331
- icon={<Icon icon={Paperclip} size="sm" />}
332
- isIconOnly
333
- />
334
- </>
335
- }
336
- footerActions={
337
- <DropdownMenu
338
- button={{
339
- label: composerMode === 'ask' ? 'Ask' : 'Edit',
340
- variant: 'ghost',
341
- size: 'sm',
342
- }}
343
- items={[
344
- {
345
- label: 'Ask',
346
- onClick: () => setComposerMode('ask'),
347
- },
348
- {
349
- label: 'Edit',
350
- onClick: () => setComposerMode('edit'),
351
- },
352
- ]}
353
- />
354
- }
355
- />
356
- }>
357
- <VisuallyHidden as="h1">Night thread</VisuallyHidden>
358
- <ChatMessageList>
359
- {/* Date divider */}
360
- <ChatSystemMessage variant="divider">
361
- Today
362
- </ChatSystemMessage>
363
-
364
- {/* User message: mention + file attachments */}
365
- <ChatMessage sender="user">
366
- <HStack gap={1} wrap="wrap">
367
- <Token label="auth-service.ts" />
368
- <Token label="middleware.ts" />
369
- </HStack>
370
- <ChatMessageBubble
371
- metadata={
372
- <ChatMessageMetadata
373
- timestamp={
374
- <Timestamp
375
- value="2026-04-29T10:15:00"
376
- format="time"
377
- />
378
- }
379
- />
380
- }>
381
- <ChatTokenizedText tokens={MENTION_TOKENS}>
382
- @agent Can you review these auth files? The JWT
383
- refresh logic seems broken, tokens expire but the
384
- middleware doesn't catch it.
385
- </ChatTokenizedText>
386
- </ChatMessageBubble>
387
- </ChatMessage>
388
-
389
- {/* Assistant message: tool calls, markdown, code block */}
390
- <ChatMessage
391
- sender="assistant"
392
- avatar={<Avatar name="Agent" size="md" />}>
393
- <ChatMessageBubble variant="ghost">
394
- Looking into the auth files now. Let me read through the
395
- code and trace the token refresh flow.
396
- </ChatMessageBubble>
397
- <ChatToolCalls
398
- defaultIsExpanded
399
- calls={[
400
- {
401
- name: 'read',
402
- target: 'auth-service.ts',
403
- status: 'complete',
404
- duration: '45ms',
405
- },
406
- {
407
- name: 'read',
408
- target: 'middleware.ts',
409
- status: 'complete',
410
- duration: '38ms',
411
- },
412
- {
413
- name: 'bash',
414
- target: 'grep -rn "refreshToken" src/',
415
- status: 'complete',
416
- duration: '120ms',
417
- node: 'cli:remote-server',
418
- },
419
- ]}
420
- />
421
-
422
- <ChatMessageBubble variant="ghost">
423
- <Markdown density="compact">{`Found the issue. In \`middleware.ts\`, the token validation runs **before** the refresh check. When a token expires, the middleware rejects the request immediately instead of attempting a refresh.
260
+ const [composerMode, setComposerMode] = useState("ask");
261
+ // Mobile shows the artifact as a full-screen dialog; desktop as a side panel.
262
+ const [isArtifactDialogOpen, setIsArtifactDialogOpen] = useState(false);
263
+ const [isArtifactOpen, setIsArtifactOpen] = useState(true);
264
+ const artifactResize = useResizable({
265
+ defaultSize: 640,
266
+ minSize: 480,
267
+ maxSize: 960,
268
+ autoSaveId: "ai-chat-artifact-panel",
269
+ });
270
+
271
+ // Single source for the breakpoint: the media query both gates the panel
272
+ // below and routes openArtifact, so the split-pane and the dialog target
273
+ // can't disagree about which surface is live.
274
+ const isMobileWidth = useMediaQuery(`(max-width: ${MOBILE_MAX_WIDTH}px)`);
275
+ const openArtifact = () => {
276
+ if (isMobileWidth) {
277
+ setIsArtifactDialogOpen(true);
278
+ } else {
279
+ setIsArtifactOpen(true);
280
+ }
281
+ };
282
+
283
+ return (
284
+ <VStack style={root}>
285
+ <Layout
286
+ height="fill"
287
+ content={
288
+ <LayoutContent padding={0}>
289
+ <HStack height="100%">
290
+ {/* Chat column — flexes to fill the space the artifact leaves */}
291
+ <VStack style={chatColumn}>
292
+ <ChatLayout
293
+ density="spacious"
294
+ style={chatLayout}
295
+ composer={
296
+ <ChatComposer
297
+ onSubmit={() => {}}
298
+ placeholder={
299
+ composerMode === "ask"
300
+ ? "Ask the night anything..."
301
+ : "Describe the rite..."
302
+ }
303
+ input={<ChatComposerInput />}
304
+ headerActions={
305
+ <>
306
+ <Button
307
+ label="Mention"
308
+ variant="ghost"
309
+ size="sm"
310
+ icon={<Icon icon={AtSign} size="sm" />}
311
+ isIconOnly
312
+ />
313
+ <Button
314
+ label="Attach"
315
+ variant="ghost"
316
+ size="sm"
317
+ icon={<Icon icon={Paperclip} size="sm" />}
318
+ isIconOnly
319
+ />
320
+ </>
321
+ }
322
+ footerActions={
323
+ <DropdownMenu
324
+ button={{
325
+ label: composerMode === "ask" ? "Ask" : "Edit",
326
+ variant: "ghost",
327
+ size: "sm",
328
+ }}
329
+ items={[
330
+ {
331
+ label: "Ask",
332
+ onClick: () => setComposerMode("ask"),
333
+ },
334
+ {
335
+ label: "Edit",
336
+ onClick: () => setComposerMode("edit"),
337
+ },
338
+ ]}
339
+ />
340
+ }
341
+ />
342
+ }
343
+ >
344
+ <VisuallyHidden as="h1">Night thread</VisuallyHidden>
345
+ <ChatMessageList>
346
+ {/* Date divider */}
347
+ <ChatSystemMessage variant="divider">Today</ChatSystemMessage>
348
+
349
+ {/* User message: mention + file attachments */}
350
+ <ChatMessage sender="user">
351
+ <HStack gap={1} wrap="wrap">
352
+ <Token label="auth-service.ts" />
353
+ <Token label="middleware.ts" />
354
+ </HStack>
355
+ <ChatMessageBubble
356
+ metadata={
357
+ <ChatMessageMetadata
358
+ timestamp={<Timestamp value="2026-04-29T10:15:00" format="time" />}
359
+ />
360
+ }
361
+ >
362
+ <ChatTokenizedText tokens={MENTION_TOKENS}>
363
+ @agent Can you review these auth files? The JWT refresh logic seems
364
+ broken, tokens expire but the middleware doesn't catch it.
365
+ </ChatTokenizedText>
366
+ </ChatMessageBubble>
367
+ </ChatMessage>
368
+
369
+ {/* Assistant message: tool calls, markdown, code block */}
370
+ <ChatMessage sender="assistant" avatar={<Avatar name="Agent" size="md" />}>
371
+ <ChatMessageBubble variant="ghost">
372
+ Looking into the auth files now. Let me read through the code and trace the
373
+ token refresh flow.
374
+ </ChatMessageBubble>
375
+ <ChatToolCalls
376
+ defaultIsExpanded
377
+ calls={[
378
+ {
379
+ name: "read",
380
+ target: "auth-service.ts",
381
+ status: "complete",
382
+ duration: "45ms",
383
+ },
384
+ {
385
+ name: "read",
386
+ target: "middleware.ts",
387
+ status: "complete",
388
+ duration: "38ms",
389
+ },
390
+ {
391
+ name: "bash",
392
+ target: 'grep -rn "refreshToken" src/',
393
+ status: "complete",
394
+ duration: "120ms",
395
+ node: "cli:remote-server",
396
+ },
397
+ ]}
398
+ />
399
+
400
+ <ChatMessageBubble variant="ghost">
401
+ <Markdown density="compact">{`Found the issue. In \`middleware.ts\`, the token validation runs **before** the refresh check. When a token expires, the middleware rejects the request immediately instead of attempting a refresh.
424
402
 
425
403
  Here's the problematic sequence:
426
404
 
@@ -429,14 +407,14 @@ Here's the problematic sequence:
429
407
  3. The catch block returns \`401\`, never reaching \`refreshToken()\`
430
408
 
431
409
  The fix is to catch \`TokenExpiredError\` specifically and attempt a refresh before rejecting:`}</Markdown>
432
- </ChatMessageBubble>
433
-
434
- <ChatMessageBubble variant="ghost">
435
- <CodeBlock
436
- title="middleware.ts"
437
- language="typescript"
438
- width="100%"
439
- code={`async function authMiddleware(req: Request) {
410
+ </ChatMessageBubble>
411
+
412
+ <ChatMessageBubble variant="ghost">
413
+ <CodeBlock
414
+ title="middleware.ts"
415
+ language="typescript"
416
+ width="100%"
417
+ code={`async function authMiddleware(req: Request) {
440
418
  try {
441
419
  const decoded = validateToken(req.headers.authorization);
442
420
  req.user = decoded;
@@ -454,91 +432,80 @@ The fix is to catch \`TokenExpiredError\` specifically and attempt a refresh bef
454
432
  }
455
433
  return next(req);
456
434
  }`}
457
- />
458
- </ChatMessageBubble>
459
-
460
- <ChatToolCalls
461
- calls={[
462
- {
463
- name: 'edit',
464
- target: 'middleware.ts',
465
- status: 'complete',
466
- duration: '85ms',
467
- additions: 8,
468
- deletions: 2,
469
- },
470
- ]}
471
- />
472
-
473
- <ChatMessageMetadata
474
- timestamp={
475
- <Timestamp
476
- value="2026-04-29T10:15:30"
477
- format="time"
478
- />
479
- }
480
- footer={
481
- <Text type="supporting" color="secondary">
482
- Agent
483
- </Text>
484
- }
485
- />
486
- </ChatMessage>
487
-
488
- {/* User message: multi-bubble grouping */}
489
- <ChatMessage sender="user">
490
- <ChatMessageBubble group="first">
491
- Nice catch, that makes sense
492
- </ChatMessageBubble>
493
- <ChatMessageBubble
494
- group="last"
495
- metadata={
496
- <ChatMessageMetadata
497
- timestamp={
498
- <Timestamp
499
- value="2026-04-29T10:16:00"
500
- format="time"
501
- />
502
- }
503
- status="delivered"
504
- />
505
- }>
506
- Can you also add a test for the refresh path?
507
- </ChatMessageBubble>
508
- </ChatMessage>
509
-
510
- {/* Assistant message: test results table + code block */}
511
- <ChatMessage
512
- sender="assistant"
513
- avatar={<Avatar name="Agent" size="md" />}>
514
- <ChatToolCalls
515
- defaultIsExpanded
516
- calls={[
517
- {
518
- name: 'read',
519
- target: 'middleware.test.ts',
520
- status: 'complete',
521
- duration: '32ms',
522
- },
523
- {
524
- name: 'edit',
525
- target: 'middleware.test.ts',
526
- status: 'complete',
527
- duration: '110ms',
528
- additions: 24,
529
- deletions: 0,
530
- },
531
- {
532
- name: 'bash',
533
- target: 'yarn test middleware',
534
- status: 'complete',
535
- duration: '3.2s',
536
- node: 'cli:remote-server',
537
- },
538
- ]}
539
- />
540
- <ChatMessageBubble variant="ghost">
541
- <Markdown density="compact">{`Added a test for the refresh flow. All **4 tests** pass:
435
+ />
436
+ </ChatMessageBubble>
437
+
438
+ <ChatToolCalls
439
+ calls={[
440
+ {
441
+ name: "edit",
442
+ target: "middleware.ts",
443
+ status: "complete",
444
+ duration: "85ms",
445
+ additions: 8,
446
+ deletions: 2,
447
+ },
448
+ ]}
449
+ />
450
+
451
+ <ChatMessageMetadata
452
+ timestamp={<Timestamp value="2026-04-29T10:15:30" format="time" />}
453
+ footer={
454
+ <Text type="supporting" color="secondary">
455
+ Agent
456
+ </Text>
457
+ }
458
+ />
459
+ </ChatMessage>
460
+
461
+ {/* User message: multi-bubble grouping */}
462
+ <ChatMessage sender="user">
463
+ <ChatMessageBubble group="first">
464
+ Nice catch, that makes sense
465
+ </ChatMessageBubble>
466
+ <ChatMessageBubble
467
+ group="last"
468
+ metadata={
469
+ <ChatMessageMetadata
470
+ timestamp={<Timestamp value="2026-04-29T10:16:00" format="time" />}
471
+ status="delivered"
472
+ />
473
+ }
474
+ >
475
+ Can you also add a test for the refresh path?
476
+ </ChatMessageBubble>
477
+ </ChatMessage>
478
+
479
+ {/* Assistant message: test results table + code block */}
480
+ <ChatMessage sender="assistant" avatar={<Avatar name="Agent" size="md" />}>
481
+ <ChatToolCalls
482
+ defaultIsExpanded
483
+ calls={[
484
+ {
485
+ name: "read",
486
+ target: "middleware.test.ts",
487
+ status: "complete",
488
+ duration: "32ms",
489
+ },
490
+ {
491
+ name: "edit",
492
+ target: "middleware.test.ts",
493
+ status: "complete",
494
+ duration: "110ms",
495
+ additions: 24,
496
+ deletions: 0,
497
+ },
498
+ {
499
+ name: "bash",
500
+ target: "yarn test middleware",
501
+ status: "complete",
502
+ duration: "3.2s",
503
+ node: "cli:remote-server",
504
+ },
505
+ ]}
506
+ />
507
+ <ChatMessageBubble variant="ghost">
508
+ <Markdown density="compact">{`Added a test for the refresh flow. All **4 tests** pass:
542
509
 
543
510
  | Test | Status |
544
511
  |------|--------|
@@ -546,14 +513,14 @@ The fix is to catch \`TokenExpiredError\` specifically and attempt a refresh bef
546
513
  | Expired token triggers refresh | ✅ |
547
514
  | Expired token with invalid refresh returns 401 | ✅ |
548
515
  | Malformed token returns 401 immediately | ✅ |`}</Markdown>
549
- </ChatMessageBubble>
550
-
551
- <ChatMessageBubble variant="ghost">
552
- <CodeBlock
553
- title="middleware.test.ts"
554
- language="typescript"
555
- width="100%"
556
- code={`describe('authMiddleware', () => {
516
+ </ChatMessageBubble>
517
+
518
+ <ChatMessageBubble variant="ghost">
519
+ <CodeBlock
520
+ title="middleware.test.ts"
521
+ language="typescript"
522
+ width="100%"
523
+ code={`describe('authMiddleware', () => {
557
524
  it('refreshes an expired token silently', async () => {
558
525
  const expiredToken = createExpiredJWT(mockUser);
559
526
  const validRefresh = createRefreshToken(mockUser);
@@ -570,201 +537,165 @@ The fix is to catch \`TokenExpiredError\` specifically and attempt a refresh bef
570
537
  expect(req.newAccessToken).toBeDefined();
571
538
  });
572
539
  });`}
573
- />
574
- </ChatMessageBubble>
575
- <ChatMessageMetadata
576
- timestamp={
577
- <Timestamp
578
- value="2026-04-29T10:16:45"
579
- format="time"
580
- />
581
- }
582
- />
583
- </ChatMessage>
584
-
585
- {/* Status message */}
586
- <ChatSystemMessage>
587
- Changes sealed in the crypt
588
- </ChatSystemMessage>
589
-
590
- {/* User message: requests a document artifact */}
591
- <ChatMessage sender="user">
592
- <ChatMessageBubble
593
- metadata={
594
- <ChatMessageMetadata
595
- timestamp={
596
- <Timestamp
597
- value="2026-04-29T10:18:00"
598
- format="time"
599
- />
600
- }
601
- />
602
- }>
603
- Looks solid. Before I open the PR, can you write up a
604
- short design doc explaining the token-refresh flow for
605
- the team?
606
- </ChatMessageBubble>
607
- </ChatMessage>
608
-
609
- {/* Assistant message: artifact card */}
610
- <ChatMessage
611
- sender="assistant"
612
- avatar={<Avatar name="Agent" size="md" />}>
613
- <ChatMessageBubble variant="ghost">
614
- <Markdown density="compact">
615
- {`I've drafted a design doc covering the problem, the fix, and the test matrix, pulling straight from the changes we just made.\n\nOpen the document below to review it. Want me to expand any section?`}
616
- </Markdown>
617
- </ChatMessageBubble>
618
- <ArtifactCard onOpen={openArtifact} />
619
- <ChatMessageMetadata
620
- timestamp={
621
- <Timestamp
622
- value="2026-04-29T10:18:40"
623
- format="time"
624
- />
625
- }
626
- />
627
- </ChatMessage>
628
-
629
- {/* User follow-up */}
630
- <ChatMessage sender="user">
631
- <ChatMessageBubble
632
- metadata={
633
- <ChatMessageMetadata
634
- timestamp={
635
- <Timestamp
636
- value="2026-04-29T10:20:00"
637
- format="time"
638
- />
639
- }
640
- status="delivered"
641
- />
642
- }>
643
- This is great. Can you add a section on rollout and
644
- monitoring at the end?
645
- </ChatMessageBubble>
646
- </ChatMessage>
647
-
648
- {/* Assistant message: in-progress tool call */}
649
- <ChatMessage
650
- sender="assistant"
651
- avatar={<Avatar name="Agent" size="md" />}>
652
- <ChatMessageBubble variant="ghost">
653
- <Markdown density="compact">
654
- {`On it: adding a **Rollout & Monitoring** section with a staged flag ramp and the alert thresholds. Updating the document now.`}
655
- </Markdown>
656
- </ChatMessageBubble>
657
- <ChatToolCalls
658
- calls={[
659
- {
660
- name: 'edit',
661
- target: 'docs/token-refresh.md',
662
- status: 'running',
663
- node: 'cli:remote-server',
664
- },
665
- ]}
666
- />
667
- <ChatMessageMetadata
668
- timestamp={
669
- <Timestamp
670
- value="2026-04-29T10:20:30"
671
- format="time"
672
- />
673
- }
674
- />
675
- </ChatMessage>
676
- </ChatMessageList>
677
- </ChatLayout>
678
- </VStack>
679
-
680
- {/* Desktop split-pane: resize handle + artifact panel. Gated on
540
+ />
541
+ </ChatMessageBubble>
542
+ <ChatMessageMetadata
543
+ timestamp={<Timestamp value="2026-04-29T10:16:45" format="time" />}
544
+ />
545
+ </ChatMessage>
546
+
547
+ {/* Status message */}
548
+ <ChatSystemMessage>Changes sealed in the crypt</ChatSystemMessage>
549
+
550
+ {/* User message: requests a document artifact */}
551
+ <ChatMessage sender="user">
552
+ <ChatMessageBubble
553
+ metadata={
554
+ <ChatMessageMetadata
555
+ timestamp={<Timestamp value="2026-04-29T10:18:00" format="time" />}
556
+ />
557
+ }
558
+ >
559
+ Looks solid. Before I open the PR, can you write up a short design doc
560
+ explaining the token-refresh flow for the team?
561
+ </ChatMessageBubble>
562
+ </ChatMessage>
563
+
564
+ {/* Assistant message: artifact card */}
565
+ <ChatMessage sender="assistant" avatar={<Avatar name="Agent" size="md" />}>
566
+ <ChatMessageBubble variant="ghost">
567
+ <Markdown density="compact">
568
+ {`I've drafted a design doc covering the problem, the fix, and the test matrix, pulling straight from the changes we just made.\n\nOpen the document below to review it. Want me to expand any section?`}
569
+ </Markdown>
570
+ </ChatMessageBubble>
571
+ <ArtifactCard onOpen={openArtifact} />
572
+ <ChatMessageMetadata
573
+ timestamp={<Timestamp value="2026-04-29T10:18:40" format="time" />}
574
+ />
575
+ </ChatMessage>
576
+
577
+ {/* User follow-up */}
578
+ <ChatMessage sender="user">
579
+ <ChatMessageBubble
580
+ metadata={
581
+ <ChatMessageMetadata
582
+ timestamp={<Timestamp value="2026-04-29T10:20:00" format="time" />}
583
+ status="delivered"
584
+ />
585
+ }
586
+ >
587
+ This is great. Can you add a section on rollout and monitoring at the end?
588
+ </ChatMessageBubble>
589
+ </ChatMessage>
590
+
591
+ {/* Assistant message: in-progress tool call */}
592
+ <ChatMessage sender="assistant" avatar={<Avatar name="Agent" size="md" />}>
593
+ <ChatMessageBubble variant="ghost">
594
+ <Markdown density="compact">
595
+ {`On it: adding a **Rollout & Monitoring** section with a staged flag ramp and the alert thresholds. Updating the document now.`}
596
+ </Markdown>
597
+ </ChatMessageBubble>
598
+ <ChatToolCalls
599
+ calls={[
600
+ {
601
+ name: "edit",
602
+ target: "docs/token-refresh.md",
603
+ status: "running",
604
+ node: "cli:remote-server",
605
+ },
606
+ ]}
607
+ />
608
+ <ChatMessageMetadata
609
+ timestamp={<Timestamp value="2026-04-29T10:20:30" format="time" />}
610
+ />
611
+ </ChatMessage>
612
+ </ChatMessageList>
613
+ </ChatLayout>
614
+ </VStack>
615
+
616
+ {/* Desktop split-pane: resize handle + artifact panel. Gated on
681
617
  the same media query that routes openArtifact, so shrinking
682
618
  the window while open moves to the dialog instead of
683
619
  squeezing the chat into a rail. */}
684
- {isArtifactOpen && !isMobileWidth && (
685
- <>
686
- <ResizeHandle
687
- direction="horizontal"
688
- resizable={artifactResize.props}
689
- isReversed
690
- pillPlacement="start"
691
- hasDivider
692
- label="Resize artifact panel"
693
- />
694
-
695
- {/* Toolbar as the card header, body below */}
696
- <Card
697
- variant="transparent"
698
- height="100%"
699
- style={artifactPanelWidthVar(artifactResize.size)}>
700
- <Toolbar
701
- label="Artifact actions"
702
- dividers={['bottom']}
703
- startContent={
704
- <HStack gap={3} vAlign="center">
705
- <Icon
706
- icon={FileText}
707
- size="sm"
708
- color="secondary"
709
- />
710
- <VStack gap={0}>
711
- <Text type="label" weight="semibold">
712
- {ARTIFACT_TITLE}
713
- </Text>
714
- <Text type="supporting" color="secondary">
715
- {ARTIFACT_SUBTITLE}
716
- </Text>
717
- </VStack>
718
- </HStack>
719
- }
720
- endContent={
721
- <ArtifactActions
722
- onClose={() => setIsArtifactOpen(false)}
723
- />
724
- }
725
- />
726
-
727
- <ArtifactBody />
728
- </Card>
729
- </>
730
- )}
731
- </HStack>
732
- </LayoutContent>
733
- }
734
- />
735
- {/* Mobile artifact view — full-screen Dialog */}
736
- <Dialog
737
- isOpen={isArtifactDialogOpen}
738
- onOpenChange={setIsArtifactDialogOpen}
739
- purpose="info"
740
- variant="fullscreen">
741
- <Layout
742
- height="auto"
743
- header={
744
- <DialogHeader
745
- title={ARTIFACT_TITLE}
746
- subtitle={ARTIFACT_SUBTITLE}
747
- hasDivider
748
- onOpenChange={setIsArtifactDialogOpen}
749
- endContent={<MobileArtifactActions />}
750
- />
751
- }
752
- content={
753
- <LayoutContent padding={0}>
754
- <Section
755
- variant="transparent"
756
- style={artifactScroll}
757
- role="region"
758
- aria-label={ARTIFACT_TITLE}
759
- tabIndex={0}>
760
- <VStack gap={2} style={articleBody}>
761
- <ArtifactContent />
762
- </VStack>
763
- </Section>
764
- </LayoutContent>
765
- }
766
- />
767
- </Dialog>
768
- </VStack>
769
- );
620
+ {isArtifactOpen && !isMobileWidth && (
621
+ <>
622
+ <ResizeHandle
623
+ direction="horizontal"
624
+ resizable={artifactResize.props}
625
+ isReversed
626
+ pillPlacement="start"
627
+ hasDivider
628
+ label="Resize artifact panel"
629
+ />
630
+
631
+ {/* Toolbar as the card header, body below */}
632
+ <Card
633
+ variant="transparent"
634
+ height="100%"
635
+ style={artifactPanelWidthVar(artifactResize.size)}
636
+ >
637
+ <Toolbar
638
+ label="Artifact actions"
639
+ dividers={["bottom"]}
640
+ startContent={
641
+ <HStack gap={3} vAlign="center">
642
+ <Icon icon={FileText} size="sm" color="secondary" />
643
+ <VStack gap={0}>
644
+ <Text type="label" weight="semibold">
645
+ {ARTIFACT_TITLE}
646
+ </Text>
647
+ <Text type="supporting" color="secondary">
648
+ {ARTIFACT_SUBTITLE}
649
+ </Text>
650
+ </VStack>
651
+ </HStack>
652
+ }
653
+ endContent={<ArtifactActions onClose={() => setIsArtifactOpen(false)} />}
654
+ />
655
+
656
+ <ArtifactBody />
657
+ </Card>
658
+ </>
659
+ )}
660
+ </HStack>
661
+ </LayoutContent>
662
+ }
663
+ />
664
+ {/* Mobile artifact view — full-screen Dialog */}
665
+ <Dialog
666
+ isOpen={isArtifactDialogOpen}
667
+ onOpenChange={setIsArtifactDialogOpen}
668
+ purpose="info"
669
+ variant="fullscreen"
670
+ >
671
+ <Layout
672
+ height="auto"
673
+ header={
674
+ <DialogHeader
675
+ title={ARTIFACT_TITLE}
676
+ subtitle={ARTIFACT_SUBTITLE}
677
+ hasDivider
678
+ onOpenChange={setIsArtifactDialogOpen}
679
+ endContent={<MobileArtifactActions />}
680
+ />
681
+ }
682
+ content={
683
+ <LayoutContent padding={0}>
684
+ <Section
685
+ variant="transparent"
686
+ style={artifactScroll}
687
+ role="region"
688
+ aria-label={ARTIFACT_TITLE}
689
+ tabIndex={0}
690
+ >
691
+ <VStack gap={2} style={articleBody}>
692
+ <ArtifactContent />
693
+ </VStack>
694
+ </Section>
695
+ </LayoutContent>
696
+ }
697
+ />
698
+ </Dialog>
699
+ </VStack>
700
+ );
770
701
  }