@flowdrop/flowdrop 2.16.0 → 2.18.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 (130) hide show
  1. package/CHANGELOG.md +95 -0
  2. package/README.md +6 -1
  3. package/dist/api/enhanced-client.d.ts +3 -1
  4. package/dist/api/enhanced-client.js +4 -2
  5. package/dist/commands/executor.js +9 -0
  6. package/dist/commands/storeIntegration.svelte.js +6 -0
  7. package/dist/commands/types.d.ts +8 -0
  8. package/dist/components/App.svelte +414 -105
  9. package/dist/components/App.svelte.d.ts +31 -0
  10. package/dist/components/CanvasToolbar.svelte +40 -3
  11. package/dist/components/CanvasToolbar.svelte.d.ts +5 -1
  12. package/dist/components/ConnectPortPicker.svelte +8 -4
  13. package/dist/components/DoctorMenu.svelte +208 -126
  14. package/dist/components/FlowDropZone.svelte +7 -1
  15. package/dist/components/FlowDropZone.svelte.d.ts +5 -0
  16. package/dist/components/ImpactConfirm.svelte +554 -0
  17. package/dist/components/ImpactConfirm.svelte.d.ts +22 -0
  18. package/dist/components/Input.svelte +8 -2
  19. package/dist/components/LockBanner.svelte +76 -0
  20. package/dist/components/LockBanner.svelte.d.ts +14 -0
  21. package/dist/components/LockFence.svelte +33 -0
  22. package/dist/components/LockFence.svelte.d.ts +19 -0
  23. package/dist/components/Navbar.svelte +77 -9
  24. package/dist/components/Navbar.svelte.d.ts +10 -0
  25. package/dist/components/NodeSidebar.svelte +36 -15
  26. package/dist/components/NodeSidebar.svelte.d.ts +2 -0
  27. package/dist/components/NodeSwapPicker.svelte +4 -14
  28. package/dist/components/RunBar.svelte +50 -3
  29. package/dist/components/RunBar.svelte.d.ts +5 -0
  30. package/dist/components/RunInputsDialog.svelte +198 -0
  31. package/dist/components/RunInputsDialog.svelte.d.ts +34 -0
  32. package/dist/components/Textarea.svelte +7 -1
  33. package/dist/components/WorkflowCompareDialog.svelte +177 -0
  34. package/dist/components/WorkflowCompareDialog.svelte.d.ts +10 -0
  35. package/dist/components/WorkflowEditor.svelte +120 -15
  36. package/dist/components/WorkflowEditor.svelte.d.ts +6 -0
  37. package/dist/components/WorkflowInterfaceEditor.svelte +17 -4
  38. package/dist/components/WorkflowInterfaceEntryCard.svelte +40 -7
  39. package/dist/components/WorkflowInterfaceEntryCard.svelte.d.ts +2 -0
  40. package/dist/components/WorkflowPlaygroundSettings.svelte +9 -1
  41. package/dist/components/form/FieldFactory.svelte +13 -6
  42. package/dist/components/form/FormArray.svelte +0 -1
  43. package/dist/components/form/FormArrayRows.svelte +4 -4
  44. package/dist/components/form/FormCodeEditor.svelte +18 -2
  45. package/dist/components/form/FormMarkdownEditor.svelte +22 -8
  46. package/dist/components/form/FormTemplateEditor.svelte +17 -1
  47. package/dist/components/form/readOnly.d.ts +13 -0
  48. package/dist/components/form/readOnly.js +18 -0
  49. package/dist/components/nodes/CaptionNode.svelte +1 -0
  50. package/dist/components/nodes/NodeCard.svelte +2 -2
  51. package/dist/components/primitives/Checkbox.svelte +5 -1
  52. package/dist/components/primitives/Select.svelte +6 -1
  53. package/dist/components/primitives/Switch.svelte +5 -1
  54. package/dist/components/toast/DismissibleToast.svelte +25 -6
  55. package/dist/components/toast/DismissibleToast.svelte.d.ts +3 -0
  56. package/dist/config/endpoints.d.ts +7 -0
  57. package/dist/config/endpoints.js +2 -1
  58. package/dist/editor/connectCandidates.d.ts +3 -0
  59. package/dist/editor/connectCandidates.js +14 -5
  60. package/dist/editor/index.d.ts +2 -1
  61. package/dist/editor/index.js +1 -1
  62. package/dist/helpers/workflowEditorHelper.d.ts +15 -0
  63. package/dist/helpers/workflowEditorHelper.js +9 -0
  64. package/dist/index.d.ts +2 -0
  65. package/dist/messages/defaults.d.ts +145 -0
  66. package/dist/messages/defaults.js +139 -1
  67. package/dist/openapi/v1/openapi.yaml +492 -0
  68. package/dist/registry/nodeComponentRegistry.d.ts +5 -0
  69. package/dist/schemas/v1/workflow.schema.json +2 -0
  70. package/dist/services/draftStorage.d.ts +24 -10
  71. package/dist/services/draftStorage.js +60 -35
  72. package/dist/services/globalSave.d.ts +45 -10
  73. package/dist/services/globalSave.js +296 -32
  74. package/dist/services/impactGate.d.ts +38 -0
  75. package/dist/services/impactGate.js +72 -0
  76. package/dist/services/impactService.d.ts +45 -0
  77. package/dist/services/impactService.js +157 -0
  78. package/dist/services/runsService.d.ts +9 -0
  79. package/dist/services/runsService.js +13 -0
  80. package/dist/services/toastQueue.d.ts +9 -0
  81. package/dist/services/toastService.d.ts +4 -0
  82. package/dist/services/toastService.js +9 -3
  83. package/dist/services/workflowLaunchService.d.ts +6 -0
  84. package/dist/services/workflowLaunchService.js +5 -1
  85. package/dist/settings/index.d.ts +2 -2
  86. package/dist/settings/index.js +1 -1
  87. package/dist/stores/doctorStore.svelte.d.ts +24 -1
  88. package/dist/stores/doctorStore.svelte.js +105 -2
  89. package/dist/stores/historyStore.svelte.d.ts +12 -2
  90. package/dist/stores/historyStore.svelte.js +25 -2
  91. package/dist/stores/instanceContainer.svelte.d.ts +23 -0
  92. package/dist/stores/instanceContainer.svelte.js +32 -2
  93. package/dist/stores/lockStore.svelte.d.ts +39 -0
  94. package/dist/stores/lockStore.svelte.js +109 -0
  95. package/dist/stores/runController.svelte.d.ts +2 -0
  96. package/dist/stores/runController.svelte.js +27 -11
  97. package/dist/stores/saveConflictStore.svelte.d.ts +62 -0
  98. package/dist/stores/saveConflictStore.svelte.js +169 -0
  99. package/dist/stores/workflowStore.svelte.d.ts +14 -4
  100. package/dist/stores/workflowStore.svelte.js +55 -18
  101. package/dist/styles/base.css +6 -0
  102. package/dist/styles/toast.css +10 -1
  103. package/dist/svelte-app.d.ts +33 -0
  104. package/dist/svelte-app.js +178 -22
  105. package/dist/types/doctor.d.ts +3 -1
  106. package/dist/types/events.d.ts +37 -0
  107. package/dist/types/events.js +2 -0
  108. package/dist/types/impact.d.ts +77 -0
  109. package/dist/types/impact.js +7 -0
  110. package/dist/types/lock.d.ts +35 -0
  111. package/dist/types/lock.js +13 -0
  112. package/dist/types/navbar.d.ts +6 -0
  113. package/dist/types/settings.d.ts +31 -0
  114. package/dist/types/settings.js +132 -0
  115. package/dist/utils/draftRestore.d.ts +27 -0
  116. package/dist/utils/draftRestore.js +36 -0
  117. package/dist/utils/interfaceTags.js +4 -1
  118. package/dist/utils/links.d.ts +29 -0
  119. package/dist/utils/links.js +63 -0
  120. package/dist/utils/nodeSearch.d.ts +10 -0
  121. package/dist/utils/nodeSearch.js +37 -0
  122. package/dist/utils/runOffer.d.ts +21 -0
  123. package/dist/utils/runOffer.js +13 -0
  124. package/dist/utils/workflowCompare.d.ts +35 -0
  125. package/dist/utils/workflowCompare.js +84 -0
  126. package/dist/utils/workflowInterface.d.ts +26 -1
  127. package/dist/utils/workflowInterface.js +91 -11
  128. package/dist/webmcp/runtime.js +16 -3
  129. package/dist/webmcp/types.d.ts +11 -1
  130. package/package.json +3 -2
