@innovatorved/code-lab 0.4.0 → 0.5.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 +2 -2
- package/CHANGELOG.md +21 -0
- package/README.md +4 -28
- package/dist/code-lab-sql.esm.js +1 -1
- package/dist/code-lab-sql.umd.js +2 -2
- package/dist/code-lab.css +1553 -98
- package/dist/code-lab.d.ts +1 -1
- package/dist/code-lab.esm.js +11883 -1619
- package/dist/code-lab.js +11882 -1618
- package/dist/code-lab.umd.js +11882 -1618
- package/dist/diagnostics.d.ts +3 -0
- package/dist/extensions/cpp.esm.js +27 -29
- package/dist/extensions/cpp.js +27 -29
- package/dist/extensions/python.esm.js +27 -28
- package/dist/extensions/python.js +27 -28
- package/dist/index.d.ts +1 -1
- package/dist/packages/settings/src/configuration-service.d.ts +7 -0
- package/dist/packages/settings/src/index.d.ts +1 -1
- package/dist/packages/ui/src/index.d.ts +2 -2
- package/dist/packages/ui/src/plugin-registry.d.ts +1 -0
- package/dist/packages/ui/src/settings-dialog.d.ts +31 -3
- package/dist/packages/ui/src/themes.d.ts +5 -0
- package/dist/preview-sw.js +1 -1
- package/dist/runtime.esm.js +1 -1
- package/dist/runtime.js +1 -1
- package/dist/schemas.d.ts +1 -1
- package/dist/scm.d.ts +92 -11
- package/dist/shell.esm.js +937 -113
- package/dist/shell.js +937 -113
- package/dist/storage.d.ts +47 -0
- package/dist/terminal.esm.js +1 -1
- package/dist/terminal.js +1 -1
- package/dist/workbench/index.d.ts +1 -1
- package/dist/workbench/styles.d.ts +1 -1
- package/package.json +2 -2
- 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 +17 -6
- package/packages/settings/src/configuration-service.ts +72 -6
- package/packages/settings/src/index.ts +1 -0
- package/packages/sql/package.json +1 -1
- package/packages/terminal/package.json +1 -1
- package/packages/ui/package.json +1 -1
- package/packages/ui/src/index.ts +4 -0
- package/packages/ui/src/plugin-registry.ts +17 -2
- package/packages/ui/src/settings-dialog.ts +374 -92
- package/packages/ui/src/themes.ts +105 -12
- package/src/code-lab.css +1553 -98
- package/src/diagnostics.ts +139 -7
- package/src/extensions/cpp.ts +33 -33
- package/src/extensions/python.ts +33 -32
- package/src/index.ts +1 -1
- package/src/schemas.ts +1 -1
- package/src/scm.ts +781 -58
- package/src/shell.ts +936 -112
- package/src/storage.ts +336 -3
- package/src/workbench/icons.ts +8 -1
- package/src/workbench/styles.ts +25 -19
- package/src/workbench.ts +12010 -3814
package/src/storage.ts
CHANGED
|
@@ -38,9 +38,285 @@ export interface WorkspaceStorageOptions {
|
|
|
38
38
|
preferredBackend?: StorageBackendType;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
export type WorkspaceKind = 'blank' | 'repo' | 'demo' | 'custom';
|
|
42
|
+
|
|
43
|
+
export interface WorkspaceMeta {
|
|
44
|
+
labId: string;
|
|
45
|
+
title: string;
|
|
46
|
+
kind: WorkspaceKind;
|
|
47
|
+
repo?: string;
|
|
48
|
+
updatedAt: number;
|
|
49
|
+
fileCount?: number;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export const WORKSPACE_REGISTRY_KEY = 'codelab:workspace-registry:v1';
|
|
53
|
+
|
|
41
54
|
const DEFAULT_DB_NAME = 'codelab_workspace_db';
|
|
42
55
|
const DEFAULT_STORE_NAME = 'projects';
|
|
43
56
|
const DEFAULT_LS_PREFIX = 'codelab:project:';
|
|
57
|
+
const WORKBENCH_STATE_PREFIX = 'sd-codelab-v1:';
|
|
58
|
+
const LEGACY_WORKBENCH_PREFIX = 'codelab_';
|
|
59
|
+
|
|
60
|
+
const memoryRegistry: Map<string, WorkspaceMeta> = new Map();
|
|
61
|
+
const memoryOrIdbNonEmptyProjects: Set<string> = new Set();
|
|
62
|
+
let registryWriteFailed = false;
|
|
63
|
+
let lastBlankTs = 0;
|
|
64
|
+
let blankSeq = 0;
|
|
65
|
+
|
|
66
|
+
function getSafeLocalStorage(): Storage | null {
|
|
67
|
+
try {
|
|
68
|
+
if (typeof globalThis === 'undefined' || !('localStorage' in globalThis)) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
const ls = globalThis.localStorage;
|
|
72
|
+
if (
|
|
73
|
+
!ls ||
|
|
74
|
+
typeof ls.getItem !== 'function' ||
|
|
75
|
+
typeof ls.setItem !== 'function' ||
|
|
76
|
+
typeof ls.removeItem !== 'function'
|
|
77
|
+
) {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
return ls;
|
|
81
|
+
} catch (err) {
|
|
82
|
+
const _ignored = err;
|
|
83
|
+
void _ignored;
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function isPlainRecord(val: unknown): val is Record<string, unknown> {
|
|
89
|
+
return Boolean(val && typeof val === 'object' && !Array.isArray(val));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function normalizeWorkspaceMeta(raw: unknown, existing?: WorkspaceMeta): WorkspaceMeta | null {
|
|
93
|
+
if (!isPlainRecord(raw)) return null;
|
|
94
|
+
const labId = typeof raw.labId === 'string' ? raw.labId.trim() : '';
|
|
95
|
+
if (!labId) return null;
|
|
96
|
+
|
|
97
|
+
const rawKind = raw.kind;
|
|
98
|
+
const kind: WorkspaceKind =
|
|
99
|
+
rawKind === 'blank' || rawKind === 'repo' || rawKind === 'demo' || rawKind === 'custom'
|
|
100
|
+
? rawKind
|
|
101
|
+
: (existing?.kind ?? 'custom');
|
|
102
|
+
|
|
103
|
+
const title =
|
|
104
|
+
typeof raw.title === 'string' && raw.title.trim()
|
|
105
|
+
? raw.title.trim()
|
|
106
|
+
: (existing?.title || labId);
|
|
107
|
+
|
|
108
|
+
const updatedAt =
|
|
109
|
+
typeof raw.updatedAt === 'number' && Number.isFinite(raw.updatedAt)
|
|
110
|
+
? raw.updatedAt
|
|
111
|
+
: Date.now();
|
|
112
|
+
|
|
113
|
+
const repo =
|
|
114
|
+
typeof raw.repo === 'string'
|
|
115
|
+
? (raw.repo.trim() || undefined)
|
|
116
|
+
: existing?.repo;
|
|
117
|
+
|
|
118
|
+
const fileCount =
|
|
119
|
+
typeof raw.fileCount === 'number' && Number.isFinite(raw.fileCount) && raw.fileCount >= 0
|
|
120
|
+
? Math.floor(raw.fileCount)
|
|
121
|
+
: existing?.fileCount;
|
|
122
|
+
|
|
123
|
+
return {
|
|
124
|
+
labId,
|
|
125
|
+
title,
|
|
126
|
+
kind,
|
|
127
|
+
updatedAt,
|
|
128
|
+
...(repo !== undefined ? { repo } : {}),
|
|
129
|
+
...(fileCount !== undefined ? { fileCount } : {})
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function readRegistryEntries(): Map<string, WorkspaceMeta> {
|
|
134
|
+
const ls = getSafeLocalStorage();
|
|
135
|
+
if (ls && !registryWriteFailed) {
|
|
136
|
+
try {
|
|
137
|
+
const raw = ls.getItem(WORKSPACE_REGISTRY_KEY);
|
|
138
|
+
if (raw === null) {
|
|
139
|
+
memoryRegistry.clear();
|
|
140
|
+
return new Map();
|
|
141
|
+
}
|
|
142
|
+
const parsed = JSON.parse(raw) as unknown;
|
|
143
|
+
if (!Array.isArray(parsed)) {
|
|
144
|
+
return new Map();
|
|
145
|
+
}
|
|
146
|
+
const map = new Map<string, WorkspaceMeta>();
|
|
147
|
+
for (const entry of parsed) {
|
|
148
|
+
const normalized = normalizeWorkspaceMeta(entry);
|
|
149
|
+
if (!normalized) continue;
|
|
150
|
+
const prev = map.get(normalized.labId);
|
|
151
|
+
if (!prev || normalized.updatedAt >= prev.updatedAt) {
|
|
152
|
+
map.set(normalized.labId, normalized);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
memoryRegistry.clear();
|
|
156
|
+
for (const [k, v] of map.entries()) {
|
|
157
|
+
memoryRegistry.set(k, { ...v });
|
|
158
|
+
}
|
|
159
|
+
return map;
|
|
160
|
+
} catch (err) {
|
|
161
|
+
const _ignored = err;
|
|
162
|
+
void _ignored;
|
|
163
|
+
return new Map();
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const out = new Map<string, WorkspaceMeta>();
|
|
168
|
+
for (const [k, v] of memoryRegistry.entries()) {
|
|
169
|
+
out.set(k, { ...v });
|
|
170
|
+
}
|
|
171
|
+
return out;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function persistRegistryEntries(map: Map<string, WorkspaceMeta>): void {
|
|
175
|
+
const sorted = Array.from(map.values()).sort((a, b) => b.updatedAt - a.updatedAt);
|
|
176
|
+
memoryRegistry.clear();
|
|
177
|
+
for (const item of sorted) {
|
|
178
|
+
memoryRegistry.set(item.labId, { ...item });
|
|
179
|
+
}
|
|
180
|
+
const ls = getSafeLocalStorage();
|
|
181
|
+
if (ls) {
|
|
182
|
+
try {
|
|
183
|
+
ls.setItem(WORKSPACE_REGISTRY_KEY, JSON.stringify(sorted));
|
|
184
|
+
registryWriteFailed = false;
|
|
185
|
+
} catch (err) {
|
|
186
|
+
const _ignored = err;
|
|
187
|
+
void _ignored;
|
|
188
|
+
registryWriteFailed = true;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export function listWorkspaces(): WorkspaceMeta[] {
|
|
194
|
+
return Array.from(readRegistryEntries().values()).sort((a, b) => b.updatedAt - a.updatedAt);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export function getWorkspaceMeta(labId: string): WorkspaceMeta | null {
|
|
198
|
+
if (typeof labId !== 'string') return null;
|
|
199
|
+
const trimmed = labId.trim();
|
|
200
|
+
if (!trimmed) return null;
|
|
201
|
+
const found = readRegistryEntries().get(trimmed);
|
|
202
|
+
return found ? { ...found } : null;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export function upsertWorkspaceMeta(meta: WorkspaceMeta): void {
|
|
206
|
+
if (!isPlainRecord(meta)) return;
|
|
207
|
+
const trimmedId = typeof meta.labId === 'string' ? meta.labId.trim() : '';
|
|
208
|
+
if (!trimmedId) return;
|
|
209
|
+
const map = readRegistryEntries();
|
|
210
|
+
const normalized = normalizeWorkspaceMeta(meta, map.get(trimmedId));
|
|
211
|
+
if (!normalized) return;
|
|
212
|
+
map.set(normalized.labId, normalized);
|
|
213
|
+
persistRegistryEntries(map);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export function removeWorkspaceMeta(labId: string): void {
|
|
217
|
+
if (typeof labId !== 'string') return;
|
|
218
|
+
const trimmed = labId.trim();
|
|
219
|
+
if (!trimmed) return;
|
|
220
|
+
const map = readRegistryEntries();
|
|
221
|
+
if (map.delete(trimmed)) {
|
|
222
|
+
persistRegistryEntries(map);
|
|
223
|
+
} else {
|
|
224
|
+
memoryRegistry.delete(trimmed);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function payloadHasSavedFiles(rawJson: string | null): boolean {
|
|
229
|
+
if (!rawJson) return false;
|
|
230
|
+
try {
|
|
231
|
+
const parsed = JSON.parse(rawJson) as unknown;
|
|
232
|
+
if (!isPlainRecord(parsed)) return false;
|
|
233
|
+
|
|
234
|
+
if (isPlainRecord(parsed.files) && Object.keys(parsed.files).length > 0) {
|
|
235
|
+
return true;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
if (isPlainRecord(parsed.customFiles)) {
|
|
239
|
+
for (const val of Object.values(parsed.customFiles)) {
|
|
240
|
+
if (typeof val === 'string') {
|
|
241
|
+
return true;
|
|
242
|
+
}
|
|
243
|
+
if (isPlainRecord(val) && Object.keys(val).length > 0) {
|
|
244
|
+
return true;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
} catch (err) {
|
|
249
|
+
const _ignored = err;
|
|
250
|
+
void _ignored;
|
|
251
|
+
}
|
|
252
|
+
return false;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
function checkHasWorkspaceData(
|
|
256
|
+
labId: string,
|
|
257
|
+
extraPrefix?: string,
|
|
258
|
+
instanceMemory?: ReadonlyMap<string, StoredProject>
|
|
259
|
+
): boolean {
|
|
260
|
+
if (typeof labId !== 'string') return false;
|
|
261
|
+
const trimmed = labId.trim();
|
|
262
|
+
if (!trimmed) return false;
|
|
263
|
+
|
|
264
|
+
if (instanceMemory) {
|
|
265
|
+
const proj = instanceMemory.get(trimmed);
|
|
266
|
+
if (proj && isPlainRecord(proj.files) && Object.keys(proj.files).length > 0) {
|
|
267
|
+
return true;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
if (memoryOrIdbNonEmptyProjects.has(trimmed)) {
|
|
272
|
+
return true;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
const ls = getSafeLocalStorage();
|
|
276
|
+
if (ls) {
|
|
277
|
+
try {
|
|
278
|
+
if (payloadHasSavedFiles(ls.getItem(`${WORKBENCH_STATE_PREFIX}${trimmed}`))) {
|
|
279
|
+
return true;
|
|
280
|
+
}
|
|
281
|
+
if (payloadHasSavedFiles(ls.getItem(`${LEGACY_WORKBENCH_PREFIX}${trimmed}`))) {
|
|
282
|
+
return true;
|
|
283
|
+
}
|
|
284
|
+
if (payloadHasSavedFiles(ls.getItem(`${DEFAULT_LS_PREFIX}${trimmed}`))) {
|
|
285
|
+
return true;
|
|
286
|
+
}
|
|
287
|
+
if (
|
|
288
|
+
typeof extraPrefix === 'string' &&
|
|
289
|
+
extraPrefix &&
|
|
290
|
+
extraPrefix !== DEFAULT_LS_PREFIX &&
|
|
291
|
+
payloadHasSavedFiles(ls.getItem(`${extraPrefix}${trimmed}`))
|
|
292
|
+
) {
|
|
293
|
+
return true;
|
|
294
|
+
}
|
|
295
|
+
} catch (err) {
|
|
296
|
+
const _ignored = err;
|
|
297
|
+
void _ignored;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
return false;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
export function hasWorkspaceData(labId: string): boolean {
|
|
305
|
+
return checkHasWorkspaceData(labId);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
export function createBlankWorkspaceId(): string {
|
|
309
|
+
const now = Date.now();
|
|
310
|
+
if (now === lastBlankTs) {
|
|
311
|
+
blankSeq += 1;
|
|
312
|
+
} else {
|
|
313
|
+
lastBlankTs = now;
|
|
314
|
+
blankSeq = 0;
|
|
315
|
+
}
|
|
316
|
+
const rand = Math.random().toString(36).slice(2, 6).padEnd(4, '0');
|
|
317
|
+
const suffix = blankSeq > 0 ? `${blankSeq.toString(36)}${rand}` : rand;
|
|
318
|
+
return `blank-workspace-${now}-${suffix}`;
|
|
319
|
+
}
|
|
44
320
|
|
|
45
321
|
function cloneProject(project: StoredProject): StoredProject {
|
|
46
322
|
const filesCopy: Record<string, string> = {};
|
|
@@ -95,6 +371,14 @@ function isIndexedDbAvailable(): boolean {
|
|
|
95
371
|
}
|
|
96
372
|
|
|
97
373
|
export class WorkspaceStorage {
|
|
374
|
+
public static readonly WORKSPACE_REGISTRY_KEY = WORKSPACE_REGISTRY_KEY;
|
|
375
|
+
public static readonly listWorkspaces = listWorkspaces;
|
|
376
|
+
public static readonly getWorkspaceMeta = getWorkspaceMeta;
|
|
377
|
+
public static readonly upsertWorkspaceMeta = upsertWorkspaceMeta;
|
|
378
|
+
public static readonly removeWorkspaceMeta = removeWorkspaceMeta;
|
|
379
|
+
public static readonly hasWorkspaceData = hasWorkspaceData;
|
|
380
|
+
public static readonly createBlankWorkspaceId = createBlankWorkspaceId;
|
|
381
|
+
|
|
98
382
|
private readonly dbName: string;
|
|
99
383
|
private readonly storeName: string;
|
|
100
384
|
private readonly storagePrefix: string;
|
|
@@ -161,6 +445,7 @@ export class WorkspaceStorage {
|
|
|
161
445
|
return false;
|
|
162
446
|
}
|
|
163
447
|
const normalized = cloneProject(project);
|
|
448
|
+
const hasFiles = Object.keys(normalized.files).length > 0;
|
|
164
449
|
// Always keep memory mirror hot for resilience
|
|
165
450
|
this.memoryStore.set(normalized.id, normalized);
|
|
166
451
|
|
|
@@ -182,7 +467,11 @@ export class WorkspaceStorage {
|
|
|
182
467
|
resolve(false);
|
|
183
468
|
}
|
|
184
469
|
});
|
|
185
|
-
if (ok)
|
|
470
|
+
if (ok) {
|
|
471
|
+
if (hasFiles) memoryOrIdbNonEmptyProjects.add(normalized.id);
|
|
472
|
+
else memoryOrIdbNonEmptyProjects.delete(normalized.id);
|
|
473
|
+
return true;
|
|
474
|
+
}
|
|
186
475
|
this.downgradeFromIdb();
|
|
187
476
|
}
|
|
188
477
|
}
|
|
@@ -191,6 +480,7 @@ export class WorkspaceStorage {
|
|
|
191
480
|
try {
|
|
192
481
|
const key = `${this.storagePrefix}${normalized.id}`;
|
|
193
482
|
globalThis.localStorage.setItem(key, JSON.stringify(normalized));
|
|
483
|
+
memoryOrIdbNonEmptyProjects.delete(normalized.id);
|
|
194
484
|
return true;
|
|
195
485
|
} catch (err) {
|
|
196
486
|
// QuotaExceededError or disabled storage -> fallback to memory
|
|
@@ -200,6 +490,8 @@ export class WorkspaceStorage {
|
|
|
200
490
|
}
|
|
201
491
|
}
|
|
202
492
|
|
|
493
|
+
if (hasFiles) memoryOrIdbNonEmptyProjects.add(normalized.id);
|
|
494
|
+
else memoryOrIdbNonEmptyProjects.delete(normalized.id);
|
|
203
495
|
return true;
|
|
204
496
|
}
|
|
205
497
|
|
|
@@ -320,6 +612,7 @@ export class WorkspaceStorage {
|
|
|
320
612
|
|
|
321
613
|
public async deleteProject(id: string): Promise<boolean> {
|
|
322
614
|
if (!id || typeof id !== 'string') return false;
|
|
615
|
+
memoryOrIdbNonEmptyProjects.delete(id);
|
|
323
616
|
let existed = this.memoryStore.delete(id);
|
|
324
617
|
|
|
325
618
|
if (this.backendType === 'indexeddb') {
|
|
@@ -365,13 +658,53 @@ export class WorkspaceStorage {
|
|
|
365
658
|
|
|
366
659
|
return existed;
|
|
367
660
|
}
|
|
661
|
+
|
|
662
|
+
public listWorkspaces(): WorkspaceMeta[] {
|
|
663
|
+
return listWorkspaces();
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
public getWorkspaceMeta(labId: string): WorkspaceMeta | null {
|
|
667
|
+
return getWorkspaceMeta(labId);
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
public upsertWorkspaceMeta(meta: WorkspaceMeta): void {
|
|
671
|
+
upsertWorkspaceMeta(meta);
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
public removeWorkspaceMeta(labId: string): void {
|
|
675
|
+
removeWorkspaceMeta(labId);
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
public hasWorkspaceData(labId: string): boolean {
|
|
679
|
+
return checkHasWorkspaceData(labId, this.storagePrefix, this.memoryStore);
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
public createBlankWorkspaceId(): string {
|
|
683
|
+
return createBlankWorkspaceId();
|
|
684
|
+
}
|
|
368
685
|
}
|
|
369
686
|
|
|
370
687
|
export function createWorkspaceStorage(options: WorkspaceStorageOptions = {}): WorkspaceStorage {
|
|
371
688
|
return new WorkspaceStorage(options);
|
|
372
689
|
}
|
|
373
690
|
|
|
374
|
-
export
|
|
691
|
+
export const CodeLabWorkspaceStorage = {
|
|
692
|
+
WORKSPACE_REGISTRY_KEY,
|
|
375
693
|
WorkspaceStorage,
|
|
376
|
-
createWorkspaceStorage
|
|
694
|
+
createWorkspaceStorage,
|
|
695
|
+
listWorkspaces,
|
|
696
|
+
getWorkspaceMeta,
|
|
697
|
+
upsertWorkspaceMeta,
|
|
698
|
+
removeWorkspaceMeta,
|
|
699
|
+
hasWorkspaceData,
|
|
700
|
+
createBlankWorkspaceId
|
|
701
|
+
};
|
|
702
|
+
|
|
703
|
+
if (typeof globalThis !== 'undefined') {
|
|
704
|
+
const g = globalThis as unknown as Record<string, unknown>;
|
|
705
|
+
g.CodeLabWorkspaceStorage = CodeLabWorkspaceStorage;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
export default {
|
|
709
|
+
...CodeLabWorkspaceStorage
|
|
377
710
|
};
|
package/src/workbench/icons.ts
CHANGED
|
@@ -47,5 +47,12 @@ export const CL_ICONS: Record<string, string> = {
|
|
|
47
47
|
share: '<svg aria-hidden="true" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="18" cy="5" r="3"/><circle cx="6" cy="12" r="3"/><circle cx="18" cy="19" r="3"/><line x1="8.59" y1="13.51" x2="15.42" y2="17.49"/><line x1="15.41" y1="6.51" x2="8.59" y2="10.49"/></svg>',
|
|
48
48
|
layout: '<svg aria-hidden="true" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2"/><line x1="3" y1="9" x2="21" y2="9"/><line x1="9" y1="21" x2="9" y2="9"/></svg>',
|
|
49
49
|
maximize: '<svg aria-hidden="true" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="15 3 21 3 21 9"/><polyline points="9 21 3 21 3 15"/><line x1="21" y1="3" x2="14" y2="10"/><line x1="3" y1="21" x2="10" y2="14"/></svg>',
|
|
50
|
-
settings: '<svg aria-hidden="true" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"/></svg>'
|
|
50
|
+
settings: '<svg aria-hidden="true" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"/></svg>',
|
|
51
|
+
files: '<svg aria-hidden="true" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M15 2H9a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V6z"/><polyline points="14 2 14 7 19 7"/><path d="M5 8v12a2 2 0 0 0 2 2h9"/></svg>',
|
|
52
|
+
gitBranch: '<svg aria-hidden="true" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><line x1="6" y1="3" x2="6" y2="15"/><circle cx="18" cy="6" r="3"/><circle cx="6" cy="18" r="3"/><path d="M18 9a9 9 0 0 1-9 9"/></svg>',
|
|
53
|
+
sidebarLeft: '<svg aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2"/><line x1="9" y1="3" x2="9" y2="21"/></svg>',
|
|
54
|
+
panelBottom: '<svg aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2"/><line x1="3" y1="15" x2="21" y2="15"/></svg>',
|
|
55
|
+
chevronUp: '<svg aria-hidden="true" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="18 15 12 9 6 15"/></svg>',
|
|
56
|
+
collapseAll: '<svg aria-hidden="true" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="4" width="16" height="16" rx="2"/><line x1="8" y1="12" x2="16" y2="12"/></svg>',
|
|
57
|
+
close: '<svg aria-hidden="true" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>'
|
|
51
58
|
};
|
package/src/workbench/styles.ts
CHANGED
|
@@ -14,7 +14,7 @@ export const WORKBENCH_STYLES = `
|
|
|
14
14
|
.codelab-btn-split .codelab-btn-split__main {
|
|
15
15
|
border-top-right-radius: 0;
|
|
16
16
|
border-bottom-right-radius: 0;
|
|
17
|
-
border-right: 1px solid rgba(
|
|
17
|
+
border-right: 1px solid rgba(0, 0, 0, 0.25);
|
|
18
18
|
}
|
|
19
19
|
.codelab-btn-split .codelab-btn-split__trigger {
|
|
20
20
|
border-top-left-radius: 0;
|
|
@@ -27,10 +27,10 @@ export const WORKBENCH_STYLES = `
|
|
|
27
27
|
top: calc(100% + 4px);
|
|
28
28
|
right: 0;
|
|
29
29
|
background: var(--cl-bg-elevated, #252526);
|
|
30
|
-
border: 1px solid var(--cl-border, #3c3c3c);
|
|
30
|
+
border: 1px solid var(--cl-border-strong, var(--cl-border, #3c3c3c));
|
|
31
31
|
border-radius: var(--cl-radius, 6px);
|
|
32
|
-
box-shadow: 0
|
|
33
|
-
z-index:
|
|
32
|
+
box-shadow: var(--cl-shadow-lg, 0 8px 24px rgba(0, 0, 0, 0.45));
|
|
33
|
+
z-index: 1200;
|
|
34
34
|
min-width: 220px;
|
|
35
35
|
padding: 4px 0;
|
|
36
36
|
display: none;
|
|
@@ -52,9 +52,11 @@ export const WORKBENCH_STYLES = `
|
|
|
52
52
|
cursor: pointer;
|
|
53
53
|
text-align: left;
|
|
54
54
|
}
|
|
55
|
-
.codelab-split-menu__item:hover
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
.codelab-split-menu__item:hover,
|
|
56
|
+
.codelab-split-menu__item:focus-visible {
|
|
57
|
+
background: var(--cl-accent, #38bdf8);
|
|
58
|
+
color: var(--cl-accent-fg, #06131f);
|
|
59
|
+
outline: none;
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
/* ── Command Palette Trigger Pill ── */
|
|
@@ -62,19 +64,23 @@ export const WORKBENCH_STYLES = `
|
|
|
62
64
|
display: inline-flex;
|
|
63
65
|
align-items: center;
|
|
64
66
|
gap: 6px;
|
|
65
|
-
padding: 3px
|
|
67
|
+
padding: 3px 12px;
|
|
68
|
+
min-width: 200px;
|
|
69
|
+
justify-content: center;
|
|
66
70
|
border-radius: var(--cl-radius, 6px);
|
|
67
|
-
background: var(--cl-
|
|
71
|
+
background: var(--cl-bg-hover, rgba(128, 128, 128, 0.12));
|
|
68
72
|
border: 1px solid var(--cl-border, #3c3c3c);
|
|
69
73
|
color: var(--cl-fg-muted, #858585);
|
|
70
|
-
font-size:
|
|
74
|
+
font-size: 11.5px;
|
|
71
75
|
cursor: pointer;
|
|
72
|
-
transition:
|
|
76
|
+
transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
|
|
73
77
|
}
|
|
74
|
-
.codelab-cmd-trigger:hover
|
|
75
|
-
|
|
78
|
+
.codelab-cmd-trigger:hover,
|
|
79
|
+
.codelab-cmd-trigger:focus-visible {
|
|
80
|
+
background: var(--cl-bg-active, rgba(128, 128, 128, 0.2));
|
|
76
81
|
color: var(--cl-fg, #cccccc);
|
|
77
|
-
border-color: var(--cl-accent, #
|
|
82
|
+
border-color: var(--cl-accent, #38bdf8);
|
|
83
|
+
outline: none;
|
|
78
84
|
}
|
|
79
85
|
|
|
80
86
|
/* ── HUD Telemetry Pill ── */
|
|
@@ -155,19 +161,19 @@ export const WORKBENCH_STYLES = `
|
|
|
155
161
|
font-size: 12px;
|
|
156
162
|
font-family: var(--cl-font-mono, monospace);
|
|
157
163
|
cursor: pointer;
|
|
158
|
-
border-bottom: 1px solid rgba(
|
|
164
|
+
border-bottom: 1px solid var(--cl-border, rgba(128, 128, 128, 0.12));
|
|
159
165
|
}
|
|
160
166
|
.codelab-problem-item:hover {
|
|
161
|
-
background: var(--cl-
|
|
167
|
+
background: var(--cl-bg-hover, rgba(128, 128, 128, 0.1));
|
|
162
168
|
}
|
|
163
169
|
.codelab-problem-item--error {
|
|
164
|
-
color: #
|
|
170
|
+
color: var(--cl-danger, #ef4444);
|
|
165
171
|
}
|
|
166
172
|
.codelab-problem-item--warning {
|
|
167
|
-
color: #
|
|
173
|
+
color: var(--cl-warn, #f59e0b);
|
|
168
174
|
}
|
|
169
175
|
.codelab-problem-item--info {
|
|
170
|
-
color: #
|
|
176
|
+
color: var(--cl-accent, #38bdf8);
|
|
171
177
|
}
|
|
172
178
|
.codelab-problem-item__location {
|
|
173
179
|
color: var(--cl-fg-muted, #858585);
|