@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,21 +1,21 @@
|
|
|
1
|
-
.workbench-jdw-lab-view {
|
|
2
|
-
height: 100%;
|
|
3
|
-
min-height: 0;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.workbench-jdw-lab-view__list {
|
|
7
|
-
padding-block: 4px;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.workbench-jdw-lab-view .ui-workbench-action-list-item__description {
|
|
11
|
-
font-family: var(
|
|
12
|
-
--monaco-monospace-font,
|
|
13
|
-
ui-monospace,
|
|
14
|
-
SFMono-Regular,
|
|
15
|
-
Menlo,
|
|
16
|
-
Consolas,
|
|
17
|
-
monospace
|
|
18
|
-
);
|
|
19
|
-
font-size: 11px;
|
|
20
|
-
opacity: 0.85;
|
|
21
|
-
}
|
|
1
|
+
.workbench-jdw-lab-view {
|
|
2
|
+
height: 100%;
|
|
3
|
+
min-height: 0;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.workbench-jdw-lab-view__list {
|
|
7
|
+
padding-block: 4px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.workbench-jdw-lab-view .ui-workbench-action-list-item__description {
|
|
11
|
+
font-family: var(
|
|
12
|
+
--monaco-monospace-font,
|
|
13
|
+
ui-monospace,
|
|
14
|
+
SFMono-Regular,
|
|
15
|
+
Menlo,
|
|
16
|
+
Consolas,
|
|
17
|
+
monospace
|
|
18
|
+
);
|
|
19
|
+
font-size: 11px;
|
|
20
|
+
opacity: 0.85;
|
|
21
|
+
}
|
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
import { WorkbenchActionSidebar } from '@workbench-kit/react/layout';
|
|
2
|
-
|
|
3
|
-
import './
|
|
4
|
-
|
|
5
|
-
import { useWorkbench } from '
|
|
6
|
-
import { useActiveEditorTab } from '
|
|
7
|
-
import { useActiveWorkspacePath } from '
|
|
8
|
-
import {
|
|
9
|
-
isSampleJdwLabViewRenderData,
|
|
10
|
-
SAMPLE_JDW_LAB_VIEW_RENDER_KIND,
|
|
11
|
-
type SampleJdwLabViewRenderData,
|
|
12
|
-
} from './
|
|
13
|
-
|
|
14
|
-
export type { SampleJdwLabViewRenderData };
|
|
15
|
-
export { isSampleJdwLabViewRenderData, SAMPLE_JDW_LAB_VIEW_RENDER_KIND };
|
|
16
|
-
|
|
17
|
-
const WORKSPACE_OPEN_COMMAND_ID = 'workspace.open' as const;
|
|
18
|
-
|
|
19
|
-
const DEFAULT_WIDGET_TREE_PATH = 'jdw/showcase/example.jdw.json';
|
|
20
|
-
const DEFAULT_TEMPLATE_JDW_PATH = 'jdw/templates/analytics-dashboard.jdw.json';
|
|
21
|
-
|
|
22
|
-
export interface SampleJdwLabViewProps {
|
|
23
|
-
readonly templateJdwPath?: string | undefined;
|
|
24
|
-
readonly widgetTreePath?: string | undefined;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function pathMatches(activePath: string | undefined, candidate: string): boolean {
|
|
28
|
-
if (!activePath) {
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return activePath === candidate || activePath.endsWith(`/${candidate}`);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export function SampleJdwLabView({
|
|
36
|
-
templateJdwPath = DEFAULT_TEMPLATE_JDW_PATH,
|
|
37
|
-
widgetTreePath = DEFAULT_WIDGET_TREE_PATH,
|
|
38
|
-
}: SampleJdwLabViewProps = {}) {
|
|
39
|
-
const { executeCommand } = useWorkbench();
|
|
40
|
-
const activeTab = useActiveEditorTab();
|
|
41
|
-
const activePath = useActiveWorkspacePath(activeTab?.resourceUri);
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<WorkbenchActionSidebar
|
|
45
|
-
className="workbench-jdw-lab-view"
|
|
46
|
-
data-testid="jdw-lab-view"
|
|
47
|
-
items={[
|
|
48
|
-
{
|
|
49
|
-
description: widgetTreePath,
|
|
50
|
-
icon: <i aria-hidden="true" className="codicon codicon-layout" />,
|
|
51
|
-
id: 'widget-tree',
|
|
52
|
-
label: 'Widget Tree',
|
|
53
|
-
selected: pathMatches(activePath, widgetTreePath),
|
|
54
|
-
testId: 'jdw-lab-open-widget-tree',
|
|
55
|
-
title: `Open ${widgetTreePath}`,
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
description: templateJdwPath,
|
|
59
|
-
icon: <i aria-hidden="true" className="codicon codicon-symbol-structure" />,
|
|
60
|
-
id: 'template-jdw',
|
|
61
|
-
label: 'Template JDW',
|
|
62
|
-
selected: pathMatches(activePath, templateJdwPath),
|
|
63
|
-
testId: 'jdw-lab-open-template-jdw',
|
|
64
|
-
title: `Open ${templateJdwPath}`,
|
|
65
|
-
},
|
|
66
|
-
]}
|
|
67
|
-
listProps={{
|
|
68
|
-
'aria-label': 'JDW lab surfaces',
|
|
69
|
-
className: 'workbench-jdw-lab-view__list',
|
|
70
|
-
}}
|
|
71
|
-
onSelect={(item) => {
|
|
72
|
-
if (typeof item.description !== 'string' || item.description.length === 0) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
void executeCommand(WORKSPACE_OPEN_COMMAND_ID, { path: item.description });
|
|
76
|
-
}}
|
|
77
|
-
/>
|
|
78
|
-
);
|
|
79
|
-
}
|
|
1
|
+
import { WorkbenchActionSidebar } from '@workbench-kit/react/layout';
|
|
2
|
+
|
|
3
|
+
import './lab-view.css';
|
|
4
|
+
|
|
5
|
+
import { useWorkbench } from '../shell/provider.js';
|
|
6
|
+
import { useActiveEditorTab } from '../editor/use-editor.js';
|
|
7
|
+
import { useActiveWorkspacePath } from '../explorer/use-active-workspace-path.js';
|
|
8
|
+
import {
|
|
9
|
+
isSampleJdwLabViewRenderData,
|
|
10
|
+
SAMPLE_JDW_LAB_VIEW_RENDER_KIND,
|
|
11
|
+
type SampleJdwLabViewRenderData,
|
|
12
|
+
} from './lab-view-data.js';
|
|
13
|
+
|
|
14
|
+
export type { SampleJdwLabViewRenderData };
|
|
15
|
+
export { isSampleJdwLabViewRenderData, SAMPLE_JDW_LAB_VIEW_RENDER_KIND };
|
|
16
|
+
|
|
17
|
+
const WORKSPACE_OPEN_COMMAND_ID = 'workspace.open' as const;
|
|
18
|
+
|
|
19
|
+
const DEFAULT_WIDGET_TREE_PATH = 'jdw/showcase/example.jdw.json';
|
|
20
|
+
const DEFAULT_TEMPLATE_JDW_PATH = 'jdw/templates/analytics-dashboard.jdw.json';
|
|
21
|
+
|
|
22
|
+
export interface SampleJdwLabViewProps {
|
|
23
|
+
readonly templateJdwPath?: string | undefined;
|
|
24
|
+
readonly widgetTreePath?: string | undefined;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function pathMatches(activePath: string | undefined, candidate: string): boolean {
|
|
28
|
+
if (!activePath) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return activePath === candidate || activePath.endsWith(`/${candidate}`);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function SampleJdwLabView({
|
|
36
|
+
templateJdwPath = DEFAULT_TEMPLATE_JDW_PATH,
|
|
37
|
+
widgetTreePath = DEFAULT_WIDGET_TREE_PATH,
|
|
38
|
+
}: SampleJdwLabViewProps = {}) {
|
|
39
|
+
const { executeCommand } = useWorkbench();
|
|
40
|
+
const activeTab = useActiveEditorTab();
|
|
41
|
+
const activePath = useActiveWorkspacePath(activeTab?.resourceUri);
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<WorkbenchActionSidebar
|
|
45
|
+
className="workbench-jdw-lab-view"
|
|
46
|
+
data-testid="jdw-lab-view"
|
|
47
|
+
items={[
|
|
48
|
+
{
|
|
49
|
+
description: widgetTreePath,
|
|
50
|
+
icon: <i aria-hidden="true" className="codicon codicon-layout" />,
|
|
51
|
+
id: 'widget-tree',
|
|
52
|
+
label: 'Widget Tree',
|
|
53
|
+
selected: pathMatches(activePath, widgetTreePath),
|
|
54
|
+
testId: 'jdw-lab-open-widget-tree',
|
|
55
|
+
title: `Open ${widgetTreePath}`,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
description: templateJdwPath,
|
|
59
|
+
icon: <i aria-hidden="true" className="codicon codicon-symbol-structure" />,
|
|
60
|
+
id: 'template-jdw',
|
|
61
|
+
label: 'Template JDW',
|
|
62
|
+
selected: pathMatches(activePath, templateJdwPath),
|
|
63
|
+
testId: 'jdw-lab-open-template-jdw',
|
|
64
|
+
title: `Open ${templateJdwPath}`,
|
|
65
|
+
},
|
|
66
|
+
]}
|
|
67
|
+
listProps={{
|
|
68
|
+
'aria-label': 'JDW lab surfaces',
|
|
69
|
+
className: 'workbench-jdw-lab-view__list',
|
|
70
|
+
}}
|
|
71
|
+
onSelect={(item) => {
|
|
72
|
+
if (typeof item.description !== 'string' || item.description.length === 0) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
void executeCommand(WORKSPACE_OPEN_COMMAND_ID, { path: item.description });
|
|
76
|
+
}}
|
|
77
|
+
/>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
@@ -1,65 +1,68 @@
|
|
|
1
|
-
import { useCallback, useMemo } from 'react';
|
|
2
|
-
import { resolveWidgetStudioAssetCatalog } from '@workbench-kit/react/widget-studio';
|
|
3
|
-
import { WidgetTreeLab } from '@workbench-kit/react/widget-tree';
|
|
4
|
-
import { BUILTIN_JDW_REGISTRY } from '@workbench-kit/react/jdw';
|
|
5
|
-
|
|
6
|
-
import { useWorkbench } from '
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
*
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const
|
|
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
|
-
}
|
|
1
|
+
import { useCallback, useMemo } from 'react';
|
|
2
|
+
import { resolveWidgetStudioAssetCatalog } from '@workbench-kit/react/widget-studio';
|
|
3
|
+
import { WidgetTreeLab } from '@workbench-kit/react/widget-tree';
|
|
4
|
+
import { BUILTIN_JDW_REGISTRY } from '@workbench-kit/react/jdw';
|
|
5
|
+
|
|
6
|
+
import { useWorkbench } from '../shell/provider.js';
|
|
7
|
+
import {
|
|
8
|
+
isWorkspaceResourceService,
|
|
9
|
+
useWorkspaceResourceState,
|
|
10
|
+
} from '../workbench/workspace-view-state.js';
|
|
11
|
+
|
|
12
|
+
export interface JdwWidgetFormViewProps {
|
|
13
|
+
readonly path: string;
|
|
14
|
+
readonly content: string;
|
|
15
|
+
readonly onContentChange: (content: string) => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const EMPTY_WORKSPACE_FILES: readonly { readonly path: string; readonly content: string }[] = [];
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Form authoring surface for JDW widgets. Builds the Assets palette from built-in
|
|
22
|
+
* assets, workspace asset packages, and other workspace `*.jdw.json` documents.
|
|
23
|
+
* Preview expands `type: "ref"` via workspace documents without rewriting the
|
|
24
|
+
* authored JSON outline.
|
|
25
|
+
*/
|
|
26
|
+
export function JdwWidgetFormView({ path, content, onContentChange }: JdwWidgetFormViewProps) {
|
|
27
|
+
const { workspaceHostPort } = useWorkbench();
|
|
28
|
+
const workspaceService = isWorkspaceResourceService(workspaceHostPort?.service)
|
|
29
|
+
? workspaceHostPort.service
|
|
30
|
+
: undefined;
|
|
31
|
+
const workspaceState = useWorkspaceResourceState(workspaceService);
|
|
32
|
+
const files =
|
|
33
|
+
workspaceState?.files ?? workspaceService?.getState().files ?? EMPTY_WORKSPACE_FILES;
|
|
34
|
+
|
|
35
|
+
const filesByPath = useMemo(() => {
|
|
36
|
+
const map = new Map<string, string>();
|
|
37
|
+
for (const file of files) {
|
|
38
|
+
map.set(file.path.replace(/\\/g, '/'), file.content);
|
|
39
|
+
}
|
|
40
|
+
return map;
|
|
41
|
+
}, [files]);
|
|
42
|
+
|
|
43
|
+
const loadDocument = useCallback(
|
|
44
|
+
(documentPath: string) => filesByPath.get(documentPath.replace(/\\/g, '/')) ?? null,
|
|
45
|
+
[filesByPath],
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
const assetCatalog = useMemo(
|
|
49
|
+
() =>
|
|
50
|
+
resolveWidgetStudioAssetCatalog(files, {
|
|
51
|
+
excludeDocumentPaths: [path],
|
|
52
|
+
}),
|
|
53
|
+
[files, path],
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<WidgetTreeLab
|
|
58
|
+
assetCatalog={assetCatalog}
|
|
59
|
+
loadDocument={loadDocument}
|
|
60
|
+
path={path}
|
|
61
|
+
registry={BUILTIN_JDW_REGISTRY}
|
|
62
|
+
showDesignSource={false}
|
|
63
|
+
value={content}
|
|
64
|
+
viewMode="design"
|
|
65
|
+
onChange={onContentChange}
|
|
66
|
+
/>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
@@ -1,51 +1,54 @@
|
|
|
1
|
-
import { useCallback, useMemo } from 'react';
|
|
2
|
-
import { JdwPreviewViewport } from '@workbench-kit/react/jdw/preview-viewport';
|
|
3
|
-
import { BUILTIN_JDW_REGISTRY } from '@workbench-kit/react/jdw';
|
|
4
|
-
|
|
5
|
-
import { useWorkbench } from '
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
1
|
+
import { useCallback, useMemo } from 'react';
|
|
2
|
+
import { JdwPreviewViewport } from '@workbench-kit/react/jdw/preview-viewport';
|
|
3
|
+
import { BUILTIN_JDW_REGISTRY } from '@workbench-kit/react/jdw';
|
|
4
|
+
|
|
5
|
+
import { useWorkbench } from '../shell/provider.js';
|
|
6
|
+
import {
|
|
7
|
+
isWorkspaceResourceService,
|
|
8
|
+
useWorkspaceResourceState,
|
|
9
|
+
} from '../workbench/workspace-view-state.js';
|
|
10
|
+
|
|
11
|
+
export interface JdwWidgetPreviewViewProps {
|
|
12
|
+
readonly path: string;
|
|
13
|
+
readonly content: string;
|
|
14
|
+
readonly className?: string | undefined;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const EMPTY_WORKSPACE_FILES: readonly { readonly path: string; readonly content: string }[] = [];
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Preview viewport for JDW documents. Expands workspace `type: "ref"` imports
|
|
21
|
+
* before layout/draw without rewriting the source buffer.
|
|
22
|
+
*/
|
|
23
|
+
export function JdwWidgetPreviewView({ path, content, className }: JdwWidgetPreviewViewProps) {
|
|
24
|
+
const { workspaceHostPort } = useWorkbench();
|
|
25
|
+
const workspaceService = isWorkspaceResourceService(workspaceHostPort?.service)
|
|
26
|
+
? workspaceHostPort.service
|
|
27
|
+
: undefined;
|
|
28
|
+
const workspaceState = useWorkspaceResourceState(workspaceService);
|
|
29
|
+
const files =
|
|
30
|
+
workspaceState?.files ?? workspaceService?.getState().files ?? EMPTY_WORKSPACE_FILES;
|
|
31
|
+
|
|
32
|
+
const filesByPath = useMemo(() => {
|
|
33
|
+
const map = new Map<string, string>();
|
|
34
|
+
for (const file of files) {
|
|
35
|
+
map.set(file.path.replace(/\\/g, '/'), file.content);
|
|
36
|
+
}
|
|
37
|
+
return map;
|
|
38
|
+
}, [files]);
|
|
39
|
+
|
|
40
|
+
const loadDocument = useCallback(
|
|
41
|
+
(documentPath: string) => filesByPath.get(documentPath.replace(/\\/g, '/')) ?? null,
|
|
42
|
+
[filesByPath],
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<JdwPreviewViewport
|
|
47
|
+
className={className}
|
|
48
|
+
documentPath={path}
|
|
49
|
+
json={content}
|
|
50
|
+
loadDocument={loadDocument}
|
|
51
|
+
registry={BUILTIN_JDW_REGISTRY}
|
|
52
|
+
/>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
@@ -1,57 +1,49 @@
|
|
|
1
|
-
import {
|
|
2
|
-
parseWorkbenchKeybindingsConfig,
|
|
3
|
-
type WorkbenchKeybindingDefinition,
|
|
4
|
-
} from '@workbench-kit/workbench-config';
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function readPersistedKeybindingOverrides(
|
|
18
|
-
storageKey = DEFAULT_WORKBENCH_KEYBINDING_STORAGE_KEY,
|
|
19
|
-
storage?: WorkbenchStorageReader,
|
|
20
|
-
): readonly WorkbenchKeybindingDefinition[] {
|
|
21
|
-
const resolvedStorage = storage ??
|
|
22
|
-
if (!resolvedStorage) {
|
|
23
|
-
return [];
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
try {
|
|
27
|
-
const raw = resolvedStorage.getItem(storageKey);
|
|
28
|
-
if (!raw) {
|
|
29
|
-
return [];
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return parseWorkbenchKeybindingsConfig(JSON.parse(raw) as unknown);
|
|
33
|
-
} catch {
|
|
34
|
-
return [];
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export function writePersistedKeybindingOverrides(
|
|
39
|
-
overrides: readonly WorkbenchKeybindingDefinition[],
|
|
40
|
-
storageKey = DEFAULT_WORKBENCH_KEYBINDING_STORAGE_KEY,
|
|
41
|
-
storage?: WorkbenchStorageWriter,
|
|
42
|
-
): void {
|
|
43
|
-
const resolvedStorage = storage ??
|
|
44
|
-
if (!resolvedStorage) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
resolvedStorage.setItem(storageKey, JSON.stringify(overrides, null, 2));
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function getBrowserLocalStorage(): (WorkbenchStorageReader & WorkbenchStorageWriter) | undefined {
|
|
52
|
-
try {
|
|
53
|
-
return globalThis.localStorage;
|
|
54
|
-
} catch {
|
|
55
|
-
return undefined;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
parseWorkbenchKeybindingsConfig,
|
|
3
|
+
type WorkbenchKeybindingDefinition,
|
|
4
|
+
} from '@workbench-kit/workbench-config';
|
|
5
|
+
import {
|
|
6
|
+
createBrowserWorkbenchStorage,
|
|
7
|
+
type WorkbenchStorageReader,
|
|
8
|
+
type WorkbenchStorageWriter,
|
|
9
|
+
} from '@workbench-kit/workbench-core';
|
|
10
|
+
|
|
11
|
+
export const DEFAULT_WORKBENCH_KEYBINDING_STORAGE_KEY = 'workbench-kit/.workbench/keybindings';
|
|
12
|
+
|
|
13
|
+
export function isWorkbenchKeybindingPersistenceAvailable(): boolean {
|
|
14
|
+
return createBrowserWorkbenchStorage({ kind: 'local' }) !== undefined;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function readPersistedKeybindingOverrides(
|
|
18
|
+
storageKey = DEFAULT_WORKBENCH_KEYBINDING_STORAGE_KEY,
|
|
19
|
+
storage?: WorkbenchStorageReader,
|
|
20
|
+
): readonly WorkbenchKeybindingDefinition[] {
|
|
21
|
+
const resolvedStorage = storage ?? createBrowserWorkbenchStorage({ kind: 'local' });
|
|
22
|
+
if (!resolvedStorage) {
|
|
23
|
+
return [];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
const raw = resolvedStorage.getItem(storageKey);
|
|
28
|
+
if (!raw) {
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return parseWorkbenchKeybindingsConfig(JSON.parse(raw) as unknown);
|
|
33
|
+
} catch {
|
|
34
|
+
return [];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function writePersistedKeybindingOverrides(
|
|
39
|
+
overrides: readonly WorkbenchKeybindingDefinition[],
|
|
40
|
+
storageKey = DEFAULT_WORKBENCH_KEYBINDING_STORAGE_KEY,
|
|
41
|
+
storage?: WorkbenchStorageWriter,
|
|
42
|
+
): void {
|
|
43
|
+
const resolvedStorage = storage ?? createBrowserWorkbenchStorage({ kind: 'local' });
|
|
44
|
+
if (!resolvedStorage) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
resolvedStorage.setItem(storageKey, JSON.stringify(overrides, null, 2));
|
|
49
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { KeybindingManagementPanel } from '@workbench-kit/react/workbench/management';
|
|
2
|
-
|
|
3
|
-
import { useKeybindingManagementModel } from './use-keybinding-management.js';
|
|
4
|
-
|
|
5
|
-
export function WorkbenchKeybindingManagementSettings() {
|
|
6
|
-
const { entries, overrideCount, resetKeybinding, setKeybinding } = useKeybindingManagementModel();
|
|
7
|
-
|
|
8
|
-
return (
|
|
9
|
-
<KeybindingManagementPanel
|
|
10
|
-
entries={entries}
|
|
11
|
-
summaryLabel={`${entries.length} command${entries.length === 1 ? '' : 's'} · ${overrideCount} user override${overrideCount === 1 ? '' : 's'}`}
|
|
12
|
-
onResetKeybinding={resetKeybinding}
|
|
13
|
-
onSetKeybinding={setKeybinding}
|
|
14
|
-
/>
|
|
15
|
-
);
|
|
16
|
-
}
|
|
1
|
+
import { KeybindingManagementPanel } from '@workbench-kit/react/workbench/management';
|
|
2
|
+
|
|
3
|
+
import { useKeybindingManagementModel } from './use-keybinding-management.js';
|
|
4
|
+
|
|
5
|
+
export function WorkbenchKeybindingManagementSettings() {
|
|
6
|
+
const { entries, overrideCount, resetKeybinding, setKeybinding } = useKeybindingManagementModel();
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<KeybindingManagementPanel
|
|
10
|
+
entries={entries}
|
|
11
|
+
summaryLabel={`${entries.length} command${entries.length === 1 ? '' : 's'} · ${overrideCount} user override${overrideCount === 1 ? '' : 's'}`}
|
|
12
|
+
onResetKeybinding={resetKeybinding}
|
|
13
|
+
onSetKeybinding={setKeybinding}
|
|
14
|
+
/>
|
|
15
|
+
);
|
|
16
|
+
}
|