@innovatorved/code-lab 0.1.9 → 0.1.11
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/ARCHITECTURE.md +1 -1
- package/README.md +1 -1
- package/dist/code-lab.css +87 -15
- package/dist/code-lab.d.ts +1 -1
- package/dist/code-lab.esm.js +218 -22
- package/dist/code-lab.js +217 -21
- package/dist/index.d.ts +1 -1
- package/dist/preview-sw.js +2 -2
- package/dist/runtime.esm.js +29 -4
- package/dist/runtime.js +29 -4
- package/dist/schemas.d.ts +1 -1
- package/dist/shell.esm.js +151 -9
- package/dist/shell.js +151 -9
- package/dist/terminal.esm.js +1 -1
- package/dist/terminal.js +1 -1
- package/package.json +1 -1
- package/src/code-lab.css +87 -15
- package/src/csp.ts +6 -1
- package/src/index.ts +1 -1
- package/src/runtime.ts +28 -3
- package/src/schemas.ts +1 -1
- package/src/shell.ts +150 -8
- package/src/workbench.ts +37 -8
package/ARCHITECTURE.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# `@innovatorved/code-lab` Architecture (v0.1.
|
|
1
|
+
# `@innovatorved/code-lab` Architecture (v0.1.10)
|
|
2
2
|
|
|
3
3
|
`@innovatorved/code-lab` is an embeddable, browser-native Node.js v22 + Bun v1.1 IDE, POSIX shell, PTY terminal, and virtual execution sandbox with self-contained browser bundles (zero runtime dependencies in `dist/*`; Zod schemas available under `@innovatorved/code-lab/schemas`).
|
|
4
4
|
|
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ Browser-native code IDE workbench, modular guided challenge engine (`@innovatorv
|
|
|
11
11
|
|
|
12
12
|
## Features
|
|
13
13
|
|
|
14
|
-
- **Modular Architecture (`v0.1.
|
|
14
|
+
- **Modular Architecture (`v0.1.10`)**: 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
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
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.
|
package/dist/code-lab.css
CHANGED
|
@@ -4259,19 +4259,20 @@ code-lab,
|
|
|
4259
4259
|
display: flex;
|
|
4260
4260
|
flex-direction: column;
|
|
4261
4261
|
height: 100%;
|
|
4262
|
-
min-height:
|
|
4262
|
+
min-height: 0;
|
|
4263
4263
|
gap: 8px;
|
|
4264
4264
|
}
|
|
4265
4265
|
|
|
4266
4266
|
.codelab-preview-chrome {
|
|
4267
4267
|
display: flex;
|
|
4268
4268
|
align-items: center;
|
|
4269
|
-
gap:
|
|
4269
|
+
gap: 6px;
|
|
4270
4270
|
flex-wrap: nowrap;
|
|
4271
4271
|
padding: 6px 8px;
|
|
4272
4272
|
background: var(--cl-bg-panel);
|
|
4273
4273
|
border: 1px solid var(--cl-border);
|
|
4274
4274
|
border-radius: var(--cl-radius-md);
|
|
4275
|
+
flex-shrink: 0;
|
|
4275
4276
|
}
|
|
4276
4277
|
|
|
4277
4278
|
.codelab-preview-nav { display: flex; gap: 2px; flex: 0 0 auto; }
|
|
@@ -4294,7 +4295,7 @@ code-lab,
|
|
|
4294
4295
|
.codelab-preview-btn:disabled { opacity: 0.35; cursor: default; }
|
|
4295
4296
|
|
|
4296
4297
|
.codelab-preview-port-select {
|
|
4297
|
-
flex: 0
|
|
4298
|
+
flex: 0 1 auto;
|
|
4298
4299
|
height: 28px;
|
|
4299
4300
|
background: var(--cl-bg-elevated);
|
|
4300
4301
|
color: var(--cl-fg);
|
|
@@ -4302,12 +4303,16 @@ code-lab,
|
|
|
4302
4303
|
border-radius: var(--cl-radius-sm);
|
|
4303
4304
|
font-size: 12px;
|
|
4304
4305
|
padding: 0 6px;
|
|
4305
|
-
max-width:
|
|
4306
|
+
max-width: 170px;
|
|
4307
|
+
}
|
|
4308
|
+
|
|
4309
|
+
.codelab-preview-split .codelab-preview-port-select {
|
|
4310
|
+
max-width: 118px;
|
|
4306
4311
|
}
|
|
4307
4312
|
|
|
4308
4313
|
.codelab-preview-url-input {
|
|
4309
|
-
flex: 1 1
|
|
4310
|
-
min-width:
|
|
4314
|
+
flex: 1 1 160px;
|
|
4315
|
+
min-width: 120px;
|
|
4311
4316
|
height: 28px;
|
|
4312
4317
|
background: var(--cl-bg);
|
|
4313
4318
|
color: var(--cl-fg);
|
|
@@ -4324,8 +4329,8 @@ code-lab,
|
|
|
4324
4329
|
|
|
4325
4330
|
/* CSP badge: which remote hosts the current preview may reach. */
|
|
4326
4331
|
.codelab-preview-csp {
|
|
4327
|
-
flex: 0
|
|
4328
|
-
max-width:
|
|
4332
|
+
flex: 0 1 auto;
|
|
4333
|
+
max-width: 180px;
|
|
4329
4334
|
overflow: hidden;
|
|
4330
4335
|
text-overflow: ellipsis;
|
|
4331
4336
|
white-space: nowrap;
|
|
@@ -4338,6 +4343,31 @@ code-lab,
|
|
|
4338
4343
|
background: var(--cl-bg-elevated);
|
|
4339
4344
|
}
|
|
4340
4345
|
|
|
4346
|
+
.codelab-preview-split .codelab-preview-csp {
|
|
4347
|
+
max-width: 110px;
|
|
4348
|
+
}
|
|
4349
|
+
|
|
4350
|
+
/* The split pane is narrower than the drawer, so the single-row chrome would
|
|
4351
|
+
clip its right-hand controls. Wrap instead, and give the URL its own row. */
|
|
4352
|
+
.codelab-preview-split .codelab-preview-chrome {
|
|
4353
|
+
flex-wrap: wrap;
|
|
4354
|
+
row-gap: 4px;
|
|
4355
|
+
}
|
|
4356
|
+
|
|
4357
|
+
.codelab-preview-split .codelab-preview-url-input {
|
|
4358
|
+
order: 10;
|
|
4359
|
+
flex: 1 1 100%;
|
|
4360
|
+
}
|
|
4361
|
+
|
|
4362
|
+
/* Icon-only pop-out keeps the split chrome to two rows. */
|
|
4363
|
+
.codelab-preview-split [data-cl-action="preview-popout"] {
|
|
4364
|
+
padding: 0 6px;
|
|
4365
|
+
}
|
|
4366
|
+
|
|
4367
|
+
.codelab-preview-split [data-cl-action="preview-popout"] > span {
|
|
4368
|
+
display: none;
|
|
4369
|
+
}
|
|
4370
|
+
|
|
4341
4371
|
.codelab-preview-csp--blocked {
|
|
4342
4372
|
color: var(--cl-red);
|
|
4343
4373
|
border-color: var(--cl-red);
|
|
@@ -4345,7 +4375,7 @@ code-lab,
|
|
|
4345
4375
|
|
|
4346
4376
|
.codelab-preview-viewport {
|
|
4347
4377
|
flex: 1 1 auto;
|
|
4348
|
-
min-height:
|
|
4378
|
+
min-height: 120px;
|
|
4349
4379
|
display: flex;
|
|
4350
4380
|
justify-content: center;
|
|
4351
4381
|
background: var(--cl-bg);
|
|
@@ -4430,12 +4460,20 @@ code-lab,
|
|
|
4430
4460
|
}
|
|
4431
4461
|
|
|
4432
4462
|
/* ── Split-Pane Web Preview, Maximize Mode & Inline Console ─────────────── */
|
|
4463
|
+
.codelab-workspace.has-preview-split {
|
|
4464
|
+
grid-template-columns: var(--cl-explorer-width, 196px) 4px minmax(260px, 1fr) 5px minmax(240px, var(--cl-preview-split-width, 44%));
|
|
4465
|
+
}
|
|
4466
|
+
|
|
4467
|
+
.codelab.files-collapsed .codelab-workspace.has-preview-split {
|
|
4468
|
+
grid-template-columns: 0px 0px minmax(260px, 1fr) 5px minmax(240px, var(--cl-preview-split-width, 44%));
|
|
4469
|
+
}
|
|
4470
|
+
|
|
4433
4471
|
.codelab-preview-split {
|
|
4434
4472
|
display: none;
|
|
4435
4473
|
flex-direction: column;
|
|
4436
|
-
width:
|
|
4437
|
-
|
|
4438
|
-
|
|
4474
|
+
width: 100%;
|
|
4475
|
+
/* Width comes from the grid track so the pane can shrink with the viewport. */
|
|
4476
|
+
min-width: 0;
|
|
4439
4477
|
height: 100%;
|
|
4440
4478
|
background: var(--cl-bg-panel);
|
|
4441
4479
|
border-left: 1px solid var(--cl-border);
|
|
@@ -4560,7 +4598,7 @@ code-lab,
|
|
|
4560
4598
|
/* ── Ports, Mini HTTP Client & Network Inspector Drawer UI ──────────────── */
|
|
4561
4599
|
.codelab-ports-panel {
|
|
4562
4600
|
display: grid;
|
|
4563
|
-
grid-template-columns: minmax(
|
|
4601
|
+
grid-template-columns: minmax(360px, 1.25fr) minmax(320px, 1fr);
|
|
4564
4602
|
gap: 12px;
|
|
4565
4603
|
padding: 10px 12px;
|
|
4566
4604
|
height: 100%;
|
|
@@ -4678,7 +4716,7 @@ code-lab,
|
|
|
4678
4716
|
text-transform: uppercase;
|
|
4679
4717
|
letter-spacing: 0.03em;
|
|
4680
4718
|
color: var(--cl-fg-muted);
|
|
4681
|
-
padding: 6px
|
|
4719
|
+
padding: 6px 6px;
|
|
4682
4720
|
border-bottom: 1px solid var(--cl-border);
|
|
4683
4721
|
background: var(--cl-bg-elevated);
|
|
4684
4722
|
white-space: nowrap;
|
|
@@ -4686,7 +4724,7 @@ code-lab,
|
|
|
4686
4724
|
|
|
4687
4725
|
.codelab-ports-table td,
|
|
4688
4726
|
.codelab-net-table td {
|
|
4689
|
-
padding: 6px
|
|
4727
|
+
padding: 6px 6px;
|
|
4690
4728
|
border-bottom: 1px solid var(--cl-border);
|
|
4691
4729
|
color: var(--cl-fg);
|
|
4692
4730
|
vertical-align: middle;
|
|
@@ -5085,3 +5123,37 @@ code-lab,
|
|
|
5085
5123
|
white-space: pre-wrap;
|
|
5086
5124
|
word-break: break-word;
|
|
5087
5125
|
}
|
|
5126
|
+
|
|
5127
|
+
/* ── Split-Pane Web Preview: responsive behaviour ────────────────────────────
|
|
5128
|
+
These must come after the base `.codelab-workspace.has-preview-split` rule
|
|
5129
|
+
above: equal specificity, later wins. */
|
|
5130
|
+
@media (max-width: 900px) {
|
|
5131
|
+
/* Device emulation and the allowlist badge are not useful in a narrow pane.
|
|
5132
|
+
The violation chip stays visible so blocked requests are still surfaced. */
|
|
5133
|
+
.codelab-preview-split .codelab-preview-modes,
|
|
5134
|
+
.codelab-preview-split #cl-preview-csp-badge {
|
|
5135
|
+
display: none;
|
|
5136
|
+
}
|
|
5137
|
+
|
|
5138
|
+
/* Keep the split, but give the editor a floor and cap the preview share. */
|
|
5139
|
+
.codelab-workspace.has-preview-split {
|
|
5140
|
+
grid-template-columns: 155px 4px minmax(180px, 1fr) 5px minmax(200px, min(42%, var(--cl-preview-split-width, 44%)));
|
|
5141
|
+
}
|
|
5142
|
+
.codelab.files-collapsed .codelab-workspace.has-preview-split {
|
|
5143
|
+
grid-template-columns: 0px 0px minmax(180px, 1fr) 5px minmax(200px, min(42%, var(--cl-preview-split-width, 44%)));
|
|
5144
|
+
}
|
|
5145
|
+
}
|
|
5146
|
+
|
|
5147
|
+
@media (max-width: 680px) {
|
|
5148
|
+
/* A five-column split cannot fit a phone: stack the preview under the editor
|
|
5149
|
+
instead of letting both shrink to nothing. The explorer and its splitter are
|
|
5150
|
+
hidden at this width, so only editor, splitter and preview are placed. */
|
|
5151
|
+
.codelab-workspace.has-preview-split {
|
|
5152
|
+
grid-template-columns: 1fr;
|
|
5153
|
+
grid-template-rows: minmax(140px, 1fr) 5px 45%;
|
|
5154
|
+
}
|
|
5155
|
+
.codelab-preview-split {
|
|
5156
|
+
border-left: 0;
|
|
5157
|
+
border-top: 1px solid var(--cl-border);
|
|
5158
|
+
}
|
|
5159
|
+
}
|
package/dist/code-lab.d.ts
CHANGED