@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.
Files changed (56) hide show
  1. package/README.md +60 -0
  2. package/dist/artifacts.cjs +858 -132
  3. package/dist/artifacts.cjs.map +1 -1
  4. package/dist/artifacts.d.cts +38 -5
  5. package/dist/artifacts.d.ts +38 -5
  6. package/dist/artifacts.js +13 -3
  7. package/dist/blocks.cjs +1185 -467
  8. package/dist/blocks.cjs.map +1 -1
  9. package/dist/blocks.css +1 -1
  10. package/dist/blocks.d.cts +23 -10
  11. package/dist/blocks.d.ts +23 -10
  12. package/dist/blocks.js +6 -3
  13. package/dist/chart.cjs +594 -0
  14. package/dist/chart.cjs.map +1 -0
  15. package/dist/chart.d.cts +439 -0
  16. package/dist/chart.d.ts +439 -0
  17. package/dist/chart.js +32 -0
  18. package/dist/chat.cjs +1207 -489
  19. package/dist/chat.cjs.map +1 -1
  20. package/dist/chat.d.cts +3 -2
  21. package/dist/chat.d.ts +3 -2
  22. package/dist/chat.js +7 -4
  23. package/dist/{chunk-MXOPG747.js → chunk-36CB624W.js} +7 -7
  24. package/dist/chunk-36CB624W.js.map +1 -0
  25. package/dist/{chunk-L35M3OD5.js → chunk-4MZZH3WX.js} +5 -11
  26. package/dist/chunk-4MZZH3WX.js.map +1 -0
  27. package/dist/chunk-AQEJRMRN.js +1 -0
  28. package/dist/chunk-AQEJRMRN.js.map +1 -0
  29. package/dist/{chunk-OUW6PUEB.js → chunk-FFX3CAOX.js} +7 -7
  30. package/dist/chunk-P6GUNIAE.js +11 -0
  31. package/dist/chunk-P6GUNIAE.js.map +1 -0
  32. package/dist/chunk-QXGYMDIA.js +477 -0
  33. package/dist/chunk-QXGYMDIA.js.map +1 -0
  34. package/dist/{chunk-BX5TCEPR.js → chunk-Z5JWF24N.js} +388 -105
  35. package/dist/chunk-Z5JWF24N.js.map +1 -0
  36. package/dist/index.cjs +924 -198
  37. package/dist/index.cjs.map +1 -1
  38. package/dist/index.d.cts +4 -3
  39. package/dist/index.d.ts +4 -3
  40. package/dist/index.js +23 -15
  41. package/dist/table.js +2 -1
  42. package/dist/types-B2aYk82c.d.cts +29 -0
  43. package/dist/types-B2aYk82c.d.ts +29 -0
  44. package/dist/types-C0BvwliI.d.cts +332 -0
  45. package/dist/types-C5bFH4v3.d.ts +332 -0
  46. package/dist/{types-DuuRI4ll.d.cts → types-DCutaXjZ.d.cts} +16 -1
  47. package/dist/{types-C9XX-Uhk.d.ts → types-uPfn67Dc.d.ts} +16 -1
  48. package/package.json +13 -1
  49. package/dist/chunk-BX5TCEPR.js.map +0 -1
  50. package/dist/chunk-L35M3OD5.js.map +0 -1
  51. package/dist/chunk-MEJESPTZ.js +0 -1
  52. package/dist/chunk-MXOPG747.js.map +0 -1
  53. package/dist/types-3Gzk7cRt.d.cts +0 -121
  54. package/dist/types-3Gzk7cRt.d.ts +0 -121
  55. /package/dist/{chunk-MEJESPTZ.js.map → chart.js.map} +0 -0
  56. /package/dist/{chunk-OUW6PUEB.js.map → chunk-FFX3CAOX.js.map} +0 -0