@@ -65,7 +65,7 @@
65
65
  label: t.makeDefault,
66
66
  icon: 'mdi:star-outline',
67
67
  testId: 'array-row-make-default',
68
- disabled: itemRef.wired || markedIndex === index,
68
+ disabled: disabled || itemRef.wired || markedIndex === index,
69
69
  onselect: () => {
70
70
  const name = (items[index] as Record<string, unknown> | undefined)?.[columns[0][0]];
71
71
  itemRef.onChange(typeof name === 'string' ? name : '');
@@ -77,13 +77,13 @@
77
77
  {
78
78
  label: t.moveUp,
79
79
  icon: 'mdi:arrow-up',
80
- disabled: index === 0,
80
+ disabled: disabled || index === 0,
81
81
  onselect: () => onMove(index, index - 1)
82
82
  },
83
83
  {
84
84
  label: t.moveDown,
85
85
  icon: 'mdi:arrow-down',
86
- disabled: index === items.length - 1,
86
+ disabled: disabled || index === items.length - 1,
87
87
  onselect: () => onMove(index, index + 1)
88
88
  },
89
89
  { type: 'separator' },
@@ -91,7 +91,7 @@
91
91
  label: t.delete,
92
92
  icon: 'mdi:trash-can-outline',
93
93
  testId: 'array-row-delete',
94
- disabled: !canRemove,
94
+ disabled: disabled || !canRemove,
95
95
  onselect: () => onRemove(index)
96
96
  }
