@designa8/vibedesign-v6 1.12.16 → 1.14.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
@@ -35,6 +35,7 @@
35
35
  --container-5xl: 64rem;
36
36
  --font-weight-medium: 500;
37
37
  --tracking-wide: 0.025em;
38
+ --tracking-widest: 0.1em;
38
39
  --leading-relaxed: 1.625;
39
40
  --radius-xs: 4px;
40
41
  --radius-sm: 8px;
@@ -44,6 +45,7 @@
44
45
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
45
46
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
46
47
  --animate-spin: spin 1s linear infinite;
48
+ --animate-ping: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
47
49
  --default-transition-duration: 150ms;
48
50
  --default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
49
51
  --default-font-family: var(--font-body);
@@ -91,6 +93,7 @@
91
93
  --color-kind-template-bg: #FEF3C7;
92
94
  --color-kind-template-text: #B45309;
93
95
  --color-kind-template-border: #FBD98A;
96
+ --color-semantic-info-soft: #EAE8FB;
94
97
  --font-body: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
95
98
  --text-display-lg: 48px;
96
99
  --text-display-lg--font-weight: 700;
@@ -319,6 +322,9 @@
319
322
  .relative {
320
323
  position: relative;
321
324
  }
325
+ .static {
326
+ position: static;
327
+ }
322
328
  .inset-0 {
323
329
  inset: 0;
324
330
  }
@@ -379,6 +385,9 @@
379
385
  max-width: 96rem;
380
386
  }
381
387
  }
388
+ .m-0 {
389
+ margin: 0;
390
+ }
382
391
  .mx-auto {
383
392
  margin-inline: auto;
384
393
  }
@@ -493,9 +502,15 @@
493
502
  .\!h-5 {
494
503
  height: calc(var(--spacing) * 5) !important;
495
504
  }
505
+ .\!h-6 {
506
+ height: calc(var(--spacing) * 6) !important;
507
+ }
496
508
  .\!h-8 {
497
509
  height: calc(var(--spacing) * 8) !important;
498
510
  }
511
+ .\!h-auto {
512
+ height: auto !important;
513
+ }
499
514
  .\!h-full {
500
515
  height: 100% !important;
501
516
  }
@@ -541,6 +556,9 @@
541
556
  .h-full {
542
557
  height: 100%;
543
558
  }
559
+ .h-lg {
560
+ height: var(--spacing-lg);
561
+ }
544
562
  .h-md {
545
563
  height: var(--spacing-md);
546
564
  }
@@ -559,12 +577,18 @@
559
577
  .min-h-8 {
560
578
  min-height: calc(var(--spacing) * 8);
561
579
  }
580
+ .min-h-full {
581
+ min-height: 100%;
582
+ }
562
583
  .\!w-4 {
563
584
  width: calc(var(--spacing) * 4) !important;
564
585
  }
565
586
  .\!w-5 {
566
587
  width: calc(var(--spacing) * 5) !important;
567
588
  }
589
+ .\!w-6 {
590
+ width: calc(var(--spacing) * 6) !important;
591
+ }
568
592
  .\!w-8 {
569
593
  width: calc(var(--spacing) * 8) !important;
570
594
  }
@@ -616,6 +640,9 @@
616
640
  .w-16 {
617
641
  width: calc(var(--spacing) * 16);
618
642
  }
643
+ .w-56 {
644
+ width: calc(var(--spacing) * 56);
645
+ }
619
646
  .w-64 {
620
647
  width: calc(var(--spacing) * 64);
621
648
  }
@@ -705,6 +732,9 @@
705
732
  --tw-scale-y: 100%;
706
733
  scale: var(--tw-scale-x) var(--tw-scale-y);
707
734
  }
735
+ .-rotate-90 {
736
+ rotate: calc(90deg * -1);
737
+ }
708
738
  .rotate-0 {
709
739
  rotate: 0deg;
710
740
  }
@@ -717,6 +747,9 @@
717
747
  .transform {
718
748
  transform: var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,);
719
749
  }
750
+ .animate-ping {
751
+ animation: var(--animate-ping);
752
+ }
720
753
  .animate-spin {
721
754
  animation: var(--animate-spin);
722
755
  }
