@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.
Files changed (131) hide show
  1. package/README.md +87 -0
  2. package/package.json +20 -18
  3. package/src/index.ts +27 -27
  4. package/src/jdw/JsonCodeEditorPane.tsx +7 -6
  5. package/src/json-config/JsonConfigWorkbench.tsx +1 -1
  6. package/src/layout/sidebar/SidebarActionIconBar.tsx +3 -3
  7. package/src/layout/sidebar/WorkbenchSidebarActions.tsx +1 -1
  8. package/src/modal/Modal.tsx +55 -25
  9. package/src/modal/ModalTitlebar.tsx +8 -8
  10. package/src/modal/useModalFocusTrap.ts +142 -0
  11. package/src/modal/useModalWindowFrame.ts +2 -2
  12. package/src/primitives/absolute-box/AbsoluteBox.tsx +4 -4
  13. package/src/primitives/button/Button.tsx +4 -4
  14. package/src/primitives/catalog-browse-card/CatalogBrowseCard.tsx +6 -6
  15. package/src/primitives/catalog-browse-pane/CatalogBrowsePane.tsx +15 -15
  16. package/src/primitives/catalog-filter-overlay/CatalogFilterOverlay.tsx +2 -2
  17. package/src/primitives/checkbox/Checkbox.tsx +1 -1
  18. package/src/primitives/chip/Chip.tsx +2 -2
  19. package/src/primitives/codicon/Codicon.tsx +1 -1
  20. package/src/primitives/file-icon/FileIcon.tsx +1 -1
  21. package/src/primitives/icon-button/IconButton.tsx +1 -1
  22. package/src/primitives/library-detail-layout/LibraryDetailLayout.tsx +5 -5
  23. package/src/primitives/library-facet-filter-panel/LibraryFacetFilterPanel.tsx +12 -12
  24. package/src/primitives/library-facet-filter-strip/LibraryFacetFilterStrip.tsx +4 -4
  25. package/src/primitives/number-input/NumberInput.tsx +5 -5
  26. package/src/primitives/record-media-hero/RecordMediaHero.tsx +6 -6
  27. package/src/primitives/scroll-area/ScrollArea.tsx +5 -5
  28. package/src/primitives/scroll-area-infinite-load/useScrollAreaInfiniteLoad.ts +5 -5
  29. package/src/primitives/searchable-multi-select/SearchableMultiSelect.tsx +7 -7
  30. package/src/primitives/text-area/TextArea.tsx +1 -1
  31. package/src/primitives/text-input/TextInput.tsx +1 -1
  32. package/src/primitives/workbench-media-slot/WorkbenchMediaPlaceholder.tsx +2 -2
  33. package/src/primitives/workbench-media-slot/WorkbenchMediaSlot.tsx +9 -9
  34. package/src/primitives/workbench-thumbnail/WorkbenchThumbnail.tsx +4 -4
  35. package/src/styles.css +1 -2
  36. package/src/widget-tree/WidgetTreeWorkspaceShell.tsx +2 -2
  37. package/src/workbench/chat/ChatCommandProposalCard.tsx +4 -4
  38. package/src/workbench/chat/ChatConversationBar.tsx +3 -3
  39. package/src/workbench/chat/ChatHistoryMenu.tsx +1 -1
  40. package/src/workbench/chat/ChatMessageCollapsible.tsx +4 -0
  41. package/src/workbench/chat/ChatMessageItem.tsx +68 -10
  42. package/src/workbench/chat/ChatMessageList.tsx +1 -1
  43. package/src/workbench/chat/ChatPanel.tsx +32 -23
  44. package/src/workbench/chat/ChatPhasedRunProgress.tsx +86 -13
  45. package/src/workbench/chat/ChatRenameDialog.tsx +1 -1
  46. package/src/workbench/chat/chat-conversation.css +2 -2
  47. package/src/workbench/chat/chat-ui.css +8 -0
  48. package/src/workbench/chat/chatConversation.ts +2 -2
  49. package/src/workbench/chat/chatMessageMeta.tsx +4 -4
  50. package/src/workbench/chat/index.ts +1 -0
  51. package/src/workbench/chat/types.ts +7 -7
  52. package/src/workbench/chat/useCancelRuntimeOnUnmount.ts +4 -4
  53. package/src/workbench/chat/useChatPrependPagination.ts +10 -10
  54. package/src/workbench/chat/useSlashCommandSuggest.ts +1 -1
  55. package/src/workbench/{WorkbenchModalPortal.tsx → chrome/WorkbenchModalPortal.tsx} +1 -1
  56. package/src/workbench/chrome/workbench-chrome.css +4 -0
  57. package/src/workbench/{CommandGroupShell.tsx → commands/CommandGroupShell.tsx} +2 -2
  58. package/src/workbench/{CommandList.tsx → commands/CommandList.tsx} +5 -5
  59. package/src/workbench/{CommandPalette.tsx → commands/CommandPalette.tsx} +16 -42
  60. package/src/workbench/{ConfirmationFlow.tsx → commands/ConfirmationFlow.tsx} +5 -5
  61. package/src/workbench/{command-model.ts → commands/command-model.ts} +5 -1
  62. package/src/workbench/{commands.ts → commands/commands.ts} +1 -1
  63. package/src/workbench/{WorkbenchEditorTabs.tsx → editor/WorkbenchEditorTabs.tsx} +1 -1
  64. package/src/workbench/{editor-tabs-dnd.ts → editor/editor-tabs-dnd.ts} +1 -1
  65. package/src/workbench/{editorTabContextMenu.ts → editor/editorTabContextMenu.ts} +2 -2
  66. package/src/workbench/{useEditorTabsStripDnd.ts → editor/useEditorTabsStripDnd.ts} +1 -1
  67. package/src/workbench/{useWorkbenchEditorTabContextMenu.tsx → editor/useWorkbenchEditorTabContextMenu.tsx} +1 -1
  68. package/src/workbench/editor-tabs/index.ts +9 -9
  69. package/src/workbench/index.ts +93 -74
  70. package/src/workbench/management/ExtensionManagementPanel.tsx +31 -2
  71. package/src/workbench/management/ExtensionManagementSidebar.tsx +18 -1
  72. package/src/workbench/management/IntegrationsShell.tsx +1 -1
  73. package/src/workbench/management/WorkbenchDialogFrame.tsx +2 -2
  74. package/src/workbench/management/extension-install-approval.ts +72 -0
  75. package/src/workbench/management/index.ts +7 -0
  76. package/src/workbench/management/types.ts +14 -1
  77. package/src/workbench/{MarkdownPreview.tsx → markdown/MarkdownPreview.tsx} +22 -7
  78. package/src/workbench/markdown/markdownRemarkPlugins.ts +12 -0
  79. package/src/workbench/markdown/sanitizeMarkdownHref.ts +29 -0
  80. package/src/workbench/{ActivityBar.tsx → shell/ActivityBar.tsx} +8 -8
  81. package/src/workbench/{ArtifactShell.tsx → shell/ArtifactShell.tsx} +25 -25
  82. package/src/workbench/{SplitView.tsx → shell/SplitView.tsx} +3 -3
  83. package/src/workbench/{StatusBar.tsx → shell/StatusBar.tsx} +8 -8
  84. package/src/workbench/{StructuredArtifactEditor.tsx → shell/StructuredArtifactEditor.tsx} +9 -9
  85. package/src/workbench/{Timeline.tsx → shell/Timeline.tsx} +18 -18
  86. package/src/workbench/{WorkbenchCanvasShell.defaults.ts → shell/WorkbenchCanvasShell.defaults.ts} +1 -1
  87. package/src/workbench/{WorkbenchCanvasShell.model.ts → shell/WorkbenchCanvasShell.model.ts} +5 -5
  88. package/src/workbench/{WorkbenchCanvasShell.tsx → shell/WorkbenchCanvasShell.tsx} +6 -6
  89. package/src/workbench/{WorkbenchDesktopTitleBar.tsx → shell/WorkbenchDesktopTitleBar.tsx} +15 -15
  90. package/src/workbench/{WorkbenchShell.tsx → shell/WorkbenchShell.tsx} +5 -5
  91. package/src/workbench/{WorkbenchShellTitleBarLayoutControls.tsx → shell/WorkbenchShellTitleBarLayoutControls.tsx} +12 -12
  92. package/src/workbench/{WorkbenchStandaloneShell.tsx → shell/WorkbenchStandaloneShell.tsx} +4 -4
  93. package/src/workbench/{WorkbenchViewEditor.tsx → shell/WorkbenchViewEditor.tsx} +7 -7
  94. package/src/workbench/{WorkbenchViewSidebar.tsx → shell/WorkbenchViewSidebar.tsx} +7 -7
  95. package/src/workbench/{WorkbenchWindowChromeControls.tsx → shell/WorkbenchWindowChromeControls.tsx} +18 -15
  96. package/src/workbench/{shell.ts → shell/shell.ts} +18 -12
  97. package/src/workbench/{shellViewModel.ts → shell/shellViewModel.ts} +3 -3
  98. package/src/workbench/{standalone.ts → shell/standalone.ts} +2 -2
  99. package/src/workbench/{useDeferredWorkbenchMount.ts → shell/useDeferredWorkbenchMount.ts} +3 -3
  100. package/src/workbench/{useWorkbenchAppearanceDocumentSync.tsx → shell/useWorkbenchAppearanceDocumentSync.tsx} +1 -1
  101. package/src/workbench/{useWorkbenchSidebarActionBarDnd.ts → shell/useWorkbenchSidebarActionBarDnd.ts} +1 -1
  102. package/src/workbench/{useWorkbenchSidebarViewPlacementDropZone.ts → shell/useWorkbenchSidebarViewPlacementDropZone.ts} +2 -2
  103. package/src/workbench/{workbenchViewRouteState.ts → shell/workbenchViewRouteState.ts} +4 -4
  104. package/src/workbench/{WorkbenchThemeProvider.tsx → theme/WorkbenchThemeProvider.tsx} +4 -4
  105. package/src/workbench/{theme.ts → theme/theme.ts} +1 -1
  106. package/src/workbench/{themePresets.ts → theme/themePresets.ts} +2 -2
  107. package/src/workbench/workspace/WorkspaceEditorPanel.tsx +1 -1
  108. package/src/workbench/workspace/workspaceJsonDiagnostics.ts +6 -5
  109. package/src/workbench/jdw/jdw-editors.css +0 -4
  110. package/src/workbench/jdw/jdw.css +0 -2
  111. package/src/workbench/markdownRemarkPlugins.ts +0 -4
  112. package/src/workbench/workbench-chrome.css +0 -4
  113. /package/src/workbench/{WorkbenchPlatformContext.tsx → chrome/WorkbenchPlatformContext.tsx} +0 -0
  114. /package/src/workbench/{workbenchModalViewState.ts → chrome/workbenchModalViewState.ts} +0 -0
  115. /package/src/workbench/{workbenchOverlaysContext.tsx → chrome/workbenchOverlaysContext.tsx} +0 -0
  116. /package/src/workbench/{workbenchPlatformChrome.ts → chrome/workbenchPlatformChrome.ts} +0 -0
  117. /package/src/workbench/{ShortcutCommandBridge.tsx → commands/ShortcutCommandBridge.tsx} +0 -0
  118. /package/src/workbench/{command-execution-policy.ts → commands/command-execution-policy.ts} +0 -0
  119. /package/src/workbench/{keyboard.ts → commands/keyboard.ts} +0 -0
  120. /package/src/workbench/{workbenchContextMenu.ts → commands/workbenchContextMenu.ts} +0 -0
  121. /package/src/workbench/{activityBarOrder.ts → shell/activityBarOrder.ts} +0 -0
  122. /package/src/workbench/{appearanceLabels.ts → shell/appearanceLabels.ts} +0 -0
  123. /package/src/workbench/{hardReset.ts → shell/hardReset.ts} +0 -0
  124. /package/src/workbench/{shellPresets.ts → shell/shellPresets.ts} +0 -0
  125. /package/src/workbench/{shellState.ts → shell/shellState.ts} +0 -0
  126. /package/src/workbench/{sidebarViewPlacementDnd.ts → shell/sidebarViewPlacementDnd.ts} +0 -0
  127. /package/src/workbench/{status.ts → shell/status.ts} +0 -0
  128. /package/src/workbench/{useWorkbenchSidebarLayout.tsx → shell/useWorkbenchSidebarLayout.tsx} +0 -0
  129. /package/src/workbench/{useWorkbenchStandaloneShellStateSync.tsx → shell/useWorkbenchStandaloneShellStateSync.tsx} +0 -0
  130. /package/src/workbench/{workbenchSidebarLayoutContext.ts → shell/workbenchSidebarLayoutContext.ts} +0 -0
  131. /package/src/workbench/{workbenchStandaloneShellReactContext.tsx → shell/workbenchStandaloneShellReactContext.tsx} +0 -0
