@flowdrop/flowdrop 2.0.0-beta.5 → 2.0.0-beta.7

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 (34) hide show
  1. package/CHANGELOG.md +39 -2
  2. package/dist/commands/executor.js +46 -20
  3. package/dist/components/App.svelte +1 -10
  4. package/dist/components/ConfigForm.svelte +98 -529
  5. package/dist/components/ConfigForm.svelte.d.ts +4 -6
  6. package/dist/components/ConfigModal.svelte +0 -1
  7. package/dist/components/form/FormField.svelte +15 -0
  8. package/dist/components/form/FormFieldLight.svelte +14 -0
  9. package/dist/components/form/FormFieldset.svelte +44 -10
  10. package/dist/components/form/FormPorts.svelte +262 -0
  11. package/dist/components/form/FormPorts.svelte.d.ts +13 -0
  12. package/dist/components/form/FormRangeField.svelte +43 -3
  13. package/dist/components/nodes/AtomNode.svelte +13 -39
  14. package/dist/components/nodes/GatewayNode.svelte +20 -56
  15. package/dist/components/nodes/SimpleNode.svelte +23 -49
  16. package/dist/components/nodes/SquareNode.svelte +23 -49
  17. package/dist/components/nodes/TerminalNode.svelte +25 -31
  18. package/dist/components/nodes/WorkflowNode.svelte +37 -84
  19. package/dist/core/index.d.ts +1 -1
  20. package/dist/openapi/v1/openapi.yaml +33 -21
  21. package/dist/schemas/v1/workflow.schema.json +16 -14
  22. package/dist/services/dynamicSchemaService.d.ts +29 -2
  23. package/dist/services/dynamicSchemaService.js +54 -25
  24. package/dist/stores/workflowStore.svelte.d.ts +1 -1
  25. package/dist/stores/workflowStore.svelte.js +7 -2
  26. package/dist/types/index.d.ts +74 -20
  27. package/dist/types/uischema.d.ts +5 -0
  28. package/dist/utils/colors.d.ts +27 -0
  29. package/dist/utils/colors.js +23 -0
  30. package/dist/utils/portUtils.d.ts +47 -11
  31. package/dist/utils/portUtils.js +67 -14
  32. package/dist/utils/schemaMerge.d.ts +25 -0
  33. package/dist/utils/schemaMerge.js +61 -0
  34. package/package.json +1 -1
@@ -24,25 +24,20 @@
24
24
  ConfigSchema,
25
25
  WorkflowNode,
26
26
  WorkflowEdge,
27
- NodeUIExtensions,
28
- NodePort,
29
- DynamicPort,
30
27
  ConfigEditOptions,
31
28
  AuthProvider
32
29
  } from '../types/index.js';
33
- import { dynamicPortToNodePort } from '../types/index.js';
34
30
  import type { UISchemaElement } from '../types/uischema.js';
35
31
  // Import the light, registry-based field factory and light fields directly
36
32
  // (not via the form barrel, which aggregates the heavy CodeMirror editors).
37
33
  import FormField from './form/FormFieldLight.svelte';
38
- import FormFieldWrapper from './form/FormFieldWrapper.svelte';
39
- import FormToggle from './form/FormToggle.svelte';
40
34
  import FormUISchemaRenderer from './form/FormUISchemaRenderer.svelte';
41
35
  import type { FieldSchema } from './form/types.js';
42
36
  import {
43
37
  getEffectiveConfigEditOptions,
44
38
  fetchDynamicSchema,
45
39
  resolveExternalEditUrl,
40
+ resolveDynamicSchemaKey,
46
41
  invalidateSchemaCache,
47
42
  type DynamicSchemaResult
48
43
  } from '../services/dynamicSchemaService.js';
@@ -50,9 +45,8 @@
50
45
  import { provideInstance } from '../stores/getInstance.svelte.js';
51
46
  import { getAvailableVariables } from '../services/variableService.js';
52
47
  import { logger } from '../utils/logger.js';
53
- import { getDataTypeColorToken, getPortBackgroundColor } from '../utils/colors.js';
54
- import { applyPortOrder } from '../utils/portUtils.js';
55
48
  import { mergeWithDefaults, cascadeClearAutocompleteDependents } from '../utils/formMerge.js';
49
+ import { applyFetchedSchema } from '../utils/schemaMerge.js';
56
50
 
