@designa8/vibedesign-linear-internal-v1-b737 0.3.0 → 0.5.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/styles.css CHANGED
@@ -304,6 +304,9 @@
304
304
  .relative {
305
305
  position: relative;
306
306
  }
307
+ .static {
308
+ position: static;
309
+ }
307
310
  .sticky {
308
311
  position: sticky;
309
312
  }
@@ -683,6 +686,12 @@
683
686
  .h-64 {
684
687
  height: calc(var(--spacing) * 64);
685
688
  }
689
+ .h-80 {
690
+ height: calc(var(--spacing) * 80);
691
+ }
692
+ .h-96 {
693
+ height: calc(var(--spacing) * 96);
694
+ }
686
695
  .h-base {
687
696
  height: var(--spacing-base);
688
697
  }
@@ -698,9 +707,15 @@
698
707
  .h-xs {
699
708
  height: var(--spacing-xs);
700
709
  }
710
+ .max-h-64 {
711
+ max-height: calc(var(--spacing) * 64);
712
+ }
701
713
  .max-h-72 {
702
714
  max-height: calc(var(--spacing) * 72);
703
715
  }
716
+ .max-h-80 {
717
+ max-height: calc(var(--spacing) * 80);
718
+ }
704
719
  .max-h-96 {
705
720
  max-height: calc(var(--spacing) * 96);
706
721
  }
@@ -743,6 +758,9 @@
743
758
  .min-h-64 {
744
759
  min-height: calc(var(--spacing) * 64);
745
760
  }
761
+ .min-h-full {
762
+ min-height: 100%;
763
+ }
746
764
  .w-1 {
747
765
  width: var(--spacing);
748
766
  }
@@ -815,6 +833,9 @@
815
833
  .w-48 {
816
834
  width: calc(var(--spacing) * 48);
817
835
  }
836
+ .w-56 {
837
+ width: calc(var(--spacing) * 56);
838
+ }
818
839
  .w-64 {
819
840
  width: calc(var(--spacing) * 64);
820
841
  }
@@ -984,6 +1005,9 @@
984
1005
  .-rotate-90 {
985
1006
  rotate: calc(90deg * -1);
986
1007
  }
1008
+ .rotate-0 {
1009
+ rotate: 0deg;
1010
+ }
987
1011
  .rotate-45 {
988
1012
  rotate: 45deg;
989
1013
  }
@@ -1377,6 +1401,12 @@
1377
1401
  .bg-canvas {
1378
1402
  background-color: var(--color-canvas);
1379
1403
  }