@@ -747,6 +780,9 @@
747
780
  .grid-cols-2 {
748
781
  grid-template-columns: repeat(2, minmax(0, 1fr));
749
782
  }
783
+ .grid-cols-4 {
784
+ grid-template-columns: repeat(4, minmax(0, 1fr));
785
+ }
750
786
  .flex-col {
751
787
  flex-direction: column;
752
788
  }
@@ -756,6 +792,9 @@
756
792
  .\!items-center {
757
793
  align-items: center !important;
758
794
  }
795
+ .items-baseline {
796
+ align-items: baseline;
797
+ }
759
798
  .items-center {
760
799
  align-items: center;
761
800
  }
@@ -878,6 +917,12 @@
878
917
  margin-block-end: calc(var(--spacing-xxs) * calc(1 - var(--tw-space-y-reverse)));
879
918
  }
880
919
  }
920
+ .gap-x-sm {
921
+ column-gap: var(--spacing-sm);
922
+ }
923
+ .gap-y-xxs {
924
+ row-gap: var(--spacing-xxs);
925
+ }
881
926
  .truncate {
882
927
  overflow: hidden;
883
928
  text-overflow: ellipsis;
@@ -1003,6 +1048,9 @@
1003
1048
  .border-semantic-success {
1004
1049
  border-color: var(--color-semantic-success);
1005
1050
  }
1051
+ .border-semantic-warning {
1052
+ border-color: var(--color-semantic-warning);
1053
+ }
1006
1054
  .border-transparent {
1007
1055
  border-color: transparent;
1008
1056
  }
@@ -1057,6 +1105,24 @@
1057
1105
  .bg-semantic-error {
1058
1106
  background-color: var(--color-semantic-error);
1059
1107
  }
1108
+ .bg-semantic-error-soft {
1109
+ background-color: var(--color-semantic-error-soft);
1110
+ }
1111
+ .bg-semantic-info-soft {
1112
+ background-color: var(--color-semantic-info-soft);
1113
+ }
1114
+ .bg-semantic-success {
1115
+ background-color: var(--color-semantic-success);
1116
+ }
1117
+ .bg-semantic-success-soft {
1118
+ background-color: var(--color-semantic-success-soft);
1119
+ }
1120
+ .bg-semantic-warning {
1121
+ background-color: var(--color-semantic-warning);
1122
+ }
1123
+ .bg-semantic-warning-soft {
1124
+ background-color: var(--color-semantic-warning-soft);
1125
+ }
1060
1126
  .bg-surface {
1061
1127
  background-color: var(--color-surface);
1062
1128
  }
@@ -1135,6 +1201,9 @@
1135
1201
  .px-xs {
1136
1202
  padding-inline: var(--spacing-xs);
1137
1203
  }
1204
+ .px-xxs {
1205
+ padding-inline: var(--spacing-xxs);
1206
+ }
1138
1207
  .\!py-0 {
1139
1208
  padding-block: 0 !important;
1140
1209
  }
@@ -1189,6 +1258,12 @@
1189
1258
  .pr-9 {
1190
1259
  padding-right: calc(var(--spacing) * 9);
1191
1260
  }
1261
+ .pr-sm {
1262
+ padding-right: var(--spacing-sm);
1263
+ }
1264
+ .pr-xl {
1265
+ padding-right: var(--spacing-xl);
1266
+ }
1192
1267
  .pb-lg {
1193
1268
  padding-bottom: var(--spacing-lg);
1194
1269
  }
@@ -1201,6 +1276,9 @@
1201
1276
  .pl-9 {
1202
1277
  padding-left: calc(var(--spacing) * 9);
1203
1278
  }
1279
+ .pl-lg {
1280
+ padding-left: var(--spacing-lg);
1281
+ }
1204
1282
  .pl-sm {
1205
1283
  padding-left: var(--spacing-sm);
1206
1284
  }
@@ -1295,9 +1373,16 @@
1295
1373
  --tw-tracking: var(--tracking-wide);
1296
1374
  letter-spacing: var(--tracking-wide);
1297
1375
  }