97
97
  );
@@ -17,7 +17,7 @@
17
17
  highlightActiveLineGutter,
18
18
  drawSelection
19
19
  } from '@codemirror/view';
20
- import { EditorState } from '@codemirror/state';
20
+ import { EditorState, Compartment } from '@codemirror/state';
21
21
  import { history, historyKeymap } from '@codemirror/commands';
22
22
  import { highlightSpecialChars, highlightActiveLine } from '@codemirror/view';
23
23
  import { syntaxHighlighting, defaultHighlightStyle } from '@codemirror/language';
@@ -172,6 +172,13 @@
172
172
  }
173
173
  }
174
174
 
175
+ /** Compartment so the editor can turn read-only on and off after it is mounted. */
176
+ const readOnlyCompartment = new Compartment();
177
+
178
+ function readOnlyExtensions(readOnly: boolean) {
179
+ return readOnly ? [EditorState.readOnly.of(true), EditorView.editable.of(false)] : [];
180
+ }
181
+
175
182
  /**
176
183
  * Create editor extensions array
177
184
  * Uses minimal setup for better performance (no auto-closing brackets, no autocompletion)
@@ -192,7 +199,7 @@
192
199
  : [history(), keymap.of([...defaultKeymap, ...historyKeymap, indentWithTab])]),
193
200
 
194
201
  // Read-only: prevent document changes and mark content as non-editable
195
- ...(disabled ? [EditorState.readOnly.of(true), EditorView.editable.of(false)] : []),
202
+ readOnlyCompartment.of(readOnlyExtensions(disabled)),
196
203
 
197
204
  // Syntax highlighting - use default for light mode, oneDark handles dark mode
198
205
  ...(darkTheme ? [oneDark] : [syntaxHighlighting(defaultHighlightStyle, { fallback: true })]),
@@ -263,6 +270,15 @@
263
270
  }
264
271
  });
265
272
 
273
+ /** Follow `disabled` after mount (for example when the editor gets locked). */
274
+ $effect(() => {
275
+ const readOnly = disabled;
276
+ if (!editorView) return;
277
+ editorView.dispatch({
278
+ effects: [readOnlyCompartment.reconfigure(readOnlyExtensions(readOnly))]
279
+ });
280
+ });
281
+
266
282
  /**
267
283
  * Update editor content when value prop changes externally
268
284
  */
@@ -95,6 +95,13 @@
95
95
  /** Autosave timer */
96
96
  let autosaveTimer: ReturnType<typeof setTimeout> | undefined;
97
97
 
98
+ /** Compartment so the editor can turn read-only on and off after it is mounted. */
99
+ const readOnlyCompartment = new Compartment();
100
+
101
+ function readOnlyExtensions(readOnly: boolean) {
102
+ return readOnly ? [EditorState.readOnly.of(true), EditorView.editable.of(false)] : [];
103
+ }
104
+
98
105
  /** Theme compartment for dynamic theme switching */
99
106
  const themeCompartment = new Compartment();
100
107
 
@@ -349,14 +356,12 @@
349
356
  drawSelection(),
350
357
  placeholderCompartment.of(placeholder(placeholderText)),
351
358
 
