@innovatorved/code-lab 0.1.0 → 0.1.2
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 +3 -3
- package/dist/code-lab.css +209 -1
- package/dist/code-lab.esm.js +297 -36
- package/dist/code-lab.js +297 -36
- package/dist/shell.esm.js +52 -1
- package/dist/shell.js +52 -1
- package/package.json +2 -2
- package/src/code-lab.css +209 -1
- package/src/shell.js +52 -1
- package/src/shell.ts +28 -1
- package/src/workbench.js +245 -35
- package/src/workbench.ts +245 -35
package/README.md
CHANGED
|
@@ -13,14 +13,14 @@ Browser-native code IDE workbench, modular guided challenge engine (`@innovatorv
|
|
|
13
13
|
|
|
14
14
|
- **Modular Architecture (`v2.0.0`)**: Pure, general-purpose browser IDE (`code-lab`) by default with File Explorer, Monaco Editor, and PTY Terminal. Curriculum features (Guided Steps, Mode Switcher, and JS/TS switcher) are encapsulated in an opt-in modular extension (`@innovatorved/code-lab/extensions/guided-lab`).
|
|
15
15
|
- **End-to-End TypeScript & Zod Type Safety**: Written in TypeScript with strict runtime schemas and inferred types (`z.infer<typeof ...>`) for workbench options, guided labs, runtime execution, and git cloning.
|
|
16
|
-
- **Public GitHub Repository Cloning (`git clone`)**: Clone any public GitHub repository (`git clone https://github.com/owner/repo` or `git clone owner/repo --branch main` in the terminal, or `await lab.cloneRepo('owner/repo')` via the SDK) directly into `/workspace` with zero authentication required (automatic GitHub Trees API + jsDelivr unlimited fallback).
|
|
17
|
-
- **Interactive IDE Workbench**: Multi-file Monaco editor, collapsible hierarchical file tree with drag-and-drop, decoupled editor tabs, Command Palette (`Cmd+Shift+P`), Quick Open (`Cmd+P`), breadcrumbs, and line-by-line solution diff viewer.
|
|
16
|
+
- **Public GitHub Repository Cloning (`git clone`)**: Clone any public GitHub repository (`git clone https://github.com/owner/repo` or `git clone owner/repo --branch main` in the terminal, or `await lab.cloneRepo('owner/repo')` via the SDK) directly into `/workspace` with zero authentication required (automatic GitHub Trees API + jsDelivr unlimited fallback). Clone progress (`remote: Enumerating objects…`, `Receiving objects: n%…`) streams into the terminal in real time as it downloads.
|
|
17
|
+
- **Interactive IDE Workbench**: Multi-file Monaco editor, collapsible hierarchical file tree with drag-and-drop, a workspace **folder switcher** (breadcrumb dropdown that scopes the explorer to any subfolder), decoupled editor tabs, Command Palette (`Cmd+Shift+P`), Quick Open (`Cmd+P`), breadcrumbs, and line-by-line solution diff viewer.
|
|
18
18
|
- **Interactive PTY Terminal**: Inline prompt (`codelab:/workspace$ `), cursor navigation, history (`Up`/`Down`), `Ctrl+R` reverse-i-search, `Tab` auto-completion, `Ctrl+C` interrupt, `Ctrl+L` clear, and 256-color / TrueColor ANSI support.
|
|
19
19
|
- **POSIX Shell & 55+ Coreutils**: Full pure-JS AST interpreter supporting pipelines (`|`), redirects (`>`, `>>`, `2>&1`, `<<<`, `<<EOF`), control flow (`if`/`for`/`while`/`case`), functions, arithmetic `$((...))`, brace expansion `{1..5}`, and 55+ UNIX commands (`git`, `ls`, `cat`, `grep`, `find`, `sed`, `awk`, `jq`, `tar`, `curl`, `nc`, `lsof`, `tsc`, etc.).
|
|
20
20
|
- **Dual Runtime Engines (Node.js v22 & Bun v1.1)**:
|
|
21
21
|
- **Node.js**: 28 built-in modules (`fs`, `fs/promises`, `http`, `https`, `net`, `stream`, `events`, `crypto`, `zlib`, `vm`, `worker_threads`, `readline`, `node:sqlite`, `node:test`, `assert`).
|
|
22
22
|
- **Bun**: Native `.ts` transpilation, `Bun.serve()`, `Bun.file()`, `Bun.write()`, `Bun.spawn()`, `Bun.password`, `Bun.hash()`, `bun:test`, and VFS-backed `bun:sqlite`.
|
|
23
|
-
- **Persistent HTTP/TCP Servers & Dual Web Preview**: Start background servers (`node server.js &` or `bun run server.ts &`), query them with `curl http://localhost:3000` or global `fetch()`, and view live responses in the Ports table, an embedded **Web Preview** tab (URL bar, back/forward, device frames), or a popped-out browser tab backed by a virtual-loopback Service Worker (`/__preview/:port/*`).
|
|
23
|
+
- **Persistent HTTP/TCP Servers & Dual Web Preview**: Start background servers (`node server.js &` or `bun run server.ts &`), query them with `curl http://localhost:3000` or global `fetch()`, and view live responses in the Ports table, an embedded **Web Preview** tab (URL bar, back/forward, device frames), or a popped-out browser tab backed by a virtual-loopback Service Worker (`/__preview/:port/*`). Public URLs (e.g. `https://example.com`) entered in the preview URL bar open in a real browser tab instead of the virtual frame.
|
|
24
24
|
- **GitHub-Flavored Markdown Engine**: Zero-dependency GFM renderer (tables with column alignment, `[!NOTE]` / `[!TIP]` / `[!IMPORTANT]` / `[!WARNING]` / `[!CAUTION]` callout alerts, task-list checkboxes, and syntax-highlighted code blocks with one-click copy) powering the Guide tab, hints, and `.md` file previews.
|
|
25
25
|
- **NPM & Bun Package Management**: `npm i <pkg>` and `bun add <pkg>` resolve dependencies from npm / esm.sh into virtual `/workspace/node_modules/<pkg>` and update `package.json`.
|
|
26
26
|
- **Guided Step-by-Step Challenges**: TutorialKit / Codedamn-style curriculum extension with targeted instructions, hints, automated test verification per step, and reference solutions.
|
package/dist/code-lab.css
CHANGED
|
@@ -1803,12 +1803,26 @@ code-lab,
|
|
|
1803
1803
|
display: flex;
|
|
1804
1804
|
align-items: center;
|
|
1805
1805
|
justify-content: space-between;
|
|
1806
|
+
gap: 8px;
|
|
1806
1807
|
height: 36px;
|
|
1807
1808
|
padding: 0 14px;
|
|
1808
1809
|
background: var(--cl-bg);
|
|
1809
1810
|
border-bottom: 1px solid var(--cl-border);
|
|
1810
1811
|
flex-shrink: 0;
|
|
1811
1812
|
user-select: none;
|
|
1813
|
+
min-width: 0;
|
|
1814
|
+
}
|
|
1815
|
+
|
|
1816
|
+
/* Keep the Clear / minimize controls pinned while the tab strip scrolls. */
|
|
1817
|
+
.codelab-drawer__bar > div:last-child {
|
|
1818
|
+
flex-shrink: 0;
|
|
1819
|
+
}
|
|
1820
|
+
|
|
1821
|
+
/* On narrow/guided layouts, drop the tab pill badges so labels never wrap. */
|
|
1822
|
+
@media (max-width: 720px) {
|
|
1823
|
+
.codelab-drawer__tab .codelab-drawer__pill {
|
|
1824
|
+
display: none;
|
|
1825
|
+
}
|
|
1812
1826
|
}
|
|
1813
1827
|
|
|
1814
1828
|
.codelab-drawer__tabs {
|
|
@@ -1816,6 +1830,17 @@ code-lab,
|
|
|
1816
1830
|
align-items: center;
|
|
1817
1831
|
gap: 4px;
|
|
1818
1832
|
height: 100%;
|
|
1833
|
+
flex: 1 1 auto;
|
|
1834
|
+
flex-wrap: nowrap;
|
|
1835
|
+
min-width: 0;
|
|
1836
|
+
overflow-x: auto;
|
|
1837
|
+
overflow-y: hidden;
|
|
1838
|
+
scrollbar-width: none;
|
|
1839
|
+
-ms-overflow-style: none;
|
|
1840
|
+
}
|
|
1841
|
+
|
|
1842
|
+
.codelab-drawer__tabs::-webkit-scrollbar {
|
|
1843
|
+
display: none;
|
|
1819
1844
|
}
|
|
1820
1845
|
|
|
1821
1846
|
.codelab-drawer__tab {
|
|
@@ -1831,6 +1856,8 @@ code-lab,
|
|
|
1831
1856
|
border: none;
|
|
1832
1857
|
cursor: pointer;
|
|
1833
1858
|
transition: all 100ms ease;
|
|
1859
|
+
flex-shrink: 0;
|
|
1860
|
+
white-space: nowrap;
|
|
1834
1861
|
}
|
|
1835
1862
|
|
|
1836
1863
|
.codelab-drawer__tab:hover {
|
|
@@ -2319,7 +2346,7 @@ code-lab,
|
|
|
2319
2346
|
font-size: 11.5px;
|
|
2320
2347
|
color: var(--cl-fg-muted);
|
|
2321
2348
|
user-select: none;
|
|
2322
|
-
overflow
|
|
2349
|
+
overflow: visible;
|
|
2323
2350
|
}
|
|
2324
2351
|
|
|
2325
2352
|
.codelab-guide__expand-btn {
|
|
@@ -2353,12 +2380,30 @@ code-lab,
|
|
|
2353
2380
|
display: inline-flex;
|
|
2354
2381
|
}
|
|
2355
2382
|
|
|
2383
|
+
.codelab-breadcrumbs__left {
|
|
2384
|
+
display: inline-flex;
|
|
2385
|
+
align-items: center;
|
|
2386
|
+
gap: 8px;
|
|
2387
|
+
min-width: 0;
|
|
2388
|
+
flex: 1 1 auto;
|
|
2389
|
+
}
|
|
2390
|
+
|
|
2356
2391
|
.codelab-breadcrumbs__path {
|
|
2357
2392
|
display: inline-flex;
|
|
2358
2393
|
align-items: center;
|
|
2359
2394
|
gap: 4px;
|
|
2360
2395
|
min-width: 0;
|
|
2361
2396
|
white-space: nowrap;
|
|
2397
|
+
overflow-x: auto;
|
|
2398
|
+
scrollbar-width: none;
|
|
2399
|
+
}
|
|
2400
|
+
|
|
2401
|
+
.codelab-breadcrumbs__path::-webkit-scrollbar {
|
|
2402
|
+
display: none;
|
|
2403
|
+
}
|
|
2404
|
+
|
|
2405
|
+
.codelab-breadcrumbs__item--folder {
|
|
2406
|
+
color: var(--cl-fg-muted);
|
|
2362
2407
|
}
|
|
2363
2408
|
|
|
2364
2409
|
.codelab-breadcrumbs__item {
|
|
@@ -2412,6 +2457,161 @@ code-lab,
|
|
|
2412
2457
|
flex-shrink: 0;
|
|
2413
2458
|
}
|
|
2414
2459
|
|
|
2460
|
+
/* ── Workspace Folder Switcher (breadcrumb dropdown) ───────────────────── */
|
|
2461
|
+
.codelab-folder-switcher {
|
|
2462
|
+
position: relative;
|
|
2463
|
+
display: inline-flex;
|
|
2464
|
+
align-items: center;
|
|
2465
|
+
flex-shrink: 0;
|
|
2466
|
+
}
|
|
2467
|
+
|
|
2468
|
+
.codelab-folder-switcher__toggle {
|
|
2469
|
+
display: inline-flex;
|
|
2470
|
+
align-items: center;
|
|
2471
|
+
gap: 5px;
|
|
2472
|
+
height: 20px;
|
|
2473
|
+
padding: 0 7px;
|
|
2474
|
+
border: 1px solid var(--cl-border);
|
|
2475
|
+
border-radius: 4px;
|
|
2476
|
+
background: var(--cl-bg);
|
|
2477
|
+
color: var(--cl-fg-muted);
|
|
2478
|
+
font-family: var(--cl-font-sans);
|
|
2479
|
+
font-size: 11px;
|
|
2480
|
+
cursor: pointer;
|
|
2481
|
+
white-space: nowrap;
|
|
2482
|
+
box-sizing: border-box;
|
|
2483
|
+
transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
|
|
2484
|
+
}
|
|
2485
|
+
|
|
2486
|
+
.codelab-folder-switcher__toggle:hover,
|
|
2487
|
+
.codelab-folder-switcher.is-open .codelab-folder-switcher__toggle {
|
|
2488
|
+
background: var(--cl-bg-hover);
|
|
2489
|
+
color: var(--cl-fg);
|
|
2490
|
+
border-color: var(--cl-border-strong);
|
|
2491
|
+
}
|
|
2492
|
+
|
|
2493
|
+
.codelab-folder-switcher__toggle.is-scoped {
|
|
2494
|
+
color: var(--cl-fg);
|
|
2495
|
+
border-color: var(--cl-border-strong);
|
|
2496
|
+
}
|
|
2497
|
+
|
|
2498
|
+
.codelab-folder-switcher__label {
|
|
2499
|
+
max-width: 160px;
|
|
2500
|
+
overflow: hidden;
|
|
2501
|
+
text-overflow: ellipsis;
|
|
2502
|
+
white-space: nowrap;
|
|
2503
|
+
}
|
|
2504
|
+
|
|
2505
|
+
.codelab-folder-switcher__menu {
|
|
2506
|
+
position: absolute;
|
|
2507
|
+
top: calc(100% + 5px);
|
|
2508
|
+
left: 0;
|
|
2509
|
+
z-index: 90;
|
|
2510
|
+
min-width: 230px;
|
|
2511
|
+
max-width: 340px;
|
|
2512
|
+
max-height: 300px;
|
|
2513
|
+
overflow-y: auto;
|
|
2514
|
+
padding: 4px;
|
|
2515
|
+
background: var(--cl-bg-elevated);
|
|
2516
|
+
border: 1px solid var(--cl-border-strong);
|
|
2517
|
+
border-radius: 6px;
|
|
2518
|
+
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
|
|
2519
|
+
display: flex;
|
|
2520
|
+
flex-direction: column;
|
|
2521
|
+
gap: 1px;
|
|
2522
|
+
}
|
|
2523
|
+
|
|
2524
|
+
.codelab-folder-switcher__section {
|
|
2525
|
+
padding: 4px 8px 6px;
|
|
2526
|
+
font-family: var(--cl-font-sans);
|
|
2527
|
+
font-size: 10px;
|
|
2528
|
+
text-transform: uppercase;
|
|
2529
|
+
letter-spacing: 0.05em;
|
|
2530
|
+
color: var(--cl-fg-subtle);
|
|
2531
|
+
}
|
|
2532
|
+
|
|
2533
|
+
.codelab-folder-switcher__option {
|
|
2534
|
+
display: flex;
|
|
2535
|
+
align-items: center;
|
|
2536
|
+
gap: 6px;
|
|
2537
|
+
width: 100%;
|
|
2538
|
+
padding: 5px 8px;
|
|
2539
|
+
border: none;
|
|
2540
|
+
border-radius: 4px;
|
|
2541
|
+
background: transparent;
|
|
2542
|
+
color: var(--cl-fg-muted);
|
|
2543
|
+
font-family: var(--cl-font-mono);
|
|
2544
|
+
font-size: 11.5px;
|
|
2545
|
+
text-align: left;
|
|
2546
|
+
cursor: pointer;
|
|
2547
|
+
}
|
|
2548
|
+
|
|
2549
|
+
.codelab-folder-switcher__option:hover {
|
|
2550
|
+
background: var(--cl-bg-hover);
|
|
2551
|
+
color: var(--cl-fg);
|
|
2552
|
+
}
|
|
2553
|
+
|
|
2554
|
+
.codelab-folder-switcher__option.active {
|
|
2555
|
+
background: var(--cl-bg-hover);
|
|
2556
|
+
color: var(--cl-fg);
|
|
2557
|
+
font-weight: 600;
|
|
2558
|
+
}
|
|
2559
|
+
|
|
2560
|
+
.codelab-folder-switcher__icon {
|
|
2561
|
+
display: inline-flex;
|
|
2562
|
+
flex-shrink: 0;
|
|
2563
|
+
color: var(--cl-fg-subtle);
|
|
2564
|
+
}
|
|
2565
|
+
|
|
2566
|
+
.codelab-folder-switcher__name {
|
|
2567
|
+
overflow: hidden;
|
|
2568
|
+
text-overflow: ellipsis;
|
|
2569
|
+
white-space: nowrap;
|
|
2570
|
+
}
|
|
2571
|
+
|
|
2572
|
+
.codelab-folder-switcher__path {
|
|
2573
|
+
margin-left: auto;
|
|
2574
|
+
padding-left: 12px;
|
|
2575
|
+
color: var(--cl-fg-subtle);
|
|
2576
|
+
font-size: 10px;
|
|
2577
|
+
overflow: hidden;
|
|
2578
|
+
text-overflow: ellipsis;
|
|
2579
|
+
white-space: nowrap;
|
|
2580
|
+
}
|
|
2581
|
+
|
|
2582
|
+
.codelab-folder-switcher__empty {
|
|
2583
|
+
padding: 8px;
|
|
2584
|
+
font-size: 11px;
|
|
2585
|
+
color: var(--cl-fg-muted);
|
|
2586
|
+
}
|
|
2587
|
+
|
|
2588
|
+
/* Scoped-explorer "back to workspace" row */
|
|
2589
|
+
.codelab-scope-up {
|
|
2590
|
+
display: flex;
|
|
2591
|
+
align-items: center;
|
|
2592
|
+
gap: 8px;
|
|
2593
|
+
width: 100%;
|
|
2594
|
+
padding: 5px 10px;
|
|
2595
|
+
margin-bottom: 2px;
|
|
2596
|
+
border: none;
|
|
2597
|
+
border-bottom: 1px dashed var(--cl-border);
|
|
2598
|
+
background: transparent;
|
|
2599
|
+
color: var(--cl-fg-muted);
|
|
2600
|
+
font-family: var(--cl-font-mono);
|
|
2601
|
+
font-size: 11.5px;
|
|
2602
|
+
text-align: left;
|
|
2603
|
+
cursor: pointer;
|
|
2604
|
+
}
|
|
2605
|
+
|
|
2606
|
+
.codelab-scope-up:hover {
|
|
2607
|
+
color: var(--cl-fg);
|
|
2608
|
+
background: var(--cl-bg-hover);
|
|
2609
|
+
}
|
|
2610
|
+
|
|
2611
|
+
.codelab-scope-up__arrow {
|
|
2612
|
+
color: var(--cl-fg-subtle);
|
|
2613
|
+
}
|
|
2614
|
+
|
|
2415
2615
|
.codelab-breadcrumb__btn,
|
|
2416
2616
|
.codelab-breadcrumbs__btn {
|
|
2417
2617
|
display: inline-flex;
|
|
@@ -3958,6 +4158,14 @@ code-lab,
|
|
|
3958
4158
|
to { opacity: 1; transform: translateY(0); }
|
|
3959
4159
|
}
|
|
3960
4160
|
|
|
4161
|
+
.codelab-toast--info .codelab-toast__icon { color: var(--cl-blue); }
|
|
4162
|
+
|
|
4163
|
+
.codelab-toast--error {
|
|
4164
|
+
border-color: var(--cl-red);
|
|
4165
|
+
}
|
|
4166
|
+
|
|
4167
|
+
.codelab-toast--error .codelab-toast__icon { color: var(--cl-red); }
|
|
4168
|
+
|
|
3961
4169
|
.codelab-toast__icon {
|
|
3962
4170
|
color: var(--cl-green);
|
|
3963
4171
|
flex: 0 0 auto;
|