57
51
  interface Props {
58
52
  /** Optional workflow node (if provided, schema and values are derived from it) */
@@ -68,8 +62,6 @@
68
62
  uiSchema?: UISchemaElement;
69
63
  /** Direct config values (used when node is not provided) */
70
64
  values?: Record<string, unknown>;
71
- /** Whether to show UI extension settings section */
72
- showUIExtensions?: boolean;
73
65
  /** Optional workflow ID for context in external links */
74
66
  workflowId?: string;
75
67
  /** Whether to also save the workflow when saving config */
@@ -87,9 +79,9 @@
87
79
  /** Auth provider for API requests (used for template variable API mode) */
88
80
  authProvider?: AuthProvider;
89
81
  /** Callback when any field value changes (fired on blur for immediate sync) */
90
- onChange?: (config: Record<string, unknown>, uiExtensions?: NodeUIExtensions) => void;
91
- /** Callback when form is saved (includes both config and extensions if enabled) */
92
- onSave?: (config: Record<string, unknown>, uiExtensions?: NodeUIExtensions) => void;
82
+ onChange?: (config: Record<string, unknown>) => void;
83
+ /** Callback when form is saved */
84
+ onSave?: (config: Record<string, unknown>) => void;
93
85
  /** Callback when form is cancelled */
94
86
  onCancel?: () => void;
95
87
  }
@@ -99,7 +91,6 @@
99
91
  schema,
100
92
  uiSchema,
101
93
  values,
102
- showUIExtensions = true,
103
94
  workflowId,
104
95
  saveWorkflowWhenSavingConfig = false,
105
96
  workflowNodes = [],
@@ -119,7 +110,6 @@
119
110
  // instance on the server (no cross-request leakage); no destroy here for the
120
111
  // same reasons as SchemaForm (shared/default in the browser, no SSR teardown).
121
112
  const fd = provideInstance();
122
- const checker = fd.portCompatibility;
123
113
 
124
114
  // Set context for child components (e.g., FormAutocomplete)
125
115
  // Use getter functions to ensure child components always get the current prop value,
@@ -132,6 +122,9 @@
132
122
  let dynamicSchemaLoading = $state(false);
133
123
  let dynamicSchemaError = $state<string | null>(null);
134
124
  let fetchedDynamicSchema = $state<ConfigSchema | null>(null);
125
+ // A uiSchema the endpoint returned alongside the schema (server-hydrated
126
+ // forms). Held next to fetchedDynamicSchema and cleared in lockstep with it.
127
+ let fetchedDynamicUiSchema = $state<UISchemaElement | null>(null);
135
128
 
136
129
  /**
137
130
  * Get the admin edit configuration for the node
@@ -166,38 +159,73 @@
166
159
  * Priority: fetchedDynamicSchema > direct schema prop > node metadata configSchema
167
160
  */
168
161
  const configSchema = $derived.by<ConfigSchema | undefined>(() => {
169
- // If we have a fetched dynamic schema, use it
162
+ const staticSchema = schema ?? (node?.data.metadata?.configSchema as ConfigSchema | undefined);
163
+ // A fetched dynamic schema is layered onto the static one per the endpoint's
164
+ // mergeStrategy/target (default 'replace' → fetched wins wholesale). With no
165
+ // static schema, the fetched schema is the form.
170
166
  if (fetchedDynamicSchema) {
171
- return fetchedDynamicSchema;
167
+ const endpoint = configEditOptions?.dynamicSchema;
168
+ return endpoint
169
+ ? applyFetchedSchema(staticSchema, fetchedDynamicSchema, endpoint)
170
+ : fetchedDynamicSchema;
172
171
  }
173
- // Otherwise use the direct prop or node metadata
174
- return schema ?? (node?.data.metadata?.configSchema as ConfigSchema | undefined);
172
+ return staticSchema;
175
173
  });
176
174
 
177
175
  /**
178
- * Get the UI schema from direct prop or node metadata
179
- * Priority: direct uiSchema prop > node metadata uiSchema
176
+ * Get the UI schema for the active configSchema.
177
+ * Priority: direct uiSchema prop > fetched dynamic uiSchema > node metadata.
178
+ *
179
+ * When the dynamic fetch returned a uiSchema, it wins over the node's static
180
+ * metadata uiSchema: the static one references only the static schema's
181
+ * properties, so it can't lay out a server-provided (hydrated) schema — its
182
+ * controls would point at fields that aren't rendered while the fetched
183
+ * fields would have no controls at all. The endpoint is expected to return a
184
+ * uiSchema describing the schema it served.
180
185
  */
