@workbench-kit/react 0.0.1-prototype.0 → 0.0.2-prototype.0.1.2

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 (155) hide show
  1. package/package.json +33 -9
  2. package/src/index.ts +545 -43
  3. package/src/jdw/JdwPreview.tsx +38 -0
  4. package/src/jdw/JsonCodeEditorPane.tsx +274 -0
  5. package/src/jdw/builtins/renderBuiltinWidgetLeaf.tsx +29 -0
  6. package/src/jdw/builtins/renderBuiltinWidgetNode.tsx +126 -0
  7. package/src/jdw/createBuiltinJdwRegistry.ts +111 -0
  8. package/src/jdw/cssRenderBackend.tsx +134 -0
  9. package/src/jdw/document.ts +38 -0
  10. package/src/jdw/fixtures/jdw-fixtures.ts +52 -0
  11. package/src/jdw/fixtures/jdw-sample-screens.ts +522 -0
  12. package/src/jdw/index.ts +45 -0
  13. package/src/jdw/parse.ts +1 -0
  14. package/src/jdw/renderJdw.tsx +32 -0
  15. package/src/json-config/JsonConfigWorkbench.tsx +316 -0
  16. package/src/json-config/index.ts +6 -0
  17. package/src/json-config/json-config-editor-state.ts +42 -0
  18. package/src/layout/Panel.tsx +146 -1
  19. package/src/layout/SideBarViewFrame.tsx +367 -328
  20. package/src/layout/WorkbenchCanvas.tsx +849 -0
  21. package/src/layout/WorkbenchFullscreen.tsx +368 -0
  22. package/src/layout/WorkbenchLayout.tsx +5 -0
  23. package/src/layout/WorkbenchLayoutBase.tsx +294 -0
  24. package/src/layout/WorkbenchPropertyPanel.tsx +497 -0
  25. package/src/layout/WorkbenchSidebarActions.tsx +274 -0
  26. package/src/layout/WorkbenchTree.tsx +351 -0
  27. package/src/layout/layoutHelpers.ts +25 -0
  28. package/src/modal/ConfirmDialog.tsx +61 -53
  29. package/src/modal/Modal.tsx +295 -35
  30. package/src/overlay/ContextMenu.tsx +146 -145
  31. package/src/primitives/AbsoluteBox.tsx +46 -0
  32. package/src/primitives/Badge.tsx +12 -12
  33. package/src/primitives/Button.tsx +44 -14
  34. package/src/primitives/Checkbox.tsx +11 -5
  35. package/src/primitives/EmptyState.tsx +27 -26
  36. package/src/primitives/Field.tsx +38 -38
  37. package/src/primitives/IconButton.tsx +5 -2
  38. package/src/primitives/List.tsx +111 -0
  39. package/src/primitives/NumberInput.tsx +38 -0
  40. package/src/primitives/ScrollArea.tsx +42 -0
  41. package/src/primitives/Select.tsx +1 -12
  42. package/src/primitives/StatusBar.tsx +46 -0
  43. package/src/primitives/TextArea.tsx +36 -0
  44. package/src/primitives/TextInput.tsx +11 -2
  45. package/src/primitives/WorkbenchChrome.tsx +424 -0
  46. package/src/primitives/WorkbenchEditor.tsx +394 -0
  47. package/src/primitives/index.ts +105 -0
  48. package/src/primitives/select/Select.tsx +266 -0
  49. package/src/primitives/select/index.ts +2 -0
  50. package/src/primitives/select/options.ts +38 -0
  51. package/src/primitives/select/overlay.ts +63 -0
  52. package/src/primitives/select/select.app.css +9 -0
  53. package/src/primitives/select/select.css +140 -0
  54. package/src/primitives/select/types.ts +18 -0
  55. package/src/primitives/styles.css +955 -0
  56. package/src/scrollbars.css +69 -0
  57. package/src/styles.css +7738 -1762
  58. package/src/utils/codicon.ts +17 -0
  59. package/src/widget-asset/WidgetAssetEditor.tsx +140 -0
  60. package/src/widget-asset/WidgetAssetMetadataForm.tsx +82 -0
  61. package/src/widget-asset/WidgetAssetModeControls.tsx +42 -0
  62. package/src/widget-asset/WidgetAssetSourceEditor.tsx +50 -0
  63. package/src/widget-asset/WidgetAssetWorkbench.tsx +112 -0
  64. package/src/widget-asset/index.ts +17 -0
  65. package/src/widget-asset/widget-asset-document.ts +37 -0
  66. package/src/widget-asset/widget-asset-mode.ts +3 -0
  67. package/src/widget-studio/builtin-widget-asset-catalog.ts +12 -0
  68. package/src/widget-studio/create-widget-studio-workspace-editor.tsx +79 -0
  69. package/src/widget-studio/index.ts +7 -0
  70. package/src/widget-studio/resolve-widget-studio-asset-catalog.ts +26 -0
  71. package/src/widget-tree/WidgetAssetPalette.tsx +77 -0
  72. package/src/widget-tree/WidgetInspectorPanel.tsx +266 -0
  73. package/src/widget-tree/WidgetSourceEditor.tsx +56 -0
  74. package/src/widget-tree/WidgetTreeLab.tsx +272 -0
  75. package/src/widget-tree/WidgetTreeModeControls.tsx +44 -0
  76. package/src/widget-tree/WidgetTreeSidePanel.tsx +49 -0
  77. package/src/widget-tree/WidgetTreeView.tsx +97 -0
  78. package/src/widget-tree/WidgetTreeWorkbench.tsx +111 -0
  79. package/src/widget-tree/WidgetTreeWorkspaceShell.tsx +154 -0
  80. package/src/widget-tree/demo-registry.ts +32 -0
  81. package/src/widget-tree/demo-widget-assets.ts +4 -0
  82. package/src/widget-tree/index.ts +27 -0
  83. package/src/widget-tree/widget-tree-document.ts +20 -0
  84. package/src/widget-tree/widget-tree-layout.ts +31 -0
  85. package/src/widget-tree/widget-tree-mode.ts +7 -0
  86. package/src/widget-tree/widget-tree-play-helpers.ts +74 -0
  87. package/src/workbench/ActivityBar.tsx +52 -52
  88. package/src/workbench/ArtifactShell.tsx +397 -0
  89. package/src/workbench/CommandPalette.tsx +819 -0
  90. package/src/workbench/ConfirmationFlow.tsx +245 -0
  91. package/src/workbench/MarkdownPreview.tsx +151 -0
  92. package/src/workbench/ShortcutCommandBridge.tsx +368 -0
  93. package/src/workbench/SplitView.tsx +136 -136
  94. package/src/workbench/StatusBar.tsx +178 -123
  95. package/src/workbench/StructuredArtifactEditor.tsx +205 -0
  96. package/src/workbench/Timeline.tsx +302 -0
  97. package/src/workbench/WorkbenchCanvasShell.tsx +941 -0
  98. package/src/workbench/WorkbenchShell.tsx +74 -70
  99. package/src/workbench/WorkbenchStandaloneShell.tsx +318 -291
  100. package/src/workbench/auth/WorkbenchAuthGate.tsx +61 -0
  101. package/src/workbench/auth/WorkbenchLoginView.tsx +635 -0
  102. package/src/workbench/auth/index.ts +19 -0
  103. package/src/workbench/chat/ChatComposer.tsx +165 -148
  104. package/src/workbench/chat/ChatMessageItem.tsx +10 -1
  105. package/src/workbench/chat/index.ts +9 -0
  106. package/src/workbench/chat/slashCommand.ts +28 -0
  107. package/src/workbench/chat/useChatRuntimeState.ts +76 -0
  108. package/src/workbench/chat/useSlashCommandSuggest.ts +101 -0
  109. package/src/workbench/commands.ts +520 -490
  110. package/src/workbench/index.ts +443 -98
  111. package/src/workbench/keyboard.ts +53 -0
  112. package/src/workbench/schema/index.ts +48 -0
  113. package/src/workbench/schema/workbenchDocument.ts +31 -0
  114. package/src/workbench/schema/workbenchDocumentActions.ts +6 -0
  115. package/src/workbench/schema/workbenchDocumentAdapter.ts +9 -0
  116. package/src/workbench/schema/workbenchDocumentPatch.ts +13 -0
  117. package/src/workbench/schema/workbenchDocumentRenderer.tsx +702 -0
  118. package/src/workbench/settings/NavigationPanel.tsx +47 -0
  119. package/src/workbench/settings/SchemaForm.tsx +420 -0
  120. package/src/workbench/settings/SectionedPanel.tsx +415 -0
  121. package/src/workbench/settings/StructuredDataForm.tsx +539 -0
  122. package/src/workbench/settings/StructuredDataSchemaPanel.tsx +559 -0
  123. package/src/workbench/settings/StructuredDataSchemaPanelEmbed.tsx +21 -0
  124. package/src/workbench/settings/StructuredDataSchemaPanelFrame.tsx +76 -0
  125. package/src/workbench/settings/StructuredDataTableView.tsx +127 -0
  126. package/src/workbench/settings/WorkbenchPanelRegion.tsx +46 -0
  127. package/src/workbench/settings/WorkbenchSettingsModal.tsx +21 -12
  128. package/src/workbench/settings/WorkbenchSettingsNav.tsx +38 -22
  129. package/src/workbench/settings/index.ts +135 -0
  130. package/src/workbench/settings/panel-region.css +21 -0
  131. package/src/workbench/settings/sectionedPanelScrollSpy.ts +143 -0
  132. package/src/workbench/settings/structured-data-schema-panel.css +330 -0
  133. package/src/workbench/settings/structured-data-table-view.css +85 -0
  134. package/src/workbench/settings/structuredDataSchema.ts +886 -0
  135. package/src/workbench/shell.ts +15 -0
  136. package/src/workbench/shellState.ts +203 -203
  137. package/src/workbench/standalone.ts +101 -94
  138. package/src/workbench/status.ts +129 -0
  139. package/src/workbench/theme.ts +44 -0
  140. package/src/workbench/workspace/MultiProviderExplorer.tsx +625 -0
  141. package/src/workbench/workspace/WorkspaceDraftsContext.tsx +111 -0
  142. package/src/workbench/workspace/WorkspaceEditor.tsx +47 -12
  143. package/src/workbench/workspace/WorkspaceEditorPanel.tsx +334 -353
  144. package/src/workbench/workspace/WorkspaceExplorer.tsx +532 -524
  145. package/src/workbench/workspace/WorkspaceFileIcon.tsx +32 -2
  146. package/src/workbench/workspace/WorkspaceSearchPanel.tsx +113 -113
  147. package/src/workbench/workspace/WorkspaceSearchResults.tsx +47 -47
  148. package/src/workbench/workspace/index.ts +156 -98
  149. package/src/workbench/workspace/mimeType.ts +45 -0
  150. package/src/workbench/workspace/path.ts +10 -10
  151. package/src/workbench/workspace/search.ts +6 -6
  152. package/src/workbench/workspace/tree.ts +1 -1
  153. package/src/workbench/workspace/types.ts +10 -10
  154. package/src/workbench/workspace/useVirtualWorkspace.ts +111 -98
  155. package/src/workbench/workspace/workspaceJsonDiagnostics.ts +83 -0