1376
+ .tracking-widest {
1377
+ --tw-tracking: var(--tracking-widest);
1378
+ letter-spacing: var(--tracking-widest);
1379
+ }
1298
1380
  .whitespace-nowrap {
1299
1381
  white-space: nowrap;
1300
1382
  }
1383
+ .whitespace-pre {
1384
+ white-space: pre;
1385
+ }
1301
1386
  .\!text-body {
1302
1387
  color: var(--color-body) !important;
1303
1388
  }
@@ -1404,6 +1489,10 @@
1404
1489
  --tw-shadow: 0 1px 2px 0 var(--tw-shadow-color, rgba(0,0,0,0.05));
1405
1490
  box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
1406
1491
  }
1492
+ .ring {
1493
+ --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
1494
+ box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
1495
+ }
1407
1496
  .ring-0 {
1408
1497
  --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
1409
1498
  box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
@@ -1541,6 +1630,13 @@
1541
1630
  }
1542
1631
  }
1543
1632
  }
1633
+ .hover\:bg-transparent {
1634
+ &:hover {
1635
+ @media (hover: hover) {
1636
+ background-color: transparent;
1637
+ }
1638
+ }
1639
+ }
1544
1640
  .hover\:\!text-ink {
1545
1641
  &:hover {
1546
1642
  @media (hover: hover) {
@@ -1569,6 +1665,13 @@
1569
1665
  }
1570
1666
  }
1571
1667
  }
