@workbench-kit/react 0.0.2-prototype.0.2.5 → 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 +87 -0
- package/package.json +20 -18
- package/src/index.ts +27 -27
- package/src/jdw/JsonCodeEditorPane.tsx +7 -6
- package/src/json-config/JsonConfigWorkbench.tsx +1 -1
- package/src/layout/sidebar/SidebarActionIconBar.tsx +3 -3
- package/src/layout/sidebar/WorkbenchSidebarActions.tsx +1 -1
- package/src/modal/Modal.tsx +55 -25
- package/src/modal/ModalTitlebar.tsx +8 -8
- package/src/modal/useModalFocusTrap.ts +142 -0
- package/src/modal/useModalWindowFrame.ts +2 -2
- package/src/primitives/absolute-box/AbsoluteBox.tsx +4 -4
- package/src/primitives/button/Button.tsx +4 -4
- package/src/primitives/catalog-browse-card/CatalogBrowseCard.tsx +6 -6
- package/src/primitives/catalog-browse-pane/CatalogBrowsePane.tsx +15 -15
- package/src/primitives/catalog-filter-overlay/CatalogFilterOverlay.tsx +2 -2
- package/src/primitives/checkbox/Checkbox.tsx +1 -1
- package/src/primitives/chip/Chip.tsx +2 -2
- package/src/primitives/codicon/Codicon.tsx +1 -1
- package/src/primitives/file-icon/FileIcon.tsx +1 -1
- package/src/primitives/icon-button/IconButton.tsx +1 -1
- package/src/primitives/library-detail-layout/LibraryDetailLayout.tsx +5 -5
- package/src/primitives/library-facet-filter-panel/LibraryFacetFilterPanel.tsx +12 -12
- package/src/primitives/library-facet-filter-strip/LibraryFacetFilterStrip.tsx +4 -4
- package/src/primitives/number-input/NumberInput.tsx +5 -5
- package/src/primitives/record-media-hero/RecordMediaHero.tsx +6 -6
- package/src/primitives/scroll-area/ScrollArea.tsx +5 -5
- package/src/primitives/scroll-area-infinite-load/useScrollAreaInfiniteLoad.ts +5 -5
- package/src/primitives/searchable-multi-select/SearchableMultiSelect.tsx +7 -7
- package/src/primitives/text-area/TextArea.tsx +1 -1
- package/src/primitives/text-input/TextInput.tsx +1 -1
- package/src/primitives/workbench-media-slot/WorkbenchMediaPlaceholder.tsx +2 -2
- package/src/primitives/workbench-media-slot/WorkbenchMediaSlot.tsx +9 -9
- package/src/primitives/workbench-thumbnail/WorkbenchThumbnail.tsx +4 -4
- package/src/styles.css +1 -2
- package/src/widget-tree/WidgetTreeWorkspaceShell.tsx +2 -2
- package/src/workbench/chat/ChatCommandProposalCard.tsx +4 -4
- package/src/workbench/chat/ChatConversationBar.tsx +3 -3
- package/src/workbench/chat/ChatHistoryMenu.tsx +1 -1
- package/src/workbench/chat/ChatMessageCollapsible.tsx +4 -0
- package/src/workbench/chat/ChatMessageItem.tsx +68 -10
- package/src/workbench/chat/ChatMessageList.tsx +1 -1
- package/src/workbench/chat/ChatPanel.tsx +32 -23
- package/src/workbench/chat/ChatPhasedRunProgress.tsx +86 -13
- package/src/workbench/chat/ChatRenameDialog.tsx +1 -1
- package/src/workbench/chat/chat-conversation.css +2 -2
- package/src/workbench/chat/chat-ui.css +8 -0
- package/src/workbench/chat/chatConversation.ts +2 -2
- package/src/workbench/chat/chatMessageMeta.tsx +4 -4
- package/src/workbench/chat/index.ts +1 -0
- package/src/workbench/chat/types.ts +7 -7
- package/src/workbench/chat/useCancelRuntimeOnUnmount.ts +4 -4
- package/src/workbench/chat/useChatPrependPagination.ts +10 -10
- package/src/workbench/chat/useSlashCommandSuggest.ts +1 -1
- package/src/workbench/{WorkbenchModalPortal.tsx → chrome/WorkbenchModalPortal.tsx} +1 -1
- package/src/workbench/chrome/workbench-chrome.css +4 -0
- package/src/workbench/{CommandGroupShell.tsx → commands/CommandGroupShell.tsx} +2 -2
- package/src/workbench/{CommandList.tsx → commands/CommandList.tsx} +5 -5
- package/src/workbench/{CommandPalette.tsx → commands/CommandPalette.tsx} +16 -42
- package/src/workbench/{ConfirmationFlow.tsx → commands/ConfirmationFlow.tsx} +5 -5
- package/src/workbench/{command-model.ts → commands/command-model.ts} +5 -1
- package/src/workbench/{commands.ts → commands/commands.ts} +1 -1
- package/src/workbench/{WorkbenchEditorTabs.tsx → editor/WorkbenchEditorTabs.tsx} +1 -1
- package/src/workbench/{editor-tabs-dnd.ts → editor/editor-tabs-dnd.ts} +1 -1
- package/src/workbench/{editorTabContextMenu.ts → editor/editorTabContextMenu.ts} +2 -2
- package/src/workbench/{useEditorTabsStripDnd.ts → editor/useEditorTabsStripDnd.ts} +1 -1
- package/src/workbench/{useWorkbenchEditorTabContextMenu.tsx → editor/useWorkbenchEditorTabContextMenu.tsx} +1 -1
- package/src/workbench/editor-tabs/index.ts +9 -9
- package/src/workbench/index.ts +93 -74
- package/src/workbench/management/ExtensionManagementPanel.tsx +31 -2
- package/src/workbench/management/ExtensionManagementSidebar.tsx +18 -1
- package/src/workbench/management/IntegrationsShell.tsx +1 -1
- package/src/workbench/management/WorkbenchDialogFrame.tsx +2 -2
- package/src/workbench/management/extension-install-approval.ts +72 -0
- package/src/workbench/management/index.ts +7 -0
- package/src/workbench/management/types.ts +14 -1
- package/src/workbench/{MarkdownPreview.tsx → markdown/MarkdownPreview.tsx} +22 -7
- package/src/workbench/markdown/markdownRemarkPlugins.ts +12 -0
- package/src/workbench/markdown/sanitizeMarkdownHref.ts +29 -0
- package/src/workbench/{ActivityBar.tsx → shell/ActivityBar.tsx} +8 -8
- package/src/workbench/{ArtifactShell.tsx → shell/ArtifactShell.tsx} +25 -25
- package/src/workbench/{SplitView.tsx → shell/SplitView.tsx} +3 -3
- package/src/workbench/{StatusBar.tsx → shell/StatusBar.tsx} +8 -8
- package/src/workbench/{StructuredArtifactEditor.tsx → shell/StructuredArtifactEditor.tsx} +9 -9
- package/src/workbench/{Timeline.tsx → shell/Timeline.tsx} +18 -18
- package/src/workbench/{WorkbenchCanvasShell.defaults.ts → shell/WorkbenchCanvasShell.defaults.ts} +1 -1
- package/src/workbench/{WorkbenchCanvasShell.model.ts → shell/WorkbenchCanvasShell.model.ts} +5 -5
- package/src/workbench/{WorkbenchCanvasShell.tsx → shell/WorkbenchCanvasShell.tsx} +6 -6
- package/src/workbench/{WorkbenchDesktopTitleBar.tsx → shell/WorkbenchDesktopTitleBar.tsx} +15 -15
- package/src/workbench/{WorkbenchShell.tsx → shell/WorkbenchShell.tsx} +5 -5
- package/src/workbench/{WorkbenchShellTitleBarLayoutControls.tsx → shell/WorkbenchShellTitleBarLayoutControls.tsx} +12 -12
- package/src/workbench/{WorkbenchStandaloneShell.tsx → shell/WorkbenchStandaloneShell.tsx} +4 -4
- package/src/workbench/{WorkbenchViewEditor.tsx → shell/WorkbenchViewEditor.tsx} +7 -7
- package/src/workbench/{WorkbenchViewSidebar.tsx → shell/WorkbenchViewSidebar.tsx} +7 -7
- package/src/workbench/{WorkbenchWindowChromeControls.tsx → shell/WorkbenchWindowChromeControls.tsx} +18 -15
- package/src/workbench/{shell.ts → shell/shell.ts} +18 -12
- package/src/workbench/{shellViewModel.ts → shell/shellViewModel.ts} +3 -3
- package/src/workbench/{standalone.ts → shell/standalone.ts} +2 -2
- package/src/workbench/{useDeferredWorkbenchMount.ts → shell/useDeferredWorkbenchMount.ts} +3 -3
- package/src/workbench/{useWorkbenchAppearanceDocumentSync.tsx → shell/useWorkbenchAppearanceDocumentSync.tsx} +1 -1
- package/src/workbench/{useWorkbenchSidebarActionBarDnd.ts → shell/useWorkbenchSidebarActionBarDnd.ts} +1 -1
- package/src/workbench/{useWorkbenchSidebarViewPlacementDropZone.ts → shell/useWorkbenchSidebarViewPlacementDropZone.ts} +2 -2
- package/src/workbench/{workbenchViewRouteState.ts → shell/workbenchViewRouteState.ts} +4 -4
- package/src/workbench/{WorkbenchThemeProvider.tsx → theme/WorkbenchThemeProvider.tsx} +4 -4
- package/src/workbench/{theme.ts → theme/theme.ts} +1 -1
- package/src/workbench/{themePresets.ts → theme/themePresets.ts} +2 -2
- package/src/workbench/workspace/WorkspaceEditorPanel.tsx +1 -1
- package/src/workbench/workspace/workspaceJsonDiagnostics.ts +6 -5
- package/src/workbench/jdw/jdw-editors.css +0 -4
- package/src/workbench/jdw/jdw.css +0 -2
- package/src/workbench/markdownRemarkPlugins.ts +0 -4
- package/src/workbench/workbench-chrome.css +0 -4
- /package/src/workbench/{WorkbenchPlatformContext.tsx → chrome/WorkbenchPlatformContext.tsx} +0 -0
- /package/src/workbench/{workbenchModalViewState.ts → chrome/workbenchModalViewState.ts} +0 -0
- /package/src/workbench/{workbenchOverlaysContext.tsx → chrome/workbenchOverlaysContext.tsx} +0 -0
- /package/src/workbench/{workbenchPlatformChrome.ts → chrome/workbenchPlatformChrome.ts} +0 -0
- /package/src/workbench/{ShortcutCommandBridge.tsx → commands/ShortcutCommandBridge.tsx} +0 -0
- /package/src/workbench/{command-execution-policy.ts → commands/command-execution-policy.ts} +0 -0
- /package/src/workbench/{keyboard.ts → commands/keyboard.ts} +0 -0
- /package/src/workbench/{workbenchContextMenu.ts → commands/workbenchContextMenu.ts} +0 -0
- /package/src/workbench/{activityBarOrder.ts → shell/activityBarOrder.ts} +0 -0
- /package/src/workbench/{appearanceLabels.ts → shell/appearanceLabels.ts} +0 -0
- /package/src/workbench/{hardReset.ts → shell/hardReset.ts} +0 -0
- /package/src/workbench/{shellPresets.ts → shell/shellPresets.ts} +0 -0
- /package/src/workbench/{shellState.ts → shell/shellState.ts} +0 -0
- /package/src/workbench/{sidebarViewPlacementDnd.ts → shell/sidebarViewPlacementDnd.ts} +0 -0
- /package/src/workbench/{status.ts → shell/status.ts} +0 -0
- /package/src/workbench/{useWorkbenchSidebarLayout.tsx → shell/useWorkbenchSidebarLayout.tsx} +0 -0
- /package/src/workbench/{useWorkbenchStandaloneShellStateSync.tsx → shell/useWorkbenchStandaloneShellStateSync.tsx} +0 -0
- /package/src/workbench/{workbenchSidebarLayoutContext.ts → shell/workbenchSidebarLayoutContext.ts} +0 -0
- /package/src/workbench/{workbenchStandaloneShellReactContext.tsx → shell/workbenchStandaloneShellReactContext.tsx} +0 -0
package/src/workbench/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { ActivityBar } from './ActivityBar';
|
|
2
|
-
export type { ActivityBarItem, ActivityBarProps } from './ActivityBar';
|
|
1
|
+
export { ActivityBar } from './shell/ActivityBar';
|
|
2
|
+
export type { ActivityBarItem, ActivityBarProps } from './shell/ActivityBar';
|
|
3
3
|
export { createStringDragMime, createTypedDragMime } from '../utils/dragMime';
|
|
4
4
|
export type { TypedDragMime, TypedDragMimeOptions } from '../utils/dragMime';
|
|
5
5
|
export {
|
|
@@ -11,13 +11,13 @@ export {
|
|
|
11
11
|
readEditorTabDragPayload,
|
|
12
12
|
resolveEditorTabDropTarget,
|
|
13
13
|
resolveEditorTabStripDropTarget,
|
|
14
|
-
} from './editor-tabs-dnd';
|
|
15
|
-
export type { EditorTabDragPayload, EditorTabDropTarget } from './editor-tabs-dnd';
|
|
16
|
-
export { useEditorTabsStripDnd } from './useEditorTabsStripDnd';
|
|
14
|
+
} from './editor/editor-tabs-dnd';
|
|
15
|
+
export type { EditorTabDragPayload, EditorTabDropTarget } from './editor/editor-tabs-dnd';
|
|
16
|
+
export { useEditorTabsStripDnd } from './editor/useEditorTabsStripDnd';
|
|
17
17
|
export type {
|
|
18
18
|
UseEditorTabsStripDndOptions,
|
|
19
19
|
UseEditorTabsStripDndResult,
|
|
20
|
-
} from './useEditorTabsStripDnd';
|
|
20
|
+
} from './editor/useEditorTabsStripDnd';
|
|
21
21
|
export {
|
|
22
22
|
WorkbenchArtifactModeControls,
|
|
23
23
|
WorkbenchArtifactPreview,
|
|
@@ -28,7 +28,7 @@ export {
|
|
|
28
28
|
getWorkbenchPreviewRenderer,
|
|
29
29
|
getWorkbenchPreviewRendererMatch,
|
|
30
30
|
selectWorkbenchPreviewRenderer,
|
|
31
|
-
} from './ArtifactShell';
|
|
31
|
+
} from './shell/ArtifactShell';
|
|
32
32
|
export type {
|
|
33
33
|
WorkbenchArtifactDescriptor,
|
|
34
34
|
WorkbenchArtifactMode,
|
|
@@ -41,7 +41,7 @@ export type {
|
|
|
41
41
|
WorkbenchPreviewRendererContext,
|
|
42
42
|
WorkbenchPreviewRendererMatch,
|
|
43
43
|
WorkbenchPreviewRendererMatchReason,
|
|
44
|
-
} from './ArtifactShell';
|
|
44
|
+
} from './shell/ArtifactShell';
|
|
45
45
|
export {
|
|
46
46
|
WorkbenchCommandGroupShell,
|
|
47
47
|
WorkbenchCommandList,
|
|
@@ -58,9 +58,14 @@ export {
|
|
|
58
58
|
isWorkbenchCommandExecutionPolicy,
|
|
59
59
|
isWorkbenchCommandRunnable,
|
|
60
60
|
resolveWorkbenchCommandExecutionPolicy,
|
|
61
|
-
} from './CommandPalette';
|
|
62
|
-
export { WorkbenchMarkdownPreview } from './MarkdownPreview';
|
|
63
|
-
export type { WorkbenchMarkdownPreviewProps } from './MarkdownPreview';
|
|
61
|
+
} from './commands/CommandPalette';
|
|
62
|
+
export { WorkbenchMarkdownPreview } from './markdown/MarkdownPreview';
|
|
63
|
+
export type { WorkbenchMarkdownPreviewProps } from './markdown/MarkdownPreview';
|
|
64
|
+
export { sanitizeMarkdownHref } from './markdown/sanitizeMarkdownHref';
|
|
65
|
+
export {
|
|
66
|
+
workbenchMarkdownRemarkPlugins,
|
|
67
|
+
workbenchMarkdownRehypePlugins,
|
|
68
|
+
} from './markdown/markdownRemarkPlugins';
|
|
64
69
|
export {
|
|
65
70
|
ChatCommandProposalCard,
|
|
66
71
|
ChatConversationBar,
|
|
@@ -81,6 +86,7 @@ export type {
|
|
|
81
86
|
ChatHistoryMenuProps,
|
|
82
87
|
ChatPanelProps,
|
|
83
88
|
ChatPhasedRunProgressAction,
|
|
89
|
+
ChatPhasedRunProgressLabels,
|
|
84
90
|
ChatPhasedRunProgressProps,
|
|
85
91
|
ChatRenameDialogProps,
|
|
86
92
|
ChatRunPhase,
|
|
@@ -101,17 +107,17 @@ export {
|
|
|
101
107
|
isWorkbenchSaveShortcutEvent,
|
|
102
108
|
useWorkbenchNativeContextMenuGuard,
|
|
103
109
|
useWorkbenchNativeSaveGuard,
|
|
104
|
-
} from './keyboard';
|
|
105
|
-
export { resolveWorkbenchTheme, useResolvedWorkbenchTheme } from './theme';
|
|
106
|
-
export type { ResolvedWorkbenchTheme } from './theme';
|
|
107
|
-
export { useDeferredWorkbenchMount } from './useDeferredWorkbenchMount';
|
|
108
|
-
export type { UseDeferredWorkbenchMountOptions } from './useDeferredWorkbenchMount';
|
|
110
|
+
} from './commands/keyboard';
|
|
111
|
+
export { resolveWorkbenchTheme, useResolvedWorkbenchTheme } from './theme/theme';
|
|
112
|
+
export type { ResolvedWorkbenchTheme } from './theme/theme';
|
|
113
|
+
export { useDeferredWorkbenchMount } from './shell/useDeferredWorkbenchMount';
|
|
114
|
+
export type { UseDeferredWorkbenchMountOptions } from './shell/useDeferredWorkbenchMount';
|
|
109
115
|
export {
|
|
110
116
|
DEFAULT_WORKBENCH_HARD_RESET_CONFIRM_MESSAGE,
|
|
111
117
|
DEFAULT_WORKBENCH_STORAGE_PREFIX,
|
|
112
118
|
performWorkbenchHardReset,
|
|
113
|
-
} from './hardReset';
|
|
114
|
-
export type { WorkbenchHardResetOptions } from './hardReset';
|
|
119
|
+
} from './shell/hardReset';
|
|
120
|
+
export type { WorkbenchHardResetOptions } from './shell/hardReset';
|
|
115
121
|
export {
|
|
116
122
|
applyWorkbenchAppearance,
|
|
117
123
|
applyWorkbenchThemeAttributes,
|
|
@@ -127,11 +133,11 @@ export {
|
|
|
127
133
|
resolveActiveThemePreset,
|
|
128
134
|
resolveWorkbenchThemeProviderAttributes,
|
|
129
135
|
WORKBENCH_COLOR_SCHEME_OPTIONS,
|
|
130
|
-
} from './themePresets';
|
|
136
|
+
} from './theme/themePresets';
|
|
131
137
|
export {
|
|
132
138
|
WORKBENCH_APPEARANCE_FIELD_DESCRIPTIONS,
|
|
133
139
|
WORKBENCH_APPEARANCE_FIELD_LABELS,
|
|
134
|
-
} from './appearanceLabels';
|
|
140
|
+
} from './shell/appearanceLabels';
|
|
135
141
|
export type {
|
|
136
142
|
DarkThemePresetId,
|
|
137
143
|
LightThemePresetId,
|
|
@@ -144,34 +150,40 @@ export type {
|
|
|
144
150
|
WorkbenchThemePresetOption,
|
|
145
151
|
WorkbenchThemePresetManifestEntry,
|
|
146
152
|
WorkbenchThemePresetSelection,
|
|
147
|
-
} from './themePresets';
|
|
153
|
+
} from './theme/themePresets';
|
|
148
154
|
export {
|
|
149
155
|
applyWorkbenchShellAttributes,
|
|
150
156
|
DEFAULT_SHELL_PRESET,
|
|
151
157
|
isShellPresetId,
|
|
152
158
|
SHELL_PRESET_MANIFEST,
|
|
153
159
|
SHELL_PRESET_OPTIONS,
|
|
154
|
-
} from './shellPresets';
|
|
160
|
+
} from './shell/shellPresets';
|
|
155
161
|
export type {
|
|
156
162
|
ShellPresetId,
|
|
157
163
|
WorkbenchShellPresetManifestEntry,
|
|
158
164
|
WorkbenchShellPresetOption,
|
|
159
|
-
} from './shellPresets';
|
|
160
|
-
export { WorkbenchThemeProvider } from './WorkbenchThemeProvider';
|
|
161
|
-
export type { WorkbenchThemeProviderProps } from './WorkbenchThemeProvider';
|
|
162
|
-
export { useWorkbenchAppearanceDocumentSync } from './useWorkbenchAppearanceDocumentSync';
|
|
163
|
-
export {
|
|
164
|
-
|
|
165
|
+
} from './shell/shellPresets';
|
|
166
|
+
export { WorkbenchThemeProvider } from './theme/WorkbenchThemeProvider';
|
|
167
|
+
export type { WorkbenchThemeProviderProps } from './theme/WorkbenchThemeProvider';
|
|
168
|
+
export { useWorkbenchAppearanceDocumentSync } from './shell/useWorkbenchAppearanceDocumentSync';
|
|
169
|
+
export {
|
|
170
|
+
WorkbenchPlatformProvider,
|
|
171
|
+
useWorkbenchHostPlatform,
|
|
172
|
+
} from './chrome/WorkbenchPlatformContext';
|
|
173
|
+
export type { WorkbenchPlatformProviderProps } from './chrome/WorkbenchPlatformContext';
|
|
165
174
|
export {
|
|
166
175
|
resolveWorkbenchHostPlatform,
|
|
167
176
|
resolveWorkbenchWindowChromeDataAttributes,
|
|
168
|
-
} from './workbenchPlatformChrome';
|
|
169
|
-
export type {
|
|
177
|
+
} from './chrome/workbenchPlatformChrome';
|
|
178
|
+
export type {
|
|
179
|
+
WorkbenchHostPlatform,
|
|
180
|
+
WorkbenchWindowChromeMode,
|
|
181
|
+
} from './chrome/workbenchPlatformChrome';
|
|
170
182
|
export {
|
|
171
183
|
WorkbenchWindowChromeControls,
|
|
172
184
|
shouldUseDarwinPlatformChrome,
|
|
173
|
-
} from './WorkbenchWindowChromeControls';
|
|
174
|
-
export type { WorkbenchWindowChromeControlsProps } from './WorkbenchWindowChromeControls';
|
|
185
|
+
} from './shell/WorkbenchWindowChromeControls';
|
|
186
|
+
export type { WorkbenchWindowChromeControlsProps } from './shell/WorkbenchWindowChromeControls';
|
|
175
187
|
export {
|
|
176
188
|
WorkbenchShortcutCommandBridge,
|
|
177
189
|
getWorkbenchShortcutCommandBindings,
|
|
@@ -179,7 +191,7 @@ export {
|
|
|
179
191
|
matchesWorkbenchShortcut,
|
|
180
192
|
runWorkbenchShortcutCommand,
|
|
181
193
|
useWorkbenchShortcutCommands,
|
|
182
|
-
} from './ShortcutCommandBridge';
|
|
194
|
+
} from './commands/ShortcutCommandBridge';
|
|
183
195
|
export type { SlashCommandParseResult } from './chat/slashCommand';
|
|
184
196
|
export type {
|
|
185
197
|
WorkbenchCommandDescriptor,
|
|
@@ -201,8 +213,8 @@ export type {
|
|
|
201
213
|
WorkbenchCommandSideEffect,
|
|
202
214
|
WorkbenchCommandStatus,
|
|
203
215
|
WorkbenchCommandSuggestProps,
|
|
204
|
-
} from './CommandPalette';
|
|
205
|
-
export type { ResolveWorkbenchCommandExecutionPolicyInput } from './CommandPalette';
|
|
216
|
+
} from './commands/CommandPalette';
|
|
217
|
+
export type { ResolveWorkbenchCommandExecutionPolicyInput } from './commands/CommandPalette';
|
|
206
218
|
export type {
|
|
207
219
|
UseWorkbenchShortcutCommandsOptions,
|
|
208
220
|
WorkbenchShortcutCommandBinding,
|
|
@@ -214,7 +226,7 @@ export type {
|
|
|
214
226
|
WorkbenchShortcutEventLike,
|
|
215
227
|
WorkbenchShortcutMatchInput,
|
|
216
228
|
WorkbenchShortcutPlatform,
|
|
217
|
-
} from './ShortcutCommandBridge';
|
|
229
|
+
} from './commands/ShortcutCommandBridge';
|
|
218
230
|
export {
|
|
219
231
|
WorkbenchConfirmationFlow,
|
|
220
232
|
getWorkbenchConfirmationButtonVariant,
|
|
@@ -223,7 +235,7 @@ export {
|
|
|
223
235
|
getWorkbenchConfirmationStatus,
|
|
224
236
|
getWorkbenchConfirmationVariant,
|
|
225
237
|
isWorkbenchConfirmationActionDisabled,
|
|
226
|
-
} from './ConfirmationFlow';
|
|
238
|
+
} from './commands/ConfirmationFlow';
|
|
227
239
|
export type {
|
|
228
240
|
WorkbenchConfirmationAction,
|
|
229
241
|
WorkbenchConfirmationCancelContext,
|
|
@@ -234,7 +246,7 @@ export type {
|
|
|
234
246
|
WorkbenchConfirmationReason,
|
|
235
247
|
WorkbenchConfirmationSideEffect,
|
|
236
248
|
WorkbenchConfirmationVariant,
|
|
237
|
-
} from './ConfirmationFlow';
|
|
249
|
+
} from './commands/ConfirmationFlow';
|
|
238
250
|
export {
|
|
239
251
|
WorkbenchAuthGate,
|
|
240
252
|
WorkbenchLoginBrandMark,
|
|
@@ -306,7 +318,7 @@ export {
|
|
|
306
318
|
createWorkbenchWorkspaceFolderMenuEntries,
|
|
307
319
|
createWorkbenchWorkspaceTargetMenuEntries,
|
|
308
320
|
getWorkbenchShowActivityCommandId,
|
|
309
|
-
} from './commands';
|
|
321
|
+
} from './commands/commands';
|
|
310
322
|
export type {
|
|
311
323
|
WorkbenchEditorCommandContext,
|
|
312
324
|
WorkbenchSearchResultCommandContext,
|
|
@@ -315,18 +327,18 @@ export type {
|
|
|
315
327
|
WorkbenchShellCommandPresetOptions,
|
|
316
328
|
WorkbenchCommandSurface,
|
|
317
329
|
WorkbenchWorkspaceCommandContext,
|
|
318
|
-
} from './commands';
|
|
330
|
+
} from './commands/commands';
|
|
319
331
|
export {
|
|
320
332
|
initializeWorkbenchShellState,
|
|
321
333
|
useWorkbenchShellState,
|
|
322
334
|
workbenchShellStateReducer,
|
|
323
|
-
} from './shellState';
|
|
335
|
+
} from './shell/shellState';
|
|
324
336
|
export type {
|
|
325
337
|
UseWorkbenchShellStateResult,
|
|
326
338
|
WorkbenchShellAction,
|
|
327
339
|
WorkbenchShellInitialState,
|
|
328
340
|
WorkbenchShellState,
|
|
329
|
-
} from './shellState';
|
|
341
|
+
} from './shell/shellState';
|
|
330
342
|
export {
|
|
331
343
|
getWorkbenchStatusDescriptor,
|
|
332
344
|
getWorkbenchStatusLabel,
|
|
@@ -336,11 +348,15 @@ export {
|
|
|
336
348
|
isWorkbenchStatusDisabled,
|
|
337
349
|
isWorkbenchStatusUnavailable,
|
|
338
350
|
workbenchStatusFromLifecycleStatus,
|
|
339
|
-
} from './status';
|
|
340
|
-
export type {
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
351
|
+
} from './shell/status';
|
|
352
|
+
export type {
|
|
353
|
+
WorkbenchStatus,
|
|
354
|
+
WorkbenchStatusDescriptor,
|
|
355
|
+
WorkbenchStatusVariant,
|
|
356
|
+
} from './shell/status';
|
|
357
|
+
export { SplitView } from './shell/SplitView';
|
|
358
|
+
export type { SplitViewLayoutMode, SplitViewProps } from './shell/SplitView';
|
|
359
|
+
export { StatusBar, StatusBarItem, StatusBarSection } from './shell/StatusBar';
|
|
344
360
|
export type {
|
|
345
361
|
StatusBarItemModel,
|
|
346
362
|
StatusBarItemProps,
|
|
@@ -348,7 +364,7 @@ export type {
|
|
|
348
364
|
StatusBarSectionAlign,
|
|
349
365
|
StatusBarSectionModel,
|
|
350
366
|
StatusBarSectionProps,
|
|
351
|
-
} from './StatusBar';
|
|
367
|
+
} from './shell/StatusBar';
|
|
352
368
|
export {
|
|
353
369
|
WorkbenchTimeline,
|
|
354
370
|
WorkbenchTimelineItem,
|
|
@@ -357,7 +373,7 @@ export {
|
|
|
357
373
|
getWorkbenchTimelineEventLabel,
|
|
358
374
|
getWorkbenchTimelineEventStatus,
|
|
359
375
|
getWorkbenchTimelineMetadataEntries,
|
|
360
|
-
} from './Timeline';
|
|
376
|
+
} from './shell/Timeline';
|
|
361
377
|
export type {
|
|
362
378
|
WorkbenchTimelineEvent,
|
|
363
379
|
WorkbenchTimelineEventKind,
|
|
@@ -369,7 +385,7 @@ export type {
|
|
|
369
385
|
WorkbenchTimelineRenderMetadata,
|
|
370
386
|
WorkbenchTimelineRenderPayload,
|
|
371
387
|
WorkbenchTimelineVariant,
|
|
372
|
-
} from './Timeline';
|
|
388
|
+
} from './shell/Timeline';
|
|
373
389
|
export {
|
|
374
390
|
WorkbenchPanelRegion,
|
|
375
391
|
WorkbenchNavigationPanel,
|
|
@@ -552,44 +568,47 @@ export {
|
|
|
552
568
|
stringifyWorkbenchStructuredDataSchemaFieldValue,
|
|
553
569
|
validateWorkbenchStructuredDataSchemaFieldValue,
|
|
554
570
|
} from './settings';
|
|
555
|
-
export { WorkbenchShell } from './WorkbenchShell';
|
|
556
|
-
export type { WorkbenchShellProps } from './WorkbenchShell';
|
|
557
|
-
export { WorkbenchViewEditor } from './WorkbenchViewEditor';
|
|
571
|
+
export { WorkbenchShell } from './shell/WorkbenchShell';
|
|
572
|
+
export type { WorkbenchShellProps } from './shell/WorkbenchShell';
|
|
573
|
+
export { WorkbenchViewEditor } from './shell/WorkbenchViewEditor';
|
|
558
574
|
export type {
|
|
559
575
|
WorkbenchViewEditorDataAttributes,
|
|
560
576
|
WorkbenchViewEditorEmptyState,
|
|
561
577
|
WorkbenchViewEditorEmptyStateProps,
|
|
562
578
|
WorkbenchViewEditorEmptyStateSurfaceProps,
|
|
563
579
|
WorkbenchViewEditorProps,
|
|
564
|
-
} from './WorkbenchViewEditor';
|
|
565
|
-
export { WorkbenchEditorTabs } from './WorkbenchEditorTabs';
|
|
566
|
-
export type { WorkbenchEditorTabsProps } from './WorkbenchEditorTabs';
|
|
580
|
+
} from './shell/WorkbenchViewEditor';
|
|
581
|
+
export { WorkbenchEditorTabs } from './editor/WorkbenchEditorTabs';
|
|
582
|
+
export type { WorkbenchEditorTabsProps } from './editor/WorkbenchEditorTabs';
|
|
567
583
|
export {
|
|
568
584
|
createWorkbenchStandaloneEditorTabCommandContext,
|
|
569
585
|
createWorkbenchStandaloneEditorTabContextMenuItems,
|
|
570
586
|
isWorkbenchEditorTabClosable,
|
|
571
|
-
} from './editorTabContextMenu';
|
|
587
|
+
} from './editor/editorTabContextMenu';
|
|
572
588
|
export type {
|
|
573
589
|
CreateWorkbenchStandaloneEditorTabCommandContextInput,
|
|
574
590
|
WorkbenchStandaloneEditorTabLike,
|
|
575
|
-
} from './editorTabContextMenu';
|
|
576
|
-
export { useWorkbenchEditorTabContextMenu } from './useWorkbenchEditorTabContextMenu';
|
|
591
|
+
} from './editor/editorTabContextMenu';
|
|
592
|
+
export { useWorkbenchEditorTabContextMenu } from './editor/useWorkbenchEditorTabContextMenu';
|
|
577
593
|
export type {
|
|
578
594
|
UseWorkbenchEditorTabContextMenuOptions,
|
|
579
595
|
UseWorkbenchEditorTabContextMenuResult,
|
|
580
|
-
} from './useWorkbenchEditorTabContextMenu';
|
|
581
|
-
export { WorkbenchViewSidebar } from './WorkbenchViewSidebar';
|
|
582
|
-
export type {
|
|
596
|
+
} from './editor/useWorkbenchEditorTabContextMenu';
|
|
597
|
+
export { WorkbenchViewSidebar } from './shell/WorkbenchViewSidebar';
|
|
598
|
+
export type {
|
|
599
|
+
WorkbenchViewSidebarItem,
|
|
600
|
+
WorkbenchViewSidebarProps,
|
|
601
|
+
} from './shell/WorkbenchViewSidebar';
|
|
583
602
|
export {
|
|
584
603
|
WorkbenchDesktopTitleBar,
|
|
585
604
|
WorkbenchDesktopWindowControls,
|
|
586
|
-
} from './WorkbenchDesktopTitleBar';
|
|
605
|
+
} from './shell/WorkbenchDesktopTitleBar';
|
|
587
606
|
export type {
|
|
588
607
|
WorkbenchDesktopTitleBarProps,
|
|
589
608
|
WorkbenchDesktopWindowControlsProps,
|
|
590
|
-
} from './WorkbenchDesktopTitleBar';
|
|
591
|
-
export { WorkbenchStandaloneShell } from './WorkbenchStandaloneShell';
|
|
592
|
-
export { WorkbenchCanvasShell } from './WorkbenchCanvasShell';
|
|
609
|
+
} from './shell/WorkbenchDesktopTitleBar';
|
|
610
|
+
export { WorkbenchStandaloneShell } from './shell/WorkbenchStandaloneShell';
|
|
611
|
+
export { WorkbenchCanvasShell } from './shell/WorkbenchCanvasShell';
|
|
593
612
|
export type {
|
|
594
613
|
WorkbenchActivityLifecycleCallbackMap,
|
|
595
614
|
WorkbenchActivityLifecycleCallbacks,
|
|
@@ -599,18 +618,18 @@ export type {
|
|
|
599
618
|
WorkbenchPrimarySidebarLifecycleReason,
|
|
600
619
|
WorkbenchStandaloneShellContext,
|
|
601
620
|
WorkbenchStandaloneShellProps,
|
|
602
|
-
} from './WorkbenchStandaloneShell';
|
|
621
|
+
} from './shell/WorkbenchStandaloneShell';
|
|
603
622
|
export {
|
|
604
623
|
createWorkbenchStandaloneShellStateSnapshot,
|
|
605
624
|
useWorkbenchStandaloneShellContext,
|
|
606
|
-
} from './workbenchStandaloneShellReactContext';
|
|
625
|
+
} from './shell/workbenchStandaloneShellReactContext';
|
|
607
626
|
export type {
|
|
608
627
|
WorkbenchStandaloneShellStateChange,
|
|
609
628
|
WorkbenchStandaloneShellStateChangeKind,
|
|
610
629
|
WorkbenchStandaloneShellStateSnapshot,
|
|
611
|
-
} from './workbenchStandaloneShellReactContext';
|
|
612
|
-
export { useWorkbenchStandaloneShellStateSync } from './useWorkbenchStandaloneShellStateSync';
|
|
613
|
-
export type { WorkbenchCanvasShellProps } from './WorkbenchCanvasShell';
|
|
630
|
+
} from './shell/workbenchStandaloneShellReactContext';
|
|
631
|
+
export { useWorkbenchStandaloneShellStateSync } from './shell/useWorkbenchStandaloneShellStateSync';
|
|
632
|
+
export type { WorkbenchCanvasShellProps } from './shell/WorkbenchCanvasShell';
|
|
614
633
|
export type {
|
|
615
634
|
WorkbenchActivityChangeEvent,
|
|
616
635
|
WorkbenchActivityDescriptor,
|
|
@@ -625,9 +644,9 @@ export type {
|
|
|
625
644
|
WorkbenchStatusController,
|
|
626
645
|
WorkbenchTheme,
|
|
627
646
|
WorkbenchWorkspaceController,
|
|
628
|
-
} from './standalone';
|
|
629
|
-
export { StructuredArtifactEditor } from './StructuredArtifactEditor';
|
|
630
|
-
export type { StructuredArtifactEditorProps } from './StructuredArtifactEditor';
|
|
647
|
+
} from './shell/standalone';
|
|
648
|
+
export { StructuredArtifactEditor } from './shell/StructuredArtifactEditor';
|
|
649
|
+
export type { StructuredArtifactEditorProps } from './shell/StructuredArtifactEditor';
|
|
631
650
|
export type {
|
|
632
651
|
WorkbenchDocument,
|
|
633
652
|
WorkbenchDocumentAdapter,
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
extensionCategoryIconTone,
|
|
8
8
|
formatExtensionCategoryLabel,
|
|
9
9
|
} from './extension-category-display.js';
|
|
10
|
+
import { resolveExtensionInstallOptions } from './extension-install-approval.js';
|
|
10
11
|
import { ManagementFilterChips } from './ManagementFilterChips.js';
|
|
11
12
|
import { ManagementCard, ManagementCardList } from './ManagementCard.js';
|
|
12
13
|
import { ManagementGroup, ManagementGroups } from './ManagementGroup.js';
|
|
@@ -40,7 +41,9 @@ export function ExtensionManagementPanel({
|
|
|
40
41
|
catalogLoading = false,
|
|
41
42
|
className,
|
|
42
43
|
installedEntries,
|
|
44
|
+
isInstallTrusted,
|
|
43
45
|
onInstall,
|
|
46
|
+
onRememberInstallTrust,
|
|
44
47
|
onToggleEnabled,
|
|
45
48
|
}: ExtensionManagementPanelProps) {
|
|
46
49
|
const [activeTab, setActiveTab] = useState<'installed' | 'browse'>(
|
|
@@ -103,12 +106,14 @@ export function ExtensionManagementPanel({
|
|
|
103
106
|
emptyLabel="No catalog extensions match the current filter."
|
|
104
107
|
entries={filteredBrowse}
|
|
105
108
|
groups={browseGroups}
|
|
109
|
+
isInstallTrusted={isInstallTrusted}
|
|
106
110
|
query={browseQuery}
|
|
107
111
|
showGroups={showBrowseGroups}
|
|
108
112
|
summary={`${filteredBrowse.length} of ${browseEntries.length} in catalog`}
|
|
109
113
|
onCategoryChange={setCategoryFilter}
|
|
110
114
|
onInstall={onInstall}
|
|
111
115
|
onQueryChange={setBrowseQuery}
|
|
116
|
+
onRememberInstallTrust={onRememberInstallTrust}
|
|
112
117
|
/>
|
|
113
118
|
),
|
|
114
119
|
},
|
|
@@ -273,9 +278,11 @@ function BrowseExtensionsTab({
|
|
|
273
278
|
emptyLabel,
|
|
274
279
|
entries,
|
|
275
280
|
groups,
|
|
281
|
+
isInstallTrusted,
|
|
276
282
|
onCategoryChange,
|
|
277
283
|
onInstall,
|
|
278
284
|
onQueryChange,
|
|
285
|
+
onRememberInstallTrust,
|
|
279
286
|
query,
|
|
280
287
|
showGroups,
|
|
281
288
|
summary,
|
|
@@ -286,9 +293,11 @@ function BrowseExtensionsTab({
|
|
|
286
293
|
emptyLabel: string;
|
|
287
294
|
entries: readonly ExtensionCatalogBrowseEntry[];
|
|
288
295
|
groups: ReadonlyArray<{ category: string; entries: readonly ExtensionCatalogBrowseEntry[] }>;
|
|
296
|
+
isInstallTrusted?: ExtensionManagementPanelProps['isInstallTrusted'];
|
|
289
297
|
onCategoryChange: (category: BrowseCategoryFilter) => void;
|
|
290
298
|
onInstall?: ExtensionManagementPanelProps['onInstall'];
|
|
291
299
|
onQueryChange: (query: string) => void;
|
|
300
|
+
onRememberInstallTrust?: ExtensionManagementPanelProps['onRememberInstallTrust'];
|
|
292
301
|
query: string;
|
|
293
302
|
showGroups: boolean;
|
|
294
303
|
summary: string;
|
|
@@ -335,7 +344,9 @@ function BrowseExtensionsTab({
|
|
|
335
344
|
<li key={entry.id}>
|
|
336
345
|
<ExtensionCatalogCard
|
|
337
346
|
entry={entry}
|
|
347
|
+
isInstallTrusted={isInstallTrusted}
|
|
338
348
|
onInstall={onInstall}
|
|
349
|
+
onRememberInstallTrust={onRememberInstallTrust}
|
|
339
350
|
showCategory={false}
|
|
340
351
|
/>
|
|
341
352
|
</li>
|
|
@@ -349,7 +360,13 @@ function BrowseExtensionsTab({
|
|
|
349
360
|
<ManagementCardList>
|
|
350
361
|
{flatEntries.map((entry) => (
|
|
351
362
|
<li key={entry.id}>
|
|
352
|
-
<ExtensionCatalogCard
|
|
363
|
+
<ExtensionCatalogCard
|
|
364
|
+
entry={entry}
|
|
365
|
+
isInstallTrusted={isInstallTrusted}
|
|
366
|
+
onInstall={onInstall}
|
|
367
|
+
onRememberInstallTrust={onRememberInstallTrust}
|
|
368
|
+
showCategory
|
|
369
|
+
/>
|
|
353
370
|
</li>
|
|
354
371
|
))}
|
|
355
372
|
</ManagementCardList>
|
|
@@ -360,11 +377,15 @@ function BrowseExtensionsTab({
|
|
|
360
377
|
|
|
361
378
|
function ExtensionCatalogCard({
|
|
362
379
|
entry,
|
|
380
|
+
isInstallTrusted,
|
|
363
381
|
onInstall,
|
|
382
|
+
onRememberInstallTrust,
|
|
364
383
|
showCategory,
|
|
365
384
|
}: {
|
|
366
385
|
entry: ExtensionCatalogBrowseEntry;
|
|
386
|
+
isInstallTrusted?: ExtensionManagementPanelProps['isInstallTrusted'];
|
|
367
387
|
onInstall?: ExtensionManagementPanelProps['onInstall'];
|
|
388
|
+
onRememberInstallTrust?: ExtensionManagementPanelProps['onRememberInstallTrust'];
|
|
368
389
|
showCategory: boolean;
|
|
369
390
|
}) {
|
|
370
391
|
return (
|
|
@@ -378,7 +399,15 @@ function ExtensionCatalogCard({
|
|
|
378
399
|
}
|
|
379
400
|
type="button"
|
|
380
401
|
variant={entry.installed ? 'default' : 'primary'}
|
|
381
|
-
onClick={() =>
|
|
402
|
+
onClick={() => {
|
|
403
|
+
if (!onInstall) return;
|
|
404
|
+
const options = resolveExtensionInstallOptions(entry, {
|
|
405
|
+
isTrusted: isInstallTrusted,
|
|
406
|
+
rememberTrust: onRememberInstallTrust,
|
|
407
|
+
});
|
|
408
|
+
if (!options) return;
|
|
409
|
+
onInstall(entry, options);
|
|
410
|
+
}}
|
|
382
411
|
>
|
|
383
412
|
{entry.installed ? 'Installed' : entry.installPlan?.blocked ? 'Blocked' : 'Install'}
|
|
384
413
|
</Button>
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
extensionCategoryIconTone,
|
|
18
18
|
formatExtensionCategoryLabel,
|
|
19
19
|
} from './extension-category-display.js';
|
|
20
|
+
import { resolveExtensionInstallOptions } from './extension-install-approval.js';
|
|
20
21
|
import { ManagementFilterChips } from './ManagementFilterChips.js';
|
|
21
22
|
import type {
|
|
22
23
|
ExtensionCatalogBrowseEntry,
|
|
@@ -57,8 +58,10 @@ export function ExtensionManagementSidebar({
|
|
|
57
58
|
emptyInstalledLabel = 'No installed extensions match the filter.',
|
|
58
59
|
emptyMarketplaceLabel = 'No marketplace extensions match the filter.',
|
|
59
60
|
installedEntries,
|
|
61
|
+
isInstallTrusted,
|
|
60
62
|
missingExtensionIds = [],
|
|
61
63
|
onInstall,
|
|
64
|
+
onRememberInstallTrust,
|
|
62
65
|
onToggleEnabled,
|
|
63
66
|
pendingAction,
|
|
64
67
|
}: ExtensionManagementSidebarProps) {
|
|
@@ -153,8 +156,10 @@ export function ExtensionManagementSidebar({
|
|
|
153
156
|
catalogLoading={catalogLoading}
|
|
154
157
|
emptyLabel={emptyMarketplaceLabel}
|
|
155
158
|
entries={filteredBrowse}
|
|
159
|
+
isInstallTrusted={isInstallTrusted}
|
|
156
160
|
pendingAction={pendingAction}
|
|
157
161
|
onInstall={onInstall}
|
|
162
|
+
onRememberInstallTrust={onRememberInstallTrust}
|
|
158
163
|
/>
|
|
159
164
|
) : (
|
|
160
165
|
<InstalledExtensionList
|
|
@@ -257,14 +262,18 @@ function MarketplaceExtensionList({
|
|
|
257
262
|
catalogLoading,
|
|
258
263
|
emptyLabel,
|
|
259
264
|
entries,
|
|
265
|
+
isInstallTrusted,
|
|
260
266
|
onInstall,
|
|
267
|
+
onRememberInstallTrust,
|
|
261
268
|
pendingAction,
|
|
262
269
|
}: {
|
|
263
270
|
catalogError?: string | undefined;
|
|
264
271
|
catalogLoading?: boolean | undefined;
|
|
265
272
|
emptyLabel: string;
|
|
266
273
|
entries: readonly ExtensionCatalogBrowseEntry[];
|
|
274
|
+
isInstallTrusted?: ExtensionManagementPanelProps['isInstallTrusted'];
|
|
267
275
|
onInstall?: ExtensionManagementPanelProps['onInstall'];
|
|
276
|
+
onRememberInstallTrust?: ExtensionManagementPanelProps['onRememberInstallTrust'];
|
|
268
277
|
pendingAction?: ExtensionManagementPendingAction | undefined;
|
|
269
278
|
}) {
|
|
270
279
|
if (catalogLoading) {
|
|
@@ -318,7 +327,15 @@ function MarketplaceExtensionList({
|
|
|
318
327
|
}
|
|
319
328
|
type="button"
|
|
320
329
|
variant={entry.installed ? 'default' : 'primary'}
|
|
321
|
-
onClick={() =>
|
|
330
|
+
onClick={() => {
|
|
331
|
+
if (!onInstall) return;
|
|
332
|
+
const options = resolveExtensionInstallOptions(entry, {
|
|
333
|
+
isTrusted: isInstallTrusted,
|
|
334
|
+
rememberTrust: onRememberInstallTrust,
|
|
335
|
+
});
|
|
336
|
+
if (!options) return;
|
|
337
|
+
onInstall(entry, options);
|
|
338
|
+
}}
|
|
322
339
|
>
|
|
323
340
|
{entry.installed
|
|
324
341
|
? 'Installed'
|
|
@@ -2,7 +2,7 @@ import type { ReactNode } from 'react';
|
|
|
2
2
|
import { PanelHeader } from '../../layout/panel';
|
|
3
3
|
import { WorkbenchEditorFrame, WorkbenchPanelScroll } from '../../layout/WorkbenchLayoutBase';
|
|
4
4
|
import { WorkbenchPropertyHint } from '../../layout/WorkbenchPropertyPanel';
|
|
5
|
-
import { SplitView } from '../SplitView';
|
|
5
|
+
import { SplitView } from '../shell/SplitView';
|
|
6
6
|
|
|
7
7
|
export interface IntegrationsShellProps {
|
|
8
8
|
children: ReactNode;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { FormEventHandler, ReactNode } from 'react';
|
|
2
2
|
import { Modal, type ModalBodyLayout, type ModalBodyPadding } from '../../modal/Modal';
|
|
3
|
-
import type { WorkbenchWindowChromeMode } from '../workbenchPlatformChrome';
|
|
4
|
-
import { WorkbenchModalPortal } from '../WorkbenchModalPortal';
|
|
3
|
+
import type { WorkbenchWindowChromeMode } from '../chrome/workbenchPlatformChrome';
|
|
4
|
+
import { WorkbenchModalPortal } from '../chrome/WorkbenchModalPortal';
|
|
5
5
|
|
|
6
6
|
export type WorkbenchDialogBodyLayout = 'column-fill' | 'default' | 'padded-fill';
|
|
7
7
|
export type WorkbenchDialogFrameSize =
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { ExtensionCatalogBrowseEntry, ExtensionInstallOptions } from './types.js';
|
|
2
|
+
|
|
3
|
+
export function extensionInstallRequiresApproval(entry: ExtensionCatalogBrowseEntry): boolean {
|
|
4
|
+
return Boolean(
|
|
5
|
+
entry.installPlan?.requiresApproval && !entry.installed && !entry.installPlan.blocked,
|
|
6
|
+
);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function formatExtensionInstallApprovalMessage(entry: ExtensionCatalogBrowseEntry): string {
|
|
10
|
+
const permissions = entry.installPlan?.permissions ?? [];
|
|
11
|
+
const permissionLine =
|
|
12
|
+
permissions.length > 0
|
|
13
|
+
? `Requested permissions: ${permissions.join(', ')}.`
|
|
14
|
+
: 'This package requests privileges that require approval.';
|
|
15
|
+
|
|
16
|
+
return [
|
|
17
|
+
`Install "${entry.displayName}"?`,
|
|
18
|
+
'',
|
|
19
|
+
permissionLine,
|
|
20
|
+
'Continue only if you trust this package.',
|
|
21
|
+
].join('\n');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface ResolveExtensionInstallOptionsInput {
|
|
25
|
+
readonly confirm?: ((message: string) => boolean) | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* When true (or when the predicate returns true), skip the confirm prompt and
|
|
28
|
+
* return `{ approved: true }`. Hosts typically back this with a durable trust
|
|
29
|
+
* store keyed by extension id + permission fingerprint.
|
|
30
|
+
*/
|
|
31
|
+
readonly isTrusted?: boolean | ((entry: ExtensionCatalogBrowseEntry) => boolean) | undefined;
|
|
32
|
+
/** Called after the user explicitly confirms trust for this install. */
|
|
33
|
+
readonly rememberTrust?: ((entry: ExtensionCatalogBrowseEntry) => void) | undefined;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Resolve install options for UI actions.
|
|
38
|
+
*
|
|
39
|
+
* Approval is required when the install plan requests permissions. A trusted
|
|
40
|
+
* predicate may skip the prompt; otherwise the host confirm dialog runs and
|
|
41
|
+
* successful consent may be persisted via `rememberTrust`.
|
|
42
|
+
*/
|
|
43
|
+
export function resolveExtensionInstallOptions(
|
|
44
|
+
entry: ExtensionCatalogBrowseEntry,
|
|
45
|
+
confirmOrOptions: ((message: string) => boolean) | ResolveExtensionInstallOptionsInput = (
|
|
46
|
+
message,
|
|
47
|
+
) => (typeof globalThis.confirm === 'function' ? globalThis.confirm(message) : false),
|
|
48
|
+
): ExtensionInstallOptions | undefined {
|
|
49
|
+
if (!extensionInstallRequiresApproval(entry)) {
|
|
50
|
+
return {};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const options =
|
|
54
|
+
typeof confirmOrOptions === 'function' ? { confirm: confirmOrOptions } : confirmOrOptions;
|
|
55
|
+
const confirm =
|
|
56
|
+
options.confirm ??
|
|
57
|
+
((message: string) =>
|
|
58
|
+
typeof globalThis.confirm === 'function' ? globalThis.confirm(message) : false);
|
|
59
|
+
|
|
60
|
+
const trusted =
|
|
61
|
+
typeof options.isTrusted === 'function' ? options.isTrusted(entry) : Boolean(options.isTrusted);
|
|
62
|
+
if (trusted) {
|
|
63
|
+
return { approved: true };
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (!confirm(formatExtensionInstallApprovalMessage(entry))) {
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
options.rememberTrust?.(entry);
|
|
71
|
+
return { approved: true };
|
|
72
|
+
}
|
|
@@ -112,6 +112,12 @@ export {
|
|
|
112
112
|
extensionCategoryIconTone,
|
|
113
113
|
formatExtensionCategoryLabel,
|
|
114
114
|
} from './extension-category-display.js';
|
|
115
|
+
export {
|
|
116
|
+
extensionInstallRequiresApproval,
|
|
117
|
+
formatExtensionInstallApprovalMessage,
|
|
118
|
+
resolveExtensionInstallOptions,
|
|
119
|
+
type ResolveExtensionInstallOptionsInput,
|
|
120
|
+
} from './extension-install-approval.js';
|
|
115
121
|
export type {
|
|
116
122
|
AccountManagementEntry,
|
|
117
123
|
AccountManagementEntryStatus,
|
|
@@ -122,6 +128,7 @@ export type {
|
|
|
122
128
|
CommandManagementPanelProps,
|
|
123
129
|
CommandManagementRunState,
|
|
124
130
|
ExtensionCatalogBrowseEntry,
|
|
131
|
+
ExtensionInstallOptions,
|
|
125
132
|
ExtensionManagementDiagnosticSummary,
|
|
126
133
|
ExtensionManagementEntry,
|
|
127
134
|
ExtensionManagementFeatureItem,
|