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

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
@@ -1,3 +1,10 @@
1
+ import { cxCodicon } from '../../utils/codicon';
2
+ import {
3
+ JDW_DOCUMENT_MIME,
4
+ JDW_SCHEMA_DOCUMENT_MIME,
5
+ isJdwDocumentPath,
6
+ isJdwSchemaDocumentPath,
7
+ } from '../../jdw/document';
1
8
  import { extensionOfPath, fileNameOfPath } from './path';
2
9
 
3
10
  export type WorkspaceFileIconKind =
@@ -10,12 +17,15 @@ export type WorkspaceFileIconKind =
10
17
  | 'git'
11
18
  | 'html'
12
19
  | 'image'
20
+ | 'jdw'
21
+ | 'jdw-schema'
13
22
  | 'javascript'
14
23
  | 'json'
15
24
  | 'lock'
16
25
  | 'markdown'
17
26
  | 'package'
18
27
  | 'pdf'
28
+ | 'schema'
19
29
  | 'sql'
20
30
  | 'text'
21
31
  | 'typescript'
@@ -31,6 +41,9 @@ export function fileIconKindForPath(path: string, mimeType?: string): WorkspaceF
31
41
  if (fileName.endsWith('.lock') || fileName.includes('lock')) return 'lock';
32
42
  if (fileName.startsWith('.env')) return 'env';
33
43
  if (fileName.startsWith('.git')) return 'git';
44
+ if (isJdwSchemaDocumentPath(path) || mimeType === JDW_SCHEMA_DOCUMENT_MIME) return 'jdw-schema';
45
+ if (isJdwDocumentPath(path) || mimeType === JDW_DOCUMENT_MIME) return 'jdw';
46
+ if (fileName.endsWith('.schema.json') || mimeType === 'application/schema+json') return 'schema';
34
47
  if (mimeType?.startsWith('image/')) return 'image';
35
48
  if (mimeType === 'application/pdf' || extension === 'pdf') return 'pdf';
36
49
 
