@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.
Files changed (95) hide show
  1. package/README.md +41 -0
  2. package/package.json +9 -9
  3. package/src/{chat-ai-mock-proposals.ts → chat/ai-mock-proposals.ts} +39 -39
  4. package/src/{chat-command-input.ts → chat/command-input.ts} +52 -52
  5. package/src/{chat-command-policy.ts → chat/command-policy.ts} +54 -54
  6. package/src/{chat-command-surface.tsx → chat/command-surface.tsx} +155 -155
  7. package/src/{use-workbench-chat-command-proposals.ts → chat/use-chat-command-proposals.ts} +194 -194
  8. package/src/{chat-view-data.ts → chat/view-data.ts} +20 -20
  9. package/src/{chat-view.tsx → chat/view.tsx} +220 -220
  10. package/src/{command-inspector-surface.tsx → commands/inspector-surface.tsx} +46 -46
  11. package/src/{use-workbench-command-descriptors.ts → commands/use-command-descriptors.ts} +41 -41
  12. package/src/{use-context-key-revision.ts → commands/use-context-key-revision.ts} +18 -18
  13. package/src/{commands-view-data.ts → commands/view-data.ts} +17 -17
  14. package/src/{commands-view.tsx → commands/view.tsx} +43 -43
  15. package/src/devtools/WorkbenchDevtoolsPanel.tsx +124 -124
  16. package/src/devtools/WorkbenchDevtoolsShell.tsx +17 -17
  17. package/src/devtools/index.ts +11 -11
  18. package/src/devtools/use-workbench-devtools-snapshot.ts +84 -84
  19. package/src/devtools/workbench-devtools-snapshot.ts +140 -140
  20. package/src/devtools/workbench-devtools.css +82 -82
  21. package/src/{editor-area-dnd.ts → editor/area-dnd.ts} +69 -69
  22. package/src/{editor-area-model.ts → editor/area-model.ts} +71 -71
  23. package/src/{editor-area.css → editor/area.css} +454 -454
  24. package/src/{editor-area.tsx → editor/area.tsx} +676 -676
  25. package/src/{editor-host-surface.tsx → editor/host-surface.tsx} +631 -634
  26. package/src/{editor-pane-visibility.ts → editor/pane-visibility.ts} +130 -130
  27. package/src/{editor-resource.ts → editor/resource.ts} +36 -36
  28. package/src/{editor-state-storage.ts → editor/state-storage.ts} +182 -193
  29. package/src/{editor-tab-context-menu.ts → editor/tab-context-menu.ts} +118 -118
  30. package/src/{use-editor.ts → editor/use-editor.ts} +114 -107
  31. package/src/{editor-view-providers.tsx → editor/view-providers.tsx} +552 -552
  32. package/src/{editor-workspace-file-availability.ts → editor/workspace-file-availability.ts} +15 -15
  33. package/src/{editor-workspace-reconcile.tsx → editor/workspace-reconcile.tsx} +31 -28
  34. package/src/{explorer-context-menu.ts → explorer/context-menu.ts} +114 -114
  35. package/src/{createCommandWorkspaceExplorerPort.ts → explorer/create-command-workspace-explorer-port.ts} +86 -86
  36. package/src/{explorer-reveal.ts → explorer/reveal.ts} +112 -112
  37. package/src/{search-view-data.ts → explorer/search-view-data.ts} +15 -15
  38. package/src/{search-view.tsx → explorer/search-view.tsx} +65 -62
  39. package/src/{use-active-workspace-path.ts → explorer/use-active-workspace-path.ts} +15 -15
  40. package/src/{explorer-view-data.ts → explorer/view-data.ts} +58 -58
  41. package/src/{explorer-view.tsx → explorer/view.tsx} +227 -224
  42. package/src/{extension-context-menu.ts → extensions/context-menu.ts} +52 -52
  43. package/src/{extension-management-model.ts → extensions/management-model.ts} +313 -313
  44. package/src/{use-extension-management.ts → extensions/use-extension-management.ts} +241 -193
  45. package/src/{extensions-view-data.ts → extensions/view-data.ts} +19 -19
  46. package/src/{extensions-view.tsx → extensions/view.tsx} +63 -38
  47. package/src/{field-remap-demo.tsx → field-remap/demo.tsx} +18 -18
  48. package/src/{field-remap-editor-surface.tsx → field-remap/editor-surface.tsx} +36 -36
  49. package/src/{field-remap-flow-adapter.ts → field-remap/flow-adapter.ts} +240 -240
  50. package/src/{field-remap-flow.tsx → field-remap/flow.tsx} +369 -369
  51. package/src/{field-remap-graph.tsx → field-remap/graph.tsx} +559 -559
  52. package/src/field-remap/jsonata-transform.ts +166 -0
  53. package/src/{field-remap-panel.tsx → field-remap/panel.tsx} +193 -175
  54. package/src/{field-remap-samples.ts → field-remap/samples.ts} +352 -352
  55. package/src/{table-mapping-adapter.ts → field-remap/table-mapping-adapter.ts} +59 -59
  56. package/src/{field-remap-tree.tsx → field-remap/tree.tsx} +404 -404
  57. package/src/{field-remap-view-data.ts → field-remap/view-data.ts} +16 -16
  58. package/src/{field-remap-view.css → field-remap/view.css} +676 -676
  59. package/src/{field-remap-view.tsx → field-remap/view.tsx} +86 -86
  60. package/src/index.ts +212 -199
  61. package/src/{json-form-source-patch.ts → jdw/json-form-source-patch.ts} +323 -323
  62. package/src/{jdw-lab-view-data.ts → jdw/lab-view-data.ts} +25 -25
  63. package/src/{jdw-lab-view.css → jdw/lab-view.css} +21 -21
  64. package/src/{jdw-lab-view.tsx → jdw/lab-view.tsx} +79 -79
  65. package/src/{jdw-widget-form-view.tsx → jdw/widget-form-view.tsx} +68 -65
  66. package/src/{jdw-widget-preview-view.tsx → jdw/widget-preview-view.tsx} +54 -51
  67. package/src/{keybinding-overrides-storage.ts → management/keybinding-overrides-storage.ts} +49 -57
  68. package/src/{keybinding-management-settings.tsx → management/keybinding-settings.tsx} +16 -16
  69. package/src/{management-palette-commands.ts → management/palette-commands.ts} +38 -38
  70. package/src/{preference-settings-storage.ts → management/preference-settings-storage.ts} +50 -58
  71. package/src/{management-settings-ids.ts → management/settings-ids.ts} +12 -12
  72. package/src/{management-settings.tsx → management/settings.tsx} +96 -75
  73. package/src/{use-command-management.ts → management/use-command-management.ts} +191 -191
  74. package/src/{use-keybinding-management.ts → management/use-keybinding-management.ts} +130 -130
  75. package/src/{shell-model.tsx → shell/model.tsx} +149 -149
  76. package/src/{provider.tsx → shell/provider.tsx} +603 -573
  77. package/src/{shell-secondary-actions.tsx → shell/secondary-actions.tsx} +59 -59
  78. package/src/{shell-settings-constants.ts → shell/settings-constants.ts} +9 -9
  79. package/src/{shell-settings.tsx → shell/settings.tsx} +599 -599
  80. package/src/{shell.tsx → shell/shell.tsx} +680 -649
  81. package/src/{shell-titlebar-layout-controls.tsx → shell/titlebar-layout-controls.tsx} +4 -4
  82. package/src/{shell-view-host.tsx → shell/view-host.tsx} +212 -199
  83. package/src/{workbench-appearance-storage.ts → workbench/appearance-storage.ts} +107 -115
  84. package/src/{workbench-command-host.tsx → workbench/command-host.tsx} +243 -243
  85. package/src/{workbench-command-palette.ts → workbench/command-palette.ts} +208 -208
  86. package/src/{workbench-keybinding-bridge.ts → workbench/keybinding-bridge.ts} +54 -54
  87. package/src/{workbench-layout-storage.ts → workbench/layout-storage.ts} +134 -145
  88. package/src/{workbench-profile-modal.tsx → workbench/profile-modal.tsx} +118 -118
  89. package/src/{workbench-shell-command-registration.ts → workbench/shell-command-registration.ts} +58 -58
  90. package/src/{workbench-startup-gate.tsx → workbench/startup-gate.tsx} +136 -136
  91. package/src/{workbench-status-sections.ts → workbench/status-sections.ts} +43 -43
  92. package/src/{use-persisted-workbench-appearance.ts → workbench/use-persisted-appearance.ts} +33 -33
  93. package/src/{workbench-user-commands.ts → workbench/user-commands.ts} +46 -46
  94. package/src/{workspace-view-state.ts → workbench/workspace-view-state.ts} +35 -35
  95. package/src/jsonata-transform.ts +0 -36
