@designa8/vibedesign-linear-internal-v1-b737 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.cjs +1581 -1169
- package/dist/index.js +1609 -1197
- package/dist/styles.css +30 -0
- package/package.json +6 -1
- package/src/atoms/CodeEditor/CodeEditor.tsx +497 -0
- package/src/atoms/CodeEditor/index.ts +6 -0
- package/src/atoms/CodeEditor/preview.tsx +135 -0
- package/src/atoms/Icon/icons.data.ts +1 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { CodeEditor, type CodeEditorFile } from "./CodeEditor";
|
|
3
|
+
|
|
4
|
+
const SHELL_TSX = `import * as React from "react";
|
|
5
|
+
|
|
6
|
+
export interface CardShellProps {
|
|
7
|
+
title: string;
|
|
8
|
+
count?: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// Composed panel used across the gallery.
|
|
12
|
+
export const CardShell = ({ title, count = 0 }: CardShellProps) => {
|
|
13
|
+
const label = \`\${title} (\${count})\`;
|
|
14
|
+
return (
|
|
15
|
+
<div className="rounded-lg border border-hairline p-base">
|
|
16
|
+
<header>{label}</header>
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
CardShell.displayName = "CardShell";`;
|
|
21
|
+
|
|
22
|
+
const TOKENS_CSS = `/* Generated from the token source of truth. */
|
|
23
|
+
:root {
|
|
24
|
+
--color-primary: var(--brand-core);
|
|
25
|
+
--color-canvas: var(--neutral-0);
|
|
26
|
+
--radius-md: 8px;
|
|
27
|
+
--space-md: 12px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
[data-theme="dark"] {
|
|
31
|
+
--color-canvas: var(--neutral-1000);
|
|
32
|
+
--color-primary: var(--brand-core-light);
|
|
33
|
+
}`;
|
|
34
|
+
|
|
35
|
+
const MANIFEST_JSON = `{
|
|
36
|
+
"name": "atoms",
|
|
37
|
+
"version": "2.4.0",
|
|
38
|
+
"components": 94,
|
|
39
|
+
"stable": true,
|
|
40
|
+
"registry": null
|
|
41
|
+
}`;
|
|
42
|
+
|
|
43
|
+
const NOTES_MD = `# CardShell
|
|
44
|
+
|
|
45
|
+
The default panel in the system. \`title\` renders the header and
|
|
46
|
+
\`count\` renders a muted tally beside it.
|
|
47
|
+
|
|
48
|
+
## States
|
|
49
|
+
- enabled
|
|
50
|
+
- hover
|
|
51
|
+
- disabled`;
|
|
52
|
+
|
|
53
|
+
const FILES: CodeEditorFile[] = [
|
|
54
|
+
{ name: "CardShell.tsx", language: "tsx", source: SHELL_TSX },
|
|
55
|
+
{ name: "tokens.css", language: "css", source: TOKENS_CSS },
|
|
56
|
+
{ name: "manifest.json", language: "json", source: MANIFEST_JSON },
|
|
57
|
+
{ name: "NOTES.md", language: "md", source: NOTES_MD },
|
|
58
|
+
];
|
|
59
|
+
|
|
60
|
+
export default function CodeEditorPreview() {
|
|
61
|
+
const [active, setActive] = React.useState("CardShell.tsx");
|
|
62
|
+
const [copies, setCopies] = React.useState(0);
|
|
63
|
+
const [draft, setDraft] = React.useState<Record<string, string>>(() =>
|
|
64
|
+
Object.fromEntries(FILES.map((file) => [file.name, file.source])),
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
const files = FILES.map((file) => ({
|
|
68
|
+
...file,
|
|
69
|
+
source: draft[file.name] ?? file.source,
|
|
70
|
+
}));
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<div className="mx-auto w-full max-w-3xl space-y-lg p-lg">
|
|
74
|
+
<section className="space-y-sm">
|
|
75
|
+
<p className="text-overline text-muted-soft">Read-only viewer</p>
|
|
76
|
+
<CodeEditor
|
|
77
|
+
files={files}
|
|
78
|
+
activeFile={active}
|
|
79
|
+
onActiveFileChange={setActive}
|
|
80
|
+
folderLabel="atoms"
|
|
81
|
+
pathPrefix="atoms / CardShell"
|
|
82
|
+
onCopy={() => setCopies((count) => count + 1)}
|
|
83
|
+
className="h-96 max-h-96 min-h-0"
|
|
84
|
+
/>
|
|
85
|
+
<p className="text-caption text-muted" aria-live="polite">
|
|
86
|
+
{copies === 0
|
|
87
|
+
? "Pick a file, then copy it — the button flips to Copied."
|
|
88
|
+
: `Copied ${copies} ${copies === 1 ? "time" : "times"} to the clipboard.`}
|
|
89
|
+
</p>
|
|
90
|
+
</section>
|
|
91
|
+
|
|
92
|
+
<section className="space-y-sm">
|
|
93
|
+
<p className="text-overline text-muted-soft">Writing (streaming) state</p>
|
|
94
|
+
<CodeEditor
|
|
95
|
+
files={files}
|
|
96
|
+
activeFile="tokens.css"
|
|
97
|
+
onActiveFileChange={() => {}}
|
|
98
|
+
folderLabel="tokens"
|
|
99
|
+
pathPrefix="tokens / generated"
|
|
100
|
+
streamingFileNames={["tokens.css"]}
|
|
101
|
+
className="h-80 max-h-80 min-h-0"
|
|
102
|
+
/>
|
|
103
|
+
</section>
|
|
104
|
+
|
|
105
|
+
<section className="space-y-sm">
|
|
106
|
+
<p className="text-overline text-muted-soft">Editable with line gutter</p>
|
|
107
|
+
<CodeEditor
|
|
108
|
+
files={files}
|
|
109
|
+
activeFile={active}
|
|
110
|
+
onActiveFileChange={setActive}
|
|
111
|
+
folderLabel="atoms"
|
|
112
|
+
pathPrefix="atoms / CardShell"
|
|
113
|
+
readOnly={false}
|
|
114
|
+
onChange={(name, source) =>
|
|
115
|
+
setDraft((prev) => ({ ...prev, [name]: source }))
|
|
116
|
+
}
|
|
117
|
+
className="h-80 max-h-80 min-h-0"
|
|
118
|
+
/>
|
|
119
|
+
</section>
|
|
120
|
+
|
|
121
|
+
<section className="space-y-sm">
|
|
122
|
+
<p className="text-overline text-muted-soft">Scoped dark theme</p>
|
|
123
|
+
<CodeEditor
|
|
124
|
+
files={files}
|
|
125
|
+
activeFile="manifest.json"
|
|
126
|
+
onActiveFileChange={() => {}}
|
|
127
|
+
folderLabel="config"
|
|
128
|
+
pathPrefix="config / manifest"
|
|
129
|
+
dark
|
|
130
|
+
className="h-80 max-h-80 min-h-0"
|
|
131
|
+
/>
|
|
132
|
+
</section>
|
|
133
|
+
</div>
|
|
134
|
+
);
|
|
135
|
+
}
|
|
@@ -97,6 +97,7 @@ export const ICON_REGISTRY = {
|
|
|
97
97
|
"chart-bar": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M3 3v16a2 2 0 0 0 2 2h16" }, { tag: "path", d: "M7 16h8" }, { tag: "path", d: "M7 11h12" }, { tag: "path", d: "M7 6h3" }] },
|
|
98
98
|
"layout-grid": { viewBox: "0 0 24 24", nodes: [{ tag: "rect", width: "7", height: "7", x: "3", y: "3", rx: "1" }, { tag: "rect", width: "7", height: "7", x: "14", y: "3", rx: "1" }, { tag: "rect", width: "7", height: "7", x: "14", y: "14", rx: "1" }, { tag: "rect", width: "7", height: "7", x: "3", y: "14", rx: "1" }] },
|
|
99
99
|
"smartphone": { viewBox: "0 0 24 24", nodes: [{ tag: "rect", width: "14", height: "20", x: "5", y: "2", rx: "2", ry: "2" }, { tag: "path", d: "M12 18h.01" }] },
|
|
100
|
+
"folder": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z" }] },
|
|
100
101
|
} as const;
|
|
101
102
|
|
|
102
103
|
export type IconName = keyof typeof ICON_REGISTRY;
|
package/src/index.ts
CHANGED
|
@@ -20,6 +20,7 @@ export * from "./atoms/Carousel";
|
|
|
20
20
|
export * from "./atoms/ChatWindow";
|
|
21
21
|
export * from "./atoms/Checkbox";
|
|
22
22
|
export * from "./atoms/Chip";
|
|
23
|
+
export * from "./atoms/CodeEditor";
|
|
23
24
|
export * from "./atoms/Combobox";
|
|
24
25
|
export * from "./atoms/CommentThread";
|
|
25
26
|
export * from "./atoms/DataTable";
|