@flowdrop/flowdrop 2.15.2 → 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.
Files changed (138) hide show
  1. package/CHANGELOG.md +140 -0
  2. package/README.md +10 -1
  3. package/dist/components/App.svelte +219 -6
  4. package/dist/components/App.svelte.d.ts +8 -0
  5. package/dist/components/CanvasToolbar.svelte +40 -3
  6. package/dist/components/CanvasToolbar.svelte.d.ts +5 -1
  7. package/dist/components/ConnectPortPicker.svelte +8 -4
  8. package/dist/components/DoctorMenu.svelte +208 -126
  9. package/dist/components/ImpactConfirm.svelte +341 -0
  10. package/dist/components/ImpactConfirm.svelte.d.ts +12 -0
  11. package/dist/components/Input.svelte +2 -2
  12. package/dist/components/Navbar.svelte +48 -3
  13. package/dist/components/Navbar.svelte.d.ts +4 -0
  14. package/dist/components/NodeSidebar.svelte +36 -15
  15. package/dist/components/NodeSidebar.svelte.d.ts +2 -0
  16. package/dist/components/NodeSwapPicker.svelte +4 -14
  17. package/dist/components/RunBar.svelte +36 -1
  18. package/dist/components/RunBar.svelte.d.ts +5 -0
  19. package/dist/components/RunInputsDialog.svelte +198 -0
  20. package/dist/components/RunInputsDialog.svelte.d.ts +34 -0
  21. package/dist/components/SchemaForm.svelte +2 -1
  22. package/dist/components/SchemaForm.svelte.d.ts +2 -1
  23. package/dist/components/WorkflowCompareDialog.svelte +177 -0
  24. package/dist/components/WorkflowCompareDialog.svelte.d.ts +10 -0
  25. package/dist/components/WorkflowEditor.svelte +88 -6
  26. package/dist/components/WorkflowEditor.svelte.d.ts +6 -0
  27. package/dist/components/WorkflowInterfaceEditor.svelte +14 -4
  28. package/dist/components/WorkflowInterfaceEntryCard.svelte +19 -3
  29. package/dist/components/WorkflowInterfaceEntryCard.svelte.d.ts +2 -0
  30. package/dist/components/form/FormAutocomplete.svelte +76 -12
  31. package/dist/components/nodes/NodeCard.svelte +2 -2
  32. package/dist/components/primitives/Button.svelte +1 -1
  33. package/dist/components/primitives/Button.svelte.d.ts +1 -1
  34. package/dist/components/primitives/Card.svelte +1 -1
  35. package/dist/components/primitives/Card.svelte.d.ts +1 -1
  36. package/dist/components/primitives/Checkbox.svelte +1 -1
  37. package/dist/components/primitives/Checkbox.svelte.d.ts +1 -1
  38. package/dist/components/primitives/Chip.svelte +1 -1
  39. package/dist/components/primitives/Chip.svelte.d.ts +1 -1
  40. package/dist/components/primitives/Combobox.svelte +1 -1
  41. package/dist/components/primitives/Combobox.svelte.d.ts +1 -1
  42. package/dist/components/primitives/Composer.svelte +1 -1
  43. package/dist/components/primitives/Composer.svelte.d.ts +1 -1
  44. package/dist/components/primitives/EmptyState.svelte +1 -1
  45. package/dist/components/primitives/EmptyState.svelte.d.ts +1 -1
  46. package/dist/components/primitives/Field.svelte +1 -1
  47. package/dist/components/primitives/Field.svelte.d.ts +1 -1
  48. package/dist/components/primitives/IconButton.svelte +1 -1
  49. package/dist/components/primitives/IconButton.svelte.d.ts +1 -1
  50. package/dist/components/primitives/Menu.svelte +1 -1
  51. package/dist/components/primitives/Menu.svelte.d.ts +1 -1
  52. package/dist/components/primitives/Notice.svelte +1 -1
  53. package/dist/components/primitives/Notice.svelte.d.ts +1 -1
  54. package/dist/components/primitives/PanelHeader.svelte +1 -1
  55. package/dist/components/primitives/PanelHeader.svelte.d.ts +1 -1
  56. package/dist/components/primitives/Segmented.svelte +2 -2
  57. package/dist/components/primitives/Segmented.svelte.d.ts +2 -2
  58. package/dist/components/primitives/Select.svelte +1 -1
  59. package/dist/components/primitives/Select.svelte.d.ts +1 -1
  60. package/dist/components/primitives/StatusPill.svelte +1 -1
  61. package/dist/components/primitives/StatusPill.svelte.d.ts +1 -1
  62. package/dist/components/primitives/Switch.svelte +1 -1
  63. package/dist/components/primitives/Switch.svelte.d.ts +1 -1
  64. package/dist/components/primitives/Tabs.svelte +2 -2
  65. package/dist/components/primitives/Tabs.svelte.d.ts +2 -2
  66. package/dist/components/primitives/Toolbar.svelte +1 -1
  67. package/dist/components/primitives/Toolbar.svelte.d.ts +1 -1
  68. package/dist/components/primitives/ToolbarSeparator.svelte +1 -1
  69. package/dist/components/primitives/ToolbarSeparator.svelte.d.ts +1 -1
  70. package/dist/components/toast/DismissibleToast.svelte +25 -6
  71. package/dist/components/toast/DismissibleToast.svelte.d.ts +3 -0
  72. package/dist/config/endpoints.d.ts +7 -0
  73. package/dist/config/endpoints.js +2 -1
  74. package/dist/editor/connectCandidates.d.ts +3 -0
  75. package/dist/editor/connectCandidates.js +14 -5
  76. package/dist/editor/index.d.ts +1 -1
  77. package/dist/editor/index.js +1 -1
  78. package/dist/helpers/workflowEditorHelper.d.ts +15 -0
  79. package/dist/helpers/workflowEditorHelper.js +9 -0
  80. package/dist/index.d.ts +1 -0
  81. package/dist/messages/defaults.d.ts +101 -0
  82. package/dist/messages/defaults.js +92 -1
  83. package/dist/openapi/v1/openapi.yaml +10 -2
  84. package/dist/schemas/v1/workflow.schema.json +1 -1
  85. package/dist/services/draftStorage.d.ts +24 -10
  86. package/dist/services/draftStorage.js +60 -35
  87. package/dist/services/globalSave.d.ts +28 -10
  88. package/dist/services/globalSave.js +135 -31
  89. package/dist/services/impactGate.d.ts +34 -0
  90. package/dist/services/impactGate.js +70 -0
  91. package/dist/services/impactService.d.ts +28 -0
  92. package/dist/services/impactService.js +71 -0
  93. package/dist/services/toastQueue.d.ts +9 -0
  94. package/dist/services/toastService.d.ts +4 -0
  95. package/dist/services/toastService.js +9 -3
  96. package/dist/services/workflowLaunchService.js +3 -1
  97. package/dist/settings/index.d.ts +2 -2
  98. package/dist/settings/index.js +1 -1
  99. package/dist/stores/doctorStore.svelte.d.ts +24 -1
  100. package/dist/stores/doctorStore.svelte.js +105 -2
  101. package/dist/stores/instanceContainer.svelte.d.ts +16 -0
  102. package/dist/stores/instanceContainer.svelte.js +22 -2
  103. package/dist/stores/saveConflictStore.svelte.d.ts +62 -0
  104. package/dist/stores/saveConflictStore.svelte.js +169 -0
  105. package/dist/stores/workflowStore.svelte.d.ts +7 -3
  106. package/dist/stores/workflowStore.svelte.js +14 -5
  107. package/dist/styles/toast.css +10 -1
  108. package/dist/svelte-app.d.ts +23 -0
  109. package/dist/svelte-app.js +114 -3
  110. package/dist/themes/scopedSkinCss.d.ts +22 -0
  111. package/dist/themes/scopedSkinCss.js +27 -1
  112. package/dist/types/doctor.d.ts +3 -1
  113. package/dist/types/events.d.ts +20 -0
  114. package/dist/types/events.js +2 -0
  115. package/dist/types/impact.d.ts +25 -0
  116. package/dist/types/impact.js +7 -0
  117. package/dist/types/index.d.ts +11 -1
  118. package/dist/types/settings.d.ts +31 -0
  119. package/dist/types/settings.js +132 -0
  120. package/dist/ui/index.d.ts +76 -0
  121. package/dist/ui/index.js +81 -0
  122. package/dist/utils/apiUrl.d.ts +55 -0
  123. package/dist/utils/apiUrl.js +117 -0
  124. package/dist/utils/draftRestore.d.ts +27 -0
  125. package/dist/utils/draftRestore.js +36 -0
  126. package/dist/utils/interfaceTags.js +4 -1
  127. package/dist/utils/nodeSearch.d.ts +10 -0
  128. package/dist/utils/nodeSearch.js +37 -0
  129. package/dist/utils/portal.js +45 -3
  130. package/dist/utils/runOffer.d.ts +21 -0
  131. package/dist/utils/runOffer.js +13 -0
  132. package/dist/utils/workflowCompare.d.ts +35 -0
  133. package/dist/utils/workflowCompare.js +84 -0
  134. package/dist/utils/workflowInterface.d.ts +26 -1
  135. package/dist/utils/workflowInterface.js +91 -11
  136. package/dist/webmcp/index.d.ts +5 -0
  137. package/dist/webmcp/index.js +5 -0
  138. package/package.json +8 -2
