@lightblues/jig 0.1.2 → 0.1.4
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 +2 -0
- package/dist/agent-chat/react.js +13 -2
- package/dist/canvas/artifact/assets/katex.css +1 -0
- package/dist/canvas/artifact/assets/manifest.json +13 -0
- package/dist/canvas/artifact/assets/runtime.js +382 -0
- package/dist/canvas/artifact/css.d.ts +29 -0
- package/dist/canvas/artifact/css.js +159 -0
- package/dist/canvas/artifact/entry.d.ts +1 -0
- package/dist/canvas/artifact/entry.js +10 -0
- package/dist/canvas/artifact/icons.d.ts +13 -0
- package/dist/canvas/artifact/icons.js +67 -0
- package/dist/canvas/artifact/icons.json +1 -0
- package/dist/canvas/artifact/index.d.ts +54 -0
- package/dist/canvas/artifact/index.js +111 -0
- package/dist/canvas/artifact/instructions.d.ts +2 -0
- package/dist/canvas/artifact/instructions.js +16 -0
- package/dist/canvas/artifact/kit.d.ts +32 -0
- package/dist/canvas/artifact/kit.js +88 -0
- package/dist/canvas/artifact/modules.d.ts +3 -0
- package/dist/canvas/artifact/modules.js +33 -0
- package/dist/canvas/artifact/names.d.ts +6 -0
- package/dist/canvas/artifact/names.js +30 -0
- package/dist/canvas/artifact/ui.d.ts +76 -0
- package/dist/canvas/artifact/ui.js +156 -0
- package/dist/canvas/build.d.ts +14 -0
- package/dist/canvas/build.js +27 -0
- package/dist/canvas/compile.d.ts +8 -0
- package/dist/canvas/compile.js +19 -4
- package/dist/canvas/kit/blocks.d.ts +118 -0
- package/dist/canvas/kit/blocks.js +276 -0
- package/dist/canvas/kit/charts.d.ts +66 -0
- package/dist/canvas/kit/charts.js +319 -0
- package/dist/canvas/kit/context.d.ts +33 -0
- package/dist/canvas/kit/context.js +38 -0
- package/dist/canvas/kit/index.d.ts +25 -0
- package/dist/canvas/kit/index.js +44 -0
- package/dist/canvas/kit/theme.d.ts +88 -0
- package/dist/canvas/kit/theme.js +63 -0
- package/dist/canvas/kit/ui.d.ts +55 -0
- package/dist/canvas/kit/ui.js +100 -0
- package/dist/canvas/runtime.d.ts +6 -1
- package/dist/canvas/runtime.js +4 -3
- package/package.json +34 -2
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type ArtifactPalette } from './css.ts';
|
|
2
|
+
export { ARTIFACT_EXPORTS, ARTIFACT_MODULES } from './names.ts';
|
|
3
|
+
export { artifactCss, artifactThemeCss, shadcnVars, classCandidates, SHADCN_NEUTRAL, type ArtifactPalette, type ArtifactCssOptions } from './css.ts';
|
|
4
|
+
export { ARTIFACT_INSTRUCTIONS } from './instructions.ts';
|
|
5
|
+
export { CanvasCompileError } from '../compile.ts';
|
|
6
|
+
export interface CompileArtifactOptions {
|
|
7
|
+
/** The host's colours per kind (the tier-A `KitPalette` shape); shadcn's neutral theme where unset. */
|
|
8
|
+
palette?: ArtifactPalette;
|
|
9
|
+
/** Source cap in UTF-8 bytes. Default 100 KB. */
|
|
10
|
+
maxBytes?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface CompiledArtifact {
|
|
13
|
+
/** What `CanvasFrame`'s `src` takes (store it). Starts with the page's CSS and icons, then the compiled body. */
|
|
14
|
+
code: string;
|
|
15
|
+
/** The `lucide-react` names the page imports. */
|
|
16
|
+
icons: string[];
|
|
17
|
+
/** Whether the page imports `TeX` or `Math`: the frame then needs the KaTeX stylesheet in `styleUrls`. */
|
|
18
|
+
tex: boolean;
|
|
19
|
+
/** Bytes of CSS in `code`. */
|
|
20
|
+
cssBytes: number;
|
|
21
|
+
/** Imports the page forgot and the compiler added (`missingImports`), or ''. */
|
|
22
|
+
added: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The imports a page forgot: a kit hook or `TeX` used as a name but neither imported nor declared (the cheap model's
|
|
26
|
+
* one recurring slip in the jig-016 re-run). Returned as one line to append, so line numbers in errors stay the same.
|
|
27
|
+
*/
|
|
28
|
+
export declare function missingImports(source: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* Compile an artifact page: a kit hook or `TeX` used without its import gets one (`missingImports`); then
|
|
31
|
+
* `compileCanvas`'s checks (named imports only, each name exported by its module, no `require` / `import()` /
|
|
32
|
+
* `import.meta`, `export default`, 100 KB); then the page's CSS and the icons it imports go in
|
|
33
|
+
* front of the body. Throws `CanvasCompileError` (its message names the line; return it to the model).
|
|
34
|
+
*/
|
|
35
|
+
export declare function compileArtifact(source: string, options?: CompileArtifactOptions): Promise<CompiledArtifact>;
|
|
36
|
+
/** The modules a page may import, with what each exports (lucide: its icon names), for docs and tool schemas. */
|
|
37
|
+
export declare function artifactImports(): Promise<Record<string, readonly string[]>>;
|
|
38
|
+
export interface ArtifactAssets {
|
|
39
|
+
/** Directory holding the files; serve it as static, cached by `hash`. */
|
|
40
|
+
dir: string;
|
|
41
|
+
/** `runtime.js`: the `runtimeUrl` of `CanvasFrame`. */
|
|
42
|
+
runtime: string;
|
|
43
|
+
/** `katex.css` (fonts inlined as `data:`): add its URL to `styleUrls` for a page whose `tex` is true. */
|
|
44
|
+
katexCss: string;
|
|
45
|
+
/** sha256 of runtime.js and katex.css, 12 hex chars, for the `?v=`. */
|
|
46
|
+
hash: string;
|
|
47
|
+
/** Sizes in bytes: raw and gzipped. */
|
|
48
|
+
sizes: Record<string, {
|
|
49
|
+
bytes: number;
|
|
50
|
+
gzip: number;
|
|
51
|
+
}>;
|
|
52
|
+
}
|
|
53
|
+
/** The prebuilt runtime and KaTeX stylesheet shipped in `dist/canvas/artifact/assets/` (`buildArtifactRuntime`). */
|
|
54
|
+
export declare function artifactAssets(): Promise<ArtifactAssets>;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// `@lightblues/jig/canvas/artifact`: tier-B pages in the artifact style (J009): React + Tailwind + shadcn/ui + recharts
|
|
2
|
+
// + lucide, plus jig's state hooks and KaTeX. Server side: compile a page (import check per module, the icons it uses,
|
|
3
|
+
// its CSS from Tailwind's compiler), the model instruction, and where the prebuilt runtime is. No React here.
|
|
4
|
+
import { readFile } from 'node:fs/promises';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import { fileURLToPath } from 'node:url';
|
|
7
|
+
import { parse } from 'sucrase/dist/parser/index.js';
|
|
8
|
+
import { TokenType as tt } from 'sucrase/dist/parser/tokenizer/types.js';
|
|
9
|
+
import { CanvasCompileError, compileCanvas } from "../compile.js";
|
|
10
|
+
import { artifactCss } from "./css.js";
|
|
11
|
+
import { iconTable } from "./icons.js";
|
|
12
|
+
import { ARTIFACT_EXPORTS, ARTIFACT_MODULES } from "./names.js";
|
|
13
|
+
export { ARTIFACT_EXPORTS, ARTIFACT_MODULES } from "./names.js";
|
|
14
|
+
export { artifactCss, artifactThemeCss, shadcnVars, classCandidates, SHADCN_NEUTRAL } from "./css.js";
|
|
15
|
+
export { ARTIFACT_INSTRUCTIONS } from "./instructions.js";
|
|
16
|
+
export { CanvasCompileError } from "../compile.js";
|
|
17
|
+
/** JSON safe inside an inline `<script>` (canvasDocument also escapes, this keeps the text plain). */
|
|
18
|
+
function scriptJson(value) {
|
|
19
|
+
return JSON.stringify(value).replace(/</g, '\\u003c').replace(/\u2028/g, '\\u2028').replace(/\u2029/g, '\\u2029');
|
|
20
|
+
}
|
|
21
|
+
/** Names a page may use without importing them: `compileArtifact` adds the import (from `FORGIVEN[name]`). */
|
|
22
|
+
const FORGIVEN = {
|
|
23
|
+
useCanvasState: 'jig/canvas', useCanvasEvent: 'jig/canvas', useCanvasAction: 'jig/canvas', useCanvasTheme: 'jig/canvas', TeX: 'jig/canvas',
|
|
24
|
+
useState: 'react', useEffect: 'react', useMemo: 'react', useRef: 'react', useCallback: 'react', useReducer: 'react', useId: 'react', useLayoutEffect: 'react', Fragment: 'react',
|
|
25
|
+
};
|
|
26
|
+
const DECLARES = new Set([tt._function, tt._const, tt._let, tt._var, tt._class]);
|
|
27
|
+
/**
|
|
28
|
+
* The imports a page forgot: a kit hook or `TeX` used as a name but neither imported nor declared (the cheap model's
|
|
29
|
+
* one recurring slip in the jig-016 re-run). Returned as one line to append, so line numbers in errors stay the same.
|
|
30
|
+
*/
|
|
31
|
+
export function missingImports(source) {
|
|
32
|
+
let tokens;
|
|
33
|
+
try {
|
|
34
|
+
tokens = parse(source, true, true, false).tokens;
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return ''; // compileCanvas reports the syntax error
|
|
38
|
+
}
|
|
39
|
+
const text = (i) => source.slice(tokens[i].start, tokens[i].end);
|
|
40
|
+
const used = new Set();
|
|
41
|
+
const bound = new Set();
|
|
42
|
+
let inImport = false;
|
|
43
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
44
|
+
const t = tokens[i];
|
|
45
|
+
if (t.type === tt._import)
|
|
46
|
+
inImport = true;
|
|
47
|
+
else if (inImport && t.type === tt.string)
|
|
48
|
+
inImport = false;
|
|
49
|
+
if (t.type !== tt.name && t.type !== tt.jsxName)
|
|
50
|
+
continue;
|
|
51
|
+
const name = text(i);
|
|
52
|
+
if (!(name in FORGIVEN))
|
|
53
|
+
continue;
|
|
54
|
+
const prev = tokens[i - 1];
|
|
55
|
+
if (inImport || (prev && DECLARES.has(prev.type)))
|
|
56
|
+
bound.add(name);
|
|
57
|
+
else if (prev?.type !== tt.dot && prev?.type !== tt.questionDot)
|
|
58
|
+
used.add(name);
|
|
59
|
+
}
|
|
60
|
+
const byModule = new Map();
|
|
61
|
+
for (const name of used)
|
|
62
|
+
if (!bound.has(name))
|
|
63
|
+
byModule.set(FORGIVEN[name], [...(byModule.get(FORGIVEN[name]) ?? []), name]);
|
|
64
|
+
return [...byModule].map(([m, names]) => `import { ${names.sort().join(', ')} } from ${JSON.stringify(m)};`).join(' ');
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Compile an artifact page: a kit hook or `TeX` used without its import gets one (`missingImports`); then
|
|
68
|
+
* `compileCanvas`'s checks (named imports only, each name exported by its module, no `require` / `import()` /
|
|
69
|
+
* `import.meta`, `export default`, 100 KB); then the page's CSS and the icons it imports go in
|
|
70
|
+
* front of the body. Throws `CanvasCompileError` (its message names the line; return it to the model).
|
|
71
|
+
*/
|
|
72
|
+
export async function compileArtifact(source, options = {}) {
|
|
73
|
+
const icons = await iconTable();
|
|
74
|
+
const used = new Set();
|
|
75
|
+
let tex = false;
|
|
76
|
+
const moduleExports = { ...ARTIFACT_EXPORTS, 'lucide-react': new Set(Object.keys(icons.names)) };
|
|
77
|
+
const missing = missingImports(source);
|
|
78
|
+
const body = compileCanvas(missing ? `${source}\n${missing}` : source, {
|
|
79
|
+
moduleExports,
|
|
80
|
+
maxBytes: options.maxBytes,
|
|
81
|
+
onImport: (from, name) => {
|
|
82
|
+
if (from === 'lucide-react')
|
|
83
|
+
used.add(name);
|
|
84
|
+
if (from === 'jig/canvas' && (name === 'TeX' || name === 'Math'))
|
|
85
|
+
tex = true;
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
const nodes = {};
|
|
89
|
+
for (const name of used)
|
|
90
|
+
nodes[name] = icons.nodes[icons.names[name]];
|
|
91
|
+
const css = await artifactCss(source, { palette: options.palette });
|
|
92
|
+
const prelude = `require("jig/canvas").__page(${scriptJson({ css, icons: nodes })});\n`;
|
|
93
|
+
return { code: prelude + body, icons: [...used].sort(), tex, cssBytes: Buffer.byteLength(css), added: missing };
|
|
94
|
+
}
|
|
95
|
+
/** The modules a page may import, with what each exports (lucide: its icon names), for docs and tool schemas. */
|
|
96
|
+
export async function artifactImports() {
|
|
97
|
+
const icons = await iconTable();
|
|
98
|
+
return { ...ARTIFACT_EXPORTS, 'lucide-react': Object.keys(icons.names).sort() };
|
|
99
|
+
}
|
|
100
|
+
/** The prebuilt runtime and KaTeX stylesheet shipped in `dist/canvas/artifact/assets/` (`buildArtifactRuntime`). */
|
|
101
|
+
export async function artifactAssets() {
|
|
102
|
+
const dir = path.join(path.dirname(fileURLToPath(import.meta.url)), 'assets');
|
|
103
|
+
let manifest;
|
|
104
|
+
try {
|
|
105
|
+
manifest = JSON.parse(await readFile(path.join(dir, 'manifest.json'), 'utf8'));
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
throw new Error(`no prebuilt artifact runtime in ${dir}: run \`npm run build\` in jig (the source tree has none)`);
|
|
109
|
+
}
|
|
110
|
+
return { dir, runtime: path.join(dir, 'runtime.js'), katexCss: path.join(dir, 'katex.css'), ...manifest };
|
|
111
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/** Put this in the system prompt of the tool or agent that writes a canvas (after the host's own context). */
|
|
2
|
+
export declare const ARTIFACT_INSTRUCTIONS = "You write an artifact: one React component in a single TSX file that the app renders in a sandboxed page, on a phone (390 px wide) or a desktop. Reply with exactly one ```tsx code block and nothing else.\n\nRules\n- `export default function App() { ... }`. TypeScript is fine. No network: put the data in the file as constants.\n- Style with Tailwind CSS classes (v4, all utilities available; write class names in full, not built from pieces). No CSS files, no <style> tags. Theme colours: bg-background, text-foreground, bg-card, text-muted-foreground, bg-primary, border; for charts var(--chart-1) \u2026 var(--chart-5) or hex colours.\n- Import with named imports only (`import { useState } from \"react\"`, never `import React` or `import * as`), and only from these modules:\n - `react` (hooks, Fragment)\n - `recharts` (charts: ResponsiveContainer, BarChart, LineChart, AreaChart, PieChart, ScatterChart, ...)\n - `lucide-react` (icons)\n - shadcn/ui components: `@/components/ui/card` (Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter), `@/components/ui/button` (Button), `@/components/ui/badge` (Badge), `@/components/ui/table` (Table, TableHeader, TableBody, TableRow, TableHead, TableCell, TableCaption), `@/components/ui/tabs` (Tabs, TabsList, TabsTrigger, TabsContent), `@/components/ui/input` (Input, Textarea), `@/components/ui/label` (Label), `@/components/ui/select` (Select, SelectTrigger, SelectValue, SelectContent, SelectItem), `@/components/ui/slider` (Slider), `@/components/ui/switch` (Switch), `@/components/ui/checkbox` (Checkbox), `@/components/ui/progress` (Progress), `@/components/ui/separator` (Separator), `@/components/ui/alert` (Alert, AlertTitle, AlertDescription), `@/components/ui/accordion` (Accordion, AccordionItem, AccordionTrigger, AccordionContent), `@/lib/utils` (cn).\n - `jig/canvas`: `useCanvasState`, `TeX`.\n- Anything the reader sets that should be kept (slider values, answers, checked items, notes): `const [value, setValue] = useCanvasState(\"key\", initial)` from `jig/canvas`, used like useState with a short key; values are plain JSON. Never use localStorage, sessionStorage or cookies (blocked in the sandbox).\n- Formulas: `<TeX>{String.raw`\\frac{a}{b}`}</TeX>` inline, `<TeX block>{...}</TeX>` on their own line (KaTeX). No other packages (no d3, no KaTeX import).";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// The model instruction for tier-B artifact pages: `eval/kit/kits/artifact.md` (jig-011, 100% render with the cheap
|
|
2
|
+
// model), plus the state hooks (pages reached for localStorage, which the sandbox blocks) and KaTeX.
|
|
3
|
+
/** Put this in the system prompt of the tool or agent that writes a canvas (after the host's own context). */
|
|
4
|
+
export const ARTIFACT_INSTRUCTIONS = `You write an artifact: one React component in a single TSX file that the app renders in a sandboxed page, on a phone (390 px wide) or a desktop. Reply with exactly one \`\`\`tsx code block and nothing else.
|
|
5
|
+
|
|
6
|
+
Rules
|
|
7
|
+
- \`export default function App() { ... }\`. TypeScript is fine. No network: put the data in the file as constants.
|
|
8
|
+
- Style with Tailwind CSS classes (v4, all utilities available; write class names in full, not built from pieces). No CSS files, no <style> tags. Theme colours: bg-background, text-foreground, bg-card, text-muted-foreground, bg-primary, border; for charts var(--chart-1) … var(--chart-5) or hex colours.
|
|
9
|
+
- Import with named imports only (\`import { useState } from "react"\`, never \`import React\` or \`import * as\`), and only from these modules:
|
|
10
|
+
- \`react\` (hooks, Fragment)
|
|
11
|
+
- \`recharts\` (charts: ResponsiveContainer, BarChart, LineChart, AreaChart, PieChart, ScatterChart, ...)
|
|
12
|
+
- \`lucide-react\` (icons)
|
|
13
|
+
- shadcn/ui components: \`@/components/ui/card\` (Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter), \`@/components/ui/button\` (Button), \`@/components/ui/badge\` (Badge), \`@/components/ui/table\` (Table, TableHeader, TableBody, TableRow, TableHead, TableCell, TableCaption), \`@/components/ui/tabs\` (Tabs, TabsList, TabsTrigger, TabsContent), \`@/components/ui/input\` (Input, Textarea), \`@/components/ui/label\` (Label), \`@/components/ui/select\` (Select, SelectTrigger, SelectValue, SelectContent, SelectItem), \`@/components/ui/slider\` (Slider), \`@/components/ui/switch\` (Switch), \`@/components/ui/checkbox\` (Checkbox), \`@/components/ui/progress\` (Progress), \`@/components/ui/separator\` (Separator), \`@/components/ui/alert\` (Alert, AlertTitle, AlertDescription), \`@/components/ui/accordion\` (Accordion, AccordionItem, AccordionTrigger, AccordionContent), \`@/lib/utils\` (cn).
|
|
14
|
+
- \`jig/canvas\`: \`useCanvasState\`, \`TeX\`.
|
|
15
|
+
- Anything the reader sets that should be kept (slider values, answers, checked items, notes): \`const [value, setValue] = useCanvasState("key", initial)\` from \`jig/canvas\`, used like useState with a short key; values are plain JSON. Never use localStorage, sessionStorage or cookies (blocked in the sandbox).
|
|
16
|
+
- Formulas: \`<TeX>{String.raw\`\\frac{a}{b}\`}</TeX>\` inline, \`<TeX block>{...}</TeX>\` on their own line (KaTeX). No other packages (no d3, no KaTeX import).`;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { ThemeKind } from '../protocol.ts';
|
|
3
|
+
export interface TeXProps {
|
|
4
|
+
/** The formula; `children` works too: `<TeX>{"e^{i\\pi}+1=0"}</TeX>`. */
|
|
5
|
+
math?: string;
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
/** Display mode, on its own line (`display` is the same). */
|
|
8
|
+
block?: boolean;
|
|
9
|
+
display?: boolean;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
/** A KaTeX formula. A bad formula shows its source in red, never throws. */
|
|
13
|
+
export declare function TeX(props: TeXProps): ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* `<Math>` is `TeX` (the Cursor kit's name). A page that imports it still has `Math.round`, `Math.PI` …: the component
|
|
16
|
+
* carries the global `Math`'s members, so the import does not break arithmetic.
|
|
17
|
+
*/
|
|
18
|
+
export declare const Math: typeof TeX & typeof globalThis.Math;
|
|
19
|
+
/** The shell around every page: the page's padding and width. */
|
|
20
|
+
export declare function ArtifactRoot({ theme, children }: {
|
|
21
|
+
theme: ThemeKind;
|
|
22
|
+
children?: ReactNode;
|
|
23
|
+
}): ReactNode;
|
|
24
|
+
/** What the compiled page's first line hands the runtime (`compileArtifact`): its CSS and the icons it imports. */
|
|
25
|
+
export interface ArtifactPagePrelude {
|
|
26
|
+
css?: string;
|
|
27
|
+
icons?: Record<string, IconNode>;
|
|
28
|
+
}
|
|
29
|
+
export type IconNode = ReadonlyArray<readonly [string, Record<string, string | number>]>;
|
|
30
|
+
export declare const lucideModule: Record<string, unknown>;
|
|
31
|
+
/** `jig/canvas` in a tier-B page. `__page` is not importable (the compile check's list leaves it out). */
|
|
32
|
+
export declare const jigCanvasModule: Record<string, unknown>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// The artifact kit's own module, `jig/canvas` inside a tier-B page (J009): the state hooks, `TeX` / `Math` (KaTeX), and
|
|
2
|
+
// the page shell. Bundled only into the artifact `runtime.js` (it imports KaTeX); the class strings here are part of
|
|
3
|
+
// every page's CSS (`ARTIFACT_KIT_CLASSES`), so keep each class in a string literal.
|
|
4
|
+
import { createElement as h, Fragment, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
5
|
+
import katex from 'katex';
|
|
6
|
+
import { useCanvasAction, useCanvasEvent, useCanvasState, useCanvasSurface, useCanvasTheme } from "../state.js";
|
|
7
|
+
function texSource(props) {
|
|
8
|
+
if (typeof props.math === 'string')
|
|
9
|
+
return props.math;
|
|
10
|
+
const parts = [];
|
|
11
|
+
const walk = (c) => {
|
|
12
|
+
if (c == null || typeof c === 'boolean')
|
|
13
|
+
return;
|
|
14
|
+
if (Array.isArray(c))
|
|
15
|
+
c.forEach(walk);
|
|
16
|
+
else if (typeof c === 'string' || typeof c === 'number' || typeof c === 'bigint')
|
|
17
|
+
parts.push(String(c));
|
|
18
|
+
};
|
|
19
|
+
walk(props.children);
|
|
20
|
+
return parts.join('');
|
|
21
|
+
}
|
|
22
|
+
/** A KaTeX formula. A bad formula shows its source in red, never throws. */
|
|
23
|
+
export function TeX(props) {
|
|
24
|
+
const tex = texSource(props);
|
|
25
|
+
const block = props.block ?? props.display ?? false;
|
|
26
|
+
const html = useMemo(() => {
|
|
27
|
+
try {
|
|
28
|
+
return katex.renderToString(tex, { displayMode: block, throwOnError: false, output: 'htmlAndMathml', strict: 'ignore', trust: false, maxSize: 50, maxExpand: 1000 });
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
}, [tex, block]);
|
|
34
|
+
if (html == null)
|
|
35
|
+
return h('code', { className: 'text-destructive' }, tex);
|
|
36
|
+
return h(block ? 'div' : 'span', {
|
|
37
|
+
'data-jig-tex': block ? 'block' : 'inline',
|
|
38
|
+
className: [block ? 'my-2 block max-w-full overflow-x-auto overflow-y-hidden py-1' : 'inline-block max-w-full overflow-x-auto overflow-y-hidden align-middle', props.className].filter(Boolean).join(' '),
|
|
39
|
+
dangerouslySetInnerHTML: { __html: html },
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* `<Math>` is `TeX` (the Cursor kit's name). A page that imports it still has `Math.round`, `Math.PI` …: the component
|
|
44
|
+
* carries the global `Math`'s members, so the import does not break arithmetic.
|
|
45
|
+
*/
|
|
46
|
+
export const Math = Object.assign(function Math(props) {
|
|
47
|
+
return TeX(props);
|
|
48
|
+
}, Object.fromEntries(Object.getOwnPropertyNames(globalThis.Math).map((k) => [k, globalThis.Math[k]])));
|
|
49
|
+
/** The shell around every page: the page's padding and width. */
|
|
50
|
+
export function ArtifactRoot({ theme, children }) {
|
|
51
|
+
return h('main', { 'data-jig-artifact': theme, className: 'mx-auto w-full max-w-[1120px] px-4 pt-4 pb-6 antialiased' }, children);
|
|
52
|
+
}
|
|
53
|
+
export const lucideModule = {};
|
|
54
|
+
/** Called once, before the page's own code, by the line `compileArtifact` puts first. */
|
|
55
|
+
function definePage(prelude) {
|
|
56
|
+
if (typeof prelude?.css === 'string' && prelude.css) {
|
|
57
|
+
const style = document.createElement('style');
|
|
58
|
+
style.setAttribute('data-jig-artifact', '');
|
|
59
|
+
style.textContent = prelude.css;
|
|
60
|
+
document.head.appendChild(style);
|
|
61
|
+
}
|
|
62
|
+
for (const [name, node] of Object.entries(prelude?.icons ?? {}))
|
|
63
|
+
lucideModule[name] = lucideIcon(name, node);
|
|
64
|
+
}
|
|
65
|
+
const ICON_ATTRS = { xmlns: 'http://www.w3.org/2000/svg', viewBox: '0 0 24 24', fill: 'none', strokeLinecap: 'round', strokeLinejoin: 'round' };
|
|
66
|
+
/** A lucide-react-compatible icon component from its node (`lucide-react`'s `Icon`, without its context). */
|
|
67
|
+
function lucideIcon(name, node) {
|
|
68
|
+
const kebab = name.replace(/^Lucide/, '').replace(/Icon$/, '').replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
|
|
69
|
+
const Icon = ({ size = 24, color = 'currentColor', strokeWidth = 2, absoluteStrokeWidth, className, children, ...rest }) => {
|
|
70
|
+
const stroke = absoluteStrokeWidth ? (Number(strokeWidth) * 24) / Number(size) : strokeWidth;
|
|
71
|
+
const aria = children == null && !Object.keys(rest).some((k) => k.startsWith('aria-') || k === 'role' || k === 'title');
|
|
72
|
+
return h('svg', {
|
|
73
|
+
...ICON_ATTRS, width: size, height: size, stroke: color, strokeWidth: stroke,
|
|
74
|
+
className: ['lucide', `lucide-${kebab}`, className].filter(Boolean).join(' '),
|
|
75
|
+
...(aria ? { 'aria-hidden': 'true' } : {}),
|
|
76
|
+
...rest,
|
|
77
|
+
}, ...node.map(([tag, attrs], i) => h(tag, { key: i, ...attrs })), children);
|
|
78
|
+
};
|
|
79
|
+
Icon.displayName = name;
|
|
80
|
+
return Icon;
|
|
81
|
+
}
|
|
82
|
+
/** `jig/canvas` in a tier-B page. `__page` is not importable (the compile check's list leaves it out). */
|
|
83
|
+
export const jigCanvasModule = {
|
|
84
|
+
useCanvasState, useCanvasEvent, useCanvasAction, useCanvasTheme, useCanvasSurface,
|
|
85
|
+
useState, useEffect, useMemo, useRef, useCallback, Fragment,
|
|
86
|
+
TeX, Math,
|
|
87
|
+
__page: definePage,
|
|
88
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// The module map of a tier-B artifact page: what each `import … from "<module>"` resolves to inside the frame. The
|
|
2
|
+
// entry of the prebuilt artifact `runtime.js`; `ARTIFACT_EXPORTS` (names.ts, generated) lists the same names for the
|
|
3
|
+
// compile check, and `test/canvas-artifact.test.ts` keeps the two in step.
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import * as recharts from 'recharts';
|
|
6
|
+
import * as ui from "./ui.js";
|
|
7
|
+
import { jigCanvasModule, lucideModule } from "./kit.js";
|
|
8
|
+
const pick = (...names) => Object.fromEntries(names.map((n) => [n, ui[n]]));
|
|
9
|
+
/** Module name → its exports. `lucide-react` is filled per page with the icons it imports (`compileArtifact`). */
|
|
10
|
+
export const ARTIFACT_MODULE_MAP = {
|
|
11
|
+
react: { ...React, default: React },
|
|
12
|
+
recharts: { ...recharts },
|
|
13
|
+
'lucide-react': lucideModule,
|
|
14
|
+
'jig/canvas': jigCanvasModule,
|
|
15
|
+
'@/lib/utils': { cn: ui.cn },
|
|
16
|
+
'@/components/ui/card': pick('Card', 'CardHeader', 'CardTitle', 'CardDescription', 'CardContent', 'CardFooter', 'CardAction'),
|
|
17
|
+
'@/components/ui/button': pick('Button', 'buttonVariants'),
|
|
18
|
+
'@/components/ui/badge': pick('Badge', 'badgeVariants'),
|
|
19
|
+
'@/components/ui/table': pick('Table', 'TableHeader', 'TableBody', 'TableFooter', 'TableRow', 'TableHead', 'TableCell', 'TableCaption'),
|
|
20
|
+
'@/components/ui/tabs': pick('Tabs', 'TabsList', 'TabsTrigger', 'TabsContent'),
|
|
21
|
+
'@/components/ui/input': pick('Input', 'Textarea'),
|
|
22
|
+
'@/components/ui/textarea': pick('Textarea'),
|
|
23
|
+
'@/components/ui/label': pick('Label'),
|
|
24
|
+
'@/components/ui/select': pick('Select', 'SelectGroup', 'SelectValue', 'SelectTrigger', 'SelectContent', 'SelectItem', 'SelectLabel', 'SelectSeparator'),
|
|
25
|
+
'@/components/ui/slider': pick('Slider'),
|
|
26
|
+
'@/components/ui/switch': pick('Switch'),
|
|
27
|
+
'@/components/ui/checkbox': pick('Checkbox'),
|
|
28
|
+
'@/components/ui/progress': pick('Progress'),
|
|
29
|
+
'@/components/ui/separator': pick('Separator'),
|
|
30
|
+
'@/components/ui/alert': pick('Alert', 'AlertTitle', 'AlertDescription'),
|
|
31
|
+
'@/components/ui/accordion': pick('Accordion', 'AccordionItem', 'AccordionTrigger', 'AccordionContent'),
|
|
32
|
+
};
|
|
33
|
+
export { ArtifactRoot } from "./kit.js";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** What each module of a tier-B page exports. `lucide-react`'s names come from the icon table (`icons.ts`). */
|
|
2
|
+
export declare const ARTIFACT_EXPORTS: Readonly<Record<string, readonly string[]>>;
|
|
3
|
+
/** The modules a tier-B page may import. */
|
|
4
|
+
export declare const ARTIFACT_MODULES: readonly string[];
|
|
5
|
+
/** The classes the kit's own components use: every page's CSS carries them. */
|
|
6
|
+
export declare const ARTIFACT_KIT_CLASSES: readonly string[];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Generated by scripts/gen-artifact-names.ts from the artifact runtime's module map and the kit's sources; do not
|
|
2
|
+
// edit. test/canvas-artifact.test.ts fails when it is stale. No imports: the server reads it without loading React.
|
|
3
|
+
/** What each module of a tier-B page exports. `lucide-react`'s names come from the icon table (`icons.ts`). */
|
|
4
|
+
export const ARTIFACT_EXPORTS = {
|
|
5
|
+
"react": ["Activity", "Children", "Component", "Fragment", "Profiler", "PureComponent", "StrictMode", "Suspense", "ViewTransition", "addTransitionType", "cache", "cacheSignal", "captureOwnerStack", "cloneElement", "createContext", "createElement", "createRef", "forwardRef", "isValidElement", "lazy", "memo", "startTransition", "use", "useActionState", "useCallback", "useContext", "useDebugValue", "useDeferredValue", "useEffect", "useEffectEvent", "useId", "useImperativeHandle", "useInsertionEffect", "useLayoutEffect", "useMemo", "useOptimistic", "useReducer", "useRef", "useState", "useSyncExternalStore", "useTransition", "version"],
|
|
6
|
+
"recharts": ["AnimationControllerProvider", "Area", "AreaChart", "AreaRevealShape", "Bar", "BarChart", "BarStack", "Brush", "CSSTransitionAnimation", "CartesianAxis", "CartesianGrid", "Cell", "ComposedChart", "Cross", "Curve", "Customized", "DefaultLegendContent", "DefaultTooltipContent", "DefaultZIndexes", "Dot", "ErrorBar", "Funnel", "FunnelChart", "Global", "JavascriptAnimation", "Label", "LabelList", "Layer", "Legend", "Line", "LineChart", "LineDrawShape", "Pie", "PieChart", "PolarAngleAxis", "PolarGrid", "PolarRadiusAxis", "Polygon", "Radar", "RadarChart", "RadialBar", "RadialBarChart", "RechartsThemeProvider", "Rectangle", "ReferenceArea", "ReferenceDot", "ReferenceLine", "ResponsiveContainer", "Sankey", "Scatter", "ScatterChart", "Sector", "SunburstChart", "Surface", "Symbols", "Text", "Tooltip", "Trapezoid", "Treemap", "XAxis", "YAxis", "ZAxis", "ZIndexLayer", "autoPalette", "autoTheme", "createCentricChart", "createHorizontalChart", "createRadialChart", "createVerticalChart", "darkPalette", "darkTheme", "emptyTheme", "getNiceTickValues", "getRelativeCoordinate", "gradients", "interpolate", "lightPalette", "lightTheme", "linearGradient", "matchAppend", "matchByDataKey", "matchByIndex", "pattern", "patterns", "useActiveTooltipCoordinate", "useActiveTooltipDataPoints", "useActiveTooltipLabel", "useCartesianChartLayout", "useCartesianScale", "useChartHeight", "useChartLayout", "useChartWidth", "useIsTooltipActive", "useMargin", "useOffset", "usePlotArea", "usePolarChartLayout", "useRechartsTheme", "useXAxisDomain", "useXAxisInverseDataSnapScale", "useXAxisInverseScale", "useXAxisInverseTickSnapScale", "useXAxisScale", "useXAxisTicks", "useYAxisDomain", "useYAxisInverseDataSnapScale", "useYAxisInverseScale", "useYAxisInverseTickSnapScale", "useYAxisScale", "useYAxisTicks"],
|
|
7
|
+
"lucide-react": [],
|
|
8
|
+
"jig/canvas": ["Fragment", "Math", "TeX", "useCallback", "useCanvasAction", "useCanvasEvent", "useCanvasState", "useCanvasSurface", "useCanvasTheme", "useEffect", "useMemo", "useRef", "useState"],
|
|
9
|
+
"@/lib/utils": ["cn"],
|
|
10
|
+
"@/components/ui/card": ["Card", "CardAction", "CardContent", "CardDescription", "CardFooter", "CardHeader", "CardTitle"],
|
|
11
|
+
"@/components/ui/button": ["Button", "buttonVariants"],
|
|
12
|
+
"@/components/ui/badge": ["Badge", "badgeVariants"],
|
|
13
|
+
"@/components/ui/table": ["Table", "TableBody", "TableCaption", "TableCell", "TableFooter", "TableHead", "TableHeader", "TableRow"],
|
|
14
|
+
"@/components/ui/tabs": ["Tabs", "TabsContent", "TabsList", "TabsTrigger"],
|
|
15
|
+
"@/components/ui/input": ["Input", "Textarea"],
|
|
16
|
+
"@/components/ui/textarea": ["Textarea"],
|
|
17
|
+
"@/components/ui/label": ["Label"],
|
|
18
|
+
"@/components/ui/select": ["Select", "SelectContent", "SelectGroup", "SelectItem", "SelectLabel", "SelectSeparator", "SelectTrigger", "SelectValue"],
|
|
19
|
+
"@/components/ui/slider": ["Slider"],
|
|
20
|
+
"@/components/ui/switch": ["Switch"],
|
|
21
|
+
"@/components/ui/checkbox": ["Checkbox"],
|
|
22
|
+
"@/components/ui/progress": ["Progress"],
|
|
23
|
+
"@/components/ui/separator": ["Separator"],
|
|
24
|
+
"@/components/ui/alert": ["Alert", "AlertDescription", "AlertTitle"],
|
|
25
|
+
"@/components/ui/accordion": ["Accordion", "AccordionContent", "AccordionItem", "AccordionTrigger"],
|
|
26
|
+
};
|
|
27
|
+
/** The modules a tier-B page may import. */
|
|
28
|
+
export const ARTIFACT_MODULES = Object.keys(ARTIFACT_EXPORTS);
|
|
29
|
+
/** The classes the kit's own components use: every page's CSS carries them. */
|
|
30
|
+
export const ARTIFACT_KIT_CLASSES = ["*:data-[slot=alert-description]:text-destructive/90", "*:data-[slot=select-value]:flex", "*:data-[slot=select-value]:gap-2", "*:data-[slot=select-value]:items-center", "*:data-[slot=select-value]:line-clamp-1", "-mx-1", "[&:has([role=checkbox])]:pr-0", "[&>svg]:pointer-events-none", "[&>svg]:size-3", "[&>svg]:size-4", "[&>svg]:text-current", "[&>svg]:translate-y-0.5", "[&>tr]:last:border-b-0", "[&[data-state=open]>svg]:rotate-180", "[&_p]:leading-relaxed", "[&_svg:not([class*='size-'])]:size-4", "[&_svg:not([class*='text-'])]:text-muted-foreground", "[&_svg]:pointer-events-none", "[&_svg]:shrink-0", "[&_tr:last-child]:border-0", "[&_tr]:border-b", "absolute", "align-middle", "antialiased", "auto-rows-min", "bg-background", "bg-border", "bg-card", "bg-destructive", "bg-muted", "bg-muted/50", "bg-popover", "bg-primary", "bg-primary/20", "bg-secondary", "bg-transparent", "block", "border", "border-b", "border-destructive/40", "border-input", "border-primary", "border-t", "border-transparent", "break-words", "caption-bottom", "col-start-2", "cursor-default", "cursor-pointer", "data-[disabled]:opacity-50", "data-[disabled]:pointer-events-none", "data-[orientation=horizontal]:h-1.5", "data-[orientation=horizontal]:h-full", "data-[orientation=horizontal]:h-px", "data-[orientation=horizontal]:w-full", "data-[orientation=vertical]:flex-col", "data-[orientation=vertical]:h-full", "data-[orientation=vertical]:min-h-44", "data-[orientation=vertical]:w-1.5", "data-[orientation=vertical]:w-auto", "data-[orientation=vertical]:w-full", "data-[orientation=vertical]:w-px", "data-[placeholder]:text-muted-foreground", "data-[side=bottom]:translate-y-1", "data-[side=left]:-translate-x-1", "data-[side=right]:translate-x-1", "data-[side=top]:-translate-y-1", "data-[size=default]:h-9", "data-[size=sm]:h-8", "data-[state=active]:bg-background", "data-[state=active]:shadow-sm", "data-[state=checked]:bg-primary", "data-[state=checked]:border-primary", "data-[state=checked]:text-primary-foreground", "data-[state=checked]:translate-x-[calc(100%-2px)]", "data-[state=selected]:bg-muted", "data-[state=unchecked]:bg-input", "data-[state=unchecked]:translate-x-0", "disabled:cursor-not-allowed", "disabled:opacity-50", "disabled:pointer-events-none", "duration-200", "field-sizing-content", "file:bg-transparent", "file:border-0", "file:font-medium", "file:h-7", "file:inline-flex", "file:text-foreground", "file:text-sm", "flex", "flex-1", "flex-col", "focus-visible:border-ring", "focus-visible:outline-1", "focus-visible:outline-hidden", "focus-visible:ring-4", "focus-visible:ring-[3px]", "focus-visible:ring-ring/50", "focus:bg-accent", "focus:text-accent-foreground", "font-medium", "font-mono", "font-semibold", "gap-1", "gap-1.5", "gap-2", "gap-4", "gap-6", "gap-y-0.5", "grid", "grid-cols-[0_1fr]", "group-data-[disabled=true]:opacity-50", "group-data-[disabled=true]:pointer-events-none", "grow", "h-10", "h-2", "h-8", "h-9", "h-[1.15rem]", "h-[calc(100%-1px)]", "h-[var(--radix-select-trigger-height)]", "h-full", "h-px", "has-[>svg]:gap-x-3", "has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr]", "hover:bg-accent", "hover:bg-destructive/90", "hover:bg-muted/50", "hover:bg-primary/90", "hover:bg-secondary/80", "hover:ring-4", "hover:text-accent-foreground", "hover:underline", "inline", "inline-block", "inline-flex", "items-center", "items-start", "justify-between", "justify-center", "justify-items-start", "justify-self-end", "last:border-b-0", "leading-none", "line-clamp-1", "max-h-(--radix-select-content-available-height)", "max-w-[1120px]", "max-w-full", "md:text-sm", "min-h-16", "min-h-4", "min-w-0", "min-w-[8rem]", "min-w-[var(--radix-select-trigger-width)]", "mt-4", "mx-auto", "my-1", "my-2", "opacity-50", "origin-(--radix-select-content-transform-origin)", "outline-hidden", "outline-none", "overflow-hidden", "overflow-x-auto", "overflow-x-hidden", "overflow-y-auto", "overflow-y-hidden", "p-1", "p-2", "p-[3px]", "pb-4", "pb-6", "peer-disabled:cursor-not-allowed", "peer-disabled:opacity-50", "pl-2", "placeholder:text-muted-foreground", "pointer-events-none", "pr-8", "pt-0", "pt-4", "px-2", "px-3", "px-4", "px-6", "py-0.5", "py-1", "py-1.5", "py-2", "py-3", "py-4", "py-6", "relative", "right-2", "ring-0", "ring-ring/50", "rounded-[4px]", "rounded-full", "rounded-lg", "rounded-md", "rounded-sm", "rounded-xl", "row-span-2", "row-start-1", "scroll-my-1", "select-none", "selection:bg-primary", "selection:text-primary-foreground", "self-start", "shadow-md", "shadow-sm", "shadow-xs", "shrink-0", "size-10", "size-3.5", "size-4", "size-8", "size-9", "table", "table-caption", "table-cell", "table-row", "text-base", "text-card-foreground", "text-current", "text-destructive", "text-foreground", "text-left", "text-muted-foreground", "text-popover-foreground", "text-primary", "text-primary-foreground", "text-secondary-foreground", "text-sm", "text-white", "text-xs", "touch-none", "tracking-tight", "transition-[color,box-shadow]", "transition-all", "transition-colors", "transition-none", "transition-shadow", "transition-transform", "translate-y-0.5", "underline-offset-4", "w-8", "w-fit", "w-full", "whitespace-nowrap", "whitespace-pre-wrap", "z-50"];
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { type ComponentProps, type ReactNode } from 'react';
|
|
2
|
+
import type * as React from 'react';
|
|
3
|
+
import { type ClassValue } from 'clsx';
|
|
4
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
5
|
+
import * as TabsP from '@radix-ui/react-tabs';
|
|
6
|
+
import * as SelectP from '@radix-ui/react-select';
|
|
7
|
+
import * as SliderP from '@radix-ui/react-slider';
|
|
8
|
+
import * as SwitchP from '@radix-ui/react-switch';
|
|
9
|
+
import * as CheckboxP from '@radix-ui/react-checkbox';
|
|
10
|
+
import * as ProgressP from '@radix-ui/react-progress';
|
|
11
|
+
import * as SeparatorP from '@radix-ui/react-separator';
|
|
12
|
+
import * as LabelP from '@radix-ui/react-label';
|
|
13
|
+
import * as AccordionP from '@radix-ui/react-accordion';
|
|
14
|
+
export declare function cn(...inputs: ClassValue[]): string;
|
|
15
|
+
export declare const Card: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
16
|
+
export declare const CardHeader: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
17
|
+
export declare const CardTitle: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
18
|
+
export declare const CardDescription: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
19
|
+
export declare const CardContent: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
20
|
+
export declare const CardFooter: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
21
|
+
export declare const CardAction: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
22
|
+
export declare const buttonVariants: (props?: ({
|
|
23
|
+
variant?: "link" | "default" | "secondary" | "destructive" | "outline" | "ghost" | null | undefined;
|
|
24
|
+
size?: "icon" | "default" | "sm" | "lg" | "icon-sm" | "icon-lg" | null | undefined;
|
|
25
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
26
|
+
type ButtonProps = ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
|
|
27
|
+
asChild?: boolean;
|
|
28
|
+
};
|
|
29
|
+
export declare const Button: React.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
30
|
+
export declare const badgeVariants: (props?: ({
|
|
31
|
+
variant?: "default" | "secondary" | "destructive" | "outline" | null | undefined;
|
|
32
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
33
|
+
type BadgeProps = ComponentProps<'span'> & VariantProps<typeof badgeVariants> & {
|
|
34
|
+
asChild?: boolean;
|
|
35
|
+
};
|
|
36
|
+
export declare const Badge: React.ForwardRefExoticComponent<Omit<BadgeProps, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
37
|
+
export declare const Table: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, "ref"> & React.RefAttributes<HTMLTableElement>>;
|
|
38
|
+
export declare const TableHeader: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>, "ref"> & React.RefAttributes<Element>>;
|
|
39
|
+
export declare const TableBody: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>, "ref"> & React.RefAttributes<Element>>;
|
|
40
|
+
export declare const TableFooter: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>, "ref"> & React.RefAttributes<Element>>;
|
|
41
|
+
export declare const TableRow: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, "ref"> & React.RefAttributes<Element>>;
|
|
42
|
+
export declare const TableHead: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>, "ref"> & React.RefAttributes<Element>>;
|
|
43
|
+
export declare const TableCell: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>, "ref"> & React.RefAttributes<Element>>;
|
|
44
|
+
export declare const TableCaption: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & React.RefAttributes<Element>>;
|
|
45
|
+
export declare const Tabs: React.ForwardRefExoticComponent<Omit<TabsP.TabsProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<unknown>>;
|
|
46
|
+
export declare const TabsList: React.ForwardRefExoticComponent<Omit<TabsP.TabsListProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<unknown>>;
|
|
47
|
+
export declare const TabsTrigger: React.ForwardRefExoticComponent<Omit<TabsP.TabsTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<unknown>>;
|
|
48
|
+
export declare const TabsContent: React.ForwardRefExoticComponent<Omit<TabsP.TabsContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<unknown>>;
|
|
49
|
+
export declare const Input: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
50
|
+
export declare const Textarea: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "ref"> & React.RefAttributes<HTMLTextAreaElement>>;
|
|
51
|
+
export declare const Label: React.ForwardRefExoticComponent<Omit<LabelP.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & React.RefAttributes<unknown>>;
|
|
52
|
+
export declare const Select: React.FC<SelectP.SelectProps>;
|
|
53
|
+
export declare const SelectGroup: React.ForwardRefExoticComponent<SelectP.SelectGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
54
|
+
export declare const SelectValue: React.ForwardRefExoticComponent<SelectP.SelectValueProps & React.RefAttributes<HTMLSpanElement>>;
|
|
55
|
+
export declare const SelectTrigger: React.ForwardRefExoticComponent<Omit<SelectP.SelectTriggerProps & React.RefAttributes<HTMLButtonElement> & {
|
|
56
|
+
size?: "sm" | "default";
|
|
57
|
+
}, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
58
|
+
export declare function SelectContent({ className, children, position, ...p }: ComponentProps<typeof SelectP.Content>): ReactNode;
|
|
59
|
+
export declare const SelectItem: React.ForwardRefExoticComponent<Omit<SelectP.SelectItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
60
|
+
export declare const SelectLabel: React.ForwardRefExoticComponent<Omit<SelectP.SelectLabelProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<unknown>>;
|
|
61
|
+
export declare const SelectSeparator: React.ForwardRefExoticComponent<Omit<SelectP.SelectSeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<unknown>>;
|
|
62
|
+
export declare const Slider: React.ForwardRefExoticComponent<Omit<SliderP.SliderProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
63
|
+
export declare const Switch: React.ForwardRefExoticComponent<Omit<SwitchP.SwitchProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
64
|
+
export declare const Checkbox: React.ForwardRefExoticComponent<Omit<CheckboxP.CheckboxProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
65
|
+
export declare const Progress: React.ForwardRefExoticComponent<Omit<ProgressP.ProgressProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
66
|
+
export declare const Separator: React.ForwardRefExoticComponent<Omit<SeparatorP.SeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
67
|
+
export declare const Alert: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
|
|
68
|
+
variant?: "default" | "destructive" | null | undefined;
|
|
69
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
70
|
+
export declare const AlertTitle: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
71
|
+
export declare const AlertDescription: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
72
|
+
export declare const Accordion: React.ForwardRefExoticComponent<(AccordionP.AccordionSingleProps | AccordionP.AccordionMultipleProps) & React.RefAttributes<HTMLDivElement>>;
|
|
73
|
+
export declare const AccordionItem: React.ForwardRefExoticComponent<Omit<AccordionP.AccordionItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<unknown>>;
|
|
74
|
+
export declare const AccordionTrigger: React.ForwardRefExoticComponent<Omit<AccordionP.AccordionTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
75
|
+
export declare const AccordionContent: React.ForwardRefExoticComponent<Omit<AccordionP.AccordionContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
76
|
+
export {};
|