@@ -0,0 +1,127 @@
1
+ import type { ComponentPropsWithRef, ReactNode } from 'react';
2
+ import { EmptyState } from '../../primitives/EmptyState';
3
+ import { ScrollArea } from '../../primitives/ScrollArea';
4
+ import { cx } from '../../utils/cx';
5
+ import {
6
+ getWorkbenchStructuredDataValue,
7
+ type WorkbenchStructuredDataRecord,
8
+ type WorkbenchStructuredDataTable,
9
+ type WorkbenchStructuredDataTableCellContext,
10
+ type WorkbenchStructuredDataTableColumn,
11
+ } from './structuredDataSchema';
12
+
13
+ export interface WorkbenchStructuredDataTableViewProps extends Omit<
14
+ ComponentPropsWithRef<'section'>,
15
+ 'children'
16
+ > {
17
+ table: WorkbenchStructuredDataTable;
18
+ }
19
+
20
+ export function buildWorkbenchStructuredDataTableFromRecords({
21
+ columns,
22
+ emptyLabel = 'No rows',
23
+ id = 'table',
24
+ label,
25
+ rows,
26
+ }: {
27
+ columns: readonly string[];
28
+ emptyLabel?: ReactNode;
29
+ id?: string;
30
+ label?: ReactNode;
31
+ rows: readonly WorkbenchStructuredDataRecord[];
32
+ }): WorkbenchStructuredDataTable {
33
+ return {
34
+ columns: columns.map((column) => ({
35
+ id: column,
36
+ label: column,
37
+ path: [column],
38
+ })),
39
+ emptyLabel,
40
+ id,
41
+ label,
42
+ rows: rows.map((data, index) => ({
43
+ data,
44
+ id: String(index),
45
+ })),
46
+ };
47
+ }
48
+
49
+ export function formatWorkbenchStructuredDataTableCell(value: unknown) {
50
+ if (value === undefined || value === null || value === '') return '-';
51
+ if (typeof value === 'boolean') return value ? 'Yes' : 'No';
52
+ if (Array.isArray(value)) return value.length === 0 ? '-' : value.join(', ');
53
+ return String(value);
54
+ }
55
+
56
+ function renderCell(
57
+ column: WorkbenchStructuredDataTableColumn,
58
+ context: WorkbenchStructuredDataTableCellContext,
59
+ ) {
60
+ return column.render?.(context) ?? formatWorkbenchStructuredDataTableCell(context.value);
61
+ }
62
+
63
+ export function WorkbenchStructuredDataTableView({
64
+ className,
65
+ table,
66
+ ...props
67
+ }: WorkbenchStructuredDataTableViewProps) {
68
+ const hasHeader = Boolean(table.label || table.description);
69
+
70
+ return (
71
+ <section
72
+ className={cx(
73
+ 'ui-workbench-structured-data-table-view',
74
+ hasHeader && 'ui-workbench-structured-data-table-view--with-header',
75
+ className,
76
+ )}
77
+ {...props}
78
+ >
79
+ {table.label ? (
80
+ <h3 className="ui-workbench-structured-data-table-view__label">{table.label}</h3>
81
+ ) : null}
82
+ {table.description ? (
83
+ <p className="ui-workbench-structured-data-table-view__description">{table.description}</p>
84
+ ) : null}
85
+ {table.rows.length === 0 ? (
86
+ <EmptyState compact icon="codicon-table">
87
+ {table.emptyLabel ?? 'No rows'}
88
+ </EmptyState>
89
+ ) : (
90
+ <ScrollArea
91
+ className="ui-workbench-structured-data-table-view__scroll"
92
+ gutter="auto"
93
+ orientation="both"
94
+ >
95
+ <table className="ui-workbench-structured-data-table-view__table">
96
+ <thead>
97
+ <tr>
98
+ {table.columns.map((column) => (
99
+ <th key={column.id} data-align={column.align}>
100
+ {column.label}
101
+ </th>
102
+ ))}
103
+ </tr>
104
+ </thead>
105
+ <tbody>
106
+ {table.rows.map((row) => (
107
+ <tr key={row.id}>
108
+ {table.columns.map((column) => {
109
+ const value = column.path
110
+ ? getWorkbenchStructuredDataValue(row.data, column.path)
111
+ : undefined;
112
+
113
+ return (
114
+ <td key={column.id} data-align={column.align}>
115
+ {renderCell(column, { column, row, value })}
116
+ </td>
117
+ );
118
+ })}
119
+ </tr>
120
+ ))}
121
+ </tbody>
122
+ </table>
123
+ </ScrollArea>
124
+ )}
125
+ </section>
126
+ );
127
+ }
@@ -0,0 +1,46 @@
1
+ import type { ComponentPropsWithRef, ElementType, ReactNode } from 'react';
2
+ import { ScrollArea } from '../../primitives/ScrollArea';
3
+ import { cx } from '../../utils/cx';
4
+
5
+ type WorkbenchPanelRegionLayout = 'fill' | 'scroll';
6
+
7
+ export interface WorkbenchPanelRegionProps extends Omit<ComponentPropsWithRef<'div'>, 'children'> {
8
+ as?: ElementType | undefined;
9
+ children: ReactNode;
10
+ layout?: WorkbenchPanelRegionLayout | undefined;
11
+ }
12
+
13
+ export function WorkbenchPanelRegion({
14
+ as,
15
+ children,
16
+ className,
17
+ layout = 'scroll',
18
+ ...props
19
+ }: WorkbenchPanelRegionProps) {
20
+ const Component = (as ?? 'div') as ElementType;
21
+ const classNames = cx(
22
+ 'ui-workbench-panel-region',
23
+ layout === 'fill' ? 'ui-workbench-panel-region--fill' : 'ui-workbench-panel-region--scroll',
24
+ className,
25
+ );
26
+
27
+ if (layout === 'scroll') {
28
+ return (
29
+ <ScrollArea
30
+ as={Component}
31
+ className={classNames}
32
+ orientation="vertical"
33
+ gutter="stable"
34
+ {...props}
35
+ >
36
+ {children}
37
+ </ScrollArea>
38
+ );
39
+ }
40
+
41
+ return (
42
+ <Component className={classNames} {...props}>
43
+ {children}
44
+ </Component>
45
+ );
46
+ }
@@ -3,6 +3,7 @@ import { Modal } from '../../modal/Modal';
3
3
  import type { ModalProps } from '../../modal/Modal';