@@ -34,13 +34,18 @@
34
34
  * failed with a known pipeline.
35
35
  */
36
36
  onAskAssistant?: (runId: string) => void;
37
+ /**
38
+ * An already expanded URL of the run's page. With a known run id the pill links "Open run" to it in
39
+ * every status.
40
+ */
41
+ runLink?: string | null;
37
42
  /** How long a finished run's pill stays, in milliseconds. @default 4500 */
38
43
  fadeMs?: number;
39
44
  /** Editor mode the pill is shown in. @default 'edit' */
40
45
  mode?: 'edit' | 'test';
41
46
  }
42
47
 
43
- let { onOpen, onAskAssistant, fadeMs = 4500, mode = 'edit' }: Props = $props();
48
+ let { onOpen, onAskAssistant, runLink, fadeMs = 4500, mode = 'edit' }: Props = $props();
44
49
 
45
50
  const fd = getInstance();
46
51
  const getMsgs = getMessages();
@@ -136,6 +141,16 @@
136
141
  {msgs.askAssistant}
137
142
  </Button>
138
143
  {/if}
144
+ {#if runLink && run.runId}
145
+ <a
146
+ class="flowdrop-run-bar__link"
147
+ href={runLink}
148
+ title={msgs.openRunTitle}
149
+ data-testid="run-bar-open-run"
150
+ >
151
+ {msgs.openRun}
152
+ </a>
153
+ {/if}
139
154
  {#if live}
140
155
  <Button
141
156
  variant="danger-ghost"
@@ -207,6 +222,26 @@
207
222
  .flowdrop-run-bar__label {
208
223
  white-space: nowrap;
209
224
  }
225
+ /* A link drawn as a small ghost button. */
226
+ .flowdrop-run-bar__link {
227
+ display: inline-flex;
228
+ align-items: center;
229
+ height: calc(var(--fd-canvas-control) - 2 * var(--fd-space-2xs));
230
+ padding: 0 var(--fd-space-sm);
231
+ border-radius: var(--fd-radius-control, var(--fd-radius-surface));
232
+ color: var(--fd-foreground);
233
+ font-size: var(--fd-text-sm);
234
+ font-weight: 500;
235
+ text-decoration: none;
236
+ white-space: nowrap;
237
+ }
238
+ .flowdrop-run-bar__link:hover {
239
+ background-color: var(--fd-muted);
240
+ }
241
+ .flowdrop-run-bar__link:focus-visible {
242
+ outline: 2px solid var(--fd-ring, var(--fd-foreground));
243
+ outline-offset: 1px;
244
+ }
210
245
  .flowdrop-run-bar--fading {
211
246
  opacity: 0;
212
247
  }
@@ -10,6 +10,11 @@ interface Props {
10
10
  * failed with a known pipeline.
11
11
  */
12
12
  onAskAssistant?: (runId: string) => void;
13
+ /**
14
+ * An already expanded URL of the run's page. With a known run id the pill links "Open run" to it in
15
+ * every status.
16
+ */
17
+ runLink?: string | null;
13
18
  /** How long a finished run's pill stays, in milliseconds. @default 4500 */
14
19
  fadeMs?: number;
15
20
  /** Editor mode the pill is shown in. @default 'edit' */
@@ -0,0 +1,198 @@
1
+ <!--
2
+ @component
3
+ The small form Run opens for a workflow that has inputs: a modal titled "Run {workflow name}" with
4
+ one field per input (the Playground's `InterfaceInputForm`), a Run button (Cmd/Ctrl+Enter) and Cancel.
5
+
6
+ The dialog only draws and reports; the host (App) owns the values, starts the run and closes it.
7
+ A refused run keeps the dialog open and names the reason under the Run button.
8
+
9
+ **Use it for** asking for a workflow's inputs before a run starts from the canvas.
10
+ **Not for** the Playground's own inputs card (use `InterfaceInputForm` there).
11
+ -->
12
+
13
+ <script lang="ts">
14
+ import Icon from '@iconify/svelte';
15
+ import InterfaceInputForm from './playground/InterfaceInputForm.svelte';
16
+ import PanelHeader from './primitives/PanelHeader.svelte';
17
+ import IconButton from './primitives/IconButton.svelte';
18
+ import Button from './primitives/Button.svelte';
19
+ import type { WorkflowInterfaceEntry } from '../types/index.js';
20
+ import { m } from '../messages/index.js';
21
+
22
+ interface Props {
23
+ /** Whether the dialog is open. */
24
+ open: boolean;
25
+ /** The workflow's name, shown in the title. */
26
+ workflowName: string;
27
+ /** The input entries to ask for. */
28
+ entries: WorkflowInterfaceEntry[];
29
+ /** Current values, keyed by entry id. */
30
+ values: Record<string, unknown>;
31
+ /** Called with the complete values on every change. */
32
+ onChange: (values: Record<string, unknown>) => void;
33
+ /** Start the run with the current values. */
34
+ onRun: () => void;
35
+ /** The run is being started: Run shows a spinner. */
36
+ runBusy?: boolean;
37
+ /** Why the last Run did not start. */
38
+ error?: string | null;
39
+ /** Close the dialog without running. */
40
+ onClose: () => void;
41
+ }
42
+
43
+ let {
44
+ open,
45
+ workflowName,
46
+ entries,
47
+ values,
48
+ onChange,
49
+ onRun,
50
+ runBusy = false,
51
+ error = null,
52
+ onClose
53
+ }: Props = $props();
54
+
55
+ // Unique per instance so two editors on one page do not share a DOM id.
56
+ const uid = $props.id();
57
+ const titleId = `${uid}-run-inputs-title`;
58
+
59
+ const labels = $derived(m().runInputsDialog);
60
+
61
+ let dialogRef = $state<HTMLDialogElement | null>(null);
62
+
63
+ $effect(() => {
64
+ if (!dialogRef) return;
65
+ if (open && !dialogRef.open) dialogRef.showModal();
66
+ else if (!open && dialogRef.open) dialogRef.close();
67
+ });
68
+
69
+ /** Whether the press that led to the click began on the backdrop (the dialog element itself). */
70
+ let pressedOnBackdrop = false;
71
+
72
+ function handlePointerDown(event: PointerEvent): void {
73
+ pressedOnBackdrop = event.target === dialogRef;
74
+ }
75
+
76
+ // A text selection that starts in a field and ends over the backdrop clicks
77
+ // the dialog too: close only when the press began there as well.
78
+ function handleBackdropClick(event: MouseEvent): void {
79
+ const started = pressedOnBackdrop;
80
+ pressedOnBackdrop = false;
81
+ if (started && event.target === dialogRef) onClose();
82
+ }
83
+
84
+ // The native close event also fires for Escape.
85
+ function handleDialogClose(): void {
86
+ if (open) onClose();
87
+ }
88
+ </script>
89
+
90
+ <!-- native <dialog> backdrop click-to-close pattern -->
91
+ <dialog
92
+ bind:this={dialogRef}
93
+ class="flowdrop-scope flowdrop-run-inputs"
94
+ data-testid="run-inputs-dialog"
95
+ onpointerdown={handlePointerDown}
96
+ onclick={handleBackdropClick}
97
+ onclose={handleDialogClose}
98
+ aria-labelledby={titleId}
99
+ >
100
+ <div class="flowdrop-run-inputs__container">
101
+ <PanelHeader title={labels.title({ name: workflowName })} {titleId}>
102
+ {#snippet actions()}
103
+ <IconButton ariaLabel={labels.close} title={m().common.close} onclick={onClose}>
104
+ <Icon icon="mdi:close" />
105
+ </IconButton>
106
+ {/snippet}
107
+ </PanelHeader>
108
+
109
+ <div class="flowdrop-run-inputs__content">
110
+ {#if open}
111
+ <InterfaceInputForm {entries} {values} {onChange} {onRun} {runBusy} {error} />
112
+ {/if}
113
+ </div>
114
+
115
+ <div class="flowdrop-run-inputs__footer">
116
+ <Button variant="ghost" data-testid="run-inputs-cancel" onclick={onClose}>
117
+ {m().common.cancel}
118
+ </Button>
119
+ </div>
120
+ </div>
121
+ </dialog>
122
+
123
+ <style>
124
+ .flowdrop-run-inputs {
125
+ position: fixed;
126
+ inset: 0;
127
+ width: 100%;
128
+ max-width: 100%;
129
+ height: 100%;
130
+ max-height: 100%;
131
+ margin: 0;
132
+ padding: 0;
133
+ border: none;
134
+ background-color: transparent;
135
+ overflow: hidden;
136
+ }
137
+
138
+ .flowdrop-run-inputs::backdrop {
139
+ background-color: var(--fd-backdrop);
140
+ backdrop-filter: blur(4px);
141
+ }
142
+
143
+ .flowdrop-run-inputs[open] {
144
+ display: flex;
145
+ align-items: center;
146
+ justify-content: center;
147
+ }
148
+
149
+ .flowdrop-run-inputs__container {
150
+ display: flex;
151
+ flex-direction: column;
152
+ width: 90vw;
153
+ max-width: 560px;
154
+ max-height: min(80vh, 640px);
155
+ background-color: var(--fd-background);
156
+ border: 1px solid var(--fd-border);
157
+ border-radius: var(--fd-modal-radius);
158
+ box-shadow: var(--fd-shadow-lg);
159
+ overflow: hidden;
160
+ }
161
+
162
+ .flowdrop-run-inputs__container :global(.flowdrop-ui-panel-header) {
163
+ height: var(--fd-modal-header-height);
164
+ }
165
+
166
+ .flowdrop-run-inputs__container :global(.flowdrop-ui-panel-header__title) {
167
+ font-size: var(--fd-modal-title-size);
168
+ }
169
+
170
+ .flowdrop-run-inputs__content {
171
+ flex: 1 1 auto;
172
+ min-height: 0;
173
+ overflow: auto;
174
+ }
175
+
176
+ /* The form is a card for the Playground; inside the dialog it fills the width. */
177
+ .flowdrop-run-inputs__content :global(.interface-input-form) {
178
+ max-width: none;
179
+ padding: var(--fd-space-md);
180
+ }
181
+
182
+ .flowdrop-run-inputs__footer {
183
+ display: flex;
184
+ justify-content: flex-end;
185
+ padding: var(--fd-space-sm) var(--fd-space-md);
186
+ border-top: 1px solid var(--fd-border);
187
+ }
188
+
189
+ @media (max-width: 640px) {
190
+ .flowdrop-run-inputs__container {
191
+ width: 100%;
192
+ height: 100%;
193
+ max-width: 100%;
194
+ max-height: 100%;
195
+ border-radius: 0;
196
+ }
197
+ }
198
+ </style>
@@ -0,0 +1,34 @@
1
+ import type { WorkflowInterfaceEntry } from '../types/index.js';
2
+ interface Props {
3
+ /** Whether the dialog is open. */
4
+ open: boolean;
5
+ /** The workflow's name, shown in the title. */
6
+ workflowName: string;
7
+ /** The input entries to ask for. */
8
+ entries: WorkflowInterfaceEntry[];
9
+ /** Current values, keyed by entry id. */
10
+ values: Record<string, unknown>;
11
+ /** Called with the complete values on every change. */
12
+ onChange: (values: Record<string, unknown>) => void;
13
+ /** Start the run with the current values. */
14
+ onRun: () => void;
15
+ /** The run is being started: Run shows a spinner. */
16
+ runBusy?: boolean;
17
+ /** Why the last Run did not start. */
18
+ error?: string | null;
19
+ /** Close the dialog without running. */
20
+ onClose: () => void;
21
+ }
22
+ /**
23
+ * The small form Run opens for a workflow that has inputs: a modal titled "Run {workflow name}" with
24
+ * one field per input (the Playground's `InterfaceInputForm`), a Run button (Cmd/Ctrl+Enter) and Cancel.
25
+ *
26
+ * The dialog only draws and reports; the host (App) owns the values, starts the run and closes it.
27
+ * A refused run keeps the dialog open and names the reason under the Run button.
28
+ *
29
+ * **Use it for** asking for a workflow's inputs before a run starts from the canvas.
30
+ * **Not for** the Playground's own inputs card (use `InterfaceInputForm` there).
31
+ */
32
+ declare const RunInputsDialog: import("svelte").Component<Props, {}, "">;
33
+ type RunInputsDialog = ReturnType<typeof RunInputsDialog>;
34
+ export default RunInputsDialog;
@@ -138,7 +138,8 @@
138
138
  authProvider?: AuthProvider;
139
139
 
140
140
  /**
141
- * Base URL for resolving relative autocomplete callback URLs.
141
+ * Put in front of `/path` autocomplete callback URLs (those with a leading slash),
142
+ * and the base for URLs without a leading slash (instead of the editor's API base).
142
143
  * @default ""
143
144
  */
144
145
  baseUrl?: string;
@@ -63,7 +63,8 @@ interface Props {
63
63
  */
64
64
  authProvider?: AuthProvider;
65
65
  /**
66
- * Base URL for resolving relative autocomplete callback URLs.
66
+ * Put in front of `/path` autocomplete callback URLs (those with a leading slash),
67
+ * and the base for URLs without a leading slash (instead of the editor's API base).
67
68
  * @default ""
68
69
  */
69
70
  baseUrl?: string;
@@ -0,0 +1,177 @@
1
+ <!--
2
+ Workflow Compare Dialog
3
+
4
+ Lists, in plain words, what differs between your version of a workflow and
5
+ the saved one, and lets the person keep theirs, load the saved one, or cancel.
6
+ Mount it when a comparison is wanted; it opens as a modal and puts focus back
7
+ on the opener when it goes away.
8
+ -->
9
+
10
+ <script lang="ts">
11
+ import Button from './primitives/Button.svelte';
12
+ import { onMount } from 'svelte';
13
+ import { m } from '../messages/index.js';
14
+ import type { WorkflowComparison } from '../utils/workflowCompare.js';
15
+
16
+ interface Props {
17
+ comparison: WorkflowComparison;
18
+ onKeepMine: () => void;
19
+ onLoadTheirs: () => void;
20
+ onClose: () => void;
21
+ }
22
+
23
+ let { comparison, onKeepMine, onLoadTheirs, onClose }: Props = $props();
24
+
25
+ const uid = $props.id();
26
+ const titleId = `${uid}-compare-title`;
27
+
28
+ let dialogRef = $state<HTMLDialogElement | null>(null);
29
+
30
+ onMount(() => {
31
+ const opener = document.activeElement as HTMLElement | null;
32
+ dialogRef?.showModal();
33
+ return () => {
34
+ if (dialogRef?.open) dialogRef.close();
35
+ opener?.focus?.();
36
+ };
37
+ });
38
+
39
+ const only = (n: number) => m().compare.wiresOnly({ n });
40
+
41
+ const mineLines = $derived([
42
+ ...comparison.nodesOnlyMine.map((n) => m().compare.stepOnly({ label: n.label })),
43
+ ...(comparison.edgesOnlyMine > 0 ? [only(comparison.edgesOnlyMine)] : [])
44
+ ]);
45
+ const theirLines = $derived([
46
+ ...comparison.nodesOnlyTheirs.map((n) => m().compare.stepOnly({ label: n.label })),
47
+ ...(comparison.edgesOnlyTheirs > 0 ? [only(comparison.edgesOnlyTheirs)] : [])
48
+ ]);
49
+ const bothLines = $derived([
50
+ ...(comparison.name
51
+ ? [m().compare.name({ mine: comparison.name.mine, theirs: comparison.name.theirs })]
52
+ : []),
53
+ ...(comparison.description ? [m().compare.description] : []),
54
+ ...comparison.nodesChanged.flatMap((n) =>
55
+ n.what.map((w) =>
56
+ w === 'settings'
57
+ ? m().compare.stepSettings({ label: n.label })
58
+ : w === 'label'
59
+ ? m().compare.stepLabel({ label: n.label })
60
+ : m().compare.stepPosition({ label: n.label })
61
+ )
62
+ ),
63
+ ...(comparison.interfaceChanged ? [m().compare.interface] : []),
64
+ ...(comparison.chatChanged ? [m().compare.chat] : [])
65
+ ]);
66
+
67
+ const groups = $derived([
68
+ { heading: m().compare.onlyMine, lines: mineLines },
69
+ { heading: m().compare.onlyTheirs, lines: theirLines },
70
+ { heading: m().compare.changedInBoth, lines: bothLines }
71
+ ]);
72
+ </script>
73
+
74
+ <dialog
75
+ bind:this={dialogRef}
76
+ class="flowdrop-scope flowdrop-compare-dialog"
77
+ aria-labelledby={titleId}
78
+ oncancel={(event) => {
79
+ event.preventDefault();
80
+ onClose();
81
+ }}
82
+ >
83
+ <div class="flowdrop-compare-dialog__container">
84
+ <h2 id={titleId} class="flowdrop-compare-dialog__title">{m().compare.title}</h2>
85
+
86
+ <div class="flowdrop-compare-dialog__body">
87
+ {#if comparison.same}
88
+ <p>{m().compare.none}</p>
89
+ {:else}
90
+ {#each groups as group (group.heading)}
91
+ {#if group.lines.length > 0}
92
+ <section>
93
+ <h3 class="flowdrop-compare-dialog__heading">{group.heading}</h3>
94
+ <ul>
95
+ {#each group.lines as line, i (`${i}:${line}`)}
96
+ <li>{line}</li>
97
+ {/each}
98
+ </ul>
99
+ </section>
100
+ {/if}
101
+ {/each}
102
+ {/if}
103
+ </div>
104
+
105
+ <div class="flowdrop-compare-dialog__actions">
106
+ <Button variant="primary" onclick={onKeepMine}>{m().compare.keepMine}</Button>
107
+ <Button onclick={onLoadTheirs}>{m().compare.loadTheirs}</Button>
108
+ <Button onclick={onClose}>{m().compare.cancel}</Button>
109
+ </div>
110
+ </div>
111
+ </dialog>
112
+
113
+ <style>
114
+ .flowdrop-compare-dialog {
115
+ position: fixed;
116
+ inset: 0;
117
+ width: 100%;
118
+ max-width: 100%;
119
+ height: 100%;
120
+ max-height: 100%;
121
+ margin: 0;
122
+ padding: 0;
123
+ border: none;
124
+ background-color: transparent;
125
+ }
126
+
127
+ .flowdrop-compare-dialog::backdrop {
128
+ background-color: var(--fd-backdrop);
129
+ }
130
+
131
+ .flowdrop-compare-dialog[open] {
132
+ display: flex;
133
+ align-items: center;
134
+ justify-content: center;
135
+ }
136
+
137
+ .flowdrop-compare-dialog__container {
138
+ display: flex;
139
+ flex-direction: column;
140
+ gap: 1rem;
141
+ width: 90vw;
142
+ max-width: 560px;
143
+ max-height: min(80vh, 640px);
144
+ padding: 1.25rem;
145
+ background-color: var(--fd-background);
146
+ color: var(--fd-foreground);
147
+ border: 1px solid var(--fd-border);
148
+ border-radius: var(--fd-modal-radius);
149
+ }
150
+
151
+ .flowdrop-compare-dialog__title {
152
+ margin: 0;
153
+ font-size: var(--fd-modal-title-size);
154
+ }
155
+
156
+ .flowdrop-compare-dialog__body {
157
+ overflow-y: auto;
158
+ min-height: 0;
159
+ }
160
+
161
+ .flowdrop-compare-dialog__heading {
162
+ margin: 0 0 0.25rem;
163
+ font-size: var(--fd-text-sm);
164
+ }
165
+
166
+ .flowdrop-compare-dialog__body ul {
167
+ margin: 0 0 1rem;
168
+ padding-left: 1.25rem;
169
+ }
170
+
171
+ .flowdrop-compare-dialog__actions {
172
+ display: flex;
173
+ flex-wrap: wrap;
174
+ gap: 0.5rem;
175
+ justify-content: flex-end;
176
+ }
177
+ </style>
@@ -0,0 +1,10 @@
1
+ import type { WorkflowComparison } from '../utils/workflowCompare.js';
2
+ interface Props {
3
+ comparison: WorkflowComparison;
4
+ onKeepMine: () => void;
5
+ onLoadTheirs: () => void;
6
+ onClose: () => void;
7
+ }
8
+ declare const WorkflowCompareDialog: import("svelte").Component<Props, {}, "">;
9
+ type WorkflowCompareDialog = ReturnType<typeof WorkflowCompareDialog>;
10
+ export default WorkflowCompareDialog;
@@ -42,6 +42,7 @@
42
42
  type ContextMenuTarget
43
43
  } from '../editor/contextMenu.js';
44
44
  import type { NodeMetadata } from '../types/index.js';
45
+ import { extractConfigDefaults } from '../utils/nodeIds.js';
45
46
  import { resolveComponentName } from '../utils/nodeTypes.js';
46
47
  import { nodeAriaLabel } from '../utils/nodeAriaLabel.js';
47
48
  import { decideInlineCommit } from '../utils/captionText.js';
@@ -62,7 +63,8 @@
62
63
  EdgeStylingHelper,
63
64
  NodeOperationsHelper,
64
65
  WorkflowOperationsHelper,
65
- ConfigurationHelper
66
+ ConfigurationHelper,
67
+ placementForNewNode
66
68
  } from '../helpers/workflowEditorHelper.js';
67
69
  import { Toaster } from 'svelte-5-french-toast';
68
70
  import {
@@ -195,6 +197,10 @@
195
197
  * while a run waits for them. Without it the button is not shown.
196
198
  */
197
199
  onOpenTest?: () => void;
200
+ /** Start the workflow: the canvas toolbar's Run button (Edit mode). Without it the button is not shown. */
201
+ onRun?: () => void;
202
+ /** A run is being started: the Run button spins. */
203
+ runBusy?: boolean;
198
204
  /** Current editor mode, shown in the canvas toolbar's Edit | Test switch. @default 'edit' */
199
205
  editorMode?: 'edit' | 'test';
200
206
  /** Switch the editor mode. The toolbar's Edit | Test switch is shown only when this is set. */
@@ -1547,6 +1553,15 @@
1547
1553
  if (showContextMenu('pane', [], event.clientX, event.clientY)) event.preventDefault();
1548
1554
  }
1549
1555
 
1556
+ /**
1557
+ * A key press belongs to the canvas when it comes from inside it, or from the canvas region
1558
+ * around it: a click on the empty canvas and the "Skip to the canvas" link both focus that region.
1559
+ */
1560
+ function onCanvas(target: HTMLElement): boolean {
1561
+ if (target.closest('.flowdrop-canvas')) return true;
1562
+ return target.getAttribute('role') === 'region' && !!canvasEl && target.contains(canvasEl);
1563
+ }
1564
+
1550
1565
  /**
1551
1566
  * Shift+F10 / the Menu key: on a focused node wrapper open that node's menu
1552
1567
  * anchored at the node; elsewhere in the canvas open the pane menu at the
@@ -1555,7 +1570,7 @@
1555
1570
  function handleMenuKey(event: KeyboardEvent, target: HTMLElement): boolean {
1556
1571
  const isMenuKey = event.key === 'ContextMenu' || (event.key === 'F10' && event.shiftKey);
1557
1572
  if (!isMenuKey || !canvasEditable) return false;
1558
- if (!target.closest('.flowdrop-canvas') || target.closest('.canvas-context-menu')) return false;
1573
+ if (!onCanvas(target) || target.closest('.canvas-context-menu')) return false;
1559
1574
 
1560
1575
  event.preventDefault();
1561
1576
 
@@ -1697,6 +1712,53 @@
1697
1712
  nodeIdToRefresh = nodeId;
1698
1713
  }
1699
1714
 
1715
+ /**
1716
+ * Add a node from a palette click or Enter: right of the selected node,
1717
+ * else the middle of the view. Goes through placeNode like a drop.
1718
+ */
1719
+ export function addNodeFromPalette(metadata: NodeMetadata): void {
1720
+ if (!canvasEditable || !canvasControllerRef) return;
1721
+ const grid = getEditorSettings().gridSize;
1722
+ const selected = flowNodes.find((n) => n.selected);
1723
+ const flowEl = canvasEl?.querySelector('.svelte-flow') ?? canvasEl;
1724
+ const rect = flowEl?.getBoundingClientRect();
1725
+ const centre = rect
1726
+ ? canvasControllerRef.canvasScreenToFlow({
1727
+ x: rect.left + rect.width / 2,
1728
+ y: rect.top + rect.height / 2
1729
+ })
1730
+ : { x: 0, y: 0 };
1731
+ const position = snapPosition(
1732
+ placementForNewNode(
1733
+ selected
1734
+ ? {
1735
+ x: selected.position.x,
1736
+ y: selected.position.y,
1737
+ width: selected.measured?.width ?? selected.width ?? grid * 10
1738
+ }
1739
+ : null,
1740
+ centre,
1741
+ grid * 2
1742
+ )
1743
+ );
1744
+ const { id } = placeNode(
1745
+ JSON.stringify({
1746
+ type: 'node',
1747
+ nodeType: metadata.node_type_id,
1748
+ nodeData: {
1749
+ label: metadata.name,
1750
+ config: extractConfigDefaults(metadata.configSchema),
1751
+ metadata
1752
+ }
1753
+ }),
1754
+ position
1755
+ );
1756
+ if (!id) return;
1757
+ flowNodes = flowNodes.map((n) =>
1758
+ n.selected === (n.id === id) ? n : { ...n, selected: n.id === id }
1759
+ );
1760
+ }
1761
+
1700
1762
  // Canvas viewport methods (forwarded to CanvasController inside <SvelteFlow>)
1701
1763
 
1702
1764
  export function canvasFitView(): void {
@@ -1751,6 +1813,24 @@
1751
1813
  function handleKeydown(event: KeyboardEvent): void {
1752
1814
  // Don't handle shortcuts if user is typing in an input, textarea, or contenteditable
1753
1815
  const target = event.target as HTMLElement;
1816
+
1817
+ // A focused port pin: Enter, Space, Menu or Shift+F10 opens its port menu.
1818
+ const pin = target.closest?.('.svelte-flow__handle');
1819
+ if (
1820
+ pin instanceof HTMLElement &&
1821
+ canvasEl?.contains(pin) &&
1822
+ canvasEditable &&
1823
+ (event.key === 'Enter' ||
1824
+ event.key === ' ' ||
1825
+ event.key === 'ContextMenu' ||
1826
+ (event.key === 'F10' && event.shiftKey))
1827
+ ) {
1828
+ event.preventDefault();
1829
+ const rect = pin.getBoundingClientRect();
1830
+ showPortMenu(pin, rect.left + rect.width / 2, rect.top + rect.height / 2);
1831
+ return;
1832
+ }
1833
+
1754
1834
  const isInputElement =
1755
1835
  target.tagName === 'INPUT' || target.tagName === 'TEXTAREA' || target.isContentEditable;
1756
1836
 
@@ -1778,7 +1858,7 @@
1778
1858
  !event.metaKey &&
1779
1859
  !event.altKey &&
1780
1860
  canvasEditable &&
1781
- target.closest('.flowdrop-canvas')
1861
+ onCanvas(target)
1782
1862
  ) {
1783
1863
  const ids = flowNodes.filter((n) => n.selected).map((n) => n.id);
1784
1864
  if (ids.length > 0) {
@@ -1788,8 +1868,8 @@
1788
1868
  return;
1789
1869
  }
1790
1870
 
1791
- // Shift+Alt+T on the canvas, or with nothing focused (a click on the empty canvas leaves the
1792
- // focus on the body): tidy up the whole graph. By code: Alt changes the key on a Mac.
1871
+ // Shift+Alt+T on the canvas, or with nothing focused: tidy up the whole graph.
1872
+ // By code: Alt changes the key on a Mac.
1793
1873
  if (
1794
1874
  event.code === 'KeyT' &&
1795
1875
  event.shiftKey &&
@@ -1797,7 +1877,7 @@
1797
1877
  !event.ctrlKey &&
1798
1878
  !event.metaKey &&
1799
1879
  canvasEditable &&
1800
- (target === document.body || target.closest('.flowdrop-canvas'))
1880
+ (target === document.body || onCanvas(target))
1801
1881
  ) {
1802
1882
  event.preventDefault();
1803
1883
  tidyLayout();
@@ -1995,6 +2075,8 @@
1995
2075
  editorMode={props.editorMode}
1996
2076
  onEditorModeChange={props.onEditorModeChange}
1997
2077
  onOpenTest={props.onOpenTest}
2078
+ onRun={props.onRun}
2079
+ runBusy={props.runBusy}
1998
2080
  onAskAssistant={props.onAskAssistant}
1999
2081
  showRun={props.showRunBar ?? true}
2000
2082
  showRuns={props.showRuns}