352
- // Editing features (skip when read-only)
353
- ...(disabled
354
- ? [EditorState.readOnly.of(true), EditorView.editable.of(false)]
355
- : [
356
- history(),
357
- keymap.of([...defaultKeymap, ...historyKeymap, indentWithTab]),
358
- createToolbarKeymap()
359
- ]),
359
+ // Editing features
360
+ history(),
361
+ keymap.of([...defaultKeymap, ...historyKeymap, indentWithTab]),
362
+ createToolbarKeymap(),
363
+ // Read-only: prevents document changes and marks content as non-editable
364
+ readOnlyCompartment.of(readOnlyExtensions(disabled)),
360
365
 
361
366
  // Theme
362
367
  themeCompartment.of(
@@ -455,6 +460,15 @@
455
460
  if (editorView) editorView.destroy();
456
461
  });
457
462
 
463
+ /** Follow `disabled` after mount (for example when the editor gets locked). */
464
+ $effect(() => {
465
+ const readOnly = disabled;
466
+ if (!editorView) return;
467
+ editorView.dispatch({
468
+ effects: [readOnlyCompartment.reconfigure(readOnlyExtensions(readOnly))]
469
+ });
470
+ });
471
+
458
472
  /**
459
473
  * Update editor content when value prop changes externally
460
474
  */
@@ -195,6 +195,13 @@
195
195
  /** Flag to prevent update loops */
196
196
  let isInternalUpdate = false;
197
197
 
198
+ /** Compartment so the editor can turn read-only on and off after it is mounted. */
199
+ const readOnlyCompartment = new Compartment();
200
+
201
+ function readOnlyExtensions(readOnly: boolean) {
202
+ return readOnly ? [EditorState.readOnly.of(true), EditorView.editable.of(false)] : [];
203
+ }
204
+
198
205
  /** Compartment for dynamic autocomplete reconfiguration */
199
206
  const autocompleteCompartment = new Compartment();
200
207
 
@@ -267,7 +274,7 @@
267
274
  : [history(), keymap.of([...defaultKeymap, ...historyKeymap, indentWithTab])]),
268
275
 
269
276
  // Read-only: prevent document changes and mark content as non-editable
270
- ...(disabled ? [EditorState.readOnly.of(true), EditorView.editable.of(false)] : []),
277
+ readOnlyCompartment.of(readOnlyExtensions(disabled)),
271
278
 
272
279
  // Syntax highlighting - use default for light mode, oneDark handles dark mode
273
280
  ...(darkTheme ? [] : [syntaxHighlighting(defaultHighlightStyle, { fallback: true })]),
@@ -450,6 +457,15 @@
450
457
  }
451
458
  });
452
459
 
460
+ /** Follow `disabled` after mount (for example when the editor gets locked). */
461
+ $effect(() => {
462
+ const readOnly = disabled;
463
+ if (!editorView) return;
464
+ editorView.dispatch({
465
+ effects: [readOnlyCompartment.reconfigure(readOnlyExtensions(readOnly))]
466
+ });
467
+ });
468
+
453
469
  /**
454
470
  * Update editor content when value prop changes externally
455
471
  */
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Read-only context for forms.
3
+ *
4
+ * A parent (for example the lock fence) calls `provideFormReadOnly` with a getter.
5
+ * Form fields call `useFormReadOnly` and treat a `true` answer like a read-only
6
+ * schema: the value cannot be changed, but the field can still be looked at.
7
+ * The getter is read each time, so it may be reactive.
8
+ */
9
+ export declare const FORM_READ_ONLY_KEY = "flowdrop:formReadOnly";
10
+ /** Tell every form field below this component whether it is read-only. */
11
+ export declare function provideFormReadOnly(isReadOnly: () => boolean): void;
12
+ /** Whether the form around this component is read-only. Call during component setup. */
13
+ export declare function useFormReadOnly(): () => boolean;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Read-only context for forms.
3
+ *
4
+ * A parent (for example the lock fence) calls `provideFormReadOnly` with a getter.
5
+ * Form fields call `useFormReadOnly` and treat a `true` answer like a read-only
6
+ * schema: the value cannot be changed, but the field can still be looked at.
7
+ * The getter is read each time, so it may be reactive.
8
+ */
9
+ import { getContext, setContext } from 'svelte';
10
+ export const FORM_READ_ONLY_KEY = 'flowdrop:formReadOnly';
11
+ /** Tell every form field below this component whether it is read-only. */
12
+ export function provideFormReadOnly(isReadOnly) {
13
+ setContext(FORM_READ_ONLY_KEY, isReadOnly);
14
+ }
15
+ /** Whether the form around this component is read-only. Call during component setup. */
16
+ export function useFormReadOnly() {
17
+ return getContext(FORM_READ_ONLY_KEY) ?? (() => false);
18
+ }
@@ -245,6 +245,7 @@
245
245
  role="textbox"