4
4
  import { TextInput } from '../../primitives/TextInput';
5
5
  import { cx } from '../../utils/cx';
6
+ import { WorkbenchNavigationPanel } from './NavigationPanel';
6
7
  import { WorkbenchSettingsNav } from './WorkbenchSettingsNav';
7
8
  import type { WorkbenchSettingsCategory, WorkbenchSettingsScope } from './types';
8
9
 
@@ -129,6 +130,8 @@ export function WorkbenchSettingsModal({
129
130
  closeLabel={closeLabel}
130
131
  footer={footer}
131
132
  labelledBy={titleId}
133
+ maximizable
134
+ movable
132
135
  title={title}
133
136
  titleSuffix={titleSuffix}
134
137
  onClose={onClose}
@@ -170,19 +173,25 @@ export function WorkbenchSettingsModal({
170
173
  </div>
171
174
  ) : null}
172
175
 
173
- <div className="workbench-settings-layout">
174
- <WorkbenchSettingsNav
175
- activeCategoryId={selectedCategoryId}
176
- categories={categories}
177
- onSelectCategory={handleSelectCategory}
178
- />
179
-
180
- <main className="workbench-settings-content">
181
- {selectedCategory
176
+ <WorkbenchNavigationPanel
177
+ className="workbench-settings-layout"
178
+ content={
179
+ selectedCategory
182
180
  ? (renderCategory?.(selectedCategory) ?? selectedCategory.content ?? emptyContent)
183
- : emptyContent}
184
- </main>
185
- </div>
181
+ : emptyContent
182
+ }
183
+ contentClassName="workbench-settings-content ui-workbench-scrollbar ui-scroll-area--stable-gutter"
184
+ nav={
185
+ <WorkbenchSettingsNav
186
+ activeCategoryId={selectedCategoryId}
187
+ categories={categories}
188
+ renderContainer={false}
189
+ onSelectCategory={handleSelectCategory}
190
+ />
191
+ }
192
+ navClassName="workbench-settings-sidebar ui-workbench-scrollbar"
193
+ navProps={{ 'aria-label': 'Settings categories' }}
194
+ />
186
195
  </Modal>
187
196
  );
188
197
  }
