@workbench-kit/shell-react 0.0.2-prototype.0.2.6
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 +49 -0
- package/src/chat-ai-mock-proposals.ts +39 -0
- package/src/chat-command-input.ts +52 -0
- package/src/chat-command-policy.ts +54 -0
- package/src/chat-command-surface.tsx +155 -0
- package/src/chat-view-data.ts +20 -0
- package/src/chat-view.tsx +220 -0
- package/src/command-inspector-surface.tsx +46 -0
- package/src/commands-view-data.ts +17 -0
- package/src/commands-view.tsx +43 -0
- package/src/createCommandWorkspaceExplorerPort.ts +86 -0
- package/src/devtools/WorkbenchDevtoolsPanel.tsx +124 -0
- package/src/devtools/WorkbenchDevtoolsShell.tsx +17 -0
- package/src/devtools/index.ts +11 -0
- package/src/devtools/use-workbench-devtools-snapshot.ts +84 -0
- package/src/devtools/workbench-devtools-snapshot.ts +140 -0
- package/src/devtools/workbench-devtools.css +82 -0
- package/src/editor-area-dnd.ts +69 -0
- package/src/editor-area-model.ts +71 -0
- package/src/editor-area.css +454 -0
- package/src/editor-area.tsx +676 -0
- package/src/editor-host-surface.tsx +634 -0
- package/src/editor-pane-visibility.ts +130 -0
- package/src/editor-resource.ts +36 -0
- package/src/editor-state-storage.ts +193 -0
- package/src/editor-tab-context-menu.ts +118 -0
- package/src/editor-view-providers.tsx +552 -0
- package/src/editor-workspace-file-availability.ts +15 -0
- package/src/editor-workspace-reconcile.tsx +28 -0
- package/src/explorer-context-menu.ts +114 -0
- package/src/explorer-reveal.ts +112 -0
- package/src/explorer-view-data.ts +58 -0
- package/src/explorer-view.tsx +224 -0
- package/src/extension-context-menu.ts +52 -0
- package/src/extension-management-model.ts +313 -0
- package/src/extensions-view-data.ts +19 -0
- package/src/extensions-view.tsx +38 -0
- package/src/field-remap-demo.tsx +18 -0
- package/src/field-remap-editor-surface.tsx +36 -0
- package/src/field-remap-flow-adapter.ts +240 -0
- package/src/field-remap-flow.tsx +369 -0
- package/src/field-remap-graph.tsx +559 -0
- package/src/field-remap-panel.tsx +175 -0
- package/src/field-remap-samples.ts +352 -0
- package/src/field-remap-tree.tsx +404 -0
- package/src/field-remap-view-data.ts +16 -0
- package/src/field-remap-view.css +676 -0
- package/src/field-remap-view.tsx +86 -0
- package/src/index.ts +199 -0
- package/src/jdw-lab-view-data.ts +25 -0
- package/src/jdw-lab-view.css +21 -0
- package/src/jdw-lab-view.tsx +79 -0
- package/src/jdw-widget-form-view.tsx +65 -0
- package/src/jdw-widget-preview-view.tsx +51 -0
- package/src/json-form-source-patch.ts +323 -0
- package/src/jsonata-transform.ts +36 -0
- package/src/keybinding-management-settings.tsx +16 -0
- package/src/keybinding-overrides-storage.ts +57 -0
- package/src/management-palette-commands.ts +38 -0
- package/src/management-settings-ids.ts +12 -0
- package/src/management-settings.tsx +75 -0
- package/src/preference-settings-storage.ts +58 -0
- package/src/provider.tsx +573 -0
- package/src/search-view-data.ts +15 -0
- package/src/search-view.tsx +62 -0
- package/src/shell-model.tsx +149 -0
- package/src/shell-secondary-actions.tsx +59 -0
- package/src/shell-settings-constants.ts +9 -0
- package/src/shell-settings.tsx +599 -0
- package/src/shell-titlebar-layout-controls.tsx +4 -0
- package/src/shell-view-host.tsx +199 -0
- package/src/shell.tsx +649 -0
- package/src/table-mapping-adapter.ts +59 -0
- package/src/use-active-workspace-path.ts +15 -0
- package/src/use-command-management.ts +191 -0
- package/src/use-context-key-revision.ts +18 -0
- package/src/use-editor.ts +107 -0
- package/src/use-extension-management.ts +193 -0
- package/src/use-keybinding-management.ts +130 -0
- package/src/use-persisted-workbench-appearance.ts +33 -0
- package/src/use-workbench-chat-command-proposals.ts +194 -0
- package/src/use-workbench-command-descriptors.ts +41 -0
- package/src/workbench-appearance-storage.ts +115 -0
- package/src/workbench-command-host.tsx +243 -0
- package/src/workbench-command-palette.ts +208 -0
- package/src/workbench-keybinding-bridge.ts +54 -0
- package/src/workbench-layout-storage.ts +145 -0
- package/src/workbench-profile-modal.tsx +118 -0
- package/src/workbench-shell-command-registration.ts +58 -0
- package/src/workbench-startup-gate.tsx +136 -0
- package/src/workbench-status-sections.ts +43 -0
- package/src/workbench-user-commands.ts +46 -0
- package/src/workspace-view-state.ts +35 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ActivityBarItem, StatusBarSectionModel } from '@workbench-kit/react/workbench/shell';
|
|
3
|
+
import type {
|
|
4
|
+
ExtensionDependencyDiagnosticSeverity,
|
|
5
|
+
WorkbenchActivityContribution,
|
|
6
|
+
WorkbenchViewContainerContribution,
|
|
7
|
+
WorkbenchViewContribution,
|
|
8
|
+
} from '@workbench-kit/workbench-core';
|
|
9
|
+
|
|
10
|
+
export interface WorkbenchShellActivityItemsInput {
|
|
11
|
+
readonly activeViewContainerId?: string | undefined;
|
|
12
|
+
readonly activities: readonly WorkbenchActivityContribution[];
|
|
13
|
+
readonly viewContainers: readonly WorkbenchViewContainerContribution[];
|
|
14
|
+
readonly views: readonly WorkbenchViewContribution[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface WorkbenchShellStatusSectionsInput {
|
|
18
|
+
readonly dependencyDiagnostics: readonly {
|
|
19
|
+
readonly severity: ExtensionDependencyDiagnosticSeverity;
|
|
20
|
+
}[];
|
|
21
|
+
readonly extensionCount: number;
|
|
22
|
+
readonly missingExtensionIds: readonly string[];
|
|
23
|
+
readonly profile?: { readonly displayName: string } | undefined;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function createWorkbenchShellActivityItems({
|
|
27
|
+
activeViewContainerId,
|
|
28
|
+
activities,
|
|
29
|
+
viewContainers,
|
|
30
|
+
views,
|
|
31
|
+
}: WorkbenchShellActivityItemsInput): ActivityBarItem[] {
|
|
32
|
+
if (activities.length > 0) {
|
|
33
|
+
return activities
|
|
34
|
+
.map<ActivityBarItem & { order?: number }>((activity) => ({
|
|
35
|
+
active: activity.viewContainerId === activeViewContainerId,
|
|
36
|
+
icon: resolveWorkbenchShellIcon(activity.icon),
|
|
37
|
+
id: activity.viewContainerId,
|
|
38
|
+
label: activity.title,
|
|
39
|
+
order: activity.order,
|
|
40
|
+
}))
|
|
41
|
+
.sort(
|
|
42
|
+
(left, right) =>
|
|
43
|
+
(left.order ?? Number.MAX_SAFE_INTEGER) - (right.order ?? Number.MAX_SAFE_INTEGER),
|
|
44
|
+
)
|
|
45
|
+
.map(({ order: _order, ...item }) => item);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const containersById = new Map(viewContainers.map((container) => [container.id, container]));
|
|
49
|
+
const firstViewsByContainerId = new Map<string, WorkbenchViewContribution>();
|
|
50
|
+
views.forEach((view) => {
|
|
51
|
+
if (!firstViewsByContainerId.has(view.containerId)) {
|
|
52
|
+
firstViewsByContainerId.set(view.containerId, view);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
return [...firstViewsByContainerId.entries()].map<ActivityBarItem>(([containerId, firstView]) => {
|
|
57
|
+
const container = containersById.get(containerId);
|
|
58
|
+
|
|
59
|
+
return {
|
|
60
|
+
active: containerId === activeViewContainerId,
|
|
61
|
+
icon: resolveWorkbenchShellIcon(container?.icon ?? firstView.name ?? containerId),
|
|
62
|
+
id: containerId,
|
|
63
|
+
label: container?.title ?? firstView.name ?? containerId,
|
|
64
|
+
};
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function createDefaultWorkbenchStatusSections({
|
|
69
|
+
dependencyDiagnostics,
|
|
70
|
+
extensionCount,
|
|
71
|
+
missingExtensionIds,
|
|
72
|
+
profile,
|
|
73
|
+
}: WorkbenchShellStatusSectionsInput): StatusBarSectionModel[] {
|
|
74
|
+
const errorDependencyDiagnostics = dependencyDiagnostics.filter(
|
|
75
|
+
(diagnostic) => diagnostic.severity === 'error',
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
return [
|
|
79
|
+
{
|
|
80
|
+
id: 'workbench',
|
|
81
|
+
items: [
|
|
82
|
+
{
|
|
83
|
+
id: 'extensions',
|
|
84
|
+
label: `extensions: ${extensionCount}`,
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
hidden: missingExtensionIds.length === 0,
|
|
88
|
+
id: 'missing-extensions',
|
|
89
|
+
label: `missing: ${missingExtensionIds.length}`,
|
|
90
|
+
status: 'waiting',
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
hidden: dependencyDiagnostics.length === 0,
|
|
94
|
+
id: 'extension-dependencies',
|
|
95
|
+
label: `deps: ${dependencyDiagnostics.length}`,
|
|
96
|
+
status: errorDependencyDiagnostics.length > 0 ? 'failed' : 'waiting',
|
|
97
|
+
title:
|
|
98
|
+
errorDependencyDiagnostics.length > 0
|
|
99
|
+
? `${errorDependencyDiagnostics.length} extension dependency error${
|
|
100
|
+
errorDependencyDiagnostics.length === 1 ? '' : 's'
|
|
101
|
+
}`
|
|
102
|
+
: `${dependencyDiagnostics.length} extension dependency warning${
|
|
103
|
+
dependencyDiagnostics.length === 1 ? '' : 's'
|
|
104
|
+
}`,
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
align: 'end',
|
|
110
|
+
id: 'workbench-meta',
|
|
111
|
+
items: [
|
|
112
|
+
...(profile
|
|
113
|
+
? [
|
|
114
|
+
{
|
|
115
|
+
icon: 'account' as const,
|
|
116
|
+
id: 'workbench.account',
|
|
117
|
+
label: profile.displayName,
|
|
118
|
+
title: 'Open profile',
|
|
119
|
+
},
|
|
120
|
+
]
|
|
121
|
+
: []),
|
|
122
|
+
],
|
|
123
|
+
},
|
|
124
|
+
];
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export function resolveWorkbenchShellIcon(icon: ReactNode | string | undefined): ReactNode {
|
|
128
|
+
if (icon === undefined) {
|
|
129
|
+
return <span aria-hidden="true">W</span>;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (typeof icon !== 'string') {
|
|
133
|
+
return icon;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const className = getWorkbenchShellCodiconClassName(icon);
|
|
137
|
+
if (className) {
|
|
138
|
+
return <i aria-hidden="true" className={`codicon ${className}`} />;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return <span aria-hidden="true">W</span>;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export function getWorkbenchShellCodiconClassName(icon: string): string | undefined {
|
|
145
|
+
const token = icon.trim();
|
|
146
|
+
if (!token) return undefined;
|
|
147
|
+
|
|
148
|
+
return token.startsWith('codicon-') ? token : `codicon-${token}`;
|
|
149
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { ActivityBarItem } from '@workbench-kit/react/workbench/shell';
|
|
2
|
+
|
|
3
|
+
export const WORKBENCH_PROFILE_ACTIVITY_ITEM_ID = 'workbench-kit.shell.profile' as const;
|
|
4
|
+
export const WORKBENCH_ACCOUNT_ACTIVITY_ITEM_ID = WORKBENCH_PROFILE_ACTIVITY_ITEM_ID;
|
|
5
|
+
export const WORKBENCH_SETTINGS_ACTIVITY_ITEM_ID = 'workbench-kit.shell.settings' as const;
|
|
6
|
+
|
|
7
|
+
export type WorkbenchSecondaryActivityRoute = 'profile' | 'settings';
|
|
8
|
+
|
|
9
|
+
export interface WorkbenchSecondaryActivityItemsInput {
|
|
10
|
+
hasProfile: boolean;
|
|
11
|
+
isProfileOpen: boolean;
|
|
12
|
+
isSettingsOpen: boolean;
|
|
13
|
+
showSettings?: boolean | undefined;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function createWorkbenchSecondaryActivityItems({
|
|
17
|
+
hasProfile,
|
|
18
|
+
isProfileOpen,
|
|
19
|
+
isSettingsOpen,
|
|
20
|
+
showSettings = true,
|
|
21
|
+
}: WorkbenchSecondaryActivityItemsInput): ActivityBarItem[] {
|
|
22
|
+
return [
|
|
23
|
+
...(hasProfile
|
|
24
|
+
? [
|
|
25
|
+
{
|
|
26
|
+
active: isProfileOpen,
|
|
27
|
+
icon: <i aria-hidden="true" className="codicon codicon-account" />,
|
|
28
|
+
id: WORKBENCH_PROFILE_ACTIVITY_ITEM_ID,
|
|
29
|
+
label: 'Profile',
|
|
30
|
+
title: 'Open profile',
|
|
31
|
+
},
|
|
32
|
+
]
|
|
33
|
+
: []),
|
|
34
|
+
...(showSettings
|
|
35
|
+
? [
|
|
36
|
+
{
|
|
37
|
+
active: isSettingsOpen,
|
|
38
|
+
icon: <i aria-hidden="true" className="codicon codicon-settings-gear" />,
|
|
39
|
+
id: WORKBENCH_SETTINGS_ACTIVITY_ITEM_ID,
|
|
40
|
+
label: 'Settings',
|
|
41
|
+
},
|
|
42
|
+
]
|
|
43
|
+
: []),
|
|
44
|
+
];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function getWorkbenchSecondaryActivityRoute(
|
|
48
|
+
itemId: string,
|
|
49
|
+
): WorkbenchSecondaryActivityRoute | undefined {
|
|
50
|
+
if (itemId === WORKBENCH_PROFILE_ACTIVITY_ITEM_ID) {
|
|
51
|
+
return 'profile';
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (itemId === WORKBENCH_SETTINGS_ACTIVITY_ITEM_ID) {
|
|
55
|
+
return 'settings';
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PreferenceScope } from '@workbench-kit/workbench-config';
|
|
2
|
+
|
|
3
|
+
export const SETTINGS_EXTENSION_ID = 'workbench-kit.builtin.settings';
|
|
4
|
+
|
|
5
|
+
export const WORKBENCH_PREFERENCE_SCOPES = [
|
|
6
|
+
{ id: 'default', label: 'Default' },
|
|
7
|
+
{ id: 'workspace', label: 'Workspace' },
|
|
8
|
+
{ id: 'local', label: 'Local' },
|
|
9
|
+
] as const satisfies ReadonlyArray<{ id: PreferenceScope; label: string }>;
|