@flowdrop/flowdrop 2.16.0 → 2.17.0
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 +80 -0
- package/README.md +6 -1
- package/dist/components/App.svelte +212 -6
- package/dist/components/App.svelte.d.ts +2 -0
- package/dist/components/CanvasToolbar.svelte +40 -3
- package/dist/components/CanvasToolbar.svelte.d.ts +5 -1
- package/dist/components/ConnectPortPicker.svelte +8 -4
- package/dist/components/DoctorMenu.svelte +208 -126
- package/dist/components/ImpactConfirm.svelte +341 -0
- package/dist/components/ImpactConfirm.svelte.d.ts +12 -0
- package/dist/components/Navbar.svelte +42 -3
- package/dist/components/Navbar.svelte.d.ts +4 -0
- package/dist/components/NodeSidebar.svelte +36 -15
- package/dist/components/NodeSidebar.svelte.d.ts +2 -0
- package/dist/components/NodeSwapPicker.svelte +4 -14
- package/dist/components/RunBar.svelte +36 -1
- package/dist/components/RunBar.svelte.d.ts +5 -0
- package/dist/components/RunInputsDialog.svelte +198 -0
- package/dist/components/RunInputsDialog.svelte.d.ts +34 -0
- package/dist/components/WorkflowCompareDialog.svelte +177 -0
- package/dist/components/WorkflowCompareDialog.svelte.d.ts +10 -0
- package/dist/components/WorkflowEditor.svelte +88 -6
- package/dist/components/WorkflowEditor.svelte.d.ts +6 -0
- package/dist/components/WorkflowInterfaceEditor.svelte +14 -4
- package/dist/components/WorkflowInterfaceEntryCard.svelte +19 -3
- package/dist/components/WorkflowInterfaceEntryCard.svelte.d.ts +2 -0
- package/dist/components/nodes/NodeCard.svelte +2 -2
- package/dist/components/toast/DismissibleToast.svelte +25 -6
- package/dist/components/toast/DismissibleToast.svelte.d.ts +3 -0
- package/dist/config/endpoints.d.ts +7 -0
- package/dist/config/endpoints.js +2 -1
- package/dist/editor/connectCandidates.d.ts +3 -0
- package/dist/editor/connectCandidates.js +14 -5
- package/dist/editor/index.d.ts +1 -1
- package/dist/editor/index.js +1 -1
- package/dist/helpers/workflowEditorHelper.d.ts +15 -0
- package/dist/helpers/workflowEditorHelper.js +9 -0
- package/dist/index.d.ts +1 -0
- package/dist/messages/defaults.d.ts +100 -0
- package/dist/messages/defaults.js +91 -1
- package/dist/services/draftStorage.d.ts +24 -10
- package/dist/services/draftStorage.js +60 -35
- package/dist/services/globalSave.d.ts +28 -10
- package/dist/services/globalSave.js +135 -31
- package/dist/services/impactGate.d.ts +34 -0
- package/dist/services/impactGate.js +70 -0
- package/dist/services/impactService.d.ts +28 -0
- package/dist/services/impactService.js +71 -0
- package/dist/services/toastQueue.d.ts +9 -0
- package/dist/services/toastService.d.ts +4 -0
- package/dist/services/toastService.js +9 -3
- package/dist/services/workflowLaunchService.js +3 -1
- package/dist/settings/index.d.ts +2 -2
- package/dist/settings/index.js +1 -1
- package/dist/stores/doctorStore.svelte.d.ts +24 -1
- package/dist/stores/doctorStore.svelte.js +105 -2
- package/dist/stores/instanceContainer.svelte.d.ts +16 -0
- package/dist/stores/instanceContainer.svelte.js +22 -2
- package/dist/stores/saveConflictStore.svelte.d.ts +62 -0
- package/dist/stores/saveConflictStore.svelte.js +169 -0
- package/dist/stores/workflowStore.svelte.d.ts +7 -3
- package/dist/stores/workflowStore.svelte.js +14 -5
- package/dist/styles/toast.css +10 -1
- package/dist/svelte-app.d.ts +2 -0
- package/dist/svelte-app.js +74 -2
- package/dist/types/doctor.d.ts +3 -1
- package/dist/types/events.d.ts +20 -0
- package/dist/types/events.js +2 -0
- package/dist/types/impact.d.ts +25 -0
- package/dist/types/impact.js +7 -0
- package/dist/types/settings.d.ts +31 -0
- package/dist/types/settings.js +132 -0
- package/dist/utils/draftRestore.d.ts +27 -0
- package/dist/utils/draftRestore.js +36 -0
- package/dist/utils/interfaceTags.js +4 -1
- package/dist/utils/nodeSearch.d.ts +10 -0
- package/dist/utils/nodeSearch.js +37 -0
- package/dist/utils/runOffer.d.ts +21 -0
- package/dist/utils/runOffer.js +13 -0
- package/dist/utils/workflowCompare.d.ts +35 -0
- package/dist/utils/workflowCompare.js +84 -0
- package/dist/utils/workflowInterface.d.ts +26 -1
- package/dist/utils/workflowInterface.js +91 -11
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,86 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [2.17.0] - 2026-11-04
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Save asks before a change that breaks or switches off what uses the workflow, listing what is affected and asking to save anyway (needs the new optional `workflows.impact` endpoint). The dialog opens on Cancel and is a native modal dialog.
|
|
13
|
+
|
|
14
|
+
- **Field schema for every editor setting.** `SETTINGS_FIELD_SCHEMA` (and the `SettingsFieldSchema` type),
|
|
15
|
+
exported from `@flowdrop/flowdrop/settings`, describes each setting: its type, a short label and the
|
|
16
|
+
values it allows.
|
|
17
|
+
|
|
18
|
+
- Publishing a generic port (data, value, ...) suggests the id, title and type from the node instead of data, data_2 and Mixed.
|
|
19
|
+
|
|
20
|
+
- New interface rows open their Title, Description, Required and Example fields; Mixed and untitled inputs are flagged.
|
|
21
|
+
|
|
22
|
+
- Toasts accept `actions` (several follow-up buttons); a toast with actions stays until it is closed.
|
|
23
|
+
|
|
24
|
+
- The navbar's main action (Save) shows a dot and says 'Unsaved changes' while the workflow has changes that are not saved.
|
|
25
|
+
|
|
26
|
+
- mountFlowDropApp asks the browser to confirm leaving the page while there are unsaved changes (`features.confirmUnsavedLeave`, on by default).
|
|
27
|
+
|
|
28
|
+
- When a stored draft differs from the loaded workflow, the editor offers Restore or Discard (and says when the workflow was saved after the draft).
|
|
29
|
+
|
|
30
|
+
- A compare dialog lists the steps, wires, interface and chat settings that differ between two versions of a workflow.
|
|
31
|
+
|
|
32
|
+
- A save refused with 409 CONFLICT shows Keep mine / Load theirs / Compare instead of a plain error.
|
|
33
|
+
|
|
34
|
+
- Edit mode has a Run button (`features.runButton`, on with the default endpoint config; `false` turns it off): it saves unsaved changes first, then starts the workflow through `host.onRun` or the `workflows.run` endpoint and shows the run on the canvas.
|
|
35
|
+
|
|
36
|
+
- Run opens a form built from the workflow interface's inputs and remembers the last values for the page.
|
|
37
|
+
|
|
38
|
+
- The run pill links 'Open run' when `features.adminLinks.run` is set; a queued run says it waits for the site's queue.
|
|
39
|
+
|
|
40
|
+
- Doctor remedies with `params.automatic: true` are applied by the editor when their problem first appears after load, as one undoable edit with an Undo toast.
|
|
41
|
+
|
|
42
|
+
- The Problems indicator shows 'Checking...' for a slow check and 'Check unavailable' with Retry when the check fails, instead of staying blank.
|
|
43
|
+
|
|
44
|
+
- The editor offers a 'Skip to the canvas' link, and mountFlowDropApp accepts navbarTitleLevel to render the title as the page's H1.
|
|
45
|
+
|
|
46
|
+
- Node search in the palette and the swap picker ranks exact name and keyword matches first.
|
|
47
|
+
|
|
48
|
+
- A palette item can be added by click or Enter: next to the selected node, else in the middle of the view.
|
|
49
|
+
|
|
50
|
+
- Port pins can be reached with Tab; Enter opens the port menu with 'Connect to…'.
|
|
51
|
+
|
|
52
|
+
### Fixed
|
|
53
|
+
|
|
54
|
+
- Drafts carry `metadata.baseRevision`, include interface and Playground edits, and are removed when the workflow is saved; `draftFingerprint` is exported.
|
|
55
|
+
|
|
56
|
+
- Run asks for a workflow's inputs also when it has no Playground settings.
|
|
57
|
+
|
|
58
|
+
- Autosave never opens the impact question: a save that needs an answer is skipped, the workflow stays unsaved, and an info toast says once that autosave waits for Save (no further impact request until the workflow changes). A 401 or 403 from the impact route counts as no impact check, like 404 and 405.
|
|
59
|
+
|
|
60
|
+
- Doctor's Undo only undoes the automatic fix, and its toast goes once the history moves on. A reload never applies an automatic fix again.
|
|
61
|
+
|
|
62
|
+
- The save conflict toast follows `showToasts` and `onApiError`.
|
|
63
|
+
|
|
64
|
+
- Host `messages` reach the impact dialog, the draft offer, the conflict toast and the Doctor toast.
|
|
65
|
+
|
|
66
|
+
- A stored draft stays while its Restore or Discard offer is open, however long the offer waits.
|
|
67
|
+
|
|
68
|
+
- Port pins are Tab stops only on the selected node, not on every node; the palette adds one node per key press (Enter on key down, Space on key up).
|
|
69
|
+
|
|
70
|
+
- A generated interface id keeps accented letters as plain letters (`Übersetzung` gives `ubersetzung`).
|
|
71
|
+
|
|
72
|
+
- "Connect to…" lists trigger pins under "Other types" when connecting a data port, and data ports when connecting a trigger pin.
|
|
73
|
+
|
|
74
|
+
- Port and interface pickers show each node's own title, and add the node id when two nodes share a name.
|
|
75
|
+
|
|
76
|
+
- An edit made while a save is in flight stays unsaved instead of being marked saved. `WorkflowStore.markAsSaved(version?)` takes the edit version the save was taken at, and `globalSaveWorkflow`'s `onMarkAsSaved` receives it.
|
|
77
|
+
|
|
78
|
+
- A second save while one is in flight joins it instead of sending the old revision again (which the server refused as a conflict). A Save pressed during an autosave that is waiting for the impact answer asks the question itself.
|
|
79
|
+
|
|
80
|
+
- The impact question comes before `onBeforeSave`, so a cancelled question never leaves a host with `onBeforeSave` and no outcome hook; Cmd+S or autosave while the question is open no longer moves the focus out of it.
|
|
81
|
+
|
|
82
|
+
- The save conflict choices stay on screen after Compare is cancelled or loading the saved version fails (toast actions accept `keepOpen`); the compare dialog heads its shared list 'Different in the two versions' and names steps by their title.
|
|
83
|
+
|
|
84
|
+
- The Run form and the compare dialog take the editor's skin; the Run form no longer closes when a text selection ends over the backdrop.
|
|
85
|
+
|
|
86
|
+
- The Problems indicator announces 'Checking...' and 'Check unavailable' to screen readers; a new automatic fix replaces the previous Undo toast; an impact question closes when its editor is destroyed.
|
|
87
|
+
|
|
8
88
|
## [2.16.0] - 2026-10-24
|
|
9
89
|
|
|
10
90
|
### Added
|
package/README.md
CHANGED
|
@@ -283,12 +283,17 @@ FLOWDROP_API_BASE_URL=http://your-backend/api node build
|
|
|
283
283
|
|
|
284
284
|
Runtime configuration means you build once and deploy to staging, production, or anywhere else with just environment variables.
|
|
285
285
|
|
|
286
|
+
## Specification
|
|
287
|
+
|
|
288
|
+
The editor implements the [FlowDrop Workflow Specification](https://flowdrop.io/spec/), version 1.0: the rules a FlowDrop workflow obeys, stated independently of any one implementation. The specification has 386 numbered rules (217 core, 167 extended, 2 optional) covering how a workflow is written, stored, validated and executed, with rulings for the hard cases and conformance fixtures you can run against your own backend. Rules are also published as [machine-readable JSON](https://flowdrop.io/spec/rules.json), and the source is on [GitHub](https://github.com/flowdrop-io/flowdrop-spec).
|
|
289
|
+
|
|
286
290
|
## Documentation
|
|
287
291
|
|
|
288
292
|
| Resource | Description |
|
|
289
293
|
| -------------------------------------------------------------------------------------------- | ------------------------ |
|
|
290
294
|
| [QUICK_START.md](https://flowdrop.mintlify.app/docs/quickstart) | Get running in 5 minutes |
|
|
291
|
-
| [API Documentation](https://flowdrop.
|
|
295
|
+
| [API Documentation](https://flowdrop.io/docs/api/) | REST API specification |
|
|
296
|
+
| [Workflow Specification](https://flowdrop.io/spec/) | Rules for workflows |
|
|
292
297
|
| [CHANGELOG.md](https://github.com/flowdrop-io/flowdrop/blob/main/libs/flowdrop/CHANGELOG.md) | Version history |
|
|
293
298
|
|
|
294
299
|
## Development
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
<script lang="ts">
|
|
8
8
|
import type { ContextMenuOptions } from '../editor/contextMenu.js';
|
|
9
|
-
import { onMount, tick, untrack } from 'svelte';
|
|
9
|
+
import { onDestroy, onMount, tick, untrack } from 'svelte';
|
|
10
10
|
import { MediaQuery } from 'svelte/reactivity';
|
|
11
11
|
import { on } from 'svelte/events';
|
|
12
12
|
import MainLayout from './layouts/MainLayout.svelte';
|
|
@@ -21,10 +21,16 @@
|
|
|
21
21
|
import ConfigForm from './ConfigForm.svelte';
|
|
22
22
|
import NodeInspector from './NodeInspector.svelte';
|
|
23
23
|
import WorkflowSettingsPanel from './WorkflowSettingsPanel.svelte';
|
|
24
|
+
import WorkflowCompareDialog from './WorkflowCompareDialog.svelte';
|
|
25
|
+
import RunInputsDialog from './RunInputsDialog.svelte';
|
|
24
26
|
import ConfigPanel from './ConfigPanel.svelte';
|
|
25
27
|
import WorkflowInterfaceEditor from './WorkflowInterfaceEditor.svelte';
|
|
26
28
|
import WorkflowPlaygroundSettings from './WorkflowPlaygroundSettings.svelte';
|
|
27
|
-
import {
|
|
29
|
+
import {
|
|
30
|
+
resolvePlaygroundChat,
|
|
31
|
+
withPlaygroundChat,
|
|
32
|
+
withoutInterfaceTurns
|
|
33
|
+
} from '../utils/playgroundChat.js';
|
|
28
34
|
import ReadOnlyDetails from './ReadOnlyDetails.svelte';
|
|
29
35
|
import CommandConsole from './console/CommandConsole.svelte';
|
|
30
36
|
import ConsoleStrip from './console/ConsoleStrip.svelte';
|
|
@@ -80,7 +86,10 @@
|
|
|
80
86
|
import { provideInstance } from '../stores/getInstance.svelte.js';
|
|
81
87
|
import type { FlowDropInstance } from '../stores/instanceContainer.svelte.js';
|
|
82
88
|
import { globalSaveWorkflow, globalExportWorkflow } from '../services/globalSave.js';
|
|
83
|
-
import { apiToasts, dismissToast } from '../services/toastService.js';
|
|
89
|
+
import { apiToasts, dismissToast, showError, showInfo } from '../services/toastService.js';
|
|
90
|
+
import { workflowLaunchService } from '../services/workflowLaunchService.js';
|
|
91
|
+
import { canOfferRun } from '../utils/runOffer.js';
|
|
92
|
+
import { collectInterfaceInputs, interfaceFormEntriesFor } from '../utils/workflowInterface.js';
|
|
84
93
|
import { initAutoSave } from '../services/autoSaveService.js';
|
|
85
94
|
import {
|
|
86
95
|
getUiSettings,
|
|
@@ -191,6 +200,8 @@
|
|
|
191
200
|
refreshTrigger?: number;
|
|
192
201
|
/** Custom navbar title */
|
|
193
202
|
navbarTitle?: string;
|
|
203
|
+
/** Heading level of the navbar title: 1 renders it as the page's H1 (default 2) */
|
|
204
|
+
navbarTitleLevel?: 1 | 2;
|
|
194
205
|
/** Custom navbar actions */
|
|
195
206
|
navbarActions?: NavbarAction[];
|
|
196
207
|
/** White-label logo for the navbar (replaces the FlowDrop wordmark) */
|
|
@@ -286,6 +297,7 @@
|
|
|
286
297
|
pipelineId,
|
|
287
298
|
refreshTrigger = 0,
|
|
288
299
|
navbarTitle,
|
|
300
|
+
navbarTitleLevel = 2,
|
|
289
301
|
navbarActions = [],
|
|
290
302
|
branding,
|
|
291
303
|
navbarEnd,
|
|
@@ -462,6 +474,10 @@
|
|
|
462
474
|
// — Svelte enforces that. The context value is a getter that closes over
|
|
463
475
|
// the live $derived, so child components always read the current tree.
|
|
464
476
|
setMessages(() => mergedMessages);
|
|
477
|
+
// Code outside the component tree (the impact dialog) reads the same tree from the instance.
|
|
478
|
+
fd.setMessages(() => mergedMessages);
|
|
479
|
+
// Do not leave the instance holding a getter into this destroyed component.
|
|
480
|
+
onDestroy(() => fd.setMessages(() => defaultMessages));
|
|
465
481
|
|
|
466
482
|
// Default navbar primary actions — used when no `navbarActions` prop is supplied.
|
|
467
483
|
// Derived so the labels track locale changes.
|
|
@@ -566,6 +582,122 @@
|
|
|
566
582
|
let error = $state<string | null>(null);
|
|
567
583
|
let endpointConfig = $state<EndpointConfig | null>(null);
|
|
568
584
|
|
|
585
|
+
/**
|
|
586
|
+
* The Edit canvas offers a Run button: editable, saved, and either the host
|
|
587
|
+
* supplies `onRun` or the backend has the `workflows.run` endpoint.
|
|
588
|
+
*/
|
|
589
|
+
const runOffered = $derived(
|
|
590
|
+
canOfferRun({
|
|
591
|
+
runButton: features.runButton,
|
|
592
|
+
canvasEditable,
|
|
593
|
+
pipelineId,
|
|
594
|
+
workflowId: fd.workflow.current?.id,
|
|
595
|
+
hostCanRun: !!fd.host.current.onRun,
|
|
596
|
+
backendCanRun: workflowLaunchService.isSupported(endpointConfig)
|
|
597
|
+
})
|
|
598
|
+
);
|
|
599
|
+
let runStarting = $state(false);
|
|
600
|
+
|
|
601
|
+
// The Run form: open while it asks for the inputs; the values stay per workflow id for the page.
|
|
602
|
+
let runDialogOpen = $state(false);
|
|
603
|
+
let runDialogValues = $state<Record<string, unknown>>({});
|
|
604
|
+
let runDialogError = $state<string | null>(null);
|
|
605
|
+
const runInputValues = new Map<string, Record<string, unknown>>();
|
|
606
|
+
|
|
607
|
+
/** The inputs a person fills in before a run: the interface inputs the chat binding does not fill. */
|
|
608
|
+
const runInputEntries = $derived.by(() => {
|
|
609
|
+
const workflow = fd.workflow.current;
|
|
610
|
+
if (!workflow) return [];
|
|
611
|
+
// Every input the chat does not fill, also in the Playground's legacy mode (no turn ports, no
|
|
612
|
+
// settings): the server refuses a run that leaves a required input out.
|
|
613
|
+
return interfaceFormEntriesFor(workflow.interface, resolvePlaygroundChat(workflow));
|
|
614
|
+
});
|
|
615
|
+
|
|
616
|
+
/**
|
|
617
|
+
* Start the run with these inputs through `host.onRun` or the `workflows.run` endpoint and show it
|
|
618
|
+
* as the shown run. Returns the reason when the run did not start, `null` otherwise.
|
|
619
|
+
*/
|
|
620
|
+
async function launchRun(inputs: Record<string, unknown>): Promise<string | null> {
|
|
621
|
+
const workflow = fd.workflow.current;
|
|
622
|
+
if (!workflow?.id) return null;
|
|
623
|
+
try {
|
|
624
|
+
const hostOnRun = fd.host.current.onRun;
|
|
625
|
+
if (hostOnRun) {
|
|
626
|
+
const envelope = await fd.runs.wrapHostHooks(fd.host.current).onRun!(inputs);
|
|
627
|
+
if (envelope.ok && (envelope.data as { queued?: boolean } | undefined)?.queued) {
|
|
628
|
+
showInfo(mergedMessages.runButton.queued);
|
|
629
|
+
}
|
|
630
|
+
return envelope.ok ? null : (envelope.message ?? mergedMessages.runButton.failed);
|
|
631
|
+
}
|
|
632
|
+
const result = await workflowLaunchService.launch(
|
|
633
|
+
endpointConfig,
|
|
634
|
+
workflow.id,
|
|
635
|
+
{ inputs, workflow },
|
|
636
|
+
authProvider
|
|
637
|
+
);
|
|
638
|
+
if (result.status === 'launched') {
|
|
639
|
+
fd.runs.openRun(result.pipelineId, result.runStatus);
|
|
640
|
+
if (result.queued) showInfo(mergedMessages.runButton.queued);
|
|
641
|
+
return null;
|
|
642
|
+
}
|
|
643
|
+
if (result.status === 'unsupported') return null;
|
|
644
|
+
return 'message' in result ? result.message : mergedMessages.runButton.failed;
|
|
645
|
+
} catch (error) {
|
|
646
|
+
return error instanceof Error ? error.message : mergedMessages.runButton.failed;
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
/**
|
|
651
|
+
* Run the workflow from the canvas: save unsaved changes first, then start the run. A workflow
|
|
652
|
+
* with inputs opens the Run form; one without runs at once. A refusal shows the server's message.
|
|
653
|
+
*/
|
|
654
|
+
async function startRun(): Promise<void> {
|
|
655
|
+
if (runStarting) return;
|
|
656
|
+
runStarting = true;
|
|
657
|
+
try {
|
|
658
|
+
if (fd.workflow.isDirty) {
|
|
659
|
+
// The save toast already explains a failed save.
|
|
660
|
+
if (!(await saveWorkflow())) return;
|
|
661
|
+
}
|
|
662
|
+
const workflow = fd.workflow.current;
|
|
663
|
+
if (!workflow?.id) return;
|
|
664
|
+
if (runInputEntries.length > 0) {
|
|
665
|
+
runDialogValues = runInputValues.get(workflow.id) ?? {};
|
|
666
|
+
runDialogError = null;
|
|
667
|
+
runDialogOpen = true;
|
|
668
|
+
return;
|
|
669
|
+
}
|
|
670
|
+
const refusal = await launchRun({});
|
|
671
|
+
if (refusal) showError(refusal);
|
|
672
|
+
} finally {
|
|
673
|
+
runStarting = false;
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
/** Run from the form: empty required inputs are refused here; a refusal from the server stays in the form. */
|
|
678
|
+
async function submitRunInputs(): Promise<void> {
|
|
679
|
+
const workflowId = fd.workflow.current?.id;
|
|
680
|
+
if (runStarting || !workflowId) return;
|
|
681
|
+
runInputValues.set(workflowId, runDialogValues);
|
|
682
|
+
const collected = collectInterfaceInputs(runInputEntries, runDialogValues);
|
|
683
|
+
if (!collected.ok) {
|
|
684
|
+
const names = (list: { id: string }[]) => list.map((entry) => entry.id).join(', ');
|
|
685
|
+
runDialogError = collected.missing.length
|
|
686
|
+
? mergedMessages.runInputsDialog.missing({ names: names(collected.missing) })
|
|
687
|
+
: mergedMessages.runInputsDialog.invalid({ names: names(collected.invalid) });
|
|
688
|
+
return;
|
|
689
|
+
}
|
|
690
|
+
runStarting = true;
|
|
691
|
+
runDialogError = null;
|
|
692
|
+
try {
|
|
693
|
+
const refusal = await launchRun(collected.inputs);
|
|
694
|
+
if (refusal) runDialogError = refusal;
|
|
695
|
+
else runDialogOpen = false;
|
|
696
|
+
} finally {
|
|
697
|
+
runStarting = false;
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
|
|
569
701
|
// ConfigSidebar state
|
|
570
702
|
let isConfigSidebarOpen = $state(false);
|
|
571
703
|
let selectedNodeId = $state<string | null>(null);
|
|
@@ -941,6 +1073,7 @@
|
|
|
941
1073
|
return true;
|
|
942
1074
|
}
|
|
943
1075
|
$effect(() => fd.doctor.setFocusHandler(focusProblemNode));
|
|
1076
|
+
$effect(() => fd.doctor.setAutoApply(canvasEditable));
|
|
944
1077
|
|
|
945
1078
|
// The Doctor diagnoses the draft a moment after each edit, and on load (and
|
|
946
1079
|
// once the workflow has an id). Reading the version and the id is the trigger.
|
|
@@ -1172,7 +1305,7 @@
|
|
|
1172
1305
|
: undefined
|
|
1173
1306
|
);
|
|
1174
1307
|
|
|
1175
|
-
async function saveWorkflow(): Promise<boolean> {
|
|
1308
|
+
async function saveWorkflow(options: { interactive?: boolean } = {}): Promise<boolean> {
|
|
1176
1309
|
// Commit any in-flight config edit so the save and its history are
|
|
1177
1310
|
// consistent (the value itself is already live in the store).
|
|
1178
1311
|
flushNodeConfigEdit();
|
|
@@ -1180,7 +1313,8 @@
|
|
|
1180
1313
|
eventHandlers: { onBeforeSave, onAfterSave, onSaveError, onApiError },
|
|
1181
1314
|
features,
|
|
1182
1315
|
instance: fd,
|
|
1183
|
-
|
|
1316
|
+
interactive: options.interactive,
|
|
1317
|
+
onMarkAsSaved: (version) => fd.workflow.markAsSaved(version)
|
|
1184
1318
|
});
|
|
1185
1319
|
}
|
|
1186
1320
|
|
|
@@ -1342,7 +1476,8 @@
|
|
|
1342
1476
|
const cleanupAutoSave = initAutoSave({
|
|
1343
1477
|
isDirty: () => fd.workflow.isDirty,
|
|
1344
1478
|
onSave: async () => {
|
|
1345
|
-
|
|
1479
|
+
// A timer must not open a question: a save that needs an answer waits.
|
|
1480
|
+
await saveWorkflow({ interactive: false });
|
|
1346
1481
|
},
|
|
1347
1482
|
onError: (error) => {
|
|
1348
1483
|
// Don't show toast for auto-save errors to avoid noise
|
|
@@ -1489,6 +1624,7 @@
|
|
|
1489
1624
|
const consoleStripShown = $derived(consoleGroupOffered && canvasEditable);
|
|
1490
1625
|
/** Id of the Console panel, for the strip's `aria-controls`. */
|
|
1491
1626
|
const consolePanelId = `${scopeId}-console-panel`;
|
|
1627
|
+
const canvasRegionId = `${scopeId}-canvas`;
|
|
1492
1628
|
/** Node-swap sub-flow occupies the right sidebar regardless of placement. */
|
|
1493
1629
|
const swapActive = $derived(swapMode !== 'idle');
|
|
1494
1630
|
|
|
@@ -2032,6 +2168,7 @@
|
|
|
2032
2168
|
activeFormat={fd.workflow.format}
|
|
2033
2169
|
categoriesDefaultOpen={themeConfig?.sidebar?.categoriesDefaultOpen ?? false}
|
|
2034
2170
|
listStyle={themeConfig?.display?.sidebarList}
|
|
2171
|
+
onadd={(n) => workflowEditorRef?.addNodeFromPalette(n)}
|
|
2035
2172
|
/>
|
|
2036
2173
|
{/if}
|
|
2037
2174
|
{/snippet}
|
|
@@ -2094,6 +2231,14 @@
|
|
|
2094
2231
|
|
|
2095
2232
|
<!-- MainLayout wrapper for workflow editor -->
|
|
2096
2233
|
<div class="flowdrop-root" data-fd-scope={scopeId} use:themeScope={{ mirror: true }}>
|
|
2234
|
+
<a
|
|
2235
|
+
class="flowdrop-skip-link"
|
|
2236
|
+
href={`#${canvasRegionId}`}
|
|
2237
|
+
onclick={(e) => {
|
|
2238
|
+
e.preventDefault();
|
|
2239
|
+
document.getElementById(canvasRegionId)?.focus();
|
|
2240
|
+
}}>{mergedMessages.layout.skipToCanvas}</a
|
|
2241
|
+
>
|
|
2097
2242
|
<MainLayout
|
|
2098
2243
|
{height}
|
|
2099
2244
|
{width}
|
|
@@ -2126,12 +2271,14 @@
|
|
|
2126
2271
|
{/snippet}
|
|
2127
2272
|
<Navbar
|
|
2128
2273
|
title={breadcrumbTitle}
|
|
2274
|
+
titleLevel={navbarTitleLevel}
|
|
2129
2275
|
primaryActions={navbarActions.length > 0 ? navbarActions : defaultPrimaryActions}
|
|
2130
2276
|
{showStatus}
|
|
2131
2277
|
{showSettings}
|
|
2132
2278
|
{branding}
|
|
2133
2279
|
end={navbarEnd}
|
|
2134
2280
|
saveShortcut
|
|
2281
|
+
dirty={canvasEditable && fd.workflow.isDirty}
|
|
2135
2282
|
onWorkflowSettings={toggleWorkflowSettings}
|
|
2136
2283
|
status={doctorStatus}
|
|
2137
2284
|
workflowSettingsOpen={isWorkflowSettingsOpen}
|
|
@@ -2304,6 +2451,8 @@
|
|
|
2304
2451
|
closeActiveConfig();
|
|
2305
2452
|
} else closeConfigSidebar();
|
|
2306
2453
|
}}
|
|
2454
|
+
id={canvasRegionId}
|
|
2455
|
+
tabindex="-1"
|
|
2307
2456
|
role="region"
|
|
2308
2457
|
aria-label={mergedMessages.layout.workflowCanvas}
|
|
2309
2458
|
>
|
|
@@ -2402,6 +2551,7 @@
|
|
|
2402
2551
|
activeFormat={fd.workflow.format}
|
|
2403
2552
|
categoriesDefaultOpen={themeConfig?.sidebar?.categoriesDefaultOpen ?? false}
|
|
2404
2553
|
listStyle={themeConfig?.display?.sidebarList}
|
|
2554
|
+
onadd={(n) => workflowEditorRef?.addNodeFromPalette(n)}
|
|
2405
2555
|
/>
|
|
2406
2556
|
</div>
|
|
2407
2557
|
{/if}
|
|
@@ -2424,6 +2574,8 @@
|
|
|
2424
2574
|
editorMode={effectiveEditorMode}
|
|
2425
2575
|
onEditorModeChange={testModeAvailable ? (next) => fd.editorMode.set(next) : undefined}
|
|
2426
2576
|
onOpenTest={testModeAvailable ? () => fd.editorMode.set('test') : undefined}
|
|
2577
|
+
onRun={runOffered ? () => void startRun() : undefined}
|
|
2578
|
+
runBusy={runStarting}
|
|
2427
2579
|
onAskAssistant={askAssistant}
|
|
2428
2580
|
showRuns={testMode && features.runsList}
|
|
2429
2581
|
adminLinks={features.adminLinks}
|
|
@@ -2431,6 +2583,33 @@
|
|
|
2431
2583
|
/>
|
|
2432
2584
|
</div>
|
|
2433
2585
|
</MainLayout>
|
|
2586
|
+
|
|
2587
|
+
{#if runOffered}
|
|
2588
|
+
<RunInputsDialog
|
|
2589
|
+
open={runDialogOpen}
|
|
2590
|
+
workflowName={fd.workflow.current?.name ?? ''}
|
|
2591
|
+
entries={runInputEntries}
|
|
2592
|
+
values={runDialogValues}
|
|
2593
|
+
onChange={(values) => {
|
|
2594
|
+
runDialogValues = values;
|
|
2595
|
+
const id = fd.workflow.current?.id;
|
|
2596
|
+
if (id) runInputValues.set(id, values);
|
|
2597
|
+
}}
|
|
2598
|
+
onRun={() => void submitRunInputs()}
|
|
2599
|
+
runBusy={runStarting}
|
|
2600
|
+
error={runDialogError}
|
|
2601
|
+
onClose={() => (runDialogOpen = false)}
|
|
2602
|
+
/>
|
|
2603
|
+
{/if}
|
|
2604
|
+
|
|
2605
|
+
{#if fd.saveConflict.comparison}
|
|
2606
|
+
<WorkflowCompareDialog
|
|
2607
|
+
comparison={fd.saveConflict.comparison}
|
|
2608
|
+
onKeepMine={() => void fd.saveConflict.keepMine()}
|
|
2609
|
+
onLoadTheirs={() => fd.saveConflict.acceptTheirs()}
|
|
2610
|
+
onClose={() => fd.saveConflict.closeComparison()}
|
|
2611
|
+
/>
|
|
2612
|
+
{/if}
|
|
2434
2613
|
</div>
|
|
2435
2614
|
|
|
2436
2615
|
<!--
|
|
@@ -2474,6 +2653,33 @@
|
|
|
2474
2653
|
{/if}
|
|
2475
2654
|
|
|
2476
2655
|
<style>
|
|
2656
|
+
/* Hidden until focused, then the first thing on screen. */
|
|
2657
|
+
.flowdrop-skip-link {
|
|
2658
|
+
position: absolute;
|
|
2659
|
+
width: 1px;
|
|
2660
|
+
height: 1px;
|
|
2661
|
+
overflow: hidden;
|
|
2662
|
+
clip-path: inset(50%);
|
|
2663
|
+
white-space: nowrap;
|
|
2664
|
+
}
|
|
2665
|
+
|
|
2666
|
+
.flowdrop-skip-link:focus {
|
|
2667
|
+
position: fixed;
|
|
2668
|
+
top: var(--fd-space-xs);
|
|
2669
|
+
left: var(--fd-space-xs);
|
|
2670
|
+
z-index: 1000;
|
|
2671
|
+
width: auto;
|
|
2672
|
+
height: auto;
|
|
2673
|
+
overflow: visible;
|
|
2674
|
+
clip-path: none;
|
|
2675
|
+
padding: var(--fd-space-xs) var(--fd-space-md);
|
|
2676
|
+
background: var(--fd-background);
|
|
2677
|
+
color: var(--fd-foreground);
|
|
2678
|
+
border-radius: var(--fd-radius-md);
|
|
2679
|
+
box-shadow: var(--fd-shadow-lg);
|
|
2680
|
+
font-size: var(--fd-text-sm);
|
|
2681
|
+
}
|
|
2682
|
+
|
|
2477
2683
|
.flowdrop-root {
|
|
2478
2684
|
display: contents;
|
|
2479
2685
|
}
|
|
@@ -98,6 +98,8 @@ interface Props {
|
|
|
98
98
|
refreshTrigger?: number;
|
|
99
99
|
/** Custom navbar title */
|
|
100
100
|
navbarTitle?: string;
|
|
101
|
+
/** Heading level of the navbar title: 1 renders it as the page's H1 (default 2) */
|
|
102
|
+
navbarTitleLevel?: 1 | 2;
|
|
101
103
|
/** Custom navbar actions */
|
|
102
104
|
navbarActions?: NavbarAction[];
|
|
103
105
|
/** White-label logo for the navbar (replaces the FlowDrop wordmark) */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
@component
|
|
3
|
-
The floating toolbar in the top-left corner of the canvas: the Edit | Test switch, the Runs list and the run pill.
|
|
3
|
+
The floating toolbar in the top-left corner of the canvas: the Edit | Test switch, the Runs list, the Run button and the run pill.
|
|
4
4
|
|
|
5
5
|
Each group draws only when its prop is given. The switch needs `onEditorModeChange`;
|
|
6
6
|
the Runs list needs `showRuns` (the host turns it on in Test mode); the pill shows while the instance has a run.
|
|
@@ -16,8 +16,11 @@
|
|
|
16
16
|
import { getInstance } from '../stores/getInstance.svelte.js';
|
|
17
17
|
import Toolbar from './primitives/Toolbar.svelte';
|
|
18
18
|
import Segmented from './primitives/Segmented.svelte';
|
|
19
|
+
import Icon from '@iconify/svelte';
|
|
20
|
+
import Button from './primitives/Button.svelte';
|
|
19
21
|
import RunBar from './RunBar.svelte';
|
|
20
22
|
import RunsMenu from './RunsMenu.svelte';
|
|
23
|
+
import { expandAdminUrl } from '../utils/runsList.js';
|
|
21
24
|
|
|
22
25
|
interface Props {
|
|
23
26
|
/** Current editor mode. */
|
|
@@ -28,6 +31,10 @@
|
|
|
28
31
|
onOpenTest?: () => void;
|
|
29
32
|
/** Take a failed run to the Assistant (the pill's "Ask the Assistant"). */
|
|
30
33
|
onAskAssistant?: (runId: string) => void;
|
|
34
|
+
/** Start the workflow. The Run button is drawn in Edit mode only, and only when this is set. */
|
|
35
|
+
onRun?: () => void;
|
|
36
|
+
/** A run is being started (saving, or waiting for the server): the button spins and blocks. */
|
|
37
|
+
runBusy?: boolean;
|
|
31
38
|
/** Show the run pill while a run exists. @default true */
|
|
32
39
|
showRun?: boolean;
|
|
33
40
|
/** Show the Runs list (Test mode's past runs). The host decides when. @default false */
|
|
@@ -41,6 +48,8 @@
|
|
|
41
48
|
onEditorModeChange,
|
|
42
49
|
onOpenTest,
|
|
43
50
|
onAskAssistant,
|
|
51
|
+
onRun,
|
|
52
|
+
runBusy = false,
|
|
44
53
|
showRun = true,
|
|
45
54
|
showRuns = false,
|
|
46
55
|
adminLinks
|
|
@@ -56,7 +65,15 @@
|
|
|
56
65
|
]);
|
|
57
66
|
|
|
58
67
|
// Drawn when it has controls; a pill-only host gets the toolbar while a run exists.
|
|
59
|
-
const
|
|
68
|
+
const runMsgs = $derived(getMsgs().runButton);
|
|
69
|
+
const runOffered = $derived(!!onRun && editorMode === 'edit' && !fd.runs.isLive);
|
|
70
|
+
const runLink = $derived(
|
|
71
|
+
expandAdminUrl(adminLinks?.run, {
|
|
72
|
+
workflowId: fd.workflow.current?.id,
|
|
73
|
+
pipelineId: fd.runs.activeRun?.runId ?? undefined
|
|
74
|
+
})
|
|
75
|
+
);
|
|
76
|
+
const drawn = $derived(!!onEditorModeChange || !!onRun || (showRun && !!fd.runs.activeRun));
|
|
60
77
|
</script>
|
|
61
78
|
|
|
62
79
|
{#if drawn}
|
|
@@ -75,8 +92,28 @@
|
|
|
75
92
|
{#if showRuns}
|
|
76
93
|
<RunsMenu {adminLinks} />
|
|
77
94
|
{/if}
|
|
95
|
+
{#if runOffered}
|
|
96
|
+
<Button
|
|
97
|
+
variant="secondary"
|
|
98
|
+
size="md"
|
|
99
|
+
data-testid="canvas-run"
|
|
100
|
+
title={runMsgs.title}
|
|
101
|
+
loading={runBusy}
|
|
102
|
+
onclick={() => onRun?.()}
|
|
103
|
+
>
|
|
104
|
+
{#snippet leadingIcon()}
|
|
105
|
+
<Icon icon="mdi:play" aria-hidden="true" />
|
|
106
|
+
{/snippet}
|
|
107
|
+
{runMsgs.label}
|
|
108
|
+
</Button>
|
|
109
|
+
{/if}
|
|
78
110
|
{#if showRun}
|
|
79
|
-
<RunBar
|
|
111
|
+
<RunBar
|
|
112
|
+
mode={editorMode}
|
|
113
|
+
{onAskAssistant}
|
|
114
|
+
onOpen={onOpenTest}
|
|
115
|
+
runLink={runLink ?? undefined}
|
|
116
|
+
/>
|
|
80
117
|
{/if}
|
|
81
118
|
</Toolbar>
|
|
82
119
|
</div>
|
|
@@ -8,6 +8,10 @@ interface Props {
|
|
|
8
8
|
onOpenTest?: () => void;
|
|
9
9
|
/** Take a failed run to the Assistant (the pill's "Ask the Assistant"). */
|
|
10
10
|
onAskAssistant?: (runId: string) => void;
|
|
11
|
+
/** Start the workflow. The Run button is drawn in Edit mode only, and only when this is set. */
|
|
12
|
+
onRun?: () => void;
|
|
13
|
+
/** A run is being started (saving, or waiting for the server): the button spins and blocks. */
|
|
14
|
+
runBusy?: boolean;
|
|
11
15
|
/** Show the run pill while a run exists. @default true */
|
|
12
16
|
showRun?: boolean;
|
|
13
17
|
/** Show the Runs list (Test mode's past runs). The host decides when. @default false */
|
|
@@ -19,7 +23,7 @@ interface Props {
|
|
|
19
23
|
};
|
|
20
24
|
}
|
|
21
25
|
/**
|
|
22
|
-
* The floating toolbar in the top-left corner of the canvas: the Edit | Test switch, the Runs list and the run pill.
|
|
26
|
+
* The floating toolbar in the top-left corner of the canvas: the Edit | Test switch, the Runs list, the Run button and the run pill.
|
|
23
27
|
*
|
|
24
28
|
* Each group draws only when its prop is given. The switch needs `onEditorModeChange`;
|
|
25
29
|
* the Runs list needs `showRuns` (the host turns it on in Test mode); the pill shows while the instance has a run.
|
|
@@ -37,8 +37,14 @@
|
|
|
37
37
|
|
|
38
38
|
const { portName, fromInput, groups, checker, x, y, onselect, onclose }: Props = $props();
|
|
39
39
|
|
|
40
|
-
/**
|
|
41
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Element that had focus when the picker opened; focus returns there when it closes.
|
|
42
|
+
* Read when the component is created: the list takes focus as it mounts, before the popover attachment runs.
|
|
43
|
+
*/
|
|
44
|
+
let previouslyFocused: HTMLElement | null =
|
|
45
|
+
typeof document !== 'undefined' && document.activeElement instanceof HTMLElement
|
|
46
|
+
? document.activeElement
|
|
47
|
+
: null;
|
|
42
48
|
|
|
43
49
|
function restoreFocus(): void {
|
|
44
50
|
if (previouslyFocused && previouslyFocused.isConnected) {
|
|
@@ -53,8 +59,6 @@
|
|
|
53
59
|
|
|
54
60
|
/** Opening, once: remember the focus, show the popover, wire the dismissals a manual popover does not do itself. */
|
|
55
61
|
const open: Attachment<HTMLDivElement> = (el) => {
|
|
56
|
-
previouslyFocused =
|
|
57
|
-
document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
58
62
|
// Optional: jsdom has no Popover API.
|
|
59
63
|
el.showPopover?.();
|
|
60
64
|
// The list asks for focus when it mounts, but a manual popover is not
|