@@ -1,41 +1,57 @@
1
+ import type { ComponentPropsWithRef } from 'react';
1
2
  import { cx } from '../../utils/cx';
2
3
  import type { WorkbenchSettingsCategory } from './types';
3
4
 
4
- export interface WorkbenchSettingsNavProps {
5
+ export interface WorkbenchSettingsNavProps extends Omit<
6
+ ComponentPropsWithRef<'aside'>,
7
+ 'children' | 'onSelect'
8
+ > {
5
9
  activeCategoryId: string;
6
10
  categories: WorkbenchSettingsCategory[];
7
11
  ariaLabel?: string;
8
12
  onSelectCategory: (categoryId: string) => void;
13
+ renderContainer?: boolean | undefined;
9
14
  }
10
15
 
11
16
  export function WorkbenchSettingsNav({
12
17
  activeCategoryId,
13
18
  ariaLabel = 'Settings categories',
14
19
  categories,
20
+ className,
15
21
  onSelectCategory,
22
+ renderContainer = true,
23
+ ...props
16
24
  }: WorkbenchSettingsNavProps) {
17
- return (
18
- <aside className="workbench-settings-sidebar" aria-label={ariaLabel}>
19
- {categories.map((category) => {
20
- const isActive = category.id === activeCategoryId;
25
+ const items = categories.map((category) => {
26
+ const isActive = category.id === activeCategoryId;
27
+
28
+ return (
29
+ <button
30
+ key={category.id}
31
+ type="button"
32
+ className={cx(
33
+ 'workbench-settings-nav-item',
34
+ isActive && 'workbench-settings-nav-item--active',
35
+ )}
36
+ aria-current={isActive ? 'page' : undefined}
37
+ disabled={category.disabled}
38
+ title={category.title}
39
+ onClick={() => onSelectCategory(category.id)}
40
+ >
41
+ {category.label}
42
+ </button>
43
+ );
44
+ });
21
45
 
22
- return (
23
- <button
24
- key={category.id}
25
- type="button"
26
- className={cx(
27
- 'workbench-settings-nav-item',
28
- isActive && 'workbench-settings-nav-item--active',
29
- )}
30
- aria-current={isActive ? 'page' : undefined}
31
- disabled={category.disabled}
32
- title={category.title}
33
- onClick={() => onSelectCategory(category.id)}
34
- >
35
- {category.label}
36
- </button>
37
- );
38
- })}
46
+ if (!renderContainer) return <>{items}</>;
47
+
48
+ return (
49
+ <aside
50
+ className={cx('workbench-settings-sidebar', 'ui-workbench-scrollbar', className)}
51
+ aria-label={ariaLabel}
52
+ {...props}
53
+ >
54
+ {items}
39
55
  </aside>
40
56
  );
41
57
  }
@@ -1,3 +1,138 @@
1
+ export { WorkbenchPanelRegion } from './WorkbenchPanelRegion';
2
+ export type { WorkbenchPanelRegionProps } from './WorkbenchPanelRegion';
3
+ export { WorkbenchNavigationPanel } from './NavigationPanel';
4
+ export type { WorkbenchNavigationPanelProps } from './NavigationPanel';
5
+ export { WorkbenchSectionedPanel } from './SectionedPanel';
6
+ export type { WorkbenchSectionedPanelItem, WorkbenchSectionedPanelProps } from './SectionedPanel';
7
+ export { WorkbenchStructuredDataSchemaPanel } from './StructuredDataSchemaPanel';
8
+ export type {
9
+ WorkbenchStructuredDataSchemaPanelClassNames,
10
+ WorkbenchStructuredDataSchemaPanelLabels,
11
+ WorkbenchStructuredDataSchemaPanelProps,
12
+ } from './StructuredDataSchemaPanel';
13
+ export { WorkbenchStructuredDataSchemaPanelEmbed } from './StructuredDataSchemaPanelEmbed';
14
+ export type { WorkbenchStructuredDataSchemaPanelEmbedProps } from './StructuredDataSchemaPanelEmbed';
15
+ export { WorkbenchStructuredDataSchemaPanelFrame } from './StructuredDataSchemaPanelFrame';
16
+ export {
17
+ WorkbenchStructuredDataTableView,
18
+ buildWorkbenchStructuredDataTableFromRecords,
19
+ formatWorkbenchStructuredDataTableCell,
20
+ } from './StructuredDataTableView';
21
+ export type { WorkbenchStructuredDataTableViewProps } from './StructuredDataTableView';
22
+ export type {
23
+ WorkbenchStructuredDataSchemaPanelFrameHeaderContent,
24
+ WorkbenchStructuredDataSchemaPanelFrameProps,
25
+ } from './StructuredDataSchemaPanelFrame';
26
+ export {
27
+ WorkbenchStructuredDataForm,
28
+ WorkbenchStructuredDataSchemaFieldInput,
29
+ WorkbenchStructuredDataTextArrayInput,
30
+ appendWorkbenchStructuredDataSchemaTableRow,
31
+ asWorkbenchStructuredDataRecord,
32
+ booleanWorkbenchStructuredDataSchemaFieldValue,
33
+ coerceWorkbenchStructuredDataFormFieldValue,
34
+ coerceWorkbenchStructuredDataSchemaFieldValue,
35
+ createWorkbenchStructuredDataSchemaDocumentEmptyRow,
36
+ createWorkbenchStructuredDataSchemaEmptyRow,
37
+ createWorkbenchStructuredDataSchemaDocumentSampleData,
38
+ createWorkbenchStructuredDataSchemaFallbackSection,
39
+ formatWorkbenchStructuredDataSchemaValue,
40
+ formatWorkbenchStructuredDataSchemaLabel,
41
+ getWorkbenchStructuredDataFormErrors,
42
+ getWorkbenchStructuredDataFormFieldDefaultValue,
43
+ getWorkbenchStructuredDataFormFieldError,
44
+ getWorkbenchStructuredDataFormFields,
45
+ getWorkbenchStructuredDataSchemaDocumentColumnDefinition,
46
+ getWorkbenchStructuredDataSchemaDocumentColumnLabel,
47
+ getWorkbenchStructuredDataSchemaDocumentFieldDefinition,
48
+ getWorkbenchStructuredDataSchemaDocumentFieldLabel,
49
+ getWorkbenchStructuredDataSchemaDocumentPanelData,
50
+ getWorkbenchStructuredDataSchemaDocumentSectionValue,
51
+ getWorkbenchStructuredDataSchemaDocumentSections,
52
+ getWorkbenchStructuredDataSchemaDocumentTableColumns,
53
+ getWorkbenchStructuredDataSchemaDocumentTableDefinition,
54
+ getWorkbenchStructuredDataSchemaFieldDataPath,
55
+ getWorkbenchStructuredDataSchemaFieldControl,
56
+ getWorkbenchStructuredDataSchemaFieldDefaultValue,
57
+ getWorkbenchStructuredDataSchemaFieldDescription,
58
+ getWorkbenchStructuredDataSchemaFieldDefinition,
59
+ getWorkbenchStructuredDataSchemaSectionAnchorId,
60
+ getWorkbenchStructuredDataSchemaSectionId,
61
+ getWorkbenchStructuredDataSchemaSectionPath,
62
+ getWorkbenchStructuredDataSchemaTableCellPath,
63
+ getWorkbenchStructuredDataSchemaTableColumns,
64
+ getWorkbenchStructuredDataSchemaTablePath,
65
+ getWorkbenchStructuredDataSchemaTableRowKey,
66
+ getWorkbenchStructuredDataSchemaTableRows,
67
+ getWorkbenchStructuredDataValue,
68
+ isWorkbenchStructuredDataFormSubmittable,
69
+ normalizeWorkbenchStructuredDataFormData,
70
+ removeWorkbenchStructuredDataSchemaTableRow,
71
+ setWorkbenchStructuredDataPathOrRootValue,
72
+ setWorkbenchStructuredDataValue,
73
+ slugWorkbenchStructuredDataSchemaAnchor,
74
+ stringifyWorkbenchStructuredDataSchemaFieldValue,
75
+ } from './StructuredDataForm';
76
+ export type {
77
+ WorkbenchStructuredDataFieldType,
78
+ WorkbenchStructuredDataFieldValue,
79
+ WorkbenchStructuredDataFormCancelContext,
80
+ WorkbenchStructuredDataFormCheckboxField,
81
+ WorkbenchStructuredDataFormErrors,
82
+ WorkbenchStructuredDataFormField,
83
+ WorkbenchStructuredDataFormFieldBase,
84
+ WorkbenchStructuredDataFormFieldChangeContext,
85
+ WorkbenchStructuredDataFormNumberField,
86
+ WorkbenchStructuredDataFormOption,
87
+ WorkbenchStructuredDataFormProps,
88
+ WorkbenchStructuredDataFormSection,
89
+ WorkbenchStructuredDataFormSelectField,
90
+ WorkbenchStructuredDataFormSubmitContext,
91
+ WorkbenchStructuredDataFormTextArrayField,
92
+ WorkbenchStructuredDataFormTextField,
93
+ WorkbenchStructuredDataTextArrayInputProps,
94
+ WorkbenchStructuredDataPath,
95
+ WorkbenchStructuredDataRecord,
96
+ WorkbenchStructuredDataSchemaDocument,
97
+ WorkbenchStructuredDataSchemaFieldControl,
98
+ WorkbenchStructuredDataSchemaFieldDefinition,
99
+ WorkbenchStructuredDataSchemaFieldInputProps,
100
+ WorkbenchStructuredDataSchemaSectionAliases,
101
+ WorkbenchStructuredDataSchemaSectionSummary,
102
+ WorkbenchStructuredDataSchemaTableColumnInput,
103
+ WorkbenchStructuredDataSchemaTableDefinition,
104
+ WorkbenchStructuredDataSchemaTableRowKeyInput,
105
+ WorkbenchStructuredDataTable,
106
+ WorkbenchStructuredDataTableCellContext,
107
+ WorkbenchStructuredDataTableColumn,
108
+ WorkbenchStructuredDataTableRow,
109
+ } from './StructuredDataForm';
110
+ export {
111
+ WorkbenchSchemaForm,
112
+ coerceWorkbenchSchemaFormFieldValue,
113
+ getWorkbenchSchemaFormErrors,
114
+ getWorkbenchSchemaFormFieldDefaultValue,
115
+ getWorkbenchSchemaFormFieldError,
116
+ isWorkbenchSchemaFormSubmittable,
117
+ normalizeWorkbenchSchemaFormValues,
118
+ } from './SchemaForm';
119
+ export type {
120
+ WorkbenchSchemaFormCancelContext,
121
+ WorkbenchSchemaFormCheckboxField,
122
+ WorkbenchSchemaFormErrors,
123
+ WorkbenchSchemaFormField,
124
+ WorkbenchSchemaFormFieldBase,
125
+ WorkbenchSchemaFormFieldChangeContext,
126
+ WorkbenchSchemaFormFieldType,
127
+ WorkbenchSchemaFormFieldValue,
128
+ WorkbenchSchemaFormNumberField,
129
+ WorkbenchSchemaFormOption,
130
+ WorkbenchSchemaFormProps,
131
+ WorkbenchSchemaFormSelectField,
132
+ WorkbenchSchemaFormSubmitContext,
133
+ WorkbenchSchemaFormTextField,
134
+ WorkbenchSchemaFormValues,
135
+ } from './SchemaForm';
1
136
  export { WorkbenchSettingsModal } from './WorkbenchSettingsModal';
2
137
  export type { WorkbenchSettingsModalProps } from './WorkbenchSettingsModal';
3
138
  export { WorkbenchSettingsNav } from './WorkbenchSettingsNav';
@@ -0,0 +1,21 @@
1
+ .ui-workbench-panel-region {
2
+ min-width: 0;
3
+ min-height: 0;
4
+ margin: 0;
5
+ }
6
+
7
+ .ui-workbench-panel-region--scroll {
8
+ display: flex;
9
+ flex-direction: column;
10
+ gap: 22px;
11
+ padding: 18px 16px 28px;
12
+ }
13
+
14
+ .ui-workbench-panel-region--fill {
15
+ display: grid;
16
+ grid-template-rows: minmax(0, 1fr);
17
+ align-content: stretch;
18
+ gap: 0;
19
+ overflow: hidden;
20
+ padding: 0;
21
+ }
@@ -0,0 +1,143 @@
1
+ export const WORKBENCH_SECTIONED_PANEL_SCROLL_SPY_OFFSET = 24;
2
+ export const WORKBENCH_SECTIONED_PANEL_SCROLL_THRESHOLD = 2;
3
+
4
+ export interface WorkbenchSectionedPanelIntersectionEntry {
5
+ intersectionRatio: number;
6
+ isIntersecting: boolean;
7
+ target: { id: string };
8
+ }
9
+
10
+ export interface WorkbenchSectionedPanelScrollPosition {
11
+ anchorId: string;
12
+ top: number;
13
+ }
14
+
15
+ export function isWorkbenchSectionedPanelScrollable({
16
+ clientHeight,
17
+ scrollHeight,
18
+ threshold = WORKBENCH_SECTIONED_PANEL_SCROLL_THRESHOLD,
19
+ }: {
20
+ clientHeight: number;
21
+ scrollHeight: number;
22
+ threshold?: number;
23
+ }): boolean {
24
+ return scrollHeight > clientHeight + threshold;
25
+ }
26
+
27
+ export function isWorkbenchSectionedPanelAtScrollTop({
28
+ scrollTop,
29
+ topThreshold = WORKBENCH_SECTIONED_PANEL_SCROLL_THRESHOLD,
30
+ }: {
31
+ scrollTop: number;
32
+ topThreshold?: number;
33
+ }): boolean {
34
+ return scrollTop <= topThreshold;
35
+ }
36
+
37
+ export function isWorkbenchSectionedPanelAtScrollBottom({
38
+ bottomThreshold = WORKBENCH_SECTIONED_PANEL_SCROLL_THRESHOLD,
39
+ clientHeight,
40
+ scrollHeight,
41
+ scrollTop,
42
+ }: {
43
+ bottomThreshold?: number;
44
+ clientHeight: number;
45
+ scrollHeight: number;
46
+ scrollTop: number;
47
+ }): boolean {
48
+ return scrollTop + clientHeight >= scrollHeight - bottomThreshold;
49
+ }
50
+
51
+ export function resolveWorkbenchSectionedPanelActiveAnchorFromIntersection({
52
+ anchorOrder,
53
+ entries,
54
+ fallbackAnchorId,
55
+ }: {
56
+ anchorOrder: readonly string[];
57
+ entries: readonly WorkbenchSectionedPanelIntersectionEntry[];
58
+ fallbackAnchorId?: string | undefined;
59
+ }): string | undefined {
60
+ const intersectingAnchorIds = new Set(
61
+ entries
62
+ .filter((entry) => entry.isIntersecting && entry.target.id)
63
+ .map((entry) => entry.target.id),
64
+ );
65
+
66
+ if (intersectingAnchorIds.size === 0) {
67
+ return fallbackAnchorId;
68
+ }
69
+
70
+ let nextActive = fallbackAnchorId;
71
+
72
+ for (const anchorId of anchorOrder) {
73
+ if (intersectingAnchorIds.has(anchorId)) {
74
+ nextActive = anchorId;
75
+ }
76
+ }
77
+
78
+ return nextActive ?? fallbackAnchorId;
79
+ }
80
+
81
+ export function resolveWorkbenchSectionedPanelActiveAnchorFromScroll({
82
+ anchorOrder,
83
+ clientHeight,
84
+ fallbackAnchorId,
85
+ offset = WORKBENCH_SECTIONED_PANEL_SCROLL_SPY_OFFSET,
86
+ scrollHeight,
87
+ scrollTop,
88
+ sectionPositions,
89
+ }: {
90
+ anchorOrder: readonly string[];
91
+ clientHeight: number;
92
+ fallbackAnchorId?: string | undefined;
93
+ offset?: number;
94
+ scrollHeight: number;
95
+ scrollTop: number;
96
+ sectionPositions: readonly WorkbenchSectionedPanelScrollPosition[];
97
+ }): string | undefined {
98
+ if (sectionPositions.length === 0) return fallbackAnchorId;
99
+
100
+ const firstAnchorId = anchorOrder[0];
101
+ const lastAnchorId = anchorOrder[anchorOrder.length - 1];
102
+
103
+ if (isWorkbenchSectionedPanelAtScrollTop({ scrollTop })) {
104
+ return firstAnchorId ?? fallbackAnchorId;
105
+ }
106
+
107
+ if (
108
+ isWorkbenchSectionedPanelAtScrollBottom({
109
+ clientHeight,
110
+ scrollHeight,
111
+ scrollTop,
112
+ })
113
+ ) {
114
+ return lastAnchorId ?? fallbackAnchorId;
115
+ }
116
+
117
+ const activeLine = scrollTop + offset;
118
+ let nextActive = fallbackAnchorId;
119
+
120
+ for (const section of sectionPositions) {
121
+ if (section.top <= activeLine) {
122
+ nextActive = section.anchorId;
123
+ }
124
+ }
125
+
126
+ return nextActive ?? fallbackAnchorId;
127
+ }
128
+
129
+ export function resolveWorkbenchSectionedPanelScrollTop({
130
+ offset = WORKBENCH_SECTIONED_PANEL_SCROLL_SPY_OFFSET,
131
+ sectionTop,
132
+ }: {
133
+ offset?: number;
134
+ sectionTop: number;
135
+ }): number {
136
+ return Math.max(0, sectionTop - offset);
137
+ }
138
+
139
+ export function createWorkbenchSectionedPanelIntersectionRootMargin(
140
+ offset = WORKBENCH_SECTIONED_PANEL_SCROLL_SPY_OFFSET,
141
+ ) {
142
+ return `-${offset}px 0px -55% 0px`;
143
+ }