246
246
  tabindex="0"
247
247
  aria-label={caption.editLabel}
248
+ data-lock-commit
248
249
  data-placeholder={caption.placeholder}
249
250
  bind:this={editorEl}
250
251
  {@attach editable}
@@ -315,7 +315,7 @@
315
315
  data-fd-port-type={pin.port.dataType}
316
316
  aria-label={pin.direction === 'input' ? graph.execIn : graph.execOut}
317
317
  style="top: {pin.y}px; transform: translateY(-50%);"
318
- tabindex={-1}
318
+ tabindex={selected ? 0 : -1}
319
319
  onmouseenter={(e: Event) => showPortTip(e, pin.port, pin.direction, false, true)}
320
320
  onmouseleave={hideTip}
321
321
  onfocus={(e: Event) => showPortTip(e, pin.port, pin.direction, false, true)}
@@ -361,7 +361,7 @@
361
361
  ? graph.connectInputPort({ name: port.name })
362
362
  : graph.connectOutputPort({ name: port.name })}
363
363
  style="top: {item.y}px; transform: translateY(-50%); --_c: {portColor};"
364
- tabindex={-1}
364
+ tabindex={selected ? 0 : -1}
365
365
  onmouseenter={(e: Event) => showPortTip(e, port, item.direction, open, false)}
366
366
  onmouseleave={hideTip}
367
367
  onfocus={(e: Event) => showPortTip(e, port, item.direction, open, false)}
@@ -14,6 +14,7 @@
14
14
  <script lang="ts">
15
15
  import type { Snippet } from 'svelte';
16
16
  import type { HTMLInputAttributes } from 'svelte/elements';
17
+ import { useFormReadOnly } from '../form/readOnly.js';
17
18
 
18
19
  interface Props extends Omit<HTMLInputAttributes, 'type' | 'checked' | 'onchange' | 'class'> {
19
20
  /** Current state. */
@@ -31,9 +32,12 @@
31
32
  label,
32
33
  onchange,
33
34
  class: className = '',
34
- disabled = false,
35
+ disabled: disabledProp = false,
35
36
  ...rest
36
37
  }: Props = $props();
38
+
39
+ const formReadOnly = useFormReadOnly();
40
+ const disabled = $derived(disabledProp || formReadOnly());
37
41
  </script>
38
42
 
39
43
  <label class="flowdrop-ui-checkbox {className}" class:flowdrop-ui-checkbox--disabled={disabled}>
@@ -22,6 +22,7 @@
22
22
  import type { Snippet } from 'svelte';
23
23
  import type { HTMLSelectAttributes } from 'svelte/elements';
24
24
  import Combobox from './Combobox.svelte';
25
+ import { useFormReadOnly } from '../form/readOnly.js';
25
26
  import { selectRendering, type SelectOption } from '../../utils/selectOptions.js';
26
27
 
27
28
  // Omit native numeric `size` so our design-token size (matching Button) wins.
@@ -59,6 +60,9 @@
59
60
  ...rest
60
61
  }: Props = $props();
61
62
 
63
+ const formReadOnly = useFormReadOnly();
64
+ const isDisabled = $derived(rest.disabled || formReadOnly());
65
+
62
66
  const rendering = $derived(options ? selectRendering(options, searchable) : 'native');
63
67
  const hasValue = $derived(options?.some((o) => o.value === value) ?? false);
64
68
 
@@ -86,7 +90,7 @@
86
90
  class={className}
87
91
  id={rest.id ?? undefined}
88
92
  name={rest.name ?? undefined}
89
- disabled={rest.disabled ?? false}
93
+ disabled={isDisabled}
90
94
  aria-label={rest['aria-label'] ?? undefined}
91
95
  aria-labelledby={rest['aria-labelledby'] ?? undefined}
92
96
  aria-describedby={rest['aria-describedby'] ?? undefined}
@@ -97,6 +101,7 @@
97
101
  <select
98
102
  class={selectClass}
99
103
  {...rest}
104
+ disabled={isDisabled}
100
105
  {...value !== undefined ? { value } : {}}
