@shapesos/clay 0.10.0 → 0.11.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/dist/artifacts.cjs +741 -0
- package/dist/artifacts.cjs.map +1 -0
- package/dist/artifacts.d.cts +56 -0
- package/dist/artifacts.d.ts +56 -0
- package/dist/artifacts.js +23 -0
- package/dist/blocks.cjs +685 -53
- package/dist/blocks.cjs.map +1 -1
- package/dist/blocks.css +2 -0
- package/dist/blocks.d.cts +22 -10
- package/dist/blocks.d.ts +22 -10
- package/dist/blocks.js +15 -5
- package/dist/button.d.cts +2 -2
- package/dist/button.d.ts +2 -2
- package/dist/chat.cjs +728 -296
- package/dist/chat.cjs.map +1 -1
- package/dist/chat.d.cts +27 -10
- package/dist/chat.d.ts +27 -10
- package/dist/chat.js +7 -3
- package/dist/chunk-BX5TCEPR.js +436 -0
- package/dist/chunk-BX5TCEPR.js.map +1 -0
- package/dist/chunk-JGMN6W72.js +12 -0
- package/dist/chunk-JGMN6W72.js.map +1 -0
- package/dist/{chunk-27GJUWVN.js → chunk-JJUIBBBU.js} +14 -8
- package/dist/chunk-JJUIBBBU.js.map +1 -0
- package/dist/chunk-L35M3OD5.js +99 -0
- package/dist/chunk-L35M3OD5.js.map +1 -0
- package/dist/chunk-MEJESPTZ.js +1 -0
- package/dist/chunk-MEJESPTZ.js.map +1 -0
- package/dist/{chunk-R3BGPOAM.js → chunk-MXOPG747.js} +53 -45
- package/dist/chunk-MXOPG747.js.map +1 -0
- package/dist/{chunk-MLCRDVQ2.js → chunk-OBOXCBDL.js} +13 -5
- package/dist/chunk-OBOXCBDL.js.map +1 -0
- package/dist/{chunk-WS4IPADR.js → chunk-OUW6PUEB.js} +42 -110
- package/dist/chunk-OUW6PUEB.js.map +1 -0
- package/dist/icon.cjs +12 -4
- package/dist/icon.cjs.map +1 -1
- package/dist/icon.d.cts +19 -6
- package/dist/icon.d.ts +19 -6
- package/dist/icon.js +1 -1
- package/dist/index.cjs +794 -332
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -4
- package/dist/index.d.ts +6 -4
- package/dist/index.js +50 -25
- package/dist/lottie.d.cts +2 -2
- package/dist/lottie.d.ts +2 -2
- package/dist/table.cjs +142 -0
- package/dist/table.cjs.map +1 -0
- package/dist/table.d.cts +44 -0
- package/dist/table.d.ts +44 -0
- package/dist/table.js +24 -0
- package/dist/table.js.map +1 -0
- package/dist/text-area.d.cts +2 -2
- package/dist/text-area.d.ts +2 -2
- package/dist/types-3Gzk7cRt.d.cts +121 -0
- package/dist/types-3Gzk7cRt.d.ts +121 -0
- package/dist/types-C9XX-Uhk.d.ts +68 -0
- package/dist/types-DuuRI4ll.d.cts +68 -0
- package/dist/utils.cjs +14 -7
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +18 -1
- package/dist/utils.d.ts +18 -1
- package/dist/utils.js +6 -4
- package/package.json +29 -4
- package/dist/chunk-27GJUWVN.js.map +0 -1
- package/dist/chunk-MLCRDVQ2.js.map +0 -1
- package/dist/chunk-OKPNST44.js +0 -1
- package/dist/chunk-R3BGPOAM.js.map +0 -1
- package/dist/chunk-WS4IPADR.js.map +0 -1
- package/dist/types-Q9aqd9nq.d.cts +0 -34
- package/dist/types-Q9aqd9nq.d.ts +0 -34
- /package/dist/{chunk-OKPNST44.js.map → artifacts.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
export { ColorToken, TypographyStyle, TypographyType, colors, fontFamilies, typographyMixin, typographyStyles, typographyTypes } from './tokens.cjs';
|
|
2
|
-
export { Block, BlockContext, BlockContextValue, BlockServices, TextBlockService, useBlockContext } from './blocks.cjs';
|
|
3
|
-
export { B as BlockComponentProps, a as BlockRecord, b as BlockService, c as BlockType, T as TextBlockRecord, d as blockTypes } from './types-
|
|
4
|
-
export {
|
|
2
|
+
export { ArtifactRefBlock, ArtifactRefBlockService, Block, BlockContext, BlockContextValue, BlockServices, TextBlockService, useBlockContext } from './blocks.cjs';
|
|
3
|
+
export { A as ArtifactRefBlockRecord, B as BlockComponentProps, a as BlockRecord, b as BlockService, c as BlockType, T as TextBlockRecord, d as blockTypes } from './types-DuuRI4ll.cjs';
|
|
4
|
+
export { A as ArtifactRecord, a as ArtifactService, b as ArtifactServiceProps, c as ArtifactType, T as TableArtifactRecord, d as TableColumn, e as TableConfig, f as TableRow, g as TableStats, h as artifactTypes } from './types-3Gzk7cRt.cjs';
|
|
5
|
+
export { ArtifactDownloadButton, ArtifactDownloadButtonProps, ArtifactServices, TableArtifact, artifactToClipboardText, isSafeDownloadUrl } from './artifacts.cjs';
|
|
6
|
+
export { ChatContext, ChatContextValue, ChatMessage, ChatMessageType, MESSAGE_ROLE, MessageRole, copyMessageText, useChatContext, useCopyToClipboard } from './chat.cjs';
|
|
5
7
|
export { Icon, IconButton, IconButtonProps, IconButtonSize, IconButtonVariant, IconProps } from './icon.cjs';
|
|
6
8
|
export { IconCtrl, KEYBOARD_SHORTCUT_VARIANTS, KeyIcon, KeyboardShortcut, KeyboardShortcutProps, KeyboardShortcutVariant } from './keyboard-shortcut.cjs';
|
|
7
9
|
export { Lottie, LottieAnimationData, LottieProps, LottieRef } from './lottie.cjs';
|
|
8
10
|
export { TextArea, TextAreaProps } from './text-area.cjs';
|
|
9
|
-
export { MarkdownTable, convertTableToCSV, markdownToPlainText, mergeRefs, parseMarkdownTable } from './utils.cjs';
|
|
11
|
+
export { MarkdownTable, convertTableToCSV, escapeCsvField, markdownToPlainText, mergeRefs, parseMarkdownTable } from './utils.cjs';
|
|
10
12
|
export { BUTTON_INTENT, BUTTON_SIZE, BUTTON_VARIANT, Button, ButtonIntent, ButtonProps, ButtonSize, ButtonVariant, ICON_POSITION, IconPosition } from './button.cjs';
|
|
11
13
|
import 'react';
|
|
12
14
|
import 'react/jsx-runtime';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
export { ColorToken, TypographyStyle, TypographyType, colors, fontFamilies, typographyMixin, typographyStyles, typographyTypes } from './tokens.js';
|
|
2
|
-
export { Block, BlockContext, BlockContextValue, BlockServices, TextBlockService, useBlockContext } from './blocks.js';
|
|
3
|
-
export { B as BlockComponentProps, a as BlockRecord, b as BlockService, c as BlockType, T as TextBlockRecord, d as blockTypes } from './types-
|
|
4
|
-
export {
|
|
2
|
+
export { ArtifactRefBlock, ArtifactRefBlockService, Block, BlockContext, BlockContextValue, BlockServices, TextBlockService, useBlockContext } from './blocks.js';
|
|
3
|
+
export { A as ArtifactRefBlockRecord, B as BlockComponentProps, a as BlockRecord, b as BlockService, c as BlockType, T as TextBlockRecord, d as blockTypes } from './types-C9XX-Uhk.js';
|
|
4
|
+
export { A as ArtifactRecord, a as ArtifactService, b as ArtifactServiceProps, c as ArtifactType, T as TableArtifactRecord, d as TableColumn, e as TableConfig, f as TableRow, g as TableStats, h as artifactTypes } from './types-3Gzk7cRt.js';
|
|
5
|
+
export { ArtifactDownloadButton, ArtifactDownloadButtonProps, ArtifactServices, TableArtifact, artifactToClipboardText, isSafeDownloadUrl } from './artifacts.js';
|
|
6
|
+
export { ChatContext, ChatContextValue, ChatMessage, ChatMessageType, MESSAGE_ROLE, MessageRole, copyMessageText, useChatContext, useCopyToClipboard } from './chat.js';
|
|
5
7
|
export { Icon, IconButton, IconButtonProps, IconButtonSize, IconButtonVariant, IconProps } from './icon.js';
|
|
6
8
|
export { IconCtrl, KEYBOARD_SHORTCUT_VARIANTS, KeyIcon, KeyboardShortcut, KeyboardShortcutProps, KeyboardShortcutVariant } from './keyboard-shortcut.js';
|
|
7
9
|
export { Lottie, LottieAnimationData, LottieProps, LottieRef } from './lottie.js';
|
|
8
10
|
export { TextArea, TextAreaProps } from './text-area.js';
|
|
9
|
-
export { MarkdownTable, convertTableToCSV, markdownToPlainText, mergeRefs, parseMarkdownTable } from './utils.js';
|
|
11
|
+
export { MarkdownTable, convertTableToCSV, escapeCsvField, markdownToPlainText, mergeRefs, parseMarkdownTable } from './utils.js';
|
|
10
12
|
export { BUTTON_INTENT, BUTTON_SIZE, BUTTON_VARIANT, Button, ButtonIntent, ButtonProps, ButtonSize, ButtonVariant, ICON_POSITION, IconPosition } from './button.js';
|
|
11
13
|
import 'react';
|
|
12
14
|
import 'react/jsx-runtime';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TextArea
|
|
3
|
+
} from "./chunk-WPQQVKWY.js";
|
|
4
|
+
import {
|
|
5
|
+
IconCtrl,
|
|
6
|
+
KEYBOARD_SHORTCUT_VARIANTS,
|
|
7
|
+
KeyboardShortcut
|
|
8
|
+
} from "./chunk-L6DUGB2E.js";
|
|
1
9
|
import {
|
|
2
10
|
convertTableToCSV,
|
|
11
|
+
escapeCsvField,
|
|
3
12
|
parseMarkdownTable
|
|
4
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-JJUIBBBU.js";
|
|
14
|
+
import {
|
|
15
|
+
mergeRefs
|
|
16
|
+
} from "./chunk-KNYB3RL7.js";
|
|
5
17
|
import {
|
|
6
18
|
BUTTON_INTENT,
|
|
7
19
|
BUTTON_SIZE,
|
|
@@ -14,53 +26,60 @@ import {
|
|
|
14
26
|
ChatContext,
|
|
15
27
|
ChatMessage,
|
|
16
28
|
MESSAGE_ROLE,
|
|
29
|
+
copyMessageText,
|
|
17
30
|
useChatContext,
|
|
18
31
|
useCopyToClipboard
|
|
19
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-OUW6PUEB.js";
|
|
20
33
|
import {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
34
|
+
BlockContext,
|
|
35
|
+
useBlockContext
|
|
36
|
+
} from "./chunk-JGMN6W72.js";
|
|
24
37
|
import {
|
|
38
|
+
ArtifactRefBlock,
|
|
39
|
+
ArtifactRefBlockService,
|
|
25
40
|
Block,
|
|
26
|
-
BlockContext,
|
|
27
41
|
BlockServices,
|
|
28
42
|
TextBlockService,
|
|
29
|
-
blockTypes
|
|
30
|
-
|
|
31
|
-
} from "./chunk-R3BGPOAM.js";
|
|
32
|
-
import "./chunk-72TJUKMV.js";
|
|
33
|
-
import {
|
|
34
|
-
IconButton
|
|
35
|
-
} from "./chunk-MLCRDVQ2.js";
|
|
43
|
+
blockTypes
|
|
44
|
+
} from "./chunk-MXOPG747.js";
|
|
36
45
|
import {
|
|
37
|
-
|
|
38
|
-
} from "./chunk-
|
|
39
|
-
import {
|
|
40
|
-
TextArea
|
|
41
|
-
} from "./chunk-WPQQVKWY.js";
|
|
42
|
-
import {
|
|
43
|
-
mergeRefs
|
|
44
|
-
} from "./chunk-KNYB3RL7.js";
|
|
46
|
+
markdownToPlainText
|
|
47
|
+
} from "./chunk-NMKKU2UG.js";
|
|
45
48
|
import {
|
|
46
49
|
fontFamilies,
|
|
47
50
|
typographyMixin,
|
|
48
51
|
typographyStyles,
|
|
49
52
|
typographyTypes
|
|
50
53
|
} from "./chunk-SV24ONND.js";
|
|
54
|
+
import "./chunk-MEJESPTZ.js";
|
|
51
55
|
import {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
ArtifactDownloadButton,
|
|
57
|
+
ArtifactServices,
|
|
58
|
+
TableArtifact,
|
|
59
|
+
artifactToClipboardText,
|
|
60
|
+
artifactTypes,
|
|
61
|
+
isSafeDownloadUrl
|
|
62
|
+
} from "./chunk-BX5TCEPR.js";
|
|
63
|
+
import "./chunk-L35M3OD5.js";
|
|
64
|
+
import "./chunk-72TJUKMV.js";
|
|
65
|
+
import {
|
|
66
|
+
IconButton
|
|
67
|
+
} from "./chunk-OBOXCBDL.js";
|
|
56
68
|
import {
|
|
57
69
|
Icon
|
|
58
70
|
} from "./chunk-OLJIJYB5.js";
|
|
59
71
|
import {
|
|
60
72
|
colors
|
|
61
73
|
} from "./chunk-JF3P66JF.js";
|
|
74
|
+
import {
|
|
75
|
+
Lottie
|
|
76
|
+
} from "./chunk-BIATJTD4.js";
|
|
62
77
|
import "./chunk-5WRI5ZAA.js";
|
|
63
78
|
export {
|
|
79
|
+
ArtifactDownloadButton,
|
|
80
|
+
ArtifactRefBlock,
|
|
81
|
+
ArtifactRefBlockService,
|
|
82
|
+
ArtifactServices,
|
|
64
83
|
BUTTON_INTENT,
|
|
65
84
|
BUTTON_SIZE,
|
|
66
85
|
BUTTON_VARIANT,
|
|
@@ -78,12 +97,18 @@ export {
|
|
|
78
97
|
KeyboardShortcut,
|
|
79
98
|
Lottie,
|
|
80
99
|
MESSAGE_ROLE,
|
|
100
|
+
TableArtifact,
|
|
81
101
|
TextArea,
|
|
82
102
|
TextBlockService,
|
|
103
|
+
artifactToClipboardText,
|
|
104
|
+
artifactTypes,
|
|
83
105
|
blockTypes,
|
|
84
106
|
colors,
|
|
85
107
|
convertTableToCSV,
|
|
108
|
+
copyMessageText,
|
|
109
|
+
escapeCsvField,
|
|
86
110
|
fontFamilies,
|
|
111
|
+
isSafeDownloadUrl,
|
|
87
112
|
markdownToPlainText,
|
|
88
113
|
mergeRefs,
|
|
89
114
|
parseMarkdownTable,
|
package/dist/lottie.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { AnimationItem } from 'lottie-web';
|
|
3
3
|
|
|
4
4
|
/** JSON animation data exported from After Effects via the Bodymovin plugin. */
|
|
@@ -59,6 +59,6 @@ interface LottieRef {
|
|
|
59
59
|
getAnimationItem(): AnimationItem | null;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
declare const Lottie:
|
|
62
|
+
declare const Lottie: React.ForwardRefExoticComponent<LottieProps & React.RefAttributes<LottieRef>>;
|
|
63
63
|
|
|
64
64
|
export { Lottie, type LottieAnimationData, type LottieProps, type LottieRef };
|
package/dist/lottie.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { AnimationItem } from 'lottie-web';
|
|
3
3
|
|
|
4
4
|
/** JSON animation data exported from After Effects via the Bodymovin plugin. */
|
|
@@ -59,6 +59,6 @@ interface LottieRef {
|
|
|
59
59
|
getAnimationItem(): AnimationItem | null;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
declare const Lottie:
|
|
62
|
+
declare const Lottie: React.ForwardRefExoticComponent<LottieProps & React.RefAttributes<LottieRef>>;
|
|
63
63
|
|
|
64
64
|
export { Lottie, type LottieAnimationData, type LottieProps, type LottieRef };
|
package/dist/table.cjs
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/components/table/index.ts
|
|
31
|
+
var table_exports = {};
|
|
32
|
+
__export(table_exports, {
|
|
33
|
+
Table: () => Table,
|
|
34
|
+
TableBody: () => TableBody,
|
|
35
|
+
TableCaption: () => TableCaption,
|
|
36
|
+
TableCell: () => TableCell,
|
|
37
|
+
TableFooter: () => TableFooter,
|
|
38
|
+
TableHead: () => TableHead,
|
|
39
|
+
TableHeader: () => TableHeader,
|
|
40
|
+
TableRow: () => TableRow,
|
|
41
|
+
useScrollShadow: () => useScrollShadow
|
|
42
|
+
});
|
|
43
|
+
module.exports = __toCommonJS(table_exports);
|
|
44
|
+
|
|
45
|
+
// src/components/ui/table.tsx
|
|
46
|
+
var React = __toESM(require("react"), 1);
|
|
47
|
+
|
|
48
|
+
// src/lib/utils.ts
|
|
49
|
+
var import_clsx = require("clsx");
|
|
50
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
51
|
+
function cn(...inputs) {
|
|
52
|
+
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// src/components/ui/table.tsx
|
|
56
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
57
|
+
var Table = React.forwardRef(({ className, containerClassName, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: cn("relative w-full overflow-auto", containerClassName), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("table", { ref, className: cn("w-full caption-bottom text-sm", className), ...props }) }));
|
|
58
|
+
Table.displayName = "Table";
|
|
59
|
+
var TableHeader = React.forwardRef(
|
|
60
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { ref, className: cn("[&_tr]:border-b", className), ...props })
|
|
61
|
+
);
|
|
62
|
+
TableHeader.displayName = "TableHeader";
|
|
63
|
+
var TableBody = React.forwardRef(
|
|
64
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { ref, className: cn("[&_tr:last-child]:border-0", className), ...props })
|
|
65
|
+
);
|
|
66
|
+
TableBody.displayName = "TableBody";
|
|
67
|
+
var TableFooter = React.forwardRef(
|
|
68
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tfoot", { ref, className: cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className), ...props })
|
|
69
|
+
);
|
|
70
|
+
TableFooter.displayName = "TableFooter";
|
|
71
|
+
var TableRow = React.forwardRef(
|
|
72
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
73
|
+
"tr",
|
|
74
|
+
{
|
|
75
|
+
ref,
|
|
76
|
+
className: cn("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted", className),
|
|
77
|
+
...props
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
);
|
|
81
|
+
TableRow.displayName = "TableRow";
|
|
82
|
+
var TableHead = React.forwardRef(
|
|
83
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
84
|
+
"th",
|
|
85
|
+
{
|
|
86
|
+
ref,
|
|
87
|
+
className: cn(
|
|
88
|
+
"h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",
|
|
89
|
+
className
|
|
90
|
+
),
|
|
91
|
+
...props
|
|
92
|
+
}
|
|
93
|
+
)
|
|
94
|
+
);
|
|
95
|
+
TableHead.displayName = "TableHead";
|
|
96
|
+
var TableCell = React.forwardRef(
|
|
97
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { ref, className: cn("p-4 align-middle [&:has([role=checkbox])]:pr-0", className), ...props })
|
|
98
|
+
);
|
|
99
|
+
TableCell.displayName = "TableCell";
|
|
100
|
+
var TableCaption = React.forwardRef(
|
|
101
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("caption", { ref, className: cn("mt-4 text-sm text-muted-foreground", className), ...props })
|
|
102
|
+
);
|
|
103
|
+
TableCaption.displayName = "TableCaption";
|
|
104
|
+
|
|
105
|
+
// src/components/table/use-scroll-shadow.ts
|
|
106
|
+
var import_react = require("react");
|
|
107
|
+
function useScrollShadow() {
|
|
108
|
+
const targetRef = (0, import_react.useRef)(null);
|
|
109
|
+
const [isScrolled, setIsScrolled] = (0, import_react.useState)(false);
|
|
110
|
+
(0, import_react.useEffect)(() => {
|
|
111
|
+
const target = targetRef.current;
|
|
112
|
+
if (!target) return;
|
|
113
|
+
let scrollContainer = target;
|
|
114
|
+
while (scrollContainer) {
|
|
115
|
+
const overflowY = getComputedStyle(scrollContainer).overflowY;
|
|
116
|
+
if (overflowY === "auto" || overflowY === "scroll") break;
|
|
117
|
+
scrollContainer = scrollContainer.parentElement;
|
|
118
|
+
}
|
|
119
|
+
if (!scrollContainer) return;
|
|
120
|
+
setIsScrolled(scrollContainer.scrollTop > 0);
|
|
121
|
+
const handleScroll = () => {
|
|
122
|
+
if (!scrollContainer) return;
|
|
123
|
+
setIsScrolled(scrollContainer.scrollTop > 0);
|
|
124
|
+
};
|
|
125
|
+
scrollContainer.addEventListener("scroll", handleScroll, { passive: true });
|
|
126
|
+
return () => scrollContainer.removeEventListener("scroll", handleScroll);
|
|
127
|
+
}, []);
|
|
128
|
+
return { targetRef, isScrolled };
|
|
129
|
+
}
|
|
130
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
131
|
+
0 && (module.exports = {
|
|
132
|
+
Table,
|
|
133
|
+
TableBody,
|
|
134
|
+
TableCaption,
|
|
135
|
+
TableCell,
|
|
136
|
+
TableFooter,
|
|
137
|
+
TableHead,
|
|
138
|
+
TableHeader,
|
|
139
|
+
TableRow,
|
|
140
|
+
useScrollShadow
|
|
141
|
+
});
|
|
142
|
+
//# sourceMappingURL=table.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/table/index.ts","../src/components/ui/table.tsx","../src/lib/utils.ts","../src/components/table/use-scroll-shadow.ts"],"sourcesContent":["/**\n * Public clay table primitives — shadcn-style compound components.\n *\n * Consumers compose tables at the call site from these parts (no wrapper, no smart `Table`):\n *\n * ```tsx\n * import { Table, TableHeader, TableBody, TableRow, TableHead, TableCell } from \"@shapesos/clay/table\";\n *\n * <Table>\n * <TableHeader>\n * <TableRow>\n * <TableHead>Name</TableHead>\n * <TableHead>Count</TableHead>\n * </TableRow>\n * </TableHeader>\n * <TableBody>\n * {rows.map((row) => (\n * <TableRow key={row.id}>\n * <TableCell>{row.name}</TableCell>\n * <TableCell>{row.count}</TableCell>\n * </TableRow>\n * ))}\n * </TableBody>\n * </Table>\n * ```\n *\n * `Table` extends shadcn's primitive with a `containerClassName` prop so callers can override the\n * wrapping `<div>`'s `overflow-auto` — needed when the table sits inside an outer scroll container\n * (e.g. an artifact card) and you want the sticky-header containing block to align with that\n * outer container.\n *\n * **Style note:** these primitives use Tailwind v4 + the clay theme tokens (`bg-muted`,\n * `text-muted-foreground`, `border-border`, etc.). Consumers must import the compiled stylesheet\n * alongside the JS:\n *\n * ```ts\n * import \"@shapesos/clay/blocks/styles.css\";\n * ```\n *\n * (The stylesheet name is `blocks/styles.css` for historical reasons — it's the single bundle\n * that compiles all clay-side Tailwind output, including the table primitives.)\n */\nexport {\n Table,\n TableBody,\n TableCaption,\n TableCell,\n TableFooter,\n TableHead,\n TableHeader,\n TableRow,\n} from \"@/components/ui/table\";\nexport { useScrollShadow } from \"./use-scroll-shadow\";\n","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":"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","names":[]}
|
package/dist/table.d.cts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { RefObject } from 'react';
|
|
3
|
+
|
|
4
|
+
/** Extension of shadcn's `Table` registry component: exposes `containerClassName` so callers can
|
|
5
|
+
* override the wrapping `<div>`'s default `overflow-auto`. We need this for sticky-header support
|
|
6
|
+
* (sticky uses the nearest overflow ancestor as its containing block — when the actual scroll
|
|
7
|
+
* container is one level out, the inner overflow-auto needs to be neutralised with
|
|
8
|
+
* `overflow-visible` so sticky aligns with the real scrolling parent). */
|
|
9
|
+
declare const Table: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableElement> & {
|
|
10
|
+
containerClassName?: string;
|
|
11
|
+
} & React.RefAttributes<HTMLTableElement>>;
|
|
12
|
+
declare const TableHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
13
|
+
declare const TableBody: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
14
|
+
declare const TableFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
15
|
+
declare const TableRow: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableRowElement> & React.RefAttributes<HTMLTableRowElement>>;
|
|
16
|
+
declare const TableHead: React.ForwardRefExoticComponent<React.ThHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
|
|
17
|
+
declare const TableCell: React.ForwardRefExoticComponent<React.TdHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
|
|
18
|
+
declare const TableCaption: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableCaptionElement> & React.RefAttributes<HTMLTableCaptionElement>>;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Tracks whether a scroll container has scrolled past its top edge, for sticky-header shadow effects.
|
|
22
|
+
*
|
|
23
|
+
* Returns `targetRef` (attach to the scroll container itself or any element inside it) and
|
|
24
|
+
* `isScrolled` (true once the container's `scrollTop > 0`). On mount the hook walks up the DOM
|
|
25
|
+
* from the target to find the nearest overflow ancestor (or uses the target itself if it already
|
|
26
|
+
* has `overflowY: auto | scroll`), then listens to its `scroll` event.
|
|
27
|
+
*
|
|
28
|
+
* Used to surface a subtle "scroll lift" shadow under sticky headers so users know there is
|
|
29
|
+
* content hidden above.
|
|
30
|
+
*
|
|
31
|
+
* **Why a scroll listener and not a sentinel + IntersectionObserver:** an earlier version used a
|
|
32
|
+
* 1px sentinel as the first child of the scroll container. The sentinel's height pushed the thead
|
|
33
|
+
* down by one pixel in normal flow, and as soon as the user scrolled the thead snapped up to its
|
|
34
|
+
* sticky position — a visible 1px jitter. A scroll listener has no layout footprint.
|
|
35
|
+
*
|
|
36
|
+
* `passive: true` so the listener doesn't block native scroll smoothness; we never call
|
|
37
|
+
* `preventDefault`.
|
|
38
|
+
*/
|
|
39
|
+
declare function useScrollShadow(): {
|
|
40
|
+
targetRef: RefObject<HTMLDivElement | null>;
|
|
41
|
+
isScrolled: boolean;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, useScrollShadow };
|
package/dist/table.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { RefObject } from 'react';
|
|
3
|
+
|
|
4
|
+
/** Extension of shadcn's `Table` registry component: exposes `containerClassName` so callers can
|
|
5
|
+
* override the wrapping `<div>`'s default `overflow-auto`. We need this for sticky-header support
|
|
6
|
+
* (sticky uses the nearest overflow ancestor as its containing block — when the actual scroll
|
|
7
|
+
* container is one level out, the inner overflow-auto needs to be neutralised with
|
|
8
|
+
* `overflow-visible` so sticky aligns with the real scrolling parent). */
|
|
9
|
+
declare const Table: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableElement> & {
|
|
10
|
+
containerClassName?: string;
|
|
11
|
+
} & React.RefAttributes<HTMLTableElement>>;
|
|
12
|
+
declare const TableHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
13
|
+
declare const TableBody: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
14
|
+
declare const TableFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
15
|
+
declare const TableRow: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableRowElement> & React.RefAttributes<HTMLTableRowElement>>;
|
|
16
|
+
declare const TableHead: React.ForwardRefExoticComponent<React.ThHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
|
|
17
|
+
declare const TableCell: React.ForwardRefExoticComponent<React.TdHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
|
|
18
|
+
declare const TableCaption: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableCaptionElement> & React.RefAttributes<HTMLTableCaptionElement>>;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Tracks whether a scroll container has scrolled past its top edge, for sticky-header shadow effects.
|
|
22
|
+
*
|
|
23
|
+
* Returns `targetRef` (attach to the scroll container itself or any element inside it) and
|
|
24
|
+
* `isScrolled` (true once the container's `scrollTop > 0`). On mount the hook walks up the DOM
|
|
25
|
+
* from the target to find the nearest overflow ancestor (or uses the target itself if it already
|
|
26
|
+
* has `overflowY: auto | scroll`), then listens to its `scroll` event.
|
|
27
|
+
*
|
|
28
|
+
* Used to surface a subtle "scroll lift" shadow under sticky headers so users know there is
|
|
29
|
+
* content hidden above.
|
|
30
|
+
*
|
|
31
|
+
* **Why a scroll listener and not a sentinel + IntersectionObserver:** an earlier version used a
|
|
32
|
+
* 1px sentinel as the first child of the scroll container. The sentinel's height pushed the thead
|
|
33
|
+
* down by one pixel in normal flow, and as soon as the user scrolled the thead snapped up to its
|
|
34
|
+
* sticky position — a visible 1px jitter. A scroll listener has no layout footprint.
|
|
35
|
+
*
|
|
36
|
+
* `passive: true` so the listener doesn't block native scroll smoothness; we never call
|
|
37
|
+
* `preventDefault`.
|
|
38
|
+
*/
|
|
39
|
+
declare function useScrollShadow(): {
|
|
40
|
+
targetRef: RefObject<HTMLDivElement | null>;
|
|
41
|
+
isScrolled: boolean;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, useScrollShadow };
|
package/dist/table.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Table,
|
|
3
|
+
TableBody,
|
|
4
|
+
TableCaption,
|
|
5
|
+
TableCell,
|
|
6
|
+
TableFooter,
|
|
7
|
+
TableHead,
|
|
8
|
+
TableHeader,
|
|
9
|
+
TableRow,
|
|
10
|
+
useScrollShadow
|
|
11
|
+
} from "./chunk-L35M3OD5.js";
|
|
12
|
+
import "./chunk-5WRI5ZAA.js";
|
|
13
|
+
export {
|
|
14
|
+
Table,
|
|
15
|
+
TableBody,
|
|
16
|
+
TableCaption,
|
|
17
|
+
TableCell,
|
|
18
|
+
TableFooter,
|
|
19
|
+
TableHead,
|
|
20
|
+
TableHeader,
|
|
21
|
+
TableRow,
|
|
22
|
+
useScrollShadow
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/text-area.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { KeyboardEventHandler } from 'react';
|
|
3
3
|
|
|
4
4
|
/** Props for the TextArea auto-resizing input component. */
|
|
@@ -23,6 +23,6 @@ interface TextAreaProps {
|
|
|
23
23
|
className?: string;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
declare const TextArea:
|
|
26
|
+
declare const TextArea: React.ForwardRefExoticComponent<TextAreaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
27
27
|
|
|
28
28
|
export { TextArea, type TextAreaProps };
|
package/dist/text-area.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { KeyboardEventHandler } from 'react';
|
|
3
3
|
|
|
4
4
|
/** Props for the TextArea auto-resizing input component. */
|
|
@@ -23,6 +23,6 @@ interface TextAreaProps {
|
|
|
23
23
|
className?: string;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
declare const TextArea:
|
|
26
|
+
declare const TextArea: React.ForwardRefExoticComponent<TextAreaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
27
27
|
|
|
28
28
|
export { TextArea, type TextAreaProps };
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Artifact-domain types — wire-protocol shapes shared between artifact components, block-services, and
|
|
5
|
+
* consumers. The block layer (`@/components/blocks`) imports these to define
|
|
6
|
+
* `ArtifactRefBlockRecord`; the artifact components consume them directly.
|
|
7
|
+
*
|
|
8
|
+
* Mirrored from the agent / io-server contract — see the `chat-typed-content-blocks-and-artifacts`
|
|
9
|
+
* plan, §6.4 (table contract).
|
|
10
|
+
*/
|
|
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
|
+
};
|
|
19
|
+
/** Discriminator for artifact types. Additive — new types extend this union. */
|
|
20
|
+
type ArtifactType = (typeof artifactTypes)[keyof typeof artifactTypes];
|
|
21
|
+
/**
|
|
22
|
+
* A single column descriptor for a `TableArtifact`. Carries the ORDER and LABEL for the
|
|
23
|
+
* rendered table — `key` selects a column from the CSV header; `label` overrides the rendered
|
|
24
|
+
* header text. The CSV is always the source of truth for the data shape; clay never coerces,
|
|
25
|
+
* reformats, or interprets cell values.
|
|
26
|
+
*/
|
|
27
|
+
interface TableColumn {
|
|
28
|
+
/** Matches a header in the CSV. Required. Used to project + order the CSV's columns. */
|
|
29
|
+
key: string;
|
|
30
|
+
/** Human-readable header text. Required. */
|
|
31
|
+
label: string;
|
|
32
|
+
/**
|
|
33
|
+
* Accepted in the wire payload but not consulted by the renderer — every cell is rendered as
|
|
34
|
+
* the raw CSV string (or empty for null). Format conversion is a server concern; if a column
|
|
35
|
+
* needs to be "Yes/No" instead of "true/false", the server should emit it that way in the CSV.
|
|
36
|
+
* Kept in the interface so callers that pass `type` (e.g. io-client) don't get a type error.
|
|
37
|
+
*/
|
|
38
|
+
type?: "string" | "number" | "date" | "boolean";
|
|
39
|
+
/**
|
|
40
|
+
* Accepted in the wire payload but not consulted by the renderer — every column is left-aligned
|
|
41
|
+
* by design. Kept in the interface for forward-compat; restore per-column alignment by editing
|
|
42
|
+
* `table-artifact-content.tsx` if a future use case justifies it.
|
|
43
|
+
*/
|
|
44
|
+
align?: "left" | "center" | "right";
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Optional stats embedded in `TableConfig` so clients can pre-render UI before fetching the
|
|
48
|
+
* actual data payload (e.g. N loading shimmers sized to the eventual row count).
|
|
49
|
+
*
|
|
50
|
+
* Backward-compat: optional everywhere — older artifacts persisted before this field shipped
|
|
51
|
+
* still validate. The renderer falls back to a single status-message line when `stats` is absent.
|
|
52
|
+
*/
|
|
53
|
+
interface TableStats {
|
|
54
|
+
/** Total number of rows in the materialised CSV. Lets the loading branch render shimmers. */
|
|
55
|
+
rowCount: number;
|
|
56
|
+
}
|
|
57
|
+
/** Rendering config for a table artifact, stored at `artifact.config` (JSONB on the server). */
|
|
58
|
+
interface TableConfig {
|
|
59
|
+
/** Column descriptors in render order. */
|
|
60
|
+
columns: TableColumn[];
|
|
61
|
+
/** Optional metadata describing the underlying data — used for loading-state UI. */
|
|
62
|
+
stats?: TableStats;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* A row inside a table artifact's parsed CSV. Every cell is the raw string from the CSV (or
|
|
66
|
+
* `null` for the empty string). The renderer never coerces or interprets — type-aware formatting
|
|
67
|
+
* is a server concern (the CSV's contents are what the user sees).
|
|
68
|
+
*/
|
|
69
|
+
type TableRow = Record<string, string | null>;
|
|
70
|
+
/** Common shape every artifact record carries. Discriminated by `type`. */
|
|
71
|
+
interface ArtifactBase<TType extends ArtifactType, TConfig> {
|
|
72
|
+
/** Artifact-type discriminator. */
|
|
73
|
+
type: TType;
|
|
74
|
+
/** Human-readable label. Nullable when the artifact has no title. */
|
|
75
|
+
title: string | null;
|
|
76
|
+
/** Rendering config — shape varies per artifact type. */
|
|
77
|
+
config: TConfig;
|
|
78
|
+
/** Protected-asset metadata pointing to the underlying data payload. Null while the asset is unavailable. */
|
|
79
|
+
protectedAsset: {
|
|
80
|
+
/** Time-limited URL the renderer fetches the artifact's data from. */
|
|
81
|
+
presignedUrl: string;
|
|
82
|
+
} | null;
|
|
83
|
+
}
|
|
84
|
+
/** Concrete table artifact record. Future artifact types extend `ArtifactRecord` here. */
|
|
85
|
+
type TableArtifactRecord = ArtifactBase<typeof artifactTypes.TABLE, TableConfig>;
|
|
86
|
+
/**
|
|
87
|
+
* Discriminated union of all supported artifacts. Single-member today; extension pattern:
|
|
88
|
+
*
|
|
89
|
+
* export type ArtifactRecord = TableArtifactRecord | ChartArtifactRecord;
|
|
90
|
+
*
|
|
91
|
+
* Every consumer that narrows on `artifact.type` must add the new branch here AND in the
|
|
92
|
+
* `ArtifactServices` map (single source of truth for the type→component mapping). Older clay
|
|
93
|
+
* versions that don't know about a new type silently render nothing — see `ArtifactRefBlock` guard.
|
|
94
|
+
*/
|
|
95
|
+
type ArtifactRecord = TableArtifactRecord;
|
|
96
|
+
/** Props every concrete artifact component receives from the dispatcher. */
|
|
97
|
+
interface ArtifactServiceProps<TArtifact extends ArtifactRecord = ArtifactRecord> {
|
|
98
|
+
/** The artifact metadata (config + presigned URL). */
|
|
99
|
+
artifact: TArtifact;
|
|
100
|
+
}
|
|
101
|
+
/** Per-artifact-type service — registry entry that pairs a discriminator with its concrete component. */
|
|
102
|
+
interface ArtifactService<TArtifact extends ArtifactRecord = ArtifactRecord> {
|
|
103
|
+
/** Discriminator value this service handles. */
|
|
104
|
+
type: ArtifactType;
|
|
105
|
+
/** React component that renders an artifact of this type — composes ai-elements primitives
|
|
106
|
+
* (`Artifact`, `ArtifactHeader`, `ArtifactTitle`, `ArtifactActions`, `ArtifactContent`) directly. */
|
|
107
|
+
Component: ComponentType<ArtifactServiceProps<TArtifact>>;
|
|
108
|
+
/**
|
|
109
|
+
* Returns a plain-text / markdown string suitable for clipboard copy.
|
|
110
|
+
*
|
|
111
|
+
* Called by `ArtifactRefBlockService.toClipboardText` when the user copies a message that
|
|
112
|
+
* contains this artifact. Must be pure and synchronous.
|
|
113
|
+
*
|
|
114
|
+
* Implementation notes per type:
|
|
115
|
+
* - `table`: returns the artifact title as plain text (see `TableArtifactService`).
|
|
116
|
+
* - Future types implement their own representation in a co-located `*-service.ts` file.
|
|
117
|
+
*/
|
|
118
|
+
toClipboardText: (artifact: TArtifact) => string;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export { type ArtifactRecord as A, type TableArtifactRecord as T, type ArtifactService as a, type ArtifactServiceProps as b, type ArtifactType as c, type TableColumn as d, type TableConfig as e, type TableRow as f, type TableStats as g, artifactTypes as h };
|