@@ -103,6 +116,10 @@ export function codiconForFileKind(kind: WorkspaceFileIconKind) {
103
116
  return 'codicon-code';
104
117
  case 'image':
105
118
  return 'codicon-file-media';
119
+ case 'jdw':
120
+ return 'codicon-layout';
121
+ case 'jdw-schema':
122
+ return 'codicon-symbol-property';
106
123
  case 'javascript':
107
124
  return 'codicon-symbol-method';
108
125
  case 'json':
@@ -115,6 +132,8 @@ export function codiconForFileKind(kind: WorkspaceFileIconKind) {
115
132
  return 'codicon-package';
116
133
  case 'pdf':
117
134
  return 'codicon-file-pdf';
135
+ case 'schema':
136
+ return 'codicon-symbol-property';
118
137
  case 'sql':
119
138
  return 'codicon-database';
120
139
  case 'text':
@@ -133,17 +152,28 @@ export function codiconForFileKind(kind: WorkspaceFileIconKind) {
133
152
  }
134
153
 
135
154
  export interface WorkspaceFileIconProps {
155
+ className?: string;
136
156
  directory?: boolean;
137
157
  expanded?: boolean;
138
158
  mimeType?: string;
139
159
  path: string;
140
160
  }
141
161
 
142
- export function WorkspaceFileIcon({ directory, expanded, mimeType, path }: WorkspaceFileIconProps) {
162
+ export function WorkspaceFileIcon({
163
+ className,
164
+ directory,
165
+ expanded,
166
+ mimeType,
167
+ path,
168
+ }: WorkspaceFileIconProps) {
143
169
  const kind = directory ? 'folder' : fileIconKindForPath(path, mimeType);
144
170
  const icon = directory && expanded ? 'codicon-folder-opened' : codiconForFileKind(kind);
145
171
 
146
172
  return (
147
- <i aria-hidden="true" className={`codicon ${icon} workspace-file-icon`} data-file-kind={kind} />
173
+ <i
174
+ aria-hidden="true"
175
+ className={cxCodicon(icon, 'workspace-file-icon', className)}
176
+ data-file-kind={kind}
177
+ />
148
178
  );
149
179
  }
@@ -1,113 +1,113 @@
1
- import type { KeyboardEvent, MouseEvent, ReactNode } from 'react';
2
- import { SideBarHeaderControl, SideBarViewFrame } from '../../layout/SideBarViewFrame';
3
- import { Badge } from '../../primitives/Badge';
4
- import { EmptyState } from '../../primitives/EmptyState';
5
- import { IconButton } from '../../primitives/IconButton';
6
- import { TextInput } from '../../primitives/TextInput';
7
- import { Toolbar } from '../../primitives/Toolbar';
8
- import { WorkspaceSearchResults } from './WorkspaceSearchResults';
9
- import type { WorkspaceSearchResult } from './types';
10
-
11
- export interface WorkspaceSearchPanelProps {
12
- activePath?: string;
13
- compactRows?: boolean;
14
- emptyQueryLabel?: ReactNode;
15
- noResultsLabel?: ReactNode;
16
- onActivateResult: (result: WorkspaceSearchResult) => void;
17
- onQueryChange: (query: string) => void;
18
- onRefresh?: () => void;
19
- onResultContextMenu?: (event: MouseEvent<HTMLElement>, result: WorkspaceSearchResult) => void;
20
- placeholder?: string;
21
- query: string;
22
- results: WorkspaceSearchResult[];
23
- searchLabel?: string;
24
- title?: ReactNode;
25
- }
26
-
27
- export function WorkspaceSearchPanel({
28
- activePath,
29
- compactRows,
30
- emptyQueryLabel = 'Type to search files',
31
- noResultsLabel = 'No results',
32
- onActivateResult,
33
- onQueryChange,
34
- onRefresh,
35
- onResultContextMenu,
36
- placeholder = 'Search',
37
- query,
38
- results,
39
- searchLabel = 'Search workspace',
40
- title = 'Search',
41
- }: WorkspaceSearchPanelProps) {
42
- const hasQuery = Boolean(query.trim());
43
- const visibleResults = hasQuery ? results : [];
44
- const resultLabel = `${visibleResults.length} ${visibleResults.length === 1 ? 'result' : 'results'}`;
45
-
46
- const handleQueryKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {
47
- if (event.key === 'Enter') {
48
- if (visibleResults[0]) {
49
- event.preventDefault();
50
- onActivateResult(visibleResults[0]);
51
- }
52
- return;
53
- }
54
-
55
- if (event.key === 'Escape' && query) {
56
- event.preventDefault();
57
- onQueryChange('');
58
- }
59
- };
60
-
61
- return (
62
- <SideBarViewFrame
63
- title={title}
64
- actions={
65
- <Toolbar>
66
- <Badge variant="muted">{resultLabel}</Badge>
67
- {onRefresh ? (
68
- <IconButton icon="codicon-refresh" label="Refresh results" onClick={onRefresh} />
69
- ) : null}
70
- </Toolbar>
71
- }
72
- headerAddon={
73
- <SideBarHeaderControl>
74
- <div className="workbench-search-control">
75
- <TextInput
76
- aria-label={searchLabel}
77
- controlWidth="full"
78
- placeholder={placeholder}
79
- value={query}
80
- onChange={(event) => onQueryChange(event.currentTarget.value)}
81
- onKeyDown={handleQueryKeyDown}
82
- />
83
- <IconButton
84
- disabled={!query}
85
- icon="codicon-close"
86
- label="Clear search"
87
- onClick={() => onQueryChange('')}
88
- />
89
- </div>
90
- </SideBarHeaderControl>
91
- }
92
- >
93
- {!hasQuery ? (
94
- <EmptyState compact icon="codicon-search">
95
- {emptyQueryLabel}
96
- </EmptyState>
97
- ) : visibleResults.length > 0 ? (
98
- <WorkspaceSearchResults
99
- activePath={activePath}
100
- compactRows={compactRows}
101
- query={query}
102
- results={visibleResults}
103
- onActivateResult={onActivateResult}
104
- onResultContextMenu={onResultContextMenu}
105
- />
106
- ) : (
107
- <EmptyState compact icon="codicon-search">
108
- {noResultsLabel}
109
- </EmptyState>
110
- )}
111
- </SideBarViewFrame>
112
- );
113
- }
1
+ import type { KeyboardEvent, MouseEvent, ReactNode } from 'react';
2
+ import { SideBarHeaderControl, SideBarViewFrame } from '../../layout/SideBarViewFrame';
3
+ import { Badge } from '../../primitives/Badge';
4
+ import { EmptyState } from '../../primitives/EmptyState';
5
+ import { IconButton } from '../../primitives/IconButton';
6
+ import { TextInput } from '../../primitives/TextInput';
7
+ import { Toolbar } from '../../primitives/Toolbar';
8
+ import { WorkspaceSearchResults } from './WorkspaceSearchResults';
9
+ import type { WorkspaceSearchResult } from './types';
10
+
11
+ export interface WorkspaceSearchPanelProps {
12
+ activePath?: string;
13
+ compactRows?: boolean;
14
+ emptyQueryLabel?: ReactNode;
15
+ noResultsLabel?: ReactNode;
16
+ onActivateResult: (result: WorkspaceSearchResult) => void;
17
+ onQueryChange: (query: string) => void;
18
+ onRefresh?: () => void;
19
+ onResultContextMenu?: (event: MouseEvent<HTMLElement>, result: WorkspaceSearchResult) => void;
20
+ placeholder?: string;
21
+ query: string;
22
+ results: WorkspaceSearchResult[];
23
+ searchLabel?: string;
24
+ title?: ReactNode;
25
+ }
26
+
27
+ export function WorkspaceSearchPanel({
28
+ activePath,
29
+ compactRows,
30
+ emptyQueryLabel = 'Type to search files',
31
+ noResultsLabel = 'No results',
32
+ onActivateResult,
33
+ onQueryChange,
34
+ onRefresh,
35
+ onResultContextMenu,
36
+ placeholder = 'Search',
37
+ query,
38
+ results,
39
+ searchLabel = 'Search workspace',
40
+ title = 'Search',
41
+ }: WorkspaceSearchPanelProps) {
42
+ const hasQuery = Boolean(query.trim());
43
+ const visibleResults = hasQuery ? results : [];
44
+ const resultLabel = `${visibleResults.length} ${visibleResults.length === 1 ? 'result' : 'results'}`;
45
+
46
+ const handleQueryKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {
47
+ if (event.key === 'Enter') {
48
+ if (visibleResults[0]) {
49
+ event.preventDefault();
50
+ onActivateResult(visibleResults[0]);
51
+ }
52
+ return;
53
+ }
54
+
55
+ if (event.key === 'Escape' && query) {
56
+ event.preventDefault();
57
+ onQueryChange('');
58
+ }
59
+ };
60
+
61
+ return (
62
+ <SideBarViewFrame
63
+ title={title}
64
+ actions={
65
+ <Toolbar>
66
+ <Badge variant="muted">{resultLabel}</Badge>
67
+ {onRefresh ? (
68
+ <IconButton icon="codicon-refresh" label="Refresh results" onClick={onRefresh} />
69
+ ) : null}
70
+ </Toolbar>
71
+ }
72
+ headerAddon={
73
+ <SideBarHeaderControl>
74
+ <div className="workbench-search-control">
75
+ <TextInput
76
+ aria-label={searchLabel}
77
+ controlWidth="full"
78
+ placeholder={placeholder}
79
+ value={query}
80
+ onChange={(event) => onQueryChange(event.currentTarget.value)}
81
+ onKeyDown={handleQueryKeyDown}
82
+ />
83
+ <IconButton
84
+ disabled={!query}
85
+ icon="codicon-close"
86
+ label="Clear search"
87
+ onClick={() => onQueryChange('')}
88
+ />
89
+ </div>
90
+ </SideBarHeaderControl>
91
+ }
92
+ >
93
+ {!hasQuery ? (
94
+ <EmptyState compact icon="codicon-search">
95
+ {emptyQueryLabel}
96
+ </EmptyState>
97
+ ) : visibleResults.length > 0 ? (
98
+ <WorkspaceSearchResults
99
+ activePath={activePath}
100
+ compactRows={compactRows}
101
+ query={query}
102
+ results={visibleResults}
103
+ onActivateResult={onActivateResult}
104
+ onResultContextMenu={onResultContextMenu}
105
+ />
106
+ ) : (
107
+ <EmptyState compact icon="codicon-search">
108
+ {noResultsLabel}
109
+ </EmptyState>
110
+ )}
111
+ </SideBarViewFrame>
112
+ );
113
+ }
@@ -1,47 +1,47 @@
1
- import type { MouseEvent } from 'react';
2
- import { SideBarList, SideBarListItem } from '../../layout/SideBarViewFrame';
3
- import { WorkspaceFileIcon } from './WorkspaceFileIcon';
4
- import { WorkspaceHighlightedText } from './WorkspaceHighlightedText';
5
- import type { WorkspaceSearchResult } from './types';
6
-
7
- export interface WorkspaceSearchResultsProps {
8
- activePath?: string;
9
- compactRows?: boolean;
10
- onActivateResult: (result: WorkspaceSearchResult) => void;
11
- onResultContextMenu?: (event: MouseEvent<HTMLElement>, result: WorkspaceSearchResult) => void;
12
- query: string;
13
- results: WorkspaceSearchResult[];
14
- }
15
-
16
- export function WorkspaceSearchResults({
17
- activePath,
18
- compactRows,
19
- onActivateResult,
20
- onResultContextMenu,
21
- query,
22
- results,
23
- }: WorkspaceSearchResultsProps) {
24
- return (
25
- <SideBarList fill aria-label="Search results">
26
- {results.map((result) => (
27
- <SideBarListItem
28
- key={result.id}
29
- active={activePath === result.path}
30
- style={compactRows ? { minHeight: 46 } : undefined}
31
- variant="stacked"
32
- onClick={() => onActivateResult(result)}
33
- onContextMenu={(event) => onResultContextMenu?.(event, result)}
34
- >
35
- <strong>
36
- <WorkspaceFileIcon mimeType={result.file.mimeType} path={result.path} />
37
- <WorkspaceHighlightedText query={query} text={result.path} />
38
- </strong>
39
- <span>
40
- Line {result.line}: <WorkspaceHighlightedText query={query} text={result.preview} />
41
- </span>
42
- </SideBarListItem>
43
- ))}
44
- {results.length === 0 ? <SideBarListItem disabled>No results</SideBarListItem> : null}
45
- </SideBarList>
46
- );
47
- }
1
+ import type { MouseEvent } from 'react';
2
+ import { SideBarList, SideBarListItem } from '../../layout/SideBarViewFrame';
3
+ import { WorkspaceFileIcon } from './WorkspaceFileIcon';
4
+ import { WorkspaceHighlightedText } from './WorkspaceHighlightedText';
5
+ import type { WorkspaceSearchResult } from './types';
6
+
7
+ export interface WorkspaceSearchResultsProps {
8
+ activePath?: string;
9
+ compactRows?: boolean;
10
+ onActivateResult: (result: WorkspaceSearchResult) => void;
11
+ onResultContextMenu?: (event: MouseEvent<HTMLElement>, result: WorkspaceSearchResult) => void;
12
+ query: string;
13
+ results: WorkspaceSearchResult[];
14
+ }
15
+
16
+ export function WorkspaceSearchResults({
17
+ activePath,
18
+ compactRows,
19
+ onActivateResult,
20
+ onResultContextMenu,
21
+ query,
22
+ results,
23
+ }: WorkspaceSearchResultsProps) {
24
+ return (
25
+ <SideBarList fill aria-label="Search results">
26
+ {results.map((result) => (
27
+ <SideBarListItem
28
+ key={result.id}
29
+ active={activePath === result.path}
30
+ style={compactRows ? { minHeight: 46 } : undefined}
31
+ variant="stacked"
32
+ onClick={() => onActivateResult(result)}
33
+ onContextMenu={(event) => onResultContextMenu?.(event, result)}
34
+ >
35
+ <strong>
36
+ <WorkspaceFileIcon mimeType={result.file.mimeType} path={result.path} />
37
+ <WorkspaceHighlightedText query={query} text={result.path} />
38
+ </strong>
39
+ <span>
40
+ Line {result.line}: <WorkspaceHighlightedText query={query} text={result.preview} />
41
+ </span>
42
+ </SideBarListItem>
43
+ ))}
44
+ {results.length === 0 ? <SideBarListItem disabled>No results</SideBarListItem> : null}
45
+ </SideBarList>
46
+ );
47
+ }
@@ -1,98 +1,156 @@
1
- export { WorkspaceEditor, languageForFile, monacoThemeForWorkspaceTheme } from './WorkspaceEditor';
2
- export type { WorkspaceEditorProps, WorkspaceEditorTheme } from './WorkspaceEditor';
3
- export { WorkspaceEditorPanel } from './WorkspaceEditorPanel';
4
- export type { WorkspaceEditorPanelProps } from './WorkspaceEditorPanel';
5
- export {
6
- WORKSPACE_EXPLORER_DRAG_DATA_TYPE,
7
- WORKSPACE_EXPLORER_DRAG_METADATA_DATA_TYPE,
8
- WorkspaceExplorer,
9
- } from './WorkspaceExplorer';
10
- export type {
11
- WorkspaceExplorerItemActionMeta,
12
- WorkspaceExplorerItemContextMenuMeta,
13
- WorkspaceExplorerItemKeyboardActionMeta,
14
- WorkspaceExplorerInlineEditCommitMeta,
15
- WorkspaceExplorerDragMetadataContext,
16
- WorkspaceExplorerDragMetadataFactory,
17
- WorkspaceExplorerInlineEditKind,
18
- WorkspaceExplorerInlineEditState,
19
- WorkspaceExplorerMoveRequestMeta,
20
- WorkspaceExplorerProps,
21
- WorkspaceExplorerSelectionChangeMeta,
22
- } from './WorkspaceExplorer';
23
- export { WorkspaceFileIcon, codiconForFileKind, fileIconKindForPath } from './WorkspaceFileIcon';
24
- export type { WorkspaceFileIconKind, WorkspaceFileIconProps } from './WorkspaceFileIcon';
25
- export { WorkspaceHighlightedText } from './WorkspaceHighlightedText';
26
- export type { WorkspaceHighlightedTextProps } from './WorkspaceHighlightedText';
27
- export { WorkspaceSearchPanel } from './WorkspaceSearchPanel';
28
- export type { WorkspaceSearchPanelProps } from './WorkspaceSearchPanel';
29
- export { WorkspaceSearchResults } from './WorkspaceSearchResults';
30
- export type { WorkspaceSearchResultsProps } from './WorkspaceSearchResults';
31
- export {
32
- extensionOfPath,
33
- fileNameOfPath,
34
- isSimpleWorkspaceName,
35
- joinWorkspacePath,
36
- normalizeWorkspacePath,
37
- parentPathOf,
38
- parentPathsOf,
39
- workspacePathSegments,
40
- } from './path';
41
- export {
42
- createWorkspaceFileDraft,
43
- discardWorkspaceFileDraft,
44
- isWorkspaceFileDraftDirty,
45
- resolveWorkspaceFileDraft,
46
- saveWorkspaceFileDraft,
47
- updateWorkspaceFileDraft,
48
- type DiscardWorkspaceFileDraftInput,
49
- type ResolveWorkspaceFileDraftInput,
50
- type SaveWorkspaceFileDraftInput,
51
- type UpdateWorkspaceFileDraftInput,
52
- type WorkspaceFileDraft,
53
- type WorkspaceFileDraftMap,
54
- } from '@workbench-kit/workspace';
55
- export { compactText, createContentPreview, highlightText, searchWorkspaceFiles } from './search';
56
- export {
57
- getWorkspaceSelectionActionPaths,
58
- getWorkspaceSelectionRange,
59
- normalizeWorkspaceSelectionPaths,
60
- pruneWorkspaceSelection,
61
- updateWorkspaceSelection,
62
- type UpdateWorkspaceSelectionInput,
63
- type WorkspaceSelectionActionPathsInput,
64
- type WorkspaceSelectionMode,
65
- type WorkspaceSelectionState,
66
- } from '@workbench-kit/workspace';
67
- export { buildWorkspaceTree, flattenWorkspaceTree } from './tree';
68
- export {
69
- getAvailableWorkspaceEntryName,
70
- getWorkspaceFileMovePlan,
71
- initializeVirtualWorkspaceState,
72
- isWorkspaceEntryPathAvailable,
73
- useVirtualWorkspace,
74
- virtualWorkspaceReducer,
75
- } from './useVirtualWorkspace';
76
- export type {
77
- CreateWorkspaceFileInput,
78
- VirtualWorkspaceAction,
79
- VirtualWorkspaceApi,
80
- VirtualWorkspaceInitialState,
81
- VirtualWorkspaceState,
82
- WorkspaceEntryNameSuggestionInput,
83
- WorkspaceEntryPathAvailabilityInput,
84
- WorkspaceFileMove,
85
- WorkspaceFileMovePlan,
86
- WorkspaceFileMovePlanInput,
87
- WriteWorkspaceFileInput,
88
- } from './useVirtualWorkspace';
89
- export type {
90
- VisibleWorkspaceNode,
91
- WorkspaceFile,
92
- WorkspaceFileSource,
93
- WorkspaceHighlightPart,
94
- WorkspaceNodeType,
95
- WorkspaceSearchMatchKind,
96
- WorkspaceSearchResult,
97
- WorkspaceTreeNode,
98
- } from './types';
1
+ export { mimeTypeForPath } from './mimeType';
2
+ export {
3
+ WorkspaceEditor,
4
+ MONACO_DARK_THEME_ID,
5
+ MONACO_LIGHT_THEME_ID,
6
+ defineMonacoWorkbenchTheme,
7
+ languageForFile,
8
+ monacoThemeForWorkspaceTheme,
9
+ } from './WorkspaceEditor';
10
+ export type { WorkspaceEditorProps, WorkspaceEditorTheme } from './WorkspaceEditor';
11
+ export { WorkspaceEditorPanel } from './WorkspaceEditorPanel';
12
+ export type {
13
+ WorkspaceEditorPanelProps,
14
+ WorkspaceEditorPanelRenderEditor,
15
+ WorkspaceEditorPanelRenderEditorContext,
16
+ WorkspaceEditorPanelRenderTabActions,
17
+ WorkspaceEditorPanelRenderTabActionsContext,
18
+ } from './WorkspaceEditorPanel';
19
+ export {
20
+ WORKSPACE_EXPLORER_DRAG_DATA_TYPE,
21
+ WORKSPACE_EXPLORER_DRAG_METADATA_DATA_TYPE,
22
+ WorkspaceExplorer,
23
+ } from './WorkspaceExplorer';
24
+ export type {
25
+ WorkspaceExplorerItemActionMeta,
26
+ WorkspaceExplorerItemContextMenuMeta,
27
+ WorkspaceExplorerItemKeyboardActionMeta,
28
+ WorkspaceExplorerInlineEditCommitMeta,
29
+ WorkspaceExplorerDragMetadataContext,
30
+ WorkspaceExplorerDragMetadataFactory,
31
+ WorkspaceExplorerInlineEditKind,
32
+ WorkspaceExplorerInlineEditState,
33
+ WorkspaceExplorerMoveRequestMeta,
34
+ WorkspaceExplorerProps,
35
+ WorkspaceExplorerSelectionChangeMeta,
36
+ } from './WorkspaceExplorer';
37
+ export { WorkspaceFileIcon, codiconForFileKind, fileIconKindForPath } from './WorkspaceFileIcon';
38
+ export type { WorkspaceFileIconKind, WorkspaceFileIconProps } from './WorkspaceFileIcon';
39
+ export { WorkspaceHighlightedText } from './WorkspaceHighlightedText';
40
+ export type { WorkspaceHighlightedTextProps } from './WorkspaceHighlightedText';
41
+ export {
42
+ WorkbenchMultiProviderExplorer,
43
+ collectWorkbenchExplorerEntryRefs,
44
+ countWorkbenchExplorerEntries,
45
+ flattenWorkbenchExplorerProviders,
46
+ getWorkbenchExplorerEntryContext,
47
+ getWorkbenchExplorerEntryKey,
48
+ getWorkbenchExplorerProviderEntryCount,
49
+ isWorkbenchExplorerActionDisabled,
50
+ isWorkbenchExplorerEntryDisabled,
51
+ isWorkbenchExplorerEntrySelectable,
52
+ isWorkbenchExplorerProviderDisabled,
53
+ normalizeWorkbenchExplorerEntryKeys,
54
+ } from './MultiProviderExplorer';
55
+ export type {
56
+ WorkbenchExplorerActionDescriptor,
57
+ WorkbenchExplorerEntryContext,
58
+ WorkbenchExplorerEntryContextInput,
59
+ WorkbenchExplorerEntryDescriptor,
60
+ WorkbenchExplorerEntryKind,
61
+ WorkbenchExplorerEntryRef,
62
+ WorkbenchExplorerEntrySelectContext,
63
+ WorkbenchExplorerEntryToggleContext,
64
+ WorkbenchExplorerFlattenedEntry,
65
+ WorkbenchExplorerProviderActionContext,
66
+ WorkbenchExplorerProviderCollapseContext,
67
+ WorkbenchExplorerProviderDescriptor,
68
+ WorkbenchExplorerProviderKind,
69
+ WorkbenchMultiProviderExplorerProps,
70
+ } from './MultiProviderExplorer';
71
+ export { WorkspaceSearchPanel } from './WorkspaceSearchPanel';
72
+ export type { WorkspaceSearchPanelProps } from './WorkspaceSearchPanel';
73
+ export { WorkspaceSearchResults } from './WorkspaceSearchResults';
74
+ export type { WorkspaceSearchResultsProps } from './WorkspaceSearchResults';
75
+ export {
76
+ extensionOfPath,
77
+ fileNameOfPath,
78
+ isSimpleWorkspaceName,
79
+ joinWorkspacePath,
80
+ normalizeWorkspacePath,
81
+ parentPathOf,
82
+ parentPathsOf,
83
+ workspacePathSegments,
84
+ } from './path';
85
+ export {
86
+ createWorkspaceFileDraft,
87
+ discardWorkspaceFileDraft,
88
+ isWorkspaceFileDraftDirty,
89
+ resolveWorkspaceFileDraft,
90
+ saveWorkspaceFileDraft,
91
+ updateWorkspaceFileDraft,
92
+ type DiscardWorkspaceFileDraftInput,
93
+ type ResolveWorkspaceFileDraftInput,
94
+ type SaveWorkspaceFileDraftInput,
95
+ type UpdateWorkspaceFileDraftInput,
96
+ type WorkspaceFileDraft,
97
+ type WorkspaceFileDraftMap,
98
+ } from '@workbench-kit/workspace';
99
+ export { compactText, createContentPreview, highlightText, searchWorkspaceFiles } from './search';
100
+ export {
101
+ getWorkspaceSelectionActionPaths,
102
+ getWorkspaceSelectionRange,
103
+ normalizeWorkspaceSelectionPaths,
104
+ pruneWorkspaceSelection,
105
+ updateWorkspaceSelection,
106
+ type UpdateWorkspaceSelectionInput,
107
+ type WorkspaceSelectionActionPathsInput,
108
+ type WorkspaceSelectionMode,
109
+ type WorkspaceSelectionState,
110
+ } from '@workbench-kit/workspace';
111
+ export { buildWorkspaceTree, flattenWorkspaceTree } from './tree';
112
+ export {
113
+ getAvailableWorkspaceEntryName,
114
+ getWorkspaceEntryMovePlan,
115
+ getWorkspaceFileMovePlan,
116
+ initializeVirtualWorkspaceState,
117
+ isWorkspaceEntryPathAvailable,
118
+ useVirtualWorkspace,
119
+ virtualWorkspaceReducer,
120
+ } from './useVirtualWorkspace';
121
+ export type {
122
+ CreateWorkspaceFileInput,
123
+ VirtualWorkspaceAction,
124
+ VirtualWorkspaceApi,
125
+ VirtualWorkspaceInitialState,
126
+ VirtualWorkspaceState,
127
+ WorkspaceEntryNameSuggestionInput,
128
+ WorkspaceEntryMove,
129
+ WorkspaceEntryMoveKind,
130
+ WorkspaceEntryMovePlan,
131
+ WorkspaceEntryMovePlanInput,
132
+ WorkspaceEntryPathAvailabilityInput,
133
+ WorkspaceFileMove,
134
+ WorkspaceFileMovePlan,
135
+ WorkspaceFileMovePlanInput,
136
+ WriteWorkspaceFileInput,
137
+ } from './useVirtualWorkspace';
138
+ export type {
139
+ VisibleWorkspaceNode,
140
+ WorkspaceFile,
141
+ WorkspaceFileSource,
142
+ WorkspaceHighlightPart,
143
+ WorkspaceNodeType,
144
+ WorkspaceSearchMatchKind,
145
+ WorkspaceSearchResult,
146
+ WorkspaceTreeNode,
147
+ } from './types';
148
+ export {
149
+ WorkspaceDraftsContext,
150
+ WorkspaceDraftsProvider,
151
+ useWorkspaceDrafts,
152
+ } from './WorkspaceDraftsContext';
153
+ export type {
154
+ WorkspaceDraftsContextValue,
155
+ WorkspaceDraftsProviderProps,
156
+ } from './WorkspaceDraftsContext';