1404
+ .bg-canvas\/90 {
1405
+ background-color: color-mix(in srgb, #FFFFFF 90%, transparent);
1406
+ @supports (color: color-mix(in lab, red, red)) {
1407
+ background-color: color-mix(in oklab, var(--color-canvas) 90%, transparent);
1408
+ }
1409
+ }
1380
1410
  .bg-current {
1381
1411
  background-color: currentcolor;
1382
1412
  }
@@ -1659,6 +1689,9 @@
1659
1689
  .align-middle {
1660
1690
  vertical-align: middle;
1661
1691
  }
1692
+ .font-mono {
1693
+ font-family: var(--font-mono);
1694
+ }
1662
1695
  .text-body-lg {
1663
1696
  font-size: var(--text-body-lg);
1664
1697
  line-height: var(--tw-leading, var(--text-body-lg--line-height));
@@ -1729,9 +1762,18 @@
1729
1762
  --tw-tracking: var(--tracking-overline);
1730
1763
  letter-spacing: var(--tracking-overline);
1731
1764
  }
1765
+ .break-words {
1766
+ overflow-wrap: break-word;
1767
+ }
1732
1768
  .whitespace-nowrap {
1733
1769
  white-space: nowrap;
1734
1770
  }
1771
+ .whitespace-pre {
1772
+ white-space: pre;
1773
+ }
1774
+ .whitespace-pre-wrap {
1775
+ white-space: pre-wrap;
1776
+ }
1735
1777
  .text-body {
1736
1778
  color: var(--color-body);
1737
1779
  }
@@ -1774,6 +1816,9 @@
1774
1816
  .uppercase {
1775
1817
  text-transform: uppercase;
1776
1818
  }
1819
+ .italic {
1820
+ font-style: italic;
1821
+ }
1777
1822
  .tabular-nums {
1778
1823
  --tw-numeric-spacing: tabular-nums;
1779
1824
  font-variant-numeric: var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@designa8/vibedesign-linear-internal-v1-b737",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "Complete design system \"My Project linear-internal-v1\" generated by Atoms Design.",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -134,6 +134,16 @@
134
134
  "kind": "Atom",
135
135
  "description": null
136
136
  },
137
+ {
138
+ "name": "CodeEditor",
139
+ "kind": "Organism",
140
+ "description": null
141
+ },
142
+ {
143
+ "name": "CodePreview",
144
+ "kind": "Molecule",
145
+ "description": null
146
+ },
137
147
  {
138
148
  "name": "Combobox",
139
149
  "kind": "Molecule",
@@ -0,0 +1,497 @@
1
+ import * as React from "react";
2
+ import { Badge } from "../Badge";
3
+ import { Button } from "../Button";
4
+ import { Icon } from "../Icon";
5
+ import { Textarea } from "../Textarea";
6
+
7
+ export type CodeEditorLanguage = "tsx" | "ts" | "css" | "json" | "md" | "txt";
8
+
9
+ export interface CodeEditorFile {
10
+ name: string;
11
+ language: CodeEditorLanguage;
12
+ source: string;
13
+ }
14
+
15
+ export interface CodeEditorProps extends React.HTMLAttributes<HTMLDivElement> {
16
+ files: CodeEditorFile[];
17
+ /** Name of the visible file. Falls back to the first file. */
18
+ activeFile?: string;
19
+ onActiveFileChange?: (name: string) => void;
20
+ /** Label of the collapsible folder row in the file tree. */
21
+ folderLabel?: string;
22
+ /** Leading breadcrumb segment, e.g. `atoms / Button`. */
23
+ pathPrefix?: string;
24
+ /** Sets `data-theme="dark"` on the editor root so tokens flip locally. */
25
+ dark?: boolean;
26
+ /** Read-only viewer. Set false to render an editable textarea instead. */
27
+ readOnly?: boolean;
28
+ /** File names currently being written; the status pill shows "Writing". */
29
+ streamingFileNames?: string[];
30
+ onChange?: (filename: string, source: string) => void;
31
+ onCopy?: () => void;
32
+ }
33
+
34
+ const LANG_LABEL: Record<CodeEditorLanguage, string> = {
35
+ tsx: "TSX",
36
+ ts: "TS",
37
+ css: "CSS",
38
+ json: "JSON",
39
+ md: "MD",
40
+ txt: "TXT",
41
+ };
42
+
43
+ const cn = (...parts: Array<string | false | null | undefined>) =>
44
+ parts.filter(Boolean).join(" ");
45
+
46
+ function LangBadge({ language }: { language: CodeEditorLanguage }) {
47
+ return (
48
+ <Badge size="sm" tone={language === "tsx" ? "primary" : "neutral"} className="w-8 justify-center font-mono">
49
+ {LANG_LABEL[language]}
50
+ </Badge>
51
+ );
52
+ }
53
+
54
+ type SyntaxTokenType =
55
+ | "plain"
56
+ | "comment"
57
+ | "string"
58
+ | "number"
59
+ | "keyword"
60
+ | "function"
61
+ | "type"
62
+ | "tag"
63
+ | "property"
64
+ | "punctuation";
65
+
66
+ const SYNTAX_CLASS: Record<SyntaxTokenType, string> = {
67
+ plain: "text-ink",
68
+ comment: "text-muted-soft italic",
69
+ string: "text-semantic-success",
70
+ number: "text-semantic-warning",
71
+ keyword: "text-primary",
72
+ function: "text-semantic-info",
73
+ type: "text-semantic-info",
74
+ tag: "text-semantic-error",
75
+ property: "text-primary",
76
+ punctuation: "text-muted",
77
+ };
78
+
79
+ type SyntaxToken = { text: string; type: SyntaxTokenType };
80
+
81
+ const JS_KEYWORDS = new Set([
82
+ "import",
83
+ "export",
84
+ "default",
85
+ "from",
86
+ "const",
87
+ "let",
88
+ "var",
89
+ "function",
90
+ "return",
91
+ "interface",
92
+ "type",
93
+ "extends",
94
+ "implements",
95
+ "class",
96
+ "new",
97
+ "this",
98
+ "if",
99
+ "else",
100
+ "for",
101
+ "while",
102
+ "switch",
103
+ "case",
104
+ "break",
105
+ "continue",
106
+ "true",
107
+ "false",
108
+ "null",
109
+ "undefined",
110
+ "void",
111
+ "async",
112
+ "await",
113
+ "of",
114
+ "in",
115
+ "as",
116
+ "public",
117
+ "private",
118
+ "protected",
119
+ "readonly",
120
+ "static",
121
+ "enum",
122
+ "namespace",
123
+ "declare",
124
+ "try",
125
+ "catch",
126
+ "finally",
127
+ "throw",
128
+ "yield",
129
+ "typeof",
130
+ "instanceof",
131
+ "super",
132
+ ]);
133
+
134
+ const TS_TYPES = new Set([
135
+ "string",
136
+ "number",
137
+ "boolean",
138
+ "any",
139
+ "unknown",
140
+ "never",
141
+ "object",
142
+ "React",
143
+ "Record",
144
+ "Partial",
145
+ "Readonly",
146
+ "Promise",
147
+ "HTMLDivElement",
148
+ "HTMLButtonElement",
149
+ "HTMLTextAreaElement",
150
+ ]);
151
+
152
+ const JS_TOKEN_RE =
153
+ /(\/\/.*)|('(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|`(?:\\.|[^`\\])*`)|(\b\d+(?:\.\d+)?\b)|(<\/?[A-Za-z][\w.]*)|([A-Za-z_$][\w$]*)/g;
154
+
155
+ function tokenizeJs(line: string): SyntaxToken[] {
156
+ const tokens: SyntaxToken[] = [];
157
+ let lastIndex = 0;
158
+ let match: RegExpExecArray | null;
159
+ JS_TOKEN_RE.lastIndex = 0;
160
+ while ((match = JS_TOKEN_RE.exec(line)) !== null) {
161
+ if (match.index > lastIndex) {
162
+ tokens.push({ text: line.slice(lastIndex, match.index), type: "plain" });
163
+ }
164
+ if (match[1] !== undefined) tokens.push({ text: match[1], type: "comment" });
165
+ else if (match[2] !== undefined) tokens.push({ text: match[2], type: "string" });
166
+ else if (match[3] !== undefined) tokens.push({ text: match[3], type: "number" });
167
+ else if (match[4] !== undefined) tokens.push({ text: match[4], type: "tag" });
168
+ else if (match[5] !== undefined) {
169
+ const word = match[5];
170
+ const isCall = /^\s*\(/.test(line.slice(JS_TOKEN_RE.lastIndex));
171
+ if (JS_KEYWORDS.has(word)) tokens.push({ text: word, type: "keyword" });
172
+ else if (TS_TYPES.has(word)) tokens.push({ text: word, type: "type" });
173
+ else if (isCall) tokens.push({ text: word, type: "function" });
174
+ else tokens.push({ text: word, type: "plain" });
175
+ }
176
+ lastIndex = JS_TOKEN_RE.lastIndex;
177
+ }
178
+ if (lastIndex < line.length) tokens.push({ text: line.slice(lastIndex), type: "plain" });
179
+ return tokens;
180
+ }
181
+
182
+ const CSS_TOKEN_RE =
183
+ /(\/\*[\s\S]*?\*\/)|('(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*")|(@[a-zA-Z-]+)|(#[0-9a-fA-F]{3,8}\b)|(-?\d+\.?\d*(?:px|em|rem|%|deg|s|ms|vh|vw)?\b)|([a-zA-Z-]+)(?=\s*:)/g;
184
+
185
+ function tokenizeCss(line: string): SyntaxToken[] {
186
+ const tokens: SyntaxToken[] = [];
187
+ let lastIndex = 0;
188
+ let match: RegExpExecArray | null;
189
+ CSS_TOKEN_RE.lastIndex = 0;
190
+ while ((match = CSS_TOKEN_RE.exec(line)) !== null) {
191
+ if (match.index > lastIndex) {
192
+ tokens.push({ text: line.slice(lastIndex, match.index), type: "plain" });
193
+ }
194
+ if (match[1] !== undefined) tokens.push({ text: match[1], type: "comment" });
195
+ else if (match[2] !== undefined) tokens.push({ text: match[2], type: "string" });
196
+ else if (match[3] !== undefined) tokens.push({ text: match[3], type: "keyword" });
197
+ else if (match[4] !== undefined) tokens.push({ text: match[4], type: "number" });
198
+ else if (match[5] !== undefined) tokens.push({ text: match[5], type: "number" });
199
+ else if (match[6] !== undefined) tokens.push({ text: match[6], type: "property" });
200
+ lastIndex = CSS_TOKEN_RE.lastIndex;
201
+ }
202
+ if (lastIndex < line.length) tokens.push({ text: line.slice(lastIndex), type: "plain" });
203
+ return tokens;
204
+ }
205
+
206
+ const JSON_TOKEN_RE = /("(?:\\.|[^"\\])*")(\s*:)?|(-?\d+(?:\.\d+)?)|\b(true|false|null)\b/g;
207
+
208
+ function tokenizeJson(line: string): SyntaxToken[] {
209
+ const tokens: SyntaxToken[] = [];
210
+ let lastIndex = 0;
211
+ let match: RegExpExecArray | null;
212
+ JSON_TOKEN_RE.lastIndex = 0;
213
+ while ((match = JSON_TOKEN_RE.exec(line)) !== null) {
214
+ if (match.index > lastIndex) {
215
+ tokens.push({ text: line.slice(lastIndex, match.index), type: "plain" });
216
+ }
217
+ if (match[1] !== undefined) {
218
+ const hasColon = match[2] !== undefined;
219
+ tokens.push({ text: match[1], type: hasColon ? "property" : "string" });
220
+ if (match[2]) tokens.push({ text: match[2], type: "punctuation" });
221
+ } else if (match[3] !== undefined) tokens.push({ text: match[3], type: "number" });
222
+ else if (match[4] !== undefined) tokens.push({ text: match[4], type: "keyword" });
223
+ lastIndex = JSON_TOKEN_RE.lastIndex;
224
+ }
225
+ if (lastIndex < line.length) tokens.push({ text: line.slice(lastIndex), type: "plain" });
226
+ return tokens;
227
+ }
228
+
229
+ const MD_TOKEN_RE = /(^#{1,6}\s.*)|(`[^`]*`)/g;
230
+
231
+ function tokenizeMd(line: string): SyntaxToken[] {
232
+ const tokens: SyntaxToken[] = [];
233
+ let lastIndex = 0;
234
+ let match: RegExpExecArray | null;
235
+ MD_TOKEN_RE.lastIndex = 0;
236
+ while ((match = MD_TOKEN_RE.exec(line)) !== null) {
237
+ if (match.index > lastIndex) {
238
+ tokens.push({ text: line.slice(lastIndex, match.index), type: "plain" });
239
+ }
240
+ if (match[1] !== undefined) tokens.push({ text: match[1], type: "keyword" });
241
+ else if (match[2] !== undefined) tokens.push({ text: match[2], type: "string" });
242
+ lastIndex = MD_TOKEN_RE.lastIndex;
243
+ }
244
+ if (lastIndex < line.length) tokens.push({ text: line.slice(lastIndex), type: "plain" });
245
+ return tokens;
246
+ }
247
+
248
+ function tokenizeLine(line: string, language: CodeEditorLanguage): SyntaxToken[] {
249
+ if (line.length === 0) return [{ text: " ", type: "plain" }];
250
+ switch (language) {
251
+ case "tsx":
252
+ case "ts":
253
+ return tokenizeJs(line);
254
+ case "css":
255
+ return tokenizeCss(line);
256
+ case "json":
257
+ return tokenizeJson(line);
258
+ case "md":
259
+ return tokenizeMd(line);
260
+ default:
261
+ return [{ text: line, type: "plain" }];
262
+ }
263
+ }
264
+
265
+ export const CodeEditor = React.forwardRef<HTMLDivElement, CodeEditorProps>(
266
+ (
267
+ {
268
+ files,
269
+ activeFile,
270
+ onActiveFileChange,
271
+ folderLabel = "atoms",
272
+ pathPrefix,
273
+ dark = false,
274
+ readOnly = true,
275
+ streamingFileNames,
276
+ onChange,
277
+ onCopy,
278
+ className,
279
+ ...rest
280
+ },
281
+ ref,
282
+ ) => {
283
+ const [copied, setCopied] = React.useState(false);
284
+ const [openRoot, setOpenRoot] = React.useState(true);
285
+ const timer = React.useRef<number | undefined>(undefined);
286
+ const tabRefs = React.useRef<Array<HTMLButtonElement | null>>([]);
287
+ const baseId = React.useId();
288
+
289
+ const current = files.find((f) => f.name === activeFile) ?? files[0] ?? null;
290
+ const streaming = Boolean(current && streamingFileNames?.includes(current.name));
291
+ const activeIndex = Math.max(
292
+ 0,
293
+ files.findIndex((f) => f.name === current?.name),
294
+ );
295
+ const editable = !readOnly && !streaming;
296
+
297
+ const path = [pathPrefix ?? folderLabel, current?.name].filter(Boolean).join(" / ");
298
+ const statusLabel = streaming ? "Writing" : readOnly ? "Read-only" : "Editing";
299
+ const lines = (current?.source ?? "").split("\n");
300
+
301
+ React.useEffect(() => {
302
+ setCopied(false);
303
+ }, [current?.name]);
304
+
305
+ React.useEffect(() => () => window.clearTimeout(timer.current), []);
306
+
307
+ async function copy() {
308
+ if (!current) return;
309
+ try {
310
+ await navigator.clipboard.writeText(current.source);
311
+ } catch {
312
+ /* Clipboard can be unavailable in sandboxed previews. */
313
+ }
314
+ setCopied(true);
315
+ window.clearTimeout(timer.current);
316
+ timer.current = window.setTimeout(() => setCopied(false), 1200);
317
+ onCopy?.();
318
+ }
319
+
320
+ function onTabKeyDown(event: React.KeyboardEvent<HTMLDivElement>) {
321
+ if (files.length === 0) return;
322
+ let next = activeIndex;
323
+ if (event.key === "ArrowDown") next = (activeIndex + 1) % files.length;
324
+ else if (event.key === "ArrowUp") next = (activeIndex - 1 + files.length) % files.length;
325
+ else if (event.key === "Home") next = 0;
326
+ else if (event.key === "End") next = files.length - 1;
327
+ else return;
328
+ event.preventDefault();
329
+ onActiveFileChange?.(files[next].name);
330
+ tabRefs.current[next]?.focus();
331
+ }
332
+
333
+ return (
334
+ <div
335
+ ref={ref}
336
+ data-theme={dark ? "dark" : undefined}
337
+ className={cn(
338
+ "flex w-full min-h-0 overflow-hidden rounded-lg border border-hairline bg-canvas text-ink",
339
+ className,
340
+ )}
341
+ {...rest}
342
+ >
343
+ <aside className="flex w-56 min-h-0 shrink-0 flex-col overflow-y-auto overscroll-contain border-r border-hairline bg-canvas">
344
+ <div className="flex items-center px-base py-md">
345
+ <span className="text-overline text-muted-soft">Files</span>
346
+ </div>
347
+ <nav className="flex flex-col gap-xxs px-sm pb-base" aria-label="Files">
348
+ <Button
349
+ type="button"
350
+ variant="item"
351
+ size="sm"
352
+ aria-expanded={openRoot}
353
+ aria-controls={`${baseId}-files`}
354
+ className="text-muted"
355
+ leadingIcon={
356
+ <Icon
357
+ name="chevron-down"
358
+ size={12}
359
+ className={cn(
360
+ "transition-transform duration-200 ease-out",
361
+ openRoot ? "rotate-0" : "-rotate-90",
362
+ )}
363
+ />
364
+ }
365
+ onClick={() => setOpenRoot((open) => !open)}
366
+ >
367
+ {folderLabel}
368
+ </Button>
369
+
370
+ <div
371
+ data-state={openRoot ? "open" : "closed"}
372
+ className="grid transition-[grid-template-rows] duration-200 ease-out data-[state=open]:grid-rows-[1fr] data-[state=closed]:grid-rows-[0fr]"
373
+ >
374
+ <div className="min-h-0 overflow-hidden">
375
+ <div
376
+ id={`${baseId}-files`}
377
+ role="tablist"
378
+ aria-label={folderLabel}
379
+ aria-orientation="vertical"
380
+ onKeyDown={onTabKeyDown}
381
+ className="flex flex-col gap-xxs pt-xxs"
382
+ >
383
+ {files.map((file, index) => {
384
+ const active = file.name === current?.name;
385
+ return (
386
+ <Button
387
+ key={file.name}
388
+ ref={(el) => {
389
+ tabRefs.current[index] = el;
390
+ }}
391
+ role="tab"
392
+ id={`${baseId}-tab-${index}`}
393
+ aria-selected={active}
394
+ aria-controls={`${baseId}-panel`}
395
+ tabIndex={openRoot && active ? 0 : -1}
396
+ type="button"
397
+ variant="item"
398
+ size="sm"
399
+ className="cursor-pointer transition duration-150 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue focus-visible:ring-inset"
400
+ leadingIcon={<LangBadge language={file.language} />}
401
+ onClick={() => onActiveFileChange?.(file.name)}
402
+ >
403
+ {file.name}
404
+ </Button>
405
+ );
406
+ })}
407
+ </div>
408
+ </div>
409
+ </div>
410
+ </nav>
411
+ </aside>
412
+
413
+ <div className="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-canvas">
414
+ <div className="flex items-center justify-between gap-sm border-b border-hairline bg-surface-soft px-base py-sm">
415
+ <div className="flex min-w-0 items-center gap-sm">
416
+ {current ? <LangBadge language={current.language} /> : null}
417
+ <span className="min-w-0 truncate font-mono text-caption text-muted">
418
+ {path || "No file selected"}
419
+ </span>
420
+ <span aria-live="polite">
421
+ <Badge size="sm" tone={streaming ? "primary" : "neutral"} className="uppercase">
422
+ {statusLabel}
423
+ </Badge>
424
+ </span>
425
+ </div>
426
+ <Button
427
+ type="button"
428
+ variant="secondary"
429
+ size="sm"
430
+ leadingIcon={<Icon name={copied ? "check" : "copy"} size={12} />}
431
+ onClick={() => void copy()}
432
+ disabled={!current || streaming}
433
+ >
434
+ {copied ? "Copied" : "Copy"}
435
+ </Button>
436
+ </div>
437
+
438
+ <div
439
+ id={`${baseId}-panel`}
440
+ role="tabpanel"
441
+ aria-labelledby={`${baseId}-tab-${activeIndex}`}
442
+ tabIndex={0}
443
+ className="min-h-0 flex-1 overflow-auto overscroll-contain bg-canvas focus-visible:outline-none focus-visible:ring-inset focus-visible:ring-2 focus-visible:ring-focus-blue"
444
+ >
445
+ {editable ? (
446
+ <div className="flex min-h-full">
447
+ <div
448
+ className="shrink-0 select-none py-sm pl-base pr-md text-right text-body-sm text-muted-soft"
449
+ aria-hidden="true"
450
+ >
451
+ {lines.map((_, index) => (
452
+ <div key={index}>{index + 1}</div>
453
+ ))}
454
+ </div>
455
+ <Textarea
456
+ chrome="none"
457
+ resizable={false}
458
+ rows={Math.min(Math.max(lines.length, 4), 24)}
459
+ aria-label={`${current?.name ?? "file"} source`}
460
+ spellCheck={false}
461
+ value={current?.source ?? ""}
462
+ onChange={(event) => {
463
+ if (current) onChange?.(current.name, event.target.value);
464
+ }}
465
+ className="min-h-full flex-1 font-mono text-body-sm"
466
+ />
467
+ </div>
468
+ ) : (
469
+ <pre className="m-0 min-h-full bg-canvas p-0 text-body-sm">
470
+ {lines.map((line, index) => (
471
+ <div key={index} className="flex">
472
+ <span
473
+ className="w-10 shrink-0 select-none pl-base pr-sm text-right text-body-sm text-muted-soft"
474
+ aria-hidden="true"
475
+ >
476
+ {index + 1}
477
+ </span>
478
+ <span className="flex-1 whitespace-pre pr-base font-mono">
479
+ {current
480
+ ? tokenizeLine(line, current.language).map((token, ti) => (
481
+ <span key={ti} className={SYNTAX_CLASS[token.type]}>
482
+ {token.text}
483
+ </span>
484
+ ))
485
+ : line || " "}
486
+ </span>
487
+ </div>
488
+ ))}
489
+ </pre>
490
+ )}
491
+ </div>
492
+ </div>
493
+ </div>
494
+ );
495
+ },
496
+ );
497
+ CodeEditor.displayName = "CodeEditor";
@@ -0,0 +1,6 @@
1
+ export { CodeEditor } from "./CodeEditor";
2
+ export type {
3
+ CodeEditorProps,
4
+ CodeEditorFile,
5
+ CodeEditorLanguage,
6
+ } from "./CodeEditor";