@innovatorved/code-lab 0.7.0 → 0.7.1

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 (129) hide show
  1. package/ARCHITECTURE.md +2 -2
  2. package/CHANGELOG.md +20 -0
  3. package/README.md +2 -2
  4. package/dist/apps/web/src/index.d.ts +0 -9
  5. package/dist/code-lab-sql.esm.js +19 -19
  6. package/dist/code-lab-sql.umd.js +20 -20
  7. package/dist/code-lab.css +1 -1
  8. package/dist/code-lab.d.ts +1 -1
  9. package/dist/code-lab.esm.js +679 -1439
  10. package/dist/code-lab.js +678 -1438
  11. package/dist/extensions/cpp.esm.js +132 -8760
  12. package/dist/extensions/cpp.js +124 -8770
  13. package/dist/extensions/guided-lab.esm.js +33 -6836
  14. package/dist/extensions/guided-lab.js +33 -6854
  15. package/dist/extensions/javascript.esm.js +1 -36
  16. package/dist/extensions/javascript.js +1 -58
  17. package/dist/extensions/python.esm.js +79 -8118
  18. package/dist/extensions/python.js +79 -8136
  19. package/dist/extensions/typescript.esm.js +1 -55
  20. package/dist/extensions/typescript.js +1 -77
  21. package/dist/modular-kernel.d.ts +0 -4
  22. package/dist/preview-sw.js +1 -1
  23. package/dist/runtime.esm.js +77 -77
  24. package/dist/runtime.js +77 -77
  25. package/dist/schemas.d.ts +9 -0
  26. package/dist/schemas.esm.js +33 -6815
  27. package/dist/schemas.js +33 -6831
  28. package/dist/shell.esm.js +33 -33
  29. package/dist/shell.js +33 -33
  30. package/dist/terminal.esm.js +8 -6
  31. package/dist/terminal.js +6 -6
  32. package/dist/workbench/command-palette.d.ts +0 -4
  33. package/dist/workbench/index.d.ts +0 -20
  34. package/dist/workbench/intellisense.d.ts +1 -7
  35. package/package.json +3 -10
  36. package/src/code-lab.css +4 -502
  37. package/src/extensions/cpp.ts +11 -29
  38. package/src/extensions/guided-lab.ts +6 -2
  39. package/src/extensions/python.ts +9 -3
  40. package/src/modular-kernel.ts +0 -4
  41. package/src/runtime.ts +124 -39
  42. package/src/schemas.ts +2 -2
  43. package/src/shell.ts +3 -0
  44. package/src/terminal.ts +4 -2
  45. package/src/workbench/command-palette.ts +22 -302
  46. package/src/workbench/diff-editor.ts +2 -0
  47. package/src/workbench/icons.ts +1 -1
  48. package/src/workbench/index.ts +0 -15
  49. package/src/workbench/intellisense.ts +17 -4
  50. package/src/workbench.ts +68 -375
  51. package/dist/code-lab.umd.js +0 -6117
  52. package/dist/packages/editor/src/index.d.ts +0 -118
  53. package/dist/packages/preview/src/index.d.ts +0 -34
  54. package/dist/packages/runtime/src/index.d.ts +0 -47
  55. package/dist/packages/terminal/src/index.d.ts +0 -54
  56. package/dist/workbench/drawer.d.ts +0 -18
  57. package/dist/workbench/file-tree.d.ts +0 -11
  58. package/dist/workbench/guided-pane.d.ts +0 -11
  59. package/dist/workbench/styles.d.ts +0 -4
  60. package/dist/workbench/toolbar.d.ts +0 -17
  61. package/packages/commands/README.md +0 -7
  62. package/packages/commands/package.json +0 -16
  63. package/packages/commands/src/index.ts +0 -467
  64. package/packages/commands/tsconfig.json +0 -22
  65. package/packages/core/README.md +0 -12
  66. package/packages/core/package.json +0 -13
  67. package/packages/core/src/di.ts +0 -147
  68. package/packages/core/src/disposable.ts +0 -112
  69. package/packages/core/src/errors.ts +0 -205
  70. package/packages/core/src/events.ts +0 -157
  71. package/packages/core/src/index.ts +0 -49
  72. package/packages/core/src/path.ts +0 -118
  73. package/packages/core/src/registry.ts +0 -61
  74. package/packages/core/tsconfig.json +0 -19
  75. package/packages/editor/README.md +0 -9
  76. package/packages/editor/package.json +0 -18
  77. package/packages/editor/src/index.ts +0 -344
  78. package/packages/editor/tsconfig.json +0 -24
  79. package/packages/fs/README.md +0 -7
  80. package/packages/fs/package.json +0 -16
  81. package/packages/fs/src/backends.ts +0 -301
  82. package/packages/fs/src/index.ts +0 -18
  83. package/packages/fs/src/types.ts +0 -44
  84. package/packages/fs/src/vfs-service.ts +0 -257
  85. package/packages/fs/tsconfig.json +0 -22
  86. package/packages/preview/README.md +0 -3
  87. package/packages/preview/package.json +0 -16
  88. package/packages/preview/src/index.ts +0 -125
  89. package/packages/preview/tsconfig.json +0 -22
  90. package/packages/runtime/README.md +0 -3
  91. package/packages/runtime/package.json +0 -17
  92. package/packages/runtime/src/index.ts +0 -134
  93. package/packages/runtime/tsconfig.json +0 -23
  94. package/packages/settings/README.md +0 -7
  95. package/packages/settings/package.json +0 -16
  96. package/packages/settings/src/builtin-schemas.ts +0 -262
  97. package/packages/settings/src/configuration-service.ts +0 -609
  98. package/packages/settings/src/index.ts +0 -38
  99. package/packages/settings/src/jsonc.ts +0 -189
  100. package/packages/settings/src/schema.ts +0 -164
  101. package/packages/settings/tsconfig.json +0 -22
  102. package/packages/sql/README.md +0 -12
  103. package/packages/sql/package.json +0 -13
  104. package/packages/sql/src/completions.ts +0 -359
  105. package/packages/sql/src/diagnostics.ts +0 -200
  106. package/packages/sql/src/formatter.ts +0 -271
  107. package/packages/sql/src/index.ts +0 -54
  108. package/packages/sql/src/sql-editor.ts +0 -802
  109. package/packages/sql/src/styles.ts +0 -524
  110. package/packages/sql/src/tokenizer.ts +0 -457
  111. package/packages/sql/src/types.ts +0 -148
  112. package/packages/sql/tsconfig.json +0 -19
  113. package/packages/terminal/README.md +0 -3
  114. package/packages/terminal/package.json +0 -16
  115. package/packages/terminal/src/index.ts +0 -183
  116. package/packages/terminal/tsconfig.json +0 -22
  117. package/packages/ui/README.md +0 -8
  118. package/packages/ui/package.json +0 -18
  119. package/packages/ui/src/index.ts +0 -40
  120. package/packages/ui/src/observability.ts +0 -173
  121. package/packages/ui/src/plugin-registry.ts +0 -289
  122. package/packages/ui/src/settings-dialog.ts +0 -939
  123. package/packages/ui/src/themes.ts +0 -333
  124. package/packages/ui/tsconfig.json +0 -24
  125. package/src/workbench/drawer.ts +0 -157
  126. package/src/workbench/file-tree.ts +0 -51
  127. package/src/workbench/guided-pane.ts +0 -43
  128. package/src/workbench/styles.ts +0 -211
  129. package/src/workbench/toolbar.ts +0 -182
