@illuma-ai/code-sandbox 1.2.1 → 1.3.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.
@@ -303,6 +303,7 @@ interface CodeViewProps {
303
303
  /**
304
304
  * CodeView — FileTree (left) + Editor (top-right) + Terminal (bottom-right).
305
305
  * Uses Allotment for resizable split panes.
306
+ * Terminal can be minimized to just a header bar.
306
307
  * Responsive: file tree shrinks on narrow containers.
307
308
  */
308
309
  function CodeView({
@@ -317,6 +318,8 @@ function CodeView({
317
318
  onCloseFile,
318
319
  onFileChange,
319
320
  }: CodeViewProps) {
321
+ const [terminalMinimized, setTerminalMinimized] = useState(false);
322
+
320
323
  return (
321
324
  <div className="h-full w-full">
322
325
  <Allotment>
@@ -332,24 +335,45 @@ function CodeView({
332
335
 
333
336
  {/* Editor + Terminal — right */}
334
337
  <Allotment.Pane>
335
- <Allotment vertical>
336
- <Allotment.Pane preferredSize="70%">
337
- <CodeEditor
338
- files={files}
339
- originalFiles={originalFiles}
340
- fileChanges={fileChanges}
341
- activeFile={selectedFile}
342
- openFiles={openFiles}
343
- onSelectFile={onSelectFile}
344
- onCloseFile={onCloseFile}
345
- onFileChange={onFileChange}
346
- />
347
- </Allotment.Pane>
338
+ <div className="h-full flex flex-col">
339
+ {/* Editor takes remaining space */}
340
+ <div
341
+ className={
342
+ terminalMinimized ? "flex-1 min-h-0" : "flex-1 min-h-0"
343
+ }
344
+ style={{ height: terminalMinimized ? "100%" : "70%" }}
345
+ >
346
+ <div className="h-full">
347
+ <CodeEditor
348
+ files={files}
349
+ originalFiles={originalFiles}
350
+ fileChanges={fileChanges}
351
+ activeFile={selectedFile}
352
+ openFiles={openFiles}
353
+ onSelectFile={onSelectFile}
354
+ onCloseFile={onCloseFile}
355
+ onFileChange={onFileChange}
356
+ />
357
+ </div>
358
+ </div>
348
359
 
349
- <Allotment.Pane preferredSize="30%" minSize={60}>
350
- <Terminal output={terminalOutput} />
351
- </Allotment.Pane>
352
- </Allotment>
360
+ {/* Terminal — collapsible */}
361
+ {terminalMinimized ? (
362
+ <Terminal
363
+ output={terminalOutput}
364
+ minimized={true}
365
+ onToggleMinimize={() => setTerminalMinimized(false)}
366
+ />
367
+ ) : (
368
+ <div style={{ height: "30%", minHeight: 60 }}>
369
+ <Terminal
370
+ output={terminalOutput}
371
+ minimized={false}
372
+ onToggleMinimize={() => setTerminalMinimized(true)}
373
+ />
374
+ </div>
375
+ )}
376
+ </div>
353
377
  </Allotment.Pane>
354
378
  </Allotment>
355
379
  </div>
package/src/index.ts CHANGED
@@ -5,6 +5,10 @@
5
5
  * Consumers import from here.
6
6
  */
7
7
 
8
+ // Styles — imported here so Vite extracts them into the library CSS bundle.
9
+ // Consumers must import: import "@illuma-ai/code-sandbox/styles.css";
10
+ import "./styles.css";
11
+
8
12
  // Main component
9
13
  export { CodeSandbox } from "./components/Workbench";
10
14
 
package/src/styles.css CHANGED
@@ -10,7 +10,8 @@
10
10
  --sb-bg-active: #37373d;
11
11
  --sb-sidebar: #252526;
12
12
  --sb-editor: #1e1e1e;
13
- --sb-terminal: #1e1e1e;
13
+ --sb-terminal: #0d1117;
14
+ --sb-terminal-header: #161b22;
14
15
  --sb-preview: #ffffff;
15
16
  --sb-border: #3c3c3c;
16
17
  --sb-text: #cccccc;
@@ -18,9 +19,66 @@
18
19
  --sb-text-active: #ffffff;
19
20
  --sb-accent: #007acc;
20
21
  --sb-accent-hover: #1a8ad4;
21
- --sb-success: #4ec9b0;
22
- --sb-warning: #cca700;
23
- --sb-error: #f44747;
22
+ --sb-success: #3fb950;
23
+ --sb-warning: #d29922;
24
+ --sb-error: #f85149;
25
+ --sb-info: #58a6ff;
26
+ --sb-cyan: #56d4dd;
27
+ --sb-magenta: #bc8cff;
28
+ --sb-yellow: #e3b341;
29
+ --sb-scrollbar-thumb: rgba(255, 255, 255, 0.12);
30
+ --sb-scrollbar-thumb-hover: rgba(255, 255, 255, 0.25);
31
+ --sb-scrollbar-track: transparent;
32
+ --sb-scrollbar-width: 6px;
33
+ }
34
+
35
+ /* ---------------------------------------------------------------------------
36
+ * Modern thin scrollbars — applies to ALL scrollable elements in sandbox
37
+ * Auto-hides via opacity transition. Themed with CSS vars.
38
+ * --------------------------------------------------------------------------- */
39
+
40
+ /* Webkit (Chrome, Safari, Edge) */
41
+ .sb-root ::-webkit-scrollbar {
42
+ width: var(--sb-scrollbar-width);
43
+ height: var(--sb-scrollbar-width);
44
+ }
45
+
46
+ .sb-root ::-webkit-scrollbar-track {
47
+ background: var(--sb-scrollbar-track);
48
+ }
49
+
50
+ .sb-root ::-webkit-scrollbar-thumb {
51
+ background: var(--sb-scrollbar-thumb);
52
+ border-radius: 999px;
53
+ }
54
+
55
+ .sb-root ::-webkit-scrollbar-thumb:hover {
56
+ background: var(--sb-scrollbar-thumb-hover);
57
+ }
58
+
59
+ .sb-root ::-webkit-scrollbar-corner {
60
+ background: transparent;
61
+ }
62
+
63
+ /* Firefox */
64
+ .sb-root * {
65
+ scrollbar-width: thin;
66
+ scrollbar-color: var(--sb-scrollbar-thumb) var(--sb-scrollbar-track);
67
+ }
68
+
69
+ /* ---------------------------------------------------------------------------
70
+ * Terminal — clean monochrome styling
71
+ * --------------------------------------------------------------------------- */
72
+
73
+ .sb-terminal-output {
74
+ font-family:
75
+ "Cascadia Code", "JetBrains Mono", "Fira Code", "Consolas", "Monaco",
76
+ "Courier New", monospace;
77
+ font-size: 12.5px;
78
+ line-height: 1.6;
79
+ letter-spacing: 0.01em;
80
+ -webkit-font-smoothing: antialiased;
81
+ -moz-osx-font-smoothing: grayscale;
24
82
  }
25
83
 
26
84
  /*
package/src/types.ts CHANGED
@@ -343,6 +343,10 @@ export interface CodeEditorProps {
343
343
  export interface TerminalProps {
344
344
  output: string[];
345
345
  className?: string;
346
+ /** Whether the terminal is collapsed to just its header bar */
347
+ minimized?: boolean;
348
+ /** Called when the user clicks the minimize/expand toggle */
349
+ onToggleMinimize?: () => void;
346
350
  }
347
351
 
348
352
  export interface PreviewProps {
@@ -1 +0,0 @@
1
- :root{--separator-border: rgba(128, 128, 128, .35);--sash-hover-transition-duration: .1s}.allotment-module_splitView__L-yRc{height:100%;overflow:hidden;position:relative;width:100%}.allotment-module_splitView__L-yRc>.allotment-module_sashContainer__fzwJF{height:100%;pointer-events:none;position:absolute;width:100%}.allotment-module_splitView__L-yRc>.allotment-module_sashContainer__fzwJF>.allotment-module_sash__QA-2t{pointer-events:auto}.allotment-module_splitView__L-yRc>.allotment-module_splitViewContainer__rQnVa{height:100%;position:relative;white-space:nowrap;width:100%}.allotment-module_splitView__L-yRc>.allotment-module_splitViewContainer__rQnVa>.allotment-module_splitViewView__MGZ6O{overflow:hidden;position:absolute;white-space:initial}.allotment-module_splitView__L-yRc.allotment-module_vertical__WSwwa>.allotment-module_splitViewContainer__rQnVa>.allotment-module_splitViewView__MGZ6O{width:100%}.allotment-module_splitView__L-yRc.allotment-module_horizontal__7doS8>.allotment-module_splitViewContainer__rQnVa>.allotment-module_splitViewView__MGZ6O{height:100%}.allotment-module_splitView__L-yRc.allotment-module_separatorBorder__x-rDS>.allotment-module_splitViewContainer__rQnVa>.allotment-module_splitViewView__MGZ6O:not(:first-child):before{background-color:var(--separator-border);content:" ";left:0;pointer-events:none;position:absolute;top:0;z-index:5}.allotment-module_splitView__L-yRc.allotment-module_separatorBorder__x-rDS.allotment-module_vertical__WSwwa>.allotment-module_splitViewContainer__rQnVa>.allotment-module_splitViewView__MGZ6O:not(:first-child):before{height:1px;width:100%}.allotment-module_splitView__L-yRc.allotment-module_separatorBorder__x-rDS.allotment-module_horizontal__7doS8>.allotment-module_splitViewContainer__rQnVa>.allotment-module_splitViewView__MGZ6O:not(:first-child):before{height:100%;width:1px}:root{--focus-border: #007fd4;--sash-size: 8px;--sash-hover-size: 4px}.sash-module_sash__K-9lB{position:absolute;z-index:35;touch-action:none;pointer-events:auto;text-align:initial}.sash-module_sash__K-9lB.sash-module_disabled__Hm-wx{pointer-events:none}.sash-module_sash__K-9lB.sash-module_mac__Jf6OJ.sash-module_vertical__pB-rs{cursor:col-resize}.sash-module_sash__K-9lB.sash-module_vertical__pB-rs.sash-module_minimum__-UKxp{cursor:e-resize}.sash-module_sash__K-9lB.sash-module_vertical__pB-rs.sash-module_maximum__TCWxD{cursor:w-resize}.sash-module_sash__K-9lB.sash-module_mac__Jf6OJ.sash-module_horizontal__kFbiw{cursor:row-resize}.sash-module_sash__K-9lB.sash-module_horizontal__kFbiw.sash-module_minimum__-UKxp{cursor:s-resize}.sash-module_sash__K-9lB.sash-module_horizontal__kFbiw.sash-module_maximum__TCWxD{cursor:n-resize}.sash-module_sash__K-9lB.sash-module_disabled__Hm-wx{cursor:default!important;pointer-events:none!important}.sash-module_sash__K-9lB.sash-module_vertical__pB-rs{cursor:ew-resize;top:0;width:var(--sash-size);height:100%}.sash-module_sash__K-9lB.sash-module_horizontal__kFbiw{cursor:ns-resize;left:0;width:100%;height:var(--sash-size)}.sash-module_sash__K-9lB:not(.sash-module_disabled__Hm-wx)>.sash-module_orthogonal-drag-handle__Yii2-{content:" ";height:calc(var(--sash-size) * 2);width:calc(var(--sash-size) * 2);z-index:100;display:block;cursor:all-scroll;position:absolute}.sash-module_sash__K-9lB.sash-module_horizontal__kFbiw.sash-module_orthogonal-edge-north__f7Noe:not(.sash-module_disabled__Hm-wx)>.sash-module_orthogonal-drag-handle__Yii2-.sash-module_start__uZEDk,.sash-module_sash__K-9lB.sash-module_horizontal__kFbiw.sash-module_orthogonal-edge-south__6ZrFC:not(.sash-module_disabled__Hm-wx)>.sash-module_orthogonal-drag-handle__Yii2-.sash-module_end__0TP-R{cursor:nwse-resize}.sash-module_sash__K-9lB.sash-module_horizontal__kFbiw.sash-module_orthogonal-edge-north__f7Noe:not(.sash-module_disabled__Hm-wx)>.sash-module_orthogonal-drag-handle__Yii2-.sash-module_end__0TP-R,.sash-module_sash__K-9lB.sash-module_horizontal__kFbiw.sash-module_orthogonal-edge-south__6ZrFC:not(.sash-module_disabled__Hm-wx)>.sash-module_orthogonal-drag-handle__Yii2-.sash-module_start__uZEDk{cursor:nesw-resize}.sash-module_sash__K-9lB.sash-module_vertical__pB-rs>.sash-module_orthogonal-drag-handle__Yii2-.sash-module_start__uZEDk{left:calc(var(--sash-size) * -.5);top:calc(var(--sash-size) * -1)}.sash-module_sash__K-9lB.sash-module_vertical__pB-rs>.sash-module_orthogonal-drag-handle__Yii2-.sash-module_end__0TP-R{left:calc(var(--sash-size) * -.5);bottom:calc(var(--sash-size) * -1)}.sash-module_sash__K-9lB.sash-module_horizontal__kFbiw>.sash-module_orthogonal-drag-handle__Yii2-.sash-module_start__uZEDk{top:calc(var(--sash-size) * -.5);left:calc(var(--sash-size) * -1)}.sash-module_sash__K-9lB.sash-module_horizontal__kFbiw>.sash-module_orthogonal-drag-handle__Yii2-.sash-module_end__0TP-R{top:calc(var(--sash-size) * -.5);right:calc(var(--sash-size) * -1)}.sash-module_sash__K-9lB:before{content:"";pointer-events:none;position:absolute;width:100%;height:100%;transition:background-color var(--sash-hover-transition-duration) ease-out;background:transparent}.sash-module_sash__K-9lB.sash-module_vertical__pB-rs:before{width:var(--sash-hover-size);left:calc(50% - (var(--sash-hover-size) / 2))}.sash-module_sash__K-9lB.sash-module_horizontal__kFbiw:before{height:var(--sash-hover-size);top:calc(50% - (var(--sash-hover-size) / 2))}.sash-module_sash__K-9lB.sash-module_hover__80W6I:before,.sash-module_sash__K-9lB.sash-module_active__bJspD:before{background:var(--focus-border)}