@workbench-kit/shell-react 0.0.2-prototype.0.2.10
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 +98 -0
- package/package.json +51 -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/use-chat-command-proposals.ts +194 -0
- package/src/chat/view-data.ts +20 -0
- package/src/chat/view.tsx +220 -0
- package/src/commands/inspector-surface.tsx +46 -0
- package/src/commands/use-command-descriptors.ts +41 -0
- package/src/commands/use-context-key-revision.ts +18 -0
- package/src/commands/view-data.ts +17 -0
- package/src/commands/view.tsx +43 -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 +691 -0
- package/src/editor/markdown-document-view-data.ts +16 -0
- package/src/editor/pane-visibility.ts +130 -0
- package/src/editor/resource.ts +36 -0
- package/src/editor/state-storage.ts +182 -0
- package/src/editor/tab-context-menu.ts +118 -0
- package/src/editor/use-editor.ts +138 -0
- package/src/editor/view-providers.tsx +504 -0
- package/src/editor/workspace-file-availability.ts +15 -0
- package/src/editor/workspace-reconcile.tsx +31 -0
- package/src/explorer/context-menu.ts +114 -0
- package/src/explorer/create-command-workspace-explorer-port.ts +86 -0
- package/src/explorer/reveal.ts +112 -0
- package/src/explorer/search-view-data.ts +15 -0
- package/src/explorer/search-view.tsx +65 -0
- package/src/explorer/use-active-workspace-path.ts +15 -0
- package/src/explorer/view-data.ts +58 -0
- package/src/explorer/view.tsx +227 -0
- package/src/extensions/context-menu.ts +52 -0
- package/src/extensions/management-model.ts +313 -0
- package/src/extensions/use-extension-management.ts +241 -0
- package/src/extensions/view-data.ts +19 -0
- package/src/extensions/view.tsx +63 -0
- package/src/field-remap/chrome-labels.ts +74 -0
- package/src/field-remap/convert-note-editor.tsx +206 -0
- package/src/field-remap/convert-palette.tsx +126 -0
- package/src/field-remap/demo.tsx +105 -0
- package/src/field-remap/detail-panel.tsx +659 -0
- package/src/field-remap/editor-surface.tsx +36 -0
- package/src/field-remap/flow-adapter.ts +838 -0
- package/src/field-remap/flow-ops.ts +442 -0
- package/src/field-remap/flow.tsx +948 -0
- package/src/field-remap/graph.tsx +559 -0
- package/src/field-remap/index.ts +88 -0
- package/src/field-remap/io-class-browse.tsx +145 -0
- package/src/field-remap/jsonata-transform.ts +166 -0
- package/src/field-remap/panel.tsx +466 -0
- package/src/field-remap/samples.ts +507 -0
- package/src/field-remap/shape-io-editor.tsx +170 -0
- package/src/field-remap/table-mapping-adapter.ts +59 -0
- package/src/field-remap/transform-options-editor.tsx +312 -0
- package/src/field-remap/tree.tsx +404 -0
- package/src/field-remap/view-data.ts +16 -0
- package/src/field-remap/view.css +1367 -0
- package/src/field-remap/view.tsx +86 -0
- package/src/index.ts +294 -0
- package/src/jdw/document-view-data.ts +31 -0
- package/src/jdw/json-form-source-patch.ts +323 -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 +68 -0
- package/src/jdw/widget-preview-view.tsx +54 -0
- package/src/management/keybinding-overrides-storage.ts +49 -0
- package/src/management/keybinding-settings.tsx +16 -0
- package/src/management/palette-commands.ts +38 -0
- package/src/management/preference-settings-storage.ts +50 -0
- package/src/management/settings-ids.ts +12 -0
- package/src/management/settings.tsx +96 -0
- package/src/management/use-command-management.ts +191 -0
- package/src/management/use-keybinding-management.ts +130 -0
- package/src/shell/model.tsx +149 -0
- package/src/shell/provider.tsx +606 -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/shell.tsx +680 -0
- package/src/shell/titlebar-layout-controls.tsx +4 -0
- package/src/shell/view-host.tsx +212 -0
- package/src/workbench/appearance-storage.ts +107 -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 +134 -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/use-persisted-appearance.ts +33 -0
- package/src/workbench/user-commands.ts +46 -0
- package/src/workbench/workspace-view-state.ts +35 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
StatusBarItemModel,
|
|
3
|
+
StatusBarSectionModel,
|
|
4
|
+
} from '@workbench-kit/react/workbench/shell';
|
|
5
|
+
|
|
6
|
+
export interface WorkspaceResourceStatusItemsInput {
|
|
7
|
+
fileCount: number;
|
|
8
|
+
fileItemId?: string | undefined;
|
|
9
|
+
fileTitle?: string | undefined;
|
|
10
|
+
folderCount: number;
|
|
11
|
+
folderItemId?: string | undefined;
|
|
12
|
+
folderTitle?: string | undefined;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function createWorkspaceResourceStatusItems({
|
|
16
|
+
fileCount,
|
|
17
|
+
fileItemId = 'workbench.workspace.files',
|
|
18
|
+
fileTitle = 'Workspace files',
|
|
19
|
+
folderCount,
|
|
20
|
+
folderItemId = 'workbench.workspace.folders',
|
|
21
|
+
folderTitle = 'Workspace folders',
|
|
22
|
+
}: WorkspaceResourceStatusItemsInput): StatusBarItemModel[] {
|
|
23
|
+
return [
|
|
24
|
+
{
|
|
25
|
+
icon: 'files',
|
|
26
|
+
id: fileItemId,
|
|
27
|
+
label: `${fileCount} files`,
|
|
28
|
+
title: fileTitle,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
icon: 'folder',
|
|
32
|
+
id: folderItemId,
|
|
33
|
+
label: `${folderCount} folders`,
|
|
34
|
+
title: folderTitle,
|
|
35
|
+
},
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function mergeWorkbenchStatusSections(
|
|
40
|
+
...sectionGroups: ReadonlyArray<readonly StatusBarSectionModel[]>
|
|
41
|
+
): StatusBarSectionModel[] {
|
|
42
|
+
return sectionGroups.flat().filter((section) => section.items.length > 0);
|
|
43
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import type { WorkbenchStorageAdapter } from '@workbench-kit/workbench-core';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
readPersistedWorkbenchAppearance,
|
|
6
|
+
writePersistedWorkbenchAppearance,
|
|
7
|
+
type WorkbenchAppearanceSettings,
|
|
8
|
+
} from './appearance-storage.js';
|
|
9
|
+
|
|
10
|
+
export interface UsePersistedWorkbenchAppearanceOptions {
|
|
11
|
+
persist?: boolean | undefined;
|
|
12
|
+
storage?: WorkbenchStorageAdapter | undefined;
|
|
13
|
+
storageKey?: string | undefined;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function usePersistedWorkbenchAppearance(
|
|
17
|
+
options: UsePersistedWorkbenchAppearanceOptions = {},
|
|
18
|
+
): [WorkbenchAppearanceSettings, (settings: WorkbenchAppearanceSettings) => void] {
|
|
19
|
+
const { persist = true, storage, storageKey } = options;
|
|
20
|
+
const [appearance, setAppearance] = useState(() =>
|
|
21
|
+
readPersistedWorkbenchAppearance(storageKey, storage),
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (!persist) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
writePersistedWorkbenchAppearance(appearance, storageKey, storage);
|
|
30
|
+
}, [appearance, persist, storage, storageKey]);
|
|
31
|
+
|
|
32
|
+
return [appearance, setAppearance];
|
|
33
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
WorkbenchUserCommandAction,
|
|
3
|
+
WorkbenchUserCommandDefinition,
|
|
4
|
+
} from '@workbench-kit/workbench-config';
|
|
5
|
+
import type { ExtensionRegistry } from '@workbench-kit/workbench-core';
|
|
6
|
+
|
|
7
|
+
export async function executeWorkbenchUserCommandAction(
|
|
8
|
+
action: WorkbenchUserCommandAction,
|
|
9
|
+
executeCommand: (commandId: string, ...args: unknown[]) => Promise<unknown>,
|
|
10
|
+
): Promise<unknown> {
|
|
11
|
+
if (action.type === 'executeCommand') {
|
|
12
|
+
return executeCommand(action.command, ...(action.args !== undefined ? [action.args] : []));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let lastResult: unknown;
|
|
16
|
+
for (const step of action.steps) {
|
|
17
|
+
lastResult = await executeWorkbenchUserCommandAction(step, executeCommand);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return lastResult;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function registerWorkbenchUserCommands(
|
|
24
|
+
extensionRegistry: ExtensionRegistry,
|
|
25
|
+
userCommands: readonly WorkbenchUserCommandDefinition[],
|
|
26
|
+
): { dispose(): void } {
|
|
27
|
+
const disposables = userCommands.map((userCommand) =>
|
|
28
|
+
extensionRegistry.commands.registerCommand({
|
|
29
|
+
category: userCommand.category,
|
|
30
|
+
handler: () =>
|
|
31
|
+
executeWorkbenchUserCommandAction(userCommand.action, (commandId, ...args) =>
|
|
32
|
+
extensionRegistry.executeCommand(commandId, ...args),
|
|
33
|
+
),
|
|
34
|
+
id: userCommand.command,
|
|
35
|
+
title: userCommand.title,
|
|
36
|
+
}),
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
dispose() {
|
|
41
|
+
for (const disposable of disposables) {
|
|
42
|
+
disposable.dispose();
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import type {
|
|
3
|
+
VirtualWorkspaceState,
|
|
4
|
+
WorkspaceChangeEvent,
|
|
5
|
+
WorkspaceResourceService,
|
|
6
|
+
} from '@workbench-kit/workspace';
|
|
7
|
+
|
|
8
|
+
export function isWorkspaceResourceService(value: unknown): value is WorkspaceResourceService {
|
|
9
|
+
return (
|
|
10
|
+
typeof value === 'object' &&
|
|
11
|
+
value !== null &&
|
|
12
|
+
typeof (value as WorkspaceResourceService).getState === 'function' &&
|
|
13
|
+
typeof (value as WorkspaceResourceService).onDidChangeWorkspace === 'function'
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function useWorkspaceResourceState(
|
|
18
|
+
workspaceService: WorkspaceResourceService | undefined,
|
|
19
|
+
): VirtualWorkspaceState | undefined {
|
|
20
|
+
const [state, setState] = useState(() => workspaceService?.getState());
|
|
21
|
+
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (!workspaceService) {
|
|
24
|
+
setState(undefined);
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
setState(workspaceService.getState());
|
|
29
|
+
return workspaceService.onDidChangeWorkspace((event: WorkspaceChangeEvent) => {
|
|
30
|
+
setState(event.state);
|
|
31
|
+
});
|
|
32
|
+
}, [workspaceService]);
|
|
33
|
+
|
|
34
|
+
return state;
|
|
35
|
+
}
|