@@ -1,19 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "ESNext",
5
- "moduleResolution": "bundler",
6
- "lib": ["ES2022"],
7
- "strict": true,
8
- "noImplicitAny": true,
9
- "strictNullChecks": true,
10
- "noUnusedLocals": true,
11
- "noUnusedParameters": true,
12
- "noImplicitReturns": true,
13
- "noFallthroughCasesInSwitch": true,
14
- "noEmit": true,
15
- "skipLibCheck": true,
16
- "forceConsistentCasingInFileNames": true
17
- },
18
- "include": ["src/**/*.ts"]
19
- }
@@ -1,9 +0,0 @@
1
- # `@code-lab/editor`
2
-
3
- Layer 2 (`services`) swappable editor abstraction (`IEditorAdapter` & `EditorService`).
4
-
5
- ## Included Adapters
6
-
7
- - `MonacoEditorAdapter` — wraps a full Monaco `IStandaloneCodeEditor` instance.
8
- - `SqlEditorAdapter` — wraps `@code-lab/sql`'s zero-WASM PostgreSQL 18 / SQLite 3 editor.
9
- - `LightweightEditorAdapter` — minimal `<textarea>` fallback for headless tests and instant boot.
@@ -1,18 +0,0 @@
1
- {
2
- "name": "@code-lab/editor",
3
- "version": "0.7.0",
4
- "description": "Swappable editor service and IEditorAdapter implementations (Monaco, SQL, Lightweight textarea) for CodeLab.",
5
- "type": "module",
6
- "main": "./src/index.ts",
7
- "types": "./src/index.ts",
8
- "exports": {
9
- ".": "./src/index.ts"
10
- },
11
- "dependencies": {
12
- "@code-lab/core": "workspace:*",
13
- "@code-lab/settings": "workspace:*",
14
- "@code-lab/sql": "workspace:*"
15
- },
16
- "sideEffects": false,
17
- "license": "MIT"
18
- }
@@ -1,344 +0,0 @@
1
- import {
2
- createServiceId,
3
- Emitter,
4
- type Event,
5
- type IDisposable,
6
- toDisposable
7
- } from '@code-lab/core';
8
- import type { IConfigurationService } from '@code-lab/settings';
9
- import {
10
- createSqlEditor,
11
- type SqlDiagnostic,
12
- type SqlDialect,
13
- type SqlEditorInstance,
14
- type SqlSchema
15
- } from '@code-lab/sql';
16
-
17
- export interface EditorMarker {
18
- readonly line: number;
19
- readonly column: number;
20
- readonly message: string;
21
- readonly severity: 'error' | 'warning' | 'info';
22
- readonly hint?: string;
23
- }
24
-
25
- export interface EditorDisplayOptions {
26
- readonly fontSize?: number;
27
- readonly tabSize?: number;
28
- readonly wordWrap?: 'off' | 'on' | 'wordWrapColumn';
29
- readonly minimap?: boolean;
30
- readonly lineNumbers?: 'on' | 'off' | 'relative';
31
- readonly readOnly?: boolean;
32
- readonly theme?: 'dark' | 'light' | 'high-contrast';
33
- }
34
-
35
- export interface IEditorAdapter extends IDisposable {
36
- readonly kind: 'monaco' | 'sql' | 'lightweight';
37
- readonly onDidChangeValue: Event<string>;
38
- getValue(): string;
39
- setValue(value: string): void;
40
- getSelection(): string;
41
- insertAtCursor(text: string): void;
42
- setLanguage(languageId: string): void;
43
- setMarkers(markers: readonly EditorMarker[]): void;
44
- applyOptions(options: EditorDisplayOptions): void;
45
- focus(): void;
46
- }
47
-
48
- export interface MonacoEditorLike {
49
- getValue(): string;
50
- setValue(value: string): void;
51
- getModel(): { getValueInRange?: (range: unknown) => string } | null;
52
- getSelection(): unknown;
53
- executeEdits(source: string, edits: Array<{ range: unknown; text: string }>): void;
54
- updateOptions(opts: Record<string, unknown>): void;
55
- focus(): void;
56
- onDidChangeModelContent(cb: () => void): { dispose(): void };
57
- dispose(): void;
58
- }
59
-
60
- export class LightweightEditorAdapter implements IEditorAdapter {
61
- public readonly kind = 'lightweight' as const;
62
- private readonly textarea: HTMLTextAreaElement;
63
- private readonly changeEmitter = new Emitter<string>({ name: 'editor.lightweight.change' });
64
- private readonly cleanup: IDisposable;
65
-
66
- public constructor(container: HTMLElement, initialValue = '') {
67
- const doc = container.ownerDocument ?? document;
68
- this.textarea = doc.createElement('textarea');
69
- this.textarea.className = 'cl-lightweight-editor';
70
- this.textarea.value = initialValue;
71
- this.textarea.spellcheck = false;
72
- container.innerHTML = '';
73
- container.appendChild(this.textarea);
74
-
75
- const onInput = (): void => {
76
- this.changeEmitter.fire(this.textarea.value);
77
- };
78
- this.textarea.addEventListener('input', onInput);
79
- this.cleanup = toDisposable(() => this.textarea.removeEventListener('input', onInput));
80
- }
81
-
82
- public get onDidChangeValue(): Event<string> {
83
- return this.changeEmitter.event;
84
- }
85
-
86
- public getValue(): string {
87
- return this.textarea.value;
88
- }
89
-
90
- public setValue(value: string): void {
91
- this.textarea.value = value;
92
- }
93
-
94
- public getSelection(): string {
95
- const start = this.textarea.selectionStart ?? 0;
96
- const end = this.textarea.selectionEnd ?? 0;
97
- return end > start ? this.textarea.value.slice(start, end) : '';
98
- }
99
-
100
- public insertAtCursor(text: string): void {
101
- const start = this.textarea.selectionStart ?? this.textarea.value.length;
102
- const end = this.textarea.selectionEnd ?? start;
103
- const cur = this.textarea.value;
104
- this.textarea.value = cur.slice(0, start) + text + cur.slice(end);
105
- const pos = start + text.length;
106
- this.textarea.selectionStart = pos;
107
- this.textarea.selectionEnd = pos;
108
- this.changeEmitter.fire(this.textarea.value);
109
- }
110
-
111
- public setLanguage(_languageId: string): void {
112
- // Plain textarea has no syntax grammar
113
- }
114
-
115
- public setMarkers(_markers: readonly EditorMarker[]): void {
116
- // Markers handled externally in Problems panel for plain textarea
117
- }
118
-
119
- public applyOptions(options: EditorDisplayOptions): void {
120
- if (options.fontSize) {
121
- this.textarea.style.fontSize = `${options.fontSize}px`;
122
- }
123
- if (options.wordWrap) {
124
- this.textarea.style.whiteSpace = options.wordWrap === 'off' ? 'pre' : 'pre-wrap';
125
- }
126
- if (options.readOnly !== undefined) {
127
- this.textarea.readOnly = options.readOnly;
128
- }
129
- }
130
-
131
- public focus(): void {
132
- this.textarea.focus();
133
- }
134
-
135
- public dispose(): void {
136
- this.cleanup.dispose();
137
- this.changeEmitter.dispose();
138
- this.textarea.remove();
139
- }
140
- }
141
-
142
- export class SqlEditorAdapter implements IEditorAdapter {
143
- public readonly kind = 'sql' as const;
144
- private readonly sqlEditor: SqlEditorInstance;
145
- private readonly changeEmitter = new Emitter<string>({ name: 'editor.sql.change' });
146
-
147
- public constructor(
148
- container: HTMLElement,
149
- options: {
150
- value?: string;
151
- dialect?: SqlDialect;
152
- schema?: SqlSchema | null;
153
- onRun?: (sql: string, effectiveSql: string) => void;
154
- } = {}
155
- ) {
156
- this.sqlEditor = createSqlEditor(container, {
157
- value: options.value ?? '',
158
- dialect: options.dialect ?? 'postgres',
159
- mode: 'inline',
160
- schema: options.schema ?? null,
161
- onChange: (val) => this.changeEmitter.fire(val),
162
- onRun: (payload) => options.onRun?.(payload.sql, payload.effectiveSql)
163
- });
164
- }
165
-
166
- public get onDidChangeValue(): Event<string> {
167
- return this.changeEmitter.event;
168
- }
169
-
170
- public get underlying(): SqlEditorInstance {
171
- return this.sqlEditor;
172
- }
173
-
174
- public getValue(): string {
175
- return this.sqlEditor.getValue();
176
- }
177
-
178
- public setValue(value: string): void {
179
- this.sqlEditor.setValue(value);
180
- }
181
-
182
- public getSelection(): string {
183
- return this.sqlEditor.getSelection();
184
- }
185
-
186
- public insertAtCursor(text: string): void {
187
- this.sqlEditor.insertAtCursor(text);
188
- }
189
-
190
- public setLanguage(languageId: string): void {
191
- if (languageId === 'sqlite') {
192
- this.sqlEditor.setDialect('sqlite');
193
- } else if (languageId === 'postgres' || languageId === 'sql') {
194
- this.sqlEditor.setDialect('postgres');
195
- }
196
- }
197
-
198
- public setMarkers(markers: readonly EditorMarker[]): void {
199
- const mapped: SqlDiagnostic[] = markers.map((m) => ({
200
- severity: m.severity,
201
- message: m.message,
202
- hint: m.hint,
203
- line: m.line,
204
- column: m.column
205
- }));
206
- this.sqlEditor.setDiagnostics(mapped);
207
- }
208
-
209
- public applyOptions(options: EditorDisplayOptions): void {
210
- if (options.readOnly !== undefined) {
211
- this.sqlEditor.setReadOnly(options.readOnly);
212
- }
213
- if (options.theme) {
214
- this.sqlEditor.setTheme(options.theme === 'light' ? 'light' : 'dark');
215
- }
216
- }
217
-
218
- public focus(): void {
219
- this.sqlEditor.focus();
220
- }
221
-
222
- public dispose(): void {
223
- this.sqlEditor.destroy();
224
- this.changeEmitter.dispose();
225
- }
226
- }
227
-
228
- export class MonacoEditorAdapter implements IEditorAdapter {
229
- public readonly kind = 'monaco' as const;
230
- private readonly editor: MonacoEditorLike;
231
- private readonly changeEmitter = new Emitter<string>({ name: 'editor.monaco.change' });
232
- private readonly modelSub: { dispose(): void };
233
-
234
- public constructor(editorInstance: MonacoEditorLike) {
235
- this.editor = editorInstance;
236
- this.modelSub = this.editor.onDidChangeModelContent(() => {
237
- this.changeEmitter.fire(this.editor.getValue());
238
- });
239
- }
240
-
241
- public get onDidChangeValue(): Event<string> {
242
- return this.changeEmitter.event;
243
- }
244
-
245
- public getValue(): string {
246
- return this.editor.getValue();
247
- }
248
-
249
- public setValue(value: string): void {
250
- if (this.editor.getValue() !== value) {
251
- this.editor.setValue(value);
252
- }
253
- }
254
-
255
- public getSelection(): string {
256
- const model = this.editor.getModel();
257
- const sel = this.editor.getSelection();
258
- if (model && typeof model.getValueInRange === 'function' && sel) {
259
- return model.getValueInRange(sel);
260
- }
261
- return '';
262
- }
263
-
264
- public insertAtCursor(text: string): void {
265
- const sel = this.editor.getSelection();
266
- if (sel) {
267
- this.editor.executeEdits('codelab', [{ range: sel, text }]);
268
- }
269
- }
270
-
271
- public setLanguage(_languageId: string): void {
272
- // Language set on Monaco ITextModel via monaco.editor.setModelLanguage
273
- }
274
-
275
- public setMarkers(_markers: readonly EditorMarker[]): void {
276
- // Markers synced via monaco.editor.setModelMarkers
277
- }
278
-
279
- public applyOptions(options: EditorDisplayOptions): void {
280
- const opts: Record<string, unknown> = {};
281
- if (options.fontSize !== undefined) opts.fontSize = options.fontSize;
282
- if (options.tabSize !== undefined) opts.tabSize = options.tabSize;
283
- if (options.wordWrap !== undefined) opts.wordWrap = options.wordWrap;
284
- if (options.minimap !== undefined) opts.minimap = { enabled: options.minimap };
285
- if (options.lineNumbers !== undefined) opts.lineNumbers = options.lineNumbers;
286
- if (options.readOnly !== undefined) opts.readOnly = options.readOnly;
287
- this.editor.updateOptions(opts);
288
- }
289
-
290
- public focus(): void {
291
- this.editor.focus();
292
- }
293
-
294
- public dispose(): void {
295
- this.modelSub.dispose();
296
- this.changeEmitter.dispose();
297
- this.editor.dispose();
298
- }
299
- }
300
-
301
- export interface IEditorService extends IDisposable {
302
- readonly activeAdapter: IEditorAdapter | undefined;
303
- setActiveAdapter(adapter: IEditorAdapter): void;
304
- syncFromConfiguration(config: IConfigurationService): void;
305
- }
306
-
307
- export const IEditorServiceId = createServiceId<IEditorService>('code-lab.editor');
308
-
309
- export class EditorService implements IEditorService {
310
- private current: IEditorAdapter | undefined;
311
-
312
- public get activeAdapter(): IEditorAdapter | undefined {
313
- return this.current;
314
- }
315
-
316
- public setActiveAdapter(adapter: IEditorAdapter): void {
317
- if (this.current && this.current !== adapter) {
318
- this.current.dispose();
319
- }
320
- this.current = adapter;
321
- }
322
-
323
- public syncFromConfiguration(config: IConfigurationService): void {
324
- if (!this.current) return;
325
- const themeRaw = config.get<string>('workbench.colorTheme', 'dark');
326
- const theme =
327
- themeRaw === 'light' ? 'light' : themeRaw === 'high-contrast' ? 'high-contrast' : 'dark';
328
- this.current.applyOptions({
329
- fontSize: config.get<number>('editor.fontSize', 13),
330
- tabSize: config.get<number>('editor.tabSize', 2),
331
- wordWrap: config.get<'off' | 'on' | 'wordWrapColumn'>('editor.wordWrap', 'off'),
332
- minimap: config.get<boolean>('editor.minimap.enabled', false),
333
- lineNumbers: config.get<'on' | 'off' | 'relative'>('editor.lineNumbers', 'on'),
334
- theme
335
- });
336
- }
337
-
338
- public dispose(): void {
339
- if (this.current) {
340
- this.current.dispose();
341
- this.current = undefined;
342
- }
343
- }
344
- }
@@ -1,24 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "ESNext",
5
- "moduleResolution": "bundler",
6
- "lib": ["ES2022", "DOM"],
7
- "strict": true,
8
- "noImplicitAny": true,
9
- "strictNullChecks": true,
10
- "noUnusedLocals": true,
11
- "noUnusedParameters": true,
12
- "noImplicitReturns": true,
13
- "noFallthroughCasesInSwitch": true,
14
- "noEmit": true,
15
- "skipLibCheck": true,
16
- "forceConsistentCasingInFileNames": true,
17
- "paths": {
18
- "@code-lab/core": ["../core/src/index.ts"],
19
- "@code-lab/settings": ["../settings/src/index.ts"],
20
- "@code-lab/sql": ["../sql/src/index.ts"]
21
- }
22
- },
23
- "include": ["src/**/*.ts"]
24
- }
@@ -1,7 +0,0 @@
1
- # `@code-lab/fs`
2
-
3
- Layer 1 (`platform`) virtual filesystem service (`IFileSystemService`) with hot-swappable storage backends:
4
-
5
- - `MemoryBackend` — fast deterministic in-memory `Uint8Array` storage for tests and ephemeral sandboxes.
6
- - `IndexedDbBackend` — persistent browser IndexedDB storage with automatic in-memory fallback.
7
- - `OpfsBackend` — Origin Private File System (`navigator.storage.getDirectory()`) backend for large workspace trees.
@@ -1,16 +0,0 @@
1
- {
2
- "name": "@code-lab/fs",
3
- "version": "0.7.0",
4
- "description": "Pluggable virtual filesystem service for CodeLab with Memory, IndexedDB, and OPFS backends.",
5
- "type": "module",
6
- "main": "./src/index.ts",
7
- "types": "./src/index.ts",
8
- "exports": {
9
- ".": "./src/index.ts"
10
- },
11
- "dependencies": {
12
- "@code-lab/core": "workspace:*"
13
- },
14
- "sideEffects": false,
15
- "license": "MIT"
16
- }