@innovatorved/code-lab 0.6.0 → 0.7.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/ARCHITECTURE.md +1 -1
- package/CHANGELOG.md +23 -0
- package/README.md +38 -1
- package/dist/code-lab-sql.css +87 -64
- package/dist/code-lab-sql.esm.js +109 -86
- package/dist/code-lab-sql.umd.js +110 -87
- package/dist/code-lab.css +1 -1
- package/dist/code-lab.d.ts +19 -1
- package/dist/code-lab.esm.js +1261 -900
- package/dist/code-lab.js +1260 -899
- package/dist/code-lab.umd.js +1260 -899
- package/dist/extensions/cpp.esm.js +9 -0
- package/dist/extensions/cpp.js +9 -0
- package/dist/extensions/guided-lab.esm.js +9 -0
- package/dist/extensions/guided-lab.js +9 -0
- package/dist/extensions/python.esm.js +9 -0
- package/dist/extensions/python.js +9 -0
- package/dist/index.d.ts +1 -1
- package/dist/packages/sql/src/styles.d.ts +1 -1
- package/dist/packages/ui/src/settings-dialog.d.ts +2 -0
- package/dist/preview-sw.js +1 -1
- package/dist/runtime.esm.js +70 -70
- package/dist/runtime.js +70 -70
- package/dist/schemas.d.ts +13 -1
- package/dist/schemas.esm.js +9 -0
- package/dist/schemas.js +9 -0
- package/dist/shell.esm.js +250 -244
- package/dist/shell.js +250 -244
- package/dist/terminal.esm.js +1 -1
- package/dist/terminal.js +1 -1
- package/dist/workbench/index.d.ts +1 -1
- package/dist/workbench/intellisense.d.ts +1 -1
- package/dist/workbench/styles.d.ts +1 -1
- package/package.json +1 -1
- package/packages/commands/package.json +1 -1
- package/packages/core/package.json +1 -1
- package/packages/editor/package.json +1 -1
- package/packages/fs/package.json +1 -1
- package/packages/preview/package.json +1 -1
- package/packages/runtime/package.json +1 -1
- package/packages/settings/package.json +1 -1
- package/packages/settings/src/builtin-schemas.ts +16 -0
- package/packages/sql/package.json +1 -1
- package/packages/sql/src/styles.ts +87 -64
- package/packages/terminal/package.json +1 -1
- package/packages/ui/package.json +1 -1
- package/packages/ui/src/observability.ts +12 -14
- package/packages/ui/src/settings-dialog.ts +409 -57
- package/packages/ui/src/themes.ts +78 -78
- package/src/code-lab.css +757 -310
- package/src/index.ts +1 -1
- package/src/runtime.ts +29 -3
- package/src/schemas.ts +10 -1
- package/src/shell.ts +106 -16
- package/src/workbench/diff-editor.ts +5 -1
- package/src/workbench/drawer.ts +5 -5
- package/src/workbench/icons.ts +5 -5
- package/src/workbench/intellisense.ts +94 -82
- package/src/workbench/styles.ts +58 -54
- package/src/workbench/toolbar.ts +1 -1
- package/src/workbench/xterm-adapter.ts +61 -56
- package/src/workbench.ts +462 -173
package/src/index.ts
CHANGED
package/src/runtime.ts
CHANGED
|
@@ -7714,6 +7714,8 @@ function __initVirtualRuntime(rootScope) {
|
|
|
7714
7714
|
return isDeepEqual(a, b, true);
|
|
7715
7715
|
}
|
|
7716
7716
|
|
|
7717
|
+
const activeBunServers = new Set();
|
|
7718
|
+
|
|
7717
7719
|
const BunObj = {
|
|
7718
7720
|
version: '1.1.0',
|
|
7719
7721
|
serve(opts = {}) {
|
|
@@ -7724,6 +7726,7 @@ function __initVirtualRuntime(rootScope) {
|
|
|
7724
7726
|
hostname,
|
|
7725
7727
|
development: false,
|
|
7726
7728
|
stop() {
|
|
7729
|
+
activeBunServers.delete(serverObj);
|
|
7727
7730
|
activePortTable.unregisterServer(port);
|
|
7728
7731
|
}
|
|
7729
7732
|
};
|
|
@@ -7735,6 +7738,7 @@ function __initVirtualRuntime(rootScope) {
|
|
|
7735
7738
|
fetch: opts.fetch ? opts.fetch.bind(serverObj) : undefined,
|
|
7736
7739
|
stop: () => serverObj.stop()
|
|
7737
7740
|
});
|
|
7741
|
+
activeBunServers.add(serverObj);
|
|
7738
7742
|
return serverObj;
|
|
7739
7743
|
},
|
|
7740
7744
|
file(p) {
|
|
@@ -9012,13 +9016,31 @@ function __initVirtualRuntime(rootScope) {
|
|
|
9012
9016
|
}
|
|
9013
9017
|
}
|
|
9014
9018
|
|
|
9019
|
+
const hasLiveServers = () => {
|
|
9020
|
+
if (vhttp.hasActiveServers()) return true;
|
|
9021
|
+
if (activeBunServers.size > 0) {
|
|
9022
|
+
for (const srv of Array.from(activeBunServers)) {
|
|
9023
|
+
if (!activePortTable.getServer(srv.port)) {
|
|
9024
|
+
activeBunServers.delete(srv);
|
|
9025
|
+
}
|
|
9026
|
+
}
|
|
9027
|
+
return activeBunServers.size > 0;
|
|
9028
|
+
}
|
|
9029
|
+
return false;
|
|
9030
|
+
};
|
|
9031
|
+
|
|
9015
9032
|
const deadline = performance.now() + timeoutMs;
|
|
9016
9033
|
let idleTicks = 0;
|
|
9017
|
-
while (!hasExited
|
|
9034
|
+
while (!hasExited) {
|
|
9018
9035
|
if (signal && signal.aborted) {
|
|
9019
9036
|
handleSigint();
|
|
9020
9037
|
break;
|
|
9021
9038
|
}
|
|
9039
|
+
const liveServers = hasLiveServers();
|
|
9040
|
+
const holdForInteractiveServer = Boolean(!isBackground && signal && liveServers);
|
|
9041
|
+
if (!holdForInteractiveServer && performance.now() >= deadline) {
|
|
9042
|
+
break;
|
|
9043
|
+
}
|
|
9022
9044
|
await Promise.resolve();
|
|
9023
9045
|
await Promise.resolve();
|
|
9024
9046
|
const busy =
|
|
@@ -9026,7 +9048,7 @@ function __initVirtualRuntime(rootScope) {
|
|
|
9026
9048
|
resourceTracker.activeImmediates.size > 0 ||
|
|
9027
9049
|
resourceTracker.inFlightHttp.size > 0 ||
|
|
9028
9050
|
resourceTracker.pendingTests.size > 0 ||
|
|
9029
|
-
(isBackground
|
|
9051
|
+
((isBackground || Boolean(signal)) && liveServers);
|
|
9030
9052
|
|
|
9031
9053
|
if (!busy) {
|
|
9032
9054
|
idleTicks++;
|
|
@@ -9034,7 +9056,7 @@ function __initVirtualRuntime(rootScope) {
|
|
|
9034
9056
|
} else {
|
|
9035
9057
|
idleTicks = 0;
|
|
9036
9058
|
}
|
|
9037
|
-
await new Promise((r) => setTimeout(r, 2));
|
|
9059
|
+
await new Promise((r) => setTimeout(r, holdForInteractiveServer ? 25 : 2));
|
|
9038
9060
|
}
|
|
9039
9061
|
} catch (err) {
|
|
9040
9062
|
if (err && err._isProcessExit) {
|
|
@@ -9070,6 +9092,10 @@ function __initVirtualRuntime(rootScope) {
|
|
|
9070
9092
|
if (!isBackground) {
|
|
9071
9093
|
vhttp.closeAllServers();
|
|
9072
9094
|
vnet.closeAllServers();
|
|
9095
|
+
for (const srv of Array.from(activeBunServers)) {
|
|
9096
|
+
try { srv.stop(); } catch (err) { _runtimeLogger.debug('executeInVirtualRuntime bun server stop failed', err); }
|
|
9097
|
+
}
|
|
9098
|
+
activeBunServers.clear();
|
|
9073
9099
|
if (initialOpenFds && typeof vfs._listOpenFds === 'function' && typeof vfs.closeSync === 'function') {
|
|
9074
9100
|
for (const fd of vfs._listOpenFds()) {
|
|
9075
9101
|
if (!initialOpenFds.has(fd)) {
|
package/src/schemas.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as z from 'zod';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Zod Schemas and Inferred TypeScript Types for code-lab v0.
|
|
4
|
+
* Zod Schemas and Inferred TypeScript Types for code-lab v0.7.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
// ── 1. Guided Step ──────────────────────────────────────────────────────────
|
|
@@ -259,6 +259,15 @@ export const WorkbenchOptionsSchema = z.object({
|
|
|
259
259
|
mode: z.enum(['guided', 'sandbox']).optional(),
|
|
260
260
|
language: LanguageIdSchema.optional(),
|
|
261
261
|
lang: LanguageIdSchema.optional(),
|
|
262
|
+
showLanguageSelector: z.boolean().optional(),
|
|
263
|
+
sqlDialect: z.enum(['postgres', 'sqlite']).optional(),
|
|
264
|
+
sqlFiles: z.record(z.string(), z.string()).optional(),
|
|
265
|
+
settings: z.record(z.string(), z.any()).optional(),
|
|
266
|
+
userSettings: z.record(z.string(), z.any()).optional(),
|
|
267
|
+
defaultSettings: z.record(z.string(), z.any()).optional(),
|
|
268
|
+
config: z.record(z.string(), z.any()).optional(),
|
|
269
|
+
overrides: z.record(z.string(), z.any()).optional(),
|
|
270
|
+
lockSettings: z.boolean().optional(),
|
|
262
271
|
stepIndex: z.number().int().optional(),
|
|
263
272
|
onStepComplete: z.function({ input: [z.any(), z.number()], output: z.void() }).optional(),
|
|
264
273
|
onLabComplete: z.function({ input: [z.string()], output: z.void() }).optional()
|
package/src/shell.ts
CHANGED
|
@@ -3535,7 +3535,7 @@
|
|
|
3535
3535
|
if (scriptArgs && scriptArgs.length > 0) {
|
|
3536
3536
|
cmd += ' ' + scriptArgs.map(quoteShellArg).join(' ');
|
|
3537
3537
|
}
|
|
3538
|
-
const fallback = tryDevScriptFallback(scriptName, cmd, ctx);
|
|
3538
|
+
const fallback = await tryDevScriptFallback(scriptName, cmd, ctx);
|
|
3539
3539
|
if (fallback) return fallback;
|
|
3540
3540
|
const binPrefix = `${PosixPath.join(ctx.cwd || '/workspace', 'node_modules/.bin')}:/workspace/node_modules/.bin`;
|
|
3541
3541
|
const scriptEnv = {
|
|
@@ -3547,6 +3547,7 @@
|
|
|
3547
3547
|
env: scriptEnv,
|
|
3548
3548
|
stdin: ctx.stdin,
|
|
3549
3549
|
signal: ctx.signal,
|
|
3550
|
+
isBackground: ctx.isBackground,
|
|
3550
3551
|
onStdout: ctx.onStdout,
|
|
3551
3552
|
onStderr: ctx.onStderr,
|
|
3552
3553
|
onRequestStdin: ctx.onRequestStdin || (ctx.shell && ctx.shell.options ? ctx.shell.options.onRequestStdin : undefined)
|
|
@@ -4100,31 +4101,96 @@
|
|
|
4100
4101
|
// Common dev-server commands that cannot run inside the virtual runtime are
|
|
4101
4102
|
// transparently redirected to the built-in preview server.
|
|
4102
4103
|
const PREVIEW_TOOL_RE = /\b(vite|ng|astro|next|webpack|parcel|esbuild|snowpack|react-scripts|serve|http-server)\b/;
|
|
4104
|
+
const NATIVE_DEV_SERVER_RE = /^(vite|ng|astro|next|webpack|parcel|esbuild|snowpack|react-scripts)$/;
|
|
4103
4105
|
// The same tools, when typed directly at the prompt (`ng serve`, `vite`).
|
|
4104
4106
|
// `serve` is omitted: it is a first-class builtin shell command.
|
|
4105
4107
|
const DIRECT_DEV_TOOL_RE = /^(vite|ng|astro|next|webpack|parcel|esbuild|snowpack|react-scripts|http-server)$/;
|
|
4106
4108
|
|
|
4107
|
-
|
|
4109
|
+
/**
|
|
4110
|
+
* Holds a foreground interactive server command open until Ctrl+C (SIGINT)
|
|
4111
|
+
* or external port shutdown, unregistering the port cleanly on interrupt.
|
|
4112
|
+
*/
|
|
4113
|
+
async function waitForForegroundServer(entry, ctx, banner) {
|
|
4114
|
+
const portTable = ctx && ctx.shell ? ctx.shell.portTable : null;
|
|
4115
|
+
const isInteractiveFg = Boolean(ctx && !ctx.isBackground && ctx.signal);
|
|
4116
|
+
if (!isInteractiveFg) {
|
|
4117
|
+
return { code: 0, stdout: banner, stderr: '' };
|
|
4118
|
+
}
|
|
4119
|
+
|
|
4120
|
+
const fullBanner = `${banner.replace(/\n+$/, '')}\n ➜ Press Ctrl+C to stop\n\n`;
|
|
4121
|
+
if (typeof ctx.onStdout === 'function') {
|
|
4122
|
+
ctx.onStdout(fullBanner);
|
|
4123
|
+
}
|
|
4124
|
+
|
|
4125
|
+
const closeServer = () => {
|
|
4126
|
+
if (entry && entry.server && typeof entry.server.close === 'function') {
|
|
4127
|
+
try { entry.server.close(); } catch (err) { _shellLogger.debug('Foreground server close failed.', err); }
|
|
4128
|
+
} else if (portTable && typeof portTable.unregisterServer === 'function' && entry) {
|
|
4129
|
+
try { portTable.unregisterServer(entry.port); } catch (err) { _shellLogger.debug('Foreground server unregister failed.', err); }
|
|
4130
|
+
}
|
|
4131
|
+
};
|
|
4132
|
+
|
|
4133
|
+
if (ctx.signal.aborted) {
|
|
4134
|
+
closeServer();
|
|
4135
|
+
return { code: 130, stdout: fullBanner, stderr: '', alreadyStreamed: typeof ctx.onStdout === 'function', aborted: true };
|
|
4136
|
+
}
|
|
4137
|
+
|
|
4138
|
+
return await new Promise((resolve) => {
|
|
4139
|
+
let settled = false;
|
|
4140
|
+
const cleanup = () => {
|
|
4141
|
+
if (ctx.signal && typeof ctx.signal.removeEventListener === 'function') {
|
|
4142
|
+
try { ctx.signal.removeEventListener('abort', onAbort); } catch (_) { void _; }
|
|
4143
|
+
}
|
|
4144
|
+
if (portTable && typeof portTable.off === 'function') {
|
|
4145
|
+
try { portTable.off('close', onPortClose); } catch (_) { void _; }
|
|
4146
|
+
}
|
|
4147
|
+
};
|
|
4148
|
+
const finish = (code, aborted) => {
|
|
4149
|
+
if (settled) return;
|
|
4150
|
+
settled = true;
|
|
4151
|
+
cleanup();
|
|
4152
|
+
resolve({
|
|
4153
|
+
code,
|
|
4154
|
+
stdout: fullBanner,
|
|
4155
|
+
stderr: '',
|
|
4156
|
+
alreadyStreamed: typeof ctx.onStdout === 'function',
|
|
4157
|
+
aborted
|
|
4158
|
+
});
|
|
4159
|
+
};
|
|
4160
|
+
const onAbort = () => {
|
|
4161
|
+
closeServer();
|
|
4162
|
+
finish(130, true);
|
|
4163
|
+
};
|
|
4164
|
+
const onPortClose = (closedPort, closedEntry) => {
|
|
4165
|
+
if (entry && Number(closedPort) === Number(entry.port) && (!closedEntry || closedEntry === entry)) {
|
|
4166
|
+
finish(0, false);
|
|
4167
|
+
}
|
|
4168
|
+
};
|
|
4169
|
+
ctx.signal.addEventListener('abort', onAbort, { once: true });
|
|
4170
|
+
if (portTable && typeof portTable.on === 'function') {
|
|
4171
|
+
portTable.on('close', onPortClose);
|
|
4172
|
+
}
|
|
4173
|
+
});
|
|
4174
|
+
}
|
|
4175
|
+
|
|
4176
|
+
async function tryDevScriptFallback(scriptName, cmd, ctx, opts) {
|
|
4108
4177
|
if (!PREVIEW_TOOL_RE.test(cmd)) return null;
|
|
4109
|
-
// Only fall back when the referenced tool is not actually installed.
|
|
4110
4178
|
const bin = (cmd.match(PREVIEW_TOOL_RE) || [])[1];
|
|
4111
4179
|
const force = Boolean(opts && opts.force);
|
|
4112
4180
|
const binPath = PosixPath.join('/workspace/node_modules/.bin', bin);
|
|
4113
|
-
|
|
4181
|
+
const isInstalled = ctx.vfs.existsSync(binPath);
|
|
4182
|
+
if (!force && !NATIVE_DEV_SERVER_RE.test(bin) && isInstalled) return null;
|
|
4114
4183
|
const portMatch = cmd.match(/--port(?:=|\s+)(\d+)/);
|
|
4115
4184
|
const defaultPorts = { ng: 4200, vite: 5173, astro: 4321, next: 3000 };
|
|
4116
4185
|
const port = portMatch ? Number(portMatch[1]) : (defaultPorts[bin] || 3000);
|
|
4117
4186
|
const rootDir = typeof ctx.resolvePath === 'function' ? ctx.resolvePath('.') : (ctx.cwd || '/workspace');
|
|
4118
4187
|
const entry = registerPreviewServer(ctx, rootDir, port);
|
|
4119
4188
|
if (!entry) return null;
|
|
4120
|
-
const note = force
|
|
4189
|
+
const note = (force || isInstalled)
|
|
4121
4190
|
? `${bin} is a native dev server and cannot execute inside this virtual runtime — using the CodeLab preview server instead.`
|
|
4122
4191
|
: `${bin} is not available in this virtual runtime — using the CodeLab preview server instead.`;
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
stdout: `\n> ${scriptName}\n> ${cmd}\n\n ${note}\n\n ➜ Local: http://127.0.0.1:${entry.port}/\n\n`,
|
|
4126
|
-
stderr: ''
|
|
4127
|
-
};
|
|
4192
|
+
const banner = `\n> ${scriptName}\n> ${cmd}\n\n ${note}\n\n ➜ Local: http://127.0.0.1:${entry.port}/\n\n`;
|
|
4193
|
+
return await waitForForegroundServer(entry, ctx, banner);
|
|
4128
4194
|
}
|
|
4129
4195
|
|
|
4130
4196
|
function evaluatePosixTest(args, ctx) {
|
|
@@ -7625,6 +7691,33 @@
|
|
|
7625
7691
|
return { code: 0, stdout: 'Python 3.12.8 (CPython WebAssembly via Pyodide)\n', stderr: '' };
|
|
7626
7692
|
}
|
|
7627
7693
|
|
|
7694
|
+
if (args[0] === '-m' && args[1] === 'http.server') {
|
|
7695
|
+
let port = 8000;
|
|
7696
|
+
let dirArg = '.';
|
|
7697
|
+
for (let i = 2; i < args.length; i++) {
|
|
7698
|
+
const a = args[i];
|
|
7699
|
+
if ((a === '-d' || a === '--directory') && args[i + 1]) {
|
|
7700
|
+
dirArg = args[++i];
|
|
7701
|
+
} else if (a.startsWith('--directory=')) {
|
|
7702
|
+
dirArg = a.slice('--directory='.length) || '.';
|
|
7703
|
+
} else if (a === '-b' || a === '--bind') {
|
|
7704
|
+
i++;
|
|
7705
|
+
} else if (/^\d+$/.test(a)) {
|
|
7706
|
+
port = Number(a);
|
|
7707
|
+
}
|
|
7708
|
+
}
|
|
7709
|
+
const rootDir = ctx.resolvePath(dirArg);
|
|
7710
|
+
if (!ctx.vfs.existsSync(rootDir)) {
|
|
7711
|
+
return { code: 1, stdout: '', stderr: `python3: http.server: ${dirArg}: No such file or directory\n` };
|
|
7712
|
+
}
|
|
7713
|
+
const entry = registerPreviewServer(ctx, rootDir, port);
|
|
7714
|
+
if (!entry) {
|
|
7715
|
+
return { code: 1, stdout: '', stderr: 'python3: http.server: no virtual port table available\n' };
|
|
7716
|
+
}
|
|
7717
|
+
const banner = `Serving HTTP on 127.0.0.1 port ${entry.port} (http://127.0.0.1:${entry.port}/) ...\n`;
|
|
7718
|
+
return await waitForForegroundServer(entry, ctx, banner);
|
|
7719
|
+
}
|
|
7720
|
+
|
|
7628
7721
|
const pyCompiler =
|
|
7629
7722
|
(ctx.shell && ctx.shell.options && ctx.shell.options.pythonCompiler) ||
|
|
7630
7723
|
(typeof globalThis !== 'undefined' && globalThis.__codelabPythonCompiler) ||
|
|
@@ -8249,11 +8342,8 @@
|
|
|
8249
8342
|
if (!entry) {
|
|
8250
8343
|
return { code: 1, stdout: '', stderr: 'serve: no virtual port table available\n' };
|
|
8251
8344
|
}
|
|
8252
|
-
|
|
8253
|
-
|
|
8254
|
-
stdout: `\n ⚡ CodeLab preview server\n\n ➜ Local: http://127.0.0.1:${entry.port}/\n ➜ Root: ${rootDir}\n ➜ Preview: open the Web Preview drawer for port ${entry.port}\n\n`,
|
|
8255
|
-
stderr: ''
|
|
8256
|
-
};
|
|
8345
|
+
const banner = `\n ⚡ CodeLab preview server\n\n ➜ Local: http://127.0.0.1:${entry.port}/\n ➜ Root: ${rootDir}\n ➜ Preview: open the Web Preview drawer for port ${entry.port}\n\n`;
|
|
8346
|
+
return await waitForForegroundServer(entry, ctx, banner);
|
|
8257
8347
|
},
|
|
8258
8348
|
|
|
8259
8349
|
// -----------------------------------------------------------------------
|
|
@@ -10803,7 +10893,7 @@
|
|
|
10803
10893
|
// this runtime — whether or not it was installed — so route it to the
|
|
10804
10894
|
// built-in preview server rather than reporting a misleading "command
|
|
10805
10895
|
// not found".
|
|
10806
|
-
const fb = tryDevScriptFallback(cmdName, [cmdName, ...args].join(' '), cmdCtx, { force: true });
|
|
10896
|
+
const fb = await tryDevScriptFallback(cmdName, [cmdName, ...args].join(' '), cmdCtx, { force: true });
|
|
10807
10897
|
res = fb || { code: 127, stdout: '', stderr: `shell: ${cmdName}: command not found\n` };
|
|
10808
10898
|
} else if (typeof this.options.onProcessSpawn === 'function') {
|
|
10809
10899
|
const spawned = await this.options.onProcessSpawn(cmdName, args, {
|
|
@@ -206,6 +206,7 @@ export class CodeLabDiffEditorManager {
|
|
|
206
206
|
automaticLayout: true,
|
|
207
207
|
minimap: { enabled: false },
|
|
208
208
|
scrollBeyondLastLine: false,
|
|
209
|
+
fontFamily: '"Geist Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, monospace',
|
|
209
210
|
fontSize: Number(this.workbench._editorFontSize) || 13
|
|
210
211
|
});
|
|
211
212
|
|
|
@@ -288,6 +289,7 @@ export class CodeLabDiffEditorManager {
|
|
|
288
289
|
automaticLayout: true,
|
|
289
290
|
minimap: { enabled: false },
|
|
290
291
|
scrollBeyondLastLine: false,
|
|
292
|
+
fontFamily: '"Geist Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, monospace',
|
|
291
293
|
fontSize: Number(this.workbench?._editorFontSize) || 13
|
|
292
294
|
});
|
|
293
295
|
|
|
@@ -361,7 +363,9 @@ export class CodeLabDiffEditorManager {
|
|
|
361
363
|
renderSideBySide: true,
|
|
362
364
|
automaticLayout: true,
|
|
363
365
|
minimap: { enabled: false },
|
|
364
|
-
scrollBeyondLastLine: false
|
|
366
|
+
scrollBeyondLastLine: false,
|
|
367
|
+
fontFamily: '"Geist Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, monospace',
|
|
368
|
+
fontSize: Number(this.workbench._editorFontSize) || 13
|
|
365
369
|
});
|
|
366
370
|
|
|
367
371
|
const lang = getMonacoLanguageForFile(file, this.workbench.lang);
|
package/src/workbench/drawer.ts
CHANGED
|
@@ -64,7 +64,7 @@ export function renderDrawerTabsHtml(opts: DrawerTabOptions): string {
|
|
|
64
64
|
<button type="button" role="tab" aria-selected="${drawerTab === 'problems'}" class="codelab-drawer__tab ${drawerTab === 'problems' ? 'active' : ''}" data-cl-drawertab="problems" title="Compiler & Runtime Problems">
|
|
65
65
|
${CL_ICONS.warning}
|
|
66
66
|
<span>Problems</span>
|
|
67
|
-
<span class="codelab-badge ${problemsCount > 0 ? 'codelab-badge--warn' : ''}" id="cl-problems-count"
|
|
67
|
+
<span class="codelab-badge ${problemsCount > 0 ? 'codelab-badge--warn' : ''}" id="cl-problems-count">${problemsCount}</span>
|
|
68
68
|
</button>
|
|
69
69
|
|
|
70
70
|
<button type="button" role="tab" aria-selected="${drawerTab === 'tests'}" class="codelab-drawer__tab ${drawerTab === 'tests' ? 'active' : ''}" data-cl-drawertab="tests">
|
|
@@ -100,8 +100,8 @@ export function renderDrawerTabsHtml(opts: DrawerTabOptions): string {
|
|
|
100
100
|
|
|
101
101
|
${formatTelemetryHud(lastDurationMs, lastPeakMemoryBytes, workbench.lang || 'js')}
|
|
102
102
|
|
|
103
|
-
<div class="codelab-drawer__actions"
|
|
104
|
-
<button type="button" class="codelab-btn codelab-btn--icon" data-cl-action="toggle-drawer" title="Minimize/Expand Drawer" aria-label="Minimize or Expand Drawer"
|
|
103
|
+
<div class="codelab-drawer__actions">
|
|
104
|
+
<button type="button" class="codelab-btn codelab-btn--icon" data-cl-action="toggle-drawer" title="Minimize/Expand Drawer" aria-label="Minimize or Expand Drawer">
|
|
105
105
|
${CL_ICONS.chevronsUpDown}
|
|
106
106
|
</button>
|
|
107
107
|
</div>
|
|
@@ -115,7 +115,7 @@ export function renderProblemsPanelHtml(workbench: any): string {
|
|
|
115
115
|
|
|
116
116
|
if (items.length === 0) {
|
|
117
117
|
return `
|
|
118
|
-
<div
|
|
118
|
+
<div class="cl-ui-empty-center">
|
|
119
119
|
${CL_ICONS.check}
|
|
120
120
|
<span>No problems detected in workspace.</span>
|
|
121
121
|
</div>
|
|
@@ -149,7 +149,7 @@ export function renderStdinPanelHtml(workbench: any): string {
|
|
|
149
149
|
<div class="codelab-stdin-panel">
|
|
150
150
|
<div class="codelab-stdin-panel__header">
|
|
151
151
|
<span>Standard Input (std::cin / sys.stdin / process.stdin)</span>
|
|
152
|
-
<button type="button" class="codelab-btn codelab-btn--sm" id="cl-stdin-clear-btn"
|
|
152
|
+
<button type="button" class="codelab-btn codelab-btn--sm" id="cl-stdin-clear-btn">Clear</button>
|
|
153
153
|
</div>
|
|
154
154
|
<textarea class="codelab-stdin-panel__textarea" id="cl-stdin-textarea" placeholder="Paste custom input lines here for DSA / competitive programming...">${val}</textarea>
|
|
155
155
|
</div>
|
package/src/workbench/icons.ts
CHANGED
|
@@ -150,15 +150,15 @@ export const CL_ICONS: Record<string, string> = {
|
|
|
150
150
|
collapseAll:
|
|
151
151
|
'<svg aria-hidden="true" width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"><rect x="2.5" y="3.5" width="9" height="9" rx="1"/><path d="M6.5 2h6a1 1 0 0 1 1 1v6"/><line x1="5" y1="8" x2="9" y2="8"/></svg>',
|
|
152
152
|
symbolFunction:
|
|
153
|
-
'<svg aria-hidden="true" width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="#
|
|
153
|
+
'<svg aria-hidden="true" width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="#c084fc" stroke-width="1.4"><rect x="2" y="2" width="12" height="12" rx="2"/><path d="M9.5 5.5H8a1 1 0 0 0-1 1v5M6 8h3.5"/></svg>',
|
|
154
154
|
symbolClass:
|
|
155
|
-
'<svg aria-hidden="true" width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="#
|
|
155
|
+
'<svg aria-hidden="true" width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="#fb923c" stroke-width="1.4"><circle cx="5" cy="8" r="2.2"/><circle cx="11.5" cy="5" r="1.8"/><circle cx="11.5" cy="11" r="1.8"/><line x1="7" y1="7" x2="9.8" y2="5.6"/><line x1="7" y1="9" x2="9.8" y2="10.4"/></svg>',
|
|
156
156
|
symbolVariable:
|
|
157
|
-
'<svg aria-hidden="true" width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="#
|
|
157
|
+
'<svg aria-hidden="true" width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="#a1a1aa" stroke-width="1.4"><rect x="2" y="3.5" width="12" height="9" rx="1.5"/><path d="M6 6.5l2 3 2-3"/></svg>'
|
|
158
158
|
};
|
|
159
159
|
|
|
160
160
|
function badgeSvg(bg: string, fg: string, text: string, fontSize = 7.2): string {
|
|
161
|
-
return `<svg class="codelab-seti-icon" aria-hidden="true" width="16" height="16" viewBox="0 0 16 16"><rect x="1.5" y="1.5" width="13" height="13" rx="2.2" fill="${bg}"/><text x="8" y="11" text-anchor="middle" fill="${fg}" font-family="
|
|
161
|
+
return `<svg class="codelab-seti-icon" aria-hidden="true" width="16" height="16" viewBox="0 0 16 16"><rect x="1.5" y="1.5" width="13" height="13" rx="2.2" fill="${bg}"/><text x="8" y="11" text-anchor="middle" fill="${fg}" font-family="'Geist',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif" font-size="${fontSize}" font-weight="700">${text}</text></svg>`;
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
/**
|
|
@@ -199,7 +199,7 @@ export function getFileIconSvg(filename: string, isOpenFolder?: boolean): string
|
|
|
199
199
|
return `<svg class="codelab-seti-icon" aria-hidden="true" width="16" height="16" viewBox="0 0 16 16" fill="none"><circle cx="8" cy="8" r="1.6" fill="#00d8ff"/><ellipse cx="8" cy="8" rx="6" ry="2.4" stroke="#00d8ff" stroke-width="1.1"/><ellipse cx="8" cy="8" rx="6" ry="2.4" stroke="#00d8ff" stroke-width="1.1" transform="rotate(60 8 8)"/><ellipse cx="8" cy="8" rx="6" ry="2.4" stroke="#00d8ff" stroke-width="1.1" transform="rotate(120 8 8)"/></svg>`;
|
|
200
200
|
case 'json':
|
|
201
201
|
case 'jsonc':
|
|
202
|
-
return `<svg class="codelab-seti-icon" aria-hidden="true" width="16" height="16" viewBox="0 0 16 16"><text x="8" y="11.5" text-anchor="middle" fill="#cbcb41" font-family="monospace" font-size="11" font-weight="700">{}</text></svg>`;
|
|
202
|
+
return `<svg class="codelab-seti-icon" aria-hidden="true" width="16" height="16" viewBox="0 0 16 16"><text x="8" y="11.5" text-anchor="middle" fill="#cbcb41" font-family="'Geist Mono',ui-monospace,monospace" font-size="11" font-weight="700">{}</text></svg>`;
|
|
203
203
|
case 'py':
|
|
204
204
|
case 'pyi':
|
|
205
205
|
return badgeSvg('#3572a5', '#ffd43b', 'PY', 7);
|
|
@@ -419,7 +419,7 @@ const TSCONFIG_JSON_SCHEMA = {
|
|
|
419
419
|
const registeredMonacoInstances = new WeakSet<object>();
|
|
420
420
|
|
|
421
421
|
/**
|
|
422
|
-
* Registers
|
|
422
|
+
* Registers Charcoal Ink (Dark), Warm Paper (Light), and High Contrast themes on Monaco.
|
|
423
423
|
*/
|
|
424
424
|
export function registerCodeLabMonacoThemes(monaco: MonacoNamespaceLike | null | undefined): boolean {
|
|
425
425
|
if (!monaco || !monaco.editor || typeof monaco.editor.defineTheme !== 'function') {
|
|
@@ -430,61 +430,61 @@ export function registerCodeLabMonacoThemes(monaco: MonacoNamespaceLike | null |
|
|
|
430
430
|
base: 'vs-dark',
|
|
431
431
|
inherit: true,
|
|
432
432
|
rules: [
|
|
433
|
-
{ token: 'comment', foreground: '
|
|
434
|
-
{ token: 'keyword', foreground: '
|
|
435
|
-
{ token: 'keyword.control', foreground: '
|
|
436
|
-
{ token: 'keyword.operator', foreground: '
|
|
437
|
-
{ token: 'storage', foreground: '
|
|
438
|
-
{ token: 'type', foreground: '
|
|
439
|
-
{ token: 'type.identifier', foreground: '
|
|
440
|
-
{ token: 'class', foreground: '
|
|
441
|
-
{ token: 'interface', foreground: '
|
|
442
|
-
{ token: 'function', foreground: '
|
|
443
|
-
{ token: 'identifier.function', foreground: '
|
|
444
|
-
{ token: 'variable', foreground: '
|
|
445
|
-
{ token: 'variable.predefined', foreground: '
|
|
446
|
-
{ token: 'constant', foreground: '
|
|
447
|
-
{ token: 'string', foreground: '
|
|
448
|
-
{ token: 'string.key.json', foreground: '
|
|
449
|
-
{ token: 'string.value.json', foreground: '
|
|
450
|
-
{ token: 'number', foreground: '
|
|
451
|
-
{ token: 'regexp', foreground: '
|
|
452
|
-
{ token: 'tag', foreground: '
|
|
453
|
-
{ token: 'attribute.name', foreground: '
|
|
454
|
-
{ token: 'attribute.value', foreground: '
|
|
455
|
-
{ token: 'delimiter', foreground: '
|
|
433
|
+
{ token: 'comment', foreground: '8E8E97', fontStyle: 'italic' },
|
|
434
|
+
{ token: 'keyword', foreground: 'F87171' },
|
|
435
|
+
{ token: 'keyword.control', foreground: 'F87171' },
|
|
436
|
+
{ token: 'keyword.operator', foreground: 'D4D4D8' },
|
|
437
|
+
{ token: 'storage', foreground: 'F87171' },
|
|
438
|
+
{ token: 'type', foreground: 'FB923C' },
|
|
439
|
+
{ token: 'type.identifier', foreground: 'FB923C' },
|
|
440
|
+
{ token: 'class', foreground: 'FB923C' },
|
|
441
|
+
{ token: 'interface', foreground: 'FB923C' },
|
|
442
|
+
{ token: 'function', foreground: 'C084FC' },
|
|
443
|
+
{ token: 'identifier.function', foreground: 'C084FC' },
|
|
444
|
+
{ token: 'variable', foreground: 'E4E4E7' },
|
|
445
|
+
{ token: 'variable.predefined', foreground: '93C5FD' },
|
|
446
|
+
{ token: 'constant', foreground: '93C5FD' },
|
|
447
|
+
{ token: 'string', foreground: '86EFAC' },
|
|
448
|
+
{ token: 'string.key.json', foreground: 'E4E4E7' },
|
|
449
|
+
{ token: 'string.value.json', foreground: '86EFAC' },
|
|
450
|
+
{ token: 'number', foreground: 'FCD34D' },
|
|
451
|
+
{ token: 'regexp', foreground: 'FCA5A5' },
|
|
452
|
+
{ token: 'tag', foreground: 'F87171' },
|
|
453
|
+
{ token: 'attribute.name', foreground: 'FCD34D' },
|
|
454
|
+
{ token: 'attribute.value', foreground: '86EFAC' },
|
|
455
|
+
{ token: 'delimiter', foreground: 'A1A1AA' }
|
|
456
456
|
],
|
|
457
457
|
colors: {
|
|
458
|
-
'editor.background': '#
|
|
459
|
-
'editor.foreground': '#
|
|
460
|
-
'editorLineNumber.foreground': '#
|
|
461
|
-
'editorLineNumber.activeForeground': '#
|
|
462
|
-
'editorCursor.foreground': '#
|
|
463
|
-
'editor.selectionBackground': '#
|
|
464
|
-
'editor.inactiveSelectionBackground': '#
|
|
465
|
-
'editor.lineHighlightBackground': '#
|
|
458
|
+
'editor.background': '#0f0f10',
|
|
459
|
+
'editor.foreground': '#f4f4f5',
|
|
460
|
+
'editorLineNumber.foreground': '#6e6e77',
|
|
461
|
+
'editorLineNumber.activeForeground': '#f4f4f5',
|
|
462
|
+
'editorCursor.foreground': '#f4f4f5',
|
|
463
|
+
'editor.selectionBackground': '#28282b',
|
|
464
|
+
'editor.inactiveSelectionBackground': '#1f1f22',
|
|
465
|
+
'editor.lineHighlightBackground': '#18181a99',
|
|
466
466
|
'editor.lineHighlightBorder': '#00000000',
|
|
467
|
-
'editorGutter.background': '#
|
|
468
|
-
'editorGutter.modifiedBackground': '#
|
|
469
|
-
'editorGutter.addedBackground': '#
|
|
470
|
-
'editorGutter.deletedBackground': '#
|
|
471
|
-
'editorWidget.background': '#
|
|
472
|
-
'editorWidget.border': '#
|
|
473
|
-
'editorSuggestWidget.background': '#
|
|
474
|
-
'editorSuggestWidget.border': '#
|
|
475
|
-
'editorSuggestWidget.selectedBackground': '#
|
|
476
|
-
'editorSuggestWidget.highlightForeground': '#
|
|
477
|
-
'editorHoverWidget.background': '#
|
|
478
|
-
'editorHoverWidget.border': '#
|
|
479
|
-
'editorIndentGuide.background1': '#
|
|
480
|
-
'editorIndentGuide.activeBackground1': '#
|
|
481
|
-
'editorBracketMatch.background': '#
|
|
482
|
-
'editorBracketMatch.border': '#
|
|
483
|
-
'scrollbarSlider.background': '#
|
|
484
|
-
'scrollbarSlider.hoverBackground': '#
|
|
485
|
-
'scrollbarSlider.activeBackground': '#
|
|
486
|
-
'diffEditor.insertedTextBackground': '#
|
|
487
|
-
'diffEditor.removedTextBackground': '#
|
|
467
|
+
'editorGutter.background': '#0f0f10',
|
|
468
|
+
'editorGutter.modifiedBackground': '#fbbf24',
|
|
469
|
+
'editorGutter.addedBackground': '#34d399',
|
|
470
|
+
'editorGutter.deletedBackground': '#f87171',
|
|
471
|
+
'editorWidget.background': '#18181a',
|
|
472
|
+
'editorWidget.border': '#27272a',
|
|
473
|
+
'editorSuggestWidget.background': '#18181a',
|
|
474
|
+
'editorSuggestWidget.border': '#27272a',
|
|
475
|
+
'editorSuggestWidget.selectedBackground': '#28282b',
|
|
476
|
+
'editorSuggestWidget.highlightForeground': '#ffffff',
|
|
477
|
+
'editorHoverWidget.background': '#18181a',
|
|
478
|
+
'editorHoverWidget.border': '#27272a',
|
|
479
|
+
'editorIndentGuide.background1': '#27272a80',
|
|
480
|
+
'editorIndentGuide.activeBackground1': '#3a3a3e',
|
|
481
|
+
'editorBracketMatch.background': '#28282b80',
|
|
482
|
+
'editorBracketMatch.border': '#71717a',
|
|
483
|
+
'scrollbarSlider.background': '#3a3a3e66',
|
|
484
|
+
'scrollbarSlider.hoverBackground': '#52525b99',
|
|
485
|
+
'scrollbarSlider.activeBackground': '#71717acc',
|
|
486
|
+
'diffEditor.insertedTextBackground': '#10b98124',
|
|
487
|
+
'diffEditor.removedTextBackground': '#ef444424'
|
|
488
488
|
}
|
|
489
489
|
});
|
|
490
490
|
|
|
@@ -492,38 +492,50 @@ export function registerCodeLabMonacoThemes(monaco: MonacoNamespaceLike | null |
|
|
|
492
492
|
base: 'vs',
|
|
493
493
|
inherit: true,
|
|
494
494
|
rules: [
|
|
495
|
-
{ token: 'comment', foreground: '
|
|
496
|
-
{ token: 'keyword', foreground: '
|
|
497
|
-
{ token: 'keyword.control', foreground: '
|
|
498
|
-
{ token: 'type', foreground: '
|
|
499
|
-
{ token: 'type.identifier', foreground: '
|
|
500
|
-
{ token: 'function', foreground: '
|
|
501
|
-
{ token: '
|
|
502
|
-
{ token: '
|
|
503
|
-
{ token: '
|
|
504
|
-
{ token: '
|
|
505
|
-
{ token: '
|
|
506
|
-
{ token: '
|
|
495
|
+
{ token: 'comment', foreground: '6E6A64', fontStyle: 'italic' },
|
|
496
|
+
{ token: 'keyword', foreground: 'C2410C' },
|
|
497
|
+
{ token: 'keyword.control', foreground: 'C2410C' },
|
|
498
|
+
{ token: 'type', foreground: '9A3412' },
|
|
499
|
+
{ token: 'type.identifier', foreground: '9A3412' },
|
|
500
|
+
{ token: 'function', foreground: '6D28D9' },
|
|
501
|
+
{ token: 'identifier.function', foreground: '6D28D9' },
|
|
502
|
+
{ token: 'variable', foreground: '18181B' },
|
|
503
|
+
{ token: 'constant', foreground: '1D4ED8' },
|
|
504
|
+
{ token: 'string', foreground: '067647' },
|
|
505
|
+
{ token: 'string.key.json', foreground: '18181B' },
|
|
506
|
+
{ token: 'string.value.json', foreground: '067647' },
|
|
507
|
+
{ token: 'number', foreground: 'B54708' },
|
|
508
|
+
{ token: 'tag', foreground: 'C2410C' },
|
|
509
|
+
{ token: 'attribute.name', foreground: '9A3412' },
|
|
510
|
+
{ token: 'attribute.value', foreground: '067647' },
|
|
511
|
+
{ token: 'delimiter', foreground: '52525B' }
|
|
507
512
|
],
|
|
508
513
|
colors: {
|
|
509
514
|
'editor.background': '#ffffff',
|
|
510
|
-
'editor.foreground': '#
|
|
511
|
-
'editorLineNumber.foreground': '#
|
|
512
|
-
'editorLineNumber.activeForeground': '#
|
|
513
|
-
'editorCursor.foreground': '#
|
|
514
|
-
'editor.selectionBackground': '#
|
|
515
|
-
'editor.
|
|
515
|
+
'editor.foreground': '#18181b',
|
|
516
|
+
'editorLineNumber.foreground': '#8a8680',
|
|
517
|
+
'editorLineNumber.activeForeground': '#18181b',
|
|
518
|
+
'editorCursor.foreground': '#18181b',
|
|
519
|
+
'editor.selectionBackground': '#e6e4df',
|
|
520
|
+
'editor.inactiveSelectionBackground': '#f1f1ee',
|
|
521
|
+
'editor.lineHighlightBackground': '#f7f7f5',
|
|
516
522
|
'editor.lineHighlightBorder': '#00000000',
|
|
517
523
|
'editorGutter.background': '#ffffff',
|
|
518
|
-
'
|
|
519
|
-
'
|
|
520
|
-
'
|
|
521
|
-
'
|
|
522
|
-
'
|
|
523
|
-
'
|
|
524
|
-
'
|
|
525
|
-
'
|
|
526
|
-
'
|
|
524
|
+
'editorGutter.modifiedBackground': '#b54708',
|
|
525
|
+
'editorGutter.addedBackground': '#067647',
|
|
526
|
+
'editorGutter.deletedBackground': '#b42318',
|
|
527
|
+
'editorWidget.background': '#f7f7f5',
|
|
528
|
+
'editorWidget.border': '#e6e4df',
|
|
529
|
+
'editorSuggestWidget.background': '#f7f7f5',
|
|
530
|
+
'editorSuggestWidget.border': '#e6e4df',
|
|
531
|
+
'editorSuggestWidget.selectedBackground': '#ecebe7',
|
|
532
|
+
'editorSuggestWidget.highlightForeground': '#09090b',
|
|
533
|
+
'editorHoverWidget.background': '#f7f7f5',
|
|
534
|
+
'editorHoverWidget.border': '#e6e4df',
|
|
535
|
+
'editorIndentGuide.background1': '#e6e4df',
|
|
536
|
+
'editorIndentGuide.activeBackground1': '#d3d0c9',
|
|
537
|
+
'diffEditor.insertedTextBackground': '#0676471f',
|
|
538
|
+
'diffEditor.removedTextBackground': '#b423181a'
|
|
527
539
|
}
|
|
528
540
|
});
|
|
529
541
|
|
|
@@ -534,8 +546,8 @@ export function registerCodeLabMonacoThemes(monaco: MonacoNamespaceLike | null |
|
|
|
534
546
|
colors: {
|
|
535
547
|
'editor.background': '#000000',
|
|
536
548
|
'editor.foreground': '#ffffff',
|
|
537
|
-
'editor.selectionBackground': '#
|
|
538
|
-
'contrastBorder': '#
|
|
549
|
+
'editor.selectionBackground': '#3f3f46',
|
|
550
|
+
'contrastBorder': '#ffffff'
|
|
539
551
|
}
|
|
540
552
|
});
|
|
541
553
|
return true;
|