@@ -1,6 +1,7 @@
1
- import { c as ArtifactType, a as ArtifactService, A as ArtifactRecord, b as ArtifactServiceProps, T as TableArtifactRecord } from './types-3Gzk7cRt.cjs';
2
- export { d as TableColumn, e as TableConfig, f as TableRow, g as TableStats, h as artifactTypes } from './types-3Gzk7cRt.cjs';
1
+ import { e as ArtifactType, c as ArtifactService, b as ArtifactRecord, d as ArtifactServiceProps, j as TableArtifactRecord, f as ChartArtifactRecord } from './types-C0BvwliI.cjs';
2
+ export { A as ArtifactDataRow, a as ArtifactLabelsMap, B as BarChartConfig, C as ChartArtifactLabels, g as ChartConfig, h as ChartStats, D as DEFAULT_CHART_ARTIFACT_LABELS, i as DEFAULT_TABLE_ARTIFACT_LABELS, L as LineChartConfig, P as PieChartConfig, T as TableArtifactLabels, k as TableColumn, l as TableConfig, m as TableRow, n as TableStats, o as artifactTypes } from './types-C0BvwliI.cjs';
3
3
  import { ReactNode } from 'react';
4
+ export { C as ChartSeries, a as ChartVariant } from './types-B2aYk82c.cjs';
4
5
 
5
6
  /**
6
7
  * Map of artifact services keyed by `artifact.type`.
@@ -28,6 +29,19 @@ interface ArtifactDownloadButtonProps {
28
29
  * `data:` URIs smuggled into `presignedUrl`.
29
30
  */
30
31
  href: string;
32
+ /**
33
+ * Tooltip text + `aria-label` for the button. Optional — defaults to `"Download CSV"` so direct
34
+ * consumers don't have to pass anything for the common case. Per-type artifact orchestrators
35
+ * (`<ChartArtifact>`, `<TableArtifact>`) pass a translated value via their own `labels` prop so
36
+ * the button reads in the user's language.
37
+ */
38
+ label?: string;
39
+ /**
40
+ * Optional callback fired on click — runs alongside the browser's native download navigation
41
+ * (no `preventDefault`). Used for analytics / observability hooks; per-type artifact
42
+ * orchestrators wire this from their `callbacks` prop.
43
+ */
44
+ onClick?: () => void;
31
45
  }
32
46
  /**
33
47
  * Reusable download button for artifact headers. Anchor-based so the browser handles the download
@@ -36,7 +50,7 @@ interface ArtifactDownloadButtonProps {
36
50
  *
37
51
  * Drop this inside `<ArtifactActions>` in any per-type artifact orchestrator.
38
52
  */
39
- declare function ArtifactDownloadButton({ href }: ArtifactDownloadButtonProps): ReactNode;
53
+ declare function ArtifactDownloadButton({ href, label, onClick, }: ArtifactDownloadButtonProps): ReactNode;
40
54
  /**
41
55
  * Returns `true` only for `http:` and `https:` URLs. Rejects `javascript:`, `data:`, and any
42
56
  * other scheme that could execute code on click.
@@ -51,6 +65,25 @@ declare function isSafeDownloadUrl(url: string): boolean;
51
65
  * Download is handled via `ArtifactDownloadButton` — a shared utility component that applies the
52
66
  * safe-URL guard and renders nothing for non-http(s) schemes.
53
67
  */
54
- declare function TableArtifact({ artifact }: ArtifactServiceProps<TableArtifactRecord>): ReactNode;
68
+ declare function TableArtifact({ artifact, labels, callbacks }: ArtifactServiceProps<TableArtifactRecord>): ReactNode;
69
+
70
+ /**
71
+ * Orchestrator for the `CHART`-typed artifact.
72
+ *
73
+ * Composes the ai-elements chrome primitives (`Artifact`, `ArtifactHeader`, `ArtifactTitle`,
74
+ * `ArtifactActions`, `ArtifactContent`) directly around the chart body (`ChartArtifactContent`),
75
+ * matching `TableArtifact`'s shape. Loading / error / unavailable / empty states render an inline
76
+ * `StatusMessage`; the ready state delegates to per-variant recharts trees inside
77
+ * `ChartArtifactContent`.
78
+ *
79
+ * The renderer is variant-agnostic at this level — it doesn't know about LINE vs BAR vs PIE.
80
+ * Variant dispatch lives inside `ChartArtifactContent` so the orchestrator can focus on the
81
+ * data lifecycle and the chrome.
82
+ *
83
+ * Labels for action buttons (download, future copy-as-PNG) are pulled from the optional `labels`
84
+ * prop with per-key fallback to `DEFAULT_CHART_ARTIFACT_LABELS`. Consumers translate via their
85
+ * own i18n layer and pass the bag; non-i18n consumers omit it and get English defaults.
86
+ */
87
+ declare function ChartArtifact({ artifact, labels, callbacks }: ArtifactServiceProps<ChartArtifactRecord>): ReactNode;
55
88
 
