@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
@@ -0,0 +1,554 @@
1
+ <!--
2
+ ImpactConfirm
3
+
4
+ The dialog shown before a workflow save that breaks or changes what uses the
5
+ workflow: lists the affected things by severity and asks the person at the
6
+ keyboard. Mounted imperatively by `services/impactGate.ts` into the host's
7
+ container (default `document.body`), one at a time per editor.
8
+
9
+ A native modal `<dialog>`: the page behind it is inert, Tab stays inside, and
10
+ the item links are part of the Tab order. Focus starts on Cancel, so Enter
11
+ never saves a breaking change by reflex.
12
+ -->
13
+
14
+ <script lang="ts">
15
+ import { onMount, tick } from 'svelte';
16
+ import { getMessages } from '../messages/context.js';
17
+ import type { Messages } from '../messages/types.js';
18
+ import Button from './primitives/Button.svelte';
19
+ import Checkbox from './primitives/Checkbox.svelte';
20
+ import { safeLinkUrl } from '../utils/links.js';
21
+ import type {
22
+ ImpactAnswer,
23
+ ImpactItem,
24
+ ImpactRenamePlace,
25
+ ImpactReport,
26
+ ImpactSeverity,
27
+ SavedCopy
28
+ } from '../types/impact.js';
29
+
30
+ interface Props {
31
+ /** What the check found. `null` when the check itself failed (see `error`). */
32
+ report: ImpactReport | null;
33
+ /** The reason the check failed; shown as one line instead of the list. */
34
+ error?: string;
35
+ /** Called exactly once with what the person decided. */
36
+ onResolve: (answer: ImpactAnswer) => void;
37
+ /**
38
+ * Saves the draft as a new workflow (the refused state's "Save as a copy").
39
+ * Rejects with the reason when it fails; the dialog then stays open.
40
+ */
41
+ onSaveAsCopy?: () => Promise<SavedCopy>;
42
+ /**
43
+ * Throws away every unsaved edit and loads the saved version (the refused
44
+ * state's "Discard my changes").
45
+ */
46
+ onDiscard?: () => Promise<void>;
47
+ }
48
+
49
+ let { report, error, onResolve, onSaveAsCopy, onDiscard }: Props = $props();
50
+
51
+ // The getter is read at initialisation: the context is gone after an await.
52
+ const readMessages = getMessages();
53
+ const m = (): Messages => readMessages();
54
+
55
+ const refused = $derived(report?.refused === true);
56
+ const renames = $derived(report?.renames ?? []);
57
+ const renamedPlaces = $derived(renames.reduce((n, r) => n + r.places.length, 0));
58
+ const breakingCount = $derived(
59
+ (report?.items ?? []).filter((item) => item.severity === 'breaks').length
60
+ );
61
+ // Opt-in: nothing a rename touches elsewhere changes unless the person asks.
62
+ let followRenames = $state(false);
63
+ let busy = $state<'copy' | 'discard' | null>(null);
64
+ let actionError = $state('');
65
+
66
+ // Unique per instance so two dialogs on one page do not share a DOM id.
67
+ const uid = $props.id();
68
+ const titleId = `${uid}-impact-title`;
69
+ const bodyId = `${uid}-impact-body`;
70
+
71
+ const severities: ImpactSeverity[] = ['breaks', 'changes', 'info'];
72
+
73
+ const groups = $derived(
74
+ severities
75
+ .map((severity) => ({
76
+ severity,
77
+ items: (report?.items ?? []).filter((item: ImpactItem) => item.severity === severity)
78
+ }))
79
+ .filter((group) => group.items.length > 0)
80
+ );
81
+
82
+ let dialogRef = $state<HTMLDialogElement | null>(null);
83
+ let cancelWrap = $state<HTMLElement | null>(null);
84
+ let opener: HTMLElement | null = null;
85
+ let resolved = false;
86
+
87
+ onMount(() => {
88
+ opener = document.activeElement instanceof HTMLElement ? document.activeElement : null;
89
+ if (dialogRef && !dialogRef.open) dialogRef.showModal();
90
+ // showModal focuses the first control (a link); the safe answer comes first.
91
+ cancelWrap?.querySelector('button')?.focus();
92
+ });
93
+
94
+ /**
95
+ * The safe answer takes focus. While an action runs every button is
96
+ * disabled and cannot hold focus, so this runs when the action has failed
97
+ * and the buttons are enabled again (the dialog may have been reopened).
98
+ */
99
+ async function focusCancel(): Promise<void> {
100
+ await tick();
101
+ cancelWrap?.querySelector('button')?.focus();
102
+ }
103
+
104
+ function resolve(answer: ImpactAnswer): void {
105
+ if (resolved) return;
106
+ resolved = true;
107
+ if (dialogRef?.open) dialogRef.close();
108
+ if (opener?.isConnected) opener.focus();
109
+ onResolve(answer);
110
+ }
111
+
112
+ function save(): void {
113
+ // Only a box the person saw is an answer.
114
+ resolve(renamedPlaces > 0 ? { action: 'save', followRenames } : { action: 'save' });
115
+ }
116
+
117
+ async function saveCopy(): Promise<void> {
118
+ if (!onSaveAsCopy || busy) return;
119
+ busy = 'copy';
120
+ actionError = '';
121
+ try {
122
+ const copy = await onSaveAsCopy();
123
+ resolve({ action: 'copied', copy });
124
+ } catch (e) {
125
+ actionError = m().impact.refused.copyFailed({
126
+ message: e instanceof Error ? e.message : String(e)
127
+ });
128
+ busy = null;
129
+ void focusCancel();
130
+ }
131
+ }
132
+
133
+ async function discard(): Promise<void> {
134
+ if (!onDiscard || busy) return;
135
+ busy = 'discard';
136
+ actionError = '';
137
+ try {
138
+ await onDiscard();
139
+ resolve({ action: 'discarded' });
140
+ } catch (e) {
141
+ actionError = m().impact.refused.discardFailed({
142
+ message: e instanceof Error ? e.message : String(e)
143
+ });
144
+ busy = null;
145
+ void focusCancel();
146
+ }
147
+ }
148
+
149
+ // Escape: the native cancel event. Resolve here and keep the browser from
150
+ // closing the dialog a second time.
151
+ function handleCancel(event: Event): void {
152
+ event.preventDefault();
153
+ if (busy) return;
154
+ resolve({ action: 'cancel' });
155
+ }
156
+
157
+ // The browser can close the dialog without a cancel event (a second Escape
158
+ // under close-request handling). An action in flight must not be cut off:
159
+ // its answer ('copied', 'discarded') or its error is what the person needs,
160
+ // so the dialog opens again. Otherwise whoever waits still gets an answer.
161
+ // `resolve` ignores this when the dialog was closed by an answer.
162
+ function handleClose(): void {
163
+ if (resolved) return;
164
+ if (busy) {
165
+ if (dialogRef && !dialogRef.open) {
166
+ dialogRef.showModal();
167
+ }
168
+ return;
169
+ }
170
+ resolve({ action: 'cancel' });
171
+ }
172
+ </script>
173
+
174
+ {#snippet label(text: string, url: string | null)}
175
+ {@const href = safeLinkUrl(url)}
176
+ {#if href}
177
+ <a class="fd-impact-confirm__label" {href} target="_blank" rel="noopener">{text}</a>
178
+ {:else}
179
+ <span class="fd-impact-confirm__label">{text}</span>
180
+ {/if}
181
+ {/snippet}
182
+
183
+ {#snippet itemRow(item: ImpactItem, severity: ImpactSeverity)}
184
+ <li class="fd-impact-confirm__item">
185
+ <span class="fd-impact-confirm__severity">{m().impact.severity[severity]}</span>
186
+ <span class="fd-impact-confirm__text">
187
+ {@render label(item.label, item.url)}
188
+ <span class="fd-impact-confirm__message">{item.message}</span>
189
+ </span>
190
+ </li>
191
+ {/snippet}
192
+
193
+ {#snippet placeRow(place: ImpactRenamePlace)}
194
+ <li class="fd-impact-confirm__item fd-impact-confirm__item--place">
195
+ <span class="fd-impact-confirm__text">
196
+ {@render label(place.label, place.url)}
197
+ {#if place.enabled === false}
198
+ <span class="fd-impact-confirm__message">{m().impact.renames.disabledPlace}</span>
199
+ {/if}
200
+ {#if place.message}
201
+ <span class="fd-impact-confirm__message">{place.message}</span>
202
+ {/if}
203
+ </span>
204
+ </li>
205
+ {/snippet}
206
+
207
+ <dialog
208
+ bind:this={dialogRef}
209
+ class="flowdrop-portal fd-impact-confirm"
210
+ data-testid="flowdrop-impact-confirm"
211
+ role="alertdialog"
212
+ aria-labelledby={titleId}
213
+ aria-describedby={bodyId}
214
+ oncancel={handleCancel}
215
+ onclose={handleClose}
216
+ closedby={busy ? 'none' : 'closerequest'}
217
+ >
218
+ <div class="fd-impact-confirm__dialog">
219
+ <header class="fd-impact-confirm__header">
220
+ <h2 id={titleId} class="fd-impact-confirm__title">
221
+ {refused ? m().impact.refused.title : m().impact.title}
222
+ </h2>
223
+ </header>
224
+ <div id={bodyId} class="fd-impact-confirm__body">
225
+ {#if refused}
226
+ <p class="fd-impact-confirm__refused" data-testid="flowdrop-impact-refused">
227
+ {m().impact.refused.body({ count: breakingCount })}
228
+ </p>
229
+ {#if report?.refusedMessage}
230
+ <p class="fd-impact-confirm__message fd-impact-confirm__refused-message">
231
+ {report.refusedMessage}
232
+ </p>
233
+ {/if}
234
+ {/if}
235
+ {#if error}
236
+ <p class="fd-impact-confirm__error" data-testid="flowdrop-impact-error">
237
+ {m().impact.failed({ message: error })}
238
+ </p>
239
+ {/if}
240
+ {#each groups as group (group.severity)}
241
+ <section class="fd-impact-confirm__group" data-severity={group.severity}>
242
+ <h3 class="fd-impact-confirm__group-title">{m().impact[group.severity]}</h3>
243
+ <ul class="fd-impact-confirm__list" role="list">
244
+ {#each group.items as item (item)}
245
+ {@render itemRow(item, group.severity)}
246
+ {/each}
247
+ </ul>
248
+ </section>
249
+ {/each}
250
+ {#if !refused && renames.length > 0}
251
+ <section class="fd-impact-confirm__group" data-testid="flowdrop-impact-renames">
252
+ <h3 class="fd-impact-confirm__group-title">{m().impact.renames.heading}</h3>
253
+ {#each renames as rename (rename.direction + rename.from)}
254
+ <p class="fd-impact-confirm__rename-title">
255
+ {m().impact.renames.title({
256
+ kind: m().impact.renames[rename.direction],
257
+ from: rename.from,
258
+ to: rename.to
259
+ })}
260
+ </p>
261
+ {#if rename.places.length > 0}
262
+ <ul class="fd-impact-confirm__list" role="list">
263
+ {#each rename.places as place (place)}
264
+ {@render placeRow(place)}
265
+ {/each}
266
+ </ul>
267
+ {:else}
268
+ <p class="fd-impact-confirm__message">{m().impact.renames.noPlaces}</p>
269
+ {/if}
270
+ {/each}
271
+ {#if renamedPlaces > 0}
272
+ <div class="fd-impact-confirm__follow">
273
+ <Checkbox
274
+ data-testid="flowdrop-impact-follow-renames"
275
+ checked={followRenames}
276
+ onchange={(checked) => (followRenames = checked)}
277
+ label={m().impact.renames.follow({ count: renamedPlaces })}
278
+ />
279
+ </div>
280
+ {/if}
281
+ </section>
282
+ {/if}
283
+ {#if actionError}
284
+ <p class="fd-impact-confirm__error" role="alert" data-testid="flowdrop-impact-action-error">
285
+ {actionError}
286
+ </p>
287
+ {/if}
288
+ </div>
289
+ <footer class="fd-impact-confirm__actions">
290
+ <span class="fd-impact-confirm__cancel" bind:this={cancelWrap}>
291
+ <Button
292
+ data-testid="flowdrop-impact-cancel"
293
+ disabled={busy !== null}
294
+ onclick={() => resolve({ action: 'cancel' })}
295
+ >
296
+ {refused ? m().impact.refused.keepEditing : m().impact.cancel}
297
+ </Button>
298
+ </span>
299
+ {#if refused}
300
+ {#if onDiscard}
301
+ <Button data-testid="flowdrop-impact-discard" disabled={busy !== null} onclick={discard}>
302
+ {busy === 'discard' ? m().impact.refused.discarding : m().impact.refused.discard}
303
+ </Button>
304
+ {/if}
305
+ {#if onSaveAsCopy && report?.copyUrl}
306
+ <Button
307
+ variant="primary"
308
+ data-testid="flowdrop-impact-copy"
309
+ disabled={busy !== null}
310
+ onclick={saveCopy}
311
+ >
312
+ {busy === 'copy' ? m().impact.refused.copying : m().impact.refused.copy}
313
+ </Button>
314
+ {/if}
315
+ {:else}
316
+ <Button variant="primary" data-testid="flowdrop-impact-save" onclick={save}>
317
+ {renamedPlaces > 0 && !report?.confirm ? m().impact.saveRenames : m().impact.save}
318
+ </Button>
319
+ {/if}
320
+ </footer>
321
+ </div>
322
+ </dialog>
323
+
324
+ <style>
325
+ /* Mounted on document.body, outside the editor tree. Tokens come from :root
326
+ (tokens.css) and, for a skinned editor, from the editor's scope, which the
327
+ helper copies onto the host element; the dark palette follows
328
+ [data-theme='dark'] on the host element; the buttons are the Button primitive.
329
+ Everything else is set here, because the host page's own element
330
+ rules (h2, h3, p, ul, li, a) reach a dialog on <body>: every element below
331
+ states its margin, padding, font and list style. */
332
+ .fd-impact-confirm {
333
+ position: fixed;
334
+ inset: 0;
335
+ z-index: 10000;
336
+ width: 100%;
337
+ height: 100%;
338
+ max-width: none;
339
+ max-height: none;
340
+ box-sizing: border-box;
341
+ margin: 0;
342
+ border: 0;
343
+ color: inherit;
344
+ align-items: center;
345
+ justify-content: center;
346
+ padding: var(--fd-space-xl, 1rem);
347
+ background: color-mix(in srgb, var(--fd-foreground) 50%, transparent);
348
+ backdrop-filter: blur(4px);
349
+ font-family: var(--fd-font-sans, system-ui, sans-serif);
350
+ font-size: var(--fd-text-sm, 0.875rem);
351
+ font-weight: 400;
352
+ line-height: var(--fd-leading-normal, 1.5);
353
+ letter-spacing: normal;
354
+ text-align: left;
355
+ text-transform: none;
356
+ }
357
+
358
+ .fd-impact-confirm:not([open]) {
359
+ display: none;
360
+ }
361
+
362
+ .fd-impact-confirm[open] {
363
+ display: flex;
364
+ }
365
+
366
+ .fd-impact-confirm::backdrop {
367
+ background: transparent;
368
+ }
369
+
370
+ .fd-impact-confirm__cancel {
371
+ display: contents;
372
+ }
373
+
374
+ .fd-impact-confirm__dialog {
375
+ display: flex;
376
+ flex-direction: column;
377
+ width: 100%;
378
+ max-width: 36rem;
379
+ max-height: calc(100vh - 2 * var(--fd-space-xl, 1rem));
380
+ overflow: hidden;
381
+ border: 1px solid var(--fd-border);
382
+ border-radius: var(--fd-radius-lg, 0.5rem);
383
+ background: var(--fd-background);
384
+ color: var(--fd-foreground);
385
+ box-shadow: var(--fd-shadow-xl);
386
+ animation: fd-impact-confirm-enter 0.2s ease-out;
387
+ }
388
+
389
+ @keyframes fd-impact-confirm-enter {
390
+ from {
391
+ opacity: 0;
392
+ transform: scale(0.95) translateY(-10px);
393
+ }
394
+ to {
395
+ opacity: 1;
396
+ transform: scale(1) translateY(0);
397
+ }
398
+ }
399
+
400
+ .fd-impact-confirm__header {
401
+ flex-shrink: 0;
402
+ padding: var(--fd-space-xl, 1rem) var(--fd-space-xl, 1rem) var(--fd-space-lg, 0.875rem);
403
+ border-bottom: 1px solid var(--fd-border);
404
+ }
405
+
406
+ .fd-impact-confirm__title {
407
+ margin: 0;
408
+ padding: 0;
409
+ font-family: inherit;
410
+ font-size: var(--fd-text-lg, 1.125rem);
411
+ letter-spacing: normal;
412
+ text-transform: none;
413
+ font-weight: 600;
414
+ line-height: var(--fd-leading-tight, 1.3);
415
+ color: var(--fd-foreground);
416
+ overflow-wrap: anywhere;
417
+ }
418
+
419
+ .fd-impact-confirm__body {
420
+ flex: 1;
421
+ min-height: 0;
422
+ overflow: auto;
423
+ padding: var(--fd-space-xl, 1rem);
424
+ }
425
+
426
+ .fd-impact-confirm__error {
427
+ margin: 0;
428
+ padding: 0;
429
+ font-size: var(--fd-text-sm, 0.875rem);
430
+ color: var(--fd-foreground);
431
+ overflow-wrap: anywhere;
432
+ }
433
+
434
+ .fd-impact-confirm__refused,
435
+ .fd-impact-confirm__refused-message,
436
+ .fd-impact-confirm__rename-title {
437
+ margin: 0 0 var(--fd-space-xs, 0.5rem);
438
+ padding: 0;
439
+ overflow-wrap: anywhere;
440
+ }
441
+
442
+ .fd-impact-confirm__refused {
443
+ font-weight: 600;
444
+ }
445
+
446
+ .fd-impact-confirm__rename-title {
447
+ margin-top: var(--fd-space-sm, 0.625rem);
448
+ }
449
+
450
+ .fd-impact-confirm__follow {
451
+ margin-top: var(--fd-space-md, 0.75rem);
452
+ }
453
+
454
+ .fd-impact-confirm__error + .fd-impact-confirm__group,
455
+ .fd-impact-confirm__refused-message + .fd-impact-confirm__group,
456
+ .fd-impact-confirm__refused + .fd-impact-confirm__group {
457
+ margin-top: var(--fd-space-lg, 0.875rem);
458
+ }
459
+
460
+ .fd-impact-confirm__group + .fd-impact-confirm__group {
461
+ margin-top: var(--fd-space-lg, 0.875rem);
462
+ }
463
+
464
+ .fd-impact-confirm__group-title {
465
+ margin: 0 0 var(--fd-space-xs, 0.5rem);
466
+ padding: 0;
467
+ font-family: inherit;
468
+ font-size: var(--fd-text-sm, 0.875rem);
469
+ font-weight: 600;
470
+ letter-spacing: normal;
471
+ text-transform: none;
472
+ line-height: var(--fd-leading-tight, 1.3);
473
+ color: var(--fd-foreground);
474
+ }
475
+
476
+ .fd-impact-confirm__list {
477
+ display: grid;
478
+ margin: 0;
479
+ padding: 0;
480
+ list-style: none;
481
+ border: 1px solid var(--fd-border);
482
+ border-radius: var(--fd-radius-md, 0.375rem);
483
+ background: var(--fd-muted);
484
+ overflow: hidden;
485
+ }
486
+
487
+ .fd-impact-confirm__item {
488
+ display: flex;
489
+ align-items: baseline;
490
+ gap: var(--fd-space-sm, 0.625rem);
491
+ margin: 0;
492
+ padding: var(--fd-space-xs, 0.5rem) var(--fd-space-md, 0.75rem);
493
+ list-style: none;
494
+ }
495
+
496
+ .fd-impact-confirm__item + .fd-impact-confirm__item {
497
+ border-top: 1px solid var(--fd-border-muted);
498
+ }
499
+
500
+ .fd-impact-confirm__severity {
501
+ flex-shrink: 0;
502
+ font-size: var(--fd-text-xs, 0.8125rem);
503
+ font-weight: 600;
504
+ text-transform: none;
505
+ color: var(--fd-muted-foreground);
506
+ }
507
+
508
+ .fd-impact-confirm__text {
509
+ min-width: 0;
510
+ line-height: var(--fd-leading-normal, 1.5);
511
+ overflow-wrap: anywhere;
512
+ }
513
+
514
+ .fd-impact-confirm__label {
515
+ font-weight: 600;
516
+ color: var(--fd-foreground);
517
+ }
518
+
519
+ a.fd-impact-confirm__label {
520
+ color: var(--fd-primary);
521
+ text-decoration: underline;
522
+ }
523
+
524
+ .fd-impact-confirm__message {
525
+ color: var(--fd-muted-foreground);
526
+ }
527
+
528
+ .fd-impact-confirm__actions {
529
+ flex-shrink: 0;
530
+ display: flex;
531
+ justify-content: flex-end;
532
+ gap: var(--fd-space-sm, 0.625rem);
533
+ padding: var(--fd-space-lg, 0.875rem) var(--fd-space-xl, 1rem);
534
+ border-top: 1px solid var(--fd-border);
535
+ background: var(--fd-muted);
536
+ }
537
+
538
+ @media (max-width: 640px) {
539
+ .fd-impact-confirm {
540
+ padding: 0;
541
+ align-items: flex-end;
542
+ }
543
+
544
+ .fd-impact-confirm__dialog {
545
+ max-width: 100%;
546
+ max-height: 100vh;
547
+ border-radius: var(--fd-radius-lg, 0.5rem) var(--fd-radius-lg, 0.5rem) 0 0;
548
+ }
549
+
550
+ .fd-impact-confirm__actions {
551
+ flex-direction: column-reverse;
552
+ }
553
+ }
554
+ </style>
@@ -0,0 +1,22 @@
1
+ import type { ImpactAnswer, ImpactReport, SavedCopy } from '../types/impact.js';
2
+ interface Props {
3
+ /** What the check found. `null` when the check itself failed (see `error`). */
4
+ report: ImpactReport | null;
5
+ /** The reason the check failed; shown as one line instead of the list. */
6
+ error?: string;
7
+ /** Called exactly once with what the person decided. */
8
+ onResolve: (answer: ImpactAnswer) => void;
9
+ /**
10
+ * Saves the draft as a new workflow (the refused state's "Save as a copy").
11
+ * Rejects with the reason when it fails; the dialog then stays open.
12
+ */
13
+ onSaveAsCopy?: () => Promise<SavedCopy>;
14
+ /**
15
+ * Throws away every unsaved edit and loads the saved version (the refused
16
+ * state's "Discard my changes").
17
+ */
18
+ onDiscard?: () => Promise<void>;
19
+ }
20
+ declare const ImpactConfirm: import("svelte").Component<Props, {}, "">;
21
+ type ImpactConfirm = ReturnType<typeof ImpactConfirm>;
22
+ export default ImpactConfirm;
@@ -17,6 +17,7 @@
17
17
  <script lang="ts">
18
18
  import type { Snippet } from 'svelte';
19
19
  import type { HTMLInputAttributes } from 'svelte/elements';
20
+ import { useFormReadOnly } from './form/readOnly.js';
20
21
 
21
22
  // Omit native numeric `size` so our design-token size (matching Button) wins.
22
23
  interface Props extends Omit<HTMLInputAttributes, 'size'> {
@@ -41,6 +42,11 @@
41
42
  ...rest
42
43
  }: Props = $props();
43
44
 
45
+ const formReadOnly = useFormReadOnly();
46
+ // A read-only form (a locked editor) keeps the value readable: it can be
47
+ // focused, selected and copied, just not changed. Hence readonly, not disabled.
48
+ const isReadOnly = $derived(Boolean(rest.readonly) || formReadOnly());
49
+
44
50
  const inputClass = $derived(
45
51
  [
46
52
  'flowdrop-input',
@@ -62,7 +68,7 @@
62
68
  {@render leading()}
63
69
  </span>
64
70
  {/if}
65
- <input class={inputClass} {...rest} />
71
+ <input class={inputClass} {...rest} readonly={isReadOnly} />
66
72
  {#if trailing}
67
73
  <span class="flowdrop-input-wrap__icon flowdrop-input-wrap__icon--trailing">
68
74
  {@render trailing()}
@@ -70,5 +76,5 @@
70
76
  {/if}
71
77
  </div>
72
78
  {:else}
73
- <input class={inputClass} {...rest} />
79
+ <input class={inputClass} {...rest} readonly={isReadOnly} />
74
80
  {/if}
@@ -0,0 +1,76 @@
1
+ <!--
2
+ @component
3
+ LockBanner: the strip above the canvas that says why the workflow is read-only
4
+ and offers the actions the host chose (for example "Edit anyway").
5
+
6
+ It draws nothing while the editor is not locked. Reasons are plain text, each
7
+ with an optional "Learn more" link; the buttons report their id to the host
8
+ through `fd.lock` (`onLockAction`).
9
+
10
+ **Use it for** the one place the editor explains a lock.
11
+ **Not for** other messages; use `Notice`.
12
+ -->
13
+
14
+ <script lang="ts">
15
+ import { getInstance } from '../stores/getInstance.svelte.js';
16
+ import Notice from './primitives/Notice.svelte';
17
+ import Button from './primitives/Button.svelte';
18
+ import { m } from '../messages/index.js';
19
+ import { safeLinkUrl } from '../utils/links.js';
20
+
21
+ const fd = getInstance();
22
+ const lock = $derived(fd.lock.current);
23
+ const lockMessages = $derived(m().lock);
24
+
25
+ /** Only http(s) and site-relative links are made clickable. */
26
+ const safeUrl = safeLinkUrl;
27
+ </script>
28
+
29
+ {#if lock}
30
+ <div class="flowdrop-lock-banner" data-testid="lock-banner">
31
+ <Notice tone="info" title={lockMessages.title} role="status">
32
+ {#each lock.reasons as reason, index (index)}
33
+ <p class="flowdrop-lock-banner__reason" data-kind={reason.kind}>
34
+ {reason.message}
35
+ {#if safeUrl(reason.url)}
36
+ <a href={safeUrl(reason.url)} target="_blank" rel="noopener noreferrer"
37
+ >{lockMessages.learnMore}</a
38
+ >
39
+ {/if}
40
+ </p>
41
+ {/each}
42
+ {#snippet actions()}
43
+ {#each lock.actions as action (action.id)}
44
+ <Button
45
+ size="sm"
46
+ variant={action.primary ? 'primary' : 'secondary'}
47
+ data-testid="lock-action-{action.id}"
48
+ onclick={() => fd.lock.fire(action.id)}
49
+ >
50
+ {action.label}
51
+ </Button>
52
+ {/each}
53
+ {/snippet}
54
+ </Notice>
55
+ </div>
56
+ {/if}
57
+
58
+ <style>
59
+ .flowdrop-lock-banner {
60
+ flex: none;
61
+ padding: var(--fd-space-xs) var(--fd-space-md) 0;
62
+ }
63
+
64
+ .flowdrop-lock-banner__reason {
65
+ margin: 0;
66
+ }
67
+
68
+ .flowdrop-lock-banner__reason + .flowdrop-lock-banner__reason {
69
+ margin-top: var(--fd-space-3xs);
70
+ }
71
+
72
+ .flowdrop-lock-banner__reason a {
73
+ color: var(--fd-primary);
74
+ white-space: nowrap;
75
+ }
76
+ </style>
@@ -0,0 +1,14 @@
1
+ /**
2
+ * LockBanner: the strip above the canvas that says why the workflow is read-only
3
+ * and offers the actions the host chose (for example "Edit anyway").
4
+ *
5
+ * It draws nothing while the editor is not locked. Reasons are plain text, each
6
+ * with an optional "Learn more" link; the buttons report their id to the host
7
+ * through `fd.lock` (`onLockAction`).
8
+ *
9
+ * **Use it for** the one place the editor explains a lock.
10
+ * **Not for** other messages; use `Notice`.
11
+ */
12
+ declare const LockBanner: import("svelte").Component<Record<string, never>, {}, "">;
13
+ type LockBanner = ReturnType<typeof LockBanner>;
14
+ export default LockBanner;