@innovatorved/code-lab 0.6.0 → 0.6.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.
- package/ARCHITECTURE.md +1 -1
- package/CHANGELOG.md +8 -0
- package/README.md +1 -1
- package/dist/code-lab-sql.css +87 -64
- package/dist/code-lab-sql.esm.js +109 -86
- package/dist/code-lab-sql.umd.js +110 -87
- package/dist/code-lab.css +1 -1
- package/dist/code-lab.d.ts +1 -1
- package/dist/code-lab.esm.js +601 -248
- package/dist/code-lab.js +600 -247
- package/dist/code-lab.umd.js +600 -247
- package/dist/index.d.ts +1 -1
- package/dist/packages/sql/src/styles.d.ts +1 -1
- package/dist/packages/ui/src/settings-dialog.d.ts +2 -0
- package/dist/preview-sw.js +1 -1
- package/dist/runtime.esm.js +1 -1
- package/dist/runtime.js +1 -1
- package/dist/schemas.d.ts +1 -1
- package/dist/shell.esm.js +1 -1
- package/dist/shell.js +1 -1
- package/dist/terminal.esm.js +1 -1
- package/dist/terminal.js +1 -1
- package/dist/workbench/index.d.ts +1 -1
- package/dist/workbench/intellisense.d.ts +1 -1
- package/dist/workbench/styles.d.ts +1 -1
- package/package.json +1 -1
- package/packages/commands/package.json +1 -1
- package/packages/core/package.json +1 -1
- package/packages/editor/package.json +1 -1
- package/packages/fs/package.json +1 -1
- package/packages/preview/package.json +1 -1
- package/packages/runtime/package.json +1 -1
- package/packages/settings/package.json +1 -1
- package/packages/sql/package.json +1 -1
- package/packages/sql/src/styles.ts +87 -64
- package/packages/terminal/package.json +1 -1
- package/packages/ui/package.json +1 -1
- package/packages/ui/src/observability.ts +12 -14
- package/packages/ui/src/settings-dialog.ts +379 -55
- package/packages/ui/src/themes.ts +78 -78
- package/src/code-lab.css +750 -309
- package/src/index.ts +1 -1
- package/src/schemas.ts +1 -1
- package/src/workbench/diff-editor.ts +5 -1
- package/src/workbench/drawer.ts +5 -5
- package/src/workbench/icons.ts +5 -5
- package/src/workbench/intellisense.ts +94 -82
- package/src/workbench/styles.ts +58 -54
- package/src/workbench/toolbar.ts +1 -1
- package/src/workbench/xterm-adapter.ts +61 -56
- package/src/workbench.ts +98 -92
|
@@ -41,18 +41,352 @@ const ALL_CATEGORIES: ReadonlyArray<'All' | SettingCategory> = [
|
|
|
41
41
|
'SQL'
|
|
42
42
|
];
|
|
43
43
|
|
|
44
|
-
const
|
|
45
|
-
|
|
44
|
+
const SETTINGS_STYLE_ID = 'codelab-ui-settings-styles';
|
|
45
|
+
|
|
46
|
+
export const SETTINGS_COMPONENT_CSS = `/* @innovatorved/code-lab/ui — Tokenized Settings & Control Components */
|
|
47
|
+
.cl-settings-dialog,
|
|
48
|
+
.cl-settings-editor {
|
|
49
|
+
--cl-ui-sans: var(--cl-font-sans, var(--ds-font-sans, var(--font-sans, "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif)));
|
|
50
|
+
--cl-ui-mono: var(--cl-font-mono, var(--ds-font-mono, var(--font-mono, "Geist Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, monospace)));
|
|
51
|
+
--cl-ui-text-2xs: var(--cl-text-2xs, var(--ds-text-2xs, 0.6875rem));
|
|
52
|
+
--cl-ui-text-xs: var(--cl-text-xs, var(--ds-text-xs, 0.75rem));
|
|
53
|
+
--cl-ui-text-sm: var(--cl-text-sm, var(--ds-text-sm, 0.8125rem));
|
|
54
|
+
--cl-ui-text-base: var(--cl-text-base, var(--ds-text-base, 0.875rem));
|
|
55
|
+
font-family: var(--cl-ui-sans);
|
|
56
|
+
color: var(--cl-fg, #f4f4f5);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.cl-settings-editor.cl-settings-inline {
|
|
60
|
+
display: flex;
|
|
61
|
+
flex-direction: column;
|
|
62
|
+
height: 100%;
|
|
63
|
+
min-height: 0;
|
|
64
|
+
background: var(--cl-editor-bg, var(--cl-bg, #0f0f10));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.cl-settings-header {
|
|
68
|
+
display: flex;
|
|
69
|
+
align-items: center;
|
|
70
|
+
justify-content: space-between;
|
|
71
|
+
gap: 12px;
|
|
72
|
+
padding: 12px 20px;
|
|
73
|
+
border-bottom: 1px solid var(--cl-border, #27272a);
|
|
74
|
+
background: var(--cl-surface, var(--cl-bg-elevated, #141415));
|
|
75
|
+
flex-wrap: wrap;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.cl-settings-title {
|
|
79
|
+
margin: 0;
|
|
80
|
+
font-size: var(--cl-ui-text-base);
|
|
81
|
+
font-weight: 600;
|
|
82
|
+
letter-spacing: -0.015em;
|
|
83
|
+
color: var(--cl-fg-active, var(--cl-fg, #f4f4f5));
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.cl-settings-actions {
|
|
87
|
+
display: flex;
|
|
88
|
+
align-items: center;
|
|
89
|
+
gap: 6px;
|
|
90
|
+
flex-wrap: wrap;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.cl-settings-toolbar {
|
|
94
|
+
padding: 12px 20px 0 20px;
|
|
95
|
+
border-bottom: 1px solid var(--cl-border, #27272a);
|
|
96
|
+
background: var(--cl-surface, var(--cl-bg-elevated, #141415));
|
|
97
|
+
display: flex;
|
|
98
|
+
flex-direction: column;
|
|
99
|
+
gap: 10px;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.cl-settings-search {
|
|
103
|
+
width: 100%;
|
|
104
|
+
height: 32px;
|
|
105
|
+
padding: 0 10px;
|
|
106
|
+
border-radius: var(--cl-radius-md, 6px);
|
|
107
|
+
border: 1px solid var(--cl-input-border, var(--cl-border, #27272a));
|
|
108
|
+
background: var(--cl-input-bg, var(--cl-bg, #0f0f10));
|
|
109
|
+
color: var(--cl-fg, #f4f4f5);
|
|
110
|
+
font-family: var(--cl-ui-sans);
|
|
111
|
+
font-size: var(--cl-ui-text-sm);
|
|
112
|
+
outline: none;
|
|
113
|
+
transition: border-color 120ms ease;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.cl-settings-search::placeholder {
|
|
117
|
+
color: var(--cl-fg-faint, var(--cl-fg-muted, #8e8e97));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.cl-settings-search:focus {
|
|
121
|
+
border-color: var(--cl-focus-border, #a1a1aa);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.cl-settings-scopes {
|
|
125
|
+
display: flex;
|
|
126
|
+
align-items: center;
|
|
127
|
+
gap: 4px;
|
|
128
|
+
overflow-x: auto;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.cl-settings-scope-tab {
|
|
132
|
+
flex: none;
|
|
133
|
+
padding: 6px 12px;
|
|
134
|
+
border: none;
|
|
135
|
+
border-bottom: 2px solid transparent;
|
|
136
|
+
background: transparent;
|
|
137
|
+
color: var(--cl-fg-muted, #a1a1aa);
|
|
138
|
+
font-family: var(--cl-ui-sans);
|
|
139
|
+
font-size: var(--cl-ui-text-xs);
|
|
140
|
+
font-weight: 500;
|
|
141
|
+
cursor: pointer;
|
|
142
|
+
transition: color 120ms ease, border-color 120ms ease;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.cl-settings-scope-tab:hover {
|
|
146
|
+
color: var(--cl-fg, #f4f4f5);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.cl-settings-scope-tab[aria-selected="true"] {
|
|
150
|
+
color: var(--cl-fg-active, var(--cl-fg, #f4f4f5));
|
|
151
|
+
font-weight: 600;
|
|
152
|
+
border-bottom-color: var(--cl-accent, #f4f4f5);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.cl-settings-body {
|
|
156
|
+
display: grid;
|
|
157
|
+
grid-template-columns: 180px minmax(0, 1fr);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.cl-settings-body--dialog {
|
|
161
|
+
min-height: 320px;
|
|
162
|
+
max-height: 62vh;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.cl-settings-body--inline {
|
|
166
|
+
flex: 1;
|
|
167
|
+
min-height: 0;
|
|
168
|
+
overflow: hidden;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.cl-settings-categories {
|
|
172
|
+
border-right: 1px solid var(--cl-border, #27272a);
|
|
173
|
+
background: var(--cl-surface, var(--cl-bg-elevated, #141415));
|
|
174
|
+
padding: 10px 8px;
|
|
175
|
+
display: flex;
|
|
176
|
+
flex-direction: column;
|
|
177
|
+
gap: 2px;
|
|
178
|
+
overflow-y: auto;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.cl-settings-cat-btn {
|
|
182
|
+
text-align: left;
|
|
183
|
+
padding: 6px 10px;
|
|
184
|
+
border: 1px solid transparent;
|
|
185
|
+
border-radius: var(--cl-radius-md, 6px);
|
|
186
|
+
background: transparent;
|
|
187
|
+
color: var(--cl-fg-muted, #a1a1aa);
|
|
188
|
+
font-family: var(--cl-ui-sans);
|
|
189
|
+
font-size: var(--cl-ui-text-sm);
|
|
190
|
+
font-weight: 500;
|
|
191
|
+
line-height: 1.35;
|
|
192
|
+
cursor: pointer;
|
|
193
|
+
transition: background 120ms ease, color 120ms ease;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.cl-settings-cat-btn:hover {
|
|
197
|
+
background: var(--cl-list-hover, var(--cl-bg-hover, #1f1f22));
|
|
198
|
+
color: var(--cl-fg, #f4f4f5);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.cl-settings-cat-btn[aria-current="true"] {
|
|
202
|
+
background: var(--cl-list-active, var(--cl-bg-active, #28282b));
|
|
203
|
+
color: var(--cl-list-active-fg, var(--cl-fg, #f4f4f5));
|
|
204
|
+
font-weight: 600;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.cl-settings-list {
|
|
208
|
+
padding: 14px 24px 28px 20px;
|
|
209
|
+
overflow-y: auto;
|
|
210
|
+
display: flex;
|
|
211
|
+
flex-direction: column;
|
|
212
|
+
gap: 8px;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.cl-settings-empty {
|
|
216
|
+
padding: 16px 4px;
|
|
217
|
+
color: var(--cl-fg-muted, #a1a1aa);
|
|
218
|
+
font-size: var(--cl-ui-text-sm);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.cl-setting-item {
|
|
222
|
+
padding: 14px 16px;
|
|
223
|
+
border: 1px solid var(--cl-border, #27272a);
|
|
224
|
+
border-radius: var(--cl-radius-lg, 8px);
|
|
225
|
+
background: var(--cl-widget-bg, var(--cl-bg-panel, #18181a));
|
|
226
|
+
display: flex;
|
|
227
|
+
flex-direction: column;
|
|
228
|
+
gap: 6px;
|
|
229
|
+
transition: border-color 120ms ease;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.cl-setting-item--modified {
|
|
233
|
+
border-color: var(--cl-border-strong, #3a3a3e);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.cl-setting-item__top {
|
|
237
|
+
display: flex;
|
|
238
|
+
align-items: center;
|
|
239
|
+
justify-content: space-between;
|
|
240
|
+
gap: 12px;
|
|
241
|
+
flex-wrap: wrap;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.cl-setting-item__heading {
|
|
245
|
+
display: flex;
|
|
246
|
+
align-items: center;
|
|
247
|
+
gap: 6px;
|
|
248
|
+
flex-wrap: wrap;
|
|
249
|
+
min-width: 0;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.cl-setting-item__cat {
|
|
253
|
+
font-size: var(--cl-ui-text-xs);
|
|
254
|
+
color: var(--cl-fg-muted, #a1a1aa);
|
|
255
|
+
font-weight: 500;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.cl-setting-item__title {
|
|
259
|
+
font-size: var(--cl-ui-text-sm);
|
|
260
|
+
font-weight: 600;
|
|
261
|
+
color: var(--cl-fg-active, var(--cl-fg, #f4f4f5));
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.cl-setting-item__key {
|
|
265
|
+
font-family: var(--cl-ui-mono);
|
|
266
|
+
font-size: var(--cl-ui-text-2xs);
|
|
267
|
+
padding: 1px 5px;
|
|
268
|
+
border-radius: var(--cl-radius-sm, 4px);
|
|
269
|
+
border: 1px solid var(--cl-border, #27272a);
|
|
270
|
+
background: var(--cl-input-bg, var(--cl-bg, #0f0f10));
|
|
271
|
+
color: var(--cl-fg-muted, #a1a1aa);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.cl-setting-badge {
|
|
275
|
+
font-family: var(--cl-ui-mono);
|
|
276
|
+
font-size: var(--cl-ui-text-2xs);
|
|
277
|
+
font-weight: 600;
|
|
278
|
+
padding: 1px 6px;
|
|
279
|
+
border-radius: 999px;
|
|
280
|
+
background: var(--cl-btn-primary-bg, var(--cl-accent, #f4f4f5));
|
|
281
|
+
color: var(--cl-btn-primary-fg, var(--cl-accent-fg, #0f0f10));
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.cl-setting-item__desc {
|
|
285
|
+
font-size: var(--cl-ui-text-xs);
|
|
286
|
+
line-height: 1.5;
|
|
287
|
+
color: var(--cl-fg-muted, #a1a1aa);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.cl-setting-item__control {
|
|
291
|
+
display: flex;
|
|
292
|
+
align-items: center;
|
|
293
|
+
gap: 8px;
|
|
294
|
+
margin-top: 2px;
|
|
295
|
+
}
|
|
46
296
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
297
|
+
.cl-ui-btn {
|
|
298
|
+
display: inline-flex;
|
|
299
|
+
align-items: center;
|
|
300
|
+
justify-content: center;
|
|
301
|
+
gap: 6px;
|
|
302
|
+
height: 28px;
|
|
303
|
+
padding: 0 10px;
|
|
304
|
+
border-radius: var(--cl-radius-md, 6px);
|
|
305
|
+
border: 1px solid var(--cl-input-border, var(--cl-border, #27272a));
|
|
306
|
+
background: var(--cl-input-bg, var(--cl-bg, #0f0f10));
|
|
307
|
+
color: var(--cl-fg, #f4f4f5);
|
|
308
|
+
font-family: var(--cl-ui-sans);
|
|
309
|
+
font-size: var(--cl-ui-text-xs);
|
|
310
|
+
font-weight: 500;
|
|
311
|
+
line-height: 1;
|
|
312
|
+
cursor: pointer;
|
|
313
|
+
transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
.cl-ui-btn:hover {
|
|
317
|
+
background: var(--cl-list-hover, var(--cl-bg-hover, #1f1f22));
|
|
318
|
+
border-color: var(--cl-border-strong, #3a3a3e);
|
|
319
|
+
}
|
|
51
320
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
321
|
+
.cl-ui-control {
|
|
322
|
+
height: 30px;
|
|
323
|
+
padding: 0 9px;
|
|
324
|
+
border-radius: var(--cl-radius-md, 6px);
|
|
325
|
+
border: 1px solid var(--cl-input-border, var(--cl-border, #27272a));
|
|
326
|
+
background: var(--cl-input-bg, var(--cl-bg, #0f0f10));
|
|
327
|
+
color: var(--cl-fg, #f4f4f5);
|
|
328
|
+
font-family: var(--cl-ui-sans);
|
|
329
|
+
font-size: var(--cl-ui-text-sm);
|
|
330
|
+
outline: none;
|
|
331
|
+
transition: border-color 120ms ease;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.cl-ui-control:focus {
|
|
335
|
+
border-color: var(--cl-focus-border, #a1a1aa);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
.cl-ui-control--num {
|
|
339
|
+
width: 104px;
|
|
340
|
+
font-family: var(--cl-ui-mono);
|
|
341
|
+
font-variant-numeric: tabular-nums;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.cl-ui-control--array {
|
|
345
|
+
width: min(280px, 100%);
|
|
346
|
+
font-family: var(--cl-ui-mono);
|
|
347
|
+
font-size: var(--cl-ui-text-xs);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
.cl-ui-control--text {
|
|
351
|
+
width: min(200px, 100%);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
.cl-ui-checkbox {
|
|
355
|
+
width: 16px;
|
|
356
|
+
height: 16px;
|
|
357
|
+
accent-color: var(--cl-accent, #f4f4f5);
|
|
358
|
+
cursor: pointer;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
@media (max-width: 640px) {
|
|
362
|
+
.cl-settings-body {
|
|
363
|
+
grid-template-columns: minmax(0, 1fr);
|
|
364
|
+
}
|
|
365
|
+
.cl-settings-categories {
|
|
366
|
+
flex-direction: row;
|
|
367
|
+
border-right: none;
|
|
368
|
+
border-bottom: 1px solid var(--cl-border, #27272a);
|
|
369
|
+
overflow-x: auto;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
`;
|
|
373
|
+
|
|
374
|
+
export function ensureSettingsStylesInjected(doc?: Document): void {
|
|
375
|
+
const targetDoc = doc ?? (typeof document !== 'undefined' ? document : undefined);
|
|
376
|
+
if (!targetDoc || !targetDoc.head) return;
|
|
377
|
+
const existing =
|
|
378
|
+
typeof targetDoc.getElementById === 'function'
|
|
379
|
+
? targetDoc.getElementById(SETTINGS_STYLE_ID)
|
|
380
|
+
: typeof targetDoc.head.querySelector === 'function'
|
|
381
|
+
? targetDoc.head.querySelector(`#${SETTINGS_STYLE_ID}`)
|
|
382
|
+
: null;
|
|
383
|
+
if (existing) return;
|
|
384
|
+
if (typeof targetDoc.createElement !== 'function') return;
|
|
385
|
+
const styleEl = targetDoc.createElement('style');
|
|
386
|
+
styleEl.id = SETTINGS_STYLE_ID;
|
|
387
|
+
styleEl.textContent = SETTINGS_COMPONENT_CSS;
|
|
388
|
+
targetDoc.head.appendChild(styleEl);
|
|
389
|
+
}
|
|
56
390
|
|
|
57
391
|
function isDomHostElement(candidate: unknown): candidate is HTMLElement {
|
|
58
392
|
return Boolean(
|
|
@@ -98,32 +432,29 @@ export class SettingsDialogController implements IDisposable {
|
|
|
98
432
|
|
|
99
433
|
private buildSurfaceInnerHtml(mode: 'dialog' | 'inline'): string {
|
|
100
434
|
const titleId = mode === 'dialog' ? 'cl-settings-dialog-title' : 'cl-settings-inline-title';
|
|
101
|
-
const
|
|
102
|
-
mode === 'dialog'
|
|
103
|
-
? 'min-height:320px;max-height:62vh;'
|
|
104
|
-
: 'flex:1;min-height:0;overflow:hidden;';
|
|
435
|
+
const bodyModeClass = mode === 'dialog' ? 'cl-settings-body--dialog' : 'cl-settings-body--inline';
|
|
105
436
|
const closeBtnHtml =
|
|
106
437
|
mode === 'dialog'
|
|
107
|
-
? `<button type="button" class="codelab-btn" data-settings-action="close" aria-label="Close Settings"
|
|
438
|
+
? `<button type="button" class="codelab-btn cl-ui-btn" data-settings-action="close" aria-label="Close Settings">✕</button>`
|
|
108
439
|
: '';
|
|
109
440
|
|
|
110
441
|
return (
|
|
111
|
-
`<div class="cl-settings-header"
|
|
112
|
-
`<h2 id="${titleId}"
|
|
113
|
-
`<div
|
|
114
|
-
`<button type="button" class="codelab-btn" data-settings-action="open-json" aria-label="Open Settings (JSON)" title="Open .codelab/settings.json"
|
|
115
|
-
`<button type="button" class="codelab-btn" data-settings-action="reset-all" aria-label="Reset All Settings" title="Reset all settings to defaults"
|
|
116
|
-
`<button type="button" class="codelab-btn" data-settings-action="export" title="Export Settings JSON"
|
|
442
|
+
`<div class="cl-settings-header">` +
|
|
443
|
+
`<h2 id="${titleId}" class="cl-settings-title">Settings</h2>` +
|
|
444
|
+
`<div class="cl-settings-actions">` +
|
|
445
|
+
`<button type="button" class="codelab-btn cl-ui-btn" data-settings-action="open-json" aria-label="Open Settings (JSON)" title="Open .codelab/settings.json">Open Settings (JSON)</button>` +
|
|
446
|
+
`<button type="button" class="codelab-btn cl-ui-btn" data-settings-action="reset-all" aria-label="Reset All Settings" title="Reset all settings to defaults">Reset All Settings</button>` +
|
|
447
|
+
`<button type="button" class="codelab-btn cl-ui-btn" data-settings-action="export" title="Export Settings JSON">Export</button>` +
|
|
117
448
|
closeBtnHtml +
|
|
118
449
|
`</div>` +
|
|
119
450
|
`</div>` +
|
|
120
|
-
`<div
|
|
121
|
-
`<input type="search" data-role="settings-search" aria-label="Search settings" value="${escapeAttr(this.searchQuery)}" placeholder="Search settings"
|
|
122
|
-
`<div role="tablist" aria-label="Settings scope"
|
|
451
|
+
`<div class="cl-settings-toolbar">` +
|
|
452
|
+
`<input type="search" class="cl-settings-search" data-role="settings-search" aria-label="Search settings" value="${escapeAttr(this.searchQuery)}" placeholder="Search settings…" />` +
|
|
453
|
+
`<div role="tablist" aria-label="Settings scope" class="cl-settings-scopes" data-role="settings-scopes"></div>` +
|
|
123
454
|
`</div>` +
|
|
124
|
-
`<div class="cl-settings-body
|
|
125
|
-
`<nav data-role="settings-categories" aria-label="Setting categories"
|
|
126
|
-
`<div
|
|
455
|
+
`<div class="cl-settings-body ${bodyModeClass}">` +
|
|
456
|
+
`<nav class="cl-settings-categories" data-role="settings-categories" aria-label="Setting categories"></nav>` +
|
|
457
|
+
`<div class="cl-settings-list" data-role="settings-list"></div>` +
|
|
127
458
|
`</div>`
|
|
128
459
|
);
|
|
129
460
|
}
|
|
@@ -325,6 +656,7 @@ export class SettingsDialogController implements IDisposable {
|
|
|
325
656
|
this.dialogDisposables.clear();
|
|
326
657
|
this.dialogEl?.remove();
|
|
327
658
|
const doc = hostRoot.ownerDocument ?? document;
|
|
659
|
+
ensureSettingsStylesInjected(doc);
|
|
328
660
|
const dialog = doc.createElement('dialog');
|
|
329
661
|
dialog.className = 'codelab-dialog cl-settings-dialog';
|
|
330
662
|
dialog.setAttribute('closedby', 'any');
|
|
@@ -334,7 +666,6 @@ export class SettingsDialogController implements IDisposable {
|
|
|
334
666
|
hostRoot.appendChild(dialog);
|
|
335
667
|
this.dialogEl = dialog;
|
|
336
668
|
|
|
337
|
-
// Reset returnValue on close + Safari fallback for `closedby="any"` light dismiss
|
|
338
669
|
const onClose = (): void => {
|
|
339
670
|
dialog.returnValue = '';
|
|
340
671
|
};
|
|
@@ -411,13 +742,10 @@ export class SettingsDialogController implements IDisposable {
|
|
|
411
742
|
this.inlineCallbacks = options;
|
|
412
743
|
|
|
413
744
|
const doc = container.ownerDocument ?? document;
|
|
745
|
+
ensureSettingsStylesInjected(doc);
|
|
414
746
|
const root = doc.createElement('div');
|
|
415
747
|
root.className = 'cl-settings-editor cl-settings-inline';
|
|
416
748
|
root.setAttribute('data-role', 'settings-inline-root');
|
|
417
|
-
root.setAttribute(
|
|
418
|
-
'style',
|
|
419
|
-
`display:flex;flex-direction:column;height:100%;min-height:0;background:var(--cl-editor-bg,var(--cl-bg,#1f1f1f));color:var(--cl-fg,#cccccc);font-family:${FONT_SANS};`
|
|
420
|
-
);
|
|
421
749
|
root.innerHTML = this.buildSurfaceInnerHtml('inline');
|
|
422
750
|
|
|
423
751
|
container.appendChild(root);
|
|
@@ -464,8 +792,7 @@ export class SettingsDialogController implements IDisposable {
|
|
|
464
792
|
.map((tab) => {
|
|
465
793
|
const selected = this.activeScope === tab.id;
|
|
466
794
|
return (
|
|
467
|
-
`<button type="button" role="tab" data-settings-scope="${tab.id}" aria-selected="${selected ? 'true' : 'false'}"
|
|
468
|
-
`style="flex:none;padding:6px 12px;border:none;border-bottom:2px solid ${selected ? 'var(--cl-btn-primary-bg,var(--cl-accent,#0078d4))' : 'transparent'};background:transparent;color:${selected ? 'var(--cl-fg-active,var(--cl-fg,#ffffff))' : 'var(--cl-fg-muted,var(--cl-muted,#9d9d9d))'};cursor:pointer;font-size:13px;font-weight:${selected ? '600' : '400'};font-family:${FONT_SANS};">` +
|
|
795
|
+
`<button type="button" role="tab" class="cl-settings-scope-tab" data-settings-scope="${tab.id}" aria-selected="${selected ? 'true' : 'false'}">` +
|
|
469
796
|
`${escapeAttr(tab.label)}` +
|
|
470
797
|
`</button>`
|
|
471
798
|
);
|
|
@@ -479,8 +806,7 @@ export class SettingsDialogController implements IDisposable {
|
|
|
479
806
|
nav.innerHTML = ALL_CATEGORIES.map((cat) => {
|
|
480
807
|
const selected = cat === this.activeCategory;
|
|
481
808
|
return (
|
|
482
|
-
`<button type="button" data-settings-cat="${cat}" aria-current="${selected ? 'true' : 'false'}"
|
|
483
|
-
`style="text-align:left;padding:4px 16px;border:none;border-left:2px solid ${selected ? 'var(--cl-btn-primary-bg,var(--cl-accent,#0078d4))' : 'transparent'};background:${selected ? 'var(--cl-list-active,#04395e)' : 'transparent'};color:${selected ? 'var(--cl-list-active-fg,#ffffff)' : 'var(--cl-fg,#cccccc)'};cursor:pointer;font-size:13px;font-weight:${selected ? '600' : '400'};font-family:${FONT_SANS};line-height:22px;">` +
|
|
809
|
+
`<button type="button" class="cl-settings-cat-btn" data-settings-cat="${cat}" aria-current="${selected ? 'true' : 'false'}">` +
|
|
484
810
|
`${escapeAttr(cat)}` +
|
|
485
811
|
`</button>`
|
|
486
812
|
);
|
|
@@ -497,22 +823,22 @@ export class SettingsDialogController implements IDisposable {
|
|
|
497
823
|
return `<option value="${escapeAttr(str)}"${sel}>${escapeAttr(str)}</option>`;
|
|
498
824
|
})
|
|
499
825
|
.join('');
|
|
500
|
-
return `<select data-setting-key="${keyAttr}" aria-label="${escapeAttr(desc.title)}"
|
|
826
|
+
return `<select class="cl-ui-control" data-setting-key="${keyAttr}" aria-label="${escapeAttr(desc.title)}">${opts}</select>`;
|
|
501
827
|
}
|
|
502
828
|
if (desc.schema.type === 'boolean') {
|
|
503
829
|
const checked = Boolean(currentVal) ? ' checked' : '';
|
|
504
|
-
return `<input type="checkbox" data-setting-key="${keyAttr}" aria-label="${escapeAttr(desc.title)}"${checked} />`;
|
|
830
|
+
return `<input type="checkbox" class="cl-ui-checkbox" data-setting-key="${keyAttr}" aria-label="${escapeAttr(desc.title)}"${checked} />`;
|
|
505
831
|
}
|
|
506
832
|
if (desc.schema.type === 'integer' || desc.schema.type === 'number') {
|
|
507
833
|
const min = desc.schema.minimum !== undefined ? ` min="${desc.schema.minimum}"` : '';
|
|
508
834
|
const max = desc.schema.maximum !== undefined ? ` max="${desc.schema.maximum}"` : '';
|
|
509
|
-
return `<input type="number" data-setting-key="${keyAttr}" aria-label="${escapeAttr(desc.title)}" value="${escapeAttr(String(currentVal ?? ''))}"${min}${max}
|
|
835
|
+
return `<input type="number" class="cl-ui-control cl-ui-control--num" data-setting-key="${keyAttr}" aria-label="${escapeAttr(desc.title)}" value="${escapeAttr(String(currentVal ?? ''))}"${min}${max} />`;
|
|
510
836
|
}
|
|
511
837
|
if (desc.schema.type === 'array') {
|
|
512
838
|
const joined = Array.isArray(currentVal) ? currentVal.join(', ') : '';
|
|
513
|
-
return `<input type="text" data-setting-key="${keyAttr}" aria-label="${escapeAttr(desc.title)}" value="${escapeAttr(joined)}"
|
|
839
|
+
return `<input type="text" class="cl-ui-control cl-ui-control--array" data-setting-key="${keyAttr}" aria-label="${escapeAttr(desc.title)}" value="${escapeAttr(joined)}" />`;
|
|
514
840
|
}
|
|
515
|
-
return `<input type="text" data-setting-key="${keyAttr}" aria-label="${escapeAttr(desc.title)}" value="${escapeAttr(String(currentVal ?? ''))}"
|
|
841
|
+
return `<input type="text" class="cl-ui-control cl-ui-control--text" data-setting-key="${keyAttr}" aria-label="${escapeAttr(desc.title)}" value="${escapeAttr(String(currentVal ?? ''))}" />`;
|
|
516
842
|
}
|
|
517
843
|
|
|
518
844
|
private renderItems(root: HTMLElement): void {
|
|
@@ -526,7 +852,7 @@ export class SettingsDialogController implements IDisposable {
|
|
|
526
852
|
});
|
|
527
853
|
|
|
528
854
|
if (descriptors.length === 0) {
|
|
529
|
-
listEl.innerHTML = `<div
|
|
855
|
+
listEl.innerHTML = `<div class="cl-settings-empty">No matching settings found.</div>`;
|
|
530
856
|
return;
|
|
531
857
|
}
|
|
532
858
|
|
|
@@ -546,27 +872,25 @@ export class SettingsDialogController implements IDisposable {
|
|
|
546
872
|
? (insp.workspaceValue !== undefined ? 'workspace' : '')
|
|
547
873
|
: (insp.effectiveSource !== 'default' ? insp.effectiveSource : '');
|
|
548
874
|
|
|
549
|
-
const
|
|
550
|
-
? '2px solid var(--cl-btn-primary-bg,var(--cl-accent,#0078d4))'
|
|
551
|
-
: '2px solid transparent';
|
|
875
|
+
const modClass = canReset ? ' cl-setting-item--modified' : '';
|
|
552
876
|
|
|
553
877
|
return (
|
|
554
|
-
`<div class="cl-setting-item" data-setting-row="${escapeAttr(desc.key)}"
|
|
555
|
-
`<div
|
|
556
|
-
`<div
|
|
557
|
-
`<span
|
|
558
|
-
`<strong
|
|
559
|
-
`<code
|
|
878
|
+
`<div class="cl-setting-item${modClass}" data-setting-row="${escapeAttr(desc.key)}">` +
|
|
879
|
+
`<div class="cl-setting-item__top">` +
|
|
880
|
+
`<div class="cl-setting-item__heading">` +
|
|
881
|
+
`<span class="cl-setting-item__cat">${escapeAttr(desc.category)}:</span>` +
|
|
882
|
+
`<strong class="cl-setting-item__title">${escapeAttr(desc.title)}</strong>` +
|
|
883
|
+
`<code class="cl-setting-item__key">${escapeAttr(desc.key)}</code>` +
|
|
560
884
|
(badgeLabel
|
|
561
|
-
? `<span
|
|
885
|
+
? `<span class="cl-setting-badge" data-role="setting-badge">${escapeAttr(badgeLabel)}</span>`
|
|
562
886
|
: '') +
|
|
563
887
|
`</div>` +
|
|
564
888
|
(canReset
|
|
565
|
-
? `<button type="button" class="codelab-btn" data-reset-key="${escapeAttr(desc.key)}" title="Reset to Default (${escapeAttr(JSON.stringify(desc.defaultValue))})"
|
|
889
|
+
? `<button type="button" class="codelab-btn cl-ui-btn" data-reset-key="${escapeAttr(desc.key)}" title="Reset to Default (${escapeAttr(JSON.stringify(desc.defaultValue))})">Reset</button>`
|
|
566
890
|
: '') +
|
|
567
891
|
`</div>` +
|
|
568
|
-
`<div
|
|
569
|
-
`<div
|
|
892
|
+
`<div class="cl-setting-item__desc">${escapeAttr(desc.description)}</div>` +
|
|
893
|
+
`<div class="cl-setting-item__control">` +
|
|
570
894
|
this.renderControl(desc, displayedVal) +
|
|
571
895
|
`</div>` +
|
|
572
896
|
`</div>`
|