101
106
  onchange={(event) => {
102
107
  // `rest.onchange` is the caller's handler (an event handler, or a list of them).
@@ -14,6 +14,7 @@
14
14
 
15
15
  <script lang="ts">
16
16
  import type { HTMLInputAttributes } from 'svelte/elements';
17
+ import { useFormReadOnly } from '../form/readOnly.js';
17
18
 
18
19
  interface Props extends Omit<HTMLInputAttributes, 'type' | 'checked' | 'onchange' | 'class'> {
19
20
  /** Current state. */
@@ -31,9 +32,12 @@
31
32
  label,
32
33
  onchange,
33
34
  class: className = '',
34
- disabled = false,
35
+ disabled: disabledProp = false,
35
36
  ...rest
36
37
  }: Props = $props();
38
+
39
+ const formReadOnly = useFormReadOnly();
40
+ const disabled = $derived(disabledProp || formReadOnly());
37
41
  </script>
38
42
 
39
43
  <span class="flowdrop-ui-switch {className}">
@@ -29,7 +29,10 @@
29
29
  /** Why it happened, one short paragraph. */
30
30
  body?: string;
31
31
  details?: readonly string[];
32
+ /** Single action; kept for callers outside the library. */
32
33
  action?: ToastAction;
34
+ /** Follow-up steps, shown after `action`. */
35
+ actions?: readonly ToastAction[];
33
36
  kind?: ToastKind;
34
37
  dismissible?: boolean;
35
38
  }
@@ -40,13 +43,23 @@
40
43
  body,
41
44
  details = [],
42
45
  action,
46
+ actions = [],
43
47
  kind = 'info',
44
48
  dismissible = true
45
49
  }: Props = $props();
46
50
 
