@innovatorved/code-lab 0.2.0 → 0.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.
Files changed (70) hide show
  1. package/ARCHITECTURE.md +11 -6
  2. package/CHANGELOG.md +27 -0
  3. package/README.md +18 -8
  4. package/dist/code-lab.css +198 -0
  5. package/dist/code-lab.d.ts +27 -9
  6. package/dist/code-lab.esm.js +8248 -83
  7. package/dist/code-lab.js +8246 -81
  8. package/dist/extensions/cpp.d.ts +32 -6
  9. package/dist/extensions/cpp.esm.js +745 -6
  10. package/dist/extensions/cpp.js +745 -6
  11. package/dist/extensions/guided-lab.esm.js +39 -1
  12. package/dist/extensions/guided-lab.js +39 -1
  13. package/dist/extensions/python.d.ts +92 -0
  14. package/dist/extensions/python.esm.js +5476 -0
  15. package/dist/extensions/python.js +5495 -0
  16. package/dist/index.d.ts +7 -4
  17. package/dist/preview-sw.js +1 -1
  18. package/dist/runtime/index.d.ts +4 -0
  19. package/dist/runtime/module-loader.d.ts +11 -0
  20. package/dist/runtime/test-harness.d.ts +24 -0
  21. package/dist/runtime/vfs.d.ts +31 -0
  22. package/dist/runtime/wasi-host.d.ts +33 -0
  23. package/dist/runtime.esm.js +36 -4
  24. package/dist/runtime.js +36 -4
  25. package/dist/schemas.d.ts +134 -21
  26. package/dist/schemas.esm.js +43 -1
  27. package/dist/schemas.js +43 -1
  28. package/dist/shell/coreutils/compilers-cli.d.ts +24 -0
  29. package/dist/shell/index.d.ts +4 -0
  30. package/dist/shell/lexer-parser.d.ts +26 -0
  31. package/dist/shell.esm.js +113 -1
  32. package/dist/shell.js +113 -1
  33. package/dist/terminal.esm.js +1 -1
  34. package/dist/terminal.js +1 -1
  35. package/dist/workbench/command-palette.d.ts +10 -0
  36. package/dist/workbench/diff-editor.d.ts +26 -0
  37. package/dist/workbench/drawer.d.ts +18 -0
  38. package/dist/workbench/editor.d.ts +11 -0
  39. package/dist/workbench/file-tree.d.ts +11 -0
  40. package/dist/workbench/guided-pane.d.ts +11 -0
  41. package/dist/workbench/icons.d.ts +5 -0
  42. package/dist/workbench/index.d.ts +39 -0
  43. package/dist/workbench/share.d.ts +21 -0
  44. package/dist/workbench/styles.d.ts +4 -0
  45. package/dist/workbench/toolbar.d.ts +17 -0
  46. package/dist/workbench.d.ts +6 -1
  47. package/package.json +8 -2
  48. package/src/code-lab.css +198 -0
  49. package/src/extensions/cpp.ts +710 -5
  50. package/src/extensions/python.ts +1293 -0
  51. package/src/index.ts +35 -3
  52. package/src/runtime/index.ts +5 -0
  53. package/src/runtime/test-harness.ts +57 -0
  54. package/src/runtime.ts +35 -3
  55. package/src/schemas.ts +46 -1
  56. package/src/shell/coreutils/compilers-cli.ts +103 -0
  57. package/src/shell/index.ts +5 -0
  58. package/src/shell.ts +112 -0
  59. package/src/workbench/command-palette.ts +140 -0
  60. package/src/workbench/diff-editor.ts +216 -0
  61. package/src/workbench/drawer.ts +148 -0
  62. package/src/workbench/editor.ts +49 -0
  63. package/src/workbench/file-tree.ts +51 -0
  64. package/src/workbench/guided-pane.ts +33 -0
  65. package/src/workbench/icons.ts +48 -0
  66. package/src/workbench/index.ts +38 -0
  67. package/src/workbench/share.ts +99 -0
  68. package/src/workbench/styles.ts +200 -0
  69. package/src/workbench/toolbar.ts +171 -0
  70. package/src/workbench.ts +755 -70