@@ -115,12 +115,25 @@ export interface ExtensionCatalogBrowseEntry {
115
115
  readonly manifestUrl: string;
116
116
  }
117
117
 
118
+ export interface ExtensionInstallOptions {
119
+ /** Required when the install plan sets `requiresApproval`. */
120
+ readonly approved?: boolean | undefined;
121
+ }
122
+
118
123
  export interface ExtensionManagementPanelProps {
119
124
  browseEntries: readonly ExtensionCatalogBrowseEntry[];
120
125
  catalogError?: string | undefined;
121
126
  catalogLoading?: boolean | undefined;
122
127
  className?: string | undefined;
123
128
  installedEntries: readonly ExtensionManagementEntry[];
124
- onInstall?: ((entry: ExtensionCatalogBrowseEntry) => void) | undefined;
129
+ onInstall?:
130
+ ((entry: ExtensionCatalogBrowseEntry, options?: ExtensionInstallOptions) => void) | undefined;
125
131
  onToggleEnabled?: ((entry: ExtensionManagementEntry, enabled: boolean) => void) | undefined;
132
+ /**
133
+ * Host-owned durable trust check. When true for an entry, the install confirm
134
+ * prompt is skipped and `{ approved: true }` is used.
135
+ */
136
+ isInstallTrusted?: ((entry: ExtensionCatalogBrowseEntry) => boolean) | undefined;
137
+ /** Persist trust after the user confirms a permissioned install. */
138
+ onRememberInstallTrust?: ((entry: ExtensionCatalogBrowseEntry) => void) | undefined;
126
139
  }
