@workbench-kit/react 0.0.2-prototype.0.2.4 → 0.0.2-prototype.0.2.41

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 (221) hide show
  1. package/README.md +172 -0
  2. package/package.json +38 -21
  3. package/src/index.ts +74 -34
  4. package/src/jdw/JsonCodeEditorPane.tsx +7 -6
  5. package/src/jdw/builtins/renderBuiltinWidgetLeaf.tsx +1 -3
  6. package/src/jdw/createBuiltinJdwRegistry.ts +1 -4
  7. package/src/jdw/cssRenderBackend.tsx +1 -4
  8. package/src/jdw/fixtures/jdw-fixtures.ts +0 -15
  9. package/src/json-config/JsonConfigWorkbench.tsx +1 -1
  10. package/src/layout/index.ts +11 -2
  11. package/src/layout/panel/Panel.tsx +0 -3
  12. package/src/layout/panel/index.ts +0 -2
  13. package/src/layout/sidebar/SideBarTree.tsx +301 -0
  14. package/src/layout/sidebar/SidebarActionIconBar.tsx +3 -3
  15. package/src/layout/sidebar/WorkbenchSidebarActions.tsx +1 -1
  16. package/src/layout/sidebar/index.ts +13 -0
  17. package/src/modal/Modal.tsx +55 -25
  18. package/src/modal/ModalTitlebar.tsx +8 -8
  19. package/src/modal/modalPosition.ts +3 -6
  20. package/src/modal/useModalFocusTrap.ts +142 -0
  21. package/src/modal/useModalWindowFrame.ts +2 -2
  22. package/src/overlay/ContextMenu.tsx +133 -21
  23. package/src/overlay/context-menu-density.css +22 -0
  24. package/src/overlay/context-menu-item.ts +17 -0
  25. package/src/overlay/context-menu.css +6 -2
  26. package/src/overlay/index.ts +6 -1
  27. package/src/overlay/measureAnchoredOverlayPanel.ts +4 -6
  28. package/src/overlay/pointerPassthroughRegion.ts +17 -1
  29. package/src/overlay/usePointerPassthroughRegion.ts +35 -6
  30. package/src/primitives/absolute-box/AbsoluteBox.tsx +4 -4
  31. package/src/primitives/app-icon/AppIcon.tsx +33 -0
  32. package/src/primitives/app-icon/app-icon.css +28 -0
  33. package/src/primitives/button/Button.tsx +4 -4
  34. package/src/primitives/catalog-browse-card/CatalogBrowseCard.tsx +6 -6
  35. package/src/primitives/catalog-browse-pane/CatalogBrowsePane.tsx +39 -32
  36. package/src/primitives/catalog-browse-pane/catalog-browse-pane.css +4 -0
  37. package/src/primitives/catalog-filter-overlay/CatalogFilterOverlay.tsx +2 -2
  38. package/src/primitives/checkbox/Checkbox.tsx +1 -1
  39. package/src/primitives/chip/Chip.tsx +3 -12
  40. package/src/primitives/chip/index.ts +2 -2
  41. package/src/primitives/codicon/Codicon.tsx +1 -1
  42. package/src/primitives/file-icon/FileIcon.tsx +1 -1
  43. package/src/primitives/icon-button/IconButton.tsx +1 -1
  44. package/src/primitives/index.ts +7 -2
  45. package/src/primitives/library-detail-layout/LibraryDetailLayout.tsx +123 -9
  46. package/src/primitives/library-detail-layout/library-detail-layout.css +57 -0
  47. package/src/primitives/library-detail-layout/resolve-hero-cover-media.ts +80 -0
  48. package/src/primitives/library-facet-filter-panel/LibraryFacetFilterPanel.tsx +12 -12
  49. package/src/primitives/library-facet-filter-strip/LibraryFacetFilterStrip.tsx +4 -4
  50. package/src/primitives/number-input/NumberInput.tsx +5 -5
  51. package/src/primitives/primitives.css +1 -0
  52. package/src/primitives/record-media-hero/RecordMediaHero.tsx +10 -6
  53. package/src/primitives/scroll-area/ScrollArea.tsx +5 -5
  54. package/src/primitives/scroll-area-infinite-load/useScrollAreaInfiniteLoad.ts +5 -5
  55. package/src/primitives/searchable-multi-select/SearchableMultiSelect.tsx +7 -7
  56. package/src/primitives/select/Select.tsx +1 -13
  57. package/src/primitives/text-area/TextArea.tsx +1 -1
  58. package/src/primitives/text-input/TextInput.tsx +1 -1
  59. package/src/primitives/workbench-media-slot/WorkbenchMediaPlaceholder.tsx +2 -2
  60. package/src/primitives/workbench-media-slot/WorkbenchMediaSlot.tsx +16 -10
  61. package/src/primitives/workbench-thumbnail/WorkbenchThumbnail.tsx +4 -4
  62. package/src/scrollbars.css +2 -6
  63. package/src/styles/core.css +16 -0
  64. package/src/styles/foundation.css +4 -0
  65. package/src/styles/overlay.css +2 -0
  66. package/src/styles.css +1 -15
  67. package/src/utils/clamp.ts +4 -0
  68. package/src/utils/normalizeKeyToken.ts +13 -0
  69. package/src/utils/readNumber.ts +4 -0
  70. package/src/widget-tree/WidgetSourceEditor.tsx +0 -14
  71. package/src/widget-tree/WidgetTreeCanvasPreview.tsx +3 -10
  72. package/src/widget-tree/WidgetTreeLab.tsx +2 -23
  73. package/src/widget-tree/WidgetTreeSidePanel.tsx +0 -5
  74. package/src/widget-tree/WidgetTreeWorkspaceShell.tsx +2 -2
  75. package/src/widget-tree/index.ts +1 -5
  76. package/src/workbench/auth/WorkbenchLoginView.tsx +1 -2
  77. package/src/workbench/auth/auth-flows.css +14 -0
  78. package/src/workbench/chat/ChatCommandProposalCard.tsx +4 -4
  79. package/src/workbench/chat/ChatConversationBar.tsx +3 -3
  80. package/src/workbench/chat/ChatHistoryMenu.tsx +1 -1
  81. package/src/workbench/chat/ChatMessageCollapsible.tsx +4 -0
  82. package/src/workbench/chat/ChatMessageItem.tsx +68 -10
  83. package/src/workbench/chat/ChatMessageList.tsx +1 -1
  84. package/src/workbench/chat/ChatPanel.tsx +32 -23
  85. package/src/workbench/chat/ChatPhasedRunProgress.tsx +86 -13
  86. package/src/workbench/chat/ChatRenameDialog.tsx +1 -1
  87. package/src/workbench/chat/chat-conversation.css +2 -2
  88. package/src/workbench/chat/chat-ui.css +8 -0
  89. package/src/workbench/chat/chatConversation.ts +2 -2
  90. package/src/workbench/chat/chatMessageMeta.tsx +4 -4
  91. package/src/workbench/chat/index.ts +1 -0
  92. package/src/workbench/chat/types.ts +7 -7
  93. package/src/workbench/chat/useCancelRuntimeOnUnmount.ts +4 -4
  94. package/src/workbench/chat/useChatPrependPagination.ts +10 -10
  95. package/src/workbench/chat/useSlashCommandSuggest.ts +1 -1
  96. package/src/workbench/{WorkbenchModalPortal.tsx → chrome/WorkbenchModalPortal.tsx} +1 -1
  97. package/src/workbench/chrome/workbench-chrome.css +4 -0
  98. package/src/workbench/chrome/workbench-layout-regions.css +13 -0
  99. package/src/workbench/chrome/workbench-shell-titlebar.css +0 -8
  100. package/src/workbench/{CommandGroupShell.tsx → commands/CommandGroupShell.tsx} +2 -2
  101. package/src/workbench/{CommandList.tsx → commands/CommandList.tsx} +6 -5
  102. package/src/workbench/{CommandPalette.tsx → commands/CommandPalette.tsx} +16 -42
  103. package/src/workbench/{ConfirmationFlow.tsx → commands/ConfirmationFlow.tsx} +5 -5
  104. package/src/workbench/{ShortcutCommandBridge.tsx → commands/ShortcutCommandBridge.tsx} +17 -13
  105. package/src/workbench/commands/WorkbenchQuickOpen.tsx +462 -0
  106. package/src/workbench/{command-model.ts → commands/command-model.ts} +5 -1
  107. package/src/workbench/commands/command-ui.ts +3 -0
  108. package/src/workbench/{commands.ts → commands/commands.ts} +45 -1
  109. package/src/workbench/commands/createWorkspaceFilesQuickOpenProvider.ts +86 -0
  110. package/src/workbench/commands/quick-open-model.ts +66 -0
  111. package/src/workbench/{WorkbenchEditorTabs.tsx → editor/WorkbenchEditorTabs.tsx} +13 -3
  112. package/src/workbench/{editor-tabs-dnd.ts → editor/editor-tabs-dnd.ts} +1 -1
  113. package/src/workbench/{editorTabContextMenu.ts → editor/editorTabContextMenu.ts} +43 -4
  114. package/src/workbench/{useEditorTabsStripDnd.ts → editor/useEditorTabsStripDnd.ts} +1 -1
  115. package/src/workbench/{useWorkbenchEditorTabContextMenu.tsx → editor/useWorkbenchEditorTabContextMenu.tsx} +16 -2
  116. package/src/workbench/editor-tabs/index.ts +10 -9
  117. package/src/workbench/index.ts +114 -74
  118. package/src/workbench/management/CommandManagementSidebar.tsx +16 -30
  119. package/src/workbench/management/ExtensionManagementPanel.tsx +84 -46
  120. package/src/workbench/management/ExtensionManagementSidebar.tsx +79 -45
  121. package/src/workbench/management/IntegrationCommandActions.tsx +8 -1
  122. package/src/workbench/management/IntegrationSettingsSurface.tsx +2 -5
  123. package/src/workbench/management/IntegrationsShell.tsx +1 -1
  124. package/src/workbench/management/KeybindingCaptureField.tsx +1 -9
  125. package/src/workbench/management/WorkbenchDialogFrame.tsx +2 -2
  126. package/src/workbench/management/WorkbenchNotice.tsx +17 -12
  127. package/src/workbench/management/createWorkbenchNotify.tsx +88 -0
  128. package/src/workbench/management/extension-install-approval.ts +72 -0
  129. package/src/workbench/management/extension-management-filters.ts +38 -0
  130. package/src/workbench/management/index.ts +18 -3
  131. package/src/workbench/management/management.css +28 -0
  132. package/src/workbench/management/types.ts +23 -1
  133. package/src/workbench/management/useWorkbenchNotify.ts +10 -0
  134. package/src/workbench/{MarkdownPreview.tsx → markdown/MarkdownPreview.tsx} +22 -7
  135. package/src/workbench/markdown/markdownRemarkPlugins.ts +12 -0
  136. package/src/workbench/markdown/sanitizeMarkdownHref.ts +29 -0
  137. package/src/workbench/schema/workbenchDocumentRenderer.tsx +48 -121
  138. package/src/workbench/settings/StructuredDataForm.tsx +1 -4
  139. package/src/workbench/settings/StructuredDataSchemaPanel.tsx +39 -44
  140. package/src/workbench/settings/sectionedPanelScrollSpy.ts +0 -81
  141. package/src/workbench/settings/structuredDataFormModel.ts +2 -1
  142. package/src/workbench/settings/structuredDataSchema.ts +24 -13
  143. package/src/workbench/settings/structuredDataSchemaSection.ts +4 -0
  144. package/src/workbench/settings/structuredDataSchemaTable.ts +5 -2
  145. package/src/workbench/{ActivityBar.tsx → shell/ActivityBar.tsx} +8 -12
  146. package/src/workbench/{ArtifactShell.tsx → shell/ArtifactShell.tsx} +25 -25
  147. package/src/workbench/{SplitView.tsx → shell/SplitView.tsx} +3 -3
  148. package/src/workbench/{StatusBar.tsx → shell/StatusBar.tsx} +8 -8
  149. package/src/workbench/{StructuredArtifactEditor.tsx → shell/StructuredArtifactEditor.tsx} +9 -9
  150. package/src/workbench/{Timeline.tsx → shell/Timeline.tsx} +77 -20
  151. package/src/workbench/{WorkbenchCanvasShell.defaults.ts → shell/WorkbenchCanvasShell.defaults.ts} +1 -1
  152. package/src/workbench/{WorkbenchCanvasShell.model.ts → shell/WorkbenchCanvasShell.model.ts} +5 -5
  153. package/src/workbench/{WorkbenchCanvasShell.tsx → shell/WorkbenchCanvasShell.tsx} +6 -6
  154. package/src/workbench/{WorkbenchDesktopTitleBar.tsx → shell/WorkbenchDesktopTitleBar.tsx} +15 -15
  155. package/src/workbench/{WorkbenchShell.tsx → shell/WorkbenchShell.tsx} +45 -6
  156. package/src/workbench/{WorkbenchShellTitleBarLayoutControls.tsx → shell/WorkbenchShellTitleBarLayoutControls.tsx} +16 -19
  157. package/src/workbench/{WorkbenchStandaloneShell.tsx → shell/WorkbenchStandaloneShell.tsx} +15 -22
  158. package/src/workbench/{WorkbenchViewEditor.tsx → shell/WorkbenchViewEditor.tsx} +7 -7
  159. package/src/workbench/{WorkbenchViewSidebar.tsx → shell/WorkbenchViewSidebar.tsx} +7 -7
  160. package/src/workbench/{WorkbenchWindowChromeControls.tsx → shell/WorkbenchWindowChromeControls.tsx} +18 -15
  161. package/src/workbench/shell/activity-bar.css +47 -0
  162. package/src/workbench/{activityBarOrder.ts → shell/activityBarOrder.ts} +2 -1
  163. package/src/workbench/{shell.ts → shell/shell.ts} +20 -13
  164. package/src/workbench/{shellViewModel.ts → shell/shellViewModel.ts} +3 -3
  165. package/src/workbench/{standalone.ts → shell/standalone.ts} +14 -2
  166. package/src/workbench/{useDeferredWorkbenchMount.ts → shell/useDeferredWorkbenchMount.ts} +3 -3
  167. package/src/workbench/{useWorkbenchAppearanceDocumentSync.tsx → shell/useWorkbenchAppearanceDocumentSync.tsx} +1 -1
  168. package/src/workbench/{useWorkbenchSidebarActionBarDnd.ts → shell/useWorkbenchSidebarActionBarDnd.ts} +1 -1
  169. package/src/workbench/{useWorkbenchSidebarViewPlacementDropZone.ts → shell/useWorkbenchSidebarViewPlacementDropZone.ts} +2 -2
  170. package/src/workbench/{workbenchSidebarLayoutContext.ts → shell/workbenchSidebarLayoutContext.ts} +0 -6
  171. package/src/workbench/{workbenchViewRouteState.ts → shell/workbenchViewRouteState.ts} +4 -4
  172. package/src/workbench/{WorkbenchThemeProvider.tsx → theme/WorkbenchThemeProvider.tsx} +4 -4
  173. package/src/workbench/{theme.ts → theme/theme.ts} +1 -1
  174. package/src/workbench/{themePresets.ts → theme/themePresets.ts} +39 -64
  175. package/src/workbench/views/command-list-density.css +36 -0
  176. package/src/workbench/views/command-list.css +2 -0
  177. package/src/workbench/views/extensions-sidebar.css +2 -0
  178. package/src/workbench/views/view-hosts.css +3 -3
  179. package/src/workbench/workspace/WorkspaceEditorPanel.tsx +1 -1
  180. package/src/workbench/workspace/WorkspaceExplorer.tsx +105 -4
  181. package/src/workbench/workspace/createVirtualWorkspaceExplorerPort.ts +1 -14
  182. package/src/workbench/workspace/workspaceExplorerKeyboard.ts +109 -0
  183. package/src/workbench/workspace/workspaceJsonDiagnostics.ts +6 -5
  184. package/src/workbench-menu-surfaces.css +3 -57
  185. package/src/brand/TilepaperAppIcon.tsx +0 -181
  186. package/src/brand/index.ts +0 -2
  187. package/src/brand/tilepaper-app-icon-geometry.ts +0 -201
  188. package/src/primitives/absolute-box/index.ts +0 -1
  189. package/src/primitives/catalog-browse-card/index.ts +0 -1
  190. package/src/primitives/catalog-browse-pane/index.ts +0 -3
  191. package/src/primitives/catalog-filter-overlay/index.ts +0 -1
  192. package/src/primitives/codicon/index.ts +0 -1
  193. package/src/primitives/external-link-button/index.ts +0 -1
  194. package/src/primitives/library-detail-layout/index.ts +0 -1
  195. package/src/primitives/library-facet-filter-panel/index.ts +0 -1
  196. package/src/primitives/library-facet-filter-strip/index.ts +0 -1
  197. package/src/primitives/panel-loading/index.ts +0 -1
  198. package/src/primitives/scroll-area-infinite-load/index.ts +0 -2
  199. package/src/primitives/workbench-thumbnail/index.ts +0 -1
  200. package/src/test-utils/workbenchMonacoMock.tsx +0 -37
  201. package/src/workbench/jdw/jdw-editors.css +0 -4
  202. package/src/workbench/jdw/jdw.css +0 -2
  203. package/src/workbench/management/integration-command-action.ts +0 -25
  204. package/src/workbench/markdownRemarkPlugins.ts +0 -4
  205. package/src/workbench/workbench-chrome.css +0 -4
  206. /package/src/workbench/{WorkbenchPlatformContext.tsx → chrome/WorkbenchPlatformContext.tsx} +0 -0
  207. /package/src/workbench/{workbenchModalViewState.ts → chrome/workbenchModalViewState.ts} +0 -0
  208. /package/src/workbench/{workbenchOverlaysContext.tsx → chrome/workbenchOverlaysContext.tsx} +0 -0
  209. /package/src/workbench/{workbenchPlatformChrome.ts → chrome/workbenchPlatformChrome.ts} +0 -0
  210. /package/src/workbench/{command-execution-policy.ts → commands/command-execution-policy.ts} +0 -0
  211. /package/src/workbench/{keyboard.ts → commands/keyboard.ts} +0 -0
  212. /package/src/workbench/{workbenchContextMenu.ts → commands/workbenchContextMenu.ts} +0 -0
  213. /package/src/workbench/{appearanceLabels.ts → shell/appearanceLabels.ts} +0 -0
  214. /package/src/workbench/{hardReset.ts → shell/hardReset.ts} +0 -0
  215. /package/src/workbench/{shellPresets.ts → shell/shellPresets.ts} +0 -0
  216. /package/src/workbench/{shellState.ts → shell/shellState.ts} +0 -0
  217. /package/src/workbench/{sidebarViewPlacementDnd.ts → shell/sidebarViewPlacementDnd.ts} +0 -0
  218. /package/src/workbench/{status.ts → shell/status.ts} +0 -0
  219. /package/src/workbench/{useWorkbenchSidebarLayout.tsx → shell/useWorkbenchSidebarLayout.tsx} +0 -0
  220. /package/src/workbench/{useWorkbenchStandaloneShellStateSync.tsx → shell/useWorkbenchStandaloneShellStateSync.tsx} +0 -0
  221. /package/src/workbench/{workbenchStandaloneShellReactContext.tsx → shell/workbenchStandaloneShellReactContext.tsx} +0 -0