@@ -0,0 +1,99 @@
1
+ /**
2
+ * @innovatorved/code-lab — Zero-Backend URL Snapshot Compressor & Decompressor
3
+ *
4
+ * Serializes workspace state { lang, activeFile, files, stdin }, compresses it
5
+ * with browser-native `CompressionStream('deflate-raw')`, and encodes as Base64url
6
+ * in the URL hash `#codelab=<base64url>`.
7
+ */
8
+
9
+ export interface WorkspaceSharePayload {
10
+ lang?: string;
11
+ activeFile?: string | null;
12
+ files: Record<string, string>;
13
+ stdin?: string;
14
+ }
15
+
16
+ function bufferToBase64Url(uint8: Uint8Array): string {
17
+ let binary = '';
18
+ for (let i = 0; i < uint8.length; i++) {
19
+ binary += String.fromCharCode(uint8[i]);
20
+ }
21
+ const base64 = typeof btoa !== 'undefined' ? btoa(binary) : Buffer.from(uint8).toString('base64');
22
+ return base64.replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
23
+ }
24
+
25
+ function base64UrlToBuffer(base64url: string): Uint8Array {
26
+ let base64 = base64url.replace(/-/g, '+').replace(/_/g, '/');
27
+ while (base64.length % 4) {
28
+ base64 += '=';
29
+ }
30
+ if (typeof atob !== 'undefined') {
31
+ const binary = atob(base64);
32
+ const bytes = new Uint8Array(binary.length);
33
+ for (let i = 0; i < binary.length; i++) {
34
+ bytes[i] = binary.charCodeAt(i);
35
+ }
36
+ return bytes;
37
+ }
38
+ return new Uint8Array(Buffer.from(base64, 'base64'));
39
+ }
40
+
41
+ /**
42
+ * Compresses workspace payload into a compact Base64url string.
43
+ */
44
+ export async function compressWorkspaceSnapshot(payload: WorkspaceSharePayload): Promise<string> {
45
+ const jsonStr = JSON.stringify(payload);
46
+ const encoder = new TextEncoder();
47
+ const rawBytes = encoder.encode(jsonStr);
48
+
49
+ if (typeof CompressionStream !== 'undefined') {
50
+ const cs = new CompressionStream('deflate-raw');
51
+ const writer = cs.writable.getWriter();
52
+ writer.write(rawBytes);
53
+ writer.close();
54
+
55
+ const response = new Response(cs.readable);
56
+ const compressedBuffer = await response.arrayBuffer();
57
+ return bufferToBase64Url(new Uint8Array(compressedBuffer));
58
+ }
59
+
60
+ // Fallback: uncompressed Base64url if CompressionStream unsupported
61
+ return bufferToBase64Url(rawBytes);
62
+ }
63
+
64
+ /**
65
+ * Decompresses a Base64url string into workspace snapshot payload.
66
+ */
67
+ export async function decompressWorkspaceSnapshot(encoded: string): Promise<WorkspaceSharePayload | null> {
68
+ if (!encoded || typeof encoded !== 'string') return null;
69
+ try {
70
+ const bytes = base64UrlToBuffer(encoded);
71
+
72
+ if (typeof DecompressionStream !== 'undefined') {
73
+ try {
74
+ const ds = new DecompressionStream('deflate-raw');
75
+ const writer = ds.writable.getWriter();
76
+ writer.write(bytes as any);
77
+ writer.close();
78
+
79
+ const response = new Response(ds.readable);
80
+ const decompressed = await response.arrayBuffer();
81
+ const text = new TextDecoder().decode(decompressed);
82
+ return JSON.parse(text);
83
+ } catch (err) {
84
+ // Fallback for uncompressed raw JSON payload
85
+ void err;
86
+ const rawText = new TextDecoder().decode(bytes);
87
+ return JSON.parse(rawText);
88
+ }
89
+ }
90
+
91
+ const rawText = new TextDecoder().decode(bytes);
92
+ return JSON.parse(rawText);
93
+ } catch (err) {
94
+ if (typeof console !== 'undefined' && console.warn) {
95
+ console.warn('[CodeLab Share Snapshot Restore Error]:', err);
96
+ }
97
+ return null;
98
+ }
99
+ }
@@ -0,0 +1,200 @@
1
+ /**
2
+ * @innovatorved/code-lab — Workbench CSS Tokens, Themes & Styles
3
+ */
4
+
5
+ export const WORKBENCH_STYLES = `
6
+ /* ── Split Run Button ── */
7
+ .codelab-btn-split {
8
+ display: inline-flex;
9
+ align-items: stretch;
10
+ border-radius: var(--cl-radius, 6px);
11
+ overflow: visible;
12
+ position: relative;
13
+ }
14
+ .codelab-btn-split .codelab-btn-split__main {
15
+ border-top-right-radius: 0;
16
+ border-bottom-right-radius: 0;
17
+ border-right: 1px solid rgba(255, 255, 255, 0.2);
18
+ }
19
+ .codelab-btn-split .codelab-btn-split__trigger {
20
+ border-top-left-radius: 0;
21
+ border-bottom-left-radius: 0;
22
+ padding: 0 6px;
23
+ min-width: 24px;
24
+ }
25
+ .codelab-split-menu {
26
+ position: absolute;
27
+ top: calc(100% + 4px);
28
+ right: 0;
29
+ background: var(--cl-bg-elevated, #252526);
30
+ border: 1px solid var(--cl-border, #3c3c3c);
31
+ border-radius: var(--cl-radius, 6px);
32
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
33
+ z-index: 1000;
34
+ min-width: 220px;
35
+ padding: 4px 0;
36
+ display: none;
37
+ }
38
+ .codelab-split-menu.open {
39
+ display: block;
40
+ }
41
+ .codelab-split-menu__item {
42
+ display: flex;
43
+ align-items: center;
44
+ justify-content: space-between;
45
+ width: 100%;
46
+ padding: 6px 12px;
47
+ background: none;
48
+ border: none;
49
+ color: var(--cl-fg, #cccccc);
50
+ font-size: 12px;
51
+ cursor: pointer;
52
+ text-align: left;
53
+ }
54
+ .codelab-split-menu__item:hover {
55
+ background: var(--cl-accent, #007acc);
56
+ color: #ffffff;
57
+ }
58
+
59
+ /* ── Command Palette Trigger Pill ── */
60
+ .codelab-cmd-trigger {
61
+ display: inline-flex;
62
+ align-items: center;
63
+ gap: 6px;
64
+ padding: 3px 10px;
65
+ border-radius: var(--cl-radius, 6px);
66
+ background: var(--cl-input-bg, rgba(255, 255, 255, 0.06));
67
+ border: 1px solid var(--cl-border, #3c3c3c);
68
+ color: var(--cl-fg-muted, #858585);
69
+ font-size: 11px;
70
+ cursor: pointer;
71
+ transition: all 0.15s ease;
72
+ }
73
+ .codelab-cmd-trigger:hover {
74
+ background: var(--cl-input-bg-focus, rgba(255, 255, 255, 0.12));
75
+ color: var(--cl-fg, #cccccc);
76
+ border-color: var(--cl-accent, #007acc);
77
+ }
78
+
79
+ /* ── HUD Telemetry Pill ── */
80
+ .codelab-hud-pill {
81
+ display: inline-flex;
82
+ align-items: center;
83
+ gap: 8px;
84
+ padding: 2px 10px;
85
+ border-radius: 12px;
86
+ background: var(--cl-hud-bg, rgba(0, 122, 204, 0.15));
87
+ border: 1px solid var(--cl-hud-border, rgba(0, 122, 204, 0.35));
88
+ color: var(--cl-hud-fg, #4fc1ff);
89
+ font-family: var(--cl-font-mono, monospace);
90
+ font-size: 11px;
91
+ font-weight: 500;
92
+ letter-spacing: 0.3px;
93
+ margin-left: auto;
94
+ user-select: none;
95
+ }
96
+ .codelab-hud-pill__metric {
97
+ display: inline-flex;
98
+ align-items: center;
99
+ gap: 4px;
100
+ }
101
+
102
+ /* ── Stdin / Custom Input Panel ── */
103
+ .codelab-stdin-panel {
104
+ display: flex;
105
+ flex-direction: column;
106
+ height: 100%;
107
+ padding: 8px 12px;
108
+ background: var(--cl-bg-editor, #1e1e1e);
109
+ box-sizing: border-box;
110
+ }
111
+ .codelab-stdin-panel__header {
112
+ display: flex;
113
+ align-items: center;
114
+ justify-content: space-between;
115
+ margin-bottom: 6px;
116
+ font-size: 11px;
117
+ color: var(--cl-fg-muted, #858585);
118
+ font-weight: 600;
119
+ text-transform: uppercase;
120
+ letter-spacing: 0.5px;
121
+ }
122
+ .codelab-stdin-panel__textarea {
123
+ flex: 1;
124
+ width: 100%;
125
+ background: var(--cl-input-bg, #252526);
126
+ border: 1px solid var(--cl-border, #3c3c3c);
127
+ border-radius: var(--cl-radius, 4px);
128
+ color: var(--cl-fg, #cccccc);
129
+ font-family: var(--cl-font-mono, monospace);
130
+ font-size: 12px;
131
+ line-height: 1.5;
132
+ padding: 8px;
133
+ resize: none;
134
+ outline: none;
135
+ box-sizing: border-box;
136
+ }
137
+ .codelab-stdin-panel__textarea:focus {
138
+ border-color: var(--cl-accent, #007acc);
139
+ }
140
+
141
+ /* ── Problems Drawer Tab ── */
142
+ .codelab-problems-list {
143
+ display: flex;
144
+ flex-direction: column;
145
+ overflow-y: auto;
146
+ height: 100%;
147
+ padding: 4px 0;
148
+ }
149
+ .codelab-problem-item {
150
+ display: flex;
151
+ align-items: center;
152
+ gap: 8px;
153
+ padding: 5px 12px;
154
+ font-size: 12px;
155
+ font-family: var(--cl-font-mono, monospace);
156
+ cursor: pointer;
157
+ border-bottom: 1px solid rgba(255, 255, 255, 0.04);
158
+ }
159
+ .codelab-problem-item:hover {
160
+ background: var(--cl-tree-hover, rgba(255, 255, 255, 0.06));
161
+ }
162
+ .codelab-problem-item--error {
163
+ color: #f14c4c;
164
+ }
165
+ .codelab-problem-item--warning {
166
+ color: #cca700;
167
+ }
168
+ .codelab-problem-item--info {
169
+ color: #3794ff;
170
+ }
171
+ .codelab-problem-item__location {
172
+ color: var(--cl-fg-muted, #858585);
173
+ font-size: 11px;
174
+ margin-left: auto;
175
+ }
176
+
177
+ /* ── Monaco Side-by-Side Diff Editor ── */
178
+ .codelab-diff-container {
179
+ display: flex;
180
+ flex-direction: column;
181
+ width: 100%;
182
+ height: 100%;
183
+ background: var(--cl-bg-editor, #1e1e1e);
184
+ }
185
+ .codelab-diff-toolbar {
186
+ display: flex;
187
+ align-items: center;
188
+ gap: 8px;
189
+ padding: 6px 12px;
190
+ background: var(--cl-bg-panel, #252526);
191
+ border-bottom: 1px solid var(--cl-border, #3c3c3c);
192
+ font-size: 12px;
193
+ }
194
+ .codelab-diff-host {
195
+ flex: 1;
196
+ width: 100%;
197
+ height: calc(100% - 36px);
198
+ position: relative;
199
+ }
200
+ `;
@@ -0,0 +1,171 @@
1
+ /**
2
+ * @innovatorved/code-lab — Topbar Navigation & Contextual Execution Controls
3
+ */
4
+
5
+ import { CL_ICONS } from './icons';
6
+
7
+ export interface ToolbarRenderOptions {
8
+ workbench: any;
9
+ title: string;
10
+ backLabel: string;
11
+ hasGuidedLab: boolean;
12
+ mode: string;
13
+ activeFile: string | null;
14
+ enabledLanguages: Set<string>;
15
+ currentLang: string;
16
+ hasWebContent: boolean;
17
+ activeServerCount: number;
18
+ }
19
+
20
+ export function renderLanguageSwitcherHtml(workbench: any): string {
21
+ const enabled = workbench.enabledLanguages || new Set(['js']);
22
+ const showTs = enabled.has('ts');
23
+ const showCpp = enabled.has('cpp');
24
+ const showPy = enabled.has('py');
25
+
26
+ const count = (enabled.has('js') ? 1 : 0) + (showTs ? 1 : 0) + (showCpp ? 1 : 0) + (showPy ? 1 : 0);
27
+ if (count <= 1) return '';
28
+
29
+ const activeLang = workbench.lang || 'js';
30
+
31
+ return `
32
+ <span class="codelab-toolbar__sep" aria-hidden="true"></span>
33
+ <div class="codelab-lang-switch codelab-segmented" role="tablist" aria-label="Language">
34
+ <button type="button" role="tab" aria-selected="${activeLang === 'js'}" class="codelab-segmented__btn ${activeLang === 'js' ? 'active' : ''}" data-cl-lang="js" title="JavaScript (Node.js &amp; Bun runtime)">JS</button>
35
+ ${showTs ? `<button type="button" role="tab" aria-selected="${activeLang === 'ts'}" class="codelab-segmented__btn ${activeLang === 'ts' ? 'active' : ''}" data-cl-lang="ts" title="TypeScript (Instant in-browser transpile)">TS</button>` : ''}
36
+ ${showCpp ? `<button type="button" role="tab" aria-selected="${activeLang === 'cpp'}" class="codelab-segmented__btn ${activeLang === 'cpp' ? 'active' : ''}" data-cl-lang="cpp" title="C++20 (WASI Clang/LLVM WebAssembly compiler)">C++</button>` : ''}
37
+ ${showPy ? `<button type="button" role="tab" aria-selected="${activeLang === 'py'}" class="codelab-segmented__btn ${activeLang === 'py' ? 'active' : ''}" data-cl-lang="py" title="Python 3.12 (CPython WebAssembly via Pyodide)">PY</button>` : ''}
38
+ </div>
39
+ `;
40
+ }
41
+
42
+ export function renderToolbarHtml(opts: ToolbarRenderOptions): string {
43
+ const { workbench, title, backLabel, hasGuidedLab, mode, activeFile, hasWebContent, activeServerCount } = opts;
44
+ const isGuided = Boolean(hasGuidedLab && mode === 'guided');
45
+ const brandLabel = title || 'code-lab';
46
+
47
+ const testFileExists = Boolean(
48
+ workbench._findEntryFile && workbench._findEntryFile('test') !== null
49
+ );
50
+
51
+ return `
52
+ <div class="codelab-topbar codelab-toolbar">
53
+ <div class="codelab-topbar__left">
54
+ ${workbench.onClose ? `
55
+ <button type="button" class="codelab-btn codelab-btn--back" data-cl-action="close-lab" title="${backLabel}">
56
+ ${CL_ICONS.arrowLeft}
57
+ <span>${backLabel}</span>
58
+ </button>
59
+ ` : ''}
60
+ <span class="codelab-brand ${workbench.onClose ? 'codelab-brand--with-back' : ''}" title="${brandLabel}">
61
+ <span class="codelab-brand__dot"></span>
62
+ <span>${brandLabel}</span>
63
+ </span>
64
+
65
+ ${hasGuidedLab ? `
66
+ <span class="codelab-toolbar__sep" aria-hidden="true"></span>
67
+ <div class="codelab-mode-switch" role="tablist" aria-label="Lab Mode">
68
+ <button type="button" role="tab" aria-selected="${mode === 'guided'}" class="codelab-mode-btn ${mode === 'guided' ? 'active' : ''}" data-cl-mode="guided">
69
+ ${CL_ICONS.target}
70
+ <span>Guided Challenge</span>
71
+ </button>
72
+ <button type="button" role="tab" aria-selected="${mode === 'sandbox'}" class="codelab-mode-btn ${mode === 'sandbox' ? 'active' : ''}" data-cl-mode="sandbox">
73
+ ${CL_ICONS.code}
74
+ <span>Reference Sandbox</span>
75
+ </button>
76
+ </div>
77
+ ` : ''}
78
+
79
+ ${renderLanguageSwitcherHtml(workbench)}
80
+
81
+ <span class="codelab-toolbar__sep" aria-hidden="true"></span>
82
+ <button type="button" class="codelab-cmd-trigger" data-cl-action="command-palette" title="Open Command Palette (⌘K / ⇧⌘P)">
83
+ ${CL_ICONS.search}
84
+ <span>Command Palette</span>
85
+ <kbd style="opacity:0.7">⇧⌘P</kbd>
86
+ </button>
87
+ </div>
88
+
89
+ <div class="codelab-topbar__right">
90
+ <button type="button" class="codelab-btn codelab-btn--stop" id="cl-stop-btn" data-cl-action="stop-run" title="Stop Running Execution" style="display:none">
91
+ ${CL_ICONS.stop}
92
+ <span>Stop</span>
93
+ </button>
94
+
95
+ ${isGuided ? `
96
+ <button type="button" class="codelab-btn codelab-btn--run" data-cl-action="run-demo" title="Run Demo Script (⇧⌘↵)">
97
+ ${CL_ICONS.play}
98
+ <span>Run Demo</span>
99
+ <span class="codelab-btn__kbd">⇧⌘↵</span>
100
+ </button>
101
+ <button type="button" class="codelab-btn codelab-btn--test" id="cl-primary-exec-btn" data-cl-action="verify-step" title="Verify Current Step (⌘↵)">
102
+ ${CL_ICONS.check}
103
+ <span>Verify Step</span>
104
+ <span class="codelab-btn__kbd">⌘↵</span>
105
+ </button>
106
+ ` : `
107
+ <div class="codelab-btn-split">
108
+ <button type="button" class="codelab-btn codelab-btn--run codelab-btn-split__main" data-cl-action="run-code" title="Run Code (⌘↵)">
109
+ ${CL_ICONS.play}
110
+ <span>Run Code</span>
111
+ <span class="codelab-btn__kbd">⌘↵</span>
112
+ </button>
113
+ <button type="button" class="codelab-btn codelab-btn--run codelab-btn-split__trigger" id="cl-split-run-trigger" title="More Execution Options" aria-haspopup="true">
114
+ ${CL_ICONS.chevronDown}
115
+ </button>
116
+ <div class="codelab-split-menu" id="cl-split-run-menu">
117
+ <button type="button" class="codelab-split-menu__item" data-cl-action="run-entry">
118
+ <span>▶ Run Entry / Demo</span> <kbd style="opacity:0.6">⌘↵</kbd>
119
+ </button>
120
+ <button type="button" class="codelab-split-menu__item" data-cl-action="run-active-file">
121
+ <span>▶ Run Active File (${activeFile || 'active'})</span> <kbd style="opacity:0.6">⇧⌘↵</kbd>
122
+ </button>
123
+ ${testFileExists ? `
124
+ <button type="button" class="codelab-split-menu__item" data-cl-action="run-tests">
125
+ <span>✓ Run Test Suite</span>
126
+ </button>
127
+ ` : ''}
128
+ <button type="button" class="codelab-split-menu__item" data-cl-action="open-stdin">
129
+ <span>⌨ Configure Stdin / Input...</span>
130
+ </button>
131
+ </div>
132
+ </div>
133
+ `}
134
+
135
+ ${hasWebContent ? `
136
+ <button type="button" class="codelab-btn codelab-btn--icon" id="cl-preview-app-btn" data-cl-action="preview-app" title="Run &amp; Preview in Browser" aria-label="Run and Preview in Browser">
137
+ ${CL_ICONS.globe}
138
+ ${activeServerCount > 0 ? `<span class="codelab-port-badge" style="position:absolute;top:2px;right:2px;font-size:9px;background:#007acc;color:#fff;border-radius:6px;padding:0 3px;">${activeServerCount}</span>` : ''}
139
+ </button>
140
+ ` : ''}
141
+
142
+ <button type="button" class="codelab-btn codelab-btn--icon" data-cl-action="share-snapshot" title="Share Snapshot Link (#codelab=...)" aria-label="Share Snapshot Link">
143
+ ${CL_ICONS.share}
144
+ </button>
145
+
146
+ <span class="codelab-toolbar__sep" aria-hidden="true"></span>
147
+
148
+ ${hasGuidedLab ? `
149
+ <button type="button" class="codelab-btn codelab-btn--icon" id="cl-toggle-guide-btn" data-cl-action="toggle-guide" title="Toggle Guide Panel" aria-label="Toggle Guide Panel">
150
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2"/><path d="M9 3v18"/></svg>
151
+ </button>
152
+ ` : ''}
153
+
154
+ <button type="button" class="codelab-btn codelab-btn--icon" id="cl-toggle-drawer-btn" data-cl-action="toggle-drawer" title="Toggle Bottom Drawer" aria-label="Toggle Bottom Drawer">
155
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2"/><path d="M3 15h18"/></svg>
156
+ </button>
157
+
158
+ <button type="button" class="codelab-btn codelab-btn--icon" id="cl-fullscreen-btn" data-cl-action="toggle-fullscreen" title="Toggle Fullscreen IDE (Esc to exit)" aria-label="Toggle Fullscreen IDE">
159
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"/></svg>
160
+ </button>
161
+
162
+ ${workbench.onClose ? `
163
+ <button type="button" class="codelab-btn codelab-btn--exit-lab codelab-btn--close-ide" id="cl-close-ide-btn" data-cl-action="close-lab" title="Exit Lab" aria-label="Exit Lab">
164
+ <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/><polyline points="16 17 21 12 16 7"/><line x1="21" y1="12" x2="9" y2="12"/></svg>
165
+ <span class="codelab-btn__label">Exit</span>
166
+ </button>
167
+ ` : ''}
168
+ </div>
169
+ </div>
170
+ `;
171
+ }