181
186
  const configUISchema = $derived.by<UISchemaElement | undefined>(() => {
182
- return uiSchema ?? (node?.data.metadata?.uiSchema as UISchemaElement | undefined);
187
+ if (uiSchema) return uiSchema;
188
+ if (fetchedDynamicSchema && fetchedDynamicUiSchema) return fetchedDynamicUiSchema;
189
+ return node?.data.metadata?.uiSchema as UISchemaElement | undefined;
183
190
  });
184
191
 
185
192
  /**
186
- * Check if the node needs dynamic schema loading
187
- * Loads when: no static schema OR preferDynamicSchema is true
193
+ * Whether this node sources its schema dynamically: dynamic schema is
194
+ * configured and used, and it actually contributes to the form — either there
195
+ * is no static schema to fall back on, it is explicitly preferred, or it is
196
+ * configured to merge/target (in which case it layers onto the static schema
197
+ * rather than replacing it, so we fetch even when a static schema exists).
188
198
  */
189
- const needsDynamicSchemaLoad = $derived.by(() => {
190
- if (!node) return false;
199
+ const wantsDynamicSchema = $derived.by(() => {
200
+ if (!node || !useDynamicSchema) return false;
201
+ const endpoint = configEditOptions?.dynamicSchema;
202
+ const layersOntoStatic = endpoint?.mergeStrategy === 'merge' || endpoint?.target != null;
191
203
  const staticSchema = schema ?? node.data.metadata?.configSchema;
192
- // Need to load if: (no static schema OR preferDynamicSchema is true) AND dynamic schema is configured
193
- return (
194
- (!staticSchema || configEditOptions?.preferDynamicSchema === true) &&
195
- useDynamicSchema &&
196
- !fetchedDynamicSchema &&
197
- !dynamicSchemaLoading
198
- );
204
+ return !staticSchema || configEditOptions?.preferDynamicSchema === true || layersOntoStatic;
205
+ });
206
+
207
+ /**
208
+ * Resolved fetch key for the dynamic schema endpoint. Read from the committed
209
+ * `node.data.config` (not the in-flight `edits`/`configValues`), so it moves
210
+ * at the commit boundary: a field edit reaches it only once `handleFormBlur`
211
+ * fires `onChange` and the parent writes the value back onto the node. It
212
+ * therefore recomputes when a committed config value the endpoint's
213
+ * parameterMapping references changes (e.g. a trigger node's event_type),
214
+ * driving the auto-refetch effect below. Relies on `node` being a deep
215
+ * reactive proxy whose `.data.config` is mutated in place; a replaced node or
216
+ * a plain snapshot would not re-run this derived.
217
+ */
218
+ const dynamicSchemaKey = $derived.by<string | null>(() => {
219
+ if (!node || !configEditOptions?.dynamicSchema || !wantsDynamicSchema) return null;
220
+ return resolveDynamicSchemaKey(configEditOptions.dynamicSchema, node, workflowId);
199
221
  });
200
222
 
223
+ /**
224
+ * Key of the schema currently loaded or in flight. Guards the effect from
225
+ * re-fetching a schema whose inputs have not changed.
226
+ */
227
+ let loadedSchemaKey = $state<string | null>(null);
228
+
201
229
  /**
202
230
  * Get the current configuration from node or direct prop
203
231
  */
@@ -234,49 +262,6 @@
234
262
  */
235
263
  let isSavingWorkflow = $state(false);
236
264
 
237
- /**
238
- * Get initial UI extensions from node (instance level overrides type level)
239
- */
240
- const initialUIExtensions = $derived.by<NodeUIExtensions>(() => {
241
- if (!node) return {};
242
- // Merge type-level defaults with instance-level overrides
243
- const typeDefaults = node.data.metadata?.extensions?.ui ?? {};
244
- const instanceOverrides = node.data.extensions?.ui ?? {};
245
- return { ...typeDefaults, ...instanceOverrides };
246
- });
247
-
248
- /**
249
- * UI Extension values for display settings.
250
- * Writable derived: recomputes from the node when it changes (covering both
251
- * "different node opened" and the post-save round-trip through node.data),
252
- * while local port-management edits overwrite it wholesale via reassignment.
253
- * NOTE: the derived value is not a deep $state proxy — update it only by
254
- * reassigning the whole object, never by mutating a property.
255
- */
256
- let uiExtensionValues = $derived.by<NodeUIExtensions>(() => ({
257
- hideUnconnectedHandles: initialUIExtensions.hideUnconnectedHandles ?? false,
258
- portOrder: initialUIExtensions.portOrder
259
- ? {
260
- inputs: initialUIExtensions.portOrder.inputs
261
- ? [...initialUIExtensions.portOrder.inputs]
262
- : undefined,
263
- outputs: initialUIExtensions.portOrder.outputs
264
- ? [...initialUIExtensions.portOrder.outputs]
265
- : undefined
266
- }
267
- : undefined,
268
- hiddenPorts: initialUIExtensions.hiddenPorts
269
- ? {
270
- inputs: initialUIExtensions.hiddenPorts.inputs
271
- ? [...initialUIExtensions.hiddenPorts.inputs]
272
- : undefined,
273
- outputs: initialUIExtensions.hiddenPorts.outputs
274
- ? [...initialUIExtensions.hiddenPorts.outputs]
275
- : undefined
276
- }
277
- : undefined
278
- }));
279
-
280
265
  /**
281
266
  * Fetch dynamic schema when needed
282
267
  */
@@ -296,6 +281,7 @@
296
281
 
297
282
  if (result.success && result.schema) {
298
283
  fetchedDynamicSchema = result.schema;
284
+ fetchedDynamicUiSchema = result.uiSchema ?? null;
299
285
  } else {
300
286
  dynamicSchemaError =
301
287
  result.error ?? configEditOptions.errorMessage ?? 'Failed to load configuration schema';
@@ -317,8 +303,9 @@
317
303
  if (!node || !configEditOptions?.dynamicSchema) return;
318
304
 
319
305
  // Invalidate the cache first
320
- invalidateSchemaCache(node, configEditOptions.dynamicSchema);
306
+ invalidateSchemaCache(node, configEditOptions.dynamicSchema, workflowId);
321
307
  fetchedDynamicSchema = null;
308
+ fetchedDynamicUiSchema = null;
322
309
 
323
310
  // Reload the schema
324
311
  await loadDynamicSchema();
@@ -349,94 +336,33 @@
349
336
  }
350
337
 
351
338
  /**
352
- * Auto-load dynamic schema on mount if needed
339
+ * Load — and reload — the dynamic schema when its resolved key changes.
340
+ *
341
+ * Covers both the initial fetch (loadedSchemaKey starts null) and refetching
342
+ * after a config value the endpoint depends on changes (e.g. picking a
343
+ * different trigger event_type). A load already in flight is left to finish;
344
+ * the effect re-runs when it settles and picks up any newer key then.
345
+ *
346
+ * The `dynamicSchemaLoading` read is load-bearing in both directions: it
347
+ * guards against re-entering while a fetch is in flight, AND — because it is
348
+ * a tracked read — flipping back to false on settle is what re-runs this
349
+ * effect to pick up a newer key. Don't hoist or drop it; the settle-and-
350
+ * refetch depends on it.
351
+ *
352
+ * loadedSchemaKey is set BEFORE the fetch (not after success) on purpose: a
353
+ * failed load consumes the key so a persistent error can't loop the effect
354
+ * into a refetch storm. Recovery from an error is manual, via
355
+ * refreshDynamicSchema().
353
356
  */
354
357
  $effect(() => {
355
- if (needsDynamicSchemaLoad) {
356
- loadDynamicSchema();
358
+ const key = dynamicSchemaKey;
359
+ if (key === null || key === loadedSchemaKey || dynamicSchemaLoading) {
360
+ return;
357
361
  }
362
+ loadedSchemaKey = key;
363
+ loadDynamicSchema();
358
364
  });
359
365
 
360
- /**
361
- * All input ports in current display order for the port management UI.
362
- * Combines static metadata inputs + dynamic config inputs, sorted by portOrder.
363
- */
364
- const allInputPortsForUI = $derived.by<NodePort[]>(() => {
365
- if (!node) return [];
366
- const staticInputs = node.data.metadata.inputs ?? [];
367
- const dynInputs = ((node.data.config?.dynamicInputs as DynamicPort[]) || []).map((p) =>
368
- dynamicPortToNodePort(p, 'input')
369
- );
370
- return applyPortOrder([...staticInputs, ...dynInputs], uiExtensionValues.portOrder?.inputs);
371
- });
372
-
373
- /**
374
- * All output ports in current display order for the port management UI.
375
- * Combines static metadata outputs + dynamic config outputs, sorted by portOrder.
376
- */
377
- const allOutputPortsForUI = $derived.by<NodePort[]>(() => {
378
- if (!node) return [];
379
- const staticOutputs = node.data.metadata.outputs ?? [];
380
- const dynOutputs = ((node.data.config?.dynamicOutputs as DynamicPort[]) || []).map((p) =>
381
- dynamicPortToNodePort(p, 'output')
382
- );
383
- return applyPortOrder([...staticOutputs, ...dynOutputs], uiExtensionValues.portOrder?.outputs);
384
- });
385
-
386
- /**
387
- * Move a port one position up or down in the display order.
388
- */
389
- function movePort(direction: 'inputs' | 'outputs', portId: string, delta: -1 | 1): void {
390
- const list = direction === 'inputs' ? allInputPortsForUI : allOutputPortsForUI;
391
- const idx = list.findIndex((p) => p.id === portId);
392
- if (idx === -1) return;
393
- const newIdx = idx + delta;
394
- if (newIdx < 0 || newIdx >= list.length) return;
395
- const newOrder = list.map((p) => p.id);
396
- [newOrder[idx], newOrder[newIdx]] = [newOrder[newIdx], newOrder[idx]];
397
- uiExtensionValues = {
398
- ...uiExtensionValues,
399
- portOrder: {
400
- ...uiExtensionValues.portOrder,
401
- [direction]: newOrder
402
- }
403
- };
404
- handleFormBlur();
405
- }
406
-
407
- /**
408
- * Toggle manual visibility of a port. Required ports cannot be hidden.
409
- */
410
- function togglePortHidden(direction: 'inputs' | 'outputs', portId: string): void {
411
- const current = uiExtensionValues.hiddenPorts?.[direction] ?? [];
412
- const isHidden = current.includes(portId);
413
- const next = isHidden ? current.filter((id) => id !== portId) : [...current, portId];
414
- uiExtensionValues = {
415
- ...uiExtensionValues,
416
- hiddenPorts: {
417
- ...uiExtensionValues.hiddenPorts,
418
- [direction]: next.length > 0 ? next : undefined
419
- }
420
- };
421
- handleFormBlur();
422
- }
423
-
424
- /**
425
- * Reset all port customizations (order + hidden) for a direction back to defaults.
426
- */
427
- function resetPortCustomizations(direction: 'inputs' | 'outputs'): void {
428
- const order = { ...uiExtensionValues.portOrder };
429
- const hidden = { ...uiExtensionValues.hiddenPorts };
430
- delete order[direction];
431
- delete hidden[direction];
432
- uiExtensionValues = {
433
- ...uiExtensionValues,
434
- portOrder: Object.keys(order).length > 0 ? order : undefined,
435
- hiddenPorts: Object.keys(hidden).length > 0 ? hidden : undefined
436
- };
437
- handleFormBlur();
438
- }
439
-
440
366
  /**
441
367
  * Check if a field is required based on schema
442
368
  */
@@ -471,8 +397,11 @@
471
397
  */
472
398
  function handleFormBlur(): void {
473
399
  if (onChange) {
474
- const extensions = showUIExtensions && node ? uiExtensionValues : undefined;
475
- onChange({ ...configValues }, extensions);
400
+ // Spread `initialConfig` first so config keys the active schema doesn't
401
+ // own (e.g. after a dynamic schema narrows the field set) pass through
402
+ // untouched instead of being silently dropped; `configValues` then wins
403
+ // for every field the schema actually renders.
404
+ onChange({ ...initialConfig, ...configValues });
476
405
  // Discharge the edits buffer at the commit boundary. Subsequent prop
477
406
  // changes (parent absorbing the commit, undo/redo, collaboration) then
478
407
  // flow through `initialConfig` cleanly instead of being shadowed by a
@@ -483,13 +412,15 @@
483
412
 
484
413
  /**
485
414
  * Handle form submission
486
- * Collects both config values and UI extension values
487
- * Optionally saves the workflow if the option is enabled
415
+ * Collects config values and optionally saves the workflow.
488
416
  */
489
417
  async function handleSave(): Promise<void> {
490
- // Collect all form values including hidden fields
418
+ // Collect all form values including hidden fields. Start from
419
+ // `initialConfig` so keys the active schema doesn't own survive the save
420
+ // (see handleFormBlur); `configValues` and the DOM scrape below then take
421
+ // precedence for every field the schema renders.
491
422
  const form = document.querySelector('.config-form');
492
- const updatedConfig: Record<string, unknown> = { ...configValues };
423
+ const updatedConfig: Record<string, unknown> = { ...initialConfig, ...configValues };
493
424
 
494
425
  if (form) {
495
426
  const inputs = form.querySelectorAll('input, select, textarea');
@@ -531,13 +462,8 @@
531
462
  );
532
463
  }
533
464
 
534
- // Pass UI extensions only if enabled
535
465
  if (onSave) {
536
- if (showUIExtensions && node) {
537
- onSave(updatedConfig, uiExtensionValues);
538
- } else {
539
- onSave(updatedConfig);
540
- }
466
+ onSave(updatedConfig);
541
467
  }
542
468
 
543
469
  // Save workflow if the option is enabled
@@ -754,192 +680,6 @@
754
680
  </div>
755
681
  {/if}
756
682
 
757
- <!-- UI Extensions Section -->
758
- {#if showUIExtensions && node}
759
- <div class="config-form__extensions">
760
- <div class="config-form__extensions-header">
761
- <Icon icon="heroicons:adjustments-horizontal" class="config-form__extensions-icon" />
762
- <span>Display Settings</span>
763
- </div>
764
- <div class="config-form__extensions-content">
765
- <!-- Hide Unconnected Handles Toggle -->
766
- <FormFieldWrapper
767
- id="ext-hideUnconnectedHandles"
768
- label="Hide Unconnected Ports"
769
- description="Hide input and output ports that are not connected to reduce visual clutter"
770
- >
771
- <FormToggle
772
- id="ext-hideUnconnectedHandles"
773
- value={Boolean(uiExtensionValues.hideUnconnectedHandles)}
774
- onLabel="Hidden"
775
- offLabel="Visible"
776
- ariaDescribedBy="ext-hideUnconnectedHandles-description"
777
- onChange={(val) => {
778
- uiExtensionValues = { ...uiExtensionValues, hideUnconnectedHandles: val };
779
- handleFormBlur();
780
- }}
781
- />
782
- </FormFieldWrapper>
783
-
784
- <!-- Input Port Order & Visibility -->
785
- {#if allInputPortsForUI.length > 0}
786
- <div class="config-form__port-order">
787
- <div class="config-form__port-order-header">
788
- <span class="config-form__port-order-label">Input Ports</span>
789
- {#if uiExtensionValues.portOrder?.inputs?.length || uiExtensionValues.hiddenPorts?.inputs?.length}
790
- <button
791
- type="button"
792
- class="config-form__port-order-reset"
793
- onclick={() => resetPortCustomizations('inputs')}
794
- title="Reset to default order and visibility"
795
- >
796
- <Icon icon="heroicons:arrow-uturn-left" />
797
- Reset
798
- </button>
799
- {/if}
800
- </div>
801
- <ul class="config-form__port-order-list">
802
- {#each allInputPortsForUI as port, i (port.id)}
803
- {@const isHidden =
804
- uiExtensionValues.hiddenPorts?.inputs?.includes(port.id) ?? false}
805
- {@const isRequired = port.required ?? false}
806
- <li
807
- class="config-form__port-order-item"
808
- class:config-form__port-order-item--hidden={isHidden}
809
- >
810
- <span class="config-form__port-order-name">{port.name}</span>
811
- <span
812
- class="config-form__port-order-badge"
813
- style="background-color:{getPortBackgroundColor(
814
- checker,
815
- port.dataType,
816
- 15
817
- )};color:{getDataTypeColorToken(
818
- checker,
819
- port.dataType
820
- )};border:1px solid {getPortBackgroundColor(checker, port.dataType, 30)}"
821
- >
822
- {port.dataType}
823
- </span>
824
- <div class="config-form__port-order-actions">
825
- <button
826
- type="button"
827
- disabled={isRequired}
828
- title={isRequired
829
- ? 'Required ports cannot be hidden'
830
- : isHidden
831
- ? 'Show port'
832
- : 'Hide port'}
833
- class:active={isHidden}
834
- onclick={() => togglePortHidden('inputs', port.id)}
835
- >
836
- <Icon icon={isHidden ? 'heroicons:eye-slash' : 'heroicons:eye'} />
837
- </button>
838
- <button
839
- type="button"
840
- disabled={i === 0 || allInputPortsForUI.length === 1}
841
- onclick={() => movePort('inputs', port.id, -1)}
842
- title="Move up"
843
- >
844
- <Icon icon="heroicons:chevron-up" />
845
- </button>
846
- <button
847
- type="button"
848
- disabled={i === allInputPortsForUI.length - 1 ||
849
- allInputPortsForUI.length === 1}
850
- onclick={() => movePort('inputs', port.id, 1)}
851
- title="Move down"
852
- >
853
- <Icon icon="heroicons:chevron-down" />
854
- </button>
855
- </div>
856
- </li>
857
- {/each}
858
- </ul>
859
- </div>
860
- {/if}
861
-
862
- <!-- Output Port Order & Visibility -->
863
- {#if allOutputPortsForUI.length > 0}
864
- <div class="config-form__port-order">
865
- <div class="config-form__port-order-header">
866
- <span class="config-form__port-order-label">Output Ports</span>
867
- {#if uiExtensionValues.portOrder?.outputs?.length || uiExtensionValues.hiddenPorts?.outputs?.length}
868
- <button
869
- type="button"
870
- class="config-form__port-order-reset"
871
- onclick={() => resetPortCustomizations('outputs')}
872
- title="Reset to default order and visibility"
873
- >
874
- <Icon icon="heroicons:arrow-uturn-left" />
875
- Reset
876
- </button>
877
- {/if}
878
- </div>
879
- <ul class="config-form__port-order-list">
880
- {#each allOutputPortsForUI as port, i (port.id)}
881
- {@const isHidden =
882
- uiExtensionValues.hiddenPorts?.outputs?.includes(port.id) ?? false}
883
- {@const isRequired = port.required ?? false}
884
- <li
885
- class="config-form__port-order-item"
886
- class:config-form__port-order-item--hidden={isHidden}
887
- >
888
- <span class="config-form__port-order-name">{port.name}</span>
889
- <span
890
- class="config-form__port-order-badge"
891
- style="background-color:{getPortBackgroundColor(
892
- checker,
893
- port.dataType,
894
- 15
895
- )};color:{getDataTypeColorToken(
896
- checker,
897
- port.dataType
898
- )};border:1px solid {getPortBackgroundColor(checker, port.dataType, 30)}"
899
- >
900
- {port.dataType}
901
- </span>
902
- <div class="config-form__port-order-actions">
903
- <button
904
- type="button"
905
- disabled={isRequired}
906
- title={isRequired
907
- ? 'Required ports cannot be hidden'
908
- : isHidden
909
- ? 'Show port'
910
- : 'Hide port'}
911
- class:active={isHidden}
912
- onclick={() => togglePortHidden('outputs', port.id)}
913
- >
914
- <Icon icon={isHidden ? 'heroicons:eye-slash' : 'heroicons:eye'} />
915
- </button>
916
- <button
917
- type="button"
918
- disabled={i === 0 || allOutputPortsForUI.length === 1}
919
- onclick={() => movePort('outputs', port.id, -1)}
920
- title="Move up"
921
- >
922
- <Icon icon="heroicons:chevron-up" />
923
- </button>
924
- <button
925
- type="button"
926
- disabled={i === allOutputPortsForUI.length - 1 ||
927
- allOutputPortsForUI.length === 1}
928
- onclick={() => movePort('outputs', port.id, 1)}
929
- title="Move down"
930
- >
931
- <Icon icon="heroicons:chevron-down" />
932
- </button>
933
- </div>
934
- </li>
935
- {/each}
936
- </ul>
937
- </div>
938
- {/if}
939
- </div>
940
- </div>
941
- {/if}
942
-
943
683
  <!-- Footer Actions - Only shown when onSave is provided and onChange is not -->
944
684
  <!-- With onChange (on-blur sync), changes are saved automatically, so no Save button needed -->
945
685
  {#if onSave && !onChange}
@@ -1093,177 +833,6 @@
1093
833
  transform: translateY(0);
1094
834
  }
1095
835
 
1096
- /* ============================================
1097
- UI EXTENSIONS SECTION
1098
- ============================================ */
1099
-
1100
- .config-form__extensions {
1101
- background-color: var(--fd-muted);
1102
- border: 1px solid var(--fd-border);
1103
- border-radius: var(--fd-control-radius);
1104
- overflow: hidden;
1105
- margin-top: var(--fd-space-xs);
1106
- }
1107
-
1108
- .config-form__extensions-header {
1109
- display: flex;
1110
- align-items: center;
1111
- gap: var(--fd-space-xs);
1112
- padding: var(--fd-space-md) var(--fd-space-xl);
1113
- background-color: var(--fd-subtle);
1114
- border-bottom: 1px solid var(--fd-border);
1115
- font-size: 0.8125rem;
1116
- font-weight: 600;
1117
- color: var(--fd-foreground);
1118
- }
1119
-
1120
- .config-form__extensions-header :global(svg) {
1121
- width: 1rem;
1122
- height: 1rem;
1123
- color: var(--fd-muted-foreground);
1124
- }
1125
-
1126
- .config-form__extensions-content {
1127
- padding: var(--fd-space-xl);
1128
- display: flex;
1129
- flex-direction: column;
1130
- gap: var(--fd-space-xl);
1131
- }
1132
-
1133
- /* ============================================
1134
- PORT ORDER & VISIBILITY
1135
- ============================================ */
1136
-
1137
- .config-form__port-order {
1138
- border-top: 1px solid var(--fd-border-muted);
1139
- padding-top: var(--fd-space-md);
1140
- margin-top: calc(var(--fd-space-xl) * -0.25);
1141
- }
1142
-
1143
- .config-form__port-order-header {
1144
- display: flex;
1145
- align-items: center;
1146
- justify-content: space-between;
1147
- margin-bottom: var(--fd-space-xs);
1148
- }
1149
-
1150
- .config-form__port-order-label {
1151
- font-size: var(--fd-text-xs);
1152
- font-weight: 600;
1153
- color: var(--fd-muted-foreground);
1154
- text-transform: uppercase;
1155
- letter-spacing: 0.05em;
1156
- }
1157
-
1158
- .config-form__port-order-reset {
1159
- background: none;
1160
- border: none;
1161
- font-size: var(--fd-text-xs);
1162
- color: var(--fd-muted-foreground);
1163
- cursor: pointer;
1164
- display: inline-flex;
1165
- align-items: center;
1166
- gap: var(--fd-space-3xs);
1167
- padding: 0;
1168
- transition: color var(--fd-transition-fast);
1169
- }
1170
-
1171
- .config-form__port-order-reset:hover {
1172
- color: var(--fd-foreground);
1173
- }
1174
-
1175
- .config-form__port-order-reset :global(svg) {
1176
- width: 0.75rem;
1177
- height: 0.75rem;
1178
- }
1179
-
1180
- .config-form__port-order-list {
1181
- list-style: none;
1182
- margin: 0;
1183
- padding: 0;
1184
- display: flex;
1185
- flex-direction: column;
1186
- gap: var(--fd-space-3xs);
1187
- }
1188
-
1189
- .config-form__port-order-item {
1190
- display: flex;
1191
- align-items: center;
1192
- gap: var(--fd-space-xs);
1193
- padding: var(--fd-space-3xs) var(--fd-space-xs);
1194
- background: var(--fd-muted);
1195
- border-radius: var(--fd-radius-sm);
1196
- border: 1px solid var(--fd-border-muted);
1197
- transition: opacity var(--fd-transition-fast);
1198
- }
1199
-
1200
- .config-form__port-order-item--hidden {
1201
- opacity: 0.4;
1202
- }
1203
-
1204
- .config-form__port-order-name {
1205
- flex: 1;
1206
- font-size: var(--fd-text-xs);
1207
- font-weight: 500;
1208
- color: var(--fd-foreground);
1209
- min-width: 0;
1210
- overflow: hidden;
1211
- text-overflow: ellipsis;
1212
- white-space: nowrap;
1213
- }
1214
-
1215
- .config-form__port-order-badge {
1216
- padding: 0.125rem var(--fd-space-3xs);
1217
- border-radius: var(--fd-radius-sm);
1218
- font-size: 0.625rem;
1219
- font-weight: 500;
1220
- text-transform: uppercase;
1221
- letter-spacing: 0.04em;
1222
- flex-shrink: 0;
1223
- }
1224
-
1225
- .config-form__port-order-actions {
1226
- display: flex;
1227
- gap: var(--fd-space-3xs);
1228
- flex-shrink: 0;
1229
- }
1230
-
1231
- .config-form__port-order-actions button {
1232
- width: 1.25rem;
1233
- height: 1.25rem;
1234
- display: flex;
1235
- align-items: center;
1236
- justify-content: center;
1237
- background: var(--fd-card);
1238
- border: 1px solid var(--fd-border);
1239
- border-radius: var(--fd-radius-sm);
1240
- color: var(--fd-muted-foreground);
1241
- cursor: pointer;
1242
- padding: 0;
1243
- transition: all var(--fd-transition-fast);
1244
- }
1245
-
1246
- .config-form__port-order-actions button:hover:not(:disabled) {
1247
- background: var(--fd-backdrop);
1248
- color: var(--fd-foreground);
1249
- border-color: var(--fd-border-strong);
1250
- }
1251
-
1252
- .config-form__port-order-actions button:disabled {
1253
- opacity: 0.3;
1254
- cursor: not-allowed;
1255
- }
1256
-
1257
- .config-form__port-order-actions button.active {
1258
- color: var(--fd-foreground);
1259
- border-color: var(--fd-border-strong);
1260
- }
1261
-
1262
- .config-form__port-order-actions button :global(svg) {
1263
- width: 0.75rem;
1264
- height: 0.75rem;
1265
- }
1266
-
1267
836
  /* ============================================
1268
837
  DEBUG SECTION
1269
838
  ============================================ */