@flowdrop/flowdrop 2.1.1 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.2.1] - 2026-08-18
11
+
12
+ ### Fixed
13
+
14
+ - **Authoring examples on a workflow interface input was impossible.** The entry card rendered its "More options" disclosure as a reactive attribute, so every edit inside the card — adding an example, committing one — re-ran it and forced the disclosure shut. Because the examples list lives inside that disclosure, the fields collapsed out from under the author mid-edit: focus fell to `<body>` and every keystroke after it was silently dropped. The disclosure is now state, seeded once from whether the entry needs attention and owned by the author from then on.
15
+ - **A card's open fields stayed behind when entries were reordered.** Interface entries had no identity to key on, so the entry list was keyed by position and per-row state belonged to the slot rather than to the entry. Reordering two entries left the open card behind, and removing an entry handed its open state to a neighbour. Rows now carry a client-side identity, kept out of the wire format, that moves with the entry.
16
+
17
+ ## [2.2.0] - 2026-08-18
18
+
19
+ ### Added
20
+
21
+ - **`workflowFormats` mount option.** Pass the format ids a host actually supports (e.g. `['flowdrop']`) to scope the "Workflow Format" select in Workflow Settings to that set. With one or zero options remaining the field is hidden entirely rather than rendered as a single-choice select, and an unknown id filters to nothing instead of erroring. Omit the option to keep offering every registered format.
22
+
23
+ ### Fixed
24
+
25
+ - **Applying workflow settings could rewrite a non-default format.** When the format field is absent from the settings form the applied config carries no `format` key, and the handler fell back to `DEFAULT_WORKFLOW_FORMAT` — silently rewriting a workflow's stored format on an unrelated name or description edit. It now falls back to the workflow's current format.
26
+
10
27
  ## [2.1.1] - 2026-08-18
11
28
 
12
29
  ### Fixed
@@ -163,6 +163,13 @@
163
163
  swapStrategies?: SwapStrategy[];
164
164
  /** Additional JSON Schema properties to show in the Workflow Settings panel. Values are persisted in workflow.config. */
165
165
  workflowSettingsSchema?: ConfigSchema;
166
+ /**
167
+ * Format ids this host supports (e.g. `['flowdrop']`). Filters the
168
+ * "Workflow Format" options in the Workflow Settings panel; when one or
169
+ * zero options remain the field is hidden entirely and the stored format
170
+ * is left untouched. Omit to offer every registered format.
171
+ */
172
+ workflowFormats?: string[];
166
173
  /**
167
174
  * Override user-facing strings. Pass either a partial of the `Messages`
168
175
  * tree directly, or a callback that returns one. Missing keys fall through
@@ -212,6 +219,7 @@
212
219
  showSettingsResetButton,
213
220
  swapStrategies,
214
221
  workflowSettingsSchema,
222
+ workflowFormats,
215
223
  messages: messagesOverride,
216
224
  instance
217
225
  }: Props = $props();
@@ -371,6 +379,15 @@
371
379
  // workflowSettingsSchema field, but a consumer schema could still collide.
372
380
  const WORKFLOW_SETTINGS_RESERVED = new Set(['name', 'description', 'format', 'interface']);
373
381
 
382
+ // Registered formats this host offers — the mount-level `workflowFormats`
383
+ // allowlist filters the registry (an unknown id filters to nothing rather
384
+ // than erroring; the field simply hides).
385
+ let workflowFormatOptions = $derived(
386
+ fd.formats
387
+ .getOneOfOptions()
388
+ .filter((option) => !workflowFormats || workflowFormats.includes(option.const))
389
+ );
390
+
374
391
  // Workflow configuration schema (derived to pick up dynamic format options)
375
392
  let workflowConfigSchema: ConfigSchema = $derived.by(() => {
376
393
  const extraProps = Object.fromEntries(
@@ -403,13 +420,18 @@
403
420
  format: 'multiline',
404
421
  default: ''
405
422
  },
406
- format: {
407
- type: 'string',
408
- title: 'Workflow Format',
409
- description: 'The specification format for this workflow',
410
- oneOf: fd.formats.getOneOfOptions(),
411
- default: 'flowdrop'
412
- },
423
+ // A format choice is only real when the host supports more than one
424
+ // format: with a single (or empty) filtered option set the field is
425
+ // hidden, and the stored format is preserved on apply (see onChange).
426
+ ...(workflowFormatOptions.length > 1 && {
427
+ format: {
428
+ type: 'string' as const,
429
+ title: 'Workflow Format',
430
+ description: 'The specification format for this workflow',
431
+ oneOf: workflowFormatOptions,
432
+ default: 'flowdrop'
433
+ }
434
+ }),
413
435
  ...extraProps
414
436
  },
415
437
  required: ['name', ...extraRequired]
@@ -420,7 +442,9 @@
420
442
  let workflowConfigValues = $derived({
421
443
  name: fd.workflow.name || '',
422
444
  description: fd.workflow.current?.description || '',
423
- format: fd.workflow.current?.metadata?.format || 'flowdrop',
445
+ ...(workflowFormatOptions.length > 1 && {
446
+ format: fd.workflow.current?.metadata?.format || 'flowdrop'
447
+ }),
424
448
  ...(fd.workflow.current?.config ?? {})
425
449
  });
426
450
 
@@ -1183,8 +1207,11 @@
1183
1207
  // Sync workflow settings changes immediately on field blur
1184
1208
  const wf = fd.workflow.current;
1185
1209
  if (wf) {
1186
- const newFormat = (config.format as string) || DEFAULT_WORKFLOW_FORMAT;
1187
1210
  const currentFormat = wf.metadata?.format || DEFAULT_WORKFLOW_FORMAT;
1211
+ // Fall back to the CURRENT format, not the default: when the field is
1212
+ // hidden (host supports one format) config.format is absent, and
1213
+ // applying name/description must not silently rewrite the format.
1214
+ const newFormat = (config.format as string) || currentFormat;
1188
1215
 
1189
1216
  // Warn about incompatible nodes when format changes
1190
1217
  if (newFormat !== currentFormat) {
@@ -109,6 +109,13 @@ interface Props {
109
109
  swapStrategies?: SwapStrategy[];
110
110
  /** Additional JSON Schema properties to show in the Workflow Settings panel. Values are persisted in workflow.config. */
111
111
  workflowSettingsSchema?: ConfigSchema;
112
+ /**
113
+ * Format ids this host supports (e.g. `['flowdrop']`). Filters the
114
+ * "Workflow Format" options in the Workflow Settings panel; when one or
115
+ * zero options remain the field is hidden entirely and the stored format
116
+ * is left untouched. Omit to offer every registered format.
117
+ */
118
+ workflowFormats?: string[];
112
119
  /**
113
120
  * Override user-facing strings. Pass either a partial of the `Messages`
114
121
  * tree directly, or a callback that returns one. Missing keys fall through