@innovatorved/code-lab 0.3.1 → 0.4.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 +8 -4
- package/CHANGELOG.md +45 -0
- package/README.md +70 -158
- package/dist/apps/web/src/index.d.ts +34 -0
- package/dist/code-lab-sql.css +482 -0
- package/dist/code-lab-sql.d.ts +179 -0
- package/dist/code-lab-sql.esm.js +542 -0
- package/dist/code-lab-sql.umd.js +531 -0
- package/dist/code-lab.css +298 -2
- package/dist/code-lab.d.ts +110 -15
- package/dist/code-lab.esm.js +35284 -18253
- package/dist/code-lab.js +40434 -23431
- package/dist/code-lab.umd.js +65502 -0
- package/dist/diagnostics.d.ts +5 -0
- package/dist/extensions/cpp.esm.js +19532 -3772
- package/dist/extensions/cpp.js +19529 -3769
- package/dist/extensions/guided-lab.esm.js +19401 -3725
- package/dist/extensions/guided-lab.js +19400 -3724
- package/dist/extensions/python.d.ts +1 -0
- package/dist/extensions/python.esm.js +19666 -3843
- package/dist/extensions/python.js +19668 -3845
- package/dist/extensions/umbrella.d.ts +5 -0
- package/dist/index.d.ts +1 -1
- package/dist/modular-kernel.d.ts +11 -0
- package/dist/packages/commands/src/index.d.ts +96 -0
- package/dist/packages/core/src/di.d.ts +36 -0
- package/dist/packages/core/src/disposable.d.ts +27 -0
- package/dist/packages/core/src/errors.d.ts +69 -0
- package/dist/packages/core/src/events.d.ts +38 -0
- package/dist/packages/core/src/index.d.ts +6 -0
- package/dist/packages/core/src/path.d.ts +14 -0
- package/dist/packages/core/src/registry.d.ts +23 -0
- package/dist/packages/editor/src/index.d.ts +118 -0
- package/dist/packages/fs/src/backends.d.ts +37 -0
- package/dist/packages/fs/src/index.d.ts +3 -0
- package/dist/packages/fs/src/types.d.ts +40 -0
- package/dist/packages/fs/src/vfs-service.d.ts +33 -0
- package/dist/packages/preview/src/index.d.ts +34 -0
- package/dist/packages/runtime/src/index.d.ts +47 -0
- package/dist/packages/settings/src/builtin-schemas.d.ts +15 -0
- package/dist/packages/settings/src/configuration-service.d.ts +100 -0
- package/dist/packages/settings/src/index.d.ts +4 -0
- package/dist/packages/settings/src/jsonc.d.ts +20 -0
- package/dist/packages/settings/src/schema.d.ts +28 -0
- package/dist/packages/sql/src/completions.d.ts +8 -0
- package/dist/packages/sql/src/diagnostics.d.ts +2 -0
- package/dist/packages/sql/src/formatter.d.ts +2 -0
- package/dist/packages/sql/src/index.d.ts +7 -0
- package/dist/packages/sql/src/sql-editor.d.ts +2 -0
- package/dist/packages/sql/src/styles.d.ts +2 -0
- package/dist/packages/sql/src/tokenizer.d.ts +13 -0
- package/dist/packages/sql/src/types.d.ts +130 -0
- package/dist/packages/terminal/src/index.d.ts +54 -0
- package/dist/packages/ui/src/index.d.ts +4 -0
- package/dist/packages/ui/src/observability.d.ts +22 -0
- package/dist/packages/ui/src/plugin-registry.d.ts +89 -0
- package/dist/packages/ui/src/settings-dialog.d.ts +25 -0
- package/dist/packages/ui/src/themes.d.ts +35 -0
- package/dist/preview-sw.js +82 -24
- package/dist/runtime.d.ts +3 -3
- package/dist/runtime.esm.js +503 -73
- package/dist/runtime.js +501 -73
- package/dist/schemas.d.ts +234 -814
- package/dist/schemas.esm.js +19401 -3725
- package/dist/schemas.js +19404 -3728
- package/dist/scm.d.ts +13 -2
- package/dist/search.d.ts +5 -1
- package/dist/shell.d.ts +1 -1
- package/dist/shell.esm.js +435 -54
- package/dist/shell.js +435 -54
- package/dist/terminal.esm.js +242 -54
- package/dist/terminal.js +242 -54
- package/dist/workbench/diff-editor.d.ts +1 -0
- package/dist/workbench/index.d.ts +1 -1
- package/dist/workbench/styles.d.ts +1 -1
- package/dist/zip.d.ts +4 -3
- package/package.json +37 -8
- package/packages/commands/README.md +7 -0
- package/packages/commands/package.json +16 -0
- package/packages/commands/src/index.ts +467 -0
- package/packages/commands/tsconfig.json +22 -0
- package/packages/core/README.md +12 -0
- package/packages/core/package.json +13 -0
- package/packages/core/src/di.ts +147 -0
- package/packages/core/src/disposable.ts +112 -0
- package/packages/core/src/errors.ts +205 -0
- package/packages/core/src/events.ts +157 -0
- package/packages/core/src/index.ts +49 -0
- package/packages/core/src/path.ts +118 -0
- package/packages/core/src/registry.ts +61 -0
- package/packages/core/tsconfig.json +19 -0
- package/packages/editor/README.md +9 -0
- package/packages/editor/package.json +18 -0
- package/packages/editor/src/index.ts +344 -0
- package/packages/editor/tsconfig.json +24 -0
- package/packages/fs/README.md +7 -0
- package/packages/fs/package.json +16 -0
- package/packages/fs/src/backends.ts +301 -0
- package/packages/fs/src/index.ts +18 -0
- package/packages/fs/src/types.ts +44 -0
- package/packages/fs/src/vfs-service.ts +257 -0
- package/packages/fs/tsconfig.json +22 -0
- package/packages/preview/README.md +3 -0
- package/packages/preview/package.json +16 -0
- package/packages/preview/src/index.ts +125 -0
- package/packages/preview/tsconfig.json +22 -0
- package/packages/runtime/README.md +3 -0
- package/packages/runtime/package.json +17 -0
- package/packages/runtime/src/index.ts +134 -0
- package/packages/runtime/tsconfig.json +23 -0
- package/packages/settings/README.md +7 -0
- package/packages/settings/package.json +16 -0
- package/packages/settings/src/builtin-schemas.ts +235 -0
- package/packages/settings/src/configuration-service.ts +543 -0
- package/packages/settings/src/index.ts +37 -0
- package/packages/settings/src/jsonc.ts +189 -0
- package/packages/settings/src/schema.ts +164 -0
- package/packages/settings/tsconfig.json +22 -0
- package/packages/sql/README.md +12 -0
- package/packages/sql/package.json +13 -0
- package/packages/sql/src/completions.ts +359 -0
- package/packages/sql/src/diagnostics.ts +200 -0
- package/packages/sql/src/formatter.ts +271 -0
- package/packages/sql/src/index.ts +54 -0
- package/packages/sql/src/sql-editor.ts +802 -0
- package/packages/sql/src/styles.ts +501 -0
- package/packages/sql/src/tokenizer.ts +457 -0
- package/packages/sql/src/types.ts +148 -0
- package/packages/sql/tsconfig.json +19 -0
- package/packages/terminal/README.md +3 -0
- package/packages/terminal/package.json +16 -0
- package/packages/terminal/src/index.ts +183 -0
- package/packages/terminal/tsconfig.json +22 -0
- package/packages/ui/README.md +8 -0
- package/packages/ui/package.json +18 -0
- package/packages/ui/src/index.ts +36 -0
- package/packages/ui/src/observability.ts +175 -0
- package/packages/ui/src/plugin-registry.ts +274 -0
- package/packages/ui/src/settings-dialog.ts +293 -0
- package/packages/ui/src/themes.ts +174 -0
- package/packages/ui/tsconfig.json +24 -0
- package/src/code-lab.css +298 -2
- package/src/csp.ts +7 -10
- package/src/diagnostics.ts +42 -3
- package/src/extensions/cpp.ts +105 -24
- package/src/extensions/python.ts +260 -116
- package/src/extensions/umbrella.ts +5 -0
- package/src/index.ts +1 -1
- package/src/modular-kernel.ts +11 -0
- package/src/preview-sw.js +73 -12
- package/src/runtime.ts +501 -74
- package/src/schemas.ts +62 -62
- package/src/scm.ts +106 -19
- package/src/search.ts +71 -27
- package/src/shell.ts +433 -53
- package/src/terminal.ts +239 -52
- package/src/workbench/diff-editor.ts +106 -18
- package/src/workbench/drawer.ts +17 -4
- package/src/workbench/guided-pane.ts +12 -2
- package/src/workbench/icons.ts +5 -2
- package/src/workbench/share.ts +37 -8
- package/src/workbench/styles.ts +2 -1
- package/src/workbench/toolbar.ts +15 -4
- package/src/workbench.ts +2877 -284
- package/src/zip.ts +29 -7
- package/dist/runtime/index.d.ts +0 -4
- package/dist/shell/coreutils/compilers-cli.d.ts +0 -24
- package/dist/shell/index.d.ts +0 -4
- package/src/runtime/index.ts +0 -5
- package/src/shell/coreutils/compilers-cli.ts +0 -103
- package/src/shell/index.ts +0 -5
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { JsonSchema } from './schema';
|
|
2
|
+
export type SettingCategory = 'Editor' | 'Workbench' | 'Files' | 'Terminal' | 'Preview' | 'Runtime' | 'SQL';
|
|
3
|
+
export interface SettingDescriptor<T = unknown> {
|
|
4
|
+
readonly key: string;
|
|
5
|
+
readonly category: SettingCategory;
|
|
6
|
+
readonly title: string;
|
|
7
|
+
readonly description: string;
|
|
8
|
+
readonly defaultValue: T;
|
|
9
|
+
readonly schema: JsonSchema;
|
|
10
|
+
}
|
|
11
|
+
export declare const BUILTIN_SETTINGS: readonly SettingDescriptor[];
|
|
12
|
+
export declare function buildSettingsJsonSchema(descriptors: readonly SettingDescriptor[]): JsonSchema;
|
|
13
|
+
export declare const KEYBINDINGS_JSON_SCHEMA: JsonSchema;
|
|
14
|
+
export declare const TASKS_JSON_SCHEMA: JsonSchema;
|
|
15
|
+
export declare const EXTENSIONS_JSON_SCHEMA: JsonSchema;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { type Event, type IDisposable } from '@code-lab/core';
|
|
2
|
+
import { type SettingDescriptor } from './builtin-schemas';
|
|
3
|
+
import { type JsonSchema } from './schema';
|
|
4
|
+
export type ConfigurationTarget = 'default' | 'user' | 'workspace' | 'override';
|
|
5
|
+
export interface SettingDiagnostic {
|
|
6
|
+
readonly file: string;
|
|
7
|
+
readonly key?: string;
|
|
8
|
+
readonly message: string;
|
|
9
|
+
readonly line: number;
|
|
10
|
+
readonly column: number;
|
|
11
|
+
readonly severity: 'error' | 'warning';
|
|
12
|
+
}
|
|
13
|
+
export interface ConfigurationChangeEvent {
|
|
14
|
+
readonly affectedKeys: ReadonlySet<string>;
|
|
15
|
+
readonly source: ConfigurationTarget;
|
|
16
|
+
readonly affectsConfiguration: (prefixOrKey: string) => boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface SettingInspection<T = unknown> {
|
|
19
|
+
readonly key: string;
|
|
20
|
+
readonly defaultValue: T | undefined;
|
|
21
|
+
readonly userValue: T | undefined;
|
|
22
|
+
readonly workspaceValue: T | undefined;
|
|
23
|
+
readonly overrideValue: T | undefined;
|
|
24
|
+
readonly effectiveValue: T | undefined;
|
|
25
|
+
readonly effectiveSource: ConfigurationTarget;
|
|
26
|
+
}
|
|
27
|
+
export interface WorkspaceTaskDefinition {
|
|
28
|
+
readonly id: string;
|
|
29
|
+
readonly label: string;
|
|
30
|
+
readonly command: string;
|
|
31
|
+
readonly group?: 'run' | 'build' | 'test' | 'dev';
|
|
32
|
+
readonly runOn?: 'manual' | 'folderOpen';
|
|
33
|
+
readonly cwd?: string;
|
|
34
|
+
readonly env?: Readonly<Record<string, string>>;
|
|
35
|
+
}
|
|
36
|
+
export interface WorkspaceExtensionsConfig {
|
|
37
|
+
readonly recommendations: readonly string[];
|
|
38
|
+
readonly autoActivate: readonly string[];
|
|
39
|
+
}
|
|
40
|
+
export interface IConfigurationService extends IDisposable {
|
|
41
|
+
readonly onDidChangeConfiguration: Event<ConfigurationChangeEvent>;
|
|
42
|
+
readonly onDidChangeDiagnostics: Event<readonly SettingDiagnostic[]>;
|
|
43
|
+
registerSetting(descriptor: SettingDescriptor): IDisposable;
|
|
44
|
+
getDescriptors(): SettingDescriptor[];
|
|
45
|
+
getJsonSchema(): JsonSchema;
|
|
46
|
+
get<T = unknown>(key: string, fallback?: T): T;
|
|
47
|
+
inspect<T = unknown>(key: string): SettingInspection<T>;
|
|
48
|
+
getDiagnostics(): readonly SettingDiagnostic[];
|
|
49
|
+
setUserSetting(key: string, value: unknown): boolean;
|
|
50
|
+
resetSetting(key: string): void;
|
|
51
|
+
setWorkspaceSetting(key: string, value: unknown): boolean;
|
|
52
|
+
loadWorkspaceSettingsJson(rawJsonc: string, filePath?: string): readonly SettingDiagnostic[];
|
|
53
|
+
setOverrides(overrides: Readonly<Record<string, unknown>>): void;
|
|
54
|
+
toWorkspaceJsonString(): string;
|
|
55
|
+
exportProfile(): string;
|
|
56
|
+
importProfile(rawJsonc: string): readonly SettingDiagnostic[];
|
|
57
|
+
toUrlParam(): string;
|
|
58
|
+
applyUrlParam(encoded: string): readonly SettingDiagnostic[];
|
|
59
|
+
}
|
|
60
|
+
export declare const IConfigurationServiceId: import("@code-lab/core").ServiceId<IConfigurationService>;
|
|
61
|
+
export declare class ConfigurationService implements IConfigurationService {
|
|
62
|
+
private readonly descriptors;
|
|
63
|
+
private readonly userValues;
|
|
64
|
+
private readonly workspaceValues;
|
|
65
|
+
private readonly overrideValues;
|
|
66
|
+
private diagnostics;
|
|
67
|
+
private readonly changeEmitter;
|
|
68
|
+
private readonly diagEmitter;
|
|
69
|
+
constructor(includeBuiltins?: boolean);
|
|
70
|
+
get onDidChangeConfiguration(): Event<ConfigurationChangeEvent>;
|
|
71
|
+
get onDidChangeDiagnostics(): Event<readonly SettingDiagnostic[]>;
|
|
72
|
+
registerSetting(descriptor: SettingDescriptor): IDisposable;
|
|
73
|
+
getDescriptors(): SettingDescriptor[];
|
|
74
|
+
getJsonSchema(): JsonSchema;
|
|
75
|
+
getDiagnostics(): readonly SettingDiagnostic[];
|
|
76
|
+
inspect<T = unknown>(key: string): SettingInspection<T>;
|
|
77
|
+
get<T = unknown>(key: string, fallback?: T): T;
|
|
78
|
+
private validateKeyValue;
|
|
79
|
+
setUserSetting(key: string, value: unknown): boolean;
|
|
80
|
+
setWorkspaceSetting(key: string, value: unknown): boolean;
|
|
81
|
+
resetSetting(key: string): void;
|
|
82
|
+
loadWorkspaceSettingsJson(rawJsonc: string, filePath?: string): readonly SettingDiagnostic[];
|
|
83
|
+
setOverrides(overrides: Readonly<Record<string, unknown>>): void;
|
|
84
|
+
toWorkspaceJsonString(): string;
|
|
85
|
+
exportProfile(): string;
|
|
86
|
+
importProfile(rawJsonc: string): readonly SettingDiagnostic[];
|
|
87
|
+
toUrlParam(): string;
|
|
88
|
+
applyUrlParam(encoded: string): readonly SettingDiagnostic[];
|
|
89
|
+
private updateDiagnostics;
|
|
90
|
+
private fireChange;
|
|
91
|
+
dispose(): void;
|
|
92
|
+
}
|
|
93
|
+
export declare function parseTasksConfig(rawJsonc: string, filePath?: string): {
|
|
94
|
+
tasks: WorkspaceTaskDefinition[];
|
|
95
|
+
diagnostics: SettingDiagnostic[];
|
|
96
|
+
};
|
|
97
|
+
export declare function parseExtensionsConfig(rawJsonc: string, filePath?: string): {
|
|
98
|
+
config: WorkspaceExtensionsConfig;
|
|
99
|
+
diagnostics: SettingDiagnostic[];
|
|
100
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { type JsoncParseError, type JsoncParseResult, stripJsonCommentsAndTrailingCommas, parseJsonc } from './jsonc';
|
|
2
|
+
export { type JsonSchemaType, type JsonSchema, type SchemaValidationIssue, validateJsonSchema } from './schema';
|
|
3
|
+
export { type SettingCategory, type SettingDescriptor, BUILTIN_SETTINGS, buildSettingsJsonSchema, KEYBINDINGS_JSON_SCHEMA, TASKS_JSON_SCHEMA, EXTENSIONS_JSON_SCHEMA } from './builtin-schemas';
|
|
4
|
+
export { type ConfigurationTarget, type SettingDiagnostic, type ConfigurationChangeEvent, type SettingInspection, type WorkspaceTaskDefinition, type WorkspaceExtensionsConfig, type IConfigurationService, IConfigurationServiceId, ConfigurationService, parseTasksConfig, parseExtensionsConfig } from './configuration-service';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @code-lab/settings — Resilient JSON with Comments (JSONC) parser.
|
|
3
|
+
* Supports `//` line comments, `/* ... * /` block comments, and trailing commas,
|
|
4
|
+
* returning structured 1-based line/column diagnostics instead of throwing.
|
|
5
|
+
*/
|
|
6
|
+
export interface JsoncParseError {
|
|
7
|
+
readonly message: string;
|
|
8
|
+
readonly offset: number;
|
|
9
|
+
readonly line: number;
|
|
10
|
+
readonly column: number;
|
|
11
|
+
}
|
|
12
|
+
export interface JsoncParseResult<T = unknown> {
|
|
13
|
+
readonly value: T | undefined;
|
|
14
|
+
readonly errors: readonly JsoncParseError[];
|
|
15
|
+
}
|
|
16
|
+
export declare function stripJsonCommentsAndTrailingCommas(input: string): {
|
|
17
|
+
cleaned: string;
|
|
18
|
+
errors: JsoncParseError[];
|
|
19
|
+
};
|
|
20
|
+
export declare function parseJsonc<T = unknown>(raw: string): JsoncParseResult<T>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @code-lab/settings — CSP-safe zero-dependency JSON Schema (Draft-07 subset) validator.
|
|
3
|
+
* Never uses `new Function` or `eval`.
|
|
4
|
+
*/
|
|
5
|
+
export type JsonSchemaType = 'string' | 'number' | 'integer' | 'boolean' | 'object' | 'array' | 'null';
|
|
6
|
+
export interface JsonSchema {
|
|
7
|
+
readonly $schema?: string;
|
|
8
|
+
readonly title?: string;
|
|
9
|
+
readonly description?: string;
|
|
10
|
+
readonly type?: JsonSchemaType | readonly JsonSchemaType[];
|
|
11
|
+
readonly enum?: readonly unknown[];
|
|
12
|
+
readonly default?: unknown;
|
|
13
|
+
readonly minimum?: number;
|
|
14
|
+
readonly maximum?: number;
|
|
15
|
+
readonly minLength?: number;
|
|
16
|
+
readonly maxLength?: number;
|
|
17
|
+
readonly pattern?: string;
|
|
18
|
+
readonly items?: JsonSchema;
|
|
19
|
+
readonly properties?: Readonly<Record<string, JsonSchema>>;
|
|
20
|
+
readonly required?: readonly string[];
|
|
21
|
+
readonly additionalProperties?: boolean | JsonSchema;
|
|
22
|
+
}
|
|
23
|
+
export interface SchemaValidationIssue {
|
|
24
|
+
readonly path: string;
|
|
25
|
+
readonly message: string;
|
|
26
|
+
readonly expected?: string;
|
|
27
|
+
}
|
|
28
|
+
export declare function validateJsonSchema(value: unknown, schema: JsonSchema, path?: string): SchemaValidationIssue[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SqlCompletionItem, SqlDialect, SqlSchema } from './types';
|
|
2
|
+
export interface ParsedSqlContext {
|
|
3
|
+
readonly aliases: ReadonlyMap<string, string>;
|
|
4
|
+
readonly referencedTables: ReadonlySet<string>;
|
|
5
|
+
readonly cteNames: ReadonlySet<string>;
|
|
6
|
+
}
|
|
7
|
+
export declare function extractTableAliases(sql: string, dialect?: SqlDialect): ParsedSqlContext;
|
|
8
|
+
export declare function completeSql(sql: string, cursorOffset: number, schema?: SqlSchema | null, dialectOverride?: SqlDialect, maxItems?: number): SqlCompletionItem[];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { type SqlDialect, type SqlEditorMode, type SqlThemeMode, type SqlColumnSchema, type SqlTableSchema, type SqlFunctionSchema, type SqlSchema, type SqlDiagnostic, type SqlRunPayload, type SqlFormatOptions, type SqlCompletionKind, type SqlCompletionItem, type SqlEditorOptions, type SqlEditorInstance, type SqlRunnerStepInfo, type SqlRunnerRequest, type SqlRunnerVerification, type SqlRunnerResult, type SqlRunnerFn } from './types';
|
|
2
|
+
export { type SqlTokenType, type SqlToken, getDialectKeywords, getSqlBuiltinFunctions, tokenizeSql, escapeSqlHtml, highlightSql } from './tokenizer';
|
|
3
|
+
export { formatSql } from './formatter';
|
|
4
|
+
export { type ParsedSqlContext, extractTableAliases, completeSql } from './completions';
|
|
5
|
+
export { parseSqlEngineError } from './diagnostics';
|
|
6
|
+
export { SQL_EDITOR_CSS, ensureSqlStylesInjected } from './styles';
|
|
7
|
+
export { createSqlEditor } from './sql-editor';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const SQL_EDITOR_CSS = "/* @innovatorved/code-lab/sql \u2014 Lightweight SQL Editor & Playground Styles */\n.cl-sql-root {\n --cl-bg: var(--code-bg, var(--surface, #0a0a0a));\n --cl-fg: var(--code-fg, var(--fg, #f5f5f5));\n --cl-accent: var(--accent, #0284c7);\n --cl-border: var(--border, #262626);\n --cl-font-mono: var(--font-mono, 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);\n --cl-sql-gutter-bg: rgba(255, 255, 255, 0.025);\n --cl-sql-gutter-fg: #737373;\n --cl-sql-popup-bg: #141414;\n --cl-sql-popup-hover: rgba(2, 132, 199, 0.18);\n --cl-sql-kw: #38bdf8;\n --cl-sql-fn: #c084fc;\n --cl-sql-type: #2dd4bf;\n --cl-sql-str: #86efac;\n --cl-sql-num: #fbbf24;\n --cl-sql-op: #f472b6;\n --cl-sql-param: #fb923c;\n --cl-sql-qident: #93c5fd;\n --cl-sql-comment: #737373;\n --cl-sql-error: #ef4444;\n --cl-sql-warn: #f59e0b;\n --cl-sql-font-size: 13.5px;\n --cl-sql-line-height: 1.55;\n\n color-scheme: dark;\n position: relative;\n display: flex;\n flex-direction: column;\n width: 100%;\n box-sizing: border-box;\n border: 1px solid var(--cl-border);\n border-radius: 8px;\n background: var(--cl-bg);\n color: var(--cl-fg);\n accent-color: var(--cl-accent);\n font-family: var(--cl-font-mono);\n container-type: inline-size;\n}\n\n.cl-sql-root[data-cl-sql-theme=\"light\"],\n:root[data-theme=\"light\"] .cl-sql-root:not([data-cl-sql-theme=\"dark\"]) {\n --cl-bg: var(--code-bg, var(--surface, #ffffff));\n --cl-fg: var(--code-fg, var(--fg, #0f172a));\n --cl-accent: var(--accent, #0284c7);\n --cl-border: var(--border, #e2e8f0);\n --cl-sql-gutter-bg: #f8fafc;\n --cl-sql-gutter-fg: #64748b;\n --cl-sql-popup-bg: #ffffff;\n --cl-sql-popup-hover: rgba(2, 132, 199, 0.12);\n --cl-sql-kw: #0369a1;\n --cl-sql-fn: #7e22ce;\n --cl-sql-type: #0f766e;\n --cl-sql-str: #15803d;\n --cl-sql-num: #b45309;\n --cl-sql-op: #be185d;\n --cl-sql-param: #c2410c;\n --cl-sql-qident: #1d4ed8;\n --cl-sql-comment: #64748b;\n color-scheme: light;\n background: var(--cl-bg);\n color: var(--cl-fg);\n accent-color: var(--cl-accent);\n}\n\n.cl-sql-root *,\n.cl-sql-root *::before,\n.cl-sql-root *::after {\n box-sizing: border-box;\n}\n\n.cl-sql-toolbar {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n padding: 6px 10px;\n border-bottom: 1px solid var(--cl-border);\n font-size: 12px;\n background: var(--cl-sql-gutter-bg);\n border-radius: 7px 7px 0 0;\n}\n\n.cl-sql-toolbar-left,\n.cl-sql-toolbar-right {\n display: flex;\n align-items: center;\n gap: 6px;\n flex-wrap: wrap;\n}\n\n.cl-sql-dialect-pill {\n display: inline-flex;\n align-items: center;\n padding: 2px 7px;\n border-radius: 999px;\n font-size: 11px;\n font-weight: 600;\n letter-spacing: 0.02em;\n border: 1px solid var(--cl-border);\n color: var(--cl-accent);\n}\n\n.cl-sql-btn {\n appearance: none;\n display: inline-flex;\n align-items: center;\n gap: 5px;\n padding: 4px 10px;\n border-radius: 5px;\n border: 1px solid var(--cl-border);\n background: transparent;\n color: var(--cl-fg);\n font-family: inherit;\n font-size: 12px;\n font-weight: 500;\n cursor: pointer;\n touch-action: manipulation;\n}\n\n.cl-sql-btn:hover {\n border-color: var(--cl-accent);\n}\n\n.cl-sql-btn-primary {\n background: var(--cl-accent);\n border-color: var(--cl-accent);\n color: #ffffff;\n}\n\n.cl-sql-btn:focus-visible {\n outline: 2px solid var(--cl-accent);\n outline-offset: 2px;\n}\n\n.cl-sql-playground-layout {\n display: grid;\n grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);\n min-height: 240px;\n}\n\n@container (max-width: 767px) {\n .cl-sql-playground-layout {\n grid-template-columns: minmax(0, 1fr);\n }\n .cl-sql-results-slot {\n border-left: none !important;\n border-top: 1px solid var(--cl-border);\n }\n}\n\n@media (max-width: 767px) {\n .cl-sql-playground-layout {\n grid-template-columns: minmax(0, 1fr);\n }\n .cl-sql-results-slot {\n border-left: none !important;\n border-top: 1px solid var(--cl-border);\n }\n}\n\n.cl-sql-results-slot {\n border-left: 1px solid var(--cl-border);\n padding: 10px 12px;\n overflow: auto;\n font-size: 12.5px;\n}\n\n.cl-sql-ResultsEmpty {\n color: var(--cl-sql-gutter-fg);\n font-size: 12px;\n}\n\n.cl-sql-surface {\n position: relative;\n display: flex;\n width: 100%;\n overflow: hidden;\n}\n\n.cl-sql-gutter {\n flex: 0 0 auto;\n min-width: 38px;\n padding: 10px 8px 10px 6px;\n text-align: right;\n user-select: none;\n background: var(--cl-sql-gutter-bg);\n border-right: 1px solid var(--cl-border);\n color: var(--cl-sql-gutter-fg);\n font-size: var(--cl-sql-font-size);\n line-height: var(--cl-sql-line-height);\n overflow: hidden;\n}\n\n.cl-sql-gutter-line {\n position: relative;\n padding-left: 10px;\n}\n\n.cl-sql-gutter-line[data-diag=\"error\"] {\n color: var(--cl-sql-error);\n font-weight: 700;\n}\n\n.cl-sql-gutter-line[data-diag=\"error\"]::before,\n.cl-sql-gutter-line[data-diag=\"warning\"]::before {\n content: \"\";\n position: absolute;\n left: 1px;\n top: 50%;\n width: 6px;\n height: 6px;\n border-radius: 50%;\n transform: translateY(-50%);\n background: var(--cl-sql-error);\n}\n\n.cl-sql-gutter-line[data-diag=\"warning\"]::before {\n background: var(--cl-sql-warn);\n}\n\n.cl-sql-editor-wrap {\n position: relative;\n flex: 1 1 auto;\n min-width: 0;\n overflow: hidden;\n}\n\n.cl-sql-backdrop,\n.cl-sql-textarea {\n margin: 0;\n padding: 10px 12px;\n width: 100%;\n height: 100%;\n border: 0;\n font-family: var(--cl-font-mono);\n font-size: var(--cl-sql-font-size);\n line-height: var(--cl-sql-line-height);\n tab-size: 2;\n white-space: pre;\n overflow: auto;\n letter-spacing: normal;\n font-variant-ligatures: none;\n}\n\n@media (pointer: coarse) {\n .cl-sql-root {\n --cl-sql-font-size: 16px;\n }\n .cl-sql-textarea,\n .cl-sql-backdrop,\n .cl-sql-gutter {\n font-size: max(16px, var(--cl-sql-font-size));\n }\n}\n\n.cl-sql-backdrop {\n position: absolute;\n inset: 0;\n pointer-events: none;\n color: var(--cl-fg);\n background: transparent;\n z-index: 1;\n}\n\n.cl-sql-textarea {\n position: relative;\n display: block;\n z-index: 2;\n resize: none;\n color: transparent;\n caret-color: var(--cl-fg);\n background: transparent;\n outline: none;\n -webkit-text-fill-color: transparent;\n}\n\n.cl-sql-textarea::placeholder {\n color: var(--cl-sql-gutter-fg);\n -webkit-text-fill-color: var(--cl-sql-gutter-fg);\n}\n\n.cl-sql-textarea::selection {\n background: rgba(2, 132, 199, 0.32);\n}\n\n.cl-sql-textarea:focus-visible {\n box-shadow: inset 0 0 0 1px var(--cl-accent);\n}\n\n/* Token highlight colors */\n.cl-sql-tok-kw { color: var(--cl-sql-kw); font-weight: 600; }\n.cl-sql-tok-fn { color: var(--cl-sql-fn); }\n.cl-sql-tok-type { color: var(--cl-sql-type); }\n.cl-sql-tok-str { color: var(--cl-sql-str); }\n.cl-sql-tok-num { color: var(--cl-sql-num); }\n.cl-sql-tok-op { color: var(--cl-sql-op); }\n.cl-sql-tok-param { color: var(--cl-sql-param); font-weight: 600; }\n.cl-sql-tok-qident { color: var(--cl-sql-qident); }\n.cl-sql-tok-comment { color: var(--cl-sql-comment); font-style: italic; }\n\n/* Inline wavy diagnostic underlines */\n.cl-sql-diag-error {\n text-decoration-line: underline;\n text-decoration-style: wavy;\n text-decoration-color: var(--cl-sql-error);\n text-underline-offset: 3px;\n background: rgba(239, 68, 68, 0.14);\n border-radius: 2px;\n}\n\n.cl-sql-diag-warning {\n text-decoration-line: underline;\n text-decoration-style: wavy;\n text-decoration-color: var(--cl-sql-warn);\n text-underline-offset: 3px;\n background: rgba(245, 158, 11, 0.14);\n border-radius: 2px;\n}\n\n.cl-sql-diag-info {\n text-decoration-line: underline;\n text-decoration-style: dotted;\n text-decoration-color: var(--cl-accent);\n}\n\n.cl-sql-diagnostics {\n display: none;\n padding: 7px 12px;\n border-top: 1px solid var(--cl-border);\n font-size: 12px;\n line-height: 1.45;\n background: rgba(239, 68, 68, 0.09);\n color: var(--cl-fg);\n}\n\n.cl-sql-diagnostics[data-visible=\"true\"] {\n display: block;\n}\n\n.cl-sql-diag-row {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n align-items: baseline;\n}\n\n.cl-sql-diag-badge {\n font-size: 10.5px;\n font-weight: 700;\n text-transform: uppercase;\n padding: 1px 5px;\n border-radius: 4px;\n background: var(--cl-sql-error);\n color: #ffffff;\n}\n\n.cl-sql-diag-badge[data-severity=\"warning\"] {\n background: var(--cl-sql-warn);\n color: #000000;\n}\n\n.cl-sql-diag-hint {\n width: 100%;\n margin-top: 2px;\n color: var(--cl-sql-gutter-fg);\n font-size: 11.5px;\n}\n\n/* Schema-aware completion popup */\n.cl-sql-completions {\n display: none;\n position: absolute;\n left: 44px;\n bottom: 8px;\n z-index: 30;\n width: min(380px, calc(100% - 52px));\n max-height: 210px;\n overflow-y: auto;\n margin: 0;\n padding: 4px;\n list-style: none;\n border: 1px solid var(--cl-border);\n border-radius: 7px;\n background: var(--cl-sql-popup-bg);\n box-shadow: 0 10px 26px rgba(0, 0, 0, 0.38);\n font-size: 12px;\n}\n\n.cl-sql-completions[data-open=\"true\"] {\n display: block;\n}\n\n.cl-sql-completion-item {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n padding: 5px 8px;\n border-radius: 5px;\n cursor: pointer;\n touch-action: manipulation;\n}\n\n.cl-sql-completion-item[aria-selected=\"true\"],\n.cl-sql-completion-item:hover {\n background: var(--cl-sql-popup-hover);\n}\n\n.cl-sql-comp-main {\n display: flex;\n align-items: center;\n gap: 6px;\n min-width: 0;\n}\n\n.cl-sql-comp-kind {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 18px;\n height: 18px;\n border-radius: 4px;\n font-size: 10px;\n font-weight: 700;\n background: rgba(2, 132, 199, 0.16);\n color: var(--cl-accent);\n flex-shrink: 0;\n}\n\n.cl-sql-comp-label {\n font-weight: 600;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.cl-sql-comp-meta {\n display: flex;\n align-items: center;\n gap: 5px;\n flex-shrink: 0;\n font-size: 11px;\n color: var(--cl-sql-gutter-fg);\n}\n\n.cl-sql-comp-badge {\n padding: 1px 5px;\n border-radius: 4px;\n border: 1px solid var(--cl-border);\n font-size: 10px;\n}\n\n.cl-sql-footer {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 3px 10px;\n border-top: 1px solid var(--cl-border);\n font-size: 11px;\n color: var(--cl-sql-gutter-fg);\n}\n\n.cl-sql-sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .cl-sql-root,\n .cl-sql-root * {\n transition: none !important;\n animation: none !important;\n }\n}\n";
|
|
2
|
+
export declare function ensureSqlStylesInjected(doc?: Document): void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { SqlDiagnostic, SqlDialect } from './types';
|
|
2
|
+
export type SqlTokenType = 'keyword' | 'function' | 'type' | 'string' | 'number' | 'operator' | 'cast' | 'param' | 'identifier' | 'quoted-ident' | 'comment' | 'punctuation' | 'whitespace';
|
|
3
|
+
export interface SqlToken {
|
|
4
|
+
readonly type: SqlTokenType;
|
|
5
|
+
readonly value: string;
|
|
6
|
+
readonly start: number;
|
|
7
|
+
readonly end: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function getDialectKeywords(dialect: SqlDialect): ReadonlySet<string>;
|
|
10
|
+
export declare function getSqlBuiltinFunctions(): ReadonlySet<string>;
|
|
11
|
+
export declare function tokenizeSql(sql: string, dialect?: SqlDialect): SqlToken[];
|
|
12
|
+
export declare function escapeSqlHtml(raw: string): string;
|
|
13
|
+
export declare function highlightSql(sql: string, dialect?: SqlDialect, diagnostics?: readonly SqlDiagnostic[]): string;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
export type SqlDialect = 'postgres' | 'sqlite';
|
|
2
|
+
export type SqlEditorMode = 'inline' | 'playground' | 'workbench';
|
|
3
|
+
export type SqlThemeMode = 'dark' | 'light' | 'auto';
|
|
4
|
+
export interface SqlColumnSchema {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly type: string;
|
|
7
|
+
readonly pk?: boolean;
|
|
8
|
+
readonly primaryKey?: boolean;
|
|
9
|
+
readonly fk?: string;
|
|
10
|
+
readonly references?: string;
|
|
11
|
+
readonly nullable?: boolean;
|
|
12
|
+
readonly comment?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface SqlTableSchema {
|
|
15
|
+
readonly name: string;
|
|
16
|
+
readonly rowCount?: number;
|
|
17
|
+
readonly columns: readonly SqlColumnSchema[];
|
|
18
|
+
}
|
|
19
|
+
export interface SqlFunctionSchema {
|
|
20
|
+
readonly name: string;
|
|
21
|
+
readonly signature: string;
|
|
22
|
+
readonly description?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface SqlSchema {
|
|
25
|
+
readonly dialect: SqlDialect;
|
|
26
|
+
readonly tables: readonly SqlTableSchema[];
|
|
27
|
+
readonly functions?: readonly SqlFunctionSchema[];
|
|
28
|
+
}
|
|
29
|
+
export interface SqlDiagnostic {
|
|
30
|
+
readonly severity: 'error' | 'warning' | 'info';
|
|
31
|
+
readonly message: string;
|
|
32
|
+
readonly hint?: string;
|
|
33
|
+
readonly line?: number;
|
|
34
|
+
readonly column?: number;
|
|
35
|
+
readonly fromOffset?: number;
|
|
36
|
+
readonly toOffset?: number;
|
|
37
|
+
}
|
|
38
|
+
export interface SqlRunPayload {
|
|
39
|
+
readonly sql: string;
|
|
40
|
+
readonly selectedSql: string;
|
|
41
|
+
readonly effectiveSql: string;
|
|
42
|
+
readonly dialect: SqlDialect;
|
|
43
|
+
}
|
|
44
|
+
export interface SqlFormatOptions {
|
|
45
|
+
readonly dialect?: SqlDialect;
|
|
46
|
+
readonly indent?: number;
|
|
47
|
+
readonly keywordCase?: 'upper' | 'lower' | 'preserve';
|
|
48
|
+
}
|
|
49
|
+
export type SqlCompletionKind = 'table' | 'column' | 'function' | 'keyword' | 'cte';
|
|
50
|
+
export interface SqlCompletionItem {
|
|
51
|
+
readonly label: string;
|
|
52
|
+
readonly insertText: string;
|
|
53
|
+
readonly kind: SqlCompletionKind;
|
|
54
|
+
readonly detail?: string;
|
|
55
|
+
readonly badge?: string;
|
|
56
|
+
readonly secondaryBadge?: string;
|
|
57
|
+
readonly description?: string;
|
|
58
|
+
readonly replaceFrom: number;
|
|
59
|
+
readonly replaceTo: number;
|
|
60
|
+
}
|
|
61
|
+
export interface SqlEditorOptions {
|
|
62
|
+
readonly value?: string;
|
|
63
|
+
readonly dialect?: SqlDialect;
|
|
64
|
+
readonly mode?: SqlEditorMode;
|
|
65
|
+
readonly schema?: SqlSchema | null;
|
|
66
|
+
readonly theme?: SqlThemeMode;
|
|
67
|
+
readonly readOnly?: boolean;
|
|
68
|
+
readonly ariaLabel?: string;
|
|
69
|
+
readonly placeholder?: string;
|
|
70
|
+
readonly minLines?: number;
|
|
71
|
+
readonly maxLines?: number;
|
|
72
|
+
readonly showToolbar?: boolean;
|
|
73
|
+
readonly onRun?: (payload: SqlRunPayload) => void | Promise<void>;
|
|
74
|
+
readonly onExplain?: (payload: SqlRunPayload) => void | Promise<void>;
|
|
75
|
+
readonly onChange?: (value: string) => void;
|
|
76
|
+
readonly onFormat?: (formatted: string) => void;
|
|
77
|
+
}
|
|
78
|
+
export interface SqlEditorInstance {
|
|
79
|
+
getValue(): string;
|
|
80
|
+
setValue(sql: string): void;
|
|
81
|
+
getSelection(): string;
|
|
82
|
+
insertAtCursor(text: string): void;
|
|
83
|
+
format(): string;
|
|
84
|
+
setDialect(dialect: SqlDialect): void;
|
|
85
|
+
getDialect(): SqlDialect;
|
|
86
|
+
setSchema(schema: SqlSchema | null): void;
|
|
87
|
+
getSchema(): SqlSchema | null;
|
|
88
|
+
setDiagnostics(diagnostics: readonly SqlDiagnostic[]): void;
|
|
89
|
+
clearDiagnostics(): void;
|
|
90
|
+
getDiagnostics(): readonly SqlDiagnostic[];
|
|
91
|
+
setTheme(theme: SqlThemeMode): void;
|
|
92
|
+
getTheme(): SqlThemeMode;
|
|
93
|
+
setReadOnly(readOnly: boolean): void;
|
|
94
|
+
focus(): void;
|
|
95
|
+
destroy(): void;
|
|
96
|
+
/** Playground slot elements when `mode === 'playground'` */
|
|
97
|
+
readonly slots?: {
|
|
98
|
+
readonly header: HTMLElement | null;
|
|
99
|
+
readonly footer: HTMLElement | null;
|
|
100
|
+
readonly results: HTMLElement | null;
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
export interface SqlRunnerStepInfo {
|
|
104
|
+
readonly index: number;
|
|
105
|
+
readonly id?: string;
|
|
106
|
+
readonly title?: string;
|
|
107
|
+
}
|
|
108
|
+
export interface SqlRunnerRequest {
|
|
109
|
+
readonly sql: string;
|
|
110
|
+
readonly selectedSql: string;
|
|
111
|
+
readonly effectiveSql: string;
|
|
112
|
+
readonly dialect: SqlDialect;
|
|
113
|
+
readonly step?: SqlRunnerStepInfo | null;
|
|
114
|
+
readonly mode: 'run' | 'verify' | 'explain';
|
|
115
|
+
}
|
|
116
|
+
export interface SqlRunnerVerification {
|
|
117
|
+
readonly passed: boolean;
|
|
118
|
+
readonly message?: string;
|
|
119
|
+
readonly details?: readonly string[];
|
|
120
|
+
}
|
|
121
|
+
export interface SqlRunnerResult {
|
|
122
|
+
readonly columns?: readonly string[];
|
|
123
|
+
readonly rows?: ReadonlyArray<ReadonlyArray<unknown> | Readonly<Record<string, unknown>>>;
|
|
124
|
+
readonly rowCount?: number;
|
|
125
|
+
readonly execMs?: number;
|
|
126
|
+
readonly plan?: string | Readonly<Record<string, unknown>> | ReadonlyArray<unknown>;
|
|
127
|
+
readonly verification?: SqlRunnerVerification;
|
|
128
|
+
readonly error?: unknown;
|
|
129
|
+
}
|
|
130
|
+
export type SqlRunnerFn = (request: SqlRunnerRequest) => Promise<SqlRunnerResult> | SqlRunnerResult;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type Event, type IDisposable } from '@code-lab/core';
|
|
2
|
+
export interface AnsiSegment {
|
|
3
|
+
readonly text: string;
|
|
4
|
+
readonly fg?: string;
|
|
5
|
+
readonly bold?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function parseAnsiSegments(input: string): AnsiSegment[];
|
|
8
|
+
export interface TerminalSession {
|
|
9
|
+
readonly id: string;
|
|
10
|
+
readonly title: string;
|
|
11
|
+
readonly cwd: string;
|
|
12
|
+
readonly lines: readonly string[];
|
|
13
|
+
write(chunk: string): void;
|
|
14
|
+
clear(): void;
|
|
15
|
+
}
|
|
16
|
+
export interface ITerminalService extends IDisposable {
|
|
17
|
+
readonly activeSessionId: string | undefined;
|
|
18
|
+
readonly onDidWrite: Event<{
|
|
19
|
+
sessionId: string;
|
|
20
|
+
chunk: string;
|
|
21
|
+
}>;
|
|
22
|
+
readonly onDidChangeSessions: Event<void>;
|
|
23
|
+
createSession(options?: {
|
|
24
|
+
title?: string;
|
|
25
|
+
cwd?: string;
|
|
26
|
+
maxScrollback?: number;
|
|
27
|
+
}): TerminalSession;
|
|
28
|
+
getSessions(): TerminalSession[];
|
|
29
|
+
setActiveSession(id: string): void;
|
|
30
|
+
closeSession(id: string): void;
|
|
31
|
+
}
|
|
32
|
+
export declare const ITerminalServiceId: import("@code-lab/core").ServiceId<ITerminalService>;
|
|
33
|
+
export declare class TerminalService implements ITerminalService {
|
|
34
|
+
private readonly sessions;
|
|
35
|
+
private currentSessionId;
|
|
36
|
+
private seq;
|
|
37
|
+
private readonly writeEmitter;
|
|
38
|
+
private readonly sessionsEmitter;
|
|
39
|
+
get activeSessionId(): string | undefined;
|
|
40
|
+
get onDidWrite(): Event<{
|
|
41
|
+
sessionId: string;
|
|
42
|
+
chunk: string;
|
|
43
|
+
}>;
|
|
44
|
+
get onDidChangeSessions(): Event<void>;
|
|
45
|
+
createSession(options?: {
|
|
46
|
+
title?: string;
|
|
47
|
+
cwd?: string;
|
|
48
|
+
maxScrollback?: number;
|
|
49
|
+
}): TerminalSession;
|
|
50
|
+
getSessions(): TerminalSession[];
|
|
51
|
+
setActiveSession(id: string): void;
|
|
52
|
+
closeSession(id: string): void;
|
|
53
|
+
dispose(): void;
|
|
54
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { type ThemeKind, type ThemeDefinition, type IThemeService, DARK_THEME, LIGHT_THEME, HIGH_CONTRAST_THEME, IThemeServiceId, parseCustomTheme, ThemeService } from './themes';
|
|
2
|
+
export { type PanelContribution, type LanguageContribution, type PluginContributions, type PluginActivationContext, type CodeLabPluginManifest, type RegisteredPluginInfo, type IPluginRegistry, IPluginRegistryId, PluginRegistry } from './plugin-registry';
|
|
3
|
+
export { type SettingsDialogOptions, SettingsDialogController } from './settings-dialog';
|
|
4
|
+
export { type ObservabilitySnapshotInput, scoreFuzzyFileMatch, rankWorkspaceFiles, renderObservabilityPanelHtml, WorkbenchErrorBoundary } from './observability';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { EventTraceRecord, ILogger, IServiceContainer } from '@code-lab/core';
|
|
2
|
+
import type { IConfigurationService } from '@code-lab/settings';
|
|
3
|
+
import type { IPluginRegistry } from './plugin-registry';
|
|
4
|
+
export declare function scoreFuzzyFileMatch(candidatePath: string, query: string): number;
|
|
5
|
+
export declare function rankWorkspaceFiles(filePaths: readonly string[], query: string, excludePatterns?: readonly string[]): string[];
|
|
6
|
+
export interface ObservabilitySnapshotInput {
|
|
7
|
+
readonly container: IServiceContainer;
|
|
8
|
+
readonly configuration: IConfigurationService;
|
|
9
|
+
readonly plugins: IPluginRegistry;
|
|
10
|
+
readonly logger: ILogger;
|
|
11
|
+
readonly recentEvents: readonly EventTraceRecord[];
|
|
12
|
+
readonly workerStatus?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function renderObservabilityPanelHtml(input: ObservabilitySnapshotInput): string;
|
|
15
|
+
export declare class WorkbenchErrorBoundary {
|
|
16
|
+
private readonly host;
|
|
17
|
+
private readonly logger;
|
|
18
|
+
private bannerEl;
|
|
19
|
+
constructor(host: HTMLElement, logger: ILogger);
|
|
20
|
+
capture(error: unknown, contextLabel?: string): void;
|
|
21
|
+
clear(): void;
|
|
22
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { type CommandDescriptor, type ICommandRegistry, type IKeybindingService, type KeybindingRule } from '@code-lab/commands';
|
|
2
|
+
import { ContributionRegistry, DisposableStore, type Event, type IDisposable, type ILogger } from '@code-lab/core';
|
|
3
|
+
import type { IConfigurationService, SettingDescriptor } from '@code-lab/settings';
|
|
4
|
+
import type { IThemeService, ThemeDefinition } from './themes';
|
|
5
|
+
export interface PanelContribution {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly title: string;
|
|
8
|
+
readonly location: 'drawer' | 'sidebar';
|
|
9
|
+
readonly icon?: string;
|
|
10
|
+
readonly render: (container: HTMLElement) => void | IDisposable;
|
|
11
|
+
}
|
|
12
|
+
export interface LanguageContribution {
|
|
13
|
+
readonly id: string;
|
|
14
|
+
readonly extensions: readonly string[];
|
|
15
|
+
readonly aliases?: readonly string[];
|
|
16
|
+
readonly runFile?: (filePath: string, source: string) => Promise<{
|
|
17
|
+
ok: boolean;
|
|
18
|
+
stdout: string;
|
|
19
|
+
stderr: string;
|
|
20
|
+
}>;
|
|
21
|
+
}
|
|
22
|
+
export interface PluginContributions {
|
|
23
|
+
readonly commands?: readonly CommandDescriptor[];
|
|
24
|
+
readonly settings?: readonly SettingDescriptor[];
|
|
25
|
+
readonly keybindings?: readonly KeybindingRule[];
|
|
26
|
+
readonly themes?: readonly ThemeDefinition[];
|
|
27
|
+
readonly panels?: readonly PanelContribution[];
|
|
28
|
+
readonly languages?: readonly LanguageContribution[];
|
|
29
|
+
}
|
|
30
|
+
export interface PluginActivationContext {
|
|
31
|
+
readonly subscriptions: DisposableStore;
|
|
32
|
+
readonly commands: ICommandRegistry;
|
|
33
|
+
readonly configuration: IConfigurationService;
|
|
34
|
+
readonly keybindings: IKeybindingService;
|
|
35
|
+
readonly themes: IThemeService;
|
|
36
|
+
readonly logger: ILogger;
|
|
37
|
+
}
|
|
38
|
+
export interface CodeLabPluginManifest {
|
|
39
|
+
readonly id: string;
|
|
40
|
+
readonly name: string;
|
|
41
|
+
readonly version: string;
|
|
42
|
+
readonly description?: string;
|
|
43
|
+
readonly activationEvents?: readonly string[];
|
|
44
|
+
readonly contributes?: PluginContributions;
|
|
45
|
+
readonly activate?: (ctx: PluginActivationContext) => void | Promise<void> | IDisposable;
|
|
46
|
+
readonly deactivate?: () => void | Promise<void>;
|
|
47
|
+
}
|
|
48
|
+
export interface RegisteredPluginInfo {
|
|
49
|
+
readonly manifest: CodeLabPluginManifest;
|
|
50
|
+
readonly active: boolean;
|
|
51
|
+
}
|
|
52
|
+
export interface IPluginRegistry extends IDisposable {
|
|
53
|
+
readonly panels: ContributionRegistry<string, PanelContribution>;
|
|
54
|
+
readonly languages: ContributionRegistry<string, LanguageContribution>;
|
|
55
|
+
readonly onDidChangePlugins: Event<string>;
|
|
56
|
+
registerPlugin(manifest: CodeLabPluginManifest): IDisposable;
|
|
57
|
+
activatePlugin(id: string): Promise<void>;
|
|
58
|
+
deactivatePlugin(id: string): Promise<void>;
|
|
59
|
+
fireActivationEvent(eventName: string): Promise<void>;
|
|
60
|
+
getPlugins(): RegisteredPluginInfo[];
|
|
61
|
+
resolveLanguageForFile(filePath: string): LanguageContribution | undefined;
|
|
62
|
+
}
|
|
63
|
+
export declare const IPluginRegistryId: import("@code-lab/core").ServiceId<IPluginRegistry>;
|
|
64
|
+
export declare class PluginRegistry implements IPluginRegistry {
|
|
65
|
+
readonly panels: ContributionRegistry<string, PanelContribution>;
|
|
66
|
+
readonly languages: ContributionRegistry<string, LanguageContribution>;
|
|
67
|
+
private readonly records;
|
|
68
|
+
private readonly changeEmitter;
|
|
69
|
+
private readonly commands;
|
|
70
|
+
private readonly configuration;
|
|
71
|
+
private readonly keybindings;
|
|
72
|
+
private readonly themes;
|
|
73
|
+
private readonly logger;
|
|
74
|
+
constructor(deps: {
|
|
75
|
+
commands: ICommandRegistry;
|
|
76
|
+
configuration: IConfigurationService;
|
|
77
|
+
keybindings: IKeybindingService;
|
|
78
|
+
themes: IThemeService;
|
|
79
|
+
logger: ILogger;
|
|
80
|
+
});
|
|
81
|
+
get onDidChangePlugins(): Event<string>;
|
|
82
|
+
registerPlugin(manifest: CodeLabPluginManifest): IDisposable;
|
|
83
|
+
activatePlugin(id: string): Promise<void>;
|
|
84
|
+
deactivatePlugin(id: string): Promise<void>;
|
|
85
|
+
fireActivationEvent(eventName: string): Promise<void>;
|
|
86
|
+
getPlugins(): RegisteredPluginInfo[];
|
|
87
|
+
resolveLanguageForFile(filePath: string): LanguageContribution | undefined;
|
|
88
|
+
dispose(): void;
|
|
89
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type IDisposable } from '@code-lab/core';
|
|
2
|
+
import type { IConfigurationService } from '@code-lab/settings';
|
|
3
|
+
export interface SettingsDialogOptions {
|
|
4
|
+
readonly configuration: IConfigurationService;
|
|
5
|
+
readonly onOpenSettingsJson?: () => void;
|
|
6
|
+
readonly onExportSettings?: (json: string) => void;
|
|
7
|
+
readonly onImportSettings?: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare class SettingsDialogController implements IDisposable {
|
|
10
|
+
private readonly disposables;
|
|
11
|
+
private readonly config;
|
|
12
|
+
private readonly options;
|
|
13
|
+
private dialogEl;
|
|
14
|
+
private activeCategory;
|
|
15
|
+
private searchQuery;
|
|
16
|
+
constructor(hostRoot: HTMLElement, options: SettingsDialogOptions);
|
|
17
|
+
private mount;
|
|
18
|
+
get isOpen(): boolean;
|
|
19
|
+
open(): void;
|
|
20
|
+
close(): void;
|
|
21
|
+
private renderCategories;
|
|
22
|
+
private renderControl;
|
|
23
|
+
private renderItems;
|
|
24
|
+
dispose(): void;
|
|
25
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type Event, type IDisposable } from '@code-lab/core';
|
|
2
|
+
export type ThemeKind = 'dark' | 'light' | 'high-contrast';
|
|
3
|
+
export interface ThemeDefinition {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly label: string;
|
|
6
|
+
readonly kind: ThemeKind;
|
|
7
|
+
readonly colors: Readonly<Record<string, string>>;
|
|
8
|
+
readonly monacoBase: 'vs-dark' | 'vs' | 'hc-black';
|
|
9
|
+
}
|
|
10
|
+
export declare const DARK_THEME: ThemeDefinition;
|
|
11
|
+
export declare const LIGHT_THEME: ThemeDefinition;
|
|
12
|
+
export declare const HIGH_CONTRAST_THEME: ThemeDefinition;
|
|
13
|
+
export declare function parseCustomTheme(rawJsonc: string): ThemeDefinition;
|
|
14
|
+
export interface IThemeService extends IDisposable {
|
|
15
|
+
readonly activeTheme: ThemeDefinition;
|
|
16
|
+
readonly onDidChangeTheme: Event<ThemeDefinition>;
|
|
17
|
+
registerTheme(theme: ThemeDefinition): IDisposable;
|
|
18
|
+
getThemes(): ThemeDefinition[];
|
|
19
|
+
setTheme(themeId: string): ThemeDefinition;
|
|
20
|
+
applyToElement(target: HTMLElement): void;
|
|
21
|
+
}
|
|
22
|
+
export declare const IThemeServiceId: import("@code-lab/core").ServiceId<IThemeService>;
|
|
23
|
+
export declare class ThemeService implements IThemeService {
|
|
24
|
+
private readonly themes;
|
|
25
|
+
private current;
|
|
26
|
+
private readonly changeEmitter;
|
|
27
|
+
constructor();
|
|
28
|
+
get activeTheme(): ThemeDefinition;
|
|
29
|
+
get onDidChangeTheme(): Event<ThemeDefinition>;
|
|
30
|
+
registerTheme(theme: ThemeDefinition): IDisposable;
|
|
31
|
+
getThemes(): ThemeDefinition[];
|
|
32
|
+
setTheme(themeId: string): ThemeDefinition;
|
|
33
|
+
applyToElement(target: HTMLElement): void;
|
|
34
|
+
dispose(): void;
|
|
35
|
+
}
|