56
- export { ArtifactDownloadButton, type ArtifactDownloadButtonProps, ArtifactRecord, ArtifactService, ArtifactServiceProps, ArtifactServices, ArtifactType, TableArtifact, TableArtifactRecord, artifactToClipboardText, isSafeDownloadUrl };
89
+ export { ArtifactDownloadButton, type ArtifactDownloadButtonProps, ArtifactRecord, ArtifactService, ArtifactServiceProps, ArtifactServices, ArtifactType, ChartArtifact, ChartArtifactRecord, TableArtifact, TableArtifactRecord, artifactToClipboardText, isSafeDownloadUrl };
@@ -1,6 +1,7 @@
1
- import { c as ArtifactType, a as ArtifactService, A as ArtifactRecord, b as ArtifactServiceProps, T as TableArtifactRecord } from './types-3Gzk7cRt.js';
2
- export { d as TableColumn, e as TableConfig, f as TableRow, g as TableStats, h as artifactTypes } from './types-3Gzk7cRt.js';
1
+ import { e as ArtifactType, c as ArtifactService, b as ArtifactRecord, d as ArtifactServiceProps, j as TableArtifactRecord, f as ChartArtifactRecord } from './types-C5bFH4v3.js';
2
+ export { A as ArtifactDataRow, a as ArtifactLabelsMap, B as BarChartConfig, C as ChartArtifactLabels, g as ChartConfig, h as ChartStats, D as DEFAULT_CHART_ARTIFACT_LABELS, i as DEFAULT_TABLE_ARTIFACT_LABELS, L as LineChartConfig, P as PieChartConfig, T as TableArtifactLabels, k as TableColumn, l as TableConfig, m as TableRow, n as TableStats, o as artifactTypes } from './types-C5bFH4v3.js';
3
3
  import { ReactNode } from 'react';
4
+ export { C as ChartSeries, a as ChartVariant } from './types-B2aYk82c.js';
4
5
 
5
6
  /**
6
7
  * Map of artifact services keyed by `artifact.type`.
@@ -28,6 +29,19 @@ interface ArtifactDownloadButtonProps {
28
29
  * `data:` URIs smuggled into `presignedUrl`.
29
30
  */
30
31
  href: string;
32
+ /**
33
+ * Tooltip text + `aria-label` for the button. Optional — defaults to `"Download CSV"` so direct
34
+ * consumers don't have to pass anything for the common case. Per-type artifact orchestrators
35
+ * (`<ChartArtifact>`, `<TableArtifact>`) pass a translated value via their own `labels` prop so
36
+ * the button reads in the user's language.
37
+ */
38
+ label?: string;
39
+ /**
40
+ * Optional callback fired on click — runs alongside the browser's native download navigation
41
+ * (no `preventDefault`). Used for analytics / observability hooks; per-type artifact
42
+ * orchestrators wire this from their `callbacks` prop.
43
+ */
44
+ onClick?: () => void;
31
45
  }
32
46
  /**
33
47
  * Reusable download button for artifact headers. Anchor-based so the browser handles the download
@@ -36,7 +50,7 @@ interface ArtifactDownloadButtonProps {
36
50
  *
37
51
  * Drop this inside `<ArtifactActions>` in any per-type artifact orchestrator.
38
52
  */
39
- declare function ArtifactDownloadButton({ href }: ArtifactDownloadButtonProps): ReactNode;
53
+ declare function ArtifactDownloadButton({ href, label, onClick, }: ArtifactDownloadButtonProps): ReactNode;
40
54
  /**
41
55
  * Returns `true` only for `http:` and `https:` URLs. Rejects `javascript:`, `data:`, and any
42
56
  * other scheme that could execute code on click.
@@ -51,6 +65,25 @@ declare function isSafeDownloadUrl(url: string): boolean;
51
65
  * Download is handled via `ArtifactDownloadButton` — a shared utility component that applies the
52
66
  * safe-URL guard and renders nothing for non-http(s) schemes.
53
67
  */
