@flowdrop/flowdrop 1.15.0 → 2.0.0-beta.2
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 +508 -0
- package/MIGRATION-2.0.md +629 -0
- package/README.md +23 -23
- package/dist/adapters/WorkflowAdapter.d.ts +1 -1
- package/dist/adapters/WorkflowAdapter.js +14 -8
- package/dist/adapters/agentspec/AgentSpecAdapter.js +7 -7
- package/dist/api/enhanced-client.js +6 -11
- package/dist/chat/batchFeedback.d.ts +39 -0
- package/dist/chat/batchFeedback.js +51 -0
- package/dist/commands/executor.js +15 -1
- package/dist/commands/storeIntegration.svelte.d.ts +4 -1
- package/dist/commands/storeIntegration.svelte.js +26 -21
- package/dist/commands/types.d.ts +2 -0
- package/dist/components/App.svelte +163 -192
- package/dist/components/App.svelte.d.ts +47 -8
- package/dist/components/ConfigForm.svelte +77 -49
- package/dist/components/ConfigModal.svelte +7 -2
- package/dist/components/ConnectionLine.svelte +4 -2
- package/dist/components/Navbar.svelte +61 -1
- package/dist/components/NodeSidebar.svelte +27 -45
- package/dist/components/NodeStatusOverlay.svelte +94 -6
- package/dist/components/NodeSwapPicker.svelte +10 -8
- package/dist/components/PipelineStatus.svelte +22 -68
- package/dist/components/PipelineStatus.svelte.d.ts +3 -0
- package/dist/components/PortCoordinateTracker.svelte +5 -6
- package/dist/components/SchemaForm.stories.svelte +1 -3
- package/dist/components/SchemaForm.svelte +22 -27
- package/dist/components/SchemaForm.svelte.d.ts +0 -8
- package/dist/components/SettingsModal.svelte +8 -3
- package/dist/components/SettingsPanel.svelte +20 -4
- package/dist/components/SwapMappingEditor.svelte +67 -49
- package/dist/components/SwapMappingEditor.svelte.d.ts +0 -2
- package/dist/components/UniversalNode.svelte +9 -7
- package/dist/components/WorkflowEditor.svelte +121 -111
- package/dist/components/WorkflowEditor.svelte.d.ts +21 -10
- package/dist/components/chat/AIChatPanel.svelte +98 -89
- package/dist/components/chat/AIChatPanel.svelte.d.ts +0 -4
- package/dist/components/chat/CommandPreview.svelte +2 -1
- package/dist/components/console/CommandConsole.svelte +7 -5
- package/dist/components/console/ConsoleAutocomplete.svelte +10 -11
- package/dist/components/console/ConsoleAutocomplete.svelte.d.ts +6 -0
- package/dist/components/console/ConsoleInput.svelte +15 -6
- package/dist/components/console/ConsoleOutput.svelte +2 -1
- package/dist/components/form/FormArray.svelte +5 -9
- package/dist/components/form/FormArray.svelte.d.ts +2 -1
- package/dist/components/form/FormAutocomplete.svelte +16 -15
- package/dist/components/form/FormField.svelte +4 -2
- package/dist/components/form/FormFieldLight.svelte +34 -3
- package/dist/components/form/FormFieldLight.svelte.d.ts +12 -0
- package/dist/components/form/FormMarkdownEditor.svelte +9 -4
- package/dist/components/form/FormRangeField.svelte +1 -0
- package/dist/components/form/FormTemplateEditor.svelte +11 -3
- package/dist/components/form/FormToggle.svelte +5 -12
- package/dist/components/form/FormToggle.svelte.d.ts +4 -2
- package/dist/components/form/FormUISchemaRenderer.svelte +3 -1
- package/dist/components/form/templateAutocomplete.js +1 -5
- package/dist/components/form/types.d.ts +1 -14
- package/dist/components/interrupt/FormPrompt.svelte +3 -2
- package/dist/components/interrupt/InterruptBubble.svelte +25 -17
- package/dist/components/interrupt/ReviewPrompt.svelte +10 -3
- package/dist/components/interrupt/TextInputPrompt.svelte +2 -1
- package/dist/components/layouts/MainLayout.svelte +20 -13
- package/dist/components/layouts/MainLayout.svelte.d.ts +4 -0
- package/dist/components/nodes/AtomNode.svelte +17 -5
- package/dist/components/nodes/GatewayNode.svelte +19 -10
- package/dist/components/nodes/IdeaNode.svelte +7 -0
- package/dist/components/nodes/SimpleNode.svelte +11 -6
- package/dist/components/nodes/SquareNode.svelte +15 -8
- package/dist/components/nodes/TerminalNode.svelte +9 -4
- package/dist/components/nodes/ToolNode.svelte +7 -1
- package/dist/components/nodes/WorkflowNode.svelte +16 -7
- package/dist/components/playground/ChatInput.svelte +11 -14
- package/dist/components/playground/ChatPanel.svelte +6 -49
- package/dist/components/playground/ChatPanel.svelte.d.ts +0 -14
- package/dist/components/playground/ControlPanel.svelte +134 -123
- package/dist/components/playground/ControlPanel.svelte.d.ts +3 -0
- package/dist/components/playground/ExecutionLogs.svelte +11 -9
- package/dist/components/playground/InputCollector.svelte +11 -9
- package/dist/components/playground/MessageStream.svelte +17 -23
- package/dist/components/playground/PipelineKanbanView.svelte +69 -8
- package/dist/components/playground/PipelineKanbanView.svelte.d.ts +2 -0
- package/dist/components/playground/PipelinePanel.svelte +31 -8
- package/dist/components/playground/PipelinePanel.svelte.d.ts +2 -0
- package/dist/components/playground/PipelineTableView.svelte +188 -44
- package/dist/components/playground/PipelineTableView.svelte.d.ts +2 -0
- package/dist/components/playground/Playground.svelte +154 -105
- package/dist/components/playground/Playground.svelte.d.ts +5 -0
- package/dist/components/playground/PlaygroundApp.svelte +11 -1
- package/dist/components/playground/PlaygroundApp.svelte.d.ts +6 -0
- package/dist/components/playground/PlaygroundModal.svelte +18 -3
- package/dist/components/playground/PlaygroundModal.svelte.d.ts +6 -0
- package/dist/components/playground/PlaygroundStudio.svelte +40 -32
- package/dist/components/playground/PlaygroundStudio.svelte.d.ts +6 -0
- package/dist/components/playground/SessionManager.svelte +9 -12
- package/dist/components/playground/pipelineViewUtils.svelte.d.ts +30 -1
- package/dist/components/playground/pipelineViewUtils.svelte.js +40 -3
- package/dist/config/endpoints.d.ts +23 -7
- package/dist/config/endpoints.js +30 -10
- package/dist/core/index.d.ts +5 -6
- package/dist/core/index.js +8 -12
- package/dist/display/index.d.ts +6 -3
- package/dist/display/index.js +7 -5
- package/dist/editor/index.d.ts +20 -21
- package/dist/editor/index.js +26 -36
- package/dist/form/code.d.ts +25 -15
- package/dist/form/code.js +44 -41
- package/dist/form/fieldRegistry.d.ts +17 -13
- package/dist/form/fieldRegistry.js +32 -12
- package/dist/form/full.d.ts +19 -14
- package/dist/form/full.js +26 -28
- package/dist/form/index.d.ts +3 -4
- package/dist/form/index.js +6 -5
- package/dist/form/markdown.d.ts +13 -8
- package/dist/form/markdown.js +22 -23
- package/dist/helpers/proximityConnect.d.ts +3 -2
- package/dist/helpers/proximityConnect.js +2 -5
- package/dist/helpers/workflowEditorHelper.d.ts +14 -5
- package/dist/helpers/workflowEditorHelper.js +28 -25
- package/dist/index.d.ts +28 -24
- package/dist/index.js +27 -50
- package/dist/messages/defaults.d.ts +2 -5
- package/dist/messages/defaults.js +3 -6
- package/dist/messages/index.d.ts +0 -1
- package/dist/messages/index.js +0 -1
- package/dist/mocks/app-forms.d.ts +6 -2
- package/dist/mocks/app-forms.js +11 -4
- package/dist/openapi/v1/openapi.yaml +3 -3
- package/dist/playground/index.d.ts +4 -5
- package/dist/playground/index.js +4 -32
- package/dist/playground/mount.d.ts +25 -0
- package/dist/playground/mount.js +50 -20
- package/dist/registry/{BaseRegistry.d.ts → BaseRegistry.svelte.d.ts} +22 -1
- package/dist/registry/{BaseRegistry.js → BaseRegistry.svelte.js} +37 -1
- package/dist/registry/builtinFormats.d.ts +9 -18
- package/dist/registry/builtinFormats.js +9 -39
- package/dist/registry/builtinNodeTypes.d.ts +53 -0
- package/dist/registry/builtinNodeTypes.js +67 -0
- package/dist/registry/builtinNodes.d.ts +2 -64
- package/dist/registry/builtinNodes.js +7 -103
- package/dist/registry/index.d.ts +3 -4
- package/dist/registry/index.js +4 -6
- package/dist/registry/nodeComponentRegistry.d.ts +182 -15
- package/dist/registry/nodeComponentRegistry.js +235 -17
- package/dist/registry/workflowFormatRegistry.d.ts +14 -9
- package/dist/registry/workflowFormatRegistry.js +24 -8
- package/dist/{schema → schemas}/index.d.ts +2 -2
- package/dist/{schema → schemas}/index.js +2 -2
- package/dist/schemas/v1/workflow.schema.json +3 -3
- package/dist/services/agentSpecExecutionService.d.ts +0 -2
- package/dist/services/agentSpecExecutionService.js +0 -3
- package/dist/services/apiVariableService.d.ts +2 -1
- package/dist/services/apiVariableService.js +16 -47
- package/dist/services/autoSaveService.d.ts +7 -0
- package/dist/services/autoSaveService.js +6 -4
- package/dist/services/categoriesApi.js +3 -6
- package/dist/services/chatService.d.ts +9 -4
- package/dist/services/chatService.js +23 -28
- package/dist/services/draftStorage.d.ts +129 -13
- package/dist/services/draftStorage.js +185 -37
- package/dist/services/dynamicSchemaService.d.ts +2 -1
- package/dist/services/dynamicSchemaService.js +5 -22
- package/dist/services/globalSave.d.ts +13 -12
- package/dist/services/globalSave.js +29 -51
- package/dist/services/historyService.d.ts +9 -3
- package/dist/services/historyService.js +9 -3
- package/dist/services/interruptService.d.ts +15 -9
- package/dist/services/interruptService.js +35 -37
- package/dist/services/nodeExecutionService.d.ts +18 -3
- package/dist/services/nodeExecutionService.js +71 -45
- package/dist/services/playgroundService.d.ts +16 -10
- package/dist/services/playgroundService.js +42 -43
- package/dist/services/portConfigApi.js +3 -6
- package/dist/services/settingsService.d.ts +9 -4
- package/dist/services/settingsService.js +23 -12
- package/dist/services/variableService.d.ts +2 -1
- package/dist/services/variableService.js +2 -2
- package/dist/services/workflowStorage.js +6 -6
- package/dist/stores/apiContext.d.ts +56 -0
- package/dist/stores/apiContext.js +80 -0
- package/dist/stores/categoriesStore.svelte.d.ts +28 -23
- package/dist/stores/categoriesStore.svelte.js +69 -64
- package/dist/stores/getInstance.svelte.d.ts +39 -0
- package/dist/stores/getInstance.svelte.js +65 -0
- package/dist/stores/historyStore.svelte.d.ts +77 -93
- package/dist/stores/historyStore.svelte.js +134 -160
- package/dist/stores/instanceContainer.svelte.d.ts +111 -0
- package/dist/stores/instanceContainer.svelte.js +114 -0
- package/dist/stores/interruptStore.svelte.d.ts +112 -82
- package/dist/stores/interruptStore.svelte.js +253 -226
- package/dist/stores/pipelinePanelStore.svelte.d.ts +27 -3
- package/dist/stores/pipelinePanelStore.svelte.js +61 -14
- package/dist/stores/playgroundStore.svelte.d.ts +169 -222
- package/dist/stores/playgroundStore.svelte.js +513 -580
- package/dist/stores/portCoordinateStore.svelte.d.ts +57 -51
- package/dist/stores/portCoordinateStore.svelte.js +109 -98
- package/dist/stores/settingsStore.svelte.d.ts +4 -1
- package/dist/stores/settingsStore.svelte.js +47 -12
- package/dist/stores/workflowStore.svelte.d.ts +178 -213
- package/dist/stores/workflowStore.svelte.js +449 -501
- package/dist/stories/EdgeDecorator.svelte +5 -2
- package/dist/stories/NodeDecorator.svelte +5 -3
- package/dist/svelte-app.d.ts +60 -10
- package/dist/svelte-app.js +159 -54
- package/dist/types/auth.d.ts +9 -51
- package/dist/types/auth.js +4 -54
- package/dist/types/events.d.ts +6 -3
- package/dist/types/index.d.ts +37 -5
- package/dist/types/index.js +0 -1
- package/dist/types/navbar.d.ts +7 -0
- package/dist/types/playground.d.ts +18 -3
- package/dist/types/settings.d.ts +13 -0
- package/dist/types/settings.js +1 -0
- package/dist/utils/colors.d.ts +47 -21
- package/dist/utils/colors.js +69 -68
- package/dist/utils/connections.d.ts +9 -15
- package/dist/utils/connections.js +13 -32
- package/dist/utils/duration.d.ts +13 -0
- package/dist/utils/duration.js +45 -0
- package/dist/utils/edgeStyling.js +9 -5
- package/dist/utils/fetchWithAuth.d.ts +36 -15
- package/dist/utils/fetchWithAuth.js +53 -23
- package/dist/utils/icons.d.ts +5 -2
- package/dist/utils/icons.js +6 -5
- package/dist/utils/nodeSwap.d.ts +6 -2
- package/dist/utils/nodeSwap.js +62 -126
- package/dist/utils/nodeTypes.d.ts +17 -8
- package/dist/utils/nodeTypes.js +27 -20
- package/dist/utils/performanceUtils.js +7 -0
- package/package.json +7 -5
- package/dist/messages/deprecation.d.ts +0 -20
- package/dist/messages/deprecation.js +0 -33
- package/dist/registry/plugin.d.ts +0 -215
- package/dist/registry/plugin.js +0 -249
- package/dist/services/api.d.ts +0 -129
- package/dist/services/api.js +0 -217
|
@@ -18,34 +18,55 @@
|
|
|
18
18
|
*
|
|
19
19
|
* @example Adding code editor support:
|
|
20
20
|
* ```typescript
|
|
21
|
-
* import {
|
|
22
|
-
* import { FormCodeEditor, codeEditorFieldMatcher } from "@flowdrop/flowdrop/form/code";
|
|
21
|
+
* import { registerCodeEditorField } from "@flowdrop/flowdrop/form/code";
|
|
23
22
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* matcher: codeEditorFieldMatcher,
|
|
27
|
-
* priority: 100
|
|
28
|
-
* });
|
|
23
|
+
* // Registers the code editor into this instance's field registry.
|
|
24
|
+
* registerCodeEditorField(fd.fields);
|
|
29
25
|
* ```
|
|
30
26
|
*/
|
|
31
|
-
import {
|
|
27
|
+
import { DEV } from 'esm-env';
|
|
28
|
+
import { BaseRegistry } from '../registry/BaseRegistry.svelte.js';
|
|
32
29
|
/**
|
|
33
30
|
* Class-based field component registry.
|
|
34
31
|
* Extends BaseRegistry with priority-based field resolution.
|
|
35
32
|
*/
|
|
36
|
-
class FieldComponentRegistry extends BaseRegistry {
|
|
33
|
+
export class FieldComponentRegistry extends BaseRegistry {
|
|
37
34
|
/** Cached ordered keys by priority (highest first), invalidated on mutation */
|
|
38
35
|
orderedKeys = null;
|
|
36
|
+
/**
|
|
37
|
+
* @param seed - Optional initial field registrations keyed by type. The
|
|
38
|
+
* registry starts empty by default — the built-in light fields are
|
|
39
|
+
* resolved inline by FormField/FormFieldLight, and heavy editors are
|
|
40
|
+
* registered on demand via `form/code`, `form/markdown`, etc.
|
|
41
|
+
*/
|
|
42
|
+
constructor(seed) {
|
|
43
|
+
super();
|
|
44
|
+
if (seed) {
|
|
45
|
+
for (const [type, registration] of Object.entries(seed)) {
|
|
46
|
+
this.register(type, registration);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
39
50
|
/**
|
|
40
51
|
* Register a field component.
|
|
41
|
-
*
|
|
52
|
+
*
|
|
53
|
+
* Re-registering an existing type overwrites it — useful for hosts
|
|
54
|
+
* replacing a built-in field — but warns in dev, since an *accidental*
|
|
55
|
+
* duplicate registration silently swallowing a field implementation is a
|
|
56
|
+
* miserable bug to track down.
|
|
42
57
|
*
|
|
43
58
|
* @param type - Unique identifier for this field type
|
|
44
59
|
* @param registration - The field component registration
|
|
45
60
|
*/
|
|
46
61
|
register(type, registration) {
|
|
62
|
+
if (DEV && this.items.has(type)) {
|
|
63
|
+
// eslint-disable-next-line no-console -- intentional dev diagnostic for accidental duplicate registrations
|
|
64
|
+
console.warn(`[flowdrop] Field type "${type}" is already registered — overwriting. ` +
|
|
65
|
+
'If this is intentional (replacing a built-in field), ignore this warning.');
|
|
66
|
+
}
|
|
47
67
|
this.items.set(type, registration);
|
|
48
68
|
this.orderedKeys = null;
|
|
69
|
+
this.touch();
|
|
49
70
|
this.notifyListeners();
|
|
50
71
|
}
|
|
51
72
|
/**
|
|
@@ -73,6 +94,7 @@ class FieldComponentRegistry extends BaseRegistry {
|
|
|
73
94
|
* @returns The matching registration or null if no match
|
|
74
95
|
*/
|
|
75
96
|
resolveFieldComponent(schema) {
|
|
97
|
+
this.trackVersion(); // reactive dependency — cached orderedKeys path still tracks mutations
|
|
76
98
|
const keys = this.getOrderedKeys();
|
|
77
99
|
for (const key of keys) {
|
|
78
100
|
const registration = this.items.get(key);
|
|
@@ -94,8 +116,6 @@ class FieldComponentRegistry extends BaseRegistry {
|
|
|
94
116
|
return this.orderedKeys;
|
|
95
117
|
}
|
|
96
118
|
}
|
|
97
|
-
/** Singleton instance of the field component registry */
|
|
98
|
-
export const fieldComponentRegistry = new FieldComponentRegistry();
|
|
99
119
|
// ============================================================================
|
|
100
120
|
// Built-in Field Matchers (for light fields)
|
|
101
121
|
// These are always available and used by the base FormField component
|
package/dist/form/full.d.ts
CHANGED
|
@@ -14,16 +14,18 @@
|
|
|
14
14
|
* // Single import that sets up everything
|
|
15
15
|
* import { SchemaForm, initializeAllFieldTypes } from "@flowdrop/flowdrop/form/full";
|
|
16
16
|
*
|
|
17
|
-
* // Call once at app startup
|
|
18
|
-
* initializeAllFieldTypes();
|
|
17
|
+
* // Call once at app startup, against an instance's field registry
|
|
18
|
+
* initializeAllFieldTypes(fd.fields);
|
|
19
19
|
*
|
|
20
20
|
* // Now all field types are available
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
|
-
export {
|
|
23
|
+
export { default as FormFieldFull } from '../components/form/FormField.svelte';
|
|
24
|
+
export { SchemaForm, FormField, FormFieldWrapper, FormTextField, FormTextarea, FormNumberField, FormRangeField, FormToggle, FormSelect, FormCheckboxGroup, FormArray, FormFieldset, FormUISchemaRenderer } from './index.js';
|
|
24
25
|
export type { FieldSchema, FieldType, FieldFormat, FieldOption, OneOfItem, SchemaFormProps, BaseFieldProps, TextFieldProps, TextareaFieldProps, NumberFieldProps, ToggleFieldProps, RangeFieldProps, SelectFieldProps, CheckboxGroupFieldProps, ArrayFieldProps, FormFieldFactoryProps, FormFieldWrapperProps, FieldComponentProps, FieldMatcher, FieldMatcherRegistration, FieldComponent, FieldComponentRegistration } from './index.js';
|
|
25
26
|
export { isFieldOptionArray, isOneOfArray, normalizeOptions, oneOfToOptions, getSchemaOptions } from './index.js';
|
|
26
|
-
export {
|
|
27
|
+
export { FieldComponentRegistry, hiddenFieldMatcher, checkboxGroupMatcher, enumSelectMatcher, textareaMatcher, rangeMatcher, textFieldMatcher, numberFieldMatcher, toggleMatcher, selectOptionsMatcher, arrayMatcher } from './index.js';
|
|
28
|
+
import type { FieldComponentRegistry } from './fieldRegistry.js';
|
|
27
29
|
export { FormCodeEditor, FormTemplateEditor } from './code.js';
|
|
28
30
|
export { FormMarkdownEditor } from './markdown.js';
|
|
29
31
|
export { registerCodeEditorField, registerTemplateEditorField, registerAllCodeEditors, isCodeEditorRegistered, isTemplateEditorRegistered, codeEditorFieldMatcher, templateEditorFieldMatcher } from './code.js';
|
|
@@ -31,26 +33,29 @@ export { registerMarkdownEditorField, isMarkdownEditorRegistered, markdownEditor
|
|
|
31
33
|
/**
|
|
32
34
|
* Initialize all form field types including heavy editors
|
|
33
35
|
*
|
|
34
|
-
* Call this once at application startup to enable all field types
|
|
35
|
-
* This includes:
|
|
36
|
+
* Call this once at application startup to enable all field types in the
|
|
37
|
+
* given instance's field registry. This includes:
|
|
36
38
|
* - Code/JSON editor (CodeMirror)
|
|
37
39
|
* - Template editor (CodeMirror with Twig/Liquid syntax)
|
|
38
40
|
* - Markdown editor (CodeMirror 6)
|
|
39
41
|
*
|
|
42
|
+
* Registration is idempotent per registry — each `register*Field` is a no-op
|
|
43
|
+
* if its field type is already present (see `FieldComponentRegistry.has`).
|
|
44
|
+
*
|
|
45
|
+
* @param registry - The instance's field registry (e.g. `fd.fields`)
|
|
46
|
+
*
|
|
40
47
|
* @example
|
|
41
48
|
* ```typescript
|
|
42
49
|
* import { initializeAllFieldTypes } from "@flowdrop/flowdrop/form/full";
|
|
43
50
|
*
|
|
44
51
|
* // In your app's entry point
|
|
45
|
-
* initializeAllFieldTypes();
|
|
52
|
+
* initializeAllFieldTypes(fd.fields);
|
|
46
53
|
* ```
|
|
47
54
|
*/
|
|
48
|
-
export declare function initializeAllFieldTypes(): void;
|
|
55
|
+
export declare function initializeAllFieldTypes(registry: FieldComponentRegistry): void;
|
|
49
56
|
/**
|
|
50
|
-
* Check if all field types
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Reset initialization state (useful for testing)
|
|
57
|
+
* Check if all heavy field types are registered in the given registry.
|
|
58
|
+
*
|
|
59
|
+
* @param registry - The instance's field registry (e.g. `fd.fields`)
|
|
55
60
|
*/
|
|
56
|
-
export declare function
|
|
61
|
+
export declare function areAllFieldTypesInitialized(registry: FieldComponentRegistry): boolean;
|
package/dist/form/full.js
CHANGED
|
@@ -14,19 +14,22 @@
|
|
|
14
14
|
* // Single import that sets up everything
|
|
15
15
|
* import { SchemaForm, initializeAllFieldTypes } from "@flowdrop/flowdrop/form/full";
|
|
16
16
|
*
|
|
17
|
-
* // Call once at app startup
|
|
18
|
-
* initializeAllFieldTypes();
|
|
17
|
+
* // Call once at app startup, against an instance's field registry
|
|
18
|
+
* initializeAllFieldTypes(fd.fields);
|
|
19
19
|
*
|
|
20
20
|
* // Now all field types are available
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
23
|
// Re-export everything from the light form module
|
|
24
|
+
// The "everything statically bundled" FormField variant lives here (this is the
|
|
25
|
+
// heavy entry), not in the light `@flowdrop/flowdrop/form`.
|
|
26
|
+
export { default as FormFieldFull } from '../components/form/FormField.svelte';
|
|
24
27
|
// Components
|
|
25
|
-
export { SchemaForm, FormField,
|
|
28
|
+
export { SchemaForm, FormField, FormFieldWrapper, FormTextField, FormTextarea, FormNumberField, FormRangeField, FormToggle, FormSelect, FormCheckboxGroup, FormArray, FormFieldset, FormUISchemaRenderer } from './index.js';
|
|
26
29
|
// Utility functions
|
|
27
30
|
export { isFieldOptionArray, isOneOfArray, normalizeOptions, oneOfToOptions, getSchemaOptions } from './index.js';
|
|
28
31
|
// Field Registry
|
|
29
|
-
export {
|
|
32
|
+
export { FieldComponentRegistry, hiddenFieldMatcher, checkboxGroupMatcher, enumSelectMatcher, textareaMatcher, rangeMatcher, textFieldMatcher, numberFieldMatcher, toggleMatcher, selectOptionsMatcher, arrayMatcher } from './index.js';
|
|
30
33
|
// Import registration functions
|
|
31
34
|
import { registerCodeEditorField, registerTemplateEditorField } from './code.js';
|
|
32
35
|
import { registerMarkdownEditorField } from './markdown.js';
|
|
@@ -36,45 +39,40 @@ export { FormMarkdownEditor } from './markdown.js';
|
|
|
36
39
|
// Re-export registration functions
|
|
37
40
|
export { registerCodeEditorField, registerTemplateEditorField, registerAllCodeEditors, isCodeEditorRegistered, isTemplateEditorRegistered, codeEditorFieldMatcher, templateEditorFieldMatcher } from './code.js';
|
|
38
41
|
export { registerMarkdownEditorField, isMarkdownEditorRegistered, markdownEditorFieldMatcher } from './markdown.js';
|
|
39
|
-
/**
|
|
40
|
-
* Track if all field types have been initialized
|
|
41
|
-
*/
|
|
42
|
-
let allFieldTypesInitialized = false;
|
|
43
42
|
/**
|
|
44
43
|
* Initialize all form field types including heavy editors
|
|
45
44
|
*
|
|
46
|
-
* Call this once at application startup to enable all field types
|
|
47
|
-
* This includes:
|
|
45
|
+
* Call this once at application startup to enable all field types in the
|
|
46
|
+
* given instance's field registry. This includes:
|
|
48
47
|
* - Code/JSON editor (CodeMirror)
|
|
49
48
|
* - Template editor (CodeMirror with Twig/Liquid syntax)
|
|
50
49
|
* - Markdown editor (CodeMirror 6)
|
|
51
50
|
*
|
|
51
|
+
* Registration is idempotent per registry — each `register*Field` is a no-op
|
|
52
|
+
* if its field type is already present (see `FieldComponentRegistry.has`).
|
|
53
|
+
*
|
|
54
|
+
* @param registry - The instance's field registry (e.g. `fd.fields`)
|
|
55
|
+
*
|
|
52
56
|
* @example
|
|
53
57
|
* ```typescript
|
|
54
58
|
* import { initializeAllFieldTypes } from "@flowdrop/flowdrop/form/full";
|
|
55
59
|
*
|
|
56
60
|
* // In your app's entry point
|
|
57
|
-
* initializeAllFieldTypes();
|
|
61
|
+
* initializeAllFieldTypes(fd.fields);
|
|
58
62
|
* ```
|
|
59
63
|
*/
|
|
60
|
-
export function initializeAllFieldTypes() {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
registerCodeEditorField();
|
|
65
|
-
registerTemplateEditorField();
|
|
66
|
-
registerMarkdownEditorField();
|
|
67
|
-
allFieldTypesInitialized = true;
|
|
64
|
+
export function initializeAllFieldTypes(registry) {
|
|
65
|
+
registerCodeEditorField(registry);
|
|
66
|
+
registerTemplateEditorField(registry);
|
|
67
|
+
registerMarkdownEditorField(registry);
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
70
|
-
* Check if all field types
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return allFieldTypesInitialized;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Reset initialization state (useful for testing)
|
|
70
|
+
* Check if all heavy field types are registered in the given registry.
|
|
71
|
+
*
|
|
72
|
+
* @param registry - The instance's field registry (e.g. `fd.fields`)
|
|
77
73
|
*/
|
|
78
|
-
export function
|
|
79
|
-
|
|
74
|
+
export function areAllFieldTypesInitialized(registry) {
|
|
75
|
+
return (registry.has('code-editor') &&
|
|
76
|
+
registry.has('template-editor') &&
|
|
77
|
+
registry.has('markdown-editor'));
|
|
80
78
|
}
|
package/dist/form/index.d.ts
CHANGED
|
@@ -59,7 +59,6 @@
|
|
|
59
59
|
*/
|
|
60
60
|
export { default as SchemaForm } from '../components/SchemaForm.svelte';
|
|
61
61
|
export { default as FormField } from '../components/form/FormFieldLight.svelte';
|
|
62
|
-
export { default as FormFieldFull } from '../components/form/FormField.svelte';
|
|
63
62
|
export { default as FormFieldWrapper } from '../components/form/FormFieldWrapper.svelte';
|
|
64
63
|
export { default as FormTextField } from '../components/form/FormTextField.svelte';
|
|
65
64
|
export { default as FormTextarea } from '../components/form/FormTextarea.svelte';
|
|
@@ -71,13 +70,13 @@ export { default as FormCheckboxGroup } from '../components/form/FormCheckboxGro
|
|
|
71
70
|
export { default as FormArray } from '../components/form/FormArray.svelte';
|
|
72
71
|
export { default as FormFieldset } from '../components/form/FormFieldset.svelte';
|
|
73
72
|
export { default as FormUISchemaRenderer } from '../components/form/FormUISchemaRenderer.svelte';
|
|
74
|
-
export type { FieldSchema, FieldType, FieldFormat, FieldOption, OneOfItem, SchemaFormProps, BaseFieldProps, TextFieldProps, TextareaFieldProps, NumberFieldProps, ToggleFieldProps, RangeFieldProps, SelectFieldProps, CheckboxGroupFieldProps, ArrayFieldProps, FormFieldFactoryProps, FormFieldWrapperProps } from '../components/form/types.js';
|
|
73
|
+
export type { FieldSchema, FieldType, FieldFormat, FieldOption, OneOfItem, SchemaFormProps, BaseFieldProps, TextFieldProps, TextareaFieldProps, NumberFieldProps, ToggleFieldProps, RangeFieldProps, SelectFieldProps, CheckboxGroupFieldProps, ArrayFieldProps, FormFieldFactoryProps, FormFieldWrapperProps, AutocompleteConfig } from '../components/form/types.js';
|
|
75
74
|
export { isFieldOptionArray, isOneOfArray, normalizeOptions, oneOfToOptions, getSchemaOptions } from '../components/form/types.js';
|
|
76
|
-
export {
|
|
75
|
+
export { FieldComponentRegistry, hiddenFieldMatcher, checkboxGroupMatcher, enumSelectMatcher, textareaMatcher, rangeMatcher, textFieldMatcher, numberFieldMatcher, toggleMatcher, selectOptionsMatcher, arrayMatcher } from './fieldRegistry.js';
|
|
77
76
|
export type { FieldComponentProps, FieldMatcher, FieldMatcherRegistration, FieldComponent, FieldComponentRegistration } from './fieldRegistry.js';
|
|
78
77
|
/**
|
|
79
78
|
* Use with Svelte's `getContext` inside custom field components registered
|
|
80
|
-
* via `
|
|
79
|
+
* via `fd.fields` to read sibling form field values.
|
|
81
80
|
*
|
|
82
81
|
* @example
|
|
83
82
|
* ```svelte
|
package/dist/form/index.js
CHANGED
|
@@ -66,8 +66,9 @@ export { default as SchemaForm } from '../components/SchemaForm.svelte';
|
|
|
66
66
|
// ============================================================================
|
|
67
67
|
// Use the light version of FormField that uses the registry for heavy editors
|
|
68
68
|
export { default as FormField } from '../components/form/FormFieldLight.svelte';
|
|
69
|
-
//
|
|
70
|
-
|
|
69
|
+
// NOTE: `FormFieldFull` — the variant that *statically* bundles every editor
|
|
70
|
+
// (including CodeMirror) — is intentionally NOT exported here; it would pull
|
|
71
|
+
// CodeMirror into this light entry. Import it from `@flowdrop/flowdrop/form/full`.
|
|
71
72
|
export { default as FormFieldWrapper } from '../components/form/FormFieldWrapper.svelte';
|
|
72
73
|
export { default as FormTextField } from '../components/form/FormTextField.svelte';
|
|
73
74
|
export { default as FormTextarea } from '../components/form/FormTextarea.svelte';
|
|
@@ -85,8 +86,8 @@ export { isFieldOptionArray, isOneOfArray, normalizeOptions, oneOfToOptions, get
|
|
|
85
86
|
// Field Registry (for dynamic field registration)
|
|
86
87
|
// ============================================================================
|
|
87
88
|
export {
|
|
88
|
-
// Registry
|
|
89
|
-
|
|
89
|
+
// Registry class (instances live on `fd.fields`)
|
|
90
|
+
FieldComponentRegistry,
|
|
90
91
|
// Built-in matchers for custom components
|
|
91
92
|
hiddenFieldMatcher, checkboxGroupMatcher, enumSelectMatcher, textareaMatcher, rangeMatcher, textFieldMatcher, numberFieldMatcher, toggleMatcher, selectOptionsMatcher, arrayMatcher } from './fieldRegistry.js';
|
|
92
93
|
// ============================================================================
|
|
@@ -94,7 +95,7 @@ hiddenFieldMatcher, checkboxGroupMatcher, enumSelectMatcher, textareaMatcher, ra
|
|
|
94
95
|
// ============================================================================
|
|
95
96
|
/**
|
|
96
97
|
* Use with Svelte's `getContext` inside custom field components registered
|
|
97
|
-
* via `
|
|
98
|
+
* via `fd.fields` to read sibling form field values.
|
|
98
99
|
*
|
|
99
100
|
* @example
|
|
100
101
|
* ```svelte
|
package/dist/form/markdown.d.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* import { registerMarkdownEditorField } from "@flowdrop/flowdrop/form/markdown";
|
|
13
13
|
*
|
|
14
14
|
* // Register markdown editor support (call once at app startup)
|
|
15
|
-
* registerMarkdownEditorField();
|
|
15
|
+
* registerMarkdownEditorField(fd.fields);
|
|
16
16
|
*
|
|
17
17
|
* // Now SchemaForm will render markdown editors for format: "markdown"
|
|
18
18
|
* const schema = {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* };
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
|
-
import type { FieldComponent } from './fieldRegistry.js';
|
|
26
|
+
import type { FieldComponent, FieldComponentRegistry } from './fieldRegistry.js';
|
|
27
27
|
import type { FieldSchema } from '../components/form/types.js';
|
|
28
28
|
export { default as FormMarkdownEditor } from '../components/form/FormMarkdownEditor.svelte';
|
|
29
29
|
export type { MarkdownEditorFieldProps } from '../components/form/types.js';
|
|
@@ -38,6 +38,7 @@ export declare function markdownEditorFieldMatcher(schema: FieldSchema): boolean
|
|
|
38
38
|
* Call this function once at application startup to enable
|
|
39
39
|
* markdown editor fields in SchemaForm.
|
|
40
40
|
*
|
|
41
|
+
* @param registry - The instance's field registry (e.g. `fd.fields`)
|
|
41
42
|
* @param priority - Priority for field matching (default: 100)
|
|
42
43
|
*
|
|
43
44
|
* @example
|
|
@@ -45,25 +46,29 @@ export declare function markdownEditorFieldMatcher(schema: FieldSchema): boolean
|
|
|
45
46
|
* // In your app's entry point:
|
|
46
47
|
* import { registerMarkdownEditorField } from "@flowdrop/flowdrop/form/markdown";
|
|
47
48
|
*
|
|
48
|
-
* registerMarkdownEditorField();
|
|
49
|
+
* registerMarkdownEditorField(fd.fields);
|
|
49
50
|
* ```
|
|
50
51
|
*/
|
|
51
|
-
export declare function registerMarkdownEditorField(priority?: number): void;
|
|
52
|
+
export declare function registerMarkdownEditorField(registry: FieldComponentRegistry, priority?: number): void;
|
|
52
53
|
/**
|
|
53
54
|
* Synchronously register markdown editor field using the imported component
|
|
54
55
|
*
|
|
55
56
|
* Use this when you've already imported the component and want immediate registration.
|
|
56
57
|
*
|
|
58
|
+
* @param registry - The instance's field registry (e.g. `fd.fields`)
|
|
59
|
+
* @param component - The pre-imported markdown editor component
|
|
57
60
|
* @param priority - Priority for field matching (default: 100)
|
|
58
61
|
*
|
|
59
62
|
* @example
|
|
60
63
|
* ```typescript
|
|
61
64
|
* import { registerMarkdownEditorFieldWithComponent, FormMarkdownEditor } from "@flowdrop/flowdrop/form/markdown";
|
|
62
|
-
* registerMarkdownEditorFieldWithComponent(FormMarkdownEditor);
|
|
65
|
+
* registerMarkdownEditorFieldWithComponent(fd.fields, FormMarkdownEditor);
|
|
63
66
|
* ```
|
|
64
67
|
*/
|
|
65
|
-
export declare function registerMarkdownEditorFieldWithComponent(component: FieldComponent, priority?: number): void;
|
|
68
|
+
export declare function registerMarkdownEditorFieldWithComponent(registry: FieldComponentRegistry, component: FieldComponent, priority?: number): void;
|
|
66
69
|
/**
|
|
67
|
-
* Check if markdown editor field is registered
|
|
70
|
+
* Check if markdown editor field is registered in the given registry.
|
|
71
|
+
*
|
|
72
|
+
* @param registry - The instance's field registry (e.g. `fd.fields`)
|
|
68
73
|
*/
|
|
69
|
-
export declare function isMarkdownEditorRegistered(): boolean;
|
|
74
|
+
export declare function isMarkdownEditorRegistered(registry: FieldComponentRegistry): boolean;
|
package/dist/form/markdown.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* import { registerMarkdownEditorField } from "@flowdrop/flowdrop/form/markdown";
|
|
13
13
|
*
|
|
14
14
|
* // Register markdown editor support (call once at app startup)
|
|
15
|
-
* registerMarkdownEditorField();
|
|
15
|
+
* registerMarkdownEditorField(fd.fields);
|
|
16
16
|
*
|
|
17
17
|
* // Now SchemaForm will render markdown editors for format: "markdown"
|
|
18
18
|
* const schema = {
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
* };
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
|
-
import { fieldComponentRegistry } from './fieldRegistry.js';
|
|
27
26
|
// Re-export the component for direct usage if needed
|
|
28
27
|
export { default as FormMarkdownEditor } from '../components/form/FormMarkdownEditor.svelte';
|
|
29
28
|
/**
|
|
@@ -33,20 +32,13 @@ export { default as FormMarkdownEditor } from '../components/form/FormMarkdownEd
|
|
|
33
32
|
export function markdownEditorFieldMatcher(schema) {
|
|
34
33
|
return schema.format === 'markdown';
|
|
35
34
|
}
|
|
36
|
-
/**
|
|
37
|
-
* Track if markdown editor is registered
|
|
38
|
-
*/
|
|
39
|
-
let markdownEditorRegistered = false;
|
|
40
|
-
// Sync registration flag with registry.clear() for test isolation
|
|
41
|
-
fieldComponentRegistry.onClear(() => {
|
|
42
|
-
markdownEditorRegistered = false;
|
|
43
|
-
});
|
|
44
35
|
/**
|
|
45
36
|
* Register the markdown editor field component
|
|
46
37
|
*
|
|
47
38
|
* Call this function once at application startup to enable
|
|
48
39
|
* markdown editor fields in SchemaForm.
|
|
49
40
|
*
|
|
41
|
+
* @param registry - The instance's field registry (e.g. `fd.fields`)
|
|
50
42
|
* @param priority - Priority for field matching (default: 100)
|
|
51
43
|
*
|
|
52
44
|
* @example
|
|
@@ -54,21 +46,25 @@ fieldComponentRegistry.onClear(() => {
|
|
|
54
46
|
* // In your app's entry point:
|
|
55
47
|
* import { registerMarkdownEditorField } from "@flowdrop/flowdrop/form/markdown";
|
|
56
48
|
*
|
|
57
|
-
* registerMarkdownEditorField();
|
|
49
|
+
* registerMarkdownEditorField(fd.fields);
|
|
58
50
|
* ```
|
|
59
51
|
*/
|
|
60
|
-
export function registerMarkdownEditorField(priority = 100) {
|
|
61
|
-
if (
|
|
52
|
+
export function registerMarkdownEditorField(registry, priority = 100) {
|
|
53
|
+
if (registry.has('markdown-editor')) {
|
|
62
54
|
return;
|
|
63
55
|
}
|
|
64
56
|
// Dynamic import to ensure proper code splitting
|
|
65
57
|
import('../components/form/FormMarkdownEditor.svelte').then((module) => {
|
|
66
|
-
|
|
58
|
+
// Re-check inside the async callback: two rapid synchronous calls both pass
|
|
59
|
+
// the guard above before either import resolves, so guard again here.
|
|
60
|
+
if (registry.has('markdown-editor')) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
registry.register('markdown-editor', {
|
|
67
64
|
component: module.default,
|
|
68
65
|
matcher: markdownEditorFieldMatcher,
|
|
69
66
|
priority
|
|
70
67
|
});
|
|
71
|
-
markdownEditorRegistered = true;
|
|
72
68
|
});
|
|
73
69
|
}
|
|
74
70
|
/**
|
|
@@ -76,28 +72,31 @@ export function registerMarkdownEditorField(priority = 100) {
|
|
|
76
72
|
*
|
|
77
73
|
* Use this when you've already imported the component and want immediate registration.
|
|
78
74
|
*
|
|
75
|
+
* @param registry - The instance's field registry (e.g. `fd.fields`)
|
|
76
|
+
* @param component - The pre-imported markdown editor component
|
|
79
77
|
* @param priority - Priority for field matching (default: 100)
|
|
80
78
|
*
|
|
81
79
|
* @example
|
|
82
80
|
* ```typescript
|
|
83
81
|
* import { registerMarkdownEditorFieldWithComponent, FormMarkdownEditor } from "@flowdrop/flowdrop/form/markdown";
|
|
84
|
-
* registerMarkdownEditorFieldWithComponent(FormMarkdownEditor);
|
|
82
|
+
* registerMarkdownEditorFieldWithComponent(fd.fields, FormMarkdownEditor);
|
|
85
83
|
* ```
|
|
86
84
|
*/
|
|
87
|
-
export function registerMarkdownEditorFieldWithComponent(component, priority = 100) {
|
|
88
|
-
if (
|
|
85
|
+
export function registerMarkdownEditorFieldWithComponent(registry, component, priority = 100) {
|
|
86
|
+
if (registry.has('markdown-editor')) {
|
|
89
87
|
return;
|
|
90
88
|
}
|
|
91
|
-
|
|
89
|
+
registry.register('markdown-editor', {
|
|
92
90
|
component,
|
|
93
91
|
matcher: markdownEditorFieldMatcher,
|
|
94
92
|
priority
|
|
95
93
|
});
|
|
96
|
-
markdownEditorRegistered = true;
|
|
97
94
|
}
|
|
98
95
|
/**
|
|
99
|
-
* Check if markdown editor field is registered
|
|
96
|
+
* Check if markdown editor field is registered in the given registry.
|
|
97
|
+
*
|
|
98
|
+
* @param registry - The instance's field registry (e.g. `fd.fields`)
|
|
100
99
|
*/
|
|
101
|
-
export function isMarkdownEditorRegistered() {
|
|
102
|
-
return
|
|
100
|
+
export function isMarkdownEditorRegistered(registry) {
|
|
101
|
+
return registry.has('markdown-editor');
|
|
103
102
|
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* compatible port pair and creates a preview/permanent edge.
|
|
7
7
|
*/
|
|
8
8
|
import type { WorkflowNode as WorkflowNodeType, WorkflowEdge, NodePort, PortCoordinateMap } from '../types/index.js';
|
|
9
|
+
import type { PortCompatibilityChecker } from '../utils/connections.js';
|
|
9
10
|
/** A candidate proximity edge before it is finalized */
|
|
10
11
|
export interface ProximityEdgeCandidate {
|
|
11
12
|
id: string;
|
|
@@ -61,7 +62,7 @@ export declare class ProximityConnectHelper {
|
|
|
61
62
|
*
|
|
62
63
|
* @returns Array with at most ONE ProximityEdgeCandidate
|
|
63
64
|
*/
|
|
64
|
-
static findCompatibleEdges(draggedNode: WorkflowNodeType, allNodes: WorkflowNodeType[], existingEdges: WorkflowEdge[], minDistance: number): ProximityEdgeCandidate[];
|
|
65
|
+
static findCompatibleEdges(checker: PortCompatibilityChecker, draggedNode: WorkflowNodeType, allNodes: WorkflowNodeType[], existingEdges: WorkflowEdge[], minDistance: number): ProximityEdgeCandidate[];
|
|
65
66
|
/**
|
|
66
67
|
* Find the single best compatible edge using port-to-port distance.
|
|
67
68
|
*
|
|
@@ -77,7 +78,7 @@ export declare class ProximityConnectHelper {
|
|
|
77
78
|
*
|
|
78
79
|
* @returns Array with at most ONE ProximityEdgeCandidate
|
|
79
80
|
*/
|
|
80
|
-
static findCompatibleEdgesByPortCoordinates(draggedNodeId: string, portCoordinates: PortCoordinateMap, existingEdges: WorkflowEdge[], maxDistance: number): ProximityEdgeCandidate[];
|
|
81
|
+
static findCompatibleEdgesByPortCoordinates(checker: PortCompatibilityChecker, draggedNodeId: string, portCoordinates: PortCoordinateMap, existingEdges: WorkflowEdge[], maxDistance: number): ProximityEdgeCandidate[];
|
|
81
82
|
/**
|
|
82
83
|
* Convert candidates to temporary (preview) WorkflowEdge objects with dashed styling.
|
|
83
84
|
*/
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
* compatible port pair and creates a preview/permanent edge.
|
|
7
7
|
*/
|
|
8
8
|
import { dynamicPortToNodePort } from '../types/index.js';
|
|
9
|
-
import { getPortCompatibilityChecker } from '../utils/connections.js';
|
|
10
9
|
import { v4 as uuidv4 } from 'uuid';
|
|
11
10
|
/** CSS class applied to proximity preview edges */
|
|
12
11
|
const PROXIMITY_EDGE_CLASS = 'flowdrop--edge--proximity-preview';
|
|
@@ -86,8 +85,7 @@ export class ProximityConnectHelper {
|
|
|
86
85
|
*
|
|
87
86
|
* @returns Array with at most ONE ProximityEdgeCandidate
|
|
88
87
|
*/
|
|
89
|
-
static findCompatibleEdges(draggedNode, allNodes, existingEdges, minDistance) {
|
|
90
|
-
const checker = getPortCompatibilityChecker();
|
|
88
|
+
static findCompatibleEdges(checker, draggedNode, allNodes, existingEdges, minDistance) {
|
|
91
89
|
// Build lookup set for O(1) duplicate checks
|
|
92
90
|
const existingEdgeSet = new Set(existingEdges.map((e) => `${e.source}:${e.sourceHandle}->${e.target}:${e.targetHandle}`));
|
|
93
91
|
// Find the closest node within distance
|
|
@@ -198,8 +196,7 @@ export class ProximityConnectHelper {
|
|
|
198
196
|
*
|
|
199
197
|
* @returns Array with at most ONE ProximityEdgeCandidate
|
|
200
198
|
*/
|
|
201
|
-
static findCompatibleEdgesByPortCoordinates(draggedNodeId, portCoordinates, existingEdges, maxDistance) {
|
|
202
|
-
const checker = getPortCompatibilityChecker();
|
|
199
|
+
static findCompatibleEdgesByPortCoordinates(checker, draggedNodeId, portCoordinates, existingEdges, maxDistance) {
|
|
203
200
|
// Build lookup set for O(1) duplicate checks
|
|
204
201
|
const existingEdgeSet = new Set(existingEdges.map((e) => `${e.source}:${e.sourceHandle}->${e.target}:${e.targetHandle}`));
|
|
205
202
|
// Partition ports by owner and direction, group other-node ports by dataType
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
* Contains business logic for workflow operations
|
|
4
4
|
*/
|
|
5
5
|
import type { WorkflowNode as WorkflowNodeType, NodeMetadata, Workflow, WorkflowEdge, NodeExecutionInfo } from '../types/index.js';
|
|
6
|
+
import { type FlowDropInstance } from '../stores/instanceContainer.svelte.js';
|
|
7
|
+
import type { ApiContext } from '../stores/apiContext.js';
|
|
8
|
+
import type { AuthProvider } from '../types/auth.js';
|
|
6
9
|
import type { EndpointConfig } from '../config/endpoints.js';
|
|
7
10
|
export { generateNodeId, extractConfigDefaults } from '../utils/nodeIds.js';
|
|
8
11
|
/**
|
|
@@ -33,11 +36,11 @@ export declare class NodeOperationsHelper {
|
|
|
33
36
|
/**
|
|
34
37
|
* Load nodes from API
|
|
35
38
|
*/
|
|
36
|
-
static loadNodesFromApi(providedNodes?: NodeMetadata[]): Promise<NodeMetadata[]>;
|
|
39
|
+
static loadNodesFromApi(api: ApiContext, providedNodes?: NodeMetadata[]): Promise<NodeMetadata[]>;
|
|
37
40
|
/**
|
|
38
41
|
* Load node execution information for all nodes in the workflow
|
|
39
42
|
*/
|
|
40
|
-
static loadNodeExecutionInfo(workflow: Workflow | null, pipelineId?: string): Promise<Record<string, NodeExecutionInfo>>;
|
|
43
|
+
static loadNodeExecutionInfo(api: ApiContext, workflow: Workflow | null, pipelineId?: string): Promise<Record<string, NodeExecutionInfo>>;
|
|
41
44
|
/**
|
|
42
45
|
* Create a new node from dropped data
|
|
43
46
|
*/
|
|
@@ -72,8 +75,13 @@ export declare class WorkflowOperationsHelper {
|
|
|
72
75
|
static addNode(workflow: Workflow, node: WorkflowNodeType): Workflow;
|
|
73
76
|
/**
|
|
74
77
|
* Save workflow to backend
|
|
78
|
+
*
|
|
79
|
+
* @param api - The instance's API context (endpoints + client)
|
|
80
|
+
* @param workflow - The workflow to save
|
|
81
|
+
* @param instance - The FlowDrop instance whose store should be synced when
|
|
82
|
+
* the server assigns a new ID; defaults to the page-default instance
|
|
75
83
|
*/
|
|
76
|
-
static saveWorkflow(workflow: Workflow | null): Promise<Workflow | null>;
|
|
84
|
+
static saveWorkflow(api: ApiContext, workflow: Workflow | null, instance?: FlowDropInstance): Promise<Workflow | null>;
|
|
77
85
|
/**
|
|
78
86
|
* Export workflow as JSON file
|
|
79
87
|
*/
|
|
@@ -127,7 +135,8 @@ export declare class WorkflowOperationsHelper {
|
|
|
127
135
|
*/
|
|
128
136
|
export declare class ConfigurationHelper {
|
|
129
137
|
/**
|
|
130
|
-
* Configure API endpoints
|
|
138
|
+
* Configure API endpoints (and optionally the auth provider) on the given
|
|
139
|
+
* instance's API context.
|
|
131
140
|
*/
|
|
132
|
-
static configureEndpoints(config: EndpointConfig): void;
|
|
141
|
+
static configureEndpoints(api: ApiContext, config: EndpointConfig, authProvider?: AuthProvider): void;
|
|
133
142
|
}
|