@@ -1,7 +1,11 @@
1
1
  import Markdown from 'react-markdown';
2
2
  import { Children, isValidElement, type ComponentPropsWithoutRef, type ReactNode } from 'react';
3
- import { cx } from '../utils/cx';
4
- import { workbenchMarkdownRemarkPlugins } from './markdownRemarkPlugins';
3
+ import { cx } from '../../utils/cx';
4
+ import {
5
+ workbenchMarkdownRemarkPlugins,
6
+ workbenchMarkdownRehypePlugins,
7
+ } from './markdownRemarkPlugins';
8
+ import { sanitizeMarkdownHref } from './sanitizeMarkdownHref';
5
9
 
6
10
  export interface WorkbenchMarkdownPreviewProps extends ComponentPropsWithoutRef<'article'> {
7
11
  source: string;
@@ -16,12 +20,23 @@ export function WorkbenchMarkdownPreview({
16
20
  <article className={cx('ui-workbench-markdown-preview', className)} {...props}>
17
21
  <Markdown
18
22
  remarkPlugins={workbenchMarkdownRemarkPlugins}
23
+ rehypePlugins={workbenchMarkdownRehypePlugins}
19
24
  components={{
20
- a: ({ children, href }) => (
21
- <a href={href} rel="noreferrer" target={href?.startsWith('#') ? undefined : '_blank'}>
22
- {children}
23
- </a>
24
- ),
25
+ a: ({ children, href }) => {
26
+ const safeHref = sanitizeMarkdownHref(href);
27
+ if (!safeHref) {
28
+ return <span>{children}</span>;
29
+ }
30
+ return (
31
+ <a
32
+ href={safeHref}
33
+ rel="noreferrer"
34
+ target={safeHref.startsWith('#') ? undefined : '_blank'}
35
+ >
36
+ {children}
37
+ </a>
38
+ );
39
+ },
25
40
  code: ({ children, className: codeClassName }) => (
26
41
  <code className={cx('ui-workbench-markdown-preview__code', codeClassName)}>
27
42
  {children}
@@ -0,0 +1,12 @@
1
+ import remarkGfm from 'remark-gfm';
2
+ import rehypeSanitize from 'rehype-sanitize';
3
+
4
+ /** Shared remark plugins for workbench markdown surfaces (preview, chat, etc.). */
5
+ export const workbenchMarkdownRemarkPlugins = [remarkGfm];
6
+
7
+ /**
8
+ * Default rehype pipeline for untrusted markdown (chat / preview).
9
+ * Strips script/event handlers and dangerous URLs via rehype-sanitize.
10
+ * Hosts that need raw HTML must render outside these kit surfaces.
11
+ */
12
+ export const workbenchMarkdownRehypePlugins = [rehypeSanitize];
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Allowlist markdown link targets for safe preview rendering.
3
+ * Blocks javascript:/data:/vbscript: and other non-navigation schemes.
4
+ */
5
+ export function sanitizeMarkdownHref(href: string | undefined): string | undefined {
6
+ if (href == null || href.trim() === '') {
7
+ return undefined;
8
+ }
9
+
10
+ const trimmed = href.trim();
11
+ if (trimmed.startsWith('#')) {
12
+ return trimmed;
13
+ }
14
+
15
+ try {
16
+ const base =
17
+ typeof globalThis.location?.href === 'string' && globalThis.location.href.length > 0
18
+ ? globalThis.location.href
19
+ : 'https://workbench.local/';
20
+ const url = new URL(trimmed, base);
21
+ const protocol = url.protocol.toLowerCase();
22
+ if (protocol === 'http:' || protocol === 'https:' || protocol === 'mailto:') {
23
+ return trimmed;
24
+ }
25
+ return undefined;
26
+ } catch {
27
+ return undefined;
28
+ }
29
+ }
@@ -1,7 +1,7 @@
1
- import './shell/activity-bar.css';
1
+ import './activity-bar.css';
2
2
  import { type ComponentPropsWithoutRef, type ReactNode } from 'react';
3
- import { Button } from '../primitives/button';
4
- import { cx } from '../utils/cx';
3
+ import { Button } from '../../primitives/button';
4
+ import { cx } from '../../utils/cx';
5
5
  import { type ActivityBarOrientation } from './activityBarOrder';
6
6
  import {
7
7
  mergeWorkbenchSidebarViewPlacementDropZoneProps,
@@ -20,18 +20,18 @@ export interface ActivityBarItem {
20
20
  }
21
21
 
22
22
  export interface ActivityBarProps extends Omit<ComponentPropsWithoutRef<'nav'>, 'children'> {
23
- acceptSidebarViewPlacementDrop?: ((viewId: string) => boolean) | undefined;
23
+ acceptSidebarViewPlacementDrop?: (viewId: string) => boolean;
24
24
  itemDataAttributeName?: string;
25
25
  items: ActivityBarItem[];
26
26
  onItemActivate?: (item: ActivityBarItem) => void;
27
27
  onItemsReorder?: (itemIds: string[]) => void;
28
- onSidebarViewPlacementDrop?: ((viewId: string) => void) | undefined;
29
- orientation?: ActivityBarOrientation | undefined;
28
+ onSidebarViewPlacementDrop?: (viewId: string) => void;
29
+ orientation?: ActivityBarOrientation;
30
30
  reorderable?: boolean;
31
31
  secondaryItems?: ActivityBarItem[];
32
- sidebarViewPlacementDropZoneId?: string | undefined;
32
+ sidebarViewPlacementDropZoneId?: string;
33
33
  /** Enables cross-slot placement drag without reordering within the bar. */
34
- placementDraggable?: boolean | undefined;
34
+ placementDraggable?: boolean;
35
35
  }
36
36
 
37
37
  /** @deprecated Use WORKBENCH_SIDEBAR_VIEW_PLACEMENT_DRAG_DATA_TYPE */
@@ -1,8 +1,8 @@
1
1
  import { useState, type ComponentPropsWithRef, type ReactNode } from 'react';
2
- import { EmptyState } from '../primitives/empty-state';
3
- import { IconButton } from '../primitives/icon-button';
4
- import { cx } from '../utils/cx';
5
- import { WorkspacePathLabel } from './workspace/WorkspacePathLabel';
2
+ import { EmptyState } from '../../primitives/empty-state';
3
+ import { IconButton } from '../../primitives/icon-button';
4
+ import { cx } from '../../utils/cx';
5
+ import { WorkspacePathLabel } from '../workspace/WorkspacePathLabel';
6
6
  import { SplitView } from './SplitView';
7
7
 
8
8
  export type WorkbenchArtifactMode = 'code' | 'preview' | 'split';
@@ -31,8 +31,8 @@ export interface WorkbenchPreviewRendererMatch {
31
31
 
32
32
  export interface WorkbenchPreviewRendererContext {
33
33
  artifact: WorkbenchArtifactDescriptor;
34
- match?: WorkbenchPreviewRendererMatch | undefined;
35
- renderer?: WorkbenchPreviewRenderer | undefined;
34
+ match?: WorkbenchPreviewRendererMatch;
35
+ renderer?: WorkbenchPreviewRenderer;
36
36
  }
37
37
 
38
38
  export interface WorkbenchPreviewRenderer {
@@ -58,11 +58,11 @@ export type WorkbenchArtifactShellRenderPreview = (
58
58
  ) => ReactNode;
59
59
 
60
60
  export interface WorkbenchArtifactModeControlsProps extends ComponentPropsWithRef<'div'> {
61
- codeLabel?: string | undefined;
61
+ codeLabel?: string;
62
62
  mode: WorkbenchArtifactMode;
63
63
  onModeChange: (mode: WorkbenchArtifactMode) => void;
64
- previewLabel?: string | undefined;
65
- splitLabel?: string | undefined;
64
+ previewLabel?: string;
65
+ splitLabel?: string;
66
66
  }
67
67
 
68
68
  function normalizeToken(value: string | undefined) {
@@ -229,9 +229,9 @@ export function WorkbenchArtifactModeControls({
229
229
 
230
230
  export interface WorkbenchArtifactPreviewProps extends ComponentPropsWithRef<'div'> {
231
231
  artifact: WorkbenchArtifactDescriptor;
232
- renderPreview?: WorkbenchArtifactShellRenderPreview | undefined;
233
- renderers?: readonly WorkbenchPreviewRenderer[] | undefined;
234
- unsupportedLabel?: ReactNode | undefined;
232
+ renderPreview?: WorkbenchArtifactShellRenderPreview;
233
+ renderers?: readonly WorkbenchPreviewRenderer[];
234
+ unsupportedLabel?: ReactNode;
235
235
  }
236
236
 
237
237
  export function WorkbenchArtifactPreview({
@@ -270,19 +270,19 @@ export interface WorkbenchArtifactShellProps extends Omit<
270
270
  ComponentPropsWithRef<'div'>,
271
271
  'children'
272
272
  > {
273
- artifact?: WorkbenchArtifactDescriptor | undefined;
274
- codeLabel?: string | undefined;
275
- defaultMode?: WorkbenchArtifactMode | undefined;
276
- emptyLabel?: ReactNode | undefined;
277
- mode?: WorkbenchArtifactMode | undefined;
278
- onModeChange?: ((mode: WorkbenchArtifactMode) => void) | undefined;
279
- previewLabel?: string | undefined;
280
- previewRenderers?: readonly WorkbenchPreviewRenderer[] | undefined;
281
- renderCode?: WorkbenchArtifactShellRenderCode | undefined;
282
- renderPreview?: WorkbenchArtifactShellRenderPreview | undefined;
283
- showHeader?: boolean | undefined;
284
- splitLabel?: string | undefined;
285
- unsupportedPreviewLabel?: ReactNode | undefined;
273
+ artifact?: WorkbenchArtifactDescriptor;
274
+ codeLabel?: string;
275
+ defaultMode?: WorkbenchArtifactMode;
276
+ emptyLabel?: ReactNode;
277
+ mode?: WorkbenchArtifactMode;
278
+ onModeChange?: (mode: WorkbenchArtifactMode) => void;
279
+ previewLabel?: string;
280
+ previewRenderers?: readonly WorkbenchPreviewRenderer[];
281
+ renderCode?: WorkbenchArtifactShellRenderCode;
282
+ renderPreview?: WorkbenchArtifactShellRenderPreview;
283
+ showHeader?: boolean;
284
+ splitLabel?: string;
285
+ unsupportedPreviewLabel?: ReactNode;
286
286
  }
287
287
 
288
288
  export function WorkbenchArtifactShell({
@@ -1,4 +1,4 @@
1
- import './shell/split-view.css';
1
+ import './split-view.css';
2
2
  import {
3
3
  useEffect,
4
4
  useLayoutEffect,
@@ -9,7 +9,7 @@ import {
9
9
  type PointerEvent,
10
10
  type ReactNode,
11
11
  } from 'react';
12
- import { cx } from '../utils/cx';
12
+ import { cx } from '../../utils/cx';
13
13
 
14
14
  export type SplitViewOrientation = 'horizontal' | 'vertical';
15
15
  export type SplitViewPrimarySizeUnit = 'percent' | 'pixels';
@@ -42,7 +42,7 @@ export interface SplitViewProps {
42
42
  onPrimarySizePxPreviewChange?: (primarySizePx: number) => void;
43
43
  onSecondarySizePxChange?: (secondarySizePx: number) => void;
44
44
  onSecondarySizePxPreviewChange?: (secondarySizePx: number) => void;
45
- orientation?: SplitViewOrientation | undefined;
45
+ orientation?: SplitViewOrientation;
46
46
  primary: ReactNode;
47
47
  primarySizePercent?: number;
48
48
  primarySizePx?: number;
@@ -1,8 +1,8 @@
1
- import './shell/status-bar.css';
1
+ import './status-bar.css';
2
2
  import type { ComponentPropsWithRef, ReactNode } from 'react';
3
- import { Button } from '../primitives/button';
4
- import { cxCodicon } from '../utils/codicon';
5
- import { cx } from '../utils/cx';
3
+ import { Button } from '../../primitives/button';
4
+ import { cxCodicon } from '../../utils/codicon';
5
+ import { cx } from '../../utils/cx';
6
6
  import {
7
7
  getWorkbenchStatusLabel,
8
8
  isWorkbenchStatusBusy,
@@ -106,7 +106,7 @@ function sortByOrderPriority<T extends { order?: number }>(values: readonly T[])
106
106
  }
107
107
 
108
108
  export interface StatusBarSectionProps extends ComponentPropsWithRef<'div'> {
109
- align?: StatusBarSectionAlign | undefined;
109
+ align?: StatusBarSectionAlign;
110
110
  }
111
111
 
112
112
  export function StatusBarSection({ align = 'start', className, ...props }: StatusBarSectionProps) {
@@ -123,9 +123,9 @@ export function StatusBarSection({ align = 'start', className, ...props }: Statu
123
123
  }
124
124
 
125
125
  export interface StatusBarItemProps extends ComponentPropsWithRef<'button'> {
126
- active?: boolean | undefined;
127
- icon?: ReactNode | string | undefined;
128
- status?: WorkbenchStatus | undefined;
126
+ active?: boolean;
127
+ icon?: ReactNode | string;
128
+ status?: WorkbenchStatus;
129
129
  }
130
130
 
131
131
  function resolveStatusBarIcon(icon: ReactNode | string | undefined) {
@@ -1,15 +1,15 @@
1
1
  import { useState, useMemo, type ReactNode } from 'react';
2
- import { useWorkspaceDrafts } from './workspace/WorkspaceDraftsContext';
3
- import { WorkspaceEditor, type WorkspaceEditorTheme } from './workspace/WorkspaceEditor';
4
- import { WorkbenchStructuredDataSchemaPanelEmbed } from './settings/StructuredDataSchemaPanelEmbed';
5
- import { type WorkbenchStructuredDataSchemaDocument } from './settings/StructuredDataForm';
2
+ import { useWorkspaceDrafts } from '../workspace/WorkspaceDraftsContext';
3
+ import { WorkspaceEditor, type WorkspaceEditorTheme } from '../workspace/WorkspaceEditor';
4
+ import { WorkbenchStructuredDataSchemaPanelEmbed } from '../settings/StructuredDataSchemaPanelEmbed';
5
+ import { type WorkbenchStructuredDataSchemaDocument } from '../settings/StructuredDataForm';
6
6
  import { type WorkbenchArtifactMode, WorkbenchArtifactModeControls } from './ArtifactShell';
7
- import { Button } from '../primitives/button';
8
- import { Panel, PanelBody, PanelHeader } from '../layout/panel';
9
- import { Toolbar } from '../primitives/toolbar';
7
+ import { Button } from '../../primitives/button';
8
+ import { Panel, PanelBody, PanelHeader } from '../../layout/panel';
9
+ import { Toolbar } from '../../primitives/toolbar';
10
10
  import { SplitView } from './SplitView';
11
- import { type WorkspaceFile } from './workspace/types';
12
- import { fileNameOfPath } from './workspace/path';
11
+ import { type WorkspaceFile } from '../workspace/types';
12
+ import { fileNameOfPath } from '../workspace/path';
13
13
 
14
14
  export interface StructuredArtifactEditorProps {
15
15
  activePattern?: string;
@@ -1,7 +1,7 @@
1
1
  import type { ComponentPropsWithRef, ReactNode } from 'react';
2
- import { EmptyState } from '../primitives/empty-state';
3
- import { cxCodicon } from '../utils/codicon';
4
- import { cx } from '../utils/cx';
2
+ import { EmptyState } from '../../primitives/empty-state';
3
+ import { cxCodicon } from '../../utils/codicon';
4
+ import { cx } from '../../utils/cx';
5
5
  import { getWorkbenchStatusLabel, isWorkbenchStatusBusy, type WorkbenchStatus } from './status';
6
6
 
7
7
  export type WorkbenchTimelineEventKind =
@@ -11,16 +11,16 @@ export type WorkbenchTimelineMessageSource = 'assistant' | 'system' | 'user' | (
11
11
  export type WorkbenchTimelineVariant = 'compact' | 'expanded';
12
12
 
13
13
  export interface WorkbenchTimelineEvent {
14
- content?: ReactNode | undefined;
15
- description?: ReactNode | undefined;
14
+ content?: ReactNode;
15
+ description?: ReactNode;
16
16
  id: string;
17
17
  kind: WorkbenchTimelineEventKind;
18
- metadata?: Record<string, unknown> | undefined;
18
+ metadata?: Record<string, unknown>;
19
19
  payload?: unknown;
20
- source?: WorkbenchTimelineMessageSource | undefined;
21
- status?: WorkbenchStatus | undefined;
22
- timestamp?: ReactNode | undefined;
23
- title?: ReactNode | undefined;
20
+ source?: WorkbenchTimelineMessageSource;
21
+ status?: WorkbenchStatus;
22
+ timestamp?: ReactNode;
23
+ title?: ReactNode;
24
24
  }
25
25
 
26
26
  export interface WorkbenchTimelineRenderContext {
@@ -172,10 +172,10 @@ export interface WorkbenchTimelineItemProps extends Omit<
172
172
  'children'
173
173
  > {
174
174
  event: WorkbenchTimelineEvent;
175
- index?: number | undefined;
176
- renderMetadata?: WorkbenchTimelineRenderMetadata | undefined;
177
- renderPayload?: WorkbenchTimelineRenderPayload | undefined;
178
- variant?: WorkbenchTimelineVariant | undefined;
175
+ index?: number;
176
+ renderMetadata?: WorkbenchTimelineRenderMetadata;
177
+ renderPayload?: WorkbenchTimelineRenderPayload;
178
+ variant?: WorkbenchTimelineVariant;
179
179
  }
180
180
 
181
181
  export function WorkbenchTimelineItem({
@@ -245,11 +245,11 @@ export function WorkbenchTimelineItem({
245
245
  }
246
246
 
247
247
  export interface WorkbenchTimelineProps extends Omit<ComponentPropsWithRef<'div'>, 'children'> {
248
- emptyLabel?: ReactNode | undefined;
248
+ emptyLabel?: ReactNode;
249
249
  events: readonly WorkbenchTimelineEvent[];
250
- renderMetadata?: WorkbenchTimelineRenderMetadata | undefined;
251
- renderPayload?: WorkbenchTimelineRenderPayload | undefined;
252
- variant?: WorkbenchTimelineVariant | undefined;
250
+ renderMetadata?: WorkbenchTimelineRenderMetadata;
251
+ renderPayload?: WorkbenchTimelineRenderPayload;
252
+ variant?: WorkbenchTimelineVariant;
253
253
  }
254
254
 
255
255
  export function WorkbenchTimeline({
@@ -1,4 +1,4 @@
1
- import type { WorkbenchDocument } from './schema';
1
+ import type { WorkbenchDocument } from '../schema';
2
2
 
3
3
  export const DEFAULT_CANVAS_ACTIVITY_ID = 'design' as const;
4
4
  export const DEFAULT_CANVAS_THEME = 'dark' as const;
@@ -1,10 +1,10 @@
1
- import type { WorkbenchDocumentNode, WorkbenchNodeLayout } from './schema';
1
+ import type { WorkbenchDocumentNode, WorkbenchNodeLayout } from '../schema';
2
2
 
3
3
  export interface WorkbenchCanvasLayoutInput {
4
- readonly height?: string | undefined;
5
- readonly width?: string | undefined;
6
- readonly x?: string | undefined;
7
- readonly y?: string | undefined;
4
+ readonly height?: string;
5
+ readonly width?: string;
6
+ readonly x?: string;
7
+ readonly y?: string;
8
8
  }
9
9
 
10
10
  export function getWorkbenchCanvasNodeChildren(node: WorkbenchDocumentNode): readonly string[] {
@@ -1,11 +1,11 @@
1
1
  import { type CSSProperties, type ReactElement, useEffect, useMemo, useState } from 'react';
2
2
  import { createCommandRegistryFromContributions } from '@workbench-kit/platform';
3
3
  import { integratedShellWorkspaceFiles } from '@workbench-kit/adapters';
4
- import { Button } from '../primitives/button';
5
- import { TextArea } from '../primitives/text-area';
6
- import { TextInput } from '../primitives/text-input';
7
- import { SideBarViewFrame } from '../layout/sidebar';
8
- import { createWorkbenchShellCommands } from './commands';
4
+ import { Button } from '../../primitives/button';
5
+ import { TextArea } from '../../primitives/text-area';
6
+ import { TextInput } from '../../primitives/text-input';
7
+ import { SideBarViewFrame } from '../../layout/sidebar';
8
+ import { createWorkbenchShellCommands } from '../commands/commands';
9
9
  import { WorkbenchStandaloneShell } from './WorkbenchStandaloneShell';
10
10
  import type { WorkbenchActivityDescriptor, WorkbenchStandaloneBootstrap } from './standalone';
11
11
  import {
@@ -19,7 +19,7 @@ import {
19
19
  type WorkbenchDocumentPatchHistory,
20
20
  type WorkbenchDocumentPatchHistoryState,
21
21
  type WorkbenchDocumentPatchResult,
22
- } from './schema';
22
+ } from '../schema';
23
23
  import {
24
24
  DEFAULT_CANVAS_ACTIVITY_ID,
25
25
  DEFAULT_CANVAS_THEME,
@@ -1,7 +1,7 @@
1
- import './chrome/workbench-desktop-titlebar.css';
1
+ import '../chrome/workbench-desktop-titlebar.css';
2
2
  import type { ReactNode } from 'react';
3
- import { cx } from '../utils/cx';
4
- import { useWorkbenchHostPlatform } from './WorkbenchPlatformContext';
3
+ import { cx } from '../../utils/cx';
4
+ import { useWorkbenchHostPlatform } from '../chrome/WorkbenchPlatformContext';
5
5
  import {
6
6
  shouldUseDarwinPlatformChrome,
7
7
  WorkbenchWindowChromeControls,
@@ -9,19 +9,19 @@ import {
9
9
  import {
10
10
  resolveWorkbenchWindowChromeDataAttributes,
11
11
  type WorkbenchWindowChromeMode,
12
- } from './workbenchPlatformChrome';
12
+ } from '../chrome/workbenchPlatformChrome';
13
13
 
14
14
  export interface WorkbenchDesktopWindowControlsProps {
15
15
  /** Defaults to `platform` so standalone controls match `WorkbenchDesktopTitleBar`. */
16
- chrome?: WorkbenchWindowChromeMode | undefined;
17
- closeLabel?: string | undefined;
16
+ chrome?: WorkbenchWindowChromeMode;
17
+ closeLabel?: string;
18
18
  isMaximized: boolean;
19
- maximizeLabel?: string | undefined;
20
- minimizeLabel?: string | undefined;
19
+ maximizeLabel?: string;
20
+ minimizeLabel?: string;
21
21
  onClose: () => void;
22
22
  onMinimize: () => void;
23
23
  onToggleMaximized: () => void;
24
- restoreLabel?: string | undefined;
24
+ restoreLabel?: string;
25
25
  }
26
26
 
27
27
  /**
@@ -59,20 +59,20 @@ export function WorkbenchDesktopWindowControls({
59
59
 
60
60
  export interface WorkbenchDesktopTitleBarProps {
61
61
  /** Optional center area, e.g. a command-menu trigger. Omit to leave it empty. */
62
- centerSlot?: ReactNode | undefined;
62
+ centerSlot?: ReactNode;
63
63
  /**
64
64
  * `platform` (default): darwin traffic lights / win32 caption buttons via host platform context.
65
65
  * `generic`: maximize + close only (modal-like), no OS-specific placement.
66
66
  */
67
- chrome?: WorkbenchWindowChromeMode | undefined;
68
- className?: string | undefined;
69
- leading?: ReactNode | undefined;
70
- trailing?: ReactNode | undefined;
67
+ chrome?: WorkbenchWindowChromeMode;
68
+ className?: string;
69
+ leading?: ReactNode;
70
+ trailing?: ReactNode;
71
71
  /**
72
72
  * Host-supplied window actions (Electron IPC callbacks). Omit on platforms that keep a native frame.
73
73
  * Kit owns chrome markup; the host owns minimize / maximize / close side effects only.
74
74
  */
75
- windowControls?: WorkbenchDesktopWindowControlsProps | undefined;
75
+ windowControls?: WorkbenchDesktopWindowControlsProps;
76
76
  }
77
77
 
78
78
  /**
@@ -1,12 +1,12 @@
1
1
  import { type CSSProperties, type ReactNode, useState } from 'react';
2
- import './chrome/workbench-layout-regions.css';
3
- import { cx } from '../utils/cx';
2
+ import '../chrome/workbench-layout-regions.css';
3
+ import { cx } from '../../utils/cx';
4
4
  import { ActivityBar, type ActivityBarProps, type ActivityBarItem } from './ActivityBar';
5
5
  import { SplitView } from './SplitView';
6
6
  import { StatusBar, type StatusBarItemModel, type StatusBarSectionModel } from './StatusBar';
7
7
  import { DEFAULT_PRIMARY_SIDEBAR_SIZE_PX } from './shellState';
8
- import { suppressNativeBrowserContextMenu } from './workbenchContextMenu';
9
- import { WorkbenchOverlaysProvider } from './workbenchOverlaysContext';
8
+ import { suppressNativeBrowserContextMenu } from '../commands/workbenchContextMenu';
9
+ import { WorkbenchOverlaysProvider } from '../chrome/workbenchOverlaysContext';
10
10
 
11
11
  export type WorkbenchShellActivityBarPosition = 'left' | 'top';
12
12
 
@@ -15,7 +15,7 @@ export interface WorkbenchShellProps {
15
15
  items: ActivityBarItem[];
16
16
  visible?: boolean;
17
17
  };
18
- activityBarPosition?: WorkbenchShellActivityBarPosition | undefined;
18
+ activityBarPosition?: WorkbenchShellActivityBarPosition;
19
19
  auxiliarySidebar?: {
20
20
  isVisible: boolean;
21
21
  node: ReactNode;
@@ -1,21 +1,21 @@
1
- import './chrome/workbench-shell-titlebar.css';
1
+ import '../chrome/workbench-shell-titlebar.css';
2
2
  import type { JSX } from 'react';
3
3
 
4
- import { IconButton } from '../primitives/icon-button';
4
+ import { IconButton } from '../../primitives/icon-button';
5
5
 
6
6
  export interface WorkbenchShellTitleBarLayoutControlsProps {
7
- readonly isAuxiliarySidebarVisible?: boolean | undefined;
8
- readonly isPanelVisible?: boolean | undefined;
7
+ readonly isAuxiliarySidebarVisible?: boolean;
8
+ readonly isPanelVisible?: boolean;
9
9
  readonly isPrimarySidebarVisible: boolean;
10
- readonly onToggleAuxiliarySidebar?: (() => void) | undefined;
11
- readonly onTogglePanel?: (() => void) | undefined;
10
+ readonly onToggleAuxiliarySidebar?: () => void;
11
+ readonly onTogglePanel?: () => void;
12
12
  readonly onTogglePrimarySidebar: () => void;
13
- readonly panelHideLabel?: string | undefined;
14
- readonly panelShowLabel?: string | undefined;
15
- readonly primarySidebarHideLabel?: string | undefined;
16
- readonly primarySidebarShowLabel?: string | undefined;
17
- readonly secondarySidebarHideLabel?: string | undefined;
18
- readonly secondarySidebarShowLabel?: string | undefined;
13
+ readonly panelHideLabel?: string;
14
+ readonly panelShowLabel?: string;
15
+ readonly primarySidebarHideLabel?: string;
16
+ readonly primarySidebarShowLabel?: string;
17
+ readonly secondarySidebarHideLabel?: string;
18
+ readonly secondarySidebarShowLabel?: string;
19
19
  }
20
20
 
21
21
  function joinClasses(...classNames: Array<string | false | null | undefined>): string {
@@ -1,16 +1,16 @@
1
1
  import { useMemo, useRef } from 'react';
2
- import { useResolvedWorkbenchTheme } from './theme';
2
+ import { useResolvedWorkbenchTheme } from '../theme/theme';
3
3
  import type { CSSProperties, MouseEvent, ReactNode } from 'react';
4
4
  import { useWorkbenchStandaloneShellStateSync } from './useWorkbenchStandaloneShellStateSync';
5
5
  import {
6
6
  WorkbenchStandaloneShellReactContextProvider,
7
7
  type WorkbenchStandaloneShellStateChange,
8
8
  } from './workbenchStandaloneShellReactContext';
9
- import { cxCodicon } from '../utils/codicon';
9
+ import { cxCodicon } from '../../utils/codicon';
10
10
  import type { StatusBarItemModel, StatusBarSectionModel } from './StatusBar';
11
11
  import type { WorkbenchShellProps } from './WorkbenchShell';
12
12
  import { WorkbenchShell } from './WorkbenchShell';
13
- import type { WorkbenchShellCommandContext } from './commands';
13
+ import type { WorkbenchShellCommandContext } from '../commands/commands';
14
14
  import { DEFAULT_PRIMARY_SIDEBAR_SIZE_PX, useWorkbenchShellState } from './shellState';
15
15
  import type {
16
16
  WorkbenchActivityChangeEvent,
@@ -19,7 +19,7 @@ import type {
19
19
  WorkbenchStandaloneBootstrapEvent,
20
20
  WorkbenchTheme,
21
21
  } from './standalone';
22
- import { WorkspaceDraftsProvider } from './workspace/WorkspaceDraftsContext';
22
+ import { WorkspaceDraftsProvider } from '../workspace/WorkspaceDraftsContext';
23
23
 
24
24
  const DEFAULT_THEME: WorkbenchTheme = 'dark';
25
25
  const DEFAULT_ACTIVITY_ID = 'explorer';
@@ -7,8 +7,8 @@ import {
7
7
  type WorkbenchEditorBodyProps,
8
8
  type WorkbenchEditorFrameProps,
9
9
  type WorkbenchPanelSurfaceProps,
10
- } from '../layout/WorkbenchLayoutBase';
11
- import { EmptyState, type EmptyStateProps } from '../primitives/empty-state';
10
+ } from '../../layout/WorkbenchLayoutBase';
11
+ import { EmptyState, type EmptyStateProps } from '../../primitives/empty-state';
12
12
 
13
13
  export type WorkbenchViewEditorDataAttributes = {
14
14
  readonly [key: `data-${string}`]: boolean | number | string | undefined;
@@ -26,15 +26,15 @@ export type WorkbenchViewEditorEmptyStateSurfaceProps = Omit<
26
26
  export interface WorkbenchViewEditorEmptyState {
27
27
  readonly children: ReactNode;
28
28
  readonly icon: EmptyStateProps['icon'];
29
- readonly props?: WorkbenchViewEditorEmptyStateProps | undefined;
30
- readonly surfaceProps?: WorkbenchViewEditorEmptyStateSurfaceProps | undefined;
29
+ readonly props?: WorkbenchViewEditorEmptyStateProps;
30
+ readonly surfaceProps?: WorkbenchViewEditorEmptyStateSurfaceProps;
31
31
  }
32
32
 
33
33
  export interface WorkbenchViewEditorProps extends Omit<WorkbenchEditorFrameProps, 'children'> {
34
- readonly bodyProps?: Omit<WorkbenchEditorBodyProps, 'children'> | undefined;
34
+ readonly bodyProps?: Omit<WorkbenchEditorBodyProps, 'children'>;
35
35
  readonly children?: ReactNode;
36
- readonly emptyState?: WorkbenchViewEditorEmptyState | undefined;
37
- readonly tabs?: ReactNode | undefined;
36
+ readonly emptyState?: WorkbenchViewEditorEmptyState;
37
+ readonly tabs?: ReactNode;
38
38
  }
39
39
 
40
40
  export function WorkbenchViewEditor({