@@ -6,6 +6,7 @@ import { ScrollArea } from '../../primitives/scroll-area';
6
6
  import { cx } from '../../utils/cx';
7
7
  import { WorkbenchSectionTabPanel } from './SectionTabPanel';
8
8
  import { WorkbenchSectionedPanel } from './SectionedPanel';
9
+ import { getWorkbenchStructuredDataSchemaPathSegments } from './structuredDataSchemaSection';
9
10
  import {
10
11
  WorkbenchStructuredDataSchemaFieldInput,
11
12
  appendWorkbenchStructuredDataSchemaTableRow,
@@ -98,6 +99,24 @@ interface WorkbenchStructuredDataSchemaSectionView {
98
99
  value: unknown;
99
100
  }
100
101
 
102
+ interface SchemaSectionRenderOptions {
103
+ classNames?: WorkbenchStructuredDataSchemaPanelClassNames | undefined;
104
+ fieldErrors?: Record<string, ReactNode> | undefined;
105
+ getFieldErrorId?: ((dataPath: string) => string | undefined) | undefined;
106
+ labels?: WorkbenchStructuredDataSchemaPanelLabels | undefined;
107
+ localErrorKeys?: ReadonlySet<string> | undefined;
108
+ onDataValueChange: (path: string[], value: unknown) => void;
109
+ onValidateField?: (
110
+ dataPath: string,
111
+ definition: WorkbenchStructuredDataSchemaFieldDefinition | undefined,
112
+ value: unknown,
113
+ ) => void;
114
+ readOnly: boolean;
115
+ }
116
+
117
+ type SchemaSectionRenderProps = WorkbenchStructuredDataSchemaSectionView &
118
+ SchemaSectionRenderOptions;
119
+
101
120
  const defaultSchemaPanelClassNames: Required<WorkbenchStructuredDataSchemaPanelClassNames> = {
102
121
  checkbox: 'ui-workbench-structured-data-schema-panel__checkbox',
103
122
  empty: 'ui-workbench-structured-data-schema-panel__empty',
@@ -144,7 +163,10 @@ function getSchemaFieldValue({
144
163
  sectionValue: unknown;
145
164
  }) {
146
165
  const fullPath = getWorkbenchStructuredDataSchemaFieldDataPath(section, fieldPath);
147
- const rootValue = getWorkbenchStructuredDataValue(data, fullPath.split('.'));
166
+ const rootValue = getWorkbenchStructuredDataValue(
167
+ data,
168
+ getWorkbenchStructuredDataSchemaPathSegments(fullPath),
169
+ );
148
170
  if (rootValue !== null && rootValue !== undefined) return rootValue;
149
171
 
150
172
  const record = asWorkbenchStructuredDataRecord(sectionValue);
@@ -152,7 +174,8 @@ function getSchemaFieldValue({
152
174
  }
153
175
 
154
176
  function formatSchemaFieldErrorKey(path: string | readonly string[]) {
155
- const segments = typeof path === 'string' ? path.split('.') : path;
177
+ const segments =
178
+ typeof path === 'string' ? getWorkbenchStructuredDataSchemaPathSegments(path) : path;
156
179
  return segments.filter(Boolean).join('.');
157
180
  }
158
181
 
@@ -245,20 +268,7 @@ function renderSchemaFormSection({
245
268
  schema,
246
269
  section,
247
270
  value,
248
- }: WorkbenchStructuredDataSchemaSectionView & {
249
- classNames?: WorkbenchStructuredDataSchemaPanelClassNames | undefined;
250
- fieldErrors?: Record<string, ReactNode> | undefined;
251
- getFieldErrorId?: ((dataPath: string) => string | undefined) | undefined;
252
- labels?: WorkbenchStructuredDataSchemaPanelLabels | undefined;
253
- localErrorKeys?: ReadonlySet<string> | undefined;
254
- onDataValueChange: (path: string[], value: unknown) => void;
255
- onValidateField?: (
256
- dataPath: string,
257
- definition: WorkbenchStructuredDataSchemaFieldDefinition | undefined,
258
- value: unknown,
259
- ) => void;
260
- readOnly: boolean;
261
- }) {
271
+ }: SchemaSectionRenderProps) {
262
272
  const fields = section.fields ?? [];
263
273
  if (fields.length) {
264
274
  return (
@@ -281,7 +291,11 @@ function renderSchemaFormSection({
281
291
  mergedFieldErrors: fieldErrors,
282
292
  onValidateField,
283
293
  value: fieldValue,
284
- onValueChange: (nextValue) => onDataValueChange(dataPath.split('.'), nextValue),
294
+ onValueChange: (nextValue) =>
295
+ onDataValueChange(
296
+ getWorkbenchStructuredDataSchemaPathSegments(dataPath),
297
+ nextValue,
298
+ ),
285
299
  })
286
300
  : null;
287
301
 
@@ -353,7 +367,12 @@ function renderSchemaFormSection({
353
367
  readOnly={readOnly}
354
368
  textareaClassName={classNames.settingControlTextarea}
355
369
  value={entry}
356
- onValueChange={(nextValue) => onDataValueChange(dataPath.split('.'), nextValue)}
370
+ onValueChange={(nextValue) =>
371
+ onDataValueChange(
372
+ getWorkbenchStructuredDataSchemaPathSegments(dataPath),
373
+ nextValue,
374
+ )
375
+ }
357
376
  />
358
377
  </div>
359
378
  </Field>
@@ -379,20 +398,8 @@ function renderSchemaTableSection({
379
398
  section,
380
399
  value,
381
400
  ...sectionView
382
- }: WorkbenchStructuredDataSchemaSectionView & {
383
- classNames?: WorkbenchStructuredDataSchemaPanelClassNames | undefined;
384
- fieldErrors?: Record<string, ReactNode> | undefined;
385
- getFieldErrorId?: ((dataPath: string) => string | undefined) | undefined;
386
- labels?: WorkbenchStructuredDataSchemaPanelLabels | undefined;
387
- localErrorKeys?: ReadonlySet<string> | undefined;
388
- onDataValueChange: (path: string[], value: unknown) => void;
389
- onValidateField?: (
390
- dataPath: string,
391
- definition: WorkbenchStructuredDataSchemaFieldDefinition | undefined,
392
- value: unknown,
393
- ) => void;
401
+ }: SchemaSectionRenderProps & {
394
402
  preferredTableColumns?: readonly string[] | undefined;
395
- readOnly: boolean;
396
403
  }) {
397
404
  const rows = getWorkbenchStructuredDataSchemaTableRows(value);
398
405
  const columns = getWorkbenchStructuredDataSchemaDocumentTableColumns({
@@ -569,22 +576,10 @@ function renderSchemaPanelSection({
569
576
  preferredTableColumns,
570
577
  readOnly,
571
578
  sectionView,
572
- }: {
579
+ }: SchemaSectionRenderOptions & {
573
580
  anchorId?: string | undefined;
574
- classNames?: WorkbenchStructuredDataSchemaPanelClassNames | undefined;
575
- fieldErrors?: Record<string, ReactNode> | undefined;
576
- getFieldErrorId?: ((dataPath: string) => string | undefined) | undefined;
577
581
  headerActions?: ReactNode | undefined;
578
- labels?: WorkbenchStructuredDataSchemaPanelLabels | undefined;
579
- localErrorKeys?: ReadonlySet<string> | undefined;
580
- onDataValueChange: (path: string[], value: unknown) => void;
581
- onValidateField?: (
582
- dataPath: string,
583
- definition: WorkbenchStructuredDataSchemaFieldDefinition | undefined,
584
- value: unknown,
585
- ) => void;
586
582
  preferredTableColumns?: readonly string[] | undefined;
587
- readOnly: boolean;
588
583
  sectionView: WorkbenchStructuredDataSchemaSectionView;
589
584
  }) {
590
585
  const { section, value } = sectionView;
@@ -30,12 +30,6 @@ export const WORKBENCH_SECTIONED_PANEL_INTERSECTION_THRESHOLDS = [0, 0.25, 0.5,
30
30
 
31
31
  export type WorkbenchSectionedPanelScrollSpyAxis = 'vertical' | 'horizontal';
32
32
 
33
- export interface WorkbenchSectionedPanelIntersectionEntry {
34
- intersectionRatio: number;
35
- isIntersecting: boolean;
36
- target: { id: string };
37
- }
38
-
39
33
  export interface WorkbenchSectionedPanelScrollPosition {
40
34
  anchorId: string;
41
35
  /** Section start along the active scroll axis (top or left). */
@@ -108,70 +102,6 @@ export function isWorkbenchSectionedPanelAtScrollEnd({
108
102
  return scrollPosition + clientSize >= scrollSize - bottomThreshold;
109
103
  }
110
104
 
111
- /** @deprecated Use `isWorkbenchSectionedPanelAtScrollStart`. */
112
- export function isWorkbenchSectionedPanelAtScrollTop({
113
- scrollTop,
114
- topThreshold = WORKBENCH_SECTIONED_PANEL_SCROLL_THRESHOLD,
115
- }: {
116
- scrollTop: number;
117
- topThreshold?: number | undefined;
118
- }): boolean {
119
- return isWorkbenchSectionedPanelAtScrollStart({
120
- scrollPosition: scrollTop,
121
- startThreshold: topThreshold,
122
- });
123
- }
124
-
125
- /** @deprecated Use `isWorkbenchSectionedPanelAtScrollEnd`. */
126
- export function isWorkbenchSectionedPanelAtScrollBottom({
127
- bottomThreshold = WORKBENCH_SECTIONED_PANEL_SCROLL_THRESHOLD,
128
- clientHeight,
129
- scrollHeight,
130
- scrollTop,
131
- }: {
132
- bottomThreshold?: number | undefined;
133
- clientHeight: number;
134
- scrollHeight: number;
135
- scrollTop: number;
136
- }): boolean {
137
- return isWorkbenchSectionedPanelAtScrollEnd({
138
- bottomThreshold,
139
- clientSize: clientHeight,
140
- scrollPosition: scrollTop,
141
- scrollSize: scrollHeight,
142
- });
143
- }
144
-
145
- export function resolveWorkbenchSectionedPanelActiveAnchorFromIntersection({
146
- anchorOrder,
147
- entries,
148
- fallbackAnchorId,
149
- }: {
150
- anchorOrder: readonly string[];
151
- entries: readonly WorkbenchSectionedPanelIntersectionEntry[];
152
- fallbackAnchorId?: string | undefined;
153
- }): string | undefined {
154
- const intersectingAnchorIds = new Set(
155
- entries
156
- .filter((entry) => entry.isIntersecting && entry.target.id)
157
- .map((entry) => entry.target.id),
158
- );
159
-
160
- if (intersectingAnchorIds.size === 0) {
161
- return fallbackAnchorId;
162
- }
163
-
164
- let nextActive = fallbackAnchorId;
165
-
166
- for (const anchorId of anchorOrder) {
167
- if (intersectingAnchorIds.has(anchorId)) {
168
- nextActive = anchorId;
169
- }
170
- }
171
-
172
- return nextActive ?? fallbackAnchorId;
173
- }
174
-
175
105
  export function resolveWorkbenchSectionedPanelActiveAnchorFromScroll({
176
106
  activeLineBias = WORKBENCH_SECTIONED_PANEL_SCROLL_SPY_ACTIVE_LINE_BIAS,
177
107
  anchorOrder,
@@ -250,17 +180,6 @@ export function resolveWorkbenchSectionedPanelScrollTarget({
250
180
  return Math.max(0, sectionStart - offset);
251
181
  }
252
182
 
253
- /** @deprecated Use `resolveWorkbenchSectionedPanelScrollTarget`. */
254
- export function resolveWorkbenchSectionedPanelScrollTop({
255
- offset = WORKBENCH_SECTIONED_PANEL_SCROLL_SPY_OFFSET,
256
- sectionTop,
257
- }: {
258
- offset?: number | undefined;
259
- sectionTop: number;
260
- }): number {
261
- return resolveWorkbenchSectionedPanelScrollTarget({ offset, sectionStart: sectionTop });
262
- }
263
-
264
183
  export function createWorkbenchSectionedPanelIntersectionRootMargin(
265
184
  offset = WORKBENCH_SECTIONED_PANEL_SCROLL_SPY_OFFSET,
266
185
  axis: WorkbenchSectionedPanelScrollSpyAxis = 'vertical',
@@ -135,6 +135,7 @@ function isWorkbenchStructuredDataFormEmptyValue(value: WorkbenchStructuredDataF
135
135
  return value === '' || value === false;
136
136
  }
137
137
 
138
- function isRenderableWorkbenchStructuredDataFormError(error: ReactNode) {
138
+ /** True when a form field error should render (non-empty ReactNode). */
139
+ export function isRenderableWorkbenchStructuredDataFormError(error: ReactNode) {
139
140
  return error !== undefined && error !== null && error !== false && error !== '';
140
141
  }
@@ -19,6 +19,7 @@ import {
19
19
  import {
20
20
  getWorkbenchStructuredDataSchemaFieldDataPath,
21
21
  getWorkbenchStructuredDataSchemaFieldDefinition,
22
+ getWorkbenchStructuredDataSchemaPathSegments,
22
23
  getWorkbenchStructuredDataSchemaSectionFieldLabel,
23
24
  getWorkbenchStructuredDataSchemaSectionPath,
24
25
  } from './structuredDataSchemaSection';
@@ -206,14 +207,18 @@ export function getWorkbenchStructuredDataSchemaDocumentSectionValue({
206
207
  section: WorkbenchStructuredDataSchemaSectionSummary;
207
208
  }) {
208
209
  const sectionKey = getWorkbenchStructuredDataSchemaSectionPath(section);
209
- const record = asWorkbenchStructuredDataRecord(data);
210
- if (!sectionKey || !record) return sectionKey ? null : data;
211
- if (sectionKey in record) return record[sectionKey];
210
+ if (!sectionKey) return data;
212
211
 
213
- const directValue = getWorkbenchStructuredDataValue(data, sectionKey.split('.'));
212
+ const directValue = getWorkbenchStructuredDataValue(
213
+ data,
214
+ getWorkbenchStructuredDataSchemaPathSegments(sectionKey),
215
+ );
214
216
  if (directValue !== null && directValue !== undefined) return directValue;
215
217
 
216
- for (const path of aliases[sectionKey] ?? []) {
218
+ const sectionAliases = Object.prototype.hasOwnProperty.call(aliases, sectionKey)
219
+ ? (aliases[sectionKey] ?? [])
220
+ : [];
221
+ for (const path of sectionAliases) {
217
222
  if (!path.length) return data;
218
223
  const value = getWorkbenchStructuredDataValue(data, path);
219
224
  if (value !== null && value !== undefined) return value;
@@ -279,13 +284,17 @@ export function createWorkbenchStructuredDataSchemaDocumentSampleData(
279
284
  ? section.columns
280
285
  : Object.keys(schemaTable?.items ?? {});
281
286
 
282
- return setWorkbenchStructuredDataValue(sample, path.split('.'), [
283
- createWorkbenchStructuredDataSchemaDocumentEmptyRow({
284
- columns,
285
- schema,
286
- section,
287
- }),
288
- ]);
287
+ return setWorkbenchStructuredDataValue(
288
+ sample,
289
+ getWorkbenchStructuredDataSchemaPathSegments(path),
290
+ [
291
+ createWorkbenchStructuredDataSchemaDocumentEmptyRow({
292
+ columns,
293
+ schema,
294
+ section,
295
+ }),
296
+ ],
297
+ );
289
298
  }
290
299
 
291
300
  return (section.fields ?? []).reduce<WorkbenchStructuredDataRecord>((nextSample, fieldPath) => {
@@ -296,7 +305,9 @@ export function createWorkbenchStructuredDataSchemaDocumentSampleData(
296
305
  );
297
306
  return setWorkbenchStructuredDataValue(
298
307
  nextSample,
299
- getWorkbenchStructuredDataSchemaFieldDataPath(section, fieldPath).split('.'),
308
+ getWorkbenchStructuredDataSchemaPathSegments(
309
+ getWorkbenchStructuredDataSchemaFieldDataPath(section, fieldPath),
310
+ ),
300
311
  getWorkbenchStructuredDataSchemaFieldDefaultValue(definition),
301
312
  );
302
313
  }, sample);
@@ -21,6 +21,10 @@ export function getWorkbenchStructuredDataSchemaSectionPath(
21
21
  return section.sectionKey || section.id || '';
22
22
  }
23
23
 
24
+ export function getWorkbenchStructuredDataSchemaPathSegments(path: string) {
25
+ return path ? path.split('.') : [];
26
+ }
27
+
24
28
  export function getWorkbenchStructuredDataSchemaFieldDataPath(
25
29
  section: WorkbenchStructuredDataSchemaSectionSummary,
26
30
  fieldPath: string,
@@ -7,7 +7,10 @@ import type {
7
7
  WorkbenchStructuredDataSchemaTableRowKeyInput,
8
8
  } from './structuredDataSchemaTypes';
9
9
  import { getWorkbenchStructuredDataSchemaFieldDefaultValue } from './structuredDataSchemaField';
10
- import { getWorkbenchStructuredDataSchemaSectionPath } from './structuredDataSchemaSection';
10
+ import {
11
+ getWorkbenchStructuredDataSchemaPathSegments,
12
+ getWorkbenchStructuredDataSchemaSectionPath,
13
+ } from './structuredDataSchemaSection';
11
14
 
12
15
  export function getWorkbenchStructuredDataSchemaTableRows(
13
16
  value: unknown,
@@ -34,7 +37,7 @@ export function getWorkbenchStructuredDataSchemaTablePath(
34
37
  section: WorkbenchStructuredDataSchemaSectionSummary,
35
38
  ) {
36
39
  const tablePath = getWorkbenchStructuredDataSchemaSectionPath(section);
37
- return tablePath ? tablePath.split('.') : [];
40
+ return getWorkbenchStructuredDataSchemaPathSegments(tablePath);
38
41
  }
39
42
 
40
43
  export function getWorkbenchStructuredDataSchemaTableRowKey({
@@ -1,14 +1,13 @@
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,
8
8
  useWorkbenchSidebarViewPlacementDropZone,
9
9
  } from './useWorkbenchSidebarViewPlacementDropZone';
10
10
  import { useWorkbenchSidebarActionBarDnd } from './useWorkbenchSidebarActionBarDnd';
11
- import { WORKBENCH_SIDEBAR_VIEW_PLACEMENT_DRAG_DATA_TYPE } from './sidebarViewPlacementDnd';
12
11
 
13
12
  export interface ActivityBarItem {
14
13
  active?: boolean;
@@ -20,23 +19,20 @@ export interface ActivityBarItem {
20
19
  }
21
20
 
22
21
  export interface ActivityBarProps extends Omit<ComponentPropsWithoutRef<'nav'>, 'children'> {
23
- acceptSidebarViewPlacementDrop?: ((viewId: string) => boolean) | undefined;
22
+ acceptSidebarViewPlacementDrop?: (viewId: string) => boolean;
24
23
  itemDataAttributeName?: string;
25
24
  items: ActivityBarItem[];
26
25
  onItemActivate?: (item: ActivityBarItem) => void;
27
26
  onItemsReorder?: (itemIds: string[]) => void;
28
- onSidebarViewPlacementDrop?: ((viewId: string) => void) | undefined;
29
- orientation?: ActivityBarOrientation | undefined;
27
+ onSidebarViewPlacementDrop?: (viewId: string) => void;
28
+ orientation?: ActivityBarOrientation;
30
29
  reorderable?: boolean;
31
30
  secondaryItems?: ActivityBarItem[];
32
- sidebarViewPlacementDropZoneId?: string | undefined;
31
+ sidebarViewPlacementDropZoneId?: string;
33
32
  /** Enables cross-slot placement drag without reordering within the bar. */
34
- placementDraggable?: boolean | undefined;
33
+ placementDraggable?: boolean;
35
34
  }
36
35
 
37
- /** @deprecated Use WORKBENCH_SIDEBAR_VIEW_PLACEMENT_DRAG_DATA_TYPE */
38
- export const ACTIVITY_BAR_DRAG_DATA_TYPE = WORKBENCH_SIDEBAR_VIEW_PLACEMENT_DRAG_DATA_TYPE;
39
-
40
36
  export function ActivityBar({
41
37
  'aria-label': ariaLabel = 'Activity bar',
42
38
  acceptSidebarViewPlacementDrop,
@@ -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;