@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
package/dist/utils/nodeTypes.js
CHANGED
|
@@ -9,8 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* Works with both built-in types and custom registered types.
|
|
11
11
|
*/
|
|
12
|
-
import {
|
|
13
|
-
import { resolveBuiltinAlias, isBuiltinType } from '../registry/builtinNodes.js';
|
|
12
|
+
import { resolveBuiltinAlias, isBuiltinType } from '../registry/builtinNodeTypes.js';
|
|
14
13
|
/**
|
|
15
14
|
* Display names for built-in node types.
|
|
16
15
|
*/
|
|
@@ -28,14 +27,15 @@ const TYPE_DISPLAY_NAMES = {
|
|
|
28
27
|
* Gets the SvelteFlow component name for a given NodeType.
|
|
29
28
|
* Uses the node component registry to resolve types.
|
|
30
29
|
*
|
|
30
|
+
* @param registry - The instance's node component registry (e.g. `fd.nodes`)
|
|
31
31
|
* @param nodeType - The node type identifier
|
|
32
32
|
* @returns The component name to use
|
|
33
33
|
*/
|
|
34
|
-
export function getComponentNameForNodeType(nodeType) {
|
|
34
|
+
export function getComponentNameForNodeType(registry, nodeType) {
|
|
35
35
|
// Resolve aliases first (e.g., "default" -> "workflowNode")
|
|
36
36
|
const resolvedType = resolveBuiltinAlias(nodeType);
|
|
37
37
|
// Check if it's registered in the registry
|
|
38
|
-
if (
|
|
38
|
+
if (registry.has(resolvedType)) {
|
|
39
39
|
return resolvedType;
|
|
40
40
|
}
|
|
41
41
|
// Unknown type - return workflowNode as default
|
|
@@ -77,11 +77,12 @@ export function getPrimaryNodeType(metadata) {
|
|
|
77
77
|
* 3. First supportedType
|
|
78
78
|
* 4. "default"
|
|
79
79
|
*
|
|
80
|
+
* @param registry - The instance's node component registry (e.g. `fd.nodes`)
|
|
80
81
|
* @param metadata - The node metadata
|
|
81
82
|
* @param configNodeType - Optional type from user config
|
|
82
83
|
* @returns The resolved node type
|
|
83
84
|
*/
|
|
84
|
-
export function resolveNodeType(metadata, configNodeType) {
|
|
85
|
+
export function resolveNodeType(registry, metadata, configNodeType) {
|
|
85
86
|
const availableTypes = getAvailableNodeTypes(metadata);
|
|
86
87
|
// Check if configNodeType is valid for this metadata
|
|
87
88
|
if (configNodeType) {
|
|
@@ -93,7 +94,7 @@ export function resolveNodeType(metadata, configNodeType) {
|
|
|
93
94
|
return configNodeType;
|
|
94
95
|
}
|
|
95
96
|
// Check if it's a registered custom type
|
|
96
|
-
if (
|
|
97
|
+
if (registry.has(configNodeType) || registry.has(resolvedConfig)) {
|
|
97
98
|
return configNodeType;
|
|
98
99
|
}
|
|
99
100
|
}
|
|
@@ -104,22 +105,24 @@ export function resolveNodeType(metadata, configNodeType) {
|
|
|
104
105
|
* Gets the SvelteFlow component name for resolved node type.
|
|
105
106
|
* This is the main function used by UniversalNode to determine which component to render.
|
|
106
107
|
*
|
|
108
|
+
* @param registry - The instance's node component registry (e.g. `fd.nodes`)
|
|
107
109
|
* @param metadata - The node metadata
|
|
108
110
|
* @param configNodeType - Optional type from user config
|
|
109
111
|
* @returns The component name to use
|
|
110
112
|
*/
|
|
111
|
-
export function resolveComponentName(metadata, configNodeType) {
|
|
112
|
-
const nodeType = resolveNodeType(metadata, configNodeType);
|
|
113
|
-
return getComponentNameForNodeType(nodeType);
|
|
113
|
+
export function resolveComponentName(registry, metadata, configNodeType) {
|
|
114
|
+
const nodeType = resolveNodeType(registry, metadata, configNodeType);
|
|
115
|
+
return getComponentNameForNodeType(registry, nodeType);
|
|
114
116
|
}
|
|
115
117
|
/**
|
|
116
118
|
* Validates if a node type is supported by the given metadata.
|
|
117
119
|
*
|
|
120
|
+
* @param registry - The instance's node component registry (e.g. `fd.nodes`)
|
|
118
121
|
* @param metadata - The node metadata
|
|
119
122
|
* @param nodeType - The type to check
|
|
120
123
|
* @returns true if the type is supported
|
|
121
124
|
*/
|
|
122
|
-
export function isNodeTypeSupported(metadata, nodeType) {
|
|
125
|
+
export function isNodeTypeSupported(registry, metadata, nodeType) {
|
|
123
126
|
const availableTypes = getAvailableNodeTypes(metadata);
|
|
124
127
|
// Check direct match
|
|
125
128
|
if (availableTypes.includes(nodeType)) {
|
|
@@ -131,7 +134,7 @@ export function isNodeTypeSupported(metadata, nodeType) {
|
|
|
131
134
|
return true;
|
|
132
135
|
}
|
|
133
136
|
// Check if it's a registered custom type that's in the available list
|
|
134
|
-
if (
|
|
137
|
+
if (registry.has(nodeType)) {
|
|
135
138
|
return availableTypes.some((t) => t === nodeType || resolveBuiltinAlias(t) === nodeType);
|
|
136
139
|
}
|
|
137
140
|
return false;
|
|
@@ -144,18 +147,19 @@ export function isNodeTypeSupported(metadata, nodeType) {
|
|
|
144
147
|
* - Types specified in metadata.supportedTypes
|
|
145
148
|
* - Registered custom types (optionally filtered)
|
|
146
149
|
*
|
|
150
|
+
* @param registry - The instance's node component registry (e.g. `fd.nodes`)
|
|
147
151
|
* @param metadata - The node metadata
|
|
148
152
|
* @param includeCustomTypes - Whether to include registered custom types
|
|
149
153
|
* @returns Array of oneOf items with const (type value) and title (display name)
|
|
150
154
|
*/
|
|
151
|
-
export function getNodeTypeOneOfOptions(metadata, includeCustomTypes = false) {
|
|
155
|
+
export function getNodeTypeOneOfOptions(registry, metadata, includeCustomTypes = false) {
|
|
152
156
|
const availableTypes = getAvailableNodeTypes(metadata);
|
|
153
157
|
const options = [];
|
|
154
158
|
const includedTypes = new Set();
|
|
155
159
|
for (const type of availableTypes) {
|
|
156
160
|
includedTypes.add(type);
|
|
157
161
|
// Get display name from registry or fallback to built-in names
|
|
158
|
-
const registration =
|
|
162
|
+
const registration = registry.get(type);
|
|
159
163
|
let title;
|
|
160
164
|
if (registration) {
|
|
161
165
|
title = registration.displayName;
|
|
@@ -171,7 +175,7 @@ export function getNodeTypeOneOfOptions(metadata, includeCustomTypes = false) {
|
|
|
171
175
|
}
|
|
172
176
|
// Optionally include all registered custom types
|
|
173
177
|
if (includeCustomTypes) {
|
|
174
|
-
const registrations =
|
|
178
|
+
const registrations = registry.filter({
|
|
175
179
|
predicate: (reg) => !isBuiltinType(reg.type) && !includedTypes.has(reg.type)
|
|
176
180
|
});
|
|
177
181
|
for (const reg of registrations) {
|
|
@@ -187,12 +191,13 @@ export function getNodeTypeOneOfOptions(metadata, includeCustomTypes = false) {
|
|
|
187
191
|
* Uses JSON Schema `oneOf` pattern with `const`/`title` for labeled options,
|
|
188
192
|
* which is the standard approach supported by form components.
|
|
189
193
|
*
|
|
194
|
+
* @param registry - The instance's node component registry (e.g. `fd.nodes`)
|
|
190
195
|
* @param metadata - The node metadata
|
|
191
196
|
* @param defaultType - Optional default type override
|
|
192
197
|
* @returns Config schema property object with oneOf for labeled options
|
|
193
198
|
*/
|
|
194
|
-
export function createNodeTypeConfigProperty(metadata, defaultType) {
|
|
195
|
-
const oneOf = getNodeTypeOneOfOptions(metadata);
|
|
199
|
+
export function createNodeTypeConfigProperty(registry, metadata, defaultType) {
|
|
200
|
+
const oneOf = getNodeTypeOneOfOptions(registry, metadata);
|
|
196
201
|
const primaryType = defaultType ?? getPrimaryNodeType(metadata);
|
|
197
202
|
return {
|
|
198
203
|
type: 'string',
|
|
@@ -205,19 +210,21 @@ export function createNodeTypeConfigProperty(metadata, defaultType) {
|
|
|
205
210
|
/**
|
|
206
211
|
* Check if a type string represents a valid registered or built-in type.
|
|
207
212
|
*
|
|
213
|
+
* @param registry - The instance's node component registry (e.g. `fd.nodes`)
|
|
208
214
|
* @param type - The type to check
|
|
209
215
|
* @returns true if the type is valid
|
|
210
216
|
*/
|
|
211
|
-
export function isValidNodeType(type) {
|
|
212
|
-
return isBuiltinType(type) ||
|
|
217
|
+
export function isValidNodeType(registry, type) {
|
|
218
|
+
return isBuiltinType(type) || registry.has(type);
|
|
213
219
|
}
|
|
214
220
|
/**
|
|
215
221
|
* Get all available node types (built-in + registered).
|
|
216
222
|
*
|
|
223
|
+
* @param registry - The instance's node component registry (e.g. `fd.nodes`)
|
|
217
224
|
* @returns Array of all valid node type identifiers
|
|
218
225
|
*/
|
|
219
|
-
export function getAllNodeTypes() {
|
|
220
|
-
return
|
|
226
|
+
export function getAllNodeTypes(registry) {
|
|
227
|
+
return registry.getTypes();
|
|
221
228
|
}
|
|
222
229
|
/**
|
|
223
230
|
* Format a type name for display when no display name is registered.
|
|
@@ -51,6 +51,9 @@ export function areEdgeArraysEqual(edges1, edges2) {
|
|
|
51
51
|
* Throttle function execution to reduce frequency
|
|
52
52
|
* Uses requestAnimationFrame for smooth UI updates
|
|
53
53
|
*/
|
|
54
|
+
// `any[]` in a generic constraint is the variance-correct idiom (it's how the TS
|
|
55
|
+
// stdlib types Parameters<T>); `unknown[]` would reject every concrete callback.
|
|
56
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
54
57
|
export function throttle(func, wait) {
|
|
55
58
|
let timeout = null;
|
|
56
59
|
let lastRan = 0;
|
|
@@ -75,6 +78,8 @@ export function throttle(func, wait) {
|
|
|
75
78
|
* Debounce function execution to reduce frequency
|
|
76
79
|
* Waits for a pause in calls before executing
|
|
77
80
|
*/
|
|
81
|
+
// `any[]` constraint: see throttle() above.
|
|
82
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
78
83
|
export function debounce(func, wait) {
|
|
79
84
|
let timeout = null;
|
|
80
85
|
return function (...args) {
|
|
@@ -90,6 +95,8 @@ export function debounce(func, wait) {
|
|
|
90
95
|
* RequestAnimationFrame-based throttle for smooth animations
|
|
91
96
|
* Better for visual updates like node dragging
|
|
92
97
|
*/
|
|
98
|
+
// `any[]` constraint: see throttle() above.
|
|
99
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
93
100
|
export function rafThrottle(func) {
|
|
94
101
|
let rafId = null;
|
|
95
102
|
let lastArgs = null;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "A drop-in visual workflow editor for any web application. You own the backend. You own the data. You own the orchestration.",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"private": false,
|
|
6
|
-
"version": "
|
|
6
|
+
"version": "2.0.0-beta.2",
|
|
7
7
|
"author": "Shibin Das (D34dMan)",
|
|
8
8
|
"bugs": {
|
|
9
9
|
"url": "https://github.com/flowdrop-io/flowdrop/issues"
|
|
@@ -47,12 +47,12 @@
|
|
|
47
47
|
"dist",
|
|
48
48
|
"!dist/**/*.test.*",
|
|
49
49
|
"!dist/**/*.spec.*",
|
|
50
|
-
"!dist/**/*.map"
|
|
50
|
+
"!dist/**/*.map",
|
|
51
|
+
"CHANGELOG.md",
|
|
52
|
+
"MIGRATION-2.0.md"
|
|
51
53
|
],
|
|
52
54
|
"sideEffects": [
|
|
53
|
-
"**/*.css"
|
|
54
|
-
"./dist/styles/base.css",
|
|
55
|
-
"./dist/editor/index.js"
|
|
55
|
+
"**/*.css"
|
|
56
56
|
],
|
|
57
57
|
"svelte": "./dist/index.js",
|
|
58
58
|
"types": "./dist/index.d.ts",
|
|
@@ -269,6 +269,7 @@
|
|
|
269
269
|
"dependencies": {
|
|
270
270
|
"diff": "^8.0.3",
|
|
271
271
|
"dompurify": "^3.3.1",
|
|
272
|
+
"esm-env": "^1.2.2",
|
|
272
273
|
"marked": "^16.1.1",
|
|
273
274
|
"svelte-5-french-toast": "^2.0.6",
|
|
274
275
|
"uuid": "^11.1.0"
|
|
@@ -288,6 +289,7 @@
|
|
|
288
289
|
"watch:build": "npm-watch build",
|
|
289
290
|
"preview": "vite preview",
|
|
290
291
|
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
292
|
+
"check:bundle": "node scripts/check-bundle.mjs",
|
|
291
293
|
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
292
294
|
"lint": "eslint . && prettier --check .",
|
|
293
295
|
"test": "vitest run",
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* One-shot deprecation warning helper for the messages migration.
|
|
3
|
-
*
|
|
4
|
-
* Components that previously accepted per-string label props (e.g.
|
|
5
|
-
* `saveLabel`, `cancelLabel`, `placeholder`, `addLabel`) keep accepting them
|
|
6
|
-
* during the v1.x deprecation window. When a consumer passes one explicitly
|
|
7
|
-
* we emit a single console.warn per (component, prop) pair so the noise is
|
|
8
|
-
* bounded even if the prop is rebound on every render.
|
|
9
|
-
*
|
|
10
|
-
* Production builds skip the warning entirely.
|
|
11
|
-
*
|
|
12
|
-
* Removed in v2.0 along with the props themselves.
|
|
13
|
-
*/
|
|
14
|
-
export declare function warnDeprecatedProp(component: string, prop: string, replacement: string): void;
|
|
15
|
-
/**
|
|
16
|
-
* Test-only: clear the warned-once cache so subsequent renders re-emit the
|
|
17
|
-
* warning. Storybook stories and Vitest specs that share a module instance
|
|
18
|
-
* need this to assert the warning fires per case.
|
|
19
|
-
*/
|
|
20
|
-
export declare function __resetDeprecationWarningsForTests(): void;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* One-shot deprecation warning helper for the messages migration.
|
|
3
|
-
*
|
|
4
|
-
* Components that previously accepted per-string label props (e.g.
|
|
5
|
-
* `saveLabel`, `cancelLabel`, `placeholder`, `addLabel`) keep accepting them
|
|
6
|
-
* during the v1.x deprecation window. When a consumer passes one explicitly
|
|
7
|
-
* we emit a single console.warn per (component, prop) pair so the noise is
|
|
8
|
-
* bounded even if the prop is rebound on every render.
|
|
9
|
-
*
|
|
10
|
-
* Production builds skip the warning entirely.
|
|
11
|
-
*
|
|
12
|
-
* Removed in v2.0 along with the props themselves.
|
|
13
|
-
*/
|
|
14
|
-
const warned = new Set();
|
|
15
|
-
export function warnDeprecatedProp(component, prop, replacement) {
|
|
16
|
-
if (import.meta.env.PROD)
|
|
17
|
-
return;
|
|
18
|
-
const key = `${component}.${prop}`;
|
|
19
|
-
if (warned.has(key))
|
|
20
|
-
return;
|
|
21
|
-
warned.add(key);
|
|
22
|
-
// eslint-disable-next-line no-console
|
|
23
|
-
console.warn(`[flowdrop] <${component}> prop \`${prop}\` is deprecated and will be removed in v2.0. ` +
|
|
24
|
-
`Use \`messages\` on <FlowDrop> instead: ${replacement}`);
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Test-only: clear the warned-once cache so subsequent renders re-emit the
|
|
28
|
-
* warning. Storybook stories and Vitest specs that share a module instance
|
|
29
|
-
* need this to assert the warning fires per case.
|
|
30
|
-
*/
|
|
31
|
-
export function __resetDeprecationWarningsForTests() {
|
|
32
|
-
warned.clear();
|
|
33
|
-
}
|
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* FlowDrop Plugin System
|
|
3
|
-
* Provides APIs for external libraries to register custom node components.
|
|
4
|
-
*
|
|
5
|
-
* This enables a plugin ecosystem where:
|
|
6
|
-
* - Third-party libraries can provide custom node types
|
|
7
|
-
* - Custom nodes are namespaced to avoid conflicts
|
|
8
|
-
* - Registration is simplified with a clean API
|
|
9
|
-
*/
|
|
10
|
-
import { type NodeComponentProps, type NodeComponentCategory, type StatusPosition, type StatusSize } from './nodeComponentRegistry.js';
|
|
11
|
-
import type { Component } from 'svelte';
|
|
12
|
-
/**
|
|
13
|
-
* Plugin configuration for external libraries.
|
|
14
|
-
* Use this to register multiple node types from a library.
|
|
15
|
-
*/
|
|
16
|
-
export interface FlowDropPluginConfig {
|
|
17
|
-
/**
|
|
18
|
-
* Unique namespace for this plugin.
|
|
19
|
-
* Used to prefix all node types (e.g., "mylib" -> "mylib:nodename").
|
|
20
|
-
* Should be lowercase, alphanumeric with optional hyphens.
|
|
21
|
-
*/
|
|
22
|
-
namespace: string;
|
|
23
|
-
/** Display name for the plugin (for UI/debugging purposes) */
|
|
24
|
-
name: string;
|
|
25
|
-
/** Plugin version (optional, for debugging) */
|
|
26
|
-
version?: string;
|
|
27
|
-
/** Description of what this plugin provides */
|
|
28
|
-
description?: string;
|
|
29
|
-
/** Node components to register */
|
|
30
|
-
nodes: PluginNodeDefinition[];
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Simplified node definition for plugins.
|
|
34
|
-
* Provides a cleaner API than full NodeComponentRegistration.
|
|
35
|
-
*/
|
|
36
|
-
export interface PluginNodeDefinition {
|
|
37
|
-
/**
|
|
38
|
-
* Type identifier for this node.
|
|
39
|
-
* Will be prefixed with the plugin namespace (e.g., "fancy" -> "mylib:fancy").
|
|
40
|
-
*/
|
|
41
|
-
type: string;
|
|
42
|
-
/** Display name shown in UI */
|
|
43
|
-
displayName: string;
|
|
44
|
-
/** Description of what this node does */
|
|
45
|
-
description?: string;
|
|
46
|
-
/** The Svelte component to render */
|
|
47
|
-
component: Component<NodeComponentProps>;
|
|
48
|
-
/** Icon in iconify format (e.g., "mdi:star") */
|
|
49
|
-
icon?: string;
|
|
50
|
-
/** Category for organizing in UI */
|
|
51
|
-
category?: NodeComponentCategory;
|
|
52
|
-
/** Status overlay position */
|
|
53
|
-
statusPosition?: StatusPosition;
|
|
54
|
-
/** Status overlay size */
|
|
55
|
-
statusSize?: StatusSize;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Result of plugin registration.
|
|
59
|
-
* Contains information about what was registered and any errors.
|
|
60
|
-
*/
|
|
61
|
-
export interface PluginRegistrationResult {
|
|
62
|
-
/** Whether all nodes were registered successfully */
|
|
63
|
-
success: boolean;
|
|
64
|
-
/** The plugin namespace */
|
|
65
|
-
namespace: string;
|
|
66
|
-
/** Array of successfully registered type identifiers (namespaced) */
|
|
67
|
-
registeredTypes: string[];
|
|
68
|
-
/** Array of error messages for failed registrations */
|
|
69
|
-
errors: string[];
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Register a FlowDrop plugin with custom node components.
|
|
73
|
-
* All node types are automatically namespaced with the plugin namespace.
|
|
74
|
-
*
|
|
75
|
-
* @param config - Plugin configuration with namespace and node definitions
|
|
76
|
-
* @returns Result object with registered types and any errors
|
|
77
|
-
*
|
|
78
|
-
* @example
|
|
79
|
-
* ```typescript
|
|
80
|
-
* import { registerFlowDropPlugin } from "@flowdrop/lib";
|
|
81
|
-
* import FancyNode from "./FancyNode.svelte";
|
|
82
|
-
* import GlowNode from "./GlowNode.svelte";
|
|
83
|
-
*
|
|
84
|
-
* const result = registerFlowDropPlugin({
|
|
85
|
-
* namespace: "awesome",
|
|
86
|
-
* name: "Awesome Nodes",
|
|
87
|
-
* version: "1.0.0",
|
|
88
|
-
* nodes: [
|
|
89
|
-
* {
|
|
90
|
-
* type: "fancy",
|
|
91
|
-
* displayName: "Fancy Node",
|
|
92
|
-
* component: FancyNode,
|
|
93
|
-
* icon: "mdi:sparkles"
|
|
94
|
-
* },
|
|
95
|
-
* {
|
|
96
|
-
* type: "glow",
|
|
97
|
-
* displayName: "Glowing Node",
|
|
98
|
-
* component: GlowNode,
|
|
99
|
-
* icon: "mdi:lightbulb"
|
|
100
|
-
* }
|
|
101
|
-
* ]
|
|
102
|
-
* });
|
|
103
|
-
*
|
|
104
|
-
* // Result:
|
|
105
|
-
* // {
|
|
106
|
-
* // success: true,
|
|
107
|
-
* // namespace: "awesome",
|
|
108
|
-
* // registeredTypes: ["awesome:fancy", "awesome:glow"],
|
|
109
|
-
* // errors: []
|
|
110
|
-
* // }
|
|
111
|
-
* ```
|
|
112
|
-
*/
|
|
113
|
-
export declare function registerFlowDropPlugin(config: FlowDropPluginConfig): PluginRegistrationResult;
|
|
114
|
-
/**
|
|
115
|
-
* Unregister all nodes from a plugin by namespace.
|
|
116
|
-
*
|
|
117
|
-
* @param namespace - The plugin namespace to unregister
|
|
118
|
-
* @returns Array of unregistered type identifiers
|
|
119
|
-
*
|
|
120
|
-
* @example
|
|
121
|
-
* ```typescript
|
|
122
|
-
* const removed = unregisterFlowDropPlugin("awesome");
|
|
123
|
-
* // Returns ["awesome:fancy", "awesome:glow"]
|
|
124
|
-
* ```
|
|
125
|
-
*/
|
|
126
|
-
export declare function unregisterFlowDropPlugin(namespace: string): string[];
|
|
127
|
-
/**
|
|
128
|
-
* Check if a namespace is valid.
|
|
129
|
-
* Must be lowercase alphanumeric with optional hyphens.
|
|
130
|
-
*
|
|
131
|
-
* @param namespace - The namespace to validate
|
|
132
|
-
* @returns true if valid
|
|
133
|
-
*/
|
|
134
|
-
export declare function isValidNamespace(namespace: string): boolean;
|
|
135
|
-
/**
|
|
136
|
-
* Get all registered plugins (unique namespaces).
|
|
137
|
-
*
|
|
138
|
-
* @returns Array of namespace strings
|
|
139
|
-
*/
|
|
140
|
-
export declare function getRegisteredPlugins(): string[];
|
|
141
|
-
/**
|
|
142
|
-
* Get the count of nodes registered by a plugin.
|
|
143
|
-
*
|
|
144
|
-
* @param namespace - The plugin namespace
|
|
145
|
-
* @returns Number of nodes registered by this plugin
|
|
146
|
-
*/
|
|
147
|
-
export declare function getPluginNodeCount(namespace: string): number;
|
|
148
|
-
/**
|
|
149
|
-
* Register a single custom node without a full plugin.
|
|
150
|
-
* Useful for project-specific custom nodes.
|
|
151
|
-
*
|
|
152
|
-
* @param type - Type identifier (can be namespaced or plain)
|
|
153
|
-
* @param displayName - Display name for UI
|
|
154
|
-
* @param component - Svelte component
|
|
155
|
-
* @param options - Additional options
|
|
156
|
-
*
|
|
157
|
-
* @example
|
|
158
|
-
* ```typescript
|
|
159
|
-
* import { registerCustomNode } from "@flowdrop/lib";
|
|
160
|
-
* import MyNode from "./MyNode.svelte";
|
|
161
|
-
*
|
|
162
|
-
* registerCustomNode("myproject:special", "Special Node", MyNode, {
|
|
163
|
-
* icon: "mdi:star",
|
|
164
|
-
* description: "A special node for my project"
|
|
165
|
-
* });
|
|
166
|
-
* ```
|
|
167
|
-
*/
|
|
168
|
-
export declare function registerCustomNode(type: string, displayName: string, component: Component<NodeComponentProps>, options?: {
|
|
169
|
-
description?: string;
|
|
170
|
-
icon?: string;
|
|
171
|
-
category?: NodeComponentCategory;
|
|
172
|
-
source?: string;
|
|
173
|
-
statusPosition?: StatusPosition;
|
|
174
|
-
statusSize?: StatusSize;
|
|
175
|
-
}): void;
|
|
176
|
-
/**
|
|
177
|
-
* Create a plugin builder for a fluent API experience.
|
|
178
|
-
*
|
|
179
|
-
* @param namespace - Plugin namespace
|
|
180
|
-
* @param name - Plugin name
|
|
181
|
-
* @returns Plugin builder with chainable methods
|
|
182
|
-
*
|
|
183
|
-
* @example
|
|
184
|
-
* ```typescript
|
|
185
|
-
* import { createPlugin } from "@flowdrop/lib";
|
|
186
|
-
*
|
|
187
|
-
* createPlugin("awesome", "Awesome Nodes")
|
|
188
|
-
* .version("1.0.0")
|
|
189
|
-
* .node("fancy", "Fancy Node", FancyNode)
|
|
190
|
-
* .node("glow", "Glowing Node", GlowNode, { icon: "mdi:lightbulb" })
|
|
191
|
-
* .register();
|
|
192
|
-
* ```
|
|
193
|
-
*/
|
|
194
|
-
export declare function createPlugin(namespace: string, name: string): {
|
|
195
|
-
/**
|
|
196
|
-
* Set plugin version
|
|
197
|
-
*/
|
|
198
|
-
version(v: string): /*elided*/ any;
|
|
199
|
-
/**
|
|
200
|
-
* Set plugin description
|
|
201
|
-
*/
|
|
202
|
-
description(desc: string): /*elided*/ any;
|
|
203
|
-
/**
|
|
204
|
-
* Add a node to the plugin
|
|
205
|
-
*/
|
|
206
|
-
node(type: string, displayName: string, component: Component<NodeComponentProps>, options?: Partial<Omit<PluginNodeDefinition, "type" | "displayName" | "component">>): /*elided*/ any;
|
|
207
|
-
/**
|
|
208
|
-
* Register the plugin
|
|
209
|
-
*/
|
|
210
|
-
register(): PluginRegistrationResult;
|
|
211
|
-
/**
|
|
212
|
-
* Get the config without registering (for testing/inspection)
|
|
213
|
-
*/
|
|
214
|
-
getConfig(): FlowDropPluginConfig;
|
|
215
|
-
};
|