@workbench-kit/shell-react 0.0.2-prototype.0.2.6 → 0.0.2-prototype.0.2.8
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/README.md +41 -0
- package/package.json +9 -9
- package/src/{chat-ai-mock-proposals.ts → chat/ai-mock-proposals.ts} +39 -39
- package/src/{chat-command-input.ts → chat/command-input.ts} +52 -52
- package/src/{chat-command-policy.ts → chat/command-policy.ts} +54 -54
- package/src/{chat-command-surface.tsx → chat/command-surface.tsx} +155 -155
- package/src/{use-workbench-chat-command-proposals.ts → chat/use-chat-command-proposals.ts} +194 -194
- package/src/{chat-view-data.ts → chat/view-data.ts} +20 -20
- package/src/{chat-view.tsx → chat/view.tsx} +220 -220
- package/src/{command-inspector-surface.tsx → commands/inspector-surface.tsx} +46 -46
- package/src/{use-workbench-command-descriptors.ts → commands/use-command-descriptors.ts} +41 -41
- package/src/{use-context-key-revision.ts → commands/use-context-key-revision.ts} +18 -18
- package/src/{commands-view-data.ts → commands/view-data.ts} +17 -17
- package/src/{commands-view.tsx → commands/view.tsx} +43 -43
- package/src/devtools/WorkbenchDevtoolsPanel.tsx +124 -124
- package/src/devtools/WorkbenchDevtoolsShell.tsx +17 -17
- package/src/devtools/index.ts +11 -11
- package/src/devtools/use-workbench-devtools-snapshot.ts +84 -84
- package/src/devtools/workbench-devtools-snapshot.ts +140 -140
- package/src/devtools/workbench-devtools.css +82 -82
- package/src/{editor-area-dnd.ts → editor/area-dnd.ts} +69 -69
- package/src/{editor-area-model.ts → editor/area-model.ts} +71 -71
- package/src/{editor-area.css → editor/area.css} +454 -454
- package/src/{editor-area.tsx → editor/area.tsx} +676 -676
- package/src/{editor-host-surface.tsx → editor/host-surface.tsx} +631 -634
- package/src/{editor-pane-visibility.ts → editor/pane-visibility.ts} +130 -130
- package/src/{editor-resource.ts → editor/resource.ts} +36 -36
- package/src/{editor-state-storage.ts → editor/state-storage.ts} +182 -193
- package/src/{editor-tab-context-menu.ts → editor/tab-context-menu.ts} +118 -118
- package/src/{use-editor.ts → editor/use-editor.ts} +114 -107
- package/src/{editor-view-providers.tsx → editor/view-providers.tsx} +552 -552
- package/src/{editor-workspace-file-availability.ts → editor/workspace-file-availability.ts} +15 -15
- package/src/{editor-workspace-reconcile.tsx → editor/workspace-reconcile.tsx} +31 -28
- package/src/{explorer-context-menu.ts → explorer/context-menu.ts} +114 -114
- package/src/{createCommandWorkspaceExplorerPort.ts → explorer/create-command-workspace-explorer-port.ts} +86 -86
- package/src/{explorer-reveal.ts → explorer/reveal.ts} +112 -112
- package/src/{search-view-data.ts → explorer/search-view-data.ts} +15 -15
- package/src/{search-view.tsx → explorer/search-view.tsx} +65 -62
- package/src/{use-active-workspace-path.ts → explorer/use-active-workspace-path.ts} +15 -15
- package/src/{explorer-view-data.ts → explorer/view-data.ts} +58 -58
- package/src/{explorer-view.tsx → explorer/view.tsx} +227 -224
- package/src/{extension-context-menu.ts → extensions/context-menu.ts} +52 -52
- package/src/{extension-management-model.ts → extensions/management-model.ts} +313 -313
- package/src/{use-extension-management.ts → extensions/use-extension-management.ts} +241 -193
- package/src/{extensions-view-data.ts → extensions/view-data.ts} +19 -19
- package/src/{extensions-view.tsx → extensions/view.tsx} +63 -38
- package/src/{field-remap-demo.tsx → field-remap/demo.tsx} +18 -18
- package/src/{field-remap-editor-surface.tsx → field-remap/editor-surface.tsx} +36 -36
- package/src/{field-remap-flow-adapter.ts → field-remap/flow-adapter.ts} +240 -240
- package/src/{field-remap-flow.tsx → field-remap/flow.tsx} +369 -369
- package/src/{field-remap-graph.tsx → field-remap/graph.tsx} +559 -559
- package/src/field-remap/jsonata-transform.ts +166 -0
- package/src/{field-remap-panel.tsx → field-remap/panel.tsx} +193 -175
- package/src/{field-remap-samples.ts → field-remap/samples.ts} +352 -352
- package/src/{table-mapping-adapter.ts → field-remap/table-mapping-adapter.ts} +59 -59
- package/src/{field-remap-tree.tsx → field-remap/tree.tsx} +404 -404
- package/src/{field-remap-view-data.ts → field-remap/view-data.ts} +16 -16
- package/src/{field-remap-view.css → field-remap/view.css} +676 -676
- package/src/{field-remap-view.tsx → field-remap/view.tsx} +86 -86
- package/src/index.ts +212 -199
- package/src/{json-form-source-patch.ts → jdw/json-form-source-patch.ts} +323 -323
- package/src/{jdw-lab-view-data.ts → jdw/lab-view-data.ts} +25 -25
- package/src/{jdw-lab-view.css → jdw/lab-view.css} +21 -21
- package/src/{jdw-lab-view.tsx → jdw/lab-view.tsx} +79 -79
- package/src/{jdw-widget-form-view.tsx → jdw/widget-form-view.tsx} +68 -65
- package/src/{jdw-widget-preview-view.tsx → jdw/widget-preview-view.tsx} +54 -51
- package/src/{keybinding-overrides-storage.ts → management/keybinding-overrides-storage.ts} +49 -57
- package/src/{keybinding-management-settings.tsx → management/keybinding-settings.tsx} +16 -16
- package/src/{management-palette-commands.ts → management/palette-commands.ts} +38 -38
- package/src/{preference-settings-storage.ts → management/preference-settings-storage.ts} +50 -58
- package/src/{management-settings-ids.ts → management/settings-ids.ts} +12 -12
- package/src/{management-settings.tsx → management/settings.tsx} +96 -75
- package/src/{use-command-management.ts → management/use-command-management.ts} +191 -191
- package/src/{use-keybinding-management.ts → management/use-keybinding-management.ts} +130 -130
- package/src/{shell-model.tsx → shell/model.tsx} +149 -149
- package/src/{provider.tsx → shell/provider.tsx} +603 -573
- package/src/{shell-secondary-actions.tsx → shell/secondary-actions.tsx} +59 -59
- package/src/{shell-settings-constants.ts → shell/settings-constants.ts} +9 -9
- package/src/{shell-settings.tsx → shell/settings.tsx} +599 -599
- package/src/{shell.tsx → shell/shell.tsx} +680 -649
- package/src/{shell-titlebar-layout-controls.tsx → shell/titlebar-layout-controls.tsx} +4 -4
- package/src/{shell-view-host.tsx → shell/view-host.tsx} +212 -199
- package/src/{workbench-appearance-storage.ts → workbench/appearance-storage.ts} +107 -115
- package/src/{workbench-command-host.tsx → workbench/command-host.tsx} +243 -243
- package/src/{workbench-command-palette.ts → workbench/command-palette.ts} +208 -208
- package/src/{workbench-keybinding-bridge.ts → workbench/keybinding-bridge.ts} +54 -54
- package/src/{workbench-layout-storage.ts → workbench/layout-storage.ts} +134 -145
- package/src/{workbench-profile-modal.tsx → workbench/profile-modal.tsx} +118 -118
- package/src/{workbench-shell-command-registration.ts → workbench/shell-command-registration.ts} +58 -58
- package/src/{workbench-startup-gate.tsx → workbench/startup-gate.tsx} +136 -136
- package/src/{workbench-status-sections.ts → workbench/status-sections.ts} +43 -43
- package/src/{use-persisted-workbench-appearance.ts → workbench/use-persisted-appearance.ts} +33 -33
- package/src/{workbench-user-commands.ts → workbench/user-commands.ts} +46 -46
- package/src/{workspace-view-state.ts → workbench/workspace-view-state.ts} +35 -35
- package/src/jsonata-transform.ts +0 -36
|
@@ -1,649 +1,680 @@
|
|
|
1
|
-
import { useCallback, useEffect, useMemo, useReducer, useState, type ReactNode } from 'react';
|
|
2
|
-
import { Modal } from '@workbench-kit/react/modal';
|
|
3
|
-
import { TilepaperAppIcon } from '@workbench-kit/react';
|
|
4
|
-
import { Badge, Button, IconButton } from '@workbench-kit/react/primitives';
|
|
5
|
-
import {
|
|
6
|
-
WorkbenchSettingsModal,
|
|
7
|
-
type WorkbenchSettingsCategory,
|
|
8
|
-
} from '@workbench-kit/react/workbench/settings';
|
|
9
|
-
import {
|
|
10
|
-
WorkbenchShell as ReactWorkbenchShell,
|
|
11
|
-
type StatusBarItemModel,
|
|
12
|
-
type StatusBarSectionModel,
|
|
13
|
-
} from '@workbench-kit/react/workbench/shell';
|
|
14
|
-
import {
|
|
15
|
-
WORKBENCH_SETTINGS_CAPABILITY_ID,
|
|
16
|
-
filterActivitiesByWhenClause,
|
|
17
|
-
} from '@workbench-kit/workbench-core';
|
|
18
|
-
import type {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
import {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
import {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
const
|
|
175
|
-
const
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
);
|
|
191
|
-
const
|
|
192
|
-
const
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
);
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
);
|
|
221
|
-
const
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
layoutService.
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
}}
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
{
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
1
|
+
import { useCallback, useEffect, useMemo, useReducer, useState, type ReactNode } from 'react';
|
|
2
|
+
import { Modal } from '@workbench-kit/react/modal';
|
|
3
|
+
import { TilepaperAppIcon } from '@workbench-kit/react';
|
|
4
|
+
import { Badge, Button, IconButton } from '@workbench-kit/react/primitives';
|
|
5
|
+
import {
|
|
6
|
+
WorkbenchSettingsModal,
|
|
7
|
+
type WorkbenchSettingsCategory,
|
|
8
|
+
} from '@workbench-kit/react/workbench/settings';
|
|
9
|
+
import {
|
|
10
|
+
WorkbenchShell as ReactWorkbenchShell,
|
|
11
|
+
type StatusBarItemModel,
|
|
12
|
+
type StatusBarSectionModel,
|
|
13
|
+
} from '@workbench-kit/react/workbench/shell';
|
|
14
|
+
import {
|
|
15
|
+
WORKBENCH_SETTINGS_CAPABILITY_ID,
|
|
16
|
+
filterActivitiesByWhenClause,
|
|
17
|
+
} from '@workbench-kit/workbench-core';
|
|
18
|
+
import type {
|
|
19
|
+
ExtensionCatalogTrustPolicy,
|
|
20
|
+
WorkbenchSettingsCapability,
|
|
21
|
+
} from '@workbench-kit/workbench-core';
|
|
22
|
+
import { WORKBENCH_PERMISSION_CONTEXT_KEY_CAN_OPEN_SETTINGS } from '@workbench-kit/platform';
|
|
23
|
+
import { isPreferenceScope, type PreferenceScope } from '@workbench-kit/workbench-config';
|
|
24
|
+
import {
|
|
25
|
+
resolveActiveThemePreset,
|
|
26
|
+
DEFAULT_SHELL_PRESET,
|
|
27
|
+
useResolvedWorkbenchTheme,
|
|
28
|
+
} from '@workbench-kit/react/workbench';
|
|
29
|
+
|
|
30
|
+
import { EditorArea } from '../editor/area.js';
|
|
31
|
+
import { BUILTIN_COMMANDS_VIEW_CONTAINER_ID } from '../commands/view-data.js';
|
|
32
|
+
import { BUILTIN_EXTENSIONS_VIEW_CONTAINER_ID } from '../extensions/view-data.js';
|
|
33
|
+
import {
|
|
34
|
+
filterActivityBarItems,
|
|
35
|
+
sortActivityBarItems,
|
|
36
|
+
} from '@workbench-kit/react/workbench/activityBarOrder';
|
|
37
|
+
import { useWorkbench } from './provider.js';
|
|
38
|
+
import { WorkbenchCommandHost, type WorkbenchCommandHostProps } from '../workbench/command-host.js';
|
|
39
|
+
import {
|
|
40
|
+
MANAGE_ACCOUNTS_COMMAND_ID,
|
|
41
|
+
MANAGE_COMMANDS_COMMAND_ID,
|
|
42
|
+
MANAGE_EXTENSIONS_COMMAND_ID,
|
|
43
|
+
MANAGE_KEYBINDINGS_COMMAND_ID,
|
|
44
|
+
WORKBENCH_ACCOUNTS_SETTINGS_CATEGORY_ID,
|
|
45
|
+
WORKBENCH_COMMANDS_SETTINGS_CATEGORY_ID,
|
|
46
|
+
WORKBENCH_KEYBINDINGS_SETTINGS_CATEGORY_ID,
|
|
47
|
+
} from '../management/settings-ids.js';
|
|
48
|
+
import { createWorkbenchManagementPaletteCommands } from '../management/palette-commands.js';
|
|
49
|
+
import {
|
|
50
|
+
WorkbenchAccountManagementSettings,
|
|
51
|
+
WorkbenchCommandManagementSettings,
|
|
52
|
+
WorkbenchKeybindingManagementSettings,
|
|
53
|
+
type WorkbenchAccountManagementInput,
|
|
54
|
+
} from '../management/settings.js';
|
|
55
|
+
import { mergeWorkbenchCommandDescriptors } from '../workbench/command-palette.js';
|
|
56
|
+
import {
|
|
57
|
+
createWorkbenchSecondaryActivityItems,
|
|
58
|
+
getWorkbenchSecondaryActivityRoute,
|
|
59
|
+
} from './secondary-actions.js';
|
|
60
|
+
import { SETTINGS_EXTENSION_ID, WORKBENCH_PREFERENCE_SCOPES } from './settings-constants.js';
|
|
61
|
+
import { createSettingsCategories, type WorkbenchThemeOption } from './settings.js';
|
|
62
|
+
import {
|
|
63
|
+
createDefaultWorkbenchStatusSections,
|
|
64
|
+
createWorkbenchShellActivityItems,
|
|
65
|
+
} from './model.js';
|
|
66
|
+
import { renderDefaultPrimarySidebar } from './view-host.js';
|
|
67
|
+
import { WorkbenchShellTitleBarLayoutControls } from './titlebar-layout-controls.js';
|
|
68
|
+
import { WorkbenchProfileModal, type WorkbenchProfileInput } from '../workbench/profile-modal.js';
|
|
69
|
+
import { useContextKeyRevision } from '../commands/use-context-key-revision.js';
|
|
70
|
+
export type { WorkbenchLocaleOption, WorkbenchThemeOption } from './settings.js';
|
|
71
|
+
|
|
72
|
+
/** Virtual width used to bridge layout `sizePercent` into pixel SplitView units. */
|
|
73
|
+
const SHELL_REACT_SIDEBAR_LAYOUT_REFERENCE_WIDTH_PX = 1200;
|
|
74
|
+
const SHELL_REACT_PRIMARY_SIDEBAR_MIN_PX = 200;
|
|
75
|
+
const SHELL_REACT_PRIMARY_SIDEBAR_MAX_PX = 480;
|
|
76
|
+
|
|
77
|
+
function clampShellReactPrimarySidebarSizePx(sizePx: number): number {
|
|
78
|
+
if (!Number.isFinite(sizePx)) {
|
|
79
|
+
return SHELL_REACT_PRIMARY_SIDEBAR_MIN_PX;
|
|
80
|
+
}
|
|
81
|
+
return Math.min(
|
|
82
|
+
SHELL_REACT_PRIMARY_SIDEBAR_MAX_PX,
|
|
83
|
+
Math.max(SHELL_REACT_PRIMARY_SIDEBAR_MIN_PX, Math.round(sizePx)),
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function shellReactPrimarySidebarSizePxFromPercent(sizePercent: number | undefined): number {
|
|
88
|
+
const percent = Number.isFinite(sizePercent) ? (sizePercent as number) : 20;
|
|
89
|
+
return clampShellReactPrimarySidebarSizePx(
|
|
90
|
+
(percent / 100) * SHELL_REACT_SIDEBAR_LAYOUT_REFERENCE_WIDTH_PX,
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface WorkbenchShellProps {
|
|
95
|
+
accountManagement?: WorkbenchAccountManagementInput | undefined;
|
|
96
|
+
additionalSettingsCategories?: readonly WorkbenchSettingsCategory[] | undefined;
|
|
97
|
+
catalogTrustPolicy?: ExtensionCatalogTrustPolicy | undefined;
|
|
98
|
+
catalogUrl?: string | undefined;
|
|
99
|
+
commandHost?: false | Omit<WorkbenchCommandHostProps, 'onOpenSettings'>;
|
|
100
|
+
compactStatus?: boolean;
|
|
101
|
+
darkPreset?: string | undefined;
|
|
102
|
+
editorArea?: ReactNode;
|
|
103
|
+
helpContent?: ReactNode;
|
|
104
|
+
helpTitle?: ReactNode;
|
|
105
|
+
lightPreset?: string | undefined;
|
|
106
|
+
onDarkPresetChange?: ((preset: string) => void) | undefined;
|
|
107
|
+
onLightPresetChange?: ((preset: string) => void) | undefined;
|
|
108
|
+
onShellPresetChange?: ((preset: string) => void) | undefined;
|
|
109
|
+
onThemeChange?: ((theme: string) => void) | undefined;
|
|
110
|
+
onLocaleChange?: ((locale: string) => void) | undefined;
|
|
111
|
+
locale?: string | undefined;
|
|
112
|
+
onStatusItemActivate?: (item: StatusBarItemModel) => void;
|
|
113
|
+
primarySidebar?: ReactNode;
|
|
114
|
+
profile?: WorkbenchProfileInput | undefined;
|
|
115
|
+
profileExtraContent?: ReactNode;
|
|
116
|
+
rootClassName?: string;
|
|
117
|
+
shellPreset?: string | undefined;
|
|
118
|
+
statusSections?: StatusBarSectionModel[];
|
|
119
|
+
theme?: string;
|
|
120
|
+
themeOptions?: readonly WorkbenchThemeOption[] | undefined;
|
|
121
|
+
title?: ReactNode;
|
|
122
|
+
titleBar?: ReactNode;
|
|
123
|
+
titleBarActions?: ReactNode;
|
|
124
|
+
titleMeta?: ReactNode;
|
|
125
|
+
/**
|
|
126
|
+
* When using the default title bar, show the bottom-panel layout toggle.
|
|
127
|
+
* Defaults to `true`. Pass `false` for primary-sidebar-only hosts.
|
|
128
|
+
* Custom `titleBar` nodes are unaffected — omit panel callbacks there instead.
|
|
129
|
+
*/
|
|
130
|
+
showPanelLayoutToggle?: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* When using the default title bar, show the auxiliary sidebar layout toggle.
|
|
133
|
+
* Defaults to `true`. Pass `false` for primary-sidebar-only hosts.
|
|
134
|
+
*/
|
|
135
|
+
showAuxiliarySidebarLayoutToggle?: boolean;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const OPEN_SETTINGS_COMMAND_ID = 'workbench-kit.builtin.settings.open';
|
|
139
|
+
|
|
140
|
+
export function WorkbenchShell({
|
|
141
|
+
accountManagement,
|
|
142
|
+
additionalSettingsCategories,
|
|
143
|
+
catalogTrustPolicy,
|
|
144
|
+
catalogUrl = '/extension-catalog.json',
|
|
145
|
+
commandHost,
|
|
146
|
+
compactStatus = true,
|
|
147
|
+
darkPreset,
|
|
148
|
+
editorArea,
|
|
149
|
+
helpContent,
|
|
150
|
+
helpTitle = 'Workbench Help',
|
|
151
|
+
lightPreset,
|
|
152
|
+
locale = 'en',
|
|
153
|
+
onDarkPresetChange,
|
|
154
|
+
onLightPresetChange,
|
|
155
|
+
onLocaleChange,
|
|
156
|
+
onShellPresetChange,
|
|
157
|
+
onThemeChange,
|
|
158
|
+
onStatusItemActivate,
|
|
159
|
+
primarySidebar,
|
|
160
|
+
profile,
|
|
161
|
+
profileExtraContent,
|
|
162
|
+
rootClassName,
|
|
163
|
+
shellPreset = DEFAULT_SHELL_PRESET,
|
|
164
|
+
statusSections,
|
|
165
|
+
theme,
|
|
166
|
+
themeOptions,
|
|
167
|
+
title = 'Workbench',
|
|
168
|
+
titleBar,
|
|
169
|
+
titleBarActions,
|
|
170
|
+
titleMeta,
|
|
171
|
+
showPanelLayoutToggle = true,
|
|
172
|
+
showAuxiliarySidebarLayoutToggle = true,
|
|
173
|
+
}: WorkbenchShellProps) {
|
|
174
|
+
const resolvedEditorArea = editorArea ?? <EditorArea />;
|
|
175
|
+
const resolvedWorkbenchTheme = useResolvedWorkbenchTheme(theme ?? 'system');
|
|
176
|
+
const activeThemePreset =
|
|
177
|
+
lightPreset !== undefined && darkPreset !== undefined
|
|
178
|
+
? resolveActiveThemePreset(resolvedWorkbenchTheme, { darkPreset, lightPreset })
|
|
179
|
+
: undefined;
|
|
180
|
+
const {
|
|
181
|
+
contextKeyService,
|
|
182
|
+
executeCommand,
|
|
183
|
+
extensionRegistry,
|
|
184
|
+
layoutService,
|
|
185
|
+
missingExtensionIds,
|
|
186
|
+
preferenceService,
|
|
187
|
+
} = useWorkbench();
|
|
188
|
+
const contextKeyRevision = useContextKeyRevision(contextKeyService);
|
|
189
|
+
const forceRender = useForceRender();
|
|
190
|
+
const [preferenceRevision, bumpPreferenceRevision] = useReducer((count: number) => count + 1, 0);
|
|
191
|
+
const [isHelpOpen, setHelpOpen] = useState(false);
|
|
192
|
+
const [isProfileOpen, setProfileOpen] = useState(false);
|
|
193
|
+
const [isSettingsOpen, setSettingsOpen] = useState(false);
|
|
194
|
+
const [settingsSearchValue, setSettingsSearchValue] = useState('');
|
|
195
|
+
const [settingsCategoryId, setSettingsCategoryId] = useState<string | undefined>();
|
|
196
|
+
const [settingsScopeId, setSettingsScopeId] = useState<PreferenceScope>('workspace');
|
|
197
|
+
const showSettingsModal = useCallback((categoryId?: string) => {
|
|
198
|
+
setHelpOpen(false);
|
|
199
|
+
setProfileOpen(false);
|
|
200
|
+
setSettingsCategoryId(categoryId);
|
|
201
|
+
setSettingsOpen(true);
|
|
202
|
+
}, []);
|
|
203
|
+
const settingsCapability = useMemo<WorkbenchSettingsCapability>(
|
|
204
|
+
() => ({
|
|
205
|
+
openSettings: showSettingsModal,
|
|
206
|
+
}),
|
|
207
|
+
[showSettingsModal],
|
|
208
|
+
);
|
|
209
|
+
const layout = layoutService.getState();
|
|
210
|
+
const resolvedStatusSections = useMemo(
|
|
211
|
+
() =>
|
|
212
|
+
statusSections ??
|
|
213
|
+
createDefaultWorkbenchStatusSections({
|
|
214
|
+
dependencyDiagnostics: extensionRegistry.getDependencyDiagnostics(),
|
|
215
|
+
extensionCount: extensionRegistry.getExtensions().length,
|
|
216
|
+
missingExtensionIds,
|
|
217
|
+
profile,
|
|
218
|
+
}),
|
|
219
|
+
[extensionRegistry, missingExtensionIds, profile, statusSections],
|
|
220
|
+
);
|
|
221
|
+
const activeViewContainerId = layout.sideBar.activeViewContainer;
|
|
222
|
+
const visibleActivities = useMemo(
|
|
223
|
+
() =>
|
|
224
|
+
filterActivitiesByWhenClause(
|
|
225
|
+
extensionRegistry.activities.getActivities(),
|
|
226
|
+
contextKeyService.createSnapshot(),
|
|
227
|
+
),
|
|
228
|
+
[contextKeyRevision, contextKeyService, extensionRegistry],
|
|
229
|
+
);
|
|
230
|
+
const activityItems = sortActivityBarItems(
|
|
231
|
+
createWorkbenchShellActivityItems({
|
|
232
|
+
activeViewContainerId,
|
|
233
|
+
activities: visibleActivities,
|
|
234
|
+
viewContainers: extensionRegistry.views.getViewContainers(),
|
|
235
|
+
views: extensionRegistry.views.getViews(),
|
|
236
|
+
}),
|
|
237
|
+
layout.activityBar.itemOrder,
|
|
238
|
+
);
|
|
239
|
+
const visibleActivityItems = filterActivityBarItems(
|
|
240
|
+
activityItems,
|
|
241
|
+
layout.activityBar.hiddenItemIds,
|
|
242
|
+
);
|
|
243
|
+
const canOpenSettingsValue = contextKeyService.get(
|
|
244
|
+
WORKBENCH_PERMISSION_CONTEXT_KEY_CAN_OPEN_SETTINGS,
|
|
245
|
+
);
|
|
246
|
+
const secondaryActivityItems = createWorkbenchSecondaryActivityItems({
|
|
247
|
+
hasProfile: profile !== undefined,
|
|
248
|
+
isProfileOpen,
|
|
249
|
+
isSettingsOpen,
|
|
250
|
+
showSettings: canOpenSettingsValue !== false,
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
useEffect(() => {
|
|
254
|
+
if (visibleActivityItems.length === 0) {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
const visibleActivityIds = new Set(visibleActivityItems.map((item) => item.id));
|
|
259
|
+
if (activeViewContainerId !== undefined && !visibleActivityIds.has(activeViewContainerId)) {
|
|
260
|
+
layoutService.setActiveViewContainer(visibleActivityItems[0]?.id);
|
|
261
|
+
}
|
|
262
|
+
}, [activeViewContainerId, layoutService, visibleActivityItems]);
|
|
263
|
+
const settingsCategories = useMemo(() => {
|
|
264
|
+
const managementCategories: WorkbenchSettingsCategory[] = [];
|
|
265
|
+
|
|
266
|
+
if (commandHost !== false) {
|
|
267
|
+
managementCategories.push({
|
|
268
|
+
content: <WorkbenchCommandManagementSettings />,
|
|
269
|
+
id: WORKBENCH_COMMANDS_SETTINGS_CATEGORY_ID,
|
|
270
|
+
label: 'Commands',
|
|
271
|
+
title: 'Command management',
|
|
272
|
+
});
|
|
273
|
+
managementCategories.push({
|
|
274
|
+
content: <WorkbenchKeybindingManagementSettings />,
|
|
275
|
+
id: WORKBENCH_KEYBINDINGS_SETTINGS_CATEGORY_ID,
|
|
276
|
+
label: 'Keyboard Shortcuts',
|
|
277
|
+
title: 'Keyboard shortcut management',
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
if (accountManagement) {
|
|
282
|
+
managementCategories.push({
|
|
283
|
+
content: <WorkbenchAccountManagementSettings accountManagement={accountManagement} />,
|
|
284
|
+
id: WORKBENCH_ACCOUNTS_SETTINGS_CATEGORY_ID,
|
|
285
|
+
label: 'Linked Accounts',
|
|
286
|
+
title: 'Linked account management',
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
return [
|
|
291
|
+
...managementCategories,
|
|
292
|
+
...(additionalSettingsCategories ?? []),
|
|
293
|
+
...createSettingsCategories(extensionRegistry, {
|
|
294
|
+
activeScope: settingsScopeId,
|
|
295
|
+
darkPreset,
|
|
296
|
+
lightPreset,
|
|
297
|
+
locale,
|
|
298
|
+
onDarkPresetChange,
|
|
299
|
+
onLightPresetChange,
|
|
300
|
+
onLocaleChange,
|
|
301
|
+
onShellPresetChange,
|
|
302
|
+
onThemeChange,
|
|
303
|
+
preferenceService,
|
|
304
|
+
shellPreset,
|
|
305
|
+
theme,
|
|
306
|
+
themeOptions,
|
|
307
|
+
}),
|
|
308
|
+
];
|
|
309
|
+
}, [
|
|
310
|
+
accountManagement,
|
|
311
|
+
additionalSettingsCategories,
|
|
312
|
+
commandHost,
|
|
313
|
+
darkPreset,
|
|
314
|
+
extensionRegistry,
|
|
315
|
+
lightPreset,
|
|
316
|
+
locale,
|
|
317
|
+
onDarkPresetChange,
|
|
318
|
+
onLightPresetChange,
|
|
319
|
+
onLocaleChange,
|
|
320
|
+
onShellPresetChange,
|
|
321
|
+
onThemeChange,
|
|
322
|
+
preferenceService,
|
|
323
|
+
preferenceRevision,
|
|
324
|
+
settingsScopeId,
|
|
325
|
+
shellPreset,
|
|
326
|
+
theme,
|
|
327
|
+
themeOptions,
|
|
328
|
+
]);
|
|
329
|
+
const defaultSettingsCategoryId =
|
|
330
|
+
settingsCategories.find((category) => category.id === SETTINGS_EXTENSION_ID)?.id ??
|
|
331
|
+
settingsCategories[0]?.id;
|
|
332
|
+
const settingsContributionCount = extensionRegistry.configurations.getConfigurations().length;
|
|
333
|
+
const showHelpModal = useCallback(() => {
|
|
334
|
+
setSettingsOpen(false);
|
|
335
|
+
setProfileOpen(false);
|
|
336
|
+
setHelpOpen(true);
|
|
337
|
+
}, []);
|
|
338
|
+
const showProfileModal = useCallback(() => {
|
|
339
|
+
setSettingsOpen(false);
|
|
340
|
+
setHelpOpen(false);
|
|
341
|
+
setProfileOpen(true);
|
|
342
|
+
}, []);
|
|
343
|
+
const resolvedTitleBar =
|
|
344
|
+
titleBar === undefined ? (
|
|
345
|
+
<WorkbenchShellTitleBar
|
|
346
|
+
helpContent={helpContent}
|
|
347
|
+
isAuxiliarySidebarVisible={layout.auxiliaryBar.visible}
|
|
348
|
+
isPanelVisible={layout.panel.visible}
|
|
349
|
+
isPrimarySidebarVisible={layout.sideBar.visible}
|
|
350
|
+
showAuxiliarySidebarLayoutToggle={showAuxiliarySidebarLayoutToggle}
|
|
351
|
+
showPanelLayoutToggle={showPanelLayoutToggle}
|
|
352
|
+
title={title}
|
|
353
|
+
titleBarActions={titleBarActions}
|
|
354
|
+
titleMeta={titleMeta}
|
|
355
|
+
onHelpOpen={showHelpModal}
|
|
356
|
+
onToggleAuxiliarySidebar={() => {
|
|
357
|
+
layoutService.setAuxiliaryBarVisible(!layout.auxiliaryBar.visible);
|
|
358
|
+
}}
|
|
359
|
+
onTogglePanel={() => {
|
|
360
|
+
layoutService.setPanelVisible(!layout.panel.visible);
|
|
361
|
+
}}
|
|
362
|
+
onTogglePrimarySidebar={() => {
|
|
363
|
+
layoutService.setSideBarVisible(!layout.sideBar.visible);
|
|
364
|
+
}}
|
|
365
|
+
/>
|
|
366
|
+
) : (
|
|
367
|
+
titleBar
|
|
368
|
+
);
|
|
369
|
+
|
|
370
|
+
useEffect(() => {
|
|
371
|
+
const layoutDisposable = layoutService.onDidChangeLayout(forceRender);
|
|
372
|
+
const viewProviderDisposable = extensionRegistry.views.onDidRegisterViewProvider(forceRender);
|
|
373
|
+
const preferenceDisposable = preferenceService.onDidChangePreference(bumpPreferenceRevision);
|
|
374
|
+
|
|
375
|
+
return () => {
|
|
376
|
+
layoutDisposable.dispose();
|
|
377
|
+
viewProviderDisposable.dispose();
|
|
378
|
+
preferenceDisposable.dispose();
|
|
379
|
+
};
|
|
380
|
+
}, [extensionRegistry, forceRender, layoutService, preferenceService]);
|
|
381
|
+
|
|
382
|
+
useEffect(() => {
|
|
383
|
+
if (!activeViewContainerId) {
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
for (const view of extensionRegistry.views.getViews(activeViewContainerId)) {
|
|
388
|
+
void extensionRegistry.activateView(view.id).then(forceRender);
|
|
389
|
+
}
|
|
390
|
+
}, [activeViewContainerId, extensionRegistry, forceRender]);
|
|
391
|
+
|
|
392
|
+
useEffect(() => {
|
|
393
|
+
if (extensionRegistry.capabilityRegistry.has(WORKBENCH_SETTINGS_CAPABILITY_ID)) {
|
|
394
|
+
return undefined;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
const disposable = extensionRegistry.capabilityRegistry.register({
|
|
398
|
+
id: WORKBENCH_SETTINGS_CAPABILITY_ID,
|
|
399
|
+
get: () => settingsCapability,
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
return () => {
|
|
403
|
+
disposable.dispose();
|
|
404
|
+
};
|
|
405
|
+
}, [extensionRegistry, settingsCapability]);
|
|
406
|
+
|
|
407
|
+
const openSettings = (categoryId?: string) => {
|
|
408
|
+
showSettingsModal(categoryId);
|
|
409
|
+
if (
|
|
410
|
+
categoryId === undefined &&
|
|
411
|
+
extensionRegistry.commands.hasCommand(OPEN_SETTINGS_COMMAND_ID)
|
|
412
|
+
) {
|
|
413
|
+
void executeCommand(OPEN_SETTINGS_COMMAND_ID).catch(() => undefined);
|
|
414
|
+
}
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
const resolvedCommandHost = useMemo(():
|
|
418
|
+
false | Omit<WorkbenchCommandHostProps, 'onOpenSettings'> => {
|
|
419
|
+
if (commandHost === false) {
|
|
420
|
+
return false;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
const hostProps = commandHost ?? {};
|
|
424
|
+
const additionalCommands = mergeWorkbenchCommandDescriptors(
|
|
425
|
+
[...createWorkbenchManagementPaletteCommands()],
|
|
426
|
+
[...(hostProps.additionalCommands ?? [])],
|
|
427
|
+
);
|
|
428
|
+
|
|
429
|
+
return {
|
|
430
|
+
...hostProps,
|
|
431
|
+
additionalCommands,
|
|
432
|
+
onRunCommand: (command, context) => {
|
|
433
|
+
if (command.id === MANAGE_COMMANDS_COMMAND_ID) {
|
|
434
|
+
layoutService.setActiveViewContainer(BUILTIN_COMMANDS_VIEW_CONTAINER_ID);
|
|
435
|
+
layoutService.setSideBarVisible(true);
|
|
436
|
+
return true;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
if (command.id === MANAGE_KEYBINDINGS_COMMAND_ID) {
|
|
440
|
+
openSettings(WORKBENCH_KEYBINDINGS_SETTINGS_CATEGORY_ID);
|
|
441
|
+
return true;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
if (command.id === MANAGE_EXTENSIONS_COMMAND_ID) {
|
|
445
|
+
layoutService.setActiveViewContainer(BUILTIN_EXTENSIONS_VIEW_CONTAINER_ID);
|
|
446
|
+
layoutService.setSideBarVisible(true);
|
|
447
|
+
return true;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
if (command.id === MANAGE_ACCOUNTS_COMMAND_ID) {
|
|
451
|
+
openSettings(WORKBENCH_ACCOUNTS_SETTINGS_CATEGORY_ID);
|
|
452
|
+
return true;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
return hostProps.onRunCommand?.(command, context) ?? false;
|
|
456
|
+
},
|
|
457
|
+
};
|
|
458
|
+
}, [commandHost, layoutService]);
|
|
459
|
+
|
|
460
|
+
const handleStatusItemActivate = useCallback(
|
|
461
|
+
(item: StatusBarItemModel) => {
|
|
462
|
+
if (item.id === 'workbench.account') {
|
|
463
|
+
if (profile) {
|
|
464
|
+
showProfileModal();
|
|
465
|
+
return;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
if (accountManagement) {
|
|
469
|
+
openSettings(WORKBENCH_ACCOUNTS_SETTINGS_CATEGORY_ID);
|
|
470
|
+
return;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
onStatusItemActivate?.(item);
|
|
477
|
+
},
|
|
478
|
+
[accountManagement, onStatusItemActivate, profile, showProfileModal],
|
|
479
|
+
);
|
|
480
|
+
|
|
481
|
+
return (
|
|
482
|
+
<ReactWorkbenchShell
|
|
483
|
+
activityBar={{
|
|
484
|
+
visible: layout.activityBar.visible,
|
|
485
|
+
items: visibleActivityItems,
|
|
486
|
+
reorderable: true,
|
|
487
|
+
secondaryItems: secondaryActivityItems,
|
|
488
|
+
onItemActivate: (item) => {
|
|
489
|
+
const secondaryActivityRoute = getWorkbenchSecondaryActivityRoute(item.id);
|
|
490
|
+
if (secondaryActivityRoute === 'profile') {
|
|
491
|
+
showProfileModal();
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
if (secondaryActivityRoute === 'settings') {
|
|
496
|
+
openSettings();
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
layoutService.focusSideBarViewContainer(item.id);
|
|
501
|
+
},
|
|
502
|
+
onItemsReorder: (itemIds) => {
|
|
503
|
+
const preservedItemIds =
|
|
504
|
+
layout.activityBar.itemOrder?.filter((itemId) => !itemIds.includes(itemId)) ?? [];
|
|
505
|
+
layoutService.setActivityBarItemOrder([...itemIds, ...preservedItemIds]);
|
|
506
|
+
},
|
|
507
|
+
}}
|
|
508
|
+
compactStatus={compactStatus}
|
|
509
|
+
onStatusItemActivate={handleStatusItemActivate}
|
|
510
|
+
primarySidebar={{
|
|
511
|
+
isVisible: layout.sideBar.visible,
|
|
512
|
+
// Provider layout still stores sideBar.sizePercent; convert at the shell boundary
|
|
513
|
+
// until workbench-core persists pixel widths directly.
|
|
514
|
+
maxPrimarySizePx: SHELL_REACT_PRIMARY_SIDEBAR_MAX_PX,
|
|
515
|
+
minPrimarySizePx: SHELL_REACT_PRIMARY_SIDEBAR_MIN_PX,
|
|
516
|
+
node:
|
|
517
|
+
primarySidebar ??
|
|
518
|
+
renderDefaultPrimarySidebar(
|
|
519
|
+
extensionRegistry,
|
|
520
|
+
activeViewContainerId,
|
|
521
|
+
catalogUrl,
|
|
522
|
+
catalogTrustPolicy,
|
|
523
|
+
),
|
|
524
|
+
onSizePxChange: (sizePx) => {
|
|
525
|
+
layoutService.setSideBarSizePercent(
|
|
526
|
+
(clampShellReactPrimarySidebarSizePx(sizePx) /
|
|
527
|
+
SHELL_REACT_SIDEBAR_LAYOUT_REFERENCE_WIDTH_PX) *
|
|
528
|
+
100,
|
|
529
|
+
);
|
|
530
|
+
},
|
|
531
|
+
primarySizePx: shellReactPrimarySidebarSizePxFromPercent(layout.sideBar.sizePercent),
|
|
532
|
+
}}
|
|
533
|
+
auxiliarySidebar={{
|
|
534
|
+
isVisible: layout.auxiliaryBar.visible,
|
|
535
|
+
node: <aside aria-label="Secondary Side Bar" className="workbench-auxiliary-side-bar" />,
|
|
536
|
+
}}
|
|
537
|
+
bottomPanel={{
|
|
538
|
+
isVisible: layout.panel.visible,
|
|
539
|
+
node: <section aria-label="Panel" className="workbench-bottom-panel" />,
|
|
540
|
+
}}
|
|
541
|
+
rootClassName={rootClassName}
|
|
542
|
+
secondaryArea={resolvedEditorArea}
|
|
543
|
+
statusSections={resolvedStatusSections}
|
|
544
|
+
titleBar={resolvedTitleBar}
|
|
545
|
+
theme={resolvedWorkbenchTheme}
|
|
546
|
+
themePreset={activeThemePreset}
|
|
547
|
+
shellPreset={shellPreset}
|
|
548
|
+
overlays={
|
|
549
|
+
<>
|
|
550
|
+
{commandHost !== false ? (
|
|
551
|
+
<WorkbenchCommandHost
|
|
552
|
+
{...(resolvedCommandHost === false ? {} : resolvedCommandHost)}
|
|
553
|
+
onOpenSettings={() => openSettings()}
|
|
554
|
+
/>
|
|
555
|
+
) : null}
|
|
556
|
+
{isSettingsOpen ? (
|
|
557
|
+
<WorkbenchSettingsModal
|
|
558
|
+
activeCategoryId={settingsCategoryId}
|
|
559
|
+
activeScopeId={settingsScopeId}
|
|
560
|
+
categories={settingsCategories}
|
|
561
|
+
defaultActiveCategoryId={defaultSettingsCategoryId}
|
|
562
|
+
defaultActiveScopeId="workspace"
|
|
563
|
+
footer={<Button onClick={() => setSettingsOpen(false)}>Close</Button>}
|
|
564
|
+
scopes={[...WORKBENCH_PREFERENCE_SCOPES]}
|
|
565
|
+
searchValue={settingsSearchValue}
|
|
566
|
+
title="Settings"
|
|
567
|
+
titleSuffix={
|
|
568
|
+
<Badge variant="muted">
|
|
569
|
+
{settingsContributionCount === 1
|
|
570
|
+
? '1 contribution'
|
|
571
|
+
: `${settingsContributionCount} contributions`}
|
|
572
|
+
</Badge>
|
|
573
|
+
}
|
|
574
|
+
onActiveCategoryIdChange={setSettingsCategoryId}
|
|
575
|
+
onClose={() => setSettingsOpen(false)}
|
|
576
|
+
onScopeChange={(scopeId) => {
|
|
577
|
+
if (isPreferenceScope(scopeId)) {
|
|
578
|
+
setSettingsScopeId(scopeId);
|
|
579
|
+
}
|
|
580
|
+
}}
|
|
581
|
+
onSearchValueChange={setSettingsSearchValue}
|
|
582
|
+
/>
|
|
583
|
+
) : null}
|
|
584
|
+
{isProfileOpen && profile ? (
|
|
585
|
+
<WorkbenchProfileModal
|
|
586
|
+
extraContent={profileExtraContent}
|
|
587
|
+
profile={profile}
|
|
588
|
+
onClose={() => setProfileOpen(false)}
|
|
589
|
+
/>
|
|
590
|
+
) : null}
|
|
591
|
+
{isHelpOpen && helpContent ? (
|
|
592
|
+
<Modal
|
|
593
|
+
bodyPadding="lg"
|
|
594
|
+
bodyScroll="auto"
|
|
595
|
+
className="workbench-help-modal"
|
|
596
|
+
closeLabel="Close help"
|
|
597
|
+
footer={<Button onClick={() => setHelpOpen(false)}>Close</Button>}
|
|
598
|
+
title={helpTitle}
|
|
599
|
+
onClose={() => setHelpOpen(false)}
|
|
600
|
+
>
|
|
601
|
+
{helpContent}
|
|
602
|
+
</Modal>
|
|
603
|
+
) : null}
|
|
604
|
+
</>
|
|
605
|
+
}
|
|
606
|
+
/>
|
|
607
|
+
);
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
function WorkbenchShellTitleBar({
|
|
611
|
+
helpContent,
|
|
612
|
+
isAuxiliarySidebarVisible,
|
|
613
|
+
isPanelVisible,
|
|
614
|
+
isPrimarySidebarVisible,
|
|
615
|
+
showAuxiliarySidebarLayoutToggle,
|
|
616
|
+
showPanelLayoutToggle,
|
|
617
|
+
title,
|
|
618
|
+
titleBarActions,
|
|
619
|
+
titleMeta,
|
|
620
|
+
onHelpOpen,
|
|
621
|
+
onToggleAuxiliarySidebar,
|
|
622
|
+
onTogglePanel,
|
|
623
|
+
onTogglePrimarySidebar,
|
|
624
|
+
}: {
|
|
625
|
+
helpContent: ReactNode | undefined;
|
|
626
|
+
isAuxiliarySidebarVisible: boolean;
|
|
627
|
+
isPanelVisible: boolean;
|
|
628
|
+
isPrimarySidebarVisible: boolean;
|
|
629
|
+
showAuxiliarySidebarLayoutToggle: boolean;
|
|
630
|
+
showPanelLayoutToggle: boolean;
|
|
631
|
+
title: ReactNode;
|
|
632
|
+
titleBarActions: ReactNode | undefined;
|
|
633
|
+
titleMeta: ReactNode | undefined;
|
|
634
|
+
onHelpOpen: () => void;
|
|
635
|
+
onToggleAuxiliarySidebar: () => void;
|
|
636
|
+
onTogglePanel: () => void;
|
|
637
|
+
onTogglePrimarySidebar: () => void;
|
|
638
|
+
}) {
|
|
639
|
+
return (
|
|
640
|
+
<>
|
|
641
|
+
<div className="workbench-shell-titlebar__identity">
|
|
642
|
+
<span aria-hidden className="workbench-shell-titlebar__app-icon">
|
|
643
|
+
<TilepaperAppIcon compact />
|
|
644
|
+
</span>
|
|
645
|
+
<span className="workbench-shell-titlebar__title">{title}</span>
|
|
646
|
+
{titleMeta ? <span className="workbench-shell-titlebar__meta">{titleMeta}</span> : null}
|
|
647
|
+
</div>
|
|
648
|
+
<div className="workbench-shell-titlebar__actions">
|
|
649
|
+
<WorkbenchShellTitleBarLayoutControls
|
|
650
|
+
isAuxiliarySidebarVisible={isAuxiliarySidebarVisible}
|
|
651
|
+
isPanelVisible={isPanelVisible}
|
|
652
|
+
isPrimarySidebarVisible={isPrimarySidebarVisible}
|
|
653
|
+
onToggleAuxiliarySidebar={
|
|
654
|
+
showAuxiliarySidebarLayoutToggle ? onToggleAuxiliarySidebar : undefined
|
|
655
|
+
}
|
|
656
|
+
onTogglePanel={showPanelLayoutToggle ? onTogglePanel : undefined}
|
|
657
|
+
onTogglePrimarySidebar={onTogglePrimarySidebar}
|
|
658
|
+
/>
|
|
659
|
+
{titleBarActions}
|
|
660
|
+
{helpContent ? (
|
|
661
|
+
<IconButton
|
|
662
|
+
className="workbench-shell-titlebar__action"
|
|
663
|
+
compact
|
|
664
|
+
icon="question"
|
|
665
|
+
label="Help"
|
|
666
|
+
onClick={onHelpOpen}
|
|
667
|
+
/>
|
|
668
|
+
) : null}
|
|
669
|
+
</div>
|
|
670
|
+
</>
|
|
671
|
+
);
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
function useForceRender() {
|
|
675
|
+
const [, forceRender] = useReducer((count: number) => count + 1, 0);
|
|
676
|
+
|
|
677
|
+
return useCallback(() => {
|
|
678
|
+
forceRender();
|
|
679
|
+
}, []);
|
|
680
|
+
}
|