@flowdrop/flowdrop 1.15.0 → 2.0.0-beta.10
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/CHANGELOG.md +648 -0
- package/MIGRATION-2.0.md +642 -0
- package/README.md +28 -28
- package/dist/adapters/WorkflowAdapter.d.ts +1 -1
- package/dist/adapters/WorkflowAdapter.js +18 -13
- package/dist/adapters/agentspec/AgentSpecAdapter.js +10 -10
- package/dist/adapters/agentspec/defaultNodeTypes.js +9 -9
- package/dist/api/enhanced-client.js +6 -11
- package/dist/chat/batchFeedback.d.ts +39 -0
- package/dist/chat/batchFeedback.js +51 -0
- package/dist/commands/executor.js +66 -27
- package/dist/commands/storeIntegration.svelte.d.ts +4 -1
- package/dist/commands/storeIntegration.svelte.js +36 -21
- package/dist/commands/types.d.ts +2 -0
- package/dist/commands/types.js +5 -5
- package/dist/components/App.svelte +696 -565
- package/dist/components/App.svelte.d.ts +63 -16
- package/dist/components/Button.stories.svelte +65 -0
- package/dist/components/Button.stories.svelte.d.ts +19 -0
- package/dist/components/Button.svelte +62 -0
- package/dist/components/Button.svelte.d.ts +24 -0
- package/dist/components/CanvasIconButton.svelte +76 -0
- package/dist/components/CanvasIconButton.svelte.d.ts +18 -0
- package/dist/components/ConfigForm.svelte +181 -552
- package/dist/components/ConfigForm.svelte.d.ts +24 -7
- package/dist/components/ConfigModal.svelte +16 -3
- package/dist/components/ConfigPanel.svelte +234 -15
- package/dist/components/ConfigPanel.svelte.d.ts +6 -0
- package/dist/components/ConnectionLine.svelte +4 -2
- package/dist/components/EditorStatusBar.stories.svelte +44 -0
- package/dist/components/EditorStatusBar.stories.svelte.d.ts +27 -0
- package/dist/components/EditorStatusBar.svelte +99 -0
- package/dist/components/EditorStatusBar.svelte.d.ts +15 -0
- package/dist/components/IconButton.svelte +80 -0
- package/dist/components/IconButton.svelte.d.ts +30 -0
- package/dist/components/Input.svelte +74 -0
- package/dist/components/Input.svelte.d.ts +17 -0
- package/dist/components/LogoWordmark.svelte +113 -0
- package/dist/components/LogoWordmark.svelte.d.ts +26 -0
- package/dist/components/Navbar.svelte +78 -64
- package/dist/components/Navbar.svelte.d.ts +3 -0
- package/dist/components/NodeSidebar.svelte +48 -171
- package/dist/components/NodeStatusOverlay.svelte +94 -6
- package/dist/components/NodeSwapPicker.svelte +22 -38
- package/dist/components/PipelineStatus.svelte +22 -68
- package/dist/components/PipelineStatus.svelte.d.ts +3 -0
- package/dist/components/PortCoordinateTracker.svelte +5 -6
- package/dist/components/PortMappingRow.svelte +0 -2
- package/dist/components/SchemaForm.stories.svelte +1 -3
- package/dist/components/SchemaForm.svelte +22 -39
- package/dist/components/SchemaForm.svelte.d.ts +0 -8
- package/dist/components/Select.svelte +53 -0
- package/dist/components/Select.svelte.d.ts +15 -0
- package/dist/components/SettingsModal.svelte +8 -8
- package/dist/components/SettingsPanel.svelte +44 -10
- package/dist/components/SwapMappingEditor.svelte +67 -49
- package/dist/components/SwapMappingEditor.svelte.d.ts +0 -2
- package/dist/components/Textarea.svelte +39 -0
- package/dist/components/Textarea.svelte.d.ts +12 -0
- package/dist/components/ThemeToggle.svelte +15 -94
- package/dist/components/UniversalNode.svelte +45 -11
- package/dist/components/UniversalNode.svelte.d.ts +1 -1
- package/dist/components/WorkflowEditor.svelte +183 -162
- package/dist/components/WorkflowEditor.svelte.d.ts +39 -10
- package/dist/components/chat/AIChatPanel.svelte +99 -90
- package/dist/components/chat/AIChatPanel.svelte.d.ts +0 -4
- package/dist/components/chat/CommandPreview.svelte +2 -1
- package/dist/components/console/CommandConsole.svelte +7 -5
- package/dist/components/console/ConsoleAutocomplete.svelte +11 -12
- package/dist/components/console/ConsoleAutocomplete.svelte.d.ts +6 -0
- package/dist/components/console/ConsoleInput.svelte +18 -9
- package/dist/components/console/ConsoleOutput.svelte +4 -3
- package/dist/components/form/FormArray.svelte +42 -182
- package/dist/components/form/FormArray.svelte.d.ts +2 -1
- package/dist/components/form/FormAutocomplete.svelte +26 -21
- package/dist/components/form/FormCheckboxGroup.svelte +1 -5
- package/dist/components/form/FormCodeEditor.svelte +9 -7
- package/dist/components/form/FormField.svelte +22 -44
- package/dist/components/form/FormFieldLight.svelte +56 -50
- package/dist/components/form/FormFieldLight.svelte.d.ts +12 -0
- package/dist/components/form/FormFieldset.svelte +45 -11
- package/dist/components/form/FormMarkdownEditor.svelte +17 -9
- package/dist/components/form/FormNumberField.svelte +4 -36
- package/dist/components/form/FormPorts.svelte +262 -0
- package/dist/components/form/FormPorts.svelte.d.ts +13 -0
- package/dist/components/form/FormRangeField.svelte +62 -30
- package/dist/components/form/FormSelect.svelte +13 -75
- package/dist/components/form/FormTemplateEditor.svelte +17 -7
- package/dist/components/form/FormTextField.svelte +3 -35
- package/dist/components/form/FormTextarea.svelte +4 -39
- package/dist/components/form/FormToggle.svelte +5 -16
- package/dist/components/form/FormToggle.svelte.d.ts +4 -2
- package/dist/components/form/FormUISchemaRenderer.svelte +3 -1
- package/dist/components/form/resolveFieldType.d.ts +24 -0
- package/dist/components/form/resolveFieldType.js +55 -0
- package/dist/components/form/templateAutocomplete.js +1 -5
- package/dist/components/form/types.d.ts +1 -14
- package/dist/components/icons/CloseIcon.svelte +6 -0
- package/dist/components/icons/CloseIcon.svelte.d.ts +26 -0
- package/dist/components/icons/CommandLineIcon.svelte +15 -0
- package/dist/components/icons/CommandLineIcon.svelte.d.ts +26 -0
- package/dist/components/icons/MenuIcon.svelte +4 -0
- package/dist/components/icons/MenuIcon.svelte.d.ts +26 -0
- package/dist/components/icons/MenuOpenIcon.svelte +6 -0
- package/dist/components/icons/MenuOpenIcon.svelte.d.ts +26 -0
- package/dist/components/interrupt/ChoicePrompt.svelte +0 -10
- package/dist/components/interrupt/ConfirmationPrompt.svelte +0 -5
- package/dist/components/interrupt/FormPrompt.svelte +3 -2
- package/dist/components/interrupt/InterruptBubble.svelte +25 -27
- package/dist/components/interrupt/ReviewPrompt.svelte +10 -23
- package/dist/components/interrupt/TextInputPrompt.svelte +2 -7
- package/dist/components/layouts/MainLayout.svelte +24 -18
- package/dist/components/layouts/MainLayout.svelte.d.ts +4 -0
- package/dist/components/nodes/AtomNode.svelte +70 -72
- package/dist/components/nodes/AtomNode.svelte.d.ts +1 -1
- package/dist/components/nodes/GatewayNode.svelte +134 -172
- package/dist/components/nodes/GatewayNode.svelte.d.ts +1 -1
- package/dist/components/nodes/IdeaNode.svelte +79 -98
- package/dist/components/nodes/IdeaNode.svelte.d.ts +8 -4
- package/dist/components/nodes/NodeConfigButton.svelte +86 -0
- package/dist/components/nodes/NodeConfigButton.svelte.d.ts +15 -0
- package/dist/components/nodes/NotesNode.svelte +76 -85
- package/dist/components/nodes/NotesNode.svelte.d.ts +8 -4
- package/dist/components/nodes/SimpleNode.svelte +68 -137
- package/dist/components/nodes/SimpleNode.svelte.d.ts +4 -4
- package/dist/components/nodes/SquareNode.svelte +122 -169
- package/dist/components/nodes/SquareNode.svelte.d.ts +4 -4
- package/dist/components/nodes/TerminalNode.svelte +70 -127
- package/dist/components/nodes/TerminalNode.svelte.d.ts +4 -4
- package/dist/components/nodes/ToolNode.svelte +99 -104
- package/dist/components/nodes/ToolNode.svelte.d.ts +6 -6
- package/dist/components/nodes/WorkflowNode.svelte +145 -195
- package/dist/components/nodes/WorkflowNode.svelte.d.ts +1 -1
- package/dist/components/playground/ChatInput.svelte +11 -15
- package/dist/components/playground/ChatPanel.svelte +6 -49
- package/dist/components/playground/ChatPanel.svelte.d.ts +0 -14
- package/dist/components/playground/ControlPanel.svelte +134 -123
- package/dist/components/playground/ControlPanel.svelte.d.ts +3 -0
- package/dist/components/playground/ExecutionLogs.svelte +11 -9
- package/dist/components/playground/InputCollector.svelte +22 -57
- package/dist/components/playground/MessageStream.svelte +17 -23
- package/dist/components/playground/PipelineKanbanView.svelte +69 -8
- package/dist/components/playground/PipelineKanbanView.svelte.d.ts +2 -0
- package/dist/components/playground/PipelinePanel.svelte +31 -8
- package/dist/components/playground/PipelinePanel.svelte.d.ts +2 -0
- package/dist/components/playground/PipelineTableView.svelte +188 -44
- package/dist/components/playground/PipelineTableView.svelte.d.ts +2 -0
- package/dist/components/playground/Playground.svelte +154 -105
- package/dist/components/playground/Playground.svelte.d.ts +5 -0
- package/dist/components/playground/PlaygroundApp.svelte +12 -2
- package/dist/components/playground/PlaygroundApp.svelte.d.ts +6 -0
- package/dist/components/playground/PlaygroundModal.svelte +18 -3
- package/dist/components/playground/PlaygroundModal.svelte.d.ts +6 -0
- package/dist/components/playground/PlaygroundStudio.svelte +40 -37
- package/dist/components/playground/PlaygroundStudio.svelte.d.ts +6 -0
- package/dist/components/playground/SessionManager.svelte +9 -12
- package/dist/components/playground/pipelineViewUtils.svelte.d.ts +30 -1
- package/dist/components/playground/pipelineViewUtils.svelte.js +40 -3
- package/dist/components/surfaces/SurfaceOverlay.svelte +153 -0
- package/dist/components/surfaces/SurfaceOverlay.svelte.d.ts +14 -0
- package/dist/components/surfaces/TabbedSurface.svelte +133 -0
- package/dist/components/surfaces/TabbedSurface.svelte.d.ts +27 -0
- package/dist/config/endpoints.d.ts +23 -7
- package/dist/config/endpoints.js +30 -10
- package/dist/core/index.d.ts +6 -7
- package/dist/core/index.js +8 -12
- package/dist/display/index.d.ts +6 -3
- package/dist/display/index.js +7 -5
- package/dist/editor/index.d.ts +20 -21
- package/dist/editor/index.js +26 -36
- package/dist/form/code.d.ts +25 -15
- package/dist/form/code.js +44 -41
- package/dist/form/fieldRegistry.d.ts +17 -13
- package/dist/form/fieldRegistry.js +32 -12
- package/dist/form/full.d.ts +19 -14
- package/dist/form/full.js +26 -28
- package/dist/form/index.d.ts +3 -4
- package/dist/form/index.js +6 -5
- package/dist/form/markdown.d.ts +13 -8
- package/dist/form/markdown.js +22 -23
- package/dist/helpers/proximityConnect.d.ts +3 -2
- package/dist/helpers/proximityConnect.js +2 -5
- package/dist/helpers/workflowEditorHelper.d.ts +14 -5
- package/dist/helpers/workflowEditorHelper.js +32 -30
- package/dist/index.d.ts +28 -24
- package/dist/index.js +27 -50
- package/dist/messages/defaults.d.ts +2 -5
- package/dist/messages/defaults.js +3 -6
- package/dist/messages/index.d.ts +1 -2
- package/dist/messages/index.js +1 -2
- package/dist/mocks/app-forms.d.ts +6 -2
- package/dist/mocks/app-forms.js +11 -4
- package/dist/openapi/v1/openapi.yaml +38 -26
- package/dist/playground/index.d.ts +4 -5
- package/dist/playground/index.js +4 -32
- package/dist/playground/mount.d.ts +34 -5
- package/dist/playground/mount.js +58 -24
- package/dist/registry/{BaseRegistry.d.ts → BaseRegistry.svelte.d.ts} +22 -1
- package/dist/registry/{BaseRegistry.js → BaseRegistry.svelte.js} +37 -1
- package/dist/registry/builtinFormats.d.ts +9 -18
- package/dist/registry/builtinFormats.js +9 -39
- package/dist/registry/builtinNodeTypes.d.ts +53 -0
- package/dist/registry/builtinNodeTypes.js +67 -0
- package/dist/registry/builtinNodes.d.ts +2 -64
- package/dist/registry/builtinNodes.js +7 -103
- package/dist/registry/index.d.ts +3 -4
- package/dist/registry/index.js +4 -6
- package/dist/registry/nodeComponentRegistry.d.ts +184 -16
- package/dist/registry/nodeComponentRegistry.js +235 -17
- package/dist/registry/workflowFormatRegistry.d.ts +14 -9
- package/dist/registry/workflowFormatRegistry.js +24 -8
- package/dist/{schema → schemas}/index.d.ts +2 -2
- package/dist/{schema → schemas}/index.js +2 -2
- package/dist/schemas/v1/workflow.schema.json +19 -17
- package/dist/services/agentSpecExecutionService.d.ts +0 -2
- package/dist/services/agentSpecExecutionService.js +0 -3
- package/dist/services/apiVariableService.d.ts +2 -1
- package/dist/services/apiVariableService.js +16 -47
- package/dist/services/autoSaveService.d.ts +7 -0
- package/dist/services/autoSaveService.js +6 -4
- package/dist/services/categoriesApi.js +3 -6
- package/dist/services/chatService.d.ts +9 -4
- package/dist/services/chatService.js +23 -28
- package/dist/services/draftStorage.d.ts +129 -13
- package/dist/services/draftStorage.js +185 -37
- package/dist/services/dynamicSchemaService.d.ts +33 -5
- package/dist/services/dynamicSchemaService.js +67 -55
- package/dist/services/globalSave.d.ts +13 -12
- package/dist/services/globalSave.js +29 -51
- package/dist/services/historyService.d.ts +39 -11
- package/dist/services/historyService.js +60 -18
- package/dist/services/interruptService.d.ts +15 -9
- package/dist/services/interruptService.js +35 -37
- package/dist/services/nodeExecutionService.d.ts +18 -3
- package/dist/services/nodeExecutionService.js +71 -45
- package/dist/services/playgroundService.d.ts +16 -10
- package/dist/services/playgroundService.js +42 -43
- package/dist/services/portConfigApi.js +3 -6
- package/dist/services/settingsService.d.ts +9 -4
- package/dist/services/settingsService.js +23 -12
- package/dist/services/variableService.d.ts +2 -1
- package/dist/services/variableService.js +2 -2
- package/dist/services/workflowStorage.js +6 -6
- package/dist/skins/drafter.d.ts +30 -0
- package/dist/skins/drafter.js +198 -0
- package/dist/skins/index.d.ts +2 -1
- package/dist/skins/index.js +4 -2
- package/dist/stores/apiContext.d.ts +56 -0
- package/dist/stores/apiContext.js +80 -0
- package/dist/stores/categoriesStore.svelte.d.ts +28 -23
- package/dist/stores/categoriesStore.svelte.js +69 -64
- package/dist/stores/getInstance.svelte.d.ts +39 -0
- package/dist/stores/getInstance.svelte.js +65 -0
- package/dist/stores/historyStore.svelte.d.ts +89 -91
- package/dist/stores/historyStore.svelte.js +159 -158
- package/dist/stores/instanceContainer.svelte.d.ts +111 -0
- package/dist/stores/instanceContainer.svelte.js +119 -0
- package/dist/stores/interruptStore.svelte.d.ts +112 -82
- package/dist/stores/interruptStore.svelte.js +253 -226
- package/dist/stores/pipelinePanelStore.svelte.d.ts +27 -3
- package/dist/stores/pipelinePanelStore.svelte.js +61 -14
- package/dist/stores/playgroundStore.svelte.d.ts +169 -222
- package/dist/stores/playgroundStore.svelte.js +513 -580
- package/dist/stores/portCoordinateStore.svelte.d.ts +57 -51
- package/dist/stores/portCoordinateStore.svelte.js +109 -98
- package/dist/stores/settingsStore.svelte.d.ts +17 -1
- package/dist/stores/settingsStore.svelte.js +79 -12
- package/dist/stores/workflowStore.svelte.d.ts +212 -210
- package/dist/stores/workflowStore.svelte.js +527 -502
- package/dist/stories/EdgeDecorator.svelte +5 -2
- package/dist/stories/NodeDecorator.svelte +5 -3
- package/dist/styles/base.css +285 -14
- package/dist/styles/tokens.css +60 -2
- package/dist/svelte-app.d.ts +78 -11
- package/dist/svelte-app.js +210 -141
- package/dist/themes/drafter.d.ts +2 -0
- package/dist/themes/drafter.js +15 -0
- package/dist/themes/index.d.ts +2 -1
- package/dist/themes/index.js +8 -2
- package/dist/types/auth.d.ts +9 -51
- package/dist/types/auth.js +4 -54
- package/dist/types/events.d.ts +24 -3
- package/dist/types/events.js +2 -1
- package/dist/types/index.d.ts +117 -32
- package/dist/types/index.js +0 -1
- package/dist/types/navbar.d.ts +7 -0
- package/dist/types/playground.d.ts +18 -3
- package/dist/types/settings.d.ts +30 -1
- package/dist/types/settings.js +5 -2
- package/dist/types/skin.d.ts +1 -1
- package/dist/types/theme.d.ts +16 -2
- package/dist/types/uischema.d.ts +5 -0
- package/dist/utils/colors.d.ts +74 -21
- package/dist/utils/colors.js +92 -68
- package/dist/utils/connections.d.ts +9 -15
- package/dist/utils/connections.js +33 -88
- package/dist/utils/duration.d.ts +13 -0
- package/dist/utils/duration.js +45 -0
- package/dist/utils/edgeStyling.js +9 -5
- package/dist/utils/fetchWithAuth.d.ts +36 -15
- package/dist/utils/fetchWithAuth.js +53 -23
- package/dist/utils/icons.d.ts +5 -2
- package/dist/utils/icons.js +6 -5
- package/dist/utils/nodeIds.d.ts +1 -1
- package/dist/utils/nodeIds.js +1 -1
- package/dist/utils/nodeSwap.d.ts +6 -2
- package/dist/utils/nodeSwap.js +62 -129
- package/dist/utils/nodeTypes.d.ts +17 -8
- package/dist/utils/nodeTypes.js +27 -20
- package/dist/utils/performanceUtils.js +7 -0
- package/dist/utils/portUtils.d.ts +47 -11
- package/dist/utils/portUtils.js +67 -14
- package/dist/utils/portal.d.ts +18 -0
- package/dist/utils/portal.js +34 -0
- package/dist/utils/schemaMerge.d.ts +25 -0
- package/dist/utils/schemaMerge.js +61 -0
- package/package.json +7 -5
- package/dist/messages/deprecation.d.ts +0 -20
- package/dist/messages/deprecation.js +0 -33
- package/dist/registry/plugin.d.ts +0 -215
- package/dist/registry/plugin.js +0 -249
- package/dist/services/api.d.ts +0 -129
- package/dist/services/api.js +0 -217
|
@@ -10,7 +10,9 @@
|
|
|
10
10
|
import Icon from '@iconify/svelte';
|
|
11
11
|
import Playground from './Playground.svelte';
|
|
12
12
|
import type { Workflow } from '../../types/index.js';
|
|
13
|
+
import type { FlowDropInstance } from '../../stores/instanceContainer.svelte.js';
|
|
13
14
|
import type { EndpointConfig } from '../../config/endpoints.js';
|
|
15
|
+
import type { AuthProvider } from '../../types/auth.js';
|
|
14
16
|
import type { PlaygroundConfig } from '../../types/playground.js';
|
|
15
17
|
import { m } from '../../messages/index.js';
|
|
16
18
|
|
|
@@ -28,8 +30,12 @@
|
|
|
28
30
|
initialSessionId?: string;
|
|
29
31
|
/** API endpoint configuration */
|
|
30
32
|
endpointConfig?: EndpointConfig;
|
|
33
|
+
/** Auth provider applied to this instance's API requests. */
|
|
34
|
+
authProvider?: AuthProvider;
|
|
31
35
|
/** Playground configuration options */
|
|
32
36
|
config?: PlaygroundConfig;
|
|
37
|
+
/** Per-instance state container — forwarded to the inner Playground */
|
|
38
|
+
instance?: FlowDropInstance;
|
|
33
39
|
/** Callback when modal is closed */
|
|
34
40
|
onClose: () => void;
|
|
35
41
|
}
|
|
@@ -40,10 +46,17 @@
|
|
|
40
46
|
workflow,
|
|
41
47
|
initialSessionId,
|
|
42
48
|
endpointConfig,
|
|
49
|
+
authProvider,
|
|
43
50
|
config = {},
|
|
51
|
+
instance,
|
|
44
52
|
onClose
|
|
45
53
|
}: Props = $props();
|
|
46
54
|
|
|
55
|
+
// Unique per component instance so two FlowDrop editors on one page
|
|
56
|
+
// don't render colliding DOM ids (a11y).
|
|
57
|
+
const uid = $props.id();
|
|
58
|
+
const titleId = `${uid}-playground-modal-title`;
|
|
59
|
+
|
|
47
60
|
/**
|
|
48
61
|
* Close modal on Escape key
|
|
49
62
|
*/
|
|
@@ -71,15 +84,15 @@
|
|
|
71
84
|
onkeydown={handleKeydown}
|
|
72
85
|
role="dialog"
|
|
73
86
|
aria-modal="true"
|
|
74
|
-
aria-labelledby=
|
|
87
|
+
aria-labelledby={titleId}
|
|
75
88
|
tabindex="-1"
|
|
76
89
|
>
|
|
77
90
|
<!-- Modal Container -->
|
|
78
|
-
<!--
|
|
91
|
+
<!-- role="presentation" container stops backdrop click propagation -->
|
|
79
92
|
<div class="playground-modal" onclick={(e) => e.stopPropagation()} role="presentation">
|
|
80
93
|
<!-- Modal Header -->
|
|
81
94
|
<div class="playground-modal__header">
|
|
82
|
-
<div class="playground-modal__title" id=
|
|
95
|
+
<div class="playground-modal__title" id={titleId}>
|
|
83
96
|
<Icon icon="mdi:play-circle-outline" />
|
|
84
97
|
<span>Playground</span>
|
|
85
98
|
</div>
|
|
@@ -96,11 +109,13 @@
|
|
|
96
109
|
<!-- Modal Content -->
|
|
97
110
|
<div class="playground-modal__content">
|
|
98
111
|
<Playground
|
|
112
|
+
{instance}
|
|
99
113
|
{workflowId}
|
|
100
114
|
{workflow}
|
|
101
115
|
mode="modal"
|
|
102
116
|
{initialSessionId}
|
|
103
117
|
{endpointConfig}
|
|
118
|
+
{authProvider}
|
|
104
119
|
{config}
|
|
105
120
|
{onClose}
|
|
106
121
|
/>
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { Workflow } from '../../types/index.js';
|
|
2
|
+
import type { FlowDropInstance } from '../../stores/instanceContainer.svelte.js';
|
|
2
3
|
import type { EndpointConfig } from '../../config/endpoints.js';
|
|
4
|
+
import type { AuthProvider } from '../../types/auth.js';
|
|
3
5
|
import type { PlaygroundConfig } from '../../types/playground.js';
|
|
4
6
|
/**
|
|
5
7
|
* Component props
|
|
@@ -15,8 +17,12 @@ interface Props {
|
|
|
15
17
|
initialSessionId?: string;
|
|
16
18
|
/** API endpoint configuration */
|
|
17
19
|
endpointConfig?: EndpointConfig;
|
|
20
|
+
/** Auth provider applied to this instance's API requests. */
|
|
21
|
+
authProvider?: AuthProvider;
|
|
18
22
|
/** Playground configuration options */
|
|
19
23
|
config?: PlaygroundConfig;
|
|
24
|
+
/** Per-instance state container — forwarded to the inner Playground */
|
|
25
|
+
instance?: FlowDropInstance;
|
|
20
26
|
/** Callback when modal is closed */
|
|
21
27
|
onClose: () => void;
|
|
22
28
|
}
|
|
@@ -3,22 +3,12 @@
|
|
|
3
3
|
import Icon from '@iconify/svelte';
|
|
4
4
|
import Playground from './Playground.svelte';
|
|
5
5
|
import PipelinePanel from './PipelinePanel.svelte';
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
pipelinePanelActions
|
|
9
|
-
} from '../../stores/pipelinePanelStore.svelte.js';
|
|
10
|
-
import {
|
|
11
|
-
getActiveExecutionId,
|
|
12
|
-
getPinnedExecutionId,
|
|
13
|
-
getLatestExecutionId,
|
|
14
|
-
getPipelineRefreshTrigger,
|
|
15
|
-
getSelectableExecutions,
|
|
16
|
-
playgroundActions
|
|
17
|
-
} from '../../stores/playgroundStore.svelte.js';
|
|
18
|
-
import { setEndpointConfig, workflowApi } from '../../services/api.js';
|
|
6
|
+
import { provideInstance } from '../../stores/getInstance.svelte.js';
|
|
7
|
+
import type { FlowDropInstance } from '../../stores/instanceContainer.svelte.js';
|
|
19
8
|
import { logger } from '../../utils/logger.js';
|
|
20
9
|
import type { Workflow, PipelineViewDef } from '../../types/index.js';
|
|
21
10
|
import type { EndpointConfig } from '../../config/endpoints.js';
|
|
11
|
+
import type { AuthProvider } from '../../types/auth.js';
|
|
22
12
|
import type { PlaygroundConfig, PlaygroundMode } from '../../types/playground.js';
|
|
23
13
|
|
|
24
14
|
interface Props {
|
|
@@ -28,6 +18,8 @@
|
|
|
28
18
|
workflow?: Workflow;
|
|
29
19
|
/** API endpoint configuration */
|
|
30
20
|
endpointConfig?: EndpointConfig;
|
|
21
|
+
/** Auth provider applied to this instance's API requests. */
|
|
22
|
+
authProvider?: AuthProvider;
|
|
31
23
|
/** Display mode (default: standalone) */
|
|
32
24
|
mode?: PlaygroundMode;
|
|
33
25
|
/** Session ID to activate on mount. Changing this prop remounts the Playground. */
|
|
@@ -46,12 +38,15 @@
|
|
|
46
38
|
onClose?: () => void;
|
|
47
39
|
/** Additional pipeline views injected by the consumer */
|
|
48
40
|
extraPipelineViews?: PipelineViewDef[];
|
|
41
|
+
/** Explicit FlowDrop instance; defaults to context or the page-default instance. */
|
|
42
|
+
instance?: FlowDropInstance;
|
|
49
43
|
}
|
|
50
44
|
|
|
51
45
|
let {
|
|
52
46
|
workflowId,
|
|
53
47
|
workflow: workflowProp,
|
|
54
48
|
endpointConfig,
|
|
49
|
+
authProvider,
|
|
55
50
|
mode = 'standalone',
|
|
56
51
|
initialSessionId,
|
|
57
52
|
config = {},
|
|
@@ -60,17 +55,28 @@
|
|
|
60
55
|
initialPipelineWidth = 500,
|
|
61
56
|
onSessionNavigate,
|
|
62
57
|
onClose,
|
|
63
|
-
extraPipelineViews = []
|
|
58
|
+
extraPipelineViews = [],
|
|
59
|
+
instance
|
|
64
60
|
}: Props = $props();
|
|
65
61
|
|
|
66
|
-
//
|
|
62
|
+
// Resolve/provide once at init; the instance prop is a fixed mount-time choice.
|
|
63
|
+
// svelte-ignore state_referenced_locally
|
|
64
|
+
const fd = provideInstance(instance);
|
|
65
|
+
|
|
66
|
+
// Pre-bound toggle for detached callback props (onclick / onTogglePanel).
|
|
67
|
+
const togglePipeline = () => fd.pipelinePanel.toggle();
|
|
68
|
+
|
|
69
|
+
// seed mutable state from the prop's initial value; workflow may load asynchronously below
|
|
70
|
+
// svelte-ignore state_referenced_locally
|
|
67
71
|
let resolvedWorkflow = $state<Workflow | null>(workflowProp ?? null);
|
|
68
|
-
//
|
|
72
|
+
// initial loading flag derived from whether a workflow was provided up front
|
|
73
|
+
// svelte-ignore state_referenced_locally
|
|
69
74
|
let workflowLoading = $state(workflowProp === undefined);
|
|
70
75
|
let workflowError = $state<string | null>(null);
|
|
71
76
|
|
|
72
77
|
let splitEl = $state<HTMLElement | null>(null);
|
|
73
|
-
//
|
|
78
|
+
// seed mutable width from the initial prop; it changes as the user drags the resizer
|
|
79
|
+
// svelte-ignore state_referenced_locally
|
|
74
80
|
let pipelineWidth = $state(initialPipelineWidth);
|
|
75
81
|
let isResizing = $state(false);
|
|
76
82
|
let containerWidth = $state(0);
|
|
@@ -92,12 +98,12 @@
|
|
|
92
98
|
});
|
|
93
99
|
|
|
94
100
|
onMount(() => {
|
|
95
|
-
|
|
101
|
+
fd.pipelinePanel.init();
|
|
96
102
|
if (initialPipelineOpen !== undefined) {
|
|
97
|
-
|
|
103
|
+
fd.pipelinePanel.setOpen(initialPipelineOpen);
|
|
98
104
|
}
|
|
99
105
|
if (endpointConfig) {
|
|
100
|
-
|
|
106
|
+
fd.api.configure(endpointConfig, authProvider);
|
|
101
107
|
}
|
|
102
108
|
if (!workflowProp) {
|
|
103
109
|
void loadWorkflow();
|
|
@@ -115,7 +121,7 @@
|
|
|
115
121
|
try {
|
|
116
122
|
workflowLoading = true;
|
|
117
123
|
workflowError = null;
|
|
118
|
-
resolvedWorkflow = await
|
|
124
|
+
resolvedWorkflow = await fd.api.client.loadWorkflow(workflowId);
|
|
119
125
|
} catch (err) {
|
|
120
126
|
workflowError = err instanceof Error ? err.message : 'Failed to load workflow';
|
|
121
127
|
logger.error('[PlaygroundStudio] Workflow load failed:', err);
|
|
@@ -162,16 +168,16 @@
|
|
|
162
168
|
style="--playground-studio-min-chat-width: {minChatWidth}px"
|
|
163
169
|
>
|
|
164
170
|
<div class="playground-studio__panes" bind:this={splitEl}>
|
|
165
|
-
{#if
|
|
166
|
-
{@const activeId =
|
|
167
|
-
{@const executions =
|
|
171
|
+
{#if fd.pipelinePanel.isOpen && resolvedWorkflow && endpointConfig}
|
|
172
|
+
{@const activeId = fd.playground.activeExecutionId}
|
|
173
|
+
{@const executions = fd.playground.selectableExecutions}
|
|
168
174
|
|
|
169
175
|
<div class="playground-studio__pipeline" style="width: {pipelineWidth}px;">
|
|
170
176
|
<button
|
|
171
177
|
type="button"
|
|
172
178
|
class="playground-studio__back-to-chat"
|
|
173
179
|
aria-label="Back to chat"
|
|
174
|
-
onclick={
|
|
180
|
+
onclick={togglePipeline}
|
|
175
181
|
>
|
|
176
182
|
<Icon icon="mdi:arrow-left" aria-hidden="true" />
|
|
177
183
|
<span>Back to chat</span>
|
|
@@ -180,11 +186,12 @@
|
|
|
180
186
|
pipelineId={activeId}
|
|
181
187
|
workflow={resolvedWorkflow}
|
|
182
188
|
{endpointConfig}
|
|
183
|
-
|
|
189
|
+
{authProvider}
|
|
190
|
+
isPinned={fd.playground.pinnedExecutionId !== null}
|
|
184
191
|
{executions}
|
|
185
|
-
latestExecutionId={
|
|
186
|
-
onSelectExecution={(id) =>
|
|
187
|
-
refreshTrigger={
|
|
192
|
+
latestExecutionId={fd.playground.latestExecutionId}
|
|
193
|
+
onSelectExecution={(id) => fd.playground.pinExecution(id)}
|
|
194
|
+
refreshTrigger={fd.playground.pipelineRefreshTrigger}
|
|
188
195
|
extraViews={extraPipelineViews}
|
|
189
196
|
/>
|
|
190
197
|
</div>
|
|
@@ -214,7 +221,7 @@
|
|
|
214
221
|
|
|
215
222
|
<div
|
|
216
223
|
class="playground-studio__chat"
|
|
217
|
-
class:playground-studio__chat--solo={!
|
|
224
|
+
class:playground-studio__chat--solo={!fd.pipelinePanel.isOpen}
|
|
218
225
|
>
|
|
219
226
|
{#if workflowLoading}
|
|
220
227
|
<div class="playground-studio__loading">
|
|
@@ -236,13 +243,14 @@
|
|
|
236
243
|
{workflowId}
|
|
237
244
|
workflow={resolvedWorkflow}
|
|
238
245
|
{endpointConfig}
|
|
246
|
+
{authProvider}
|
|
239
247
|
{mode}
|
|
240
248
|
{initialSessionId}
|
|
241
249
|
{config}
|
|
242
250
|
{onClose}
|
|
243
251
|
{onSessionNavigate}
|
|
244
|
-
onTogglePanel={
|
|
245
|
-
isPipelinePanelOpen={
|
|
252
|
+
onTogglePanel={togglePipeline}
|
|
253
|
+
isPipelinePanelOpen={fd.pipelinePanel.isOpen}
|
|
246
254
|
/>
|
|
247
255
|
{/key}
|
|
248
256
|
{/if}
|
|
@@ -455,11 +463,6 @@
|
|
|
455
463
|
.playground-studio__back-to-chat:hover {
|
|
456
464
|
background-color: var(--fd-muted);
|
|
457
465
|
}
|
|
458
|
-
|
|
459
|
-
.playground-studio__back-to-chat:focus-visible {
|
|
460
|
-
outline: 2px solid var(--fd-ring);
|
|
461
|
-
outline-offset: 2px;
|
|
462
|
-
}
|
|
463
466
|
}
|
|
464
467
|
|
|
465
468
|
@media (prefers-reduced-motion: reduce) {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { FlowDropInstance } from '../../stores/instanceContainer.svelte.js';
|
|
1
2
|
import type { Workflow, PipelineViewDef } from '../../types/index.js';
|
|
2
3
|
import type { EndpointConfig } from '../../config/endpoints.js';
|
|
4
|
+
import type { AuthProvider } from '../../types/auth.js';
|
|
3
5
|
import type { PlaygroundConfig, PlaygroundMode } from '../../types/playground.js';
|
|
4
6
|
interface Props {
|
|
5
7
|
/** Target workflow ID */
|
|
@@ -8,6 +10,8 @@ interface Props {
|
|
|
8
10
|
workflow?: Workflow;
|
|
9
11
|
/** API endpoint configuration */
|
|
10
12
|
endpointConfig?: EndpointConfig;
|
|
13
|
+
/** Auth provider applied to this instance's API requests. */
|
|
14
|
+
authProvider?: AuthProvider;
|
|
11
15
|
/** Display mode (default: standalone) */
|
|
12
16
|
mode?: PlaygroundMode;
|
|
13
17
|
/** Session ID to activate on mount. Changing this prop remounts the Playground. */
|
|
@@ -26,6 +30,8 @@ interface Props {
|
|
|
26
30
|
onClose?: () => void;
|
|
27
31
|
/** Additional pipeline views injected by the consumer */
|
|
28
32
|
extraPipelineViews?: PipelineViewDef[];
|
|
33
|
+
/** Explicit FlowDrop instance; defaults to context or the page-default instance. */
|
|
34
|
+
instance?: FlowDropInstance;
|
|
29
35
|
}
|
|
30
36
|
declare const PlaygroundStudio: import("svelte").Component<Props, {}, "">;
|
|
31
37
|
type PlaygroundStudio = ReturnType<typeof PlaygroundStudio>;
|
|
@@ -10,14 +10,11 @@
|
|
|
10
10
|
import Icon from '@iconify/svelte';
|
|
11
11
|
import { slide } from 'svelte/transition';
|
|
12
12
|
import type { PlaygroundSession } from '../../types/playground.js';
|
|
13
|
-
import {
|
|
14
|
-
getSessions,
|
|
15
|
-
getCurrentSession,
|
|
16
|
-
getIsLoading,
|
|
17
|
-
getSessionCount
|
|
18
|
-
} from '../../stores/playgroundStore.svelte.js';
|
|
13
|
+
import { getInstance } from '../../stores/getInstance.svelte.js';
|
|
19
14
|
import { m } from '../../messages/index.js';
|
|
20
15
|
|
|
16
|
+
const fd = getInstance();
|
|
17
|
+
|
|
21
18
|
/**
|
|
22
19
|
* Component props
|
|
23
20
|
*/
|
|
@@ -175,8 +172,8 @@
|
|
|
175
172
|
<div class="session-manager__title">
|
|
176
173
|
<Icon icon="mdi:history" />
|
|
177
174
|
<span>{t.header}</span>
|
|
178
|
-
{#if
|
|
179
|
-
<span class="session-manager__count">{
|
|
175
|
+
{#if fd.playground.sessionCount > 0}
|
|
176
|
+
<span class="session-manager__count">{fd.playground.sessionCount}</span>
|
|
180
177
|
{/if}
|
|
181
178
|
</div>
|
|
182
179
|
<Icon
|
|
@@ -193,7 +190,7 @@
|
|
|
193
190
|
type="button"
|
|
194
191
|
class="session-manager__new-btn"
|
|
195
192
|
onclick={onCreateSession}
|
|
196
|
-
disabled={
|
|
193
|
+
disabled={fd.playground.isLoading}
|
|
197
194
|
>
|
|
198
195
|
<Icon icon="mdi:plus" />
|
|
199
196
|
{t.newSession}
|
|
@@ -201,16 +198,16 @@
|
|
|
201
198
|
|
|
202
199
|
<!-- Sessions List -->
|
|
203
200
|
<div class="session-manager__list">
|
|
204
|
-
{#if
|
|
201
|
+
{#if fd.playground.sessions.length === 0}
|
|
205
202
|
<div class="session-manager__empty">
|
|
206
203
|
<Icon icon="mdi:chat-outline" />
|
|
207
204
|
<span>{t.empty}</span>
|
|
208
205
|
</div>
|
|
209
206
|
{:else}
|
|
210
|
-
{#each
|
|
207
|
+
{#each fd.playground.sessions as session (session.id)}
|
|
211
208
|
<div
|
|
212
209
|
class="session-manager__item"
|
|
213
|
-
class:session-manager__item--active={
|
|
210
|
+
class:session-manager__item--active={fd.playground.currentSession?.id === session.id}
|
|
214
211
|
role="button"
|
|
215
212
|
tabindex="0"
|
|
216
213
|
onclick={() => handleSelectSession(session.id)}
|
|
@@ -1,11 +1,39 @@
|
|
|
1
1
|
import type { EndpointConfig } from '../../config/endpoints.js';
|
|
2
|
+
import type { AuthProvider } from '../../types/auth.js';
|
|
2
3
|
import type { NodeExecutionStatus, KanbanColumnDef } from '../../types/index.js';
|
|
3
4
|
export type NodeStatus = NodeExecutionStatus;
|
|
4
5
|
export interface NodeStatusData {
|
|
5
6
|
status: string;
|
|
6
7
|
last_executed?: string | null;
|
|
7
8
|
execution_time?: number | null;
|
|
9
|
+
/** Precise duration in microseconds, from orchestrator-stamped job metadata */
|
|
10
|
+
execution_time_us?: number | null;
|
|
8
11
|
error?: string | null;
|
|
12
|
+
/** Number of jobs for this node that actually ran (loop iterations) */
|
|
13
|
+
executions?: number | null;
|
|
14
|
+
/** Per-status job counts, e.g. { completed: 2, skipped: 1 } */
|
|
15
|
+
status_counts?: Record<string, number> | null;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* One job from the pipeline payload. Loop-orchestrated workflows create one
|
|
19
|
+
* job per iteration for the same node, so a node can have several of these —
|
|
20
|
+
* the label carries the iteration suffix (e.g. "Invoke tool #2").
|
|
21
|
+
*/
|
|
22
|
+
export interface PipelineJobItem {
|
|
23
|
+
id: string;
|
|
24
|
+
label: string;
|
|
25
|
+
nodeId: string;
|
|
26
|
+
status: string;
|
|
27
|
+
createdAt?: string | null;
|
|
28
|
+
started?: string | null;
|
|
29
|
+
completed?: string | null;
|
|
30
|
+
/** Precise duration in microseconds, when the job ran to completion */
|
|
31
|
+
executionTimeUs?: number | null;
|
|
32
|
+
error?: string | null;
|
|
33
|
+
retryCount?: number | null;
|
|
34
|
+
maxRetries?: number | null;
|
|
35
|
+
inputData?: unknown;
|
|
36
|
+
outputData?: unknown;
|
|
9
37
|
}
|
|
10
38
|
export declare function resolveStatus(raw: NodeStatusData | undefined): NodeStatus;
|
|
11
39
|
/**
|
|
@@ -13,8 +41,9 @@ export declare function resolveStatus(raw: NodeStatusData | undefined): NodeStat
|
|
|
13
41
|
* `endpointConfig` is used once to construct the API client — it must be stable.
|
|
14
42
|
* `getPipelineId` is called on every fetch so pipeline ID changes are picked up.
|
|
15
43
|
*/
|
|
16
|
-
export declare function createPipelineDataFetcher(getPipelineId: () => string, endpointConfig: EndpointConfig): {
|
|
44
|
+
export declare function createPipelineDataFetcher(getPipelineId: () => string, endpointConfig: EndpointConfig, authProvider?: AuthProvider): {
|
|
17
45
|
readonly nodeStatusMap: Record<string, NodeStatusData>;
|
|
46
|
+
readonly jobs: PipelineJobItem[];
|
|
18
47
|
readonly kanbanConfig: KanbanColumnDef[] | null;
|
|
19
48
|
readonly isLoading: boolean;
|
|
20
49
|
readonly isError: boolean;
|
|
@@ -11,6 +11,35 @@ const KNOWN_STATUSES = new Set([
|
|
|
11
11
|
'failed',
|
|
12
12
|
'cancelled'
|
|
13
13
|
]);
|
|
14
|
+
function toJobItem(raw, index) {
|
|
15
|
+
const started = typeof raw.started === 'string' ? raw.started : null;
|
|
16
|
+
const completed = typeof raw.completed === 'string' ? raw.completed : null;
|
|
17
|
+
// Prefer the orchestrator-stamped microsecond duration; fall back to the
|
|
18
|
+
// second-granularity timestamps for jobs that predate the metadata stamp.
|
|
19
|
+
let executionTimeUs = typeof raw.execution_time_us === 'number' ? raw.execution_time_us : null;
|
|
20
|
+
if (executionTimeUs == null && started && completed) {
|
|
21
|
+
const startMs = Date.parse(started);
|
|
22
|
+
const endMs = Date.parse(completed);
|
|
23
|
+
if (!Number.isNaN(startMs) && !Number.isNaN(endMs)) {
|
|
24
|
+
executionTimeUs = (endMs - startMs) * 1000;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
id: typeof raw.id === 'string' || typeof raw.id === 'number' ? String(raw.id) : `job-${index}`,
|
|
29
|
+
label: typeof raw.label === 'string' ? raw.label : '',
|
|
30
|
+
nodeId: typeof raw.node_id === 'string' ? raw.node_id : '',
|
|
31
|
+
status: typeof raw.status === 'string' ? raw.status : 'idle',
|
|
32
|
+
createdAt: typeof raw.created_at === 'string' ? raw.created_at : null,
|
|
33
|
+
started,
|
|
34
|
+
completed,
|
|
35
|
+
executionTimeUs,
|
|
36
|
+
error: typeof raw.error_message === 'string' ? raw.error_message : null,
|
|
37
|
+
retryCount: typeof raw.retry_count === 'number' ? raw.retry_count : null,
|
|
38
|
+
maxRetries: typeof raw.max_retries === 'number' ? raw.max_retries : null,
|
|
39
|
+
inputData: raw.input_data ?? null,
|
|
40
|
+
outputData: raw.output_data ?? null
|
|
41
|
+
};
|
|
42
|
+
}
|
|
14
43
|
export function resolveStatus(raw) {
|
|
15
44
|
if (!raw)
|
|
16
45
|
return 'pending';
|
|
@@ -26,9 +55,10 @@ export function resolveStatus(raw) {
|
|
|
26
55
|
* `endpointConfig` is used once to construct the API client — it must be stable.
|
|
27
56
|
* `getPipelineId` is called on every fetch so pipeline ID changes are picked up.
|
|
28
57
|
*/
|
|
29
|
-
export function createPipelineDataFetcher(getPipelineId, endpointConfig) {
|
|
30
|
-
const client = new EnhancedFlowDropApiClient(endpointConfig);
|
|
58
|
+
export function createPipelineDataFetcher(getPipelineId, endpointConfig, authProvider) {
|
|
59
|
+
const client = new EnhancedFlowDropApiClient(endpointConfig, authProvider);
|
|
31
60
|
let nodeStatusMap = $state({});
|
|
61
|
+
let jobs = $state([]);
|
|
32
62
|
let kanbanConfig = $state(null);
|
|
33
63
|
let isLoading = $state(false);
|
|
34
64
|
let isError = $state(false);
|
|
@@ -43,10 +73,14 @@ export function createPipelineDataFetcher(getPipelineId, endpointConfig) {
|
|
|
43
73
|
status: info.status,
|
|
44
74
|
last_executed: info.last_executed,
|
|
45
75
|
execution_time: info.execution_time,
|
|
46
|
-
|
|
76
|
+
execution_time_us: info.execution_time_us,
|
|
77
|
+
error: info.error,
|
|
78
|
+
executions: info.executions,
|
|
79
|
+
status_counts: info.status_counts
|
|
47
80
|
};
|
|
48
81
|
}
|
|
49
82
|
nodeStatusMap = map;
|
|
83
|
+
jobs = (data.jobs ?? []).map(toJobItem);
|
|
50
84
|
if (data.kanban_config?.columns) {
|
|
51
85
|
// Server sends statuses as string[]; trust the server and cast at this
|
|
52
86
|
// boundary. resolveStatus() handles unknown values at read time.
|
|
@@ -70,6 +104,9 @@ export function createPipelineDataFetcher(getPipelineId, endpointConfig) {
|
|
|
70
104
|
get nodeStatusMap() {
|
|
71
105
|
return nodeStatusMap;
|
|
72
106
|
},
|
|
107
|
+
get jobs() {
|
|
108
|
+
return jobs;
|
|
109
|
+
},
|
|
73
110
|
get kanbanConfig() {
|
|
74
111
|
return kanbanConfig;
|
|
75
112
|
},
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
SurfaceOverlay
|
|
3
|
+
A reusable centered modal shell used to host a surface (or a TabbedSurface of
|
|
4
|
+
several) in the `modal` placement. Portals to `document.body` so the fixed
|
|
5
|
+
backdrop escapes any ancestor that establishes a containing block (transform,
|
|
6
|
+
filter, backdrop-filter, …). Esc and backdrop-click close it.
|
|
7
|
+
|
|
8
|
+
Promotes the modal shell first built inline in ConfigPanel so config, console,
|
|
9
|
+
and chat can all float when their placement is `modal`.
|
|
10
|
+
-->
|
|
11
|
+
|
|
12
|
+
<script lang="ts">
|
|
13
|
+
import type { Snippet } from 'svelte';
|
|
14
|
+
import { portal } from '../../utils/portal.js';
|
|
15
|
+
|
|
16
|
+
interface Props {
|
|
17
|
+
/** Header title. */
|
|
18
|
+
title: string;
|
|
19
|
+
/** Accessible label for the close button. */
|
|
20
|
+
closeLabel?: string;
|
|
21
|
+
/** Called on Esc, backdrop click, or the close button. */
|
|
22
|
+
onClose: () => void;
|
|
23
|
+
/** Overlay body. */
|
|
24
|
+
children: Snippet;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const { title, closeLabel = 'Close', onClose, children }: Props = $props();
|
|
28
|
+
|
|
29
|
+
const uid = $props.id();
|
|
30
|
+
const titleId = `${uid}-surface-overlay-title`;
|
|
31
|
+
|
|
32
|
+
function handleKeydown(event: KeyboardEvent) {
|
|
33
|
+
if (event.key === 'Escape') {
|
|
34
|
+
event.stopPropagation();
|
|
35
|
+
onClose();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function handleBackdropClick(event: MouseEvent) {
|
|
40
|
+
if (event.target === event.currentTarget) {
|
|
41
|
+
onClose();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
47
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
48
|
+
<div
|
|
49
|
+
class="surface-overlay__backdrop"
|
|
50
|
+
use:portal
|
|
51
|
+
onclick={handleBackdropClick}
|
|
52
|
+
onkeydown={handleKeydown}
|
|
53
|
+
>
|
|
54
|
+
<div
|
|
55
|
+
class="surface-overlay"
|
|
56
|
+
role="dialog"
|
|
57
|
+
aria-modal="true"
|
|
58
|
+
aria-labelledby={titleId}
|
|
59
|
+
tabindex="-1"
|
|
60
|
+
>
|
|
61
|
+
<div class="surface-overlay__header">
|
|
62
|
+
<h2 id={titleId} class="surface-overlay__title">{title}</h2>
|
|
63
|
+
<button class="surface-overlay__close" onclick={onClose} aria-label={closeLabel}> × </button>
|
|
64
|
+
</div>
|
|
65
|
+
<div class="surface-overlay__body">
|
|
66
|
+
{@render children()}
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
<style>
|
|
72
|
+
.surface-overlay__backdrop {
|
|
73
|
+
position: fixed;
|
|
74
|
+
inset: 0;
|
|
75
|
+
/*
|
|
76
|
+
Portalled to document.body, this shell sits outside the editor container
|
|
77
|
+
that carries the app font, so it would otherwise inherit the host page's
|
|
78
|
+
default (e.g. serif on a bare Drupal page). Re-establish the font here,
|
|
79
|
+
mirroring the mount container's declaration.
|
|
80
|
+
*/
|
|
81
|
+
font-family: var(--fd-font-family, system-ui, -apple-system, sans-serif);
|
|
82
|
+
background-color: var(--fd-backdrop, rgba(0, 0, 0, 0.5));
|
|
83
|
+
display: flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
justify-content: center;
|
|
86
|
+
z-index: 1000;
|
|
87
|
+
padding: 1rem;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.surface-overlay {
|
|
91
|
+
display: flex;
|
|
92
|
+
flex-direction: column;
|
|
93
|
+
width: 100%;
|
|
94
|
+
max-width: 48rem;
|
|
95
|
+
max-height: 90vh;
|
|
96
|
+
background-color: var(--fd-panel-bg, var(--fd-card));
|
|
97
|
+
border: 1px solid var(--fd-border);
|
|
98
|
+
border-radius: var(--fd-radius-lg, 0.75rem);
|
|
99
|
+
box-shadow: var(--fd-shadow-lg, 0 20px 25px -5px rgba(0, 0, 0, 0.25));
|
|
100
|
+
overflow: hidden;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.surface-overlay__header {
|
|
104
|
+
display: flex;
|
|
105
|
+
justify-content: space-between;
|
|
106
|
+
align-items: center;
|
|
107
|
+
padding: 0.875rem 1rem;
|
|
108
|
+
border-bottom: 1px solid var(--fd-border);
|
|
109
|
+
background-color: var(--fd-card);
|
|
110
|
+
flex-shrink: 0;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.surface-overlay__title {
|
|
114
|
+
margin: 0;
|
|
115
|
+
font-size: 1rem;
|
|
116
|
+
font-weight: 600;
|
|
117
|
+
color: var(--fd-foreground);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.surface-overlay__close {
|
|
121
|
+
background: none;
|
|
122
|
+
border: none;
|
|
123
|
+
font-size: 1.25rem;
|
|
124
|
+
line-height: 1;
|
|
125
|
+
cursor: pointer;
|
|
126
|
+
color: var(--fd-muted-foreground);
|
|
127
|
+
padding: 0.25rem;
|
|
128
|
+
border-radius: var(--fd-radius-sm);
|
|
129
|
+
transition:
|
|
130
|
+
color var(--fd-transition-fast),
|
|
131
|
+
background-color var(--fd-transition-fast);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.surface-overlay__close:hover {
|
|
135
|
+
color: var(--fd-foreground);
|
|
136
|
+
background-color: var(--fd-subtle);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.surface-overlay__body {
|
|
140
|
+
flex: 1;
|
|
141
|
+
min-height: 0;
|
|
142
|
+
overflow-y: auto;
|
|
143
|
+
display: flex;
|
|
144
|
+
flex-direction: column;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
@media (max-width: 640px) {
|
|
148
|
+
.surface-overlay {
|
|
149
|
+
max-width: 100%;
|
|
150
|
+
max-height: 95vh;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
</style>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
interface Props {
|
|
3
|
+
/** Header title. */
|
|
4
|
+
title: string;
|
|
5
|
+
/** Accessible label for the close button. */
|
|
6
|
+
closeLabel?: string;
|
|
7
|
+
/** Called on Esc, backdrop click, or the close button. */
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
/** Overlay body. */
|
|
10
|
+
children: Snippet;
|
|
11
|
+
}
|
|
12
|
+
declare const SurfaceOverlay: import("svelte").Component<Props, {}, "">;
|
|
13
|
+
type SurfaceOverlay = ReturnType<typeof SurfaceOverlay>;
|
|
14
|
+
export default SurfaceOverlay;
|