1668
+ .hover\:no-underline {
1669
+ &:hover {
1670
+ @media (hover: hover) {
1671
+ text-decoration-line: none;
1672
+ }
1673
+ }
1674
+ }
1572
1675
  .hover\:underline {
1573
1676
  &:hover {
1574
1677
  @media (hover: hover) {
@@ -1669,6 +1772,11 @@
1669
1772
  background-color: var(--color-surface-strong);
1670
1773
  }
1671
1774
  }
1775
+ .active\:bg-transparent {
1776
+ &:active {
1777
+ background-color: transparent;
1778
+ }
1779
+ }
1672
1780
  .active\:brightness-75 {
1673
1781
  &:active {
1674
1782
  --tw-brightness: brightness(75%);
@@ -1785,6 +1893,10 @@
1785
1893
  --color-hairline-soft: #242432;
1786
1894
  --color-hairline-strong: #3C3C50;
1787
1895
  --color-primary-disabled: #3D3870;
1896
+ --color-semantic-success-soft: #123321;
1897
+ --color-semantic-warning-soft: #3A2A0A;
1898
+ --color-semantic-error-soft: #3A1414;
1899
+ --color-semantic-info-soft: #28234F;
1788
1900
  }
1789
1901
  @property --tw-translate-x {
1790
1902
  syntax: "*";
@@ -1989,6 +2101,12 @@
1989
2101
  transform: rotate(360deg);
1990
2102
  }
1991
2103
  }
2104
+ @keyframes ping {
2105
+ 75%, 100% {
2106
+ transform: scale(2);
2107
+ opacity: 0;
2108
+ }
2109
+ }
1992
2110
  @layer properties {
1993
2111
  @supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
1994
2112
  *, ::before, ::after, ::backdrop {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@designa8/vibedesign-v6",
3
- "version": "1.12.16",
3
+ "version": "1.14.0",
4
4
  "description": "Design system \"Plasma Design System\" generated by atom-server.",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -69,6 +69,11 @@
69
69
  "kind": "Atom",
70
70
  "description": null
71
71
  },
72
+ {
73
+ "name": "CodeEditor",
74
+ "kind": "Organism",
75
+ "description": null
76
+ },
72
77
  {
73
78
  "name": "ComponentCard",
74
79
  "kind": "Atom",
@@ -89,6 +94,11 @@
89
94
  "kind": "Template",
90
95
  "description": null
91
96
  },
97
+ {
98
+ "name": "Icon",
99
+ "kind": "Atom",
100
+ "description": null
101
+ },
92
102
  {
93
103
  "name": "Input",
94
104
  "kind": "Atom",
@@ -119,6 +129,11 @@
119
129
  "kind": "Organism",
120
130
  "description": null
121
131
  },
132
+ {
133
+ "name": "StatusBar",
134
+ "kind": "Molecule",
135
+ "description": null
136
+ },
122
137
  {
123
138
  "name": "TopNavbar",
124
139
  "kind": "Organism",
@@ -19,6 +19,8 @@ const COLLAPSED_RAIL_WIDTH = 12;
19
19
  const PANEL_GAP_RIGHT = CURVE_R;
20
20
  /** Tailwind md breakpoint — 768px */
21
21
  const MOBILE_BREAKPOINT = 768;
22
+ /** Fixed fallback height when rendered outside a real viewport (e.g. in a small iframe preview). */
23
+ const FALLBACK_HEIGHT = 640;
22
24
 
23
25
  // ─── Types ────────────────────────────────────────────────────────────────────
24
26
 
@@ -41,6 +43,14 @@ export interface AppLayoutProps {
41
43
  defaultMobilePanel?: MobilePanel;
42
44
  /** When true, hides the entire left-hand identity/navigation cluster in the top bar — the avatar nav (avatar initials, chevron, and its dropdown menu) and the project/workspace name control (desktop WorkspaceMenu and mobile project name) — while keeping the rest of the top bar (tabs, actions) visible. Useful for a distraction-free fullscreen preview overlay. Defaults to false. */
43
45
  hideProjectName?: boolean;
46
+ /**
47
+ * Fills the real viewport (100vh) when true. Defaults to true so the
48
+ * layout behaves like a full app page in production. Set to false (the
49
+ * design-system preview does this) to size to a fixed content height
50
+ * instead — required inside iframed contexts where 100vh would resolve
51
+ * against the iframe rather than the browser window.
52
+ */
53
+ fillViewport?: boolean;
44
54
  className?: string;
45
55
  }
46
56
 
@@ -179,7 +189,7 @@ const AvatarNav: React.FC<AvatarNavProps> = ({ initials, onBackToProjects, onHom
179
189
  <div
180
190
  role="menu"
181
191
  aria-label="Navigation"
182
- className="absolute left-0 mt-xs rounded-xl bg-canvas border border-hairline-soft shadow-card py-xs"
192
+ className="absolute left-0 mt-xs rounded-xl bg-canvas border border-hairline-soft shadow-card py-xs overflow-hidden"
183
193
  style={{ minWidth: 200, zIndex: 1000, top: "100%" }}
184
194
  >
185
195
  <Button
@@ -403,11 +413,13 @@ export const AppLayout = React.forwardRef<HTMLDivElement, AppLayoutProps>(
403
413
  avatarInitials = "A",
404
414
  defaultMobilePanel = "chat",
405
415
  hideProjectName = false,
416
+ fillViewport = true,
406
417
  className,
407
418
  },
408
419
  ref,
409
420
  ) => {
410
421
  const isMobile = useIsMobile();
422
+ const rootHeight = fillViewport ? "100vh" : `${FALLBACK_HEIGHT}px`;
411
423
 
412
424
  // Desktop state
413
425
  const [activeTab, setActiveTab] = React.useState(rightPanelActiveTab);
@@ -491,7 +503,7 @@ export const AppLayout = React.forwardRef<HTMLDivElement, AppLayoutProps>(
491
503
  <div
492
504
  ref={ref}
493
505
  className={["w-full flex flex-col overflow-hidden bg-canvas", className].filter(Boolean).join(" ")}
494
- style={{ height: "100vh" }}
506
+ style={{ height: rootHeight }}
495
507
  >
496
508
  <MobileTopBar
497
509
  projectName={projectName}
@@ -553,7 +565,7 @@ export const AppLayout = React.forwardRef<HTMLDivElement, AppLayoutProps>(
553
565
  <div
554
566
  ref={ref}
555
567
  className={["w-full flex flex-col overflow-hidden", className].filter(Boolean).join(" ")}
556
- style={{ height: "100vh", background: "var(--color-surface-soft)" }}
568
+ style={{ height: rootHeight, background: "var(--color-surface-soft)" }}
557
569
  >
558
570
  {/* TOP BAR */}
559
571
  <div
@@ -39,12 +39,13 @@ const sampleMessages: ChatMessage[] = [
39
39
 
40
40
  export default function AppLayoutPreview() {
41
41
  return (
42
- <div className="w-full" style={{ height: "100vh" }}>
42
+ <div className="w-full">
43
43
  {/*
44
- Variant A: consumer passes explicit tabs — nav renders as expected.
45
- Variant B (below, commented out): no tabs passed — nav is hidden.
44
+ fillViewport=false renders the layout at a fixed content height instead
45
+ of 100vh — required inside this iframed preview.
46
46
  */}
47
47
  <AppLayout
48
+ fillViewport={false}
48
49
  navbarProps={{
49
50
  avatarInitials: "OF",
50
51
  version: "Latest",
@@ -0,0 +1,186 @@
1
+ import React from "react";
2
+ import { Icon } from "../Icon";
3
+ import { Button } from "../Button";
4
+
5
+ export type CodeEditorLanguage = "tsx" | "ts" | "css" | "json" | "md" | "txt";
6
+
7
+ export interface CodeEditorFile {
8
+ name: string;
9
+ language: CodeEditorLanguage;
10
+ source: string;
11
+ }
12
+
13
+ export interface CodeEditorProps {
14
+ files: CodeEditorFile[];
15
+ activeFile?: string;
16
+ onActiveFileChange?: (name: string) => void;
17
+ folderLabel?: string;
18
+ pathPrefix?: string;
19
+ dark?: boolean;
20
+ readOnly?: boolean;
21
+ streamingFileNames?: string[];
22
+ onChange?: (filename: string, source: string) => void;
23
+ onCopy?: () => void;
24
+ className?: string;
25
+ }
26
+
27
+ const LANG_LABEL: Record<CodeEditorLanguage, string> = {
28
+ tsx: "TSX",
29
+ ts: "TS",
30
+ css: "CSS",
31
+ json: "JSON",
32
+ md: "MD",
33
+ txt: "TXT",
34
+ };
35
+
36
+ function LangBadge({ language }: { language: CodeEditorLanguage }) {
37
+ return (
38
+ <span className="inline-flex h-lg min-w-[1.6rem] items-center justify-center rounded-xs bg-surface-strong px-xxs text-caption text-muted">
39
+ {LANG_LABEL[language]}
40
+ </span>
41
+ );
42
+ }
43
+
44
+ export const CodeEditor = React.forwardRef<HTMLDivElement, CodeEditorProps>(
45
+ (
46
+ {
47
+ files,
48
+ activeFile,
49
+ onActiveFileChange,
50
+ folderLabel = "atoms",
51
+ pathPrefix,
52
+ dark = false,
53
+ readOnly = true,
54
+ streamingFileNames = [],
55
+ onChange,
56
+ onCopy,
57
+ className = "",
58
+ },
59
+ ref,
60
+ ) => {
61
+ const [copied, setCopied] = React.useState(false);
62
+ const [openRoot, setOpenRoot] = React.useState(true);
63
+ const current = files.find((f) => f.name === activeFile) ?? files[0] ?? null;
64
+ const streaming = current ? streamingFileNames.includes(current.name) : false;
65
+ const path = [pathPrefix, current?.name].filter(Boolean).join(" / ");
66
+
67
+ async function copy() {
68
+ if (!current) return;
69
+ try {
70
+ await navigator.clipboard.writeText(current.source);
71
+ } catch {
72
+ // clipboard may be unavailable in sandboxed contexts; ignore
73
+ }
74
+ setCopied(true);
75
+ window.setTimeout(() => setCopied(false), 1200);
76
+ onCopy?.();
77
+ }
78
+
79
+ const lines = (current?.source ?? "").split("\n");
80
+ const statusLabel = streaming ? "Writing" : readOnly ? "Read-only" : "Editing";
81
+
82
+ return (
83
+ <div
84
+ ref={ref}
85
+ data-theme={dark ? "dark" : undefined}
86
+ className={["flex w-full overflow-hidden rounded-lg border border-hairline bg-canvas text-ink", className].join(" ")}
87
+ >
88
+ <aside className="flex w-56 shrink-0 flex-col overflow-y-auto border-r border-hairline bg-canvas">
89
+ <div className="flex items-center justify-between px-lg py-md">
90
+ <span className="text-caption font-weight-heading-sm uppercase tracking-widest text-muted-soft">
91
+ Files
92
+ </span>
93
+ </div>
94
+ <nav className="flex flex-col gap-xxs px-sm pb-lg">
95
+ <Button
96
+ type="button"
97
+ variant="ghost"
98
+ size="sm"
99
+ className="w-full justify-start gap-xs px-sm py-xs text-body-sm text-muted"
100
+ onClick={() => setOpenRoot((o) => !o)}
101
+ >
102
+ <Icon
103
+ name="chevron-down"
104
+ className={["h-3 w-3 shrink-0 transition-transform", openRoot ? "rotate-0" : "-rotate-90"].join(" ")}
105
+ />
106
+ {folderLabel}
107
+ </Button>
108
+ {openRoot &&
109
+ files.map((f) => (
110
+ <Button
111
+ key={f.name}
112
+ type="button"
113
+ variant="ghost"
114
+ size="sm"
115
+ onClick={() => onActiveFileChange?.(f.name)}
116
+ aria-current={f.name === current?.name ? "true" : undefined}
117
+ className={[
118
+ "w-full justify-start gap-sm py-xs pr-sm pl-lg text-body-sm",
119
+ f.name === current?.name ? "bg-primary-disabled text-primary" : "text-body",
120
+ ].join(" ")}
121
+ >
122
+ <LangBadge language={f.language} />
123
+ <span className="truncate">{f.name}</span>
124
+ </Button>
125
+ ))}
126
+ </nav>
127
+ </aside>
128
+
129
+ <div className="flex min-w-0 flex-1 flex-col overflow-hidden bg-canvas">
130
+ <div className="flex items-center justify-between border-b border-hairline bg-surface-soft px-lg py-sm">
131
+ <div className="flex min-w-0 items-center gap-sm font-mono text-caption text-muted">
132
+ {current ? <LangBadge language={current.language} /> : null}
133
+ <span className="truncate">{path}</span>
134
+ <span className="rounded-xs bg-surface-strong px-sm py-xxs text-caption font-weight-heading-sm uppercase tracking-wide text-muted">
135
+ {statusLabel}
136
+ </span>
137
+ </div>
138
+ <Button
139
+ type="button"
140
+ variant="secondary"
141
+ size="sm"
142
+ onClick={() => void copy()}
143
+ disabled={!current || streaming}
144
+ >
145
+ <Icon name={copied ? "check-checkmark" : "copy-clipboard"} className="h-3 w-3" />
146
+ {copied ? "Copied" : "Copy"}
147
+ </Button>
148
+ </div>
149
+
150
+ <div className="flex-1 overflow-auto bg-canvas">
151
+ {readOnly || streaming ? (
152
+ <pre className="m-0 p-0 text-body-sm leading-[1.55] text-ink">
153
+ {lines.map((line, i) => (
154
+ <div key={i} className="flex">
155
+ <span className="select-none px-md text-right text-caption text-muted-soft">
156
+ <span className="inline-block min-w-[2ch]">{i + 1}</span>
157
+ </span>
158
+ <span className="flex-1 whitespace-pre pr-xl font-mono">{line || " "}</span>
159
+ </div>
160
+ ))}
161
+ </pre>
162
+ ) : (
163
+ <div className="flex min-h-full">
164
+ <div className="select-none px-md py-sm text-right text-caption text-muted-soft">
165
+ {lines.map((_, i) => (
166
+ <div key={i}>{i + 1}</div>
167
+ ))}
168
+ </div>
169
+ <textarea
170
+ className="min-h-full flex-1 resize-none bg-transparent p-sm font-mono text-body-sm leading-[1.55] text-ink outline-none"
171
+ value={current?.source ?? ""}
172
+ spellCheck={false}
173
+ onChange={(e) => {
174
+ if (current) onChange?.(current.name, e.target.value);
175
+ }}
176
+ />
177
+ </div>
178
+ )}
179
+ </div>
180
+ </div>
181
+ </div>
182
+ );
183
+ },
184
+ );
185
+
186
+ CodeEditor.displayName = "CodeEditor";
@@ -0,0 +1,2 @@
1
+ export { CodeEditor } from "./CodeEditor";
2
+ export type { CodeEditorProps, CodeEditorFile, CodeEditorLanguage } from "./CodeEditor";