@shapesos/clay 0.11.0 → 0.12.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 +60 -0
- package/dist/artifacts.cjs +858 -132
- package/dist/artifacts.cjs.map +1 -1
- package/dist/artifacts.d.cts +38 -5
- package/dist/artifacts.d.ts +38 -5
- package/dist/artifacts.js +13 -3
- package/dist/blocks.cjs +1185 -467
- package/dist/blocks.cjs.map +1 -1
- package/dist/blocks.css +1 -1
- package/dist/blocks.d.cts +23 -10
- package/dist/blocks.d.ts +23 -10
- package/dist/blocks.js +6 -3
- package/dist/chart.cjs +594 -0
- package/dist/chart.cjs.map +1 -0
- package/dist/chart.d.cts +439 -0
- package/dist/chart.d.ts +439 -0
- package/dist/chart.js +32 -0
- package/dist/chat.cjs +1207 -489
- package/dist/chat.cjs.map +1 -1
- package/dist/chat.d.cts +3 -2
- package/dist/chat.d.ts +3 -2
- package/dist/chat.js +7 -4
- package/dist/{chunk-MXOPG747.js → chunk-36CB624W.js} +7 -7
- package/dist/chunk-36CB624W.js.map +1 -0
- package/dist/{chunk-L35M3OD5.js → chunk-4MZZH3WX.js} +5 -11
- package/dist/chunk-4MZZH3WX.js.map +1 -0
- package/dist/chunk-AQEJRMRN.js +1 -0
- package/dist/chunk-AQEJRMRN.js.map +1 -0
- package/dist/{chunk-OUW6PUEB.js → chunk-FFX3CAOX.js} +7 -7
- package/dist/chunk-P6GUNIAE.js +11 -0
- package/dist/chunk-P6GUNIAE.js.map +1 -0
- package/dist/chunk-QXGYMDIA.js +477 -0
- package/dist/chunk-QXGYMDIA.js.map +1 -0
- package/dist/{chunk-BX5TCEPR.js → chunk-Z5JWF24N.js} +388 -105
- package/dist/chunk-Z5JWF24N.js.map +1 -0
- package/dist/index.cjs +924 -198
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +23 -15
- package/dist/table.js +2 -1
- package/dist/types-B2aYk82c.d.cts +29 -0
- package/dist/types-B2aYk82c.d.ts +29 -0
- package/dist/types-C0BvwliI.d.cts +332 -0
- package/dist/types-C5bFH4v3.d.ts +332 -0
- package/dist/{types-DuuRI4ll.d.cts → types-DCutaXjZ.d.cts} +16 -1
- package/dist/{types-C9XX-Uhk.d.ts → types-uPfn67Dc.d.ts} +16 -1
- package/package.json +13 -1
- package/dist/chunk-BX5TCEPR.js.map +0 -1
- package/dist/chunk-L35M3OD5.js.map +0 -1
- package/dist/chunk-MEJESPTZ.js +0 -1
- package/dist/chunk-MXOPG747.js.map +0 -1
- package/dist/types-3Gzk7cRt.d.cts +0 -121
- package/dist/types-3Gzk7cRt.d.ts +0 -121
- /package/dist/{chunk-MEJESPTZ.js.map → chart.js.map} +0 -0
- /package/dist/{chunk-OUW6PUEB.js.map → chunk-FFX3CAOX.js.map} +0 -0
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import { C as ChartSeries } from './types-B2aYk82c.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Shared artifact primitives — the discriminator constant and the cross-variant `ArtifactBase`
|
|
6
|
+
* shape that every concrete artifact record extends.
|
|
7
|
+
*
|
|
8
|
+
* Pulled into its own file so the per-type `types.ts` files (`table-artifact/types.ts`,
|
|
9
|
+
* `chart-artifact/types.ts`) and the union assembler (`artifacts/types.ts`) can all depend on
|
|
10
|
+
* one canonical source without creating a circular module graph between them.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Artifact-type discriminator constants. Uppercase to match the server-side `artifactTypes`
|
|
14
|
+
* constant — io-server stores `artifact.type === "TABLE"` (aligned with the GraphQL enum).
|
|
15
|
+
*/
|
|
16
|
+
declare const artifactTypes: {
|
|
17
|
+
readonly TABLE: "TABLE";
|
|
18
|
+
readonly CHART: "CHART";
|
|
19
|
+
};
|
|
20
|
+
/** Discriminator for artifact types. Additive — new types extend this union. */
|
|
21
|
+
type ArtifactType = (typeof artifactTypes)[keyof typeof artifactTypes];
|
|
22
|
+
/** Common shape every artifact record carries. Discriminated by `type`. */
|
|
23
|
+
interface ArtifactBase<TType extends ArtifactType, TConfig> {
|
|
24
|
+
/** Artifact-type discriminator. */
|
|
25
|
+
type: TType;
|
|
26
|
+
/** Human-readable label. Nullable when the artifact has no title. */
|
|
27
|
+
title: string | null;
|
|
28
|
+
/** Rendering config — shape varies per artifact type. */
|
|
29
|
+
config: TConfig;
|
|
30
|
+
/** Protected-asset metadata pointing to the underlying data payload. Null while the asset is unavailable. */
|
|
31
|
+
protectedAsset: {
|
|
32
|
+
/** Time-limited URL the renderer fetches the artifact's data from. */
|
|
33
|
+
presignedUrl: string;
|
|
34
|
+
} | null;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A row inside an artifact's parsed CSV. Every cell is the raw string from the CSV (or `null`
|
|
38
|
+
* for the empty string). Used by every artifact kind whose data wire is a CSV (`TABLE`, `CHART`).
|
|
39
|
+
* The renderer never coerces — type-aware formatting is a server concern (the CSV's contents
|
|
40
|
+
* are what the user sees).
|
|
41
|
+
*/
|
|
42
|
+
type ArtifactDataRow = Record<string, string | null>;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Rendering config for a `BAR` chart. `xKey` selects the categorical axis; each series
|
|
46
|
+
* contributes one `<Bar>`. `stacked` collapses all series onto a single stack-id (so they sum
|
|
47
|
+
* vertically); when false / omitted bars are grouped side-by-side per x-tick.
|
|
48
|
+
*/
|
|
49
|
+
interface BarChartConfig extends ChartConfigBase {
|
|
50
|
+
variant: "BAR";
|
|
51
|
+
/** CSV column key used as the x-axis. */
|
|
52
|
+
xKey: string;
|
|
53
|
+
/** When true, stack all series on one stack-id. When false / omitted, group bars side-by-side. */
|
|
54
|
+
stacked?: boolean;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Rendering config for a `LINE` chart. `xKey` selects the categorical/temporal axis from the
|
|
59
|
+
* CSV; each series contributes one `<Line>` overlaid against that axis.
|
|
60
|
+
*/
|
|
61
|
+
interface LineChartConfig extends ChartConfigBase {
|
|
62
|
+
variant: "LINE";
|
|
63
|
+
/** CSV column key used as the x-axis. */
|
|
64
|
+
xKey: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Rendering config for a `PIE` chart. `categoryKey` names the slice; `valueKey` carries the
|
|
69
|
+
* slice's numeric magnitude. One row of CSV becomes one slice. The base's `series` array is
|
|
70
|
+
* always empty for pie — colors are resolved by row index from the palette.
|
|
71
|
+
*/
|
|
72
|
+
interface PieChartConfig extends ChartConfigBase {
|
|
73
|
+
variant: "PIE";
|
|
74
|
+
/** CSV column key used as the slice label. */
|
|
75
|
+
categoryKey: string;
|
|
76
|
+
/** CSV column key used as the slice numeric value. */
|
|
77
|
+
valueKey: string;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Discriminated union of all supported chart variant configs. Assembled here (not in the parent
|
|
82
|
+
* `types.ts`) because the union depends on each variant service file as its single source of
|
|
83
|
+
* truth for that variant's config type.
|
|
84
|
+
*
|
|
85
|
+
* Extension pattern: add a new variant by creating one `*-chart-variant-service.ts` file and
|
|
86
|
+
* extending this union + the `ChartVariantServices` map below. No edits to the dispatcher.
|
|
87
|
+
*/
|
|
88
|
+
type ChartConfig = LineChartConfig | BarChartConfig | PieChartConfig;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Optional stats embedded in `ChartConfig` so clients can pre-render UI before fetching the
|
|
92
|
+
* actual CSV (e.g. a skeleton sized to the eventual row count). Mirrors `TableStats`.
|
|
93
|
+
*/
|
|
94
|
+
interface ChartStats {
|
|
95
|
+
/** Total number of rows in the materialised CSV. */
|
|
96
|
+
rowCount: number;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Cross-variant base for `ChartConfig`. Carries the fields every variant shares — series
|
|
100
|
+
* descriptors and optional stats. Per-variant config interfaces (in `chart-variant-services/`)
|
|
101
|
+
* extend this with their own required fields.
|
|
102
|
+
*
|
|
103
|
+
* Note: `series` is always present on the wire (matching the GraphQL `[ChartSeries!]!` shape)
|
|
104
|
+
* even for PIE — PIE just receives an empty array. Keeping it on the base mirrors the wire shape
|
|
105
|
+
* exactly and avoids TS object-literal freshness errors for callers that explicitly set
|
|
106
|
+
* `series: []` on a pie config.
|
|
107
|
+
*/
|
|
108
|
+
interface ChartConfigBase {
|
|
109
|
+
/** Series descriptors in render order. LINE/BAR consume these; PIE ignores in favour of `categoryKey`+`valueKey`. */
|
|
110
|
+
series: ChartSeries[];
|
|
111
|
+
/** Optional metadata describing the underlying data — used for loading-state UI. */
|
|
112
|
+
stats?: ChartStats;
|
|
113
|
+
}
|
|
114
|
+
/** Concrete chart artifact record. */
|
|
115
|
+
type ChartArtifactRecord = ArtifactBase<typeof artifactTypes.CHART, ChartConfig>;
|
|
116
|
+
/**
|
|
117
|
+
* Localized labels for the `CHART` artifact's user-facing strings. Covers action buttons AND
|
|
118
|
+
* status messages — see `TableArtifactLabels` for the same shape philosophy. Extends as the
|
|
119
|
+
* chart artifact grows its action set (e.g. future `copyAsPng`); optional keys document
|
|
120
|
+
* anticipated additions without forcing every consumer to provide them today.
|
|
121
|
+
*/
|
|
122
|
+
interface ChartArtifactLabels {
|
|
123
|
+
/** Tooltip + aria-label on the Download CSV button in the chart artifact header. */
|
|
124
|
+
download: string;
|
|
125
|
+
/** Status message shown when no presigned URL is available or the chart config is malformed. */
|
|
126
|
+
unavailable: string;
|
|
127
|
+
/** Status message shown when the fetch / parse fails at runtime. */
|
|
128
|
+
loadError: string;
|
|
129
|
+
/** Status message shown while the CSV is being fetched. */
|
|
130
|
+
loading: string;
|
|
131
|
+
/** Status message shown when the fetched CSV has zero data rows. */
|
|
132
|
+
empty: string;
|
|
133
|
+
/**
|
|
134
|
+
* Category labels treated as the "Others" bucket in pie charts (case-insensitive). Matching
|
|
135
|
+
* slices are pinned to the end of the sweep and rendered in neutral grey. The agent writes a
|
|
136
|
+
* translated bucket name in non-English UIs (e.g. "אחרים", "Otros") — consumer passes the
|
|
137
|
+
* localized list here so clay can detect the bucket regardless of language. English fallback
|
|
138
|
+
* is `["Others", "Other"]`. Pass `[]` to disable Others detection (every slice from the palette).
|
|
139
|
+
*/
|
|
140
|
+
othersCategoryLabels: readonly string[];
|
|
141
|
+
}
|
|
142
|
+
/** English fallback for `ChartArtifactLabels`. Used when the consumer hasn't passed `labels`. */
|
|
143
|
+
declare const DEFAULT_CHART_ARTIFACT_LABELS: ChartArtifactLabels;
|
|
144
|
+
/**
|
|
145
|
+
* Consumer-supplied side-effect callbacks for actions on the chart artifact. Mirrors
|
|
146
|
+
* `ChartArtifactLabels`'s shape philosophy: one entry per action this artifact exposes
|
|
147
|
+
* (download today; future "Copy as PNG" etc.). Every callback is optional — consumers wire
|
|
148
|
+
* only the actions they care about. The artifact passes its own `ChartArtifactRecord` as the
|
|
149
|
+
* only argument so consumers can derive analytics context (title, config.variant, etc.) without
|
|
150
|
+
* a per-block closure at every render site.
|
|
151
|
+
*
|
|
152
|
+
* The callback fires alongside the default browser behaviour (e.g. `onDownload` does not
|
|
153
|
+
* prevent the anchor's download navigation) — it's purely for analytics / observability hooks.
|
|
154
|
+
*/
|
|
155
|
+
interface ChartArtifactCallbacks {
|
|
156
|
+
/** Fires when the Download CSV button is clicked. Browser-native download still happens. */
|
|
157
|
+
onDownload?: (artifact: ChartArtifactRecord) => void;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* A single column descriptor for a `TableArtifact`. Carries the ORDER and LABEL for the
|
|
162
|
+
* rendered table — `key` selects a column from the CSV header; `label` overrides the rendered
|
|
163
|
+
* header text. The CSV is always the source of truth for the data shape; clay never coerces,
|
|
164
|
+
* reformats, or interprets cell values.
|
|
165
|
+
*/
|
|
166
|
+
interface TableColumn {
|
|
167
|
+
/** Matches a header in the CSV. Required. Used to project + order the CSV's columns. */
|
|
168
|
+
key: string;
|
|
169
|
+
/** Human-readable header text. Required. */
|
|
170
|
+
label: string;
|
|
171
|
+
/**
|
|
172
|
+
* Accepted in the wire payload but not consulted by the renderer — every cell is rendered as
|
|
173
|
+
* the raw CSV string (or empty for null). Format conversion is a server concern; if a column
|
|
174
|
+
* needs to be "Yes/No" instead of "true/false", the server should emit it that way in the CSV.
|
|
175
|
+
* Kept in the interface so callers that pass `type` (e.g. io-client) don't get a type error.
|
|
176
|
+
*/
|
|
177
|
+
type?: "string" | "number" | "date" | "boolean";
|
|
178
|
+
/**
|
|
179
|
+
* Accepted in the wire payload but not consulted by the renderer — every column is left-aligned
|
|
180
|
+
* by design. Kept in the interface for forward-compat; restore per-column alignment by editing
|
|
181
|
+
* `table-artifact-content.tsx` if a future use case justifies it.
|
|
182
|
+
*/
|
|
183
|
+
align?: "left" | "center" | "right";
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Optional stats embedded in `TableConfig` so clients can pre-render UI before fetching the
|
|
187
|
+
* actual data payload (e.g. N loading shimmers sized to the eventual row count).
|
|
188
|
+
*
|
|
189
|
+
* Backward-compat: optional everywhere — older artifacts persisted before this field shipped
|
|
190
|
+
* still validate. The renderer falls back to a single status-message line when `stats` is absent.
|
|
191
|
+
*/
|
|
192
|
+
interface TableStats {
|
|
193
|
+
/** Total number of rows in the materialised CSV. Lets the loading branch render shimmers. */
|
|
194
|
+
rowCount: number;
|
|
195
|
+
}
|
|
196
|
+
/** Rendering config for a table artifact, stored at `artifact.config` (JSONB on the server). */
|
|
197
|
+
interface TableConfig {
|
|
198
|
+
/** Column descriptors in render order. */
|
|
199
|
+
columns: TableColumn[];
|
|
200
|
+
/** Optional metadata describing the underlying data — used for loading-state UI. */
|
|
201
|
+
stats?: TableStats;
|
|
202
|
+
}
|
|
203
|
+
/** Alias retained for callers typed against the table-specific name. */
|
|
204
|
+
type TableRow = ArtifactDataRow;
|
|
205
|
+
/** Concrete table artifact record. */
|
|
206
|
+
type TableArtifactRecord = ArtifactBase<typeof artifactTypes.TABLE, TableConfig>;
|
|
207
|
+
/**
|
|
208
|
+
* Localized labels for the `TABLE` artifact's user-facing strings. Covers both action buttons
|
|
209
|
+
* (download today; future "Copy as CSV", etc.) AND status messages (loading / error / empty /
|
|
210
|
+
* unavailable). Consumer passes the bag from their i18n layer; clay falls back to English
|
|
211
|
+
* defaults when omitted (per-key Partial merge).
|
|
212
|
+
*/
|
|
213
|
+
interface TableArtifactLabels {
|
|
214
|
+
/** Tooltip + aria-label on the Download CSV button in the table artifact header. */
|
|
215
|
+
download: string;
|
|
216
|
+
/**
|
|
217
|
+
* Status message shown when no presigned URL is available (permanent server-side absence) or
|
|
218
|
+
* the artifact config is malformed. Both states reduce to "the underlying file isn't usable".
|
|
219
|
+
*/
|
|
220
|
+
unavailable: string;
|
|
221
|
+
/** Status message shown when the fetch / parse fails at runtime (transient). */
|
|
222
|
+
loadError: string;
|
|
223
|
+
/** Status message shown while the CSV is being fetched and `stats.rowCount` is not known. */
|
|
224
|
+
loading: string;
|
|
225
|
+
/** Empty-state row inside the table body when the fetched CSV has zero data rows. */
|
|
226
|
+
empty: string;
|
|
227
|
+
}
|
|
228
|
+
/** English fallback for `TableArtifactLabels`. Used when the consumer hasn't passed `labels`. */
|
|
229
|
+
declare const DEFAULT_TABLE_ARTIFACT_LABELS: TableArtifactLabels;
|
|
230
|
+
/**
|
|
231
|
+
* Consumer-supplied side-effect callbacks for actions on the table artifact. Mirrors
|
|
232
|
+
* `ChartArtifactCallbacks` — see that interface for the shape philosophy. Every callback is
|
|
233
|
+
* optional; the artifact passes its own `TableArtifactRecord` as the only argument so consumers
|
|
234
|
+
* can derive analytics context without a per-block closure at every render site.
|
|
235
|
+
*/
|
|
236
|
+
interface TableArtifactCallbacks {
|
|
237
|
+
/** Fires when the Download CSV button is clicked. Browser-native download still happens. */
|
|
238
|
+
onDownload?: (artifact: TableArtifactRecord) => void;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Artifact-domain types — wire-protocol shapes shared between artifact components, block-services,
|
|
243
|
+
* and consumers. Splits responsibilities across three layers so each artifact kind owns its own
|
|
244
|
+
* `types.ts` and this file assembles the cross-type union + service contract:
|
|
245
|
+
*
|
|
246
|
+
* 1. **`artifact-base.ts`** — discriminator (`artifactTypes`), `ArtifactBase<TType, TConfig>`, and
|
|
247
|
+
* `ArtifactDataRow`. Pulled out so each per-type `types.ts` and this assembler can depend on
|
|
248
|
+
* one canonical base without a circular module graph.
|
|
249
|
+
* 2. **`<type>-artifact/types.ts`** — per-artifact-type records, configs, labels, and defaults.
|
|
250
|
+
* Variant-specific types (e.g. `LineChartConfig`) live in even deeper per-variant service files.
|
|
251
|
+
* 3. **This file** — the cross-type `ArtifactRecord` union, the labels map keyed by artifact type,
|
|
252
|
+
* and the `ArtifactService<TArtifact, TLabels>` registry contract used by the dispatcher.
|
|
253
|
+
*
|
|
254
|
+
* Mirrored from the agent / io-server contract — see the `chat-typed-content-blocks-and-artifacts`
|
|
255
|
+
* plan, §6.4 (table contract).
|
|
256
|
+
*/
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Per-artifact-type labels map. Lets a consumer pass labels for every artifact kind in a single
|
|
260
|
+
* bag at the block layer (`<ArtifactRefBlock>` payload); the dispatcher routes the matching slice
|
|
261
|
+
* (`labels[artifact.type]`) to the concrete artifact component.
|
|
262
|
+
*
|
|
263
|
+
* Extension pattern: add a new field here when adding a new artifact type. Keep the field
|
|
264
|
+
* optional so older consumers don't break on upgrade.
|
|
265
|
+
*/
|
|
266
|
+
interface ArtifactLabelsMap {
|
|
267
|
+
TABLE: TableArtifactLabels;
|
|
268
|
+
CHART: ChartArtifactLabels;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Per-artifact-type callbacks map. Sibling to `ArtifactLabelsMap` — consumer passes a single
|
|
272
|
+
* bag at the block layer covering every artifact type's action callbacks (today: `onDownload`).
|
|
273
|
+
* Used for analytics / observability hooks — every callback is optional and fires alongside
|
|
274
|
+
* the default browser behaviour (it does NOT replace it).
|
|
275
|
+
*
|
|
276
|
+
* Each callback receives its artifact-type's `ArtifactBase`-derived record so consumers can
|
|
277
|
+
* derive analytics context (title, config, etc.) from one wiring at the chat-surface level
|
|
278
|
+
* instead of per-block closures.
|
|
279
|
+
*/
|
|
280
|
+
interface ArtifactCallbacksMap {
|
|
281
|
+
TABLE: TableArtifactCallbacks;
|
|
282
|
+
CHART: ChartArtifactCallbacks;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Discriminated union of all supported artifacts. Extension pattern: add the new branch here AND
|
|
286
|
+
* in the `ArtifactServices` map (single source of truth for the type→component mapping). Older
|
|
287
|
+
* clay versions that don't know about a new type silently render nothing — see `ArtifactRefBlock`
|
|
288
|
+
* guard.
|
|
289
|
+
*/
|
|
290
|
+
type ArtifactRecord = TableArtifactRecord | ChartArtifactRecord;
|
|
291
|
+
/**
|
|
292
|
+
* Props every concrete artifact component receives from the dispatcher.
|
|
293
|
+
*
|
|
294
|
+
* `labels` is the FULL `ArtifactLabelsMap` bag — every artifact component receives the same
|
|
295
|
+
* shape and reads its own slice internally (`labels?.TABLE`, `labels?.CHART`). One uniform prop
|
|
296
|
+
* type across all artifact components keeps the block-layer dispatcher a generic forward — no
|
|
297
|
+
* per-type branch, no cast, no map-key extraction at the seam.
|
|
298
|
+
*/
|
|
299
|
+
interface ArtifactServiceProps<TArtifact extends ArtifactRecord = ArtifactRecord> {
|
|
300
|
+
/** The artifact metadata (config + presigned URL). */
|
|
301
|
+
artifact: TArtifact;
|
|
302
|
+
/**
|
|
303
|
+
* Optional localized labels keyed by artifact type. Each artifact component reads only its
|
|
304
|
+
* own slice (`labels?.TABLE` or `labels?.CHART`); anything omitted falls back to the English
|
|
305
|
+
* default (per-key `Partial` merge against `DEFAULT_*_ARTIFACT_LABELS`).
|
|
306
|
+
*/
|
|
307
|
+
labels?: Partial<ArtifactLabelsMap>;
|
|
308
|
+
/**
|
|
309
|
+
* Optional side-effect callbacks keyed by artifact type — for analytics / observability hooks
|
|
310
|
+
* (e.g. tracking a download event). Each artifact component reads only its own slice
|
|
311
|
+
* (`callbacks?.TABLE`, `callbacks?.CHART`). Callbacks fire alongside the default browser
|
|
312
|
+
* behaviour and do not replace it.
|
|
313
|
+
*/
|
|
314
|
+
callbacks?: Partial<ArtifactCallbacksMap>;
|
|
315
|
+
}
|
|
316
|
+
/** Per-artifact-type service — registry entry that pairs a discriminator with its concrete component. */
|
|
317
|
+
interface ArtifactService<TArtifact extends ArtifactRecord = ArtifactRecord> {
|
|
318
|
+
/** Discriminator value this service handles. */
|
|
319
|
+
type: (typeof artifactTypes)[keyof typeof artifactTypes];
|
|
320
|
+
/** React component that renders an artifact of this type — composes ai-elements primitives
|
|
321
|
+
* (`Artifact`, `ArtifactHeader`, `ArtifactTitle`, `ArtifactActions`, `ArtifactContent`) directly. */
|
|
322
|
+
Component: ComponentType<ArtifactServiceProps<TArtifact>>;
|
|
323
|
+
/**
|
|
324
|
+
* Returns a plain-text / markdown string suitable for clipboard copy.
|
|
325
|
+
*
|
|
326
|
+
* Called by `ArtifactRefBlockService.toClipboardText` when the user copies a message that
|
|
327
|
+
* contains this artifact. Must be pure and synchronous.
|
|
328
|
+
*/
|
|
329
|
+
toClipboardText: (artifact: TArtifact) => string;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
export { type ArtifactDataRow as A, type BarChartConfig as B, type ChartArtifactLabels as C, DEFAULT_CHART_ARTIFACT_LABELS as D, type LineChartConfig as L, type PieChartConfig as P, type TableArtifactLabels as T, type ArtifactLabelsMap as a, type ArtifactRecord as b, type ArtifactService as c, type ArtifactServiceProps as d, type ArtifactType as e, type ChartArtifactRecord as f, type ChartConfig as g, type ChartStats as h, DEFAULT_TABLE_ARTIFACT_LABELS as i, type TableArtifactRecord as j, type TableColumn as k, type TableConfig as l, type TableRow as m, type TableStats as n, artifactTypes as o, type ArtifactCallbacksMap as p };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentType } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { b as ArtifactRecord, a as ArtifactLabelsMap, p as ArtifactCallbacksMap } from './types-C0BvwliI.cjs';
|
|
3
3
|
|
|
4
4
|
/** Block-type discriminator constants. Mirrors the wire shape from io-server / shapes-agent. */
|
|
5
5
|
declare const blockTypes: {
|
|
@@ -35,6 +35,21 @@ interface ArtifactRefBlockRecord {
|
|
|
35
35
|
artifactId: string;
|
|
36
36
|
/** Inlined artifact metadata — clients fetch the underlying data via `artifact.protectedAsset.presignedUrl`. */
|
|
37
37
|
artifact: ArtifactRecord;
|
|
38
|
+
/**
|
|
39
|
+
* Optional consumer-supplied labels for the rendered artifact's action buttons + status
|
|
40
|
+
* messages, keyed by artifact type. NOT a wire field — the consumer constructs this from
|
|
41
|
+
* their i18n layer when materialising the block-record from the server payload, then passes
|
|
42
|
+
* the augmented block to `<Block>`. The dispatcher stays generic — it forwards the whole
|
|
43
|
+
* `labels` bag to every artifact component, and each component reads its own slice
|
|
44
|
+
* (`labels.TABLE`, `labels.CHART`) internally.
|
|
45
|
+
*/
|
|
46
|
+
labels?: Partial<ArtifactLabelsMap>;
|
|
47
|
+
/**
|
|
48
|
+
* Optional side-effect callbacks for actions on the rendered artifact (e.g. `onDownload`).
|
|
49
|
+
* Keyed by artifact type, mirroring `labels`. NOT a wire field — the consumer wires this
|
|
50
|
+
* once to bridge artifact actions to their analytics / observability layer.
|
|
51
|
+
*/
|
|
52
|
+
callbacks?: Partial<ArtifactCallbacksMap>;
|
|
38
53
|
};
|
|
39
54
|
}
|
|
40
55
|
/** Discriminated union of all supported content blocks. Additive — new types extend this union. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentType } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { b as ArtifactRecord, a as ArtifactLabelsMap, p as ArtifactCallbacksMap } from './types-C5bFH4v3.js';
|
|
3
3
|
|
|
4
4
|
/** Block-type discriminator constants. Mirrors the wire shape from io-server / shapes-agent. */
|
|
5
5
|
declare const blockTypes: {
|
|
@@ -35,6 +35,21 @@ interface ArtifactRefBlockRecord {
|
|
|
35
35
|
artifactId: string;
|
|
36
36
|
/** Inlined artifact metadata — clients fetch the underlying data via `artifact.protectedAsset.presignedUrl`. */
|
|
37
37
|
artifact: ArtifactRecord;
|
|
38
|
+
/**
|
|
39
|
+
* Optional consumer-supplied labels for the rendered artifact's action buttons + status
|
|
40
|
+
* messages, keyed by artifact type. NOT a wire field — the consumer constructs this from
|
|
41
|
+
* their i18n layer when materialising the block-record from the server payload, then passes
|
|
42
|
+
* the augmented block to `<Block>`. The dispatcher stays generic — it forwards the whole
|
|
43
|
+
* `labels` bag to every artifact component, and each component reads its own slice
|
|
44
|
+
* (`labels.TABLE`, `labels.CHART`) internally.
|
|
45
|
+
*/
|
|
46
|
+
labels?: Partial<ArtifactLabelsMap>;
|
|
47
|
+
/**
|
|
48
|
+
* Optional side-effect callbacks for actions on the rendered artifact (e.g. `onDownload`).
|
|
49
|
+
* Keyed by artifact type, mirroring `labels`. NOT a wire field — the consumer wires this
|
|
50
|
+
* once to bridge artifact actions to their analytics / observability layer.
|
|
51
|
+
*/
|
|
52
|
+
callbacks?: Partial<ArtifactCallbacksMap>;
|
|
38
53
|
};
|
|
39
54
|
}
|
|
40
55
|
/** Discriminated union of all supported content blocks. Additive — new types extend this union. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shapesos/clay",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"main": "./dist/index.cjs",
|
|
5
5
|
"module": "./dist/index.js",
|
|
6
6
|
"devDependencies": {
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"lefthook": "^2.1.1",
|
|
34
34
|
"react": "^19.2.4",
|
|
35
35
|
"react-dom": "^19.2.4",
|
|
36
|
+
"recharts": "^3.8.1",
|
|
36
37
|
"storybook": "^10.2.13",
|
|
37
38
|
"styled-components": "^6.3.11",
|
|
38
39
|
"tailwindcss": "^4",
|
|
@@ -46,8 +47,14 @@
|
|
|
46
47
|
"peerDependencies": {
|
|
47
48
|
"react": "^17 || ^18 || ^19",
|
|
48
49
|
"react-dom": "^17 || ^18 || ^19",
|
|
50
|
+
"recharts": "^3",
|
|
49
51
|
"styled-components": "^5 || ^6"
|
|
50
52
|
},
|
|
53
|
+
"peerDependenciesMeta": {
|
|
54
|
+
"recharts": {
|
|
55
|
+
"optional": true
|
|
56
|
+
}
|
|
57
|
+
},
|
|
51
58
|
"exports": {
|
|
52
59
|
".": {
|
|
53
60
|
"types": "./dist/index.d.ts",
|
|
@@ -75,6 +82,11 @@
|
|
|
75
82
|
"import": "./dist/artifacts.js",
|
|
76
83
|
"require": "./dist/artifacts.cjs"
|
|
77
84
|
},
|
|
85
|
+
"./chart": {
|
|
86
|
+
"types": "./dist/chart.d.ts",
|
|
87
|
+
"import": "./dist/chart.js",
|
|
88
|
+
"require": "./dist/chart.cjs"
|
|
89
|
+
},
|
|
78
90
|
"./table": {
|
|
79
91
|
"types": "./dist/table.d.ts",
|
|
80
92
|
"import": "./dist/table.js",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/artifacts/types.ts","../node_modules/@tabler/icons-react/src/defaultAttributes.ts","../node_modules/@tabler/icons-react/src/createReactComponent.ts","../node_modules/@tabler/icons-react/src/icons/IconCheck.ts","../node_modules/@tabler/icons-react/src/icons/IconCopy.ts","../node_modules/@tabler/icons-react/src/icons/IconDownload.ts","../node_modules/@tabler/icons-react/src/icons/IconThumbDown.ts","../node_modules/@tabler/icons-react/src/icons/IconThumbUp.ts","../src/components/ui/tooltip.tsx","../src/components/artifacts/artifact-download-button/artifact-download-button.tsx","../src/components/artifacts/table-artifact/table-artifact.tsx","../src/components/ai-elements/artifact.tsx","../src/components/artifacts/table-artifact/table-artifact-styles.ts","../src/components/artifacts/table-artifact/table-artifact-content.constants.ts","../src/components/artifacts/table-artifact/table-artifact-content.utils.ts","../src/components/artifacts/table-artifact/table-artifact-content.tsx","../src/components/artifacts/table-artifact/use-table-artifact-data.ts","../src/components/artifacts/table-artifact/parse-csv.ts","../src/components/artifacts/table-artifact/validate.ts","../src/components/artifacts/table-artifact/to-clipboard-text.ts","../src/components/artifacts/artifact-services/table-artifact-service.ts","../src/components/artifacts/artifact-services/index.ts"],"sourcesContent":["/**\n * Artifact-domain types — wire-protocol shapes shared between artifact components, block-services, and\n * consumers. The block layer (`@/components/blocks`) imports these to define\n * `ArtifactRefBlockRecord`; the artifact components consume them directly.\n *\n * Mirrored from the agent / io-server contract — see the `chat-typed-content-blocks-and-artifacts`\n * plan, §6.4 (table contract).\n */\n\nimport type { ComponentType } from \"react\";\n\n/**\n * Artifact-type discriminator constants. Uppercase to match the server-side `artifactTypes`\n * constant — io-server stores `artifact.type === \"TABLE\"` (aligned with the GraphQL enum).\n */\nexport const artifactTypes = {\n TABLE: \"TABLE\",\n} as const;\n\n/** Discriminator for artifact types. Additive — new types extend this union. */\nexport type ArtifactType = (typeof artifactTypes)[keyof typeof artifactTypes];\n\n/**\n * A single column descriptor for a `TableArtifact`. Carries the ORDER and LABEL for the\n * rendered table — `key` selects a column from the CSV header; `label` overrides the rendered\n * header text. The CSV is always the source of truth for the data shape; clay never coerces,\n * reformats, or interprets cell values.\n */\nexport interface TableColumn {\n /** Matches a header in the CSV. Required. Used to project + order the CSV's columns. */\n key: string;\n /** Human-readable header text. Required. */\n label: string;\n /**\n * Accepted in the wire payload but not consulted by the renderer — every cell is rendered as\n * the raw CSV string (or empty for null). Format conversion is a server concern; if a column\n * needs to be \"Yes/No\" instead of \"true/false\", the server should emit it that way in the CSV.\n * Kept in the interface so callers that pass `type` (e.g. io-client) don't get a type error.\n */\n type?: \"string\" | \"number\" | \"date\" | \"boolean\";\n /**\n * Accepted in the wire payload but not consulted by the renderer — every column is left-aligned\n * by design. Kept in the interface for forward-compat; restore per-column alignment by editing\n * `table-artifact-content.tsx` if a future use case justifies it.\n */\n align?: \"left\" | \"center\" | \"right\";\n}\n\n/**\n * Optional stats embedded in `TableConfig` so clients can pre-render UI before fetching the\n * actual data payload (e.g. N loading shimmers sized to the eventual row count).\n *\n * Backward-compat: optional everywhere — older artifacts persisted before this field shipped\n * still validate. The renderer falls back to a single status-message line when `stats` is absent.\n */\nexport interface TableStats {\n /** Total number of rows in the materialised CSV. Lets the loading branch render shimmers. */\n rowCount: number;\n}\n\n/** Rendering config for a table artifact, stored at `artifact.config` (JSONB on the server). */\nexport interface TableConfig {\n /** Column descriptors in render order. */\n columns: TableColumn[];\n /** Optional metadata describing the underlying data — used for loading-state UI. */\n stats?: TableStats;\n}\n\n/**\n * A row inside a table artifact's parsed CSV. Every cell is the raw string from the CSV (or\n * `null` for the empty string). The renderer never coerces or interprets — type-aware formatting\n * is a server concern (the CSV's contents are what the user sees).\n */\nexport type TableRow = Record<string, string | null>;\n\n/** Common shape every artifact record carries. Discriminated by `type`. */\ninterface ArtifactBase<TType extends ArtifactType, TConfig> {\n /** Artifact-type discriminator. */\n type: TType;\n /** Human-readable label. Nullable when the artifact has no title. */\n title: string | null;\n /** Rendering config — shape varies per artifact type. */\n config: TConfig;\n /** Protected-asset metadata pointing to the underlying data payload. Null while the asset is unavailable. */\n protectedAsset: {\n /** Time-limited URL the renderer fetches the artifact's data from. */\n presignedUrl: string;\n } | null;\n}\n\n/** Concrete table artifact record. Future artifact types extend `ArtifactRecord` here. */\nexport type TableArtifactRecord = ArtifactBase<typeof artifactTypes.TABLE, TableConfig>;\n\n/**\n * Discriminated union of all supported artifacts. Single-member today; extension pattern:\n *\n * export type ArtifactRecord = TableArtifactRecord | ChartArtifactRecord;\n *\n * Every consumer that narrows on `artifact.type` must add the new branch here AND in the\n * `ArtifactServices` map (single source of truth for the type→component mapping). Older clay\n * versions that don't know about a new type silently render nothing — see `ArtifactRefBlock` guard.\n */\nexport type ArtifactRecord = TableArtifactRecord;\n\n/** Props every concrete artifact component receives from the dispatcher. */\nexport interface ArtifactServiceProps<TArtifact extends ArtifactRecord = ArtifactRecord> {\n /** The artifact metadata (config + presigned URL). */\n artifact: TArtifact;\n}\n\n/** Per-artifact-type service — registry entry that pairs a discriminator with its concrete component. */\nexport interface ArtifactService<TArtifact extends ArtifactRecord = ArtifactRecord> {\n /** Discriminator value this service handles. */\n type: ArtifactType;\n /** React component that renders an artifact of this type — composes ai-elements primitives\n * (`Artifact`, `ArtifactHeader`, `ArtifactTitle`, `ArtifactActions`, `ArtifactContent`) directly. */\n Component: ComponentType<ArtifactServiceProps<TArtifact>>;\n /**\n * Returns a plain-text / markdown string suitable for clipboard copy.\n *\n * Called by `ArtifactRefBlockService.toClipboardText` when the user copies a message that\n * contains this artifact. Must be pure and synchronous.\n *\n * Implementation notes per type:\n * - `table`: returns the artifact title as plain text (see `TableArtifactService`).\n * - Future types implement their own representation in a co-located `*-service.ts` file.\n */\n toClipboardText: (artifact: TArtifact) => string;\n}\n","export default {\n outline: {\n xmlns: 'http://www.w3.org/2000/svg',\n width: 24,\n height: 24,\n viewBox: '0 0 24 24',\n fill: 'none',\n stroke: 'currentColor',\n strokeWidth: 2,\n strokeLinecap: 'round',\n strokeLinejoin: 'round',\n },\n filled: {\n xmlns: 'http://www.w3.org/2000/svg',\n width: 24,\n height: 24,\n viewBox: '0 0 24 24',\n fill: 'currentColor',\n stroke: 'none',\n },\n};\n","import { forwardRef, createElement } from 'react';\nimport defaultAttributes from './defaultAttributes';\nimport type { IconNode, IconProps, Icon } from './types';\n\nconst createReactComponent = (\n type: 'outline' | 'filled',\n iconName: string,\n iconNamePascal: string,\n iconNode: IconNode,\n) => {\n const Component = forwardRef<SVGSVGElement, IconProps>(\n (\n { color = 'currentColor', size = 24, stroke = 2, title, className, children, ...rest }: IconProps,\n ref,\n ) =>\n createElement(\n 'svg',\n {\n ref,\n ...defaultAttributes[type],\n width: size,\n height: size,\n className: [`tabler-icon`, `tabler-icon-${iconName}`, className].join(' '),\n ...(type === 'filled'\n ? {\n fill: color,\n }\n : {\n strokeWidth: stroke,\n stroke: color,\n }),\n ...rest,\n },\n [\n title && createElement('title', { key: 'svg-title' }, title),\n ...iconNode.map(([tag, attrs]) => createElement(tag, attrs)),\n ...(Array.isArray(children) ? children : [children]),\n ],\n ),\n );\n\n Component.displayName = `${iconNamePascal}`;\n\n return Component;\n};\n\nexport default createReactComponent;\n","import createReactComponent from '../createReactComponent';\nimport { IconNode } from '../types';\n\nexport const __iconNode: IconNode = [[\"path\",{\"d\":\"M5 12l5 5l10 -10\",\"key\":\"svg-0\"}]]\n\nconst IconCheck = createReactComponent('outline', 'check', 'Check', __iconNode);\n\nexport default IconCheck;","import createReactComponent from '../createReactComponent';\nimport { IconNode } from '../types';\n\nexport const __iconNode: IconNode = [[\"path\",{\"d\":\"M7 9.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666\",\"key\":\"svg-0\"}],[\"path\",{\"d\":\"M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1\",\"key\":\"svg-1\"}]]\n\nconst IconCopy = createReactComponent('outline', 'copy', 'Copy', __iconNode);\n\nexport default IconCopy;","import createReactComponent from '../createReactComponent';\nimport { IconNode } from '../types';\n\nexport const __iconNode: IconNode = [[\"path\",{\"d\":\"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2\",\"key\":\"svg-0\"}],[\"path\",{\"d\":\"M7 11l5 5l5 -5\",\"key\":\"svg-1\"}],[\"path\",{\"d\":\"M12 4l0 12\",\"key\":\"svg-2\"}]]\n\nconst IconDownload = createReactComponent('outline', 'download', 'Download', __iconNode);\n\nexport default IconDownload;","import createReactComponent from '../createReactComponent';\nimport { IconNode } from '../types';\n\nexport const __iconNode: IconNode = [[\"path\",{\"d\":\"M7 13v-8a1 1 0 0 0 -1 -1h-2a1 1 0 0 0 -1 1v7a1 1 0 0 0 1 1h3a4 4 0 0 1 4 4v1a2 2 0 0 0 4 0v-5h3a2 2 0 0 0 2 -2l-1 -5a2 3 0 0 0 -2 -2h-7a3 3 0 0 0 -3 3\",\"key\":\"svg-0\"}]]\n\nconst IconThumbDown = createReactComponent('outline', 'thumb-down', 'ThumbDown', __iconNode);\n\nexport default IconThumbDown;","import createReactComponent from '../createReactComponent';\nimport { IconNode } from '../types';\n\nexport const __iconNode: IconNode = [[\"path\",{\"d\":\"M7 11v8a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1v-7a1 1 0 0 1 1 -1h3a4 4 0 0 0 4 -4v-1a2 2 0 0 1 4 0v5h3a2 2 0 0 1 2 2l-1 5a2 3 0 0 1 -2 2h-7a3 3 0 0 1 -3 -3\",\"key\":\"svg-0\"}]]\n\nconst IconThumbUp = createReactComponent('outline', 'thumb-up', 'ThumbUp', __iconNode);\n\nexport default IconThumbUp;","import * as React from \"react\";\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\n\nimport { cn } from \"@/lib/utils\";\n\nconst TooltipProvider = TooltipPrimitive.Provider;\n\nconst Tooltip = TooltipPrimitive.Root;\n\nconst TooltipTrigger = TooltipPrimitive.Trigger;\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n <TooltipPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]\",\n className\n )}\n {...props}\n />\n));\nTooltipContent.displayName = TooltipPrimitive.Content.displayName;\n\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };\n","import { IconDownload } from \"@tabler/icons-react\";\nimport type { ReactNode } from \"react\";\n\nimport { IconButton } from \"@/components/icon-button/icon-button\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"@/components/ui/tooltip\";\n\n/** Props for `ArtifactDownloadButton`. */\nexport interface ArtifactDownloadButtonProps {\n /**\n * URL to download the artifact's underlying bytes. The button is an `<a href download>` so the\n * browser uses whatever filename the server supplies via `Content-Disposition`. No client-side\n * filename invention.\n *\n * Renders nothing when the URL is not a safe `http(s):` scheme — guards against `javascript:` or\n * `data:` URIs smuggled into `presignedUrl`.\n */\n href: string;\n}\n\n/**\n * Reusable download button for artifact headers. Anchor-based so the browser handles the download\n * natively (respects `Content-Disposition`, falls back to URL basename). `rel=\"noopener noreferrer\"`\n * defends against `window.opener` leakage if the browser opens the URL instead of downloading.\n *\n * Drop this inside `<ArtifactActions>` in any per-type artifact orchestrator.\n */\nexport function ArtifactDownloadButton({ href }: ArtifactDownloadButtonProps): ReactNode {\n if (!isSafeDownloadUrl(href)) return null;\n return (\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger asChild>\n <IconButton\n as=\"a\"\n href={href}\n download\n rel=\"noopener noreferrer\"\n icon={IconDownload}\n size=\"small\"\n aria-label=\"Download artifact\"\n />\n </TooltipTrigger>\n <TooltipContent>Download</TooltipContent>\n </Tooltip>\n </TooltipProvider>\n );\n}\n\n/**\n * Returns `true` only for `http:` and `https:` URLs. Rejects `javascript:`, `data:`, and any\n * other scheme that could execute code on click.\n */\nexport function isSafeDownloadUrl(url: string): boolean {\n try {\n const parsed = new URL(url);\n return parsed.protocol === \"https:\" || parsed.protocol === \"http:\";\n } catch {\n return false;\n }\n}\n","import { useEffect, type ReactNode } from \"react\";\n\nimport {\n Artifact,\n ArtifactActions,\n ArtifactContent,\n ArtifactHeader,\n ArtifactTitle,\n} from \"@/components/ai-elements/artifact\";\nimport { ArtifactDownloadButton } from \"@/components/artifacts/artifact-download-button/artifact-download-button\";\nimport type { ArtifactServiceProps } from \"@/components/artifacts/types\";\nimport type { TableArtifactRecord } from \"@/components/artifacts/types\";\nimport { TableArtifactContent } from \"./table-artifact-content\";\nimport { StatusMessage } from \"./table-artifact-styles\";\nimport { useTableArtifactData } from \"./use-table-artifact-data\";\nimport { isValidTableConfig } from \"./validate\";\n\nconst TITLE_CLASSES = \"text-sm font-semibold text-foreground\";\n\n/**\n * Cap the body at ~10 rows × 48px (~480px). Long lists scroll inside the artifact so they\n * don't stretch the chat surface. Each artifact type declares its own sensible cap.\n */\nconst TABLE_MAX_BODY_HEIGHT = 480;\n\n/**\n * Cap on shimmer rows during loading. Approximates the visible viewport (`TABLE_MAX_BODY_HEIGHT`\n * ÷ 48px per row) so we don't render hundreds of placeholder DOM nodes for very large tables.\n */\nconst MAX_SHIMMER_ROWS = 10;\n\n/** User-facing copy for permanent server-side absence of the artifact's data (no presigned URL or malformed config). */\nconst MSG_UNAVAILABLE = \"Table data is unavailable.\";\n\n/**\n * Orchestrator for the `table`-typed artifact.\n *\n * Composes the ai-elements chrome primitives (`Artifact`, `ArtifactHeader`, `ArtifactTitle`,\n * `ArtifactActions`, `ArtifactContent`) directly around the table body (`TableArtifactContent`).\n * Download is handled via `ArtifactDownloadButton` — a shared utility component that applies the\n * safe-URL guard and renders nothing for non-http(s) schemes.\n */\nexport function TableArtifact({ artifact }: ArtifactServiceProps<TableArtifactRecord>): ReactNode {\n const validConfig = isValidTableConfig(artifact.config);\n const validColumns = validConfig ? artifact.config.columns : null;\n\n useEffect(() => {\n if (validConfig) return;\n console.warn(\"[clay] TableArtifact: malformed `config` — skipping render.\");\n }, [validConfig]);\n\n // Hook is always called (Rules of Hooks). Pass null URL when config is invalid so the hook\n // short-circuits at its `if (!presignedUrl) return UNAVAILABLE` path — no network fetch fires\n // for an artifact whose config shape can't be rendered.\n const data = useTableArtifactData(\n validConfig ? artifact.protectedAsset?.presignedUrl ?? null : null,\n validColumns ?? []\n );\n\n const presignedUrl = artifact.protectedAsset?.presignedUrl ?? null;\n\n if (!validConfig || !validColumns) {\n return (\n <Artifact className=\"shadow-none w-full rounded-2xl bg-background/70\">\n <ArtifactHeader className=\"bg-background/70\">\n {artifact.title ? <ArtifactTitle className={TITLE_CLASSES}>{artifact.title}</ArtifactTitle> : <span />}\n {presignedUrl ? (\n <ArtifactActions>\n <ArtifactDownloadButton href={presignedUrl} />\n </ArtifactActions>\n ) : null}\n </ArtifactHeader>\n <ArtifactContent className=\"p-0 overflow-auto\" style={{ maxHeight: TABLE_MAX_BODY_HEIGHT }}>\n <StatusMessage $tone=\"info\">{MSG_UNAVAILABLE}</StatusMessage>\n </ArtifactContent>\n </Artifact>\n );\n }\n\n return (\n // The table body owns its own scroll container (`ArtifactTable` inside `TableArtifactContent`).\n // Disable the outer overflow container so only one scroll context exists — this prevents\n // double-scroll nesting and lets `useScrollShadow` find the correct scroll ancestor.\n <Artifact className=\"shadow-none w-full rounded-2xl bg-background/70\">\n <ArtifactHeader className=\"bg-background/70\">\n {artifact.title ? <ArtifactTitle className={TITLE_CLASSES}>{artifact.title}</ArtifactTitle> : <span />}\n <ArtifactActions>\n <ArtifactDownloadButton href={presignedUrl ?? \"\"} />\n </ArtifactActions>\n </ArtifactHeader>\n <ArtifactContent className=\"p-0 overflow-visible\" style={{ maxHeight: \"none\" }}>\n <TableArtifactContent\n columns={validColumns}\n data={data}\n knownRowCount={artifact.config.stats?.rowCount}\n maxShimmerRows={MAX_SHIMMER_ROWS}\n maxBodyHeight={TABLE_MAX_BODY_HEIGHT}\n unavailableMessage={MSG_UNAVAILABLE}\n />\n </ArtifactContent>\n </Artifact>\n );\n}\n","import type { HTMLAttributes } from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\n/* ------------------------------------------------------------------------------------------------\n * Originally vendored from `@vercel/ai-elements`'s `artifact` registry entry — see\n * https://elements.ai-sdk.dev/api/registry/artifact.json. Slimmed to the chrome primitives clay\n * actually composes (`Artifact`, `ArtifactHeader`, `ArtifactTitle`, `ArtifactActions`,\n * `ArtifactContent`). The original entry also shipped `ArtifactClose`, `ArtifactDescription`, and\n * `ArtifactAction` — all dependent on the shadcn `Button` primitive, none of which clay consumes.\n * Action buttons inside the artifact header use clay's `IconButton` (see `TableArtifact`'s\n * `ExportCsvButton`) instead of a generic shadcn Button, so the design system stays single-sourced.\n *\n * If a future ai-elements re-scaffold needs one of the dropped primitives back, re-add only the\n * piece consumers need and route its inner button through clay's `Button` / `IconButton` rather\n * than re-introducing the shadcn Button file.\n * ------------------------------------------------------------------------------------------------ */\n\nexport type ArtifactProps = HTMLAttributes<HTMLDivElement>;\n\nexport const Artifact = ({ className, ...props }: ArtifactProps) => (\n <div\n className={cn(\"flex flex-col overflow-hidden rounded-lg border bg-background shadow-sm\", className)}\n {...props}\n />\n);\n\nexport type ArtifactHeaderProps = HTMLAttributes<HTMLDivElement>;\n\nexport const ArtifactHeader = ({ className, ...props }: ArtifactHeaderProps) => (\n <div className={cn(\"flex items-center justify-between border-b bg-muted/50 px-4 py-3\", className)} {...props} />\n);\n\nexport type ArtifactTitleProps = HTMLAttributes<HTMLParagraphElement>;\n\nexport const ArtifactTitle = ({ className, ...props }: ArtifactTitleProps) => (\n <p className={cn(\"font-medium text-foreground text-sm\", className)} {...props} />\n);\n\nexport type ArtifactActionsProps = HTMLAttributes<HTMLDivElement>;\n\nexport const ArtifactActions = ({ className, ...props }: ArtifactActionsProps) => (\n <div className={cn(\"flex items-center gap-1\", className)} {...props} />\n);\n\nexport type ArtifactContentProps = HTMLAttributes<HTMLDivElement>;\n\nexport const ArtifactContent = ({ className, ...props }: ArtifactContentProps) => (\n <div className={cn(\"flex-1 overflow-auto p-4\", className)} {...props} />\n);\n","import type { ReactNode } from \"react\";\n\nimport { createElement } from \"react\";\n\ninterface StatusMessageProps {\n /** Visual tone: \"error\" renders red copy, \"info\" renders muted brown copy. */\n $tone?: \"info\" | \"error\";\n children: ReactNode;\n}\n\n/**\n * Centred status copy rendered inside the artifact when there is no table to show\n * (loading without a known row count, error, or unavailable).\n * Uses Tailwind so it stays consistent with the rest of the artifact renderer.\n */\nexport function StatusMessage({ $tone, children }: StatusMessageProps): ReactNode {\n return createElement(\n \"div\",\n {\n className: `py-6 px-2 text-center text-sm font-medium leading-5 ${\n $tone === \"error\" ? \"text-red-600\" : \"text-brown-70\"\n }`,\n },\n children\n );\n}\n","/**\n * Discriminant constants for `TableArtifactDataState.status`.\n *\n * Use these instead of inline string literals so a typo is a compile-time error rather than a\n * silent wrong-branch at runtime.\n */\nexport const TABLE_STATUS = {\n LOADING: \"loading\",\n READY: \"ready\",\n ERROR: \"error\",\n UNAVAILABLE: \"unavailable\",\n} as const;\n","import type { TableColumn, TableRow as TableRowData } from \"@/components/artifacts/types\";\n\n/**\n * Returns a cell's rendered string. The CSV is the source of truth — clay never coerces or\n * reformats values. `null` / missing keys render as the empty cell. The value comes out as it\n * went in (whatever the server wrote into the CSV).\n */\nexport function formatCell(row: TableRowData, column: TableColumn): string {\n return row[column.key] ?? \"\";\n}\n\n/**\n * Header + body cell class strings. Alignment is uniformly left in chat-embedded artifact tables\n * by design (mixing right-aligned numerics with left-aligned text reads inconsistently); the\n * wire-type `column.align` is preserved for forward-compat but ignored at render time. See\n * `TableColumn.align` doc in `@/components/artifacts/types`.\n */\nexport const HEAD_CLASS = \"h-auto py-2 px-4 text-xs font-medium text-foreground whitespace-nowrap text-left\";\nexport const CELL_CLASS = \"p-4 text-sm font-normal text-foreground align-top min-w-[150px] text-left\";\n\n/**\n * Row tint matches the artifact card's frosted-glass scheme. The custom `border-b-brown-30`\n * overrides shadcn's row-default border (which inherits `--color-border` = brown-40) with the\n * lighter brown-30. Hover lifts to `bg-secondary` (opaque brown-20) for strong feedback against\n * the translucent base.\n */\nexport const ROW_CLASSES = \"border-b-brown-30 bg-background/70 hover:bg-secondary\";\n\n/**\n * Mount-time fade-in for data rows so the shimmer-to-data transition feels smooth (300ms ease-in\n * over `opacity: 0 → 1`). Shimmer rows keep `ROW_CLASSES` (no animate-in) so they remain in their\n * loading stillness while the pulse animation runs. `animate-in fade-in duration-300` is provided\n * by `tw-animate-css`.\n */\nexport const DATA_ROW_CLASSES = `${ROW_CLASSES} animate-in fade-in duration-300`;\n\n/** Layered drop-shadow for the scroll-lift effect on the sticky header. */\nexport const SCROLL_SHADOW = \"0 1px 2px rgb(0 0 0 / 0.01), 0 6px 12px -2px rgb(0 0 0 / 0.03)\";\n","import { type ReactNode } from \"react\";\n\nimport { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, useScrollShadow } from \"@/components/table\";\nimport type { TableColumn, TableRow as TableRowData } from \"@/components/artifacts/types\";\nimport { StatusMessage } from \"./table-artifact-styles\";\nimport type { ArtifactTableProps, TableArtifactContentProps } from \"./table-artifact-content.types\";\nimport { TABLE_STATUS } from \"./table-artifact-content.constants\";\nimport {\n CELL_CLASS,\n DATA_ROW_CLASSES,\n formatCell,\n HEAD_CLASS,\n ROW_CLASSES,\n SCROLL_SHADOW,\n} from \"./table-artifact-content.utils\";\n\n/**\n * Bridges artifact data-states → shadcn's compound `Table` primitives.\n *\n * The four states render differently:\n *\n * - **loading w/ knownRowCount** → renders a sticky-header table with N shimmer rows so the\n * layout doesn't jump.\n * - **loading w/o knownRowCount** → renders the inline \"Loading table…\" status message.\n * - **error / unavailable** → renders an inline status message.\n * - **ready** → renders the full table with data rows and the scroll-lift\n * shadow on the sticky header.\n *\n * The shadcn primitives are composed directly here — no `Table` wrapper component sits in between.\n * Each row variant (header, data, shimmer, empty) is a small inline component below.\n */\nexport function TableArtifactContent({\n columns,\n data,\n knownRowCount,\n maxShimmerRows,\n maxBodyHeight,\n unavailableMessage,\n}: TableArtifactContentProps): ReactNode {\n if (data.status === TABLE_STATUS.ERROR) {\n // No retry hook today — copy intentionally drops the \"Please try again.\" that has nowhere\n // to land. Wire an `onRetry` callback into `ArtifactService` to re-mint a fresh\n // presigned URL before re-introducing the retry framing.\n return <StatusMessage $tone=\"error\">Couldn't load table data.</StatusMessage>;\n }\n if (data.status === TABLE_STATUS.UNAVAILABLE) {\n return <StatusMessage $tone=\"info\">{unavailableMessage}</StatusMessage>;\n }\n if (data.status === TABLE_STATUS.LOADING) {\n if (typeof knownRowCount === \"number\" && knownRowCount > 0) {\n const shimmerCount = Math.min(knownRowCount, maxShimmerRows);\n return (\n <ArtifactTable columns={columns} maxBodyHeight={maxBodyHeight}>\n {renderShimmerRows(columns, shimmerCount)}\n </ArtifactTable>\n );\n }\n return <StatusMessage $tone=\"info\">Loading table…</StatusMessage>;\n }\n // data.status === TABLE_STATUS.READY\n return (\n <ArtifactTable columns={columns} maxBodyHeight={maxBodyHeight}>\n {data.rows.length === 0 ? renderEmptyRow(columns.length) : renderDataRows(columns, data.rows)}\n </ArtifactTable>\n );\n}\n\n/**\n * Compound-table chrome shared between the loading-shimmer branch and the data/empty branch:\n * scroll container, sticky header, and the body slot. Caller passes the body rows.\n */\nfunction ArtifactTable({ columns, maxBodyHeight, children }: ArtifactTableProps): ReactNode {\n const { targetRef, isScrolled } = useScrollShadow();\n return (\n <div ref={targetRef} className=\"overscroll-none\" style={{ maxHeight: maxBodyHeight, overflowY: \"auto\" }}>\n <Table containerClassName=\"overflow-visible\">\n <TableHeader\n data-scrolled={isScrolled ? \"true\" : undefined}\n className=\"sticky top-0 z-10 bg-background/70 backdrop-blur-lg transition-shadow\"\n style={isScrolled ? { boxShadow: SCROLL_SHADOW } : undefined}\n >\n <TableRow className=\"hover:bg-transparent\">\n {columns.map((column) => (\n <TableHead key={column.key} scope=\"col\" className={HEAD_CLASS}>\n {column.label}\n </TableHead>\n ))}\n </TableRow>\n </TableHeader>\n <TableBody>{children}</TableBody>\n </Table>\n </div>\n );\n}\n\nfunction renderShimmerRows(columns: TableColumn[], count: number): ReactNode {\n return Array.from({ length: count }).map((_, index) => (\n <TableRow key={`shimmer-${index}`} className={ROW_CLASSES} aria-hidden=\"true\">\n {columns.map((column) => (\n <TableCell key={column.key} className={CELL_CLASS}>\n <span className=\"block h-3 w-3/4 animate-pulse rounded bg-muted-foreground/20\" />\n </TableCell>\n ))}\n </TableRow>\n ));\n}\n\nfunction renderDataRows(columns: TableColumn[], rows: TableRowData[]): ReactNode {\n // `key={index}` is safe today because `rows` is a static fetch result — no sort, filter, or\n // streaming insertion. The moment row order can change (e.g. client-side sort feature), this\n // must switch to a stable per-row identity or React will reconcile incorrectly (inputs lose\n // focus, animations glitch). The data hook will need to surface a row-id at that point.\n return rows.map((row, index) => (\n <TableRow key={index} className={DATA_ROW_CLASSES}>\n {columns.map((column) => (\n <TableCell key={column.key} className={CELL_CLASS}>\n {formatCell(row, column)}\n </TableCell>\n ))}\n </TableRow>\n ));\n}\n\nfunction renderEmptyRow(colSpan: number): ReactNode {\n return (\n <TableRow className=\"hover:bg-transparent\">\n <TableCell colSpan={colSpan} className=\"py-6 text-center text-sm text-muted-foreground\">\n No rows to display.\n </TableCell>\n </TableRow>\n );\n}\n","import { useEffect, useMemo, useState } from \"react\";\n\nimport type { TableColumn, TableRow } from \"@/components/artifacts/types\";\nimport { parseCsv } from \"./parse-csv\";\n\n/**\n * Discriminator for the result returned by `useTableArtifactData`.\n *\n * - `loading` — fetch is in flight (or about to be).\n * - `ready` — payload fetched and parsed successfully.\n * - `error` — fetch or parse failed at runtime; user can retry.\n * - `unavailable` — the artifact has no presigned URL at all (permanent server-side state). Distinct\n * from `error` so the renderer can surface \"data is unavailable\" instead of a misleading \"try again\".\n */\nexport type TableArtifactDataState =\n | { status: \"loading\"; rows: null; error: null }\n | { status: \"ready\"; rows: TableRow[]; error: null }\n | { status: \"error\"; rows: null; error: Error }\n | { status: \"unavailable\"; rows: null; error: null };\n\nconst LOADING: TableArtifactDataState = { status: \"loading\", rows: null, error: null };\nconst UNAVAILABLE: TableArtifactDataState = { status: \"unavailable\", rows: null, error: null };\n\ninterface InternalState {\n /** The cache key the current `data` was fetched for; used to ignore stale data when inputs change. */\n cacheKey: string | null;\n /** The fetch result for `cacheKey`. */\n data: TableArtifactDataState;\n}\n\nconst INITIAL_INTERNAL: InternalState = { cacheKey: null, data: LOADING };\n\n/**\n * Builds a stable fingerprint string for a columns array so the effect only re-runs when the\n * column definitions actually change, not just when the array reference is replaced.\n */\nfunction columnsFingerprint(columns: TableColumn[]): string {\n return columns.map((c) => `${c.key}:${c.type ?? \"string\"}`).join(\"|\");\n}\n\n/**\n * Fetches a table artifact's data payload from a presigned URL and parses it as CSV.\n *\n * The server writes `text/csv` to the presigned URL (io-server PR #2096). This hook fetches with\n * `Accept: text/csv`, reads the body as text, and delegates to `parseCsv` for RFC 4180 parsing\n * and per-column type coercion (CSV strings → typed values per `column.type`).\n *\n * Returns `loading` while the request is in flight, `unavailable` synchronously when no URL is\n * supplied, `ready` on success, or `error` on a runtime failure (HTTP non-2xx, network, or parse\n * error). Parse errors are surfaced as `error` state — they are never thrown.\n *\n * In-flight requests are cancelled via `AbortController` when the URL or columns change, or the\n * consumer unmounts, so abandoned table loads don't keep consuming bandwidth.\n *\n * @param presignedUrl S3 presigned URL for the artifact's CSV file, or `null`/`undefined` when absent.\n * @param columns Column definitions from `TableConfig.columns` — used for per-cell type coercion.\n */\nexport function useTableArtifactData(\n presignedUrl: string | null | undefined,\n columns: TableColumn[]\n): TableArtifactDataState {\n // Stable fingerprint so the effect doesn't re-fire on referentially-new but content-equal column arrays.\n const colsKey = useMemo(() => columnsFingerprint(columns), [columns]);\n\n const cacheKey = presignedUrl ? `${presignedUrl}::${colsKey}` : null;\n\n const [state, setState] = useState<InternalState>(INITIAL_INTERNAL);\n\n useEffect(() => {\n if (!presignedUrl) return;\n\n const controller = new AbortController();\n\n fetch(presignedUrl, {\n signal: controller.signal,\n headers: { Accept: \"text/csv\" },\n // Presigned URLs are cross-origin S3 in production and don't need credentials. Explicit\n // omit so a same-origin URL (compromised payload, local dev) can't accidentally receive\n // session cookies or auth headers.\n credentials: \"omit\",\n })\n .then(async (response) => {\n if (!response.ok) throw new Error(`Failed to load table data (${response.status})`);\n return response.text();\n })\n .then((text) => {\n if (controller.signal.aborted) return;\n try {\n const rows = parseCsv(text, columns);\n setState({ cacheKey: `${presignedUrl}::${colsKey}`, data: { status: \"ready\", rows, error: null } });\n } catch (parseError: unknown) {\n console.error(\"[TableArtifact] CSV parse failed\", parseError);\n const err = parseError instanceof Error ? parseError : new Error(String(parseError));\n setState({ cacheKey: `${presignedUrl}::${colsKey}`, data: { status: \"error\", rows: null, error: err } });\n }\n })\n .catch((error: unknown) => {\n // Per the Fetch spec, `signal.aborted` is set before the promise rejects on abort, so this\n // guard catches every abort case driven by our `controller.abort()` cleanup.\n if (controller.signal.aborted) return;\n console.error(\"[TableArtifact] Fetch failed\", error);\n const err = error instanceof Error ? error : new Error(String(error));\n setState({ cacheKey: `${presignedUrl}::${colsKey}`, data: { status: \"error\", rows: null, error: err } });\n });\n\n return () => {\n controller.abort();\n };\n // `columns` is intentionally omitted from the dep array: `colsKey` is its stable fingerprint\n // (covers every observable change), and `columns` is validated config from a static payload\n // that cannot mutate between effect invocation and fetch resolution. If `columns` ever becomes\n // dynamic (e.g. a future column-reorder UI), this assumption breaks and the suppression must\n // be removed in favour of including `columns` directly.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [presignedUrl, colsKey]);\n\n if (!presignedUrl) return UNAVAILABLE;\n // While the in-flight URL/columns change, cached data belongs to a stale key — return loading until\n // the new fetch resolves. Avoids a synchronous setState() in the effect body (lint forbids that).\n if (state.cacheKey !== cacheKey) return LOADING;\n return state.data;\n}\n","import Papa from \"papaparse\";\n\nimport type { TableColumn, TableRow } from \"@/components/artifacts/types\";\n\n/**\n * Parses a CSV text payload fetched from a presigned URL into `TableRow[]`.\n *\n * Uses `Papa.parse` with `header: true` (first row is the header) and `skipEmptyLines: true`.\n * Every cell arrives as a string — the renderer NEVER coerces values to JS numbers / booleans /\n * dates. Format conversion is a server concern: if a column needs to be `\"Yes/No\"` or\n * `\"$1,234\"`, the server emits it that way in the CSV.\n *\n * Column projection rules:\n * - CSV header columns NOT in `columns[].key` are silently dropped.\n * - `columns[].key` values missing from the CSV header are silently omitted from row output —\n * client-side reconciliation warnings would let the client second-guess the server's contract.\n * Trust the CSV.\n *\n * Empty cells (`\"\"`) are returned as `null` so the renderer can distinguish \"missing value\"\n * from \"empty string\" downstream.\n *\n * @param text Raw CSV text (may start with a UTF-8 BOM which Papa strips automatically).\n * @param columns Column definitions from `TableConfig.columns`.\n * @returns Rows in source order, projected to the configured columns.\n */\nexport function parseCsv(text: string, columns: TableColumn[]): TableRow[] {\n const result = Papa.parse<Record<string, string>>(text, {\n header: true,\n skipEmptyLines: true,\n dynamicTyping: false,\n });\n\n const csvHeaders = new Set(result.meta?.fields ?? []);\n const presentColumns = columns.filter((col) => csvHeaders.has(col.key));\n\n return result.data.map((rawRow) => {\n const row: TableRow = {};\n for (const column of presentColumns) {\n const value = rawRow[column.key];\n row[column.key] = value === undefined || value === \"\" ? null : value;\n }\n return row;\n });\n}\n","import type { TableColumn, TableConfig } from \"@/components/artifacts/types\";\n\n/**\n * Returns true iff `config` carries the minimum-viable shape for rendering: a non-empty array\n * of columns where each has a non-empty `key` and a string `label`.\n *\n * Anything else is trusted to the server. The deprecated `type` / `align` wire fields are NOT\n * validated — clay doesn't act on them, so rejecting unknown values would punish servers\n * shipping fields clay was about to ignore anyway.\n */\nexport function isValidTableConfig(config: unknown): config is TableConfig {\n if (!config || typeof config !== \"object\") return false;\n const candidate = config as { columns?: unknown };\n if (!Array.isArray(candidate.columns)) return false;\n if (candidate.columns.length === 0) return false;\n return candidate.columns.every(isValidTableColumn);\n}\n\n/** Minimum-viable column shape: non-empty string `key` + string `label`. */\nfunction isValidTableColumn(column: unknown): column is TableColumn {\n if (!column || typeof column !== \"object\") return false;\n const candidate = column as Record<string, unknown>;\n if (typeof candidate.key !== \"string\" || candidate.key.length === 0) return false;\n if (typeof candidate.label !== \"string\") return false;\n return true;\n}\n","import type { TableArtifactRecord } from \"@/components/artifacts/types\";\n\n/**\n * Produces a plain-text clipboard representation of a table artifact.\n *\n * Returns the artifact title as plain text so that pasting into non-markdown-aware targets\n * (plain-text editors, terminal, spreadsheets) does not expose raw markdown syntax. This\n * matches the contract of `TextBlockService.toClipboardText`, which also strips markdown —\n * `useCopyToClipboard` writes the aggregated string verbatim, so every block type must\n * independently normalise to plain text.\n *\n * The presigned URL is intentionally omitted from the clipboard value: presigned URLs expire\n * quickly (typically 15 min–1 h) and are not useful when pasted as bare text. The Download\n * button in the artifact chrome is the canonical way to obtain the file.\n */\nexport function tableArtifactToClipboardText(artifact: TableArtifactRecord): string {\n const trimmedTitle = artifact.title?.trim();\n return trimmedTitle || \"Table\";\n}\n","import type { ArtifactService, TableArtifactRecord } from \"../types\";\nimport { artifactTypes } from \"../types\";\nimport { TableArtifact } from \"../table-artifact/table-artifact\";\nimport { tableArtifactToClipboardText } from \"../table-artifact/to-clipboard-text\";\n\nexport const TableArtifactService: ArtifactService<TableArtifactRecord> = {\n type: artifactTypes.TABLE,\n Component: TableArtifact,\n toClipboardText: tableArtifactToClipboardText,\n};\n","import type { ArtifactRecord, ArtifactService, ArtifactType } from \"../types\";\nimport { artifactTypes } from \"../types\";\nimport { TableArtifactService } from \"./table-artifact-service\";\n\n// `ArtifactService<TSpecific>` is invariant on `TSpecific` via React's `ComponentType`\n// (props are contravariant). Each service overlaps structurally with the base `ArtifactService`\n// enough for a direct `as ArtifactService` cast. The registry dispatches only by runtime\n// discriminator — `ArtifactServices[artifact.type]` always resolves to the matching concrete service.\n/**\n * Map of artifact services keyed by `artifact.type`.\n *\n * Adding a new artifact type = create a `*-service.ts` file (mirroring `block-services/`), then\n * add one entry here. The block-level dispatcher (`ArtifactRefBlock`) consumes this map to\n * render the concrete component; `artifactToClipboardText` consumes it for the clipboard contract.\n */\nexport const ArtifactServices: Record<ArtifactType, ArtifactService> = {\n [artifactTypes.TABLE]: TableArtifactService as ArtifactService,\n};\n\n/**\n * Returns a clipboard-friendly string for an artifact, delegating to the registered service's\n * `toClipboardText`. Falls back to `[Artifact: <title>]` when the artifact type has no registered\n * service (unknown type) so copy never silently produces an empty string.\n */\nexport function artifactToClipboardText(artifact: ArtifactRecord): string {\n const entry = ArtifactServices[artifact.type];\n if (!entry) {\n return `[Artifact: ${artifact.title ?? artifact.type}]`;\n }\n return entry.toClipboardText(artifact);\n}\n"],"mappings":";;;;;;;;;;;;;;;AAeO,IAAM,gBAAgB;AAAA,EAC3B,OAAO;AACT;A;;;;;ACjBA,IAAA,oBAAe;EACb,SAAS;IACP,OAAO;IACP,OAAO;IACP,QAAQ;IACR,SAAS;IACT,MAAM;IACN,QAAQ;IACR,aAAa;IACb,eAAe;IACf,gBAAgB;EAAA;EAElB,QAAQ;IACN,OAAO;IACP,OAAO;IACP,QAAQ;IACR,SAAS;IACT,MAAM;IACN,QAAQ;EAAA;AAEZ;;;AChBA,IAAM,uBAAuB,CAC3B,MACA,UACA,gBACA,aACG;AACH,QAAM,YAAY;IAChB,CACE,EAAE,QAAQ,gBAAgB,OAAO,IAAI,SAAS,GAAG,OAAO,WAAW,UAAU,GAAG,KAAA,GAChF,QAEA;MACE;MACA;QACE;QACA,GAAG,kBAAkB,IAAI;QACzB,OAAO;QACP,QAAQ;QACR,WAAW,CAAC,eAAe,eAAe,QAAQ,IAAI,SAAS,EAAE,KAAK,GAAG;QACzE,GAAI,SAAS,WACT;UACE,MAAM;QAAA,IAER;UACE,aAAa;UACb,QAAQ;QAAA;QAEd,GAAG;MAAA;MAEL;QACE,SAAS,cAAc,SAAS,EAAE,KAAK,YAAA,GAAe,KAAK;QAC3D,GAAG,SAAS,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM,cAAc,KAAK,KAAK,CAAC;QAC3D,GAAI,MAAM,QAAQ,QAAQ,IAAI,WAAW,CAAC,QAAQ;MAAA;IACpD;EACF;AAGJ,YAAU,cAAc,GAAG,cAAc;AAEzC,SAAO;AACT;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tD;AACA,SAAO,MAAM,gBAAgB,QAAQ;AACvC;","names":["__iconNode","__iconNode","__iconNode","__iconNode","jsx","useEffect","jsx","createElement","jsx","jsxs","jsx","jsxs","useEffect"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ui/table.tsx","../src/lib/utils.ts","../src/components/table/use-scroll-shadow.ts"],"sourcesContent":["import * as React from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\n/** Extension of shadcn's `Table` registry component: exposes `containerClassName` so callers can\n * override the wrapping `<div>`'s default `overflow-auto`. We need this for sticky-header support\n * (sticky uses the nearest overflow ancestor as its containing block — when the actual scroll\n * container is one level out, the inner overflow-auto needs to be neutralised with\n * `overflow-visible` so sticky aligns with the real scrolling parent). */\nconst Table = React.forwardRef<\n HTMLTableElement,\n React.HTMLAttributes<HTMLTableElement> & { containerClassName?: string }\n>(({ className, containerClassName, ...props }, ref) => (\n <div className={cn(\"relative w-full overflow-auto\", containerClassName)}>\n <table ref={ref} className={cn(\"w-full caption-bottom text-sm\", className)} {...props} />\n </div>\n));\nTable.displayName = \"Table\";\n\nconst TableHeader = React.forwardRef<HTMLTableSectionElement, React.HTMLAttributes<HTMLTableSectionElement>>(\n ({ className, ...props }, ref) => <thead ref={ref} className={cn(\"[&_tr]:border-b\", className)} {...props} />\n);\nTableHeader.displayName = \"TableHeader\";\n\nconst TableBody = React.forwardRef<HTMLTableSectionElement, React.HTMLAttributes<HTMLTableSectionElement>>(\n ({ className, ...props }, ref) => (\n <tbody ref={ref} className={cn(\"[&_tr:last-child]:border-0\", className)} {...props} />\n )\n);\nTableBody.displayName = \"TableBody\";\n\nconst TableFooter = React.forwardRef<HTMLTableSectionElement, React.HTMLAttributes<HTMLTableSectionElement>>(\n ({ className, ...props }, ref) => (\n <tfoot ref={ref} className={cn(\"border-t bg-muted/50 font-medium [&>tr]:last:border-b-0\", className)} {...props} />\n )\n);\nTableFooter.displayName = \"TableFooter\";\n\nconst TableRow = React.forwardRef<HTMLTableRowElement, React.HTMLAttributes<HTMLTableRowElement>>(\n ({ className, ...props }, ref) => (\n <tr\n ref={ref}\n className={cn(\"border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted\", className)}\n {...props}\n />\n )\n);\nTableRow.displayName = \"TableRow\";\n\nconst TableHead = React.forwardRef<HTMLTableCellElement, React.ThHTMLAttributes<HTMLTableCellElement>>(\n ({ className, ...props }, ref) => (\n <th\n ref={ref}\n className={cn(\n \"h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0\",\n className\n )}\n {...props}\n />\n )\n);\nTableHead.displayName = \"TableHead\";\n\nconst TableCell = React.forwardRef<HTMLTableCellElement, React.TdHTMLAttributes<HTMLTableCellElement>>(\n ({ className, ...props }, ref) => (\n <td ref={ref} className={cn(\"p-4 align-middle [&:has([role=checkbox])]:pr-0\", className)} {...props} />\n )\n);\nTableCell.displayName = \"TableCell\";\n\nconst TableCaption = React.forwardRef<HTMLTableCaptionElement, React.HTMLAttributes<HTMLTableCaptionElement>>(\n ({ className, ...props }, ref) => (\n <caption ref={ref} className={cn(\"mt-4 text-sm text-muted-foreground\", className)} {...props} />\n )\n);\nTableCaption.displayName = \"TableCaption\";\n\nexport { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption };\n","import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\n/**\n * Combines class names using clsx and tailwind-merge — the standard shadcn/ui helper.\n * Tailwind classes that conflict (e.g. `p-2 p-4`) get merged so the last one wins.\n */\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs));\n}\n","import { useEffect, useRef, useState, type RefObject } from \"react\";\n\n/**\n * Tracks whether a scroll container has scrolled past its top edge, for sticky-header shadow effects.\n *\n * Returns `targetRef` (attach to the scroll container itself or any element inside it) and\n * `isScrolled` (true once the container's `scrollTop > 0`). On mount the hook walks up the DOM\n * from the target to find the nearest overflow ancestor (or uses the target itself if it already\n * has `overflowY: auto | scroll`), then listens to its `scroll` event.\n *\n * Used to surface a subtle \"scroll lift\" shadow under sticky headers so users know there is\n * content hidden above.\n *\n * **Why a scroll listener and not a sentinel + IntersectionObserver:** an earlier version used a\n * 1px sentinel as the first child of the scroll container. The sentinel's height pushed the thead\n * down by one pixel in normal flow, and as soon as the user scrolled the thead snapped up to its\n * sticky position — a visible 1px jitter. A scroll listener has no layout footprint.\n *\n * `passive: true` so the listener doesn't block native scroll smoothness; we never call\n * `preventDefault`.\n */\nexport function useScrollShadow(): {\n targetRef: RefObject<HTMLDivElement | null>;\n isScrolled: boolean;\n} {\n const targetRef = useRef<HTMLDivElement>(null);\n const [isScrolled, setIsScrolled] = useState(false);\n\n useEffect(() => {\n const target = targetRef.current;\n if (!target) return;\n\n let scrollContainer: HTMLElement | null = target;\n while (scrollContainer) {\n const overflowY = getComputedStyle(scrollContainer).overflowY;\n if (overflowY === \"auto\" || overflowY === \"scroll\") break;\n scrollContainer = scrollContainer.parentElement;\n }\n if (!scrollContainer) return;\n\n setIsScrolled(scrollContainer.scrollTop > 0);\n\n const handleScroll = () => {\n if (!scrollContainer) return;\n setIsScrolled(scrollContainer.scrollTop > 0);\n };\n scrollContainer.addEventListener(\"scroll\", handleScroll, { passive: true });\n return () => scrollContainer.removeEventListener(\"scroll\", handleScroll);\n }, []);\n\n return { targetRef, isScrolled };\n}\n"],"mappings":";AAAA,YAAY,WAAW;;;ACAvB,SAAS,YAA6B;AACtC,SAAS,eAAe;AAMjB,SAAS,MAAM,QAA8B;AAClD,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;ADKI;AALJ,IAAM,QAAc,iBAGlB,CAAC,EAAE,WAAW,oBAAoB,GAAG,MAAM,GAAG,QAC9C,oBAAC,SAAI,WAAW,GAAG,iCAAiC,kBAAkB,GACpE,8BAAC,WAAM,KAAU,WAAW,GAAG,iCAAiC,SAAS,GAAI,GAAG,OAAO,GACzF,CACD;AACD,MAAM,cAAc;AAEpB,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,QAAQ,gBAAgC;AAqBrD,SAAS,kBAGd;AACA,QAAM,YAAY,OAAuB,IAAI;AAC7C,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAElD,YAAU,MAAM;AACd,UAAM,SAAS,UAAU;AACzB,QAAI,CAAC,OAAQ;AAEb,QAAI,kBAAsC;AAC1C,WAAO,iBAAiB;AACtB,YAAM,YAAY,iBAAiB,eAAe,EAAE;AACpD,UAAI,cAAc,UAAU,cAAc,SAAU;AACpD,wBAAkB,gBAAgB;AAAA,IACpC;AACA,QAAI,CAAC,gBAAiB;AAEtB,kBAAc,gBAAgB,YAAY,CAAC;AAE3C,UAAM,eAAe,MAAM;AACzB,UAAI,CAAC,gBAAiB;AACtB,oBAAc,gBAAgB,YAAY,CAAC;AAAA,IAC7C;AACA,oBAAgB,iBAAiB,UAAU,cAAc,EAAE,SAAS,KAAK,CAAC;AAC1E,WAAO,MAAM,gBAAgB,oBAAoB,UAAU,YAAY;AAAA,EACzE,GAAG,CAAC,CAAC;AAEL,SAAO,EAAE,WAAW,WAAW;AACjC;","names":[]}
|
package/dist/chunk-MEJESPTZ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=chunk-MEJESPTZ.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/blocks/types.ts","../src/components/blocks/artifact-ref-block/artifact-ref-block.tsx","../src/components/blocks/block-services/artifact-ref-block-service.ts","../src/components/blocks/text-block/text-block.tsx","../src/components/blocks/scrollable-table/scrollable-table-styles.ts","../src/components/blocks/scrollable-table/scrollable-table.tsx","../src/components/blocks/text-block/sanitize.ts","../src/components/blocks/text-block/text-block-styles.ts","../src/components/blocks/block-services/text-block-service.ts","../src/components/blocks/block-services/index.ts","../src/components/blocks/block/block.tsx"],"sourcesContent":["import type { ComponentType } from \"react\";\n\nimport type { ArtifactRecord } from \"@/components/artifacts/types\";\n\n/** Block-type discriminator constants. Mirrors the wire shape from io-server / shapes-agent. */\nexport const blockTypes = {\n TEXT: \"TEXT\",\n ARTIFACT_REF: \"ARTIFACT_REF\",\n} as const;\n\n/** Discriminator for content blocks. */\nexport type BlockType = (typeof blockTypes)[keyof typeof blockTypes];\n\n/** Plain-text content block — rendered as Markdown. */\nexport interface TextBlockRecord {\n /** Block-type discriminator. */\n type: typeof blockTypes.TEXT;\n /** Type-specific data; kept as `payload` to match the wire shape 1:1. */\n payload: {\n /** The Markdown source for this text segment. */\n text: string;\n };\n}\n\n/**\n * Reference-to-an-artifact content block — dispatched to the per-type artifact component.\n *\n * The artifact-domain types (`ArtifactRecord`, `TableArtifactRecord`, etc.) live in\n * `@/components/artifacts/types` so the artifact layer can be consumed independently of the\n * block layer (e.g. by a future surface that renders an artifact outside chat). The block layer\n * imports them here to wrap an artifact in an `ARTIFACT_REF` block.\n */\nexport interface ArtifactRefBlockRecord {\n /** Block-type discriminator. */\n type: typeof blockTypes.ARTIFACT_REF;\n /** Type-specific data; kept as `payload` to match the wire shape 1:1. */\n payload: {\n /** The artifact's stable identifier, used for keying / future cross-message reuse. */\n artifactId: string;\n /** Inlined artifact metadata — clients fetch the underlying data via `artifact.protectedAsset.presignedUrl`. */\n artifact: ArtifactRecord;\n };\n}\n\n/** Discriminated union of all supported content blocks. Additive — new types extend this union. */\nexport type BlockRecord = TextBlockRecord | ArtifactRefBlockRecord;\n\n/** Props every concrete block component receives from the dispatcher. */\nexport interface BlockComponentProps<TBlock extends BlockRecord = BlockRecord> {\n /** The block to render. */\n block: TBlock;\n}\n\n/** Per-block-type service — registry entry that pairs a discriminator with its concrete component. */\nexport interface BlockService<TBlock extends BlockRecord = BlockRecord> {\n /** Discriminator value this service handles. */\n type: BlockType;\n /** React component that renders a block of this type. */\n Component: ComponentType<BlockComponentProps<TBlock>>;\n /**\n * Returns a plain-text or markdown string representation of this block suitable for clipboard\n * copy. Called by `copyMessageText` when the user clicks \"copy message\".\n *\n * - `TextBlockService`: returns `block.payload.text` verbatim (markdown preserved).\n * - `ArtifactRefBlockService`: delegates to `ArtifactServices[artifact.type].toClipboardText`.\n * Falls back to `[Artifact: <title>]` when the artifact type has no registered component.\n *\n * Optional so external `BlockService` implementors don't break on upgrade — when omitted, the\n * aggregator treats the block as contributing the empty string (silently skipped). Implementations\n * must be pure, synchronous functions — no async, no hooks, no side effects.\n */\n toClipboardText?: (block: TBlock) => string;\n}\n","import type { ReactNode } from \"react\";\n\nimport { ArtifactServices } from \"@/components/artifacts/artifact-services\";\nimport type { ArtifactRefBlockRecord, BlockComponentProps } from \"../types\";\n\n/**\n * Renders an `ARTIFACT_REF` block by dispatching the inlined artifact to its per-type component.\n *\n * This is the single bridge between the block layer and the artifact layer. It does the\n * `artifact.type → concrete component` lookup directly via the `ArtifactServices` map —\n * there is intentionally no separate `<ArtifactComponent>` JSX dispatcher in between.\n *\n * Unknown artifact types render as `null` (the map only contains types we know how to\n * render). Older clients receiving a future artifact type they don't yet support degrade\n * silently rather than crashing the chat.\n */\nexport function ArtifactRefBlock({ block }: BlockComponentProps<ArtifactRefBlockRecord>): ReactNode {\n const { artifact } = block.payload;\n const entry = ArtifactServices[artifact.type];\n if (!entry) return null;\n const { Component } = entry;\n return <Component artifact={artifact} />;\n}\n","import { artifactToClipboardText } from \"@/components/artifacts/artifact-services\";\nimport { ArtifactRefBlock } from \"../artifact-ref-block/artifact-ref-block\";\nimport { blockTypes } from \"../types\";\nimport type { ArtifactRefBlockRecord, BlockService } from \"../types\";\n\nexport const ArtifactRefBlockService: BlockService<ArtifactRefBlockRecord> = {\n type: blockTypes.ARTIFACT_REF,\n Component: ArtifactRefBlock,\n /**\n * Delegates to the registered artifact component's `toClipboardText`. Falls back to\n * `[Artifact: <title>]` via `artifactToClipboardText`'s own fallback when the artifact type\n * has no registered component, so copy never silently produces an empty string.\n */\n toClipboardText: (block) => artifactToClipboardText(block.payload.artifact),\n};\n","import type { ReactNode } from \"react\";\nimport ReactMarkdown from \"react-markdown\";\nimport remarkBreaks from \"remark-breaks\";\nimport remarkGfm from \"remark-gfm\";\n\nimport { ScrollableTable } from \"../scrollable-table/scrollable-table\";\nimport type { BlockComponentProps, TextBlockRecord } from \"../types\";\nimport { sanitize } from \"./sanitize\";\nimport { TextBlockWrapper } from \"./text-block-styles\";\n\nconst markdownComponents = {\n table: ((tableProps: { node?: unknown; children?: ReactNode }) => (\n <ScrollableTable {...tableProps} />\n )) as React.ComponentType<unknown>,\n};\n\n/** Renders a TEXT block as Markdown with GFM (tables, strikethrough) and line breaks. */\nexport function TextBlock({ block }: BlockComponentProps<TextBlockRecord>): ReactNode {\n return (\n <TextBlockWrapper>\n <ReactMarkdown remarkPlugins={[remarkGfm, remarkBreaks]} components={markdownComponents}>\n {sanitize(block.payload.text)}\n </ReactMarkdown>\n </TextBlockWrapper>\n );\n}\n","import styled from \"styled-components\";\n\nexport const TableContainer = styled.div`\n position: relative;\n margin-block: 8px 16px;\n`;\n\nexport const TableScroll = styled.div`\n width: 100%;\n overflow-x: auto;\n overflow-y: hidden;\n`;\n","import { type ReactNode } from \"react\";\n\nimport { TableContainer, TableScroll } from \"./scrollable-table-styles\";\n\n/** Props for the ScrollableTable component. */\ninterface ScrollableTableProps {\n /** Unused node prop from react-markdown. */\n node?: unknown;\n /** Table children elements. */\n children?: ReactNode;\n}\n\n/** Renders a markdown table inside a horizontally scrollable wrapper. Read-only — actions live on artifact-tables. */\nexport function ScrollableTable({ node: _node, ...props }: ScrollableTableProps): ReactNode {\n return (\n <TableContainer>\n <TableScroll>\n <table {...props} />\n </TableScroll>\n </TableContainer>\n );\n}\n","// Strips io-server's `<!-- table-title: ... -->` HTML-comment metadata before rendering.\n// The marker is emitted by the server's CSV-export pipeline so the export button can label\n// the file; it has no place in the visual output. If the server-side format changes\n// (prefix, spacing, closing-tag style), this filter silently stops matching and the\n// raw HTML comment leaks into rendered Markdown — keep this contract aligned with io-server.\nexport function sanitize(text: string): string {\n return text\n .split(\"\\n\")\n .filter((line) => {\n const t = line.trim();\n return !(t.startsWith(\"<!-- table-title:\") && t.endsWith(\"-->\"));\n })\n .join(\"\\n\");\n}\n","import styled from \"styled-components\";\n\nimport { colors } from \"@/tokens/colors\";\nimport { typographyMixin, typographyTypes } from \"@/tokens/typography\";\n\nexport const TextBlockWrapper = styled.div`\n ${typographyMixin(typographyTypes.GEIST_BODY_S_REGULAR)};\n color: ${colors[\"brown-100\"]};\n word-break: break-word;\n\n & h1 {\n ${typographyMixin(typographyTypes.GEIST_HEADING_S_BOLD)};\n margin-block: 20px;\n }\n\n & h2 {\n ${typographyMixin(typographyTypes.GEIST_BODY_L_SEMI_BOLD)};\n margin-block: 12px;\n }\n\n & h3,\n & h4,\n & h5,\n & h6 {\n ${typographyMixin(typographyTypes.GEIST_BODY_M_SEMI_BOLD)};\n margin-block: 8px;\n }\n\n & strong {\n ${typographyMixin(typographyTypes.GEIST_BODY_S_SEMI_BOLD)};\n }\n\n & p {\n margin-block: 0px;\n }\n\n & p + p {\n margin-block: 8px 0px;\n }\n\n & ul,\n & ol {\n margin-block: 16px;\n padding-left: 20px;\n }\n\n & li + li {\n margin-block: 4px;\n }\n\n & ol {\n list-style-type: decimal;\n }\n\n & ol ol {\n list-style-type: lower-alpha;\n }\n\n & ol ol ol {\n list-style-type: lower-roman;\n }\n\n & a {\n color: inherit;\n text-decoration-line: underline;\n text-decoration-style: dotted;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n transition: color 75ms ease-in-out;\n\n &:hover {\n color: ${colors[\"blue-600\"]};\n }\n }\n\n & hr {\n border: none;\n border-top: 1px solid ${colors[\"brown-40\"]};\n margin-block: 20px;\n }\n\n & table {\n margin: 0;\n width: 100%;\n border-collapse: collapse;\n }\n\n & th,\n & td {\n border: none;\n border-bottom: 1px solid ${colors[\"brown-40\"]};\n text-align: left;\n }\n\n & th {\n ${typographyMixin(typographyTypes.GEIST_LABEL_CAPTION_MEDIUM)};\n padding: 8px;\n }\n\n & td {\n ${typographyMixin(typographyTypes.GEIST_BODY_XS_MEDIUM)};\n padding: 16px 8px;\n min-width: 150px;\n width: 1%;\n }\n\n & td strong {\n font-weight: inherit;\n font-size: inherit;\n line-height: inherit;\n }\n\n & blockquote {\n margin-block: 4px;\n margin-inline: 0px;\n padding-left: 16px;\n border-left: 4px solid ${colors[\"brown-40\"]};\n color: ${colors[\"brown-80\"]};\n }\n`;\n","import { markdownToPlainText } from \"@/utils/markdown-to-plain-text\";\nimport { TextBlock } from \"../text-block/text-block\";\nimport { blockTypes } from \"../types\";\nimport type { BlockService, TextBlockRecord } from \"../types\";\n\nexport const TextBlockService: BlockService<TextBlockRecord> = {\n type: blockTypes.TEXT,\n Component: TextBlock,\n /**\n * Converts the block's markdown source to plain text so the final clipboard value is clean\n * when pasted into tools that don't render markdown. Each block type owns its own clipboard\n * conversion so `useCopyToClipboard` can write text verbatim without a second pass.\n */\n toClipboardText: (block) => markdownToPlainText(block.payload.text),\n};\n","import { blockTypes, type BlockService, type BlockType } from \"../types\";\nimport { ArtifactRefBlockService } from \"./artifact-ref-block-service\";\nimport { TextBlockService } from \"./text-block-service\";\n\n// `BlockService<TBlock>` is invariant on `TBlock` via React's `ComponentType` (props are\n// contravariant). The concrete services overlap structurally with the base `BlockService` type\n// enough for a direct `as BlockService` cast. The registry dispatches by runtime discriminator —\n// `BlockServices[block.type]` always resolves to the matching concrete service — so the cast is sound.\nexport const BlockServices: Record<BlockType, BlockService> = {\n [blockTypes.TEXT]: TextBlockService as BlockService,\n [blockTypes.ARTIFACT_REF]: ArtifactRefBlockService as BlockService,\n};\n","import type { ReactNode } from \"react\";\n\nimport { BlockServices } from \"../block-services\";\nimport type { BlockRecord } from \"../types\";\n\n/** Props for the Block dispatcher. */\ninterface BlockProps {\n /** The block to render. Dispatched to the registered concrete component for its `type`. */\n block: BlockRecord;\n}\n\n/** Dispatches a single block to its registered concrete component. Unknown types render as a no-op. */\nexport function Block({ block }: BlockProps): ReactNode {\n const service = BlockServices[block.type];\n if (!service) return null;\n const { Component } = service;\n return <Component block={block} />;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