@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.
- package/package.json +33 -9
- package/src/index.ts +545 -43
- package/src/jdw/JdwPreview.tsx +38 -0
- package/src/jdw/JsonCodeEditorPane.tsx +274 -0
- package/src/jdw/builtins/renderBuiltinWidgetLeaf.tsx +29 -0
- package/src/jdw/builtins/renderBuiltinWidgetNode.tsx +126 -0
- package/src/jdw/createBuiltinJdwRegistry.ts +111 -0
- package/src/jdw/cssRenderBackend.tsx +134 -0
- package/src/jdw/document.ts +38 -0
- package/src/jdw/fixtures/jdw-fixtures.ts +52 -0
- package/src/jdw/fixtures/jdw-sample-screens.ts +522 -0
- package/src/jdw/index.ts +45 -0
- package/src/jdw/parse.ts +1 -0
- package/src/jdw/renderJdw.tsx +32 -0
- package/src/json-config/JsonConfigWorkbench.tsx +316 -0
- package/src/json-config/index.ts +6 -0
- package/src/json-config/json-config-editor-state.ts +42 -0
- package/src/layout/Panel.tsx +146 -1
- package/src/layout/SideBarViewFrame.tsx +367 -328
- package/src/layout/WorkbenchCanvas.tsx +849 -0
- package/src/layout/WorkbenchFullscreen.tsx +368 -0
- package/src/layout/WorkbenchLayout.tsx +5 -0
- package/src/layout/WorkbenchLayoutBase.tsx +294 -0
- package/src/layout/WorkbenchPropertyPanel.tsx +497 -0
- package/src/layout/WorkbenchSidebarActions.tsx +274 -0
- package/src/layout/WorkbenchTree.tsx +351 -0
- package/src/layout/layoutHelpers.ts +25 -0
- package/src/modal/ConfirmDialog.tsx +61 -53
- package/src/modal/Modal.tsx +295 -35
- package/src/overlay/ContextMenu.tsx +146 -145
- package/src/primitives/AbsoluteBox.tsx +46 -0
- package/src/primitives/Badge.tsx +12 -12
- package/src/primitives/Button.tsx +44 -14
- package/src/primitives/Checkbox.tsx +11 -5
- package/src/primitives/EmptyState.tsx +27 -26
- package/src/primitives/Field.tsx +38 -38
- package/src/primitives/IconButton.tsx +5 -2
- package/src/primitives/List.tsx +111 -0
- package/src/primitives/NumberInput.tsx +38 -0
- package/src/primitives/ScrollArea.tsx +42 -0
- package/src/primitives/Select.tsx +1 -12
- package/src/primitives/StatusBar.tsx +46 -0
- package/src/primitives/TextArea.tsx +36 -0
- package/src/primitives/TextInput.tsx +11 -2
- package/src/primitives/WorkbenchChrome.tsx +424 -0
- package/src/primitives/WorkbenchEditor.tsx +394 -0
- package/src/primitives/index.ts +105 -0
- package/src/primitives/select/Select.tsx +266 -0
- package/src/primitives/select/index.ts +2 -0
- package/src/primitives/select/options.ts +38 -0
- package/src/primitives/select/overlay.ts +63 -0
- package/src/primitives/select/select.app.css +9 -0
- package/src/primitives/select/select.css +140 -0
- package/src/primitives/select/types.ts +18 -0
- package/src/primitives/styles.css +955 -0
- package/src/scrollbars.css +69 -0
- package/src/styles.css +7738 -1762
- package/src/utils/codicon.ts +17 -0
- package/src/widget-asset/WidgetAssetEditor.tsx +140 -0
- package/src/widget-asset/WidgetAssetMetadataForm.tsx +82 -0
- package/src/widget-asset/WidgetAssetModeControls.tsx +42 -0
- package/src/widget-asset/WidgetAssetSourceEditor.tsx +50 -0
- package/src/widget-asset/WidgetAssetWorkbench.tsx +112 -0
- package/src/widget-asset/index.ts +17 -0
- package/src/widget-asset/widget-asset-document.ts +37 -0
- package/src/widget-asset/widget-asset-mode.ts +3 -0
- package/src/widget-studio/builtin-widget-asset-catalog.ts +12 -0
- package/src/widget-studio/create-widget-studio-workspace-editor.tsx +79 -0
- package/src/widget-studio/index.ts +7 -0
- package/src/widget-studio/resolve-widget-studio-asset-catalog.ts +26 -0
- package/src/widget-tree/WidgetAssetPalette.tsx +77 -0
- package/src/widget-tree/WidgetInspectorPanel.tsx +266 -0
- package/src/widget-tree/WidgetSourceEditor.tsx +56 -0
- package/src/widget-tree/WidgetTreeLab.tsx +272 -0
- package/src/widget-tree/WidgetTreeModeControls.tsx +44 -0
- package/src/widget-tree/WidgetTreeSidePanel.tsx +49 -0
- package/src/widget-tree/WidgetTreeView.tsx +97 -0
- package/src/widget-tree/WidgetTreeWorkbench.tsx +111 -0
- package/src/widget-tree/WidgetTreeWorkspaceShell.tsx +154 -0
- package/src/widget-tree/demo-registry.ts +32 -0
- package/src/widget-tree/demo-widget-assets.ts +4 -0
- package/src/widget-tree/index.ts +27 -0
- package/src/widget-tree/widget-tree-document.ts +20 -0
- package/src/widget-tree/widget-tree-layout.ts +31 -0
- package/src/widget-tree/widget-tree-mode.ts +7 -0
- package/src/widget-tree/widget-tree-play-helpers.ts +74 -0
- package/src/workbench/ActivityBar.tsx +52 -52
- package/src/workbench/ArtifactShell.tsx +397 -0
- package/src/workbench/CommandPalette.tsx +819 -0
- package/src/workbench/ConfirmationFlow.tsx +245 -0
- package/src/workbench/MarkdownPreview.tsx +151 -0
- package/src/workbench/ShortcutCommandBridge.tsx +368 -0
- package/src/workbench/SplitView.tsx +136 -136
- package/src/workbench/StatusBar.tsx +178 -123
- package/src/workbench/StructuredArtifactEditor.tsx +205 -0
- package/src/workbench/Timeline.tsx +302 -0
- package/src/workbench/WorkbenchCanvasShell.tsx +941 -0
- package/src/workbench/WorkbenchShell.tsx +74 -70
- package/src/workbench/WorkbenchStandaloneShell.tsx +318 -291
- package/src/workbench/auth/WorkbenchAuthGate.tsx +61 -0
- package/src/workbench/auth/WorkbenchLoginView.tsx +635 -0
- package/src/workbench/auth/index.ts +19 -0
- package/src/workbench/chat/ChatComposer.tsx +165 -148
- package/src/workbench/chat/ChatMessageItem.tsx +10 -1
- package/src/workbench/chat/index.ts +9 -0
- package/src/workbench/chat/slashCommand.ts +28 -0
- package/src/workbench/chat/useChatRuntimeState.ts +76 -0
- package/src/workbench/chat/useSlashCommandSuggest.ts +101 -0
- package/src/workbench/commands.ts +520 -490
- package/src/workbench/index.ts +443 -98
- package/src/workbench/keyboard.ts +53 -0
- package/src/workbench/schema/index.ts +48 -0
- package/src/workbench/schema/workbenchDocument.ts +31 -0
- package/src/workbench/schema/workbenchDocumentActions.ts +6 -0
- package/src/workbench/schema/workbenchDocumentAdapter.ts +9 -0
- package/src/workbench/schema/workbenchDocumentPatch.ts +13 -0
- package/src/workbench/schema/workbenchDocumentRenderer.tsx +702 -0
- package/src/workbench/settings/NavigationPanel.tsx +47 -0
- package/src/workbench/settings/SchemaForm.tsx +420 -0
- package/src/workbench/settings/SectionedPanel.tsx +415 -0
- package/src/workbench/settings/StructuredDataForm.tsx +539 -0
- package/src/workbench/settings/StructuredDataSchemaPanel.tsx +559 -0
- package/src/workbench/settings/StructuredDataSchemaPanelEmbed.tsx +21 -0
- package/src/workbench/settings/StructuredDataSchemaPanelFrame.tsx +76 -0
- package/src/workbench/settings/StructuredDataTableView.tsx +127 -0
- package/src/workbench/settings/WorkbenchPanelRegion.tsx +46 -0
- package/src/workbench/settings/WorkbenchSettingsModal.tsx +21 -12
- package/src/workbench/settings/WorkbenchSettingsNav.tsx +38 -22
- package/src/workbench/settings/index.ts +135 -0
- package/src/workbench/settings/panel-region.css +21 -0
- package/src/workbench/settings/sectionedPanelScrollSpy.ts +143 -0
- package/src/workbench/settings/structured-data-schema-panel.css +330 -0
- package/src/workbench/settings/structured-data-table-view.css +85 -0
- package/src/workbench/settings/structuredDataSchema.ts +886 -0
- package/src/workbench/shell.ts +15 -0
- package/src/workbench/shellState.ts +203 -203
- package/src/workbench/standalone.ts +101 -94
- package/src/workbench/status.ts +129 -0
- package/src/workbench/theme.ts +44 -0
- package/src/workbench/workspace/MultiProviderExplorer.tsx +625 -0
- package/src/workbench/workspace/WorkspaceDraftsContext.tsx +111 -0
- package/src/workbench/workspace/WorkspaceEditor.tsx +47 -12
- package/src/workbench/workspace/WorkspaceEditorPanel.tsx +334 -353
- package/src/workbench/workspace/WorkspaceExplorer.tsx +532 -524
- package/src/workbench/workspace/WorkspaceFileIcon.tsx +32 -2
- package/src/workbench/workspace/WorkspaceSearchPanel.tsx +113 -113
- package/src/workbench/workspace/WorkspaceSearchResults.tsx +47 -47
- package/src/workbench/workspace/index.ts +156 -98
- package/src/workbench/workspace/mimeType.ts +45 -0
- package/src/workbench/workspace/path.ts +10 -10
- package/src/workbench/workspace/search.ts +6 -6
- package/src/workbench/workspace/tree.ts +1 -1
- package/src/workbench/workspace/types.ts +10 -10
- package/src/workbench/workspace/useVirtualWorkspace.ts +111 -98
- 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({
|
|
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
|
|
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 {
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
} from './
|
|
10
|
-
export type {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
export type {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
} from './
|
|
41
|
-
export {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
} from '
|
|
55
|
-
export {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
} from '
|
|
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';
|