@workbench-kit/shell-react 0.0.2-prototype.0.2.15 → 0.0.2-prototype.0.2.16
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/package.json +8 -8
- package/src/field-remap/view-data.ts +1 -0
- package/src/field-remap/view.tsx +19 -0
- package/src/index.ts +6 -1
- package/src/jdw/lab-view-data.ts +1 -0
- package/src/jdw/lab-view.tsx +27 -0
- package/src/shell/provider.tsx +16 -1
- package/src/shell/shell.tsx +48 -8
- package/src/shell/view-host.tsx +80 -45
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workbench-kit/shell-react",
|
|
3
|
-
"version": "0.0.2-prototype.0.2.
|
|
3
|
+
"version": "0.0.2-prototype.0.2.16",
|
|
4
4
|
"private": false,
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"**/*.css"
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
"@xyflow/react": "^12.11.2",
|
|
25
25
|
"jsonata": "^2.2.0",
|
|
26
26
|
"react-table-mapping": "^1.0.3",
|
|
27
|
-
"@workbench-kit/
|
|
28
|
-
"@workbench-kit/
|
|
29
|
-
"@workbench-kit/
|
|
30
|
-
"@workbench-kit/
|
|
31
|
-
"@workbench-kit/workbench-
|
|
32
|
-
"@workbench-kit/
|
|
33
|
-
"@workbench-kit/workspace": "0.0.2-prototype.0.2.
|
|
27
|
+
"@workbench-kit/react": "0.0.2-prototype.0.2.16",
|
|
28
|
+
"@workbench-kit/workbench-config": "0.0.2-prototype.0.2.16",
|
|
29
|
+
"@workbench-kit/field-remap": "0.0.2-prototype.0.2.16",
|
|
30
|
+
"@workbench-kit/tokens": "0.0.2-prototype.0.2.16",
|
|
31
|
+
"@workbench-kit/workbench-core": "0.0.2-prototype.0.2.16",
|
|
32
|
+
"@workbench-kit/platform": "0.0.2-prototype.0.2.16",
|
|
33
|
+
"@workbench-kit/workspace": "0.0.2-prototype.0.2.16"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"react": "^19.0.0",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export const SAMPLE_FIELD_REMAP_VIEW_RENDER_KIND =
|
|
2
2
|
'workbench-kit.samples.field-remap.view' as const;
|
|
3
|
+
export const SAMPLE_FIELD_REMAP_VIEW_ID = 'workbench-kit.samples.field-remap.panel' as const;
|
|
3
4
|
|
|
4
5
|
export interface SampleFieldRemapViewRenderData {
|
|
5
6
|
readonly kind: typeof SAMPLE_FIELD_REMAP_VIEW_RENDER_KIND;
|
package/src/field-remap/view.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { JSX } from 'react';
|
|
2
2
|
import { WorkbenchActionSidebar } from '@workbench-kit/react/layout';
|
|
3
|
+
import type { ViewHostFactory } from '@workbench-kit/workbench-core';
|
|
3
4
|
|
|
4
5
|
import './view.css';
|
|
5
6
|
|
|
@@ -10,6 +11,7 @@ import {
|
|
|
10
11
|
} from './samples.js';
|
|
11
12
|
import {
|
|
12
13
|
isSampleFieldRemapViewRenderData,
|
|
14
|
+
SAMPLE_FIELD_REMAP_VIEW_ID,
|
|
13
15
|
SAMPLE_FIELD_REMAP_VIEW_RENDER_KIND,
|
|
14
16
|
type SampleFieldRemapViewRenderData,
|
|
15
17
|
} from './view-data.js';
|
|
@@ -43,6 +45,23 @@ export interface SampleFieldRemapViewProps {
|
|
|
43
45
|
readonly className?: string | undefined;
|
|
44
46
|
}
|
|
45
47
|
|
|
48
|
+
export const SAMPLE_FIELD_REMAP_VIEW_HOST_FACTORY: ViewHostFactory = {
|
|
49
|
+
id: 'workbench-kit.samples.field-remap.react-view-host',
|
|
50
|
+
priority: 100,
|
|
51
|
+
canCreate: ({ viewId }) => viewId === SAMPLE_FIELD_REMAP_VIEW_ID,
|
|
52
|
+
create: ({ provider }) => {
|
|
53
|
+
const host = provider.resolveViewHost();
|
|
54
|
+
const render = host.render.bind(host);
|
|
55
|
+
|
|
56
|
+
host.render = () => {
|
|
57
|
+
const renderData = render();
|
|
58
|
+
return isSampleFieldRemapViewRenderData(renderData) ? <SampleFieldRemapView /> : renderData;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return host;
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
|
|
46
65
|
/** Sidebar: catalog of field-remap / table-mapping samples. */
|
|
47
66
|
export function SampleFieldRemapView({ className }: SampleFieldRemapViewProps = {}): JSX.Element {
|
|
48
67
|
const editorService = useEditorService();
|
package/src/index.ts
CHANGED
|
@@ -80,7 +80,11 @@ export {
|
|
|
80
80
|
isBuiltinEditorMarkdownPreviewRenderData,
|
|
81
81
|
type BuiltinEditorMarkdownPreviewRenderData,
|
|
82
82
|
} from './editor/markdown-document-view-data.js';
|
|
83
|
-
export {
|
|
83
|
+
export {
|
|
84
|
+
SAMPLE_JDW_LAB_VIEW_HOST_FACTORY,
|
|
85
|
+
SampleJdwLabView,
|
|
86
|
+
type SampleJdwLabViewProps,
|
|
87
|
+
} from './jdw/lab-view.js';
|
|
84
88
|
export { JdwWidgetFormView, type JdwWidgetFormViewProps } from './jdw/widget-form-view.js';
|
|
85
89
|
export { JdwWidgetPreviewView, type JdwWidgetPreviewViewProps } from './jdw/widget-preview-view.js';
|
|
86
90
|
export {
|
|
@@ -186,6 +190,7 @@ export {
|
|
|
186
190
|
type FieldRemapSampleId,
|
|
187
191
|
} from './field-remap/samples.js';
|
|
188
192
|
export {
|
|
193
|
+
SAMPLE_FIELD_REMAP_VIEW_HOST_FACTORY,
|
|
189
194
|
SampleFieldRemapView,
|
|
190
195
|
buildFieldRemapEditorUri,
|
|
191
196
|
parseFieldRemapEditorSampleId,
|
package/src/jdw/lab-view-data.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export const SAMPLE_JDW_LAB_VIEW_RENDER_KIND = 'workbench-kit.samples.jdw.view' as const;
|
|
2
|
+
export const SAMPLE_JDW_LAB_VIEW_ID = 'workbench-kit.samples.jdw.panel' as const;
|
|
2
3
|
|
|
3
4
|
export interface SampleJdwLabViewRenderData {
|
|
4
5
|
readonly kind: typeof SAMPLE_JDW_LAB_VIEW_RENDER_KIND;
|
package/src/jdw/lab-view.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { WorkbenchActionSidebar } from '@workbench-kit/react/layout';
|
|
2
|
+
import type { ViewHostFactory } from '@workbench-kit/workbench-core';
|
|
2
3
|
|
|
3
4
|
import './lab-view.css';
|
|
4
5
|
|
|
@@ -7,6 +8,7 @@ import { useActiveEditorTab } from '../editor/use-editor.js';
|
|
|
7
8
|
import { useActiveWorkspacePath } from '../explorer/use-active-workspace-path.js';
|
|
8
9
|
import {
|
|
9
10
|
isSampleJdwLabViewRenderData,
|
|
11
|
+
SAMPLE_JDW_LAB_VIEW_ID,
|
|
10
12
|
SAMPLE_JDW_LAB_VIEW_RENDER_KIND,
|
|
11
13
|
type SampleJdwLabViewRenderData,
|
|
12
14
|
} from './lab-view-data.js';
|
|
@@ -24,6 +26,31 @@ export interface SampleJdwLabViewProps {
|
|
|
24
26
|
readonly widgetTreePath?: string | undefined;
|
|
25
27
|
}
|
|
26
28
|
|
|
29
|
+
export const SAMPLE_JDW_LAB_VIEW_HOST_FACTORY: ViewHostFactory = {
|
|
30
|
+
id: 'workbench-kit.samples.jdw.react-view-host',
|
|
31
|
+
priority: 100,
|
|
32
|
+
canCreate: ({ viewId }) => viewId === SAMPLE_JDW_LAB_VIEW_ID,
|
|
33
|
+
create: ({ provider }) => {
|
|
34
|
+
const host = provider.resolveViewHost();
|
|
35
|
+
const render = host.render.bind(host);
|
|
36
|
+
|
|
37
|
+
host.render = () => {
|
|
38
|
+
const renderData = render();
|
|
39
|
+
|
|
40
|
+
return isSampleJdwLabViewRenderData(renderData) ? (
|
|
41
|
+
<SampleJdwLabView
|
|
42
|
+
templateJdwPath={renderData.templateJdwPath}
|
|
43
|
+
widgetTreePath={renderData.widgetTreePath}
|
|
44
|
+
/>
|
|
45
|
+
) : (
|
|
46
|
+
renderData
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
return host;
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
|
|
27
54
|
function pathMatches(activePath: string | undefined, candidate: string): boolean {
|
|
28
55
|
if (!activePath) {
|
|
29
56
|
return false;
|
package/src/shell/provider.tsx
CHANGED
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
type WorkbenchEditorSavePort,
|
|
35
35
|
type WorkbenchExtensionDescription,
|
|
36
36
|
type WorkbenchLayoutStateInput,
|
|
37
|
+
type ViewHostFactory,
|
|
37
38
|
} from '@workbench-kit/workbench-core';
|
|
38
39
|
import {
|
|
39
40
|
ContextKeyService,
|
|
@@ -140,6 +141,8 @@ export interface WorkbenchProviderProps {
|
|
|
140
141
|
persistLayout?: boolean;
|
|
141
142
|
persistLocalPreferences?: boolean;
|
|
142
143
|
userCommands?: readonly WorkbenchUserCommandDefinition[];
|
|
144
|
+
/** Host-owned framework adapters registered before extension activation. */
|
|
145
|
+
viewHostFactories?: readonly ViewHostFactory[] | undefined;
|
|
143
146
|
workspaceHostPort?: WorkbenchWorkspaceHostPort | undefined;
|
|
144
147
|
}
|
|
145
148
|
|
|
@@ -212,6 +215,7 @@ export function WorkbenchProvider({
|
|
|
212
215
|
persistLayout,
|
|
213
216
|
persistLocalPreferences,
|
|
214
217
|
userCommands = [],
|
|
218
|
+
viewHostFactories,
|
|
215
219
|
workspaceHostPort,
|
|
216
220
|
}: WorkbenchProviderProps) {
|
|
217
221
|
const hostAvailableExtensions = availableExtensions ?? DEFAULT_AVAILABLE_EXTENSIONS;
|
|
@@ -335,6 +339,9 @@ export function WorkbenchProvider({
|
|
|
335
339
|
|
|
336
340
|
const services = useMemo<WorkbenchProviderServices>(() => {
|
|
337
341
|
const extensionRegistry = new ExtensionRegistry();
|
|
342
|
+
const viewHostFactoryDisposables = (viewHostFactories ?? []).map((factory) =>
|
|
343
|
+
extensionRegistry.viewHostFactories.register(factory),
|
|
344
|
+
);
|
|
338
345
|
const editorDocumentViewProviders = extensionRegistry.editorDocumentViews;
|
|
339
346
|
const editorDocumentViewProviderDisposables = [
|
|
340
347
|
...(includeDefaultDocumentViewProviders === false
|
|
@@ -433,6 +440,9 @@ export function WorkbenchProvider({
|
|
|
433
440
|
for (const disposable of editorDocumentViewProviderDisposables) {
|
|
434
441
|
disposable.dispose();
|
|
435
442
|
}
|
|
443
|
+
for (const disposable of viewHostFactoryDisposables) {
|
|
444
|
+
disposable.dispose();
|
|
445
|
+
}
|
|
436
446
|
extensionRegistry.dispose();
|
|
437
447
|
layoutService.dispose();
|
|
438
448
|
preferenceService.dispose();
|
|
@@ -465,6 +475,7 @@ export function WorkbenchProvider({
|
|
|
465
475
|
resolvedInitialLayout,
|
|
466
476
|
resolvedInitialLocalPreferences,
|
|
467
477
|
userCommands,
|
|
478
|
+
viewHostFactories,
|
|
468
479
|
workspaceHostPort,
|
|
469
480
|
]);
|
|
470
481
|
|
|
@@ -473,7 +484,11 @@ export function WorkbenchProvider({
|
|
|
473
484
|
return undefined;
|
|
474
485
|
}
|
|
475
486
|
|
|
476
|
-
const disposable = services.layoutService.onDidChangeLayout(({ state }) => {
|
|
487
|
+
const disposable = services.layoutService.onDidChangeLayout(({ state, transient }) => {
|
|
488
|
+
if (transient) {
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
|
|
477
492
|
writePersistedWorkbenchLayout(state, layoutStorageKey, layoutStorage);
|
|
478
493
|
});
|
|
479
494
|
|
package/src/shell/shell.tsx
CHANGED
|
@@ -70,7 +70,12 @@ import {
|
|
|
70
70
|
createWorkbenchShellActivityItems,
|
|
71
71
|
} from './model.js';
|
|
72
72
|
import { mergeWorkbenchStatusSections } from '../workbench/status-sections.js';
|
|
73
|
-
import {
|
|
73
|
+
import {
|
|
74
|
+
getVisibleWorkbenchViews,
|
|
75
|
+
renderDefaultAuxiliarySidebar,
|
|
76
|
+
renderDefaultBottomPanel,
|
|
77
|
+
renderDefaultPrimarySidebar,
|
|
78
|
+
} from './view-host.js';
|
|
74
79
|
import { WorkbenchShellTitleBarLayoutControls } from './titlebar-layout-controls.js';
|
|
75
80
|
import { WorkbenchProfileModal, type WorkbenchProfileInput } from '../workbench/profile-modal.js';
|
|
76
81
|
import { useContextKeyRevision } from '../commands/use-context-key-revision.js';
|
|
@@ -205,6 +210,10 @@ export function WorkbenchShell({
|
|
|
205
210
|
preferenceService,
|
|
206
211
|
} = useWorkbench();
|
|
207
212
|
const contextKeyRevision = useContextKeyRevision(contextKeyService);
|
|
213
|
+
const contextKeySnapshot = useMemo(
|
|
214
|
+
() => contextKeyService.createSnapshot(),
|
|
215
|
+
[contextKeyRevision, contextKeyService],
|
|
216
|
+
);
|
|
208
217
|
const forceRender = useForceRender();
|
|
209
218
|
const [preferenceRevision, bumpPreferenceRevision] = useReducer((count: number) => count + 1, 0);
|
|
210
219
|
const [isHelpOpen, setHelpOpen] = useState(false);
|
|
@@ -247,9 +256,9 @@ export function WorkbenchShell({
|
|
|
247
256
|
() =>
|
|
248
257
|
filterActivitiesByWhenClause(
|
|
249
258
|
extensionRegistry.activities.getActivities(),
|
|
250
|
-
|
|
259
|
+
contextKeySnapshot,
|
|
251
260
|
),
|
|
252
|
-
[
|
|
261
|
+
[contextKeySnapshot, extensionRegistry],
|
|
253
262
|
);
|
|
254
263
|
const activityItems = sortActivityBarItems(
|
|
255
264
|
createWorkbenchShellActivityItems({
|
|
@@ -429,20 +438,44 @@ export function WorkbenchShell({
|
|
|
429
438
|
return;
|
|
430
439
|
}
|
|
431
440
|
|
|
432
|
-
for (const view of
|
|
441
|
+
for (const view of getVisibleWorkbenchViews(
|
|
442
|
+
extensionRegistry,
|
|
443
|
+
activeViewContainerId,
|
|
444
|
+
contextKeySnapshot,
|
|
445
|
+
)) {
|
|
433
446
|
void extensionRegistry.activateView(view.id).then(forceRender);
|
|
434
447
|
}
|
|
435
|
-
}, [activeViewContainerId, extensionRegistry, forceRender]);
|
|
448
|
+
}, [activeViewContainerId, contextKeySnapshot, extensionRegistry, forceRender]);
|
|
436
449
|
|
|
437
450
|
useEffect(() => {
|
|
438
451
|
if (!activePanelViewContainerId) {
|
|
439
452
|
return;
|
|
440
453
|
}
|
|
441
454
|
|
|
442
|
-
for (const view of
|
|
455
|
+
for (const view of getVisibleWorkbenchViews(
|
|
456
|
+
extensionRegistry,
|
|
457
|
+
activePanelViewContainerId,
|
|
458
|
+
contextKeySnapshot,
|
|
459
|
+
)) {
|
|
443
460
|
void extensionRegistry.activateView(view.id).then(forceRender);
|
|
444
461
|
}
|
|
445
|
-
}, [activePanelViewContainerId, extensionRegistry, forceRender]);
|
|
462
|
+
}, [activePanelViewContainerId, contextKeySnapshot, extensionRegistry, forceRender]);
|
|
463
|
+
|
|
464
|
+
useEffect(() => {
|
|
465
|
+
if (!layout.auxiliaryBar.visible) {
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
for (const container of extensionRegistry.views.getViewContainers('auxiliarybar')) {
|
|
470
|
+
for (const view of getVisibleWorkbenchViews(
|
|
471
|
+
extensionRegistry,
|
|
472
|
+
container.id,
|
|
473
|
+
contextKeySnapshot,
|
|
474
|
+
)) {
|
|
475
|
+
void extensionRegistry.activateView(view.id).then(forceRender);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
}, [contextKeySnapshot, extensionRegistry, forceRender, layout.auxiliaryBar.visible]);
|
|
446
479
|
|
|
447
480
|
useEffect(() => {
|
|
448
481
|
if (extensionRegistry.capabilityRegistry.has(WORKBENCH_SETTINGS_CAPABILITY_ID)) {
|
|
@@ -601,6 +634,7 @@ export function WorkbenchShell({
|
|
|
601
634
|
activeViewContainerId,
|
|
602
635
|
catalogUrl,
|
|
603
636
|
catalogTrustPolicy,
|
|
637
|
+
contextKeySnapshot,
|
|
604
638
|
),
|
|
605
639
|
onSizePxChange: (sizePx) => {
|
|
606
640
|
layoutService.setSideBarSizePercent(
|
|
@@ -613,13 +647,19 @@ export function WorkbenchShell({
|
|
|
613
647
|
}}
|
|
614
648
|
auxiliarySidebar={{
|
|
615
649
|
isVisible: layout.auxiliaryBar.visible,
|
|
616
|
-
node:
|
|
650
|
+
node: renderDefaultAuxiliarySidebar(
|
|
651
|
+
extensionRegistry,
|
|
652
|
+
contextKeySnapshot,
|
|
653
|
+
catalogUrl,
|
|
654
|
+
catalogTrustPolicy,
|
|
655
|
+
),
|
|
617
656
|
}}
|
|
618
657
|
bottomPanel={{
|
|
619
658
|
isVisible: layout.panel.visible,
|
|
620
659
|
node: renderDefaultBottomPanel(extensionRegistry, activePanelViewContainerId, {
|
|
621
660
|
catalogTrustPolicy,
|
|
622
661
|
catalogUrl,
|
|
662
|
+
contextKeys: contextKeySnapshot,
|
|
623
663
|
onActiveViewContainerChange: (viewContainerId) => {
|
|
624
664
|
layoutService.setActivePanelViewContainer(viewContainerId);
|
|
625
665
|
if (!layout.panel.visible) {
|
package/src/shell/view-host.tsx
CHANGED
|
@@ -5,7 +5,12 @@ import type {
|
|
|
5
5
|
ViewHost,
|
|
6
6
|
ViewHostFactoryRegistry,
|
|
7
7
|
ViewProvider,
|
|
8
|
+
WorkbenchViewContribution,
|
|
8
9
|
} from '@workbench-kit/workbench-core';
|
|
10
|
+
import {
|
|
11
|
+
filterWorkbenchContributionsByWhenClause,
|
|
12
|
+
type WorkbenchContextKeySnapshot,
|
|
13
|
+
} from '@workbench-kit/platform';
|
|
9
14
|
|
|
10
15
|
import { BuiltinChatView } from '../chat/view.js';
|
|
11
16
|
import { isBuiltinChatViewRenderData } from '../chat/view-data.js';
|
|
@@ -15,10 +20,6 @@ import { BuiltinExplorerView } from '../explorer/view.js';
|
|
|
15
20
|
import { isBuiltinExplorerViewRenderData } from '../explorer/view-data.js';
|
|
16
21
|
import { BuiltinExtensionsView } from '../extensions/view.js';
|
|
17
22
|
import { isBuiltinExtensionsViewRenderData } from '../extensions/view-data.js';
|
|
18
|
-
import { SampleJdwLabView } from '../jdw/lab-view.js';
|
|
19
|
-
import { isSampleJdwLabViewRenderData } from '../jdw/lab-view-data.js';
|
|
20
|
-
import { SampleFieldRemapView } from '../field-remap/view.js';
|
|
21
|
-
import { isSampleFieldRemapViewRenderData } from '../field-remap/view-data.js';
|
|
22
23
|
import { BuiltinSearchView } from '../explorer/search-view.js';
|
|
23
24
|
import { isBuiltinSearchViewRenderData } from '../explorer/search-view-data.js';
|
|
24
25
|
|
|
@@ -27,10 +28,11 @@ export function renderDefaultPrimarySidebar(
|
|
|
27
28
|
activeViewContainerId: string | undefined,
|
|
28
29
|
catalogUrl?: string | undefined,
|
|
29
30
|
catalogTrustPolicy?: ExtensionCatalogTrustPolicy | undefined,
|
|
31
|
+
contextKeys: WorkbenchContextKeySnapshot = {},
|
|
30
32
|
) {
|
|
31
33
|
const views = activeViewContainerId
|
|
32
|
-
? extensionRegistry
|
|
33
|
-
: extensionRegistry.views.getViews();
|
|
34
|
+
? getVisibleWorkbenchViews(extensionRegistry, activeViewContainerId, contextKeys)
|
|
35
|
+
: filterWorkbenchContributionsByWhenClause(extensionRegistry.views.getViews(), contextKeys);
|
|
34
36
|
if (views.length === 0) {
|
|
35
37
|
return <aside aria-label="Primary sidebar" />;
|
|
36
38
|
}
|
|
@@ -38,20 +40,29 @@ export function renderDefaultPrimarySidebar(
|
|
|
38
40
|
return (
|
|
39
41
|
<aside
|
|
40
42
|
aria-label="Primary sidebar"
|
|
41
|
-
className="workbench-primary-side-bar shell-react-
|
|
43
|
+
className="workbench-primary-side-bar shell-react-sidebar-host"
|
|
42
44
|
>
|
|
43
|
-
{
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
45
|
+
{renderWorkbenchViews(extensionRegistry, views, { catalogTrustPolicy, catalogUrl })}
|
|
46
|
+
</aside>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function renderDefaultAuxiliarySidebar(
|
|
51
|
+
extensionRegistry: Pick<ExtensionRegistry, 'viewHostFactories' | 'views'>,
|
|
52
|
+
contextKeys: WorkbenchContextKeySnapshot,
|
|
53
|
+
catalogUrl?: string | undefined,
|
|
54
|
+
catalogTrustPolicy?: ExtensionCatalogTrustPolicy | undefined,
|
|
55
|
+
) {
|
|
56
|
+
const views = extensionRegistry.views
|
|
57
|
+
.getViewContainers('auxiliarybar')
|
|
58
|
+
.flatMap((container) => getVisibleWorkbenchViews(extensionRegistry, container.id, contextKeys));
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<aside
|
|
62
|
+
aria-label="Secondary Side Bar"
|
|
63
|
+
className="workbench-auxiliary-side-bar shell-react-sidebar-host"
|
|
64
|
+
>
|
|
65
|
+
{renderWorkbenchViews(extensionRegistry, views, { catalogTrustPolicy, catalogUrl })}
|
|
55
66
|
</aside>
|
|
56
67
|
);
|
|
57
68
|
}
|
|
@@ -62,6 +73,7 @@ export function renderDefaultBottomPanel(
|
|
|
62
73
|
options: {
|
|
63
74
|
catalogTrustPolicy?: ExtensionCatalogTrustPolicy | undefined;
|
|
64
75
|
catalogUrl?: string | undefined;
|
|
76
|
+
contextKeys?: WorkbenchContextKeySnapshot | undefined;
|
|
65
77
|
onActiveViewContainerChange?: ((viewContainerId: string) => void) | undefined;
|
|
66
78
|
} = {},
|
|
67
79
|
) {
|
|
@@ -80,7 +92,11 @@ export function renderDefaultBottomPanel(
|
|
|
80
92
|
? activeViewContainerId
|
|
81
93
|
: containers[0]?.id;
|
|
82
94
|
const views = resolvedActiveViewContainerId
|
|
83
|
-
?
|
|
95
|
+
? getVisibleWorkbenchViews(
|
|
96
|
+
extensionRegistry,
|
|
97
|
+
resolvedActiveViewContainerId,
|
|
98
|
+
options.contextKeys ?? {},
|
|
99
|
+
)
|
|
84
100
|
: [];
|
|
85
101
|
|
|
86
102
|
return (
|
|
@@ -111,24 +127,56 @@ export function renderDefaultBottomPanel(
|
|
|
111
127
|
{views.length === 0 ? (
|
|
112
128
|
<div className="workbench-bottom-panel__empty">No views in this panel container.</div>
|
|
113
129
|
) : (
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
fallback={view.name}
|
|
120
|
-
provider={extensionRegistry.views.getViewProvider(view.id)}
|
|
121
|
-
viewHostFactories={extensionRegistry.viewHostFactories}
|
|
122
|
-
viewId={view.id}
|
|
123
|
-
/>
|
|
124
|
-
</section>
|
|
125
|
-
))
|
|
130
|
+
renderWorkbenchViews(extensionRegistry, views, {
|
|
131
|
+
catalogTrustPolicy: options.catalogTrustPolicy,
|
|
132
|
+
catalogUrl: options.catalogUrl,
|
|
133
|
+
sectionClassName: 'workbench-bottom-panel__view',
|
|
134
|
+
})
|
|
126
135
|
)}
|
|
127
136
|
</div>
|
|
128
137
|
</section>
|
|
129
138
|
);
|
|
130
139
|
}
|
|
131
140
|
|
|
141
|
+
export function getVisibleWorkbenchViews(
|
|
142
|
+
extensionRegistry: Pick<ExtensionRegistry, 'views'>,
|
|
143
|
+
viewContainerId: string,
|
|
144
|
+
contextKeys: WorkbenchContextKeySnapshot,
|
|
145
|
+
): WorkbenchViewContribution[] {
|
|
146
|
+
return filterWorkbenchContributionsByWhenClause(
|
|
147
|
+
extensionRegistry.views.getViews(viewContainerId),
|
|
148
|
+
contextKeys,
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function renderWorkbenchViews(
|
|
153
|
+
extensionRegistry: Pick<ExtensionRegistry, 'viewHostFactories' | 'views'>,
|
|
154
|
+
views: readonly WorkbenchViewContribution[],
|
|
155
|
+
options: {
|
|
156
|
+
catalogTrustPolicy?: ExtensionCatalogTrustPolicy | undefined;
|
|
157
|
+
catalogUrl?: string | undefined;
|
|
158
|
+
sectionClassName?: string | undefined;
|
|
159
|
+
},
|
|
160
|
+
): ReactNode {
|
|
161
|
+
return views.map((view) => (
|
|
162
|
+
<section
|
|
163
|
+
key={view.id}
|
|
164
|
+
className={options.sectionClassName}
|
|
165
|
+
data-view-container-id={view.containerId}
|
|
166
|
+
data-view-id={view.id}
|
|
167
|
+
>
|
|
168
|
+
<WorkbenchViewHost
|
|
169
|
+
catalogTrustPolicy={options.catalogTrustPolicy}
|
|
170
|
+
catalogUrl={options.catalogUrl}
|
|
171
|
+
fallback={view.name}
|
|
172
|
+
provider={extensionRegistry.views.getViewProvider(view.id)}
|
|
173
|
+
viewHostFactories={extensionRegistry.viewHostFactories}
|
|
174
|
+
viewId={view.id}
|
|
175
|
+
/>
|
|
176
|
+
</section>
|
|
177
|
+
));
|
|
178
|
+
}
|
|
179
|
+
|
|
132
180
|
export function WorkbenchViewHost({
|
|
133
181
|
catalogTrustPolicy,
|
|
134
182
|
catalogUrl,
|
|
@@ -268,18 +316,5 @@ export function toWorkbenchViewHostReactNode(
|
|
|
268
316
|
);
|
|
269
317
|
}
|
|
270
318
|
|
|
271
|
-
if (isSampleJdwLabViewRenderData(value)) {
|
|
272
|
-
return (
|
|
273
|
-
<SampleJdwLabView
|
|
274
|
-
templateJdwPath={value.templateJdwPath}
|
|
275
|
-
widgetTreePath={value.widgetTreePath}
|
|
276
|
-
/>
|
|
277
|
-
);
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
if (isSampleFieldRemapViewRenderData(value)) {
|
|
281
|
-
return <SampleFieldRemapView />;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
319
|
return toReactNode(value, fallback);
|
|
285
320
|
}
|