54
- declare function TableArtifact({ artifact }: ArtifactServiceProps<TableArtifactRecord>): ReactNode;
68
+ declare function TableArtifact({ artifact, labels, callbacks }: ArtifactServiceProps<TableArtifactRecord>): ReactNode;
69
+
70
+ /**
71
+ * Orchestrator for the `CHART`-typed artifact.
72
+ *
73
+ * Composes the ai-elements chrome primitives (`Artifact`, `ArtifactHeader`, `ArtifactTitle`,
74
+ * `ArtifactActions`, `ArtifactContent`) directly around the chart body (`ChartArtifactContent`),
75
+ * matching `TableArtifact`'s shape. Loading / error / unavailable / empty states render an inline
76
+ * `StatusMessage`; the ready state delegates to per-variant recharts trees inside
77
+ * `ChartArtifactContent`.
78
+ *
79
+ * The renderer is variant-agnostic at this level — it doesn't know about LINE vs BAR vs PIE.
80
+ * Variant dispatch lives inside `ChartArtifactContent` so the orchestrator can focus on the
81
+ * data lifecycle and the chrome.
82
+ *
83
+ * Labels for action buttons (download, future copy-as-PNG) are pulled from the optional `labels`
84
+ * prop with per-key fallback to `DEFAULT_CHART_ARTIFACT_LABELS`. Consumers translate via their
85
+ * own i18n layer and pass the bag; non-i18n consumers omit it and get English defaults.
86
+ */
87
+ declare function ChartArtifact({ artifact, labels, callbacks }: ArtifactServiceProps<ChartArtifactRecord>): ReactNode;
55
88
 
56
- export { ArtifactDownloadButton, type ArtifactDownloadButtonProps, ArtifactRecord, ArtifactService, ArtifactServiceProps, ArtifactServices, ArtifactType, TableArtifact, TableArtifactRecord, artifactToClipboardText, isSafeDownloadUrl };
89
+ export { ArtifactDownloadButton, type ArtifactDownloadButtonProps, ArtifactRecord, ArtifactService, ArtifactServiceProps, ArtifactServices, ArtifactType, ChartArtifact, ChartArtifactRecord, TableArtifact, TableArtifactRecord, artifactToClipboardText, isSafeDownloadUrl };
package/dist/artifacts.js CHANGED
@@ -1,13 +1,20 @@
1
- import "./chunk-MEJESPTZ.js";
1
+ import "./chunk-AQEJRMRN.js";
2
2
  import {
3
3
  ArtifactDownloadButton,
4
4
  ArtifactServices,
5
+ ChartArtifact,
6
+ DEFAULT_CHART_ARTIFACT_LABELS,
7
+ DEFAULT_TABLE_ARTIFACT_LABELS,
5
8
  TableArtifact,
6
9
  artifactToClipboardText,
7
10
  artifactTypes,
8
11
  isSafeDownloadUrl
9
- } from "./chunk-BX5TCEPR.js";
10
- import "./chunk-L35M3OD5.js";
12
+ } from "./chunk-Z5JWF24N.js";
13
+ import "./chunk-QXGYMDIA.js";
14
+ import "./chunk-C77QMQNT.js";
15
+ import "./chunk-SV24ONND.js";
16
+ import "./chunk-4MZZH3WX.js";
17
+ import "./chunk-P6GUNIAE.js";
11
18
  import "./chunk-OBOXCBDL.js";
12
19
  import "./chunk-OLJIJYB5.js";
13
20
  import "./chunk-JF3P66JF.js";
@@ -15,6 +22,9 @@ import "./chunk-5WRI5ZAA.js";
15
22
  export {
16
23
  ArtifactDownloadButton,
17
24
  ArtifactServices,
25
+ ChartArtifact,
26
+ DEFAULT_CHART_ARTIFACT_LABELS,
27
+ DEFAULT_TABLE_ARTIFACT_LABELS,
18
28
  TableArtifact,
19
29
  artifactToClipboardText,
20
30
  artifactTypes,