@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.
- 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
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
export type WorkbenchStatus =
|
|
2
|
+
| 'idle'
|
|
3
|
+
| 'running'
|
|
4
|
+
| 'completed'
|
|
5
|
+
| 'failed'
|
|
6
|
+
| 'waiting'
|
|
7
|
+
| 'cancelled'
|
|
8
|
+
| 'disabled'
|
|
9
|
+
| 'unavailable';
|
|
10
|
+
|
|
11
|
+
export type WorkbenchStatusVariant =
|
|
12
|
+
| 'accent'
|
|
13
|
+
| 'danger'
|
|
14
|
+
| 'muted'
|
|
15
|
+
| 'neutral'
|
|
16
|
+
| 'success'
|
|
17
|
+
| 'warning';
|
|
18
|
+
|
|
19
|
+
export interface WorkbenchStatusDescriptor {
|
|
20
|
+
busy: boolean;
|
|
21
|
+
disabled: boolean;
|
|
22
|
+
label: string;
|
|
23
|
+
status: WorkbenchStatus;
|
|
24
|
+
unavailable: boolean;
|
|
25
|
+
variant: WorkbenchStatusVariant;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const workbenchStatusDescriptors: Record<WorkbenchStatus, WorkbenchStatusDescriptor> = {
|
|
29
|
+
cancelled: {
|
|
30
|
+
busy: false,
|
|
31
|
+
disabled: false,
|
|
32
|
+
label: 'Cancelled',
|
|
33
|
+
status: 'cancelled',
|
|
34
|
+
unavailable: false,
|
|
35
|
+
variant: 'muted',
|
|
36
|
+
},
|
|
37
|
+
completed: {
|
|
38
|
+
busy: false,
|
|
39
|
+
disabled: false,
|
|
40
|
+
label: 'Completed',
|
|
41
|
+
status: 'completed',
|
|
42
|
+
unavailable: false,
|
|
43
|
+
variant: 'success',
|
|
44
|
+
},
|
|
45
|
+
disabled: {
|
|
46
|
+
busy: false,
|
|
47
|
+
disabled: true,
|
|
48
|
+
label: 'Disabled',
|
|
49
|
+
status: 'disabled',
|
|
50
|
+
unavailable: false,
|
|
51
|
+
variant: 'muted',
|
|
52
|
+
},
|
|
53
|
+
failed: {
|
|
54
|
+
busy: false,
|
|
55
|
+
disabled: false,
|
|
56
|
+
label: 'Failed',
|
|
57
|
+
status: 'failed',
|
|
58
|
+
unavailable: false,
|
|
59
|
+
variant: 'danger',
|
|
60
|
+
},
|
|
61
|
+
idle: {
|
|
62
|
+
busy: false,
|
|
63
|
+
disabled: false,
|
|
64
|
+
label: 'Idle',
|
|
65
|
+
status: 'idle',
|
|
66
|
+
unavailable: false,
|
|
67
|
+
variant: 'neutral',
|
|
68
|
+
},
|
|
69
|
+
running: {
|
|
70
|
+
busy: true,
|
|
71
|
+
disabled: false,
|
|
72
|
+
label: 'Running',
|
|
73
|
+
status: 'running',
|
|
74
|
+
unavailable: false,
|
|
75
|
+
variant: 'accent',
|
|
76
|
+
},
|
|
77
|
+
unavailable: {
|
|
78
|
+
busy: false,
|
|
79
|
+
disabled: true,
|
|
80
|
+
label: 'Unavailable',
|
|
81
|
+
status: 'unavailable',
|
|
82
|
+
unavailable: true,
|
|
83
|
+
variant: 'muted',
|
|
84
|
+
},
|
|
85
|
+
waiting: {
|
|
86
|
+
busy: false,
|
|
87
|
+
disabled: false,
|
|
88
|
+
label: 'Waiting',
|
|
89
|
+
status: 'waiting',
|
|
90
|
+
unavailable: false,
|
|
91
|
+
variant: 'warning',
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export function getWorkbenchStatusDescriptor(status: WorkbenchStatus): WorkbenchStatusDescriptor {
|
|
96
|
+
return workbenchStatusDescriptors[status];
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export function getWorkbenchStatusLabel(status: WorkbenchStatus) {
|
|
100
|
+
return getWorkbenchStatusDescriptor(status).label;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export function getWorkbenchStatusVariant(status: WorkbenchStatus) {
|
|
104
|
+
return getWorkbenchStatusDescriptor(status).variant;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export function isWorkbenchStatusBusy(status: WorkbenchStatus) {
|
|
108
|
+
return getWorkbenchStatusDescriptor(status).busy;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export function isWorkbenchStatusDisabled(status: WorkbenchStatus) {
|
|
112
|
+
return getWorkbenchStatusDescriptor(status).disabled;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export function isWorkbenchStatusUnavailable(status: WorkbenchStatus) {
|
|
116
|
+
return getWorkbenchStatusDescriptor(status).unavailable;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export function isWorkbenchStatus(status: string): status is WorkbenchStatus {
|
|
120
|
+
return Object.prototype.hasOwnProperty.call(workbenchStatusDescriptors, status);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export function workbenchStatusFromLifecycleStatus(status: string): WorkbenchStatus {
|
|
124
|
+
if (isWorkbenchStatus(status)) return status;
|
|
125
|
+
if (status === 'error') return 'failed';
|
|
126
|
+
if (status === 'pending') return 'waiting';
|
|
127
|
+
if (status === 'done' || status === 'success') return 'completed';
|
|
128
|
+
return 'idle';
|
|
129
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useSyncExternalStore } from 'react';
|
|
2
|
+
import type { WorkbenchTheme } from './standalone';
|
|
3
|
+
|
|
4
|
+
export type ResolvedWorkbenchTheme = 'dark' | 'light';
|
|
5
|
+
|
|
6
|
+
const LIGHT_QUERY = '(prefers-color-scheme: light)';
|
|
7
|
+
|
|
8
|
+
function getSystemTheme(): ResolvedWorkbenchTheme {
|
|
9
|
+
if (typeof window === 'undefined') return 'dark';
|
|
10
|
+
return window.matchMedia(LIGHT_QUERY).matches ? 'light' : 'dark';
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function subscribeToSystemTheme(onChange: () => void): () => void {
|
|
14
|
+
if (typeof window === 'undefined') return () => undefined;
|
|
15
|
+
const mediaQuery = window.matchMedia(LIGHT_QUERY);
|
|
16
|
+
mediaQuery.addEventListener('change', onChange);
|
|
17
|
+
return () => mediaQuery.removeEventListener('change', onChange);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function getServerSystemTheme(): ResolvedWorkbenchTheme {
|
|
21
|
+
return 'dark';
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Resolves a theme preference (including 'system') to an actual 'light' | 'dark' theme.
|
|
26
|
+
* For custom theme strings, returns them unchanged (cast to ResolvedWorkbenchTheme).
|
|
27
|
+
*/
|
|
28
|
+
export function useResolvedWorkbenchTheme(
|
|
29
|
+
theme: WorkbenchTheme | 'system',
|
|
30
|
+
): ResolvedWorkbenchTheme {
|
|
31
|
+
const systemTheme = useSyncExternalStore<ResolvedWorkbenchTheme>(
|
|
32
|
+
subscribeToSystemTheme,
|
|
33
|
+
getSystemTheme,
|
|
34
|
+
getServerSystemTheme,
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
if (theme === 'system') return systemTheme;
|
|
38
|
+
return theme as unknown as ResolvedWorkbenchTheme;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function resolveWorkbenchTheme(theme: WorkbenchTheme | 'system'): ResolvedWorkbenchTheme {
|
|
42
|
+
if (theme === 'system') return getSystemTheme();
|
|
43
|
+
return theme as unknown as ResolvedWorkbenchTheme;
|
|
44
|
+
}
|