@@ -1,17 +1,17 @@
1
- export const BUILTIN_COMMANDS_VIEW_RENDER_KIND = 'workbench-kit.builtin.commands.view' as const;
2
- export const BUILTIN_COMMANDS_VIEW_CONTAINER_ID = 'commands' as const;
3
-
4
- export interface BuiltinCommandsViewRenderData {
5
- readonly kind: typeof BUILTIN_COMMANDS_VIEW_RENDER_KIND;
6
- }
7
-
8
- export function isBuiltinCommandsViewRenderData(
9
- value: unknown,
10
- ): value is BuiltinCommandsViewRenderData {
11
- return (
12
- typeof value === 'object' &&
13
- value !== null &&
14
- 'kind' in value &&
15
- (value as BuiltinCommandsViewRenderData).kind === BUILTIN_COMMANDS_VIEW_RENDER_KIND
16
- );
17
- }
1
+ export const BUILTIN_COMMANDS_VIEW_RENDER_KIND = 'workbench-kit.builtin.commands.view' as const;
2
+ export const BUILTIN_COMMANDS_VIEW_CONTAINER_ID = 'commands' as const;
3
+
4
+ export interface BuiltinCommandsViewRenderData {
5
+ readonly kind: typeof BUILTIN_COMMANDS_VIEW_RENDER_KIND;
6
+ }
7
+
8
+ export function isBuiltinCommandsViewRenderData(
9
+ value: unknown,
10
+ ): value is BuiltinCommandsViewRenderData {
11
+ return (
12
+ typeof value === 'object' &&
13
+ value !== null &&
14
+ 'kind' in value &&
15
+ (value as BuiltinCommandsViewRenderData).kind === BUILTIN_COMMANDS_VIEW_RENDER_KIND
16
+ );
17
+ }
@@ -1,43 +1,43 @@
1
- import {
2
- CommandManagementSidebar,
3
- buildCommandInspectorUri,
4
- findCommandManagementEntry,
5
- } from '@workbench-kit/react/workbench/management';
6
-
7
- import {
8
- BUILTIN_COMMANDS_VIEW_RENDER_KIND,
9
- isBuiltinCommandsViewRenderData,
10
- type BuiltinCommandsViewRenderData,
11
- } from './commands-view-data.js';
12
- import { useCommandManagementModel } from './use-command-management.js';
13
- import { useEditorService } from './use-editor.js';
14
-
15
- export type { BuiltinCommandsViewRenderData };
16
- export { BUILTIN_COMMANDS_VIEW_RENDER_KIND, isBuiltinCommandsViewRenderData };
17
-
18
- export function BuiltinCommandsView() {
19
- const editorService = useEditorService();
20
- const { groups, lastRun, refreshRegistry, runCommand } = useCommandManagementModel();
21
-
22
- const inspectCommand = (commandId: string) => {
23
- const entry = findCommandManagementEntry(groups, commandId);
24
- editorService.openEditor({
25
- icon: 'codicon-terminal',
26
- pinned: true,
27
- preview: false,
28
- resourceUri: buildCommandInspectorUri(commandId),
29
- title: entry?.label ?? commandId,
30
- });
31
- };
32
-
33
- return (
34
- <CommandManagementSidebar
35
- className="workbench-commands-view"
36
- groups={groups}
37
- lastRun={lastRun}
38
- onInspectCommand={inspectCommand}
39
- onRefresh={refreshRegistry}
40
- onRunCommand={runCommand}
41
- />
42
- );
43
- }
1
+ import {
2
+ CommandManagementSidebar,
3
+ buildCommandInspectorUri,
4
+ findCommandManagementEntry,
5
+ } from '@workbench-kit/react/workbench/management';
6
+
7
+ import {
8
+ BUILTIN_COMMANDS_VIEW_RENDER_KIND,
9
+ isBuiltinCommandsViewRenderData,
10
+ type BuiltinCommandsViewRenderData,
11
+ } from './view-data.js';
12
+ import { useCommandManagementModel } from '../management/use-command-management.js';
13
+ import { useEditorService } from '../editor/use-editor.js';
14
+
15
+ export type { BuiltinCommandsViewRenderData };
16
+ export { BUILTIN_COMMANDS_VIEW_RENDER_KIND, isBuiltinCommandsViewRenderData };
17
+
18
+ export function BuiltinCommandsView() {
19
+ const editorService = useEditorService();
20
+ const { groups, lastRun, refreshRegistry, runCommand } = useCommandManagementModel();
21
+
22
+ const inspectCommand = (commandId: string) => {
23
+ const entry = findCommandManagementEntry(groups, commandId);
24
+ editorService.openEditor({
25
+ icon: 'codicon-terminal',
26
+ pinned: true,
27
+ preview: false,
28
+ resourceUri: buildCommandInspectorUri(commandId),
29
+ title: entry?.label ?? commandId,
30
+ });
31
+ };
32
+
33
+ return (
34
+ <CommandManagementSidebar
35
+ className="workbench-commands-view"
36
+ groups={groups}
37
+ lastRun={lastRun}
38
+ onInspectCommand={inspectCommand}
39
+ onRefresh={refreshRegistry}
40
+ onRunCommand={runCommand}
41
+ />
42
+ );
43
+ }
@@ -1,124 +1,124 @@
1
- import { useMemo, useState } from 'react';
2
-
3
- import { Button, ScrollArea } from '@workbench-kit/react/primitives';
4
-
5
- import { useWorkbenchDevtoolsSnapshot } from './use-workbench-devtools-snapshot.js';
6
-
7
- type DevtoolsSectionId =
8
- | 'commands'
9
- | 'menus'
10
- | 'keybindings'
11
- | 'contextKeys'
12
- | 'capabilities'
13
- | 'layout'
14
- | 'editor'
15
- | 'views'
16
- | 'transactions'
17
- | 'diagnostics';
18
-
19
- const DEVTOOLS_SECTIONS: readonly {
20
- readonly id: DevtoolsSectionId;
21
- readonly label: string;
22
- }[] = [
23
- { id: 'commands', label: 'Commands' },
24
- { id: 'menus', label: 'Menus' },
25
- { id: 'keybindings', label: 'Keybindings' },
26
- { id: 'contextKeys', label: 'Context keys' },
27
- { id: 'capabilities', label: 'Capabilities' },
28
- { id: 'layout', label: 'Layout' },
29
- { id: 'editor', label: 'Editor' },
30
- { id: 'views', label: 'Views' },
31
- { id: 'transactions', label: 'Transactions' },
32
- { id: 'diagnostics', label: 'Diagnostics' },
33
- ];
34
-
35
- function formatSectionValue(
36
- sectionId: DevtoolsSectionId,
37
- snapshot: ReturnType<typeof useWorkbenchDevtoolsSnapshot>,
38
- ): string {
39
- switch (sectionId) {
40
- case 'commands':
41
- return JSON.stringify(snapshot.commands, null, 2);
42
- case 'menus':
43
- return JSON.stringify(snapshot.menus, null, 2);
44
- case 'keybindings':
45
- return JSON.stringify(snapshot.keybindings, null, 2);
46
- case 'contextKeys':
47
- return JSON.stringify(snapshot.contextKeys, null, 2);
48
- case 'capabilities':
49
- return JSON.stringify(
50
- {
51
- activeExtensions: snapshot.activeExtensions,
52
- capabilities: snapshot.capabilities,
53
- },
54
- null,
55
- 2,
56
- );
57
- case 'layout':
58
- return JSON.stringify(snapshot.layout, null, 2);
59
- case 'editor':
60
- return JSON.stringify(snapshot.editor, null, 2);
61
- case 'views':
62
- return JSON.stringify(
63
- {
64
- activities: snapshot.activities,
65
- viewContainers: snapshot.viewContainers,
66
- views: snapshot.views,
67
- },
68
- null,
69
- 2,
70
- );
71
- case 'transactions':
72
- return JSON.stringify(snapshot.transactions, null, 2);
73
- case 'diagnostics':
74
- return JSON.stringify(snapshot.dependencyDiagnostics, null, 2);
75
- default:
76
- return '';
77
- }
78
- }
79
-
80
- export function WorkbenchDevtoolsPanel() {
81
- const snapshot = useWorkbenchDevtoolsSnapshot();
82
- const [activeSection, setActiveSection] = useState<DevtoolsSectionId>('commands');
83
- const sectionValue = useMemo(
84
- () => formatSectionValue(activeSection, snapshot),
85
- [activeSection, snapshot],
86
- );
87
-
88
- return (
89
- <aside
90
- aria-label="Workbench devtools"
91
- className="workbench-devtools-panel"
92
- data-testid="workbench-devtools-panel"
93
- >
94
- <header className="workbench-devtools-panel__header">
95
- <strong>Workbench Devtools</strong>
96
- <span className="workbench-devtools-panel__meta">Read-only</span>
97
- </header>
98
- <p className="workbench-devtools-panel__timestamp">Updated {snapshot.capturedAt}</p>
99
- <nav aria-label="Devtools sections" className="workbench-devtools-panel__tabs">
100
- {DEVTOOLS_SECTIONS.map((section) => (
101
- <Button
102
- key={section.id}
103
- aria-pressed={activeSection === section.id}
104
- compact
105
- className="workbench-devtools-panel__tab"
106
- onClick={() => {
107
- setActiveSection(section.id);
108
- }}
109
- >
110
- {section.label}
111
- </Button>
112
- ))}
113
- </nav>
114
- <ScrollArea
115
- as="pre"
116
- className="workbench-devtools-panel__output"
117
- gutter="stable"
118
- orientation="vertical"
119
- >
120
- {sectionValue}
121
- </ScrollArea>
122
- </aside>
123
- );
124
- }
1
+ import { useMemo, useState } from 'react';
2
+
3
+ import { Button, ScrollArea } from '@workbench-kit/react/primitives';
4
+
5
+ import { useWorkbenchDevtoolsSnapshot } from './use-workbench-devtools-snapshot.js';
6
+
7
+ type DevtoolsSectionId =
8
+ | 'commands'
9
+ | 'menus'
10
+ | 'keybindings'
11
+ | 'contextKeys'
12
+ | 'capabilities'
13
+ | 'layout'
14
+ | 'editor'
15
+ | 'views'
16
+ | 'transactions'
17
+ | 'diagnostics';
18
+
19
+ const DEVTOOLS_SECTIONS: readonly {
20
+ readonly id: DevtoolsSectionId;
21
+ readonly label: string;
22
+ }[] = [
23
+ { id: 'commands', label: 'Commands' },
24
+ { id: 'menus', label: 'Menus' },
25
+ { id: 'keybindings', label: 'Keybindings' },
26
+ { id: 'contextKeys', label: 'Context keys' },
27
+ { id: 'capabilities', label: 'Capabilities' },
28
+ { id: 'layout', label: 'Layout' },
29
+ { id: 'editor', label: 'Editor' },
30
+ { id: 'views', label: 'Views' },
31
+ { id: 'transactions', label: 'Transactions' },
32
+ { id: 'diagnostics', label: 'Diagnostics' },
33
+ ];
34
+
35
+ function formatSectionValue(
36
+ sectionId: DevtoolsSectionId,
37
+ snapshot: ReturnType<typeof useWorkbenchDevtoolsSnapshot>,
38
+ ): string {
39
+ switch (sectionId) {
40
+ case 'commands':
41
+ return JSON.stringify(snapshot.commands, null, 2);
42
+ case 'menus':
43
+ return JSON.stringify(snapshot.menus, null, 2);
44
+ case 'keybindings':
45
+ return JSON.stringify(snapshot.keybindings, null, 2);
46
+ case 'contextKeys':
47
+ return JSON.stringify(snapshot.contextKeys, null, 2);
48
+ case 'capabilities':
49
+ return JSON.stringify(
50
+ {
51
+ activeExtensions: snapshot.activeExtensions,
52
+ capabilities: snapshot.capabilities,
53
+ },
54
+ null,
55
+ 2,
56
+ );
57
+ case 'layout':
58
+ return JSON.stringify(snapshot.layout, null, 2);
59
+ case 'editor':
60
+ return JSON.stringify(snapshot.editor, null, 2);
61
+ case 'views':
62
+ return JSON.stringify(
63
+ {
64
+ activities: snapshot.activities,
65
+ viewContainers: snapshot.viewContainers,
66
+ views: snapshot.views,
67
+ },
68
+ null,
69
+ 2,
70
+ );
71
+ case 'transactions':
72
+ return JSON.stringify(snapshot.transactions, null, 2);
73
+ case 'diagnostics':
74
+ return JSON.stringify(snapshot.dependencyDiagnostics, null, 2);
75
+ default:
76
+ return '';
77
+ }
78
+ }
79
+
80
+ export function WorkbenchDevtoolsPanel() {
81
+ const snapshot = useWorkbenchDevtoolsSnapshot();
82
+ const [activeSection, setActiveSection] = useState<DevtoolsSectionId>('commands');
83
+ const sectionValue = useMemo(
84
+ () => formatSectionValue(activeSection, snapshot),
85
+ [activeSection, snapshot],
86
+ );
87
+
88
+ return (
89
+ <aside
90
+ aria-label="Workbench devtools"
91
+ className="workbench-devtools-panel"
92
+ data-testid="workbench-devtools-panel"
93
+ >
94
+ <header className="workbench-devtools-panel__header">
95
+ <strong>Workbench Devtools</strong>
96
+ <span className="workbench-devtools-panel__meta">Read-only</span>
97
+ </header>
98
+ <p className="workbench-devtools-panel__timestamp">Updated {snapshot.capturedAt}</p>
99
+ <nav aria-label="Devtools sections" className="workbench-devtools-panel__tabs">
100
+ {DEVTOOLS_SECTIONS.map((section) => (
101
+ <Button
102
+ key={section.id}
103
+ aria-pressed={activeSection === section.id}
104
+ compact
105
+ className="workbench-devtools-panel__tab"
106
+ onClick={() => {
107
+ setActiveSection(section.id);
108
+ }}
109
+ >
110
+ {section.label}
111
+ </Button>
112
+ ))}
113
+ </nav>
114
+ <ScrollArea
115
+ as="pre"
116
+ className="workbench-devtools-panel__output"
117
+ gutter="stable"
118
+ orientation="vertical"
119
+ >
120
+ {sectionValue}
121
+ </ScrollArea>
122
+ </aside>
123
+ );
124
+ }
@@ -1,17 +1,17 @@
1
- import type { ReactNode } from 'react';
2
-
3
- import { WorkbenchDevtoolsPanel } from './WorkbenchDevtoolsPanel.js';
4
- import './workbench-devtools.css';
5
-
6
- export interface WorkbenchDevtoolsShellProps {
7
- readonly children: ReactNode;
8
- }
9
-
10
- export function WorkbenchDevtoolsShell({ children }: WorkbenchDevtoolsShellProps) {
11
- return (
12
- <div className="workbench-devtools-shell" data-testid="workbench-devtools-shell">
13
- <div className="workbench-devtools-shell__main">{children}</div>
14
- <WorkbenchDevtoolsPanel />
15
- </div>
16
- );
17
- }
1
+ import type { ReactNode } from 'react';
2
+
3
+ import { WorkbenchDevtoolsPanel } from './WorkbenchDevtoolsPanel.js';
4
+ import './workbench-devtools.css';
5
+
6
+ export interface WorkbenchDevtoolsShellProps {
7
+ readonly children: ReactNode;
8
+ }
9
+
10
+ export function WorkbenchDevtoolsShell({ children }: WorkbenchDevtoolsShellProps) {
11
+ return (
12
+ <div className="workbench-devtools-shell" data-testid="workbench-devtools-shell">
13
+ <div className="workbench-devtools-shell__main">{children}</div>
14
+ <WorkbenchDevtoolsPanel />
15
+ </div>
16
+ );
17
+ }
@@ -1,11 +1,11 @@
1
- export { WorkbenchDevtoolsPanel } from './WorkbenchDevtoolsPanel.js';
2
- export {
3
- WorkbenchDevtoolsShell,
4
- type WorkbenchDevtoolsShellProps,
5
- } from './WorkbenchDevtoolsShell.js';
6
- export {
7
- collectWorkbenchDevtoolsSnapshot,
8
- type CollectWorkbenchDevtoolsSnapshotInput,
9
- type WorkbenchDevtoolsSnapshot,
10
- } from './workbench-devtools-snapshot.js';
11
- export { useWorkbenchDevtoolsSnapshot } from './use-workbench-devtools-snapshot.js';
1
+ export { WorkbenchDevtoolsPanel } from './WorkbenchDevtoolsPanel.js';
2
+ export {
3
+ WorkbenchDevtoolsShell,
4
+ type WorkbenchDevtoolsShellProps,
5
+ } from './WorkbenchDevtoolsShell.js';
6
+ export {
7
+ collectWorkbenchDevtoolsSnapshot,
8
+ type CollectWorkbenchDevtoolsSnapshotInput,
9
+ type WorkbenchDevtoolsSnapshot,
10
+ } from './workbench-devtools-snapshot.js';
11
+ export { useWorkbenchDevtoolsSnapshot } from './use-workbench-devtools-snapshot.js';
@@ -1,84 +1,84 @@
1
- import { useMemo, useSyncExternalStore } from 'react';
2
-
3
- import {
4
- collectWorkbenchDevtoolsSnapshot,
5
- type WorkbenchDevtoolsSnapshot,
6
- } from './workbench-devtools-snapshot.js';
7
- import { useWorkbench } from '../provider.js';
8
- import type { WorkbenchWorkspaceHostPort as WorkspaceHostPort } from '@workbench-kit/workspace';
9
-
10
- export function useWorkbenchDevtoolsSnapshot(): WorkbenchDevtoolsSnapshot {
11
- const { editorService, extensionRegistry, layoutService, workspaceHostPort } = useWorkbench();
12
-
13
- const store = useMemo(() => {
14
- const collectSnapshot = () =>
15
- collectWorkbenchDevtoolsSnapshot({
16
- editorService,
17
- extensionRegistry,
18
- layoutService,
19
- workspaceHostPort,
20
- });
21
- let snapshot = collectSnapshot();
22
-
23
- const notifyChange = (onStoreChange: () => void) => {
24
- snapshot = collectSnapshot();
25
- onStoreChange();
26
- };
27
-
28
- return {
29
- getSnapshot: () => snapshot,
30
- subscribe: (onStoreChange: () => void) => {
31
- const disposables = [
32
- layoutService.onDidChangeLayout(() => {
33
- notifyChange(onStoreChange);
34
- }),
35
- editorService.onDidChangeEditors(() => {
36
- notifyChange(onStoreChange);
37
- }),
38
- extensionRegistry.commands.onDidRegisterCommand(() => {
39
- notifyChange(onStoreChange);
40
- }),
41
- extensionRegistry.menus.onDidRegisterMenuItem(() => {
42
- notifyChange(onStoreChange);
43
- }),
44
- extensionRegistry.keybindings.onDidRegisterKeybinding(() => {
45
- notifyChange(onStoreChange);
46
- }),
47
- extensionRegistry.views.onDidRegisterView(() => {
48
- notifyChange(onStoreChange);
49
- }),
50
- extensionRegistry.views.onDidRegisterViewContainer(() => {
51
- notifyChange(onStoreChange);
52
- }),
53
- extensionRegistry.views.onDidRegisterViewProvider(() => {
54
- notifyChange(onStoreChange);
55
- }),
56
- extensionRegistry.activities.onDidRegisterActivity(() => {
57
- notifyChange(onStoreChange);
58
- }),
59
- extensionRegistry.onDidActivateExtension(() => {
60
- notifyChange(onStoreChange);
61
- }),
62
- extensionRegistry.onDidDeactivateExtension(() => {
63
- notifyChange(onStoreChange);
64
- }),
65
- ];
66
-
67
- const workspacePort = workspaceHostPort as WorkspaceHostPort | undefined;
68
- const unsubscribeWorkspace = workspacePort?.service.onDidChangeWorkspace(() => {
69
- notifyChange(onStoreChange);
70
- });
71
-
72
- return () => {
73
- for (const disposable of disposables) {
74
- disposable.dispose();
75
- }
76
-
77
- unsubscribeWorkspace?.();
78
- };
79
- },
80
- };
81
- }, [editorService, extensionRegistry, layoutService, workspaceHostPort]);
82
-
83
- return useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot);
84
- }
1
+ import { useMemo, useSyncExternalStore } from 'react';
2
+
3
+ import {
4
+ collectWorkbenchDevtoolsSnapshot,
5
+ type WorkbenchDevtoolsSnapshot,
6
+ } from './workbench-devtools-snapshot.js';
7
+ import { useWorkbench } from '../shell/provider.js';
8
+ import type { WorkbenchWorkspaceHostPort as WorkspaceHostPort } from '@workbench-kit/workspace';
9
+
10
+ export function useWorkbenchDevtoolsSnapshot(): WorkbenchDevtoolsSnapshot {
11
+ const { editorService, extensionRegistry, layoutService, workspaceHostPort } = useWorkbench();
12
+
13
+ const store = useMemo(() => {
14
+ const collectSnapshot = () =>
15
+ collectWorkbenchDevtoolsSnapshot({
16
+ editorService,
17
+ extensionRegistry,
18
+ layoutService,
19
+ workspaceHostPort,
20
+ });
21
+ let snapshot = collectSnapshot();
22
+
23
+ const notifyChange = (onStoreChange: () => void) => {
24
+ snapshot = collectSnapshot();
25
+ onStoreChange();
26
+ };
27
+
28
+ return {
29
+ getSnapshot: () => snapshot,
30
+ subscribe: (onStoreChange: () => void) => {
31
+ const disposables = [
32
+ layoutService.onDidChangeLayout(() => {
33
+ notifyChange(onStoreChange);
34
+ }),
35
+ editorService.onDidChangeEditors(() => {
36
+ notifyChange(onStoreChange);
37
+ }),
38
+ extensionRegistry.commands.onDidRegisterCommand(() => {
39
+ notifyChange(onStoreChange);
40
+ }),
41
+ extensionRegistry.menus.onDidRegisterMenuItem(() => {
42
+ notifyChange(onStoreChange);
43
+ }),
44
+ extensionRegistry.keybindings.onDidRegisterKeybinding(() => {
45
+ notifyChange(onStoreChange);
46
+ }),
47
+ extensionRegistry.views.onDidRegisterView(() => {
48
+ notifyChange(onStoreChange);
49
+ }),
50
+ extensionRegistry.views.onDidRegisterViewContainer(() => {
51
+ notifyChange(onStoreChange);
52
+ }),
53
+ extensionRegistry.views.onDidRegisterViewProvider(() => {
54
+ notifyChange(onStoreChange);
55
+ }),
56
+ extensionRegistry.activities.onDidRegisterActivity(() => {
57
+ notifyChange(onStoreChange);
58
+ }),
59
+ extensionRegistry.onDidActivateExtension(() => {
60
+ notifyChange(onStoreChange);
61
+ }),
62
+ extensionRegistry.onDidDeactivateExtension(() => {
63
+ notifyChange(onStoreChange);
64
+ }),
65
+ ];
66
+
67
+ const workspacePort = workspaceHostPort as WorkspaceHostPort | undefined;
68
+ const unsubscribeWorkspace = workspacePort?.service.onDidChangeWorkspace(() => {
69
+ notifyChange(onStoreChange);
70
+ });
71
+
72
+ return () => {
73
+ for (const disposable of disposables) {
74
+ disposable.dispose();
75
+ }
76
+
77
+ unsubscribeWorkspace?.();
78
+ };
79
+ },
80
+ };
81
+ }, [editorService, extensionRegistry, layoutService, workspaceHostPort]);
82
+
83
+ return useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot);
84
+ }