47
- function runAction(): void {
48
- action?.onClick();
49
- toastApi.dismiss(toast.id);
51
+ const all = $derived([...(action ? [action] : []), ...actions]);
52
+ // The main action is the one marked `primary`, else the first.
53
+ const mainIndex = $derived(
54
+ Math.max(
55
+ 0,
56
+ all.findIndex((a) => a.primary)
57
+ )
58
+ );
59
+
60
+ function run(item: ToastAction): void {
61
+ item.onClick();
62
+ if (!item.keepOpen) toastApi.dismiss(toast.id);
50
63
  }
51
64
  </script>
52
65
 
@@ -88,9 +101,15 @@
88
101
  {/each}
89
102
  </ul>
90
103
  {/if}
91
- {#if action}
92
- <div class="flowdrop-toast-actions">
93
- <Button variant="ghost" size="sm" onclick={runAction}>{action.label}</Button>
104
+ {#if all.length}
105
+ <div class="flowdrop-toast-actions" class:flowdrop-toast-actions--multi={all.length > 1}>
106
+ {#each all as item, i (i)}
107
+ <Button
108
+ variant={all.length === 1 ? 'ghost' : i === mainIndex ? 'primary' : 'secondary'}
109
+ size="sm"
110
+ onclick={() => run(item)}>{item.label}</Button
111
+ >
112
+ {/each}
94
113
  </div>
95
114
  {/if}
96
115
  </div>
@@ -25,7 +25,10 @@ interface Props {
25
25
  /** Why it happened, one short paragraph. */
26
26
  body?: string;
27
27
  details?: readonly string[];
28
+ /** Single action; kept for callers outside the library. */
28
29
  action?: ToastAction;
30
+ /** Follow-up steps, shown after `action`. */
31
+ actions?: readonly ToastAction[];
29
32
  kind?: ToastKind;
30
33
  dismissible?: boolean;
31
34
  }
@@ -51,6 +51,13 @@ export interface EndpointConfig {
51
51
  * the editor applies as one undoable edit. Needs `diagnose`.
52
52
  */
53
53
  remedy?: string;
54
+ /**
55
+ * Impact check before save (`POST`, body = the workflow as the editor
56
+ * would save it, `{id}` = the saved workflow id). Answers `{ success,
57
+ * data: { confirm, interface, renames, items } }`. A backend without it
58
+ * omits the key and the editor saves without asking.
59
+ */
60
+ impact?: string;
54
61
  };
55
62
  executions: {
56
63
  execute: string;
@@ -28,7 +28,8 @@ export const defaultEndpointConfig = {
28
28
  // Singular `workflow` here is the reference backend's spelling, not a typo.
29
29
  run: '/workflow/{workflowId}/run',
30
30
  diagnose: '/workflow/{id}/diagnose',
31
- remedy: '/workflow/{id}/remedy'
31
+ remedy: '/workflow/{id}/remedy',
32
+ impact: '/workflow/{id}/impact'
32
33
  },
33
34
  executions: {
34
35
  execute: '/workflows/{id}/execute',
@@ -7,6 +7,9 @@
7
7
  * wire is a valid target (the pick adds another); a pair that is already wired
8
8
  * is marked and picking it does nothing.
9
9
  *
10
+ * Trigger pins and data ports never count as compatible with each other: they
11
+ * are listed, but under "Other types".
12
+ *
10
13
  * @module editor/connectCandidates
11
14
  */
12
15
  import type { NodePort, Workflow, WorkflowEdge } from '../types/index.js';
@@ -7,6 +7,9 @@
7
7
  * wire is a valid target (the pick adds another); a pair that is already wired
8
8
  * is marked and picking it does nothing.
9
9
  *
10
+ * Trigger pins and data ports never count as compatible with each other: they
11
+ * are listed, but under "Other types".
12
+ *
10
13
  * @module editor/connectCandidates
11
14
  */
12
15
  import { v4 as uuidv4 } from 'uuid';
@@ -14,7 +17,7 @@ import { ProximityConnectHelper } from '../helpers/proximityConnect.js';
14
17
  import { buildHandleId } from '../utils/handleIds.js';
15
18
  import { isPortVisible } from '../utils/portUtils.js';
16
19
  import { isTriggerEventInput } from '../utils/reservedPorts.js';
17
- import { nodeCanvasLabel } from '../utils/workflowInterface.js';
20
+ import { disambiguateLabels, nodeCanvasLabel } from '../utils/workflowInterface.js';
18
21
  import { defaultMessages } from '../messages/defaults.js';
19
22
  /** A stable key for a candidate, `nodeId::portId`. */
20
23
  export function connectCandidateKey(candidate) {
@@ -49,6 +52,7 @@ export function canConnectFrom(workflow, target) {
49
52
  */
50
53
  export function listConnectCandidates(workflow, checker, target) {
51
54
  const groups = { compatible: [], other: [] };
55
+ const found = [];
52
56
  const origin = resolveOrigin(workflow, target);
53
57
  if (!origin)
54
58
  return groups;
@@ -75,9 +79,11 @@ export function listConnectCandidates(workflow, checker, target) {
75
79
  edge.sourceHandle === handle &&
76
80
  edge.target === target.nodeId &&
77
81
  edge.targetHandle === originHandle);
78
- const compatible = fromOutput
79
- ? checker.areDataTypesCompatible(origin.port.dataType, port.dataType)
80
- : checker.areDataTypesCompatible(port.dataType, origin.port.dataType);
82
+ const sameKind = (origin.port.dataType === 'trigger') === (port.dataType === 'trigger');
83
+ const compatible = sameKind &&
84
+ (fromOutput
85
+ ? checker.areDataTypesCompatible(origin.port.dataType, port.dataType)
86
+ : checker.areDataTypesCompatible(port.dataType, origin.port.dataType));
81
87
  const candidate = {
82
88
  nodeId: node.id,
83
89
  nodeLabel: nodeCanvasLabel(node),
@@ -86,9 +92,12 @@ export function listConnectCandidates(workflow, checker, target) {
86
92
  wired,
87
93
  connected
88
94
  };
89
- (compatible ? groups.compatible : groups.other).push(candidate);
95
+ found.push(candidate);
90
96
  }
91
97
  }
98
+ for (const candidate of disambiguateLabels(found)) {
99
+ (candidate.compatible ? groups.compatible : groups.other).push(candidate);
100
+ }
92
101
  return groups;
93
102
  }
94
103
  /** The edge a pick makes. The source is always the output side. Styling is left to the editor. */
@@ -78,10 +78,11 @@ export { showSuccess, showError, showWarning, showInfo, showLoading, dismissToas
78
78
  export { NodeExecutionService } from '../services/nodeExecutionService.js';
79
79
  export { saveWorkflow, updateWorkflow, getWorkflow, getWorkflows, deleteWorkflow, getWorkflowCount, initializeSampleWorkflows } from '../services/workflowStorage.js';
80
80
  export { globalSaveWorkflow, globalExportWorkflow } from '../services/globalSave.js';
81
+ export type { SaveRefusalOutcome } from '../services/globalSave.js';
81
82
  export { fetchPortConfig, validatePortConfig } from '../services/portConfigApi.js';
82
83
  export { fetchCategories, validateCategories } from '../services/categoriesApi.js';
83
84
  export { fetchDynamicSchema, resolveExternalEditUrl, getEffectiveConfigEditOptions, clearSchemaCache, invalidateSchemaCache, hasConfigEditOptions, shouldShowExternalEdit, shouldUseDynamicSchema } from '../services/dynamicSchemaService.js';
84
- export { getDraftStorageKey, saveDraft, loadDraft, deleteDraft, hasDraft, getDraftMetadata, clearAllDrafts, setDraftStorage, getDraftStorage, resolveDraftStorage, DraftAutoSaveManager } from '../services/draftStorage.js';
85
+ export { getDraftStorageKey, saveDraft, loadDraft, draftFingerprint, deleteDraft, hasDraft, getDraftMetadata, clearAllDrafts, setDraftStorage, getDraftStorage, resolveDraftStorage, DraftAutoSaveManager } from '../services/draftStorage.js';
85
86
  export type { DraftStorageAdapter, DraftStorageType, DraftStorageOption } from '../services/draftStorage.js';
86
87
  export { EnhancedFlowDropApiClient, ApiError, parseApiErrorBody, errorDetails } from '../api/enhanced-client.js';
87
88
  export { isLoopbackEdge, isValidLoopbackCycle, PortCompatibilityChecker, getPossibleConnections, validateConnection, getConnectionSuggestions, hasCycles, hasInvalidCycles, getExecutionOrder } from '../utils/connections.js';
@@ -116,7 +116,7 @@ export { globalSaveWorkflow, globalExportWorkflow } from '../services/globalSave
116
116
  export { fetchPortConfig, validatePortConfig } from '../services/portConfigApi.js';
117
117
  export { fetchCategories, validateCategories } from '../services/categoriesApi.js';
118
118
  export { fetchDynamicSchema, resolveExternalEditUrl, getEffectiveConfigEditOptions, clearSchemaCache, invalidateSchemaCache, hasConfigEditOptions, shouldShowExternalEdit, shouldUseDynamicSchema } from '../services/dynamicSchemaService.js';
119
- export { getDraftStorageKey, saveDraft, loadDraft, deleteDraft, hasDraft, getDraftMetadata, clearAllDrafts, setDraftStorage, getDraftStorage, resolveDraftStorage, DraftAutoSaveManager } from '../services/draftStorage.js';
119
+ export { getDraftStorageKey, saveDraft, loadDraft, draftFingerprint, deleteDraft, hasDraft, getDraftMetadata, clearAllDrafts, setDraftStorage, getDraftStorage, resolveDraftStorage, DraftAutoSaveManager } from '../services/draftStorage.js';
120
120
  // ============================================================================
121
121
  // API Clients
122
122
  // ============================================================================
@@ -145,6 +145,21 @@ export declare class WorkflowOperationsHelper {
145
145
  */
146
146
  static checkWorkflowHasAnyCycles(nodes: WorkflowNodeType[], edges: WorkflowEdge[]): boolean;
147
147
  }
148
+ /**
149
+ * Where a node added from the palette lands: to the right of the selected
150
+ * node, else the middle of the visible canvas.
151
+ */
152
+ export declare function placementForNewNode(selected: {
153
+ x: number;
154
+ y: number;
155
+ width: number;
156
+ } | null, viewportCentre: {
157
+ x: number;
158
+ y: number;
159
+ }, gap: number): {
160
+ x: number;
161
+ y: number;
162
+ };
148
163
  /**
149
164
  * Configuration helper
150
165
  */
@@ -412,6 +412,15 @@ export class WorkflowOperationsHelper {
412
412
  return hasCycles(nodes, edges);
413
413
  }
414
414
  }
415
+ /**
416
+ * Where a node added from the palette lands: to the right of the selected
417
+ * node, else the middle of the visible canvas.
418
+ */
419
+ export function placementForNewNode(selected, viewportCentre, gap) {
420
+ if (!selected)
421
+ return { x: viewportCentre.x, y: viewportCentre.y };
422
+ return { x: selected.x + selected.width + gap, y: selected.y };
423
+ }
415
424
  /**
416
425
  * Configuration helper
417
426
  */
package/dist/index.d.ts CHANGED
@@ -39,4 +39,6 @@ export type { AuthProvider } from './types/auth.js';
39
39
  export type { FlowDropInstance } from './stores/instanceContainer.svelte.js';
40
40
  export type { FlowDropMountOptions, MountedFlowDropApp, RunCommandOptions } from './svelte-app.js';
41
41
  export type { FlowDropEventHandlers } from './types/events.js';
42
+ export type { EditorLock, EditorLockReason, EditorLockAction } from './types/lock.js';
43
+ export type { ImpactSeverity, ImpactItem, ImpactReport, ImpactRename, ImpactRenamePlace, SavedCopy } from './types/impact.js';
42
44
  export type { Messages, MessagesOverride } from './messages/index.js';