@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
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* This module is automatically loaded when the library initializes,
|
|
6
6
|
* ensuring all built-in node types are available without user action.
|
|
7
7
|
*/
|
|
8
|
-
import {
|
|
8
|
+
import {} from './nodeComponentRegistry.js';
|
|
9
|
+
import { FLOWDROP_SOURCE } from './builtinNodeTypes.js';
|
|
9
10
|
import WorkflowNode from '../components/nodes/WorkflowNode.svelte';
|
|
10
11
|
import SimpleNode from '../components/nodes/SimpleNode.svelte';
|
|
11
12
|
import SquareNode from '../components/nodes/SquareNode.svelte';
|
|
@@ -15,10 +16,11 @@ import GatewayNode from '../components/nodes/GatewayNode.svelte';
|
|
|
15
16
|
import NotesNode from '../components/nodes/NotesNode.svelte';
|
|
16
17
|
import TerminalNode from '../components/nodes/TerminalNode.svelte';
|
|
17
18
|
import IdeaNode from '../components/nodes/IdeaNode.svelte';
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
// Pure type metadata + resolution helpers are re-exported for backward
|
|
20
|
+
// compatibility — they now live in a component-free module so that
|
|
21
|
+
// type-only consumers (e.g. utils/nodeTypes.ts, reachable from `core`) do
|
|
22
|
+
// not statically pull in the node components below.
|
|
23
|
+
export { FLOWDROP_SOURCE, BUILTIN_TYPE_ALIASES, BUILTIN_NODE_TYPES, resolveBuiltinAlias, isBuiltinType, getBuiltinTypes } from './builtinNodeTypes.js';
|
|
22
24
|
/**
|
|
23
25
|
* Built-in FlowDrop node component registrations.
|
|
24
26
|
* These are the default node types that ship with FlowDrop.
|
|
@@ -124,101 +126,3 @@ export const BUILTIN_NODE_COMPONENTS = [
|
|
|
124
126
|
statusSize: 'sm'
|
|
125
127
|
}
|
|
126
128
|
];
|
|
127
|
-
/**
|
|
128
|
-
* Alias mapping for type resolution.
|
|
129
|
-
* Maps alternative type names to their canonical registration.
|
|
130
|
-
*/
|
|
131
|
-
export const BUILTIN_TYPE_ALIASES = {
|
|
132
|
-
default: 'workflowNode'
|
|
133
|
-
};
|
|
134
|
-
/**
|
|
135
|
-
* Track whether built-in nodes have been registered.
|
|
136
|
-
* Prevents duplicate registration on hot reload.
|
|
137
|
-
*/
|
|
138
|
-
let builtinsRegistered = false;
|
|
139
|
-
/**
|
|
140
|
-
* Initialize the registry with built-in components.
|
|
141
|
-
* This is called automatically when the library loads.
|
|
142
|
-
*
|
|
143
|
-
* Safe to call multiple times - will only register once.
|
|
144
|
-
*
|
|
145
|
-
* @example
|
|
146
|
-
* ```typescript
|
|
147
|
-
* // Usually not needed - called automatically
|
|
148
|
-
* // But can be called manually if needed
|
|
149
|
-
* registerBuiltinNodes();
|
|
150
|
-
* ```
|
|
151
|
-
*/
|
|
152
|
-
export function registerBuiltinNodes() {
|
|
153
|
-
if (builtinsRegistered) {
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
// Register all built-in components
|
|
157
|
-
nodeComponentRegistry.registerAll(BUILTIN_NODE_COMPONENTS, true);
|
|
158
|
-
// Set the default type
|
|
159
|
-
nodeComponentRegistry.setDefaultType('workflowNode');
|
|
160
|
-
builtinsRegistered = true;
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Check if built-in nodes have been registered.
|
|
164
|
-
*
|
|
165
|
-
* @returns true if registerBuiltinNodes() has been called
|
|
166
|
-
*/
|
|
167
|
-
export function areBuiltinsRegistered() {
|
|
168
|
-
return builtinsRegistered;
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* Reset the registration state.
|
|
172
|
-
* Primarily useful for testing.
|
|
173
|
-
*/
|
|
174
|
-
export function resetBuiltinRegistration() {
|
|
175
|
-
builtinsRegistered = false;
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Get the canonical type for a given type string.
|
|
179
|
-
* Handles aliases like "default" -> "workflowNode".
|
|
180
|
-
*
|
|
181
|
-
* @param type - The type string to resolve
|
|
182
|
-
* @returns The canonical type string
|
|
183
|
-
*/
|
|
184
|
-
export function resolveBuiltinAlias(type) {
|
|
185
|
-
return BUILTIN_TYPE_ALIASES[type] ?? type;
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* Check if a type is a built-in FlowDrop type.
|
|
189
|
-
*
|
|
190
|
-
* @param type - The type to check
|
|
191
|
-
* @returns true if this is a built-in type
|
|
192
|
-
*/
|
|
193
|
-
export function isBuiltinType(type) {
|
|
194
|
-
const canonicalType = resolveBuiltinAlias(type);
|
|
195
|
-
return BUILTIN_NODE_COMPONENTS.some((reg) => reg.type === canonicalType);
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Get all built-in type identifiers.
|
|
199
|
-
*
|
|
200
|
-
* @returns Array of built-in type strings
|
|
201
|
-
*/
|
|
202
|
-
export function getBuiltinTypes() {
|
|
203
|
-
return BUILTIN_NODE_COMPONENTS.map((reg) => reg.type);
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Array of built-in type strings for runtime validation.
|
|
207
|
-
*/
|
|
208
|
-
export const BUILTIN_NODE_TYPES = [
|
|
209
|
-
'workflowNode',
|
|
210
|
-
'simple',
|
|
211
|
-
'square',
|
|
212
|
-
'atom',
|
|
213
|
-
'tool',
|
|
214
|
-
'gateway',
|
|
215
|
-
'note',
|
|
216
|
-
'terminal',
|
|
217
|
-
'idea'
|
|
218
|
-
];
|
|
219
|
-
// Sync registration flag with registry.clear() for test isolation
|
|
220
|
-
nodeComponentRegistry.onClear(() => {
|
|
221
|
-
builtinsRegistered = false;
|
|
222
|
-
});
|
|
223
|
-
// Auto-register built-ins when this module is imported
|
|
224
|
-
registerBuiltinNodes();
|
package/dist/registry/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* Node Component Registry Module
|
|
3
3
|
* Exports all registry-related functionality.
|
|
4
4
|
*/
|
|
5
|
-
export { BaseRegistry } from './BaseRegistry.js';
|
|
6
|
-
export {
|
|
7
|
-
export { BUILTIN_NODE_COMPONENTS, BUILTIN_NODE_TYPES, FLOWDROP_SOURCE,
|
|
8
|
-
export { registerFlowDropPlugin, unregisterFlowDropPlugin, registerCustomNode, createPlugin, isValidNamespace, getRegisteredPlugins, getPluginNodeCount, type FlowDropPluginConfig, type PluginNodeDefinition, type PluginRegistrationResult } from './plugin.js';
|
|
5
|
+
export { BaseRegistry } from './BaseRegistry.svelte.js';
|
|
6
|
+
export { NodeComponentRegistry, createNamespacedType, parseNamespacedType, createPlugin, isValidNamespace, type NodeComponentProps, type NodeTypeInfo, type NodeComponentRegistration, type NodeComponentCategory, type StatusPosition, type StatusSize, type NodeRegistrationFilter, type FlowDropPluginConfig, type PluginNodeDefinition, type PluginRegistrationResult } from './nodeComponentRegistry.js';
|
|
7
|
+
export { BUILTIN_NODE_COMPONENTS, BUILTIN_NODE_TYPES, FLOWDROP_SOURCE, resolveBuiltinAlias, isBuiltinType, getBuiltinTypes, type BuiltinNodeType } from './builtinNodes.js';
|
package/dist/registry/index.js
CHANGED
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
* Exports all registry-related functionality.
|
|
4
4
|
*/
|
|
5
5
|
// Base registry
|
|
6
|
-
export { BaseRegistry } from './BaseRegistry.js';
|
|
7
|
-
// Core registry
|
|
8
|
-
export {
|
|
6
|
+
export { BaseRegistry } from './BaseRegistry.svelte.js';
|
|
7
|
+
// Core registry (the class — instances live on `fd.nodes`)
|
|
8
|
+
export { NodeComponentRegistry, createNamespacedType, parseNamespacedType, createPlugin, isValidNamespace } from './nodeComponentRegistry.js';
|
|
9
9
|
// Built-in nodes
|
|
10
|
-
export { BUILTIN_NODE_COMPONENTS, BUILTIN_NODE_TYPES, FLOWDROP_SOURCE,
|
|
11
|
-
// Plugin system
|
|
12
|
-
export { registerFlowDropPlugin, unregisterFlowDropPlugin, registerCustomNode, createPlugin, isValidNamespace, getRegisteredPlugins, getPluginNodeCount } from './plugin.js';
|
|
10
|
+
export { BUILTIN_NODE_COMPONENTS, BUILTIN_NODE_TYPES, FLOWDROP_SOURCE, resolveBuiltinAlias, isBuiltinType, getBuiltinTypes } from './builtinNodes.js';
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import type { Component } from 'svelte';
|
|
12
12
|
import type { WorkflowNode } from '../types/index.js';
|
|
13
|
-
import { BaseRegistry } from './BaseRegistry.js';
|
|
13
|
+
import { BaseRegistry } from './BaseRegistry.svelte.js';
|
|
14
14
|
/**
|
|
15
15
|
* Props interface that all node components must accept.
|
|
16
16
|
* Any component registered in the registry must be compatible with these props.
|
|
@@ -86,6 +86,73 @@ export interface NodeRegistrationFilter {
|
|
|
86
86
|
/** Custom filter function */
|
|
87
87
|
predicate?: (registration: NodeComponentRegistration) => boolean;
|
|
88
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Plugin configuration for external libraries.
|
|
91
|
+
* Use this to register multiple node types from a library.
|
|
92
|
+
*/
|
|
93
|
+
export interface FlowDropPluginConfig {
|
|
94
|
+
/**
|
|
95
|
+
* Unique namespace for this plugin.
|
|
96
|
+
* Used to prefix all node types (e.g., "mylib" -> "mylib:nodename").
|
|
97
|
+
* Should be lowercase, alphanumeric with optional hyphens.
|
|
98
|
+
*/
|
|
99
|
+
namespace: string;
|
|
100
|
+
/** Display name for the plugin (for UI/debugging purposes) */
|
|
101
|
+
name: string;
|
|
102
|
+
/** Plugin version (optional, for debugging) */
|
|
103
|
+
version?: string;
|
|
104
|
+
/** Description of what this plugin provides */
|
|
105
|
+
description?: string;
|
|
106
|
+
/** Node components to register */
|
|
107
|
+
nodes: PluginNodeDefinition[];
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Simplified node definition for plugins.
|
|
111
|
+
* Provides a cleaner API than full NodeComponentRegistration.
|
|
112
|
+
*/
|
|
113
|
+
export interface PluginNodeDefinition {
|
|
114
|
+
/**
|
|
115
|
+
* Type identifier for this node.
|
|
116
|
+
* Will be prefixed with the plugin namespace (e.g., "fancy" -> "mylib:fancy").
|
|
117
|
+
*/
|
|
118
|
+
type: string;
|
|
119
|
+
/** Display name shown in UI */
|
|
120
|
+
displayName: string;
|
|
121
|
+
/** Description of what this node does */
|
|
122
|
+
description?: string;
|
|
123
|
+
/** The Svelte component to render */
|
|
124
|
+
component: Component<NodeComponentProps>;
|
|
125
|
+
/** Icon in iconify format (e.g., "mdi:star") */
|
|
126
|
+
icon?: string;
|
|
127
|
+
/** Category for organizing in UI */
|
|
128
|
+
category?: NodeComponentCategory;
|
|
129
|
+
/** Status overlay position */
|
|
130
|
+
statusPosition?: StatusPosition;
|
|
131
|
+
/** Status overlay size */
|
|
132
|
+
statusSize?: StatusSize;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Result of plugin registration.
|
|
136
|
+
* Contains information about what was registered and any errors.
|
|
137
|
+
*/
|
|
138
|
+
export interface PluginRegistrationResult {
|
|
139
|
+
/** Whether all nodes were registered successfully */
|
|
140
|
+
success: boolean;
|
|
141
|
+
/** The plugin namespace */
|
|
142
|
+
namespace: string;
|
|
143
|
+
/** Array of successfully registered type identifiers (namespaced) */
|
|
144
|
+
registeredTypes: string[];
|
|
145
|
+
/** Array of error messages for failed registrations */
|
|
146
|
+
errors: string[];
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Check if a namespace is valid.
|
|
150
|
+
* Must be lowercase alphanumeric with optional hyphens.
|
|
151
|
+
*
|
|
152
|
+
* @param namespace - The namespace to validate
|
|
153
|
+
* @returns true if valid
|
|
154
|
+
*/
|
|
155
|
+
export declare function isValidNamespace(namespace: string): boolean;
|
|
89
156
|
/**
|
|
90
157
|
* Central registry for node component types.
|
|
91
158
|
* Allows built-in and third-party components to be registered and resolved.
|
|
@@ -95,7 +162,7 @@ export interface NodeRegistrationFilter {
|
|
|
95
162
|
* @example
|
|
96
163
|
* ```typescript
|
|
97
164
|
* // Register a custom node
|
|
98
|
-
*
|
|
165
|
+
* fd.nodes.register({
|
|
99
166
|
* type: "myCustomNode",
|
|
100
167
|
* displayName: "My Custom Node",
|
|
101
168
|
* component: MyCustomNodeComponent,
|
|
@@ -104,14 +171,28 @@ export interface NodeRegistrationFilter {
|
|
|
104
171
|
* });
|
|
105
172
|
*
|
|
106
173
|
* // Get a component
|
|
107
|
-
* const component =
|
|
174
|
+
* const component = fd.nodes.getComponent("myCustomNode");
|
|
108
175
|
* ```
|
|
109
176
|
*/
|
|
110
|
-
declare class NodeComponentRegistry extends BaseRegistry<string, NodeComponentRegistration> {
|
|
177
|
+
export declare class NodeComponentRegistry extends BaseRegistry<string, NodeComponentRegistration> {
|
|
111
178
|
/** Default type to use when requested type is not found */
|
|
112
179
|
private defaultType;
|
|
113
180
|
/** Initial default type, restored on clear() */
|
|
114
181
|
private static readonly INITIAL_DEFAULT_TYPE;
|
|
182
|
+
/**
|
|
183
|
+
* @param seed - Optional initial registrations and default type. When
|
|
184
|
+
* omitted the registry starts empty; instances created via
|
|
185
|
+
* `createFlowDropInstance` pass the built-in node components (see
|
|
186
|
+
* `builtinNodes.ts`).
|
|
187
|
+
*/
|
|
188
|
+
constructor(seed?: {
|
|
189
|
+
registrations?: NodeComponentRegistration[];
|
|
190
|
+
defaultType?: string;
|
|
191
|
+
});
|
|
192
|
+
/**
|
|
193
|
+
* Clear all registrations and reset default type.
|
|
194
|
+
*/
|
|
195
|
+
clear(): void;
|
|
115
196
|
/**
|
|
116
197
|
* Register a node component type.
|
|
117
198
|
*
|
|
@@ -121,7 +202,7 @@ declare class NodeComponentRegistry extends BaseRegistry<string, NodeComponentRe
|
|
|
121
202
|
*
|
|
122
203
|
* @example
|
|
123
204
|
* ```typescript
|
|
124
|
-
*
|
|
205
|
+
* fd.nodes.register({
|
|
125
206
|
* type: "fancy",
|
|
126
207
|
* displayName: "Fancy Node",
|
|
127
208
|
* component: FancyNode,
|
|
@@ -129,10 +210,6 @@ declare class NodeComponentRegistry extends BaseRegistry<string, NodeComponentRe
|
|
|
129
210
|
* });
|
|
130
211
|
* ```
|
|
131
212
|
*/
|
|
132
|
-
/**
|
|
133
|
-
* Clear all registrations and reset default type.
|
|
134
|
-
*/
|
|
135
|
-
clear(): void;
|
|
136
213
|
register(registration: NodeComponentRegistration, overwrite?: boolean): void;
|
|
137
214
|
/**
|
|
138
215
|
* Register multiple components at once.
|
|
@@ -171,10 +248,10 @@ declare class NodeComponentRegistry extends BaseRegistry<string, NodeComponentRe
|
|
|
171
248
|
* @example
|
|
172
249
|
* ```typescript
|
|
173
250
|
* // Get all visual nodes
|
|
174
|
-
* const visualNodes =
|
|
251
|
+
* const visualNodes = fd.nodes.filter({ category: "visual" });
|
|
175
252
|
*
|
|
176
253
|
* // Get nodes from a specific library
|
|
177
|
-
* const libNodes =
|
|
254
|
+
* const libNodes = fd.nodes.filter({ source: "mylib" });
|
|
178
255
|
* ```
|
|
179
256
|
*/
|
|
180
257
|
filter(filter: NodeRegistrationFilter): NodeComponentRegistration[];
|
|
@@ -214,7 +291,7 @@ declare class NodeComponentRegistry extends BaseRegistry<string, NodeComponentRe
|
|
|
214
291
|
*
|
|
215
292
|
* @example
|
|
216
293
|
* ```typescript
|
|
217
|
-
* const oneOf =
|
|
294
|
+
* const oneOf = fd.nodes.getOneOfOptions();
|
|
218
295
|
* // Use in configSchema: { type: "string", oneOf }
|
|
219
296
|
* ```
|
|
220
297
|
*/
|
|
@@ -236,9 +313,100 @@ declare class NodeComponentRegistry extends BaseRegistry<string, NodeComponentRe
|
|
|
236
313
|
* @returns The status size, or default "md"
|
|
237
314
|
*/
|
|
238
315
|
getStatusSize(type: string): StatusSize;
|
|
316
|
+
/**
|
|
317
|
+
* Register a single custom node without a full plugin.
|
|
318
|
+
* Useful for project-specific custom nodes.
|
|
319
|
+
*
|
|
320
|
+
* @param type - Type identifier (can be namespaced or plain)
|
|
321
|
+
* @param displayName - Display name for UI
|
|
322
|
+
* @param component - Svelte component
|
|
323
|
+
* @param options - Additional options
|
|
324
|
+
*
|
|
325
|
+
* @example
|
|
326
|
+
* ```typescript
|
|
327
|
+
* fd.nodes.registerCustom("myproject:special", "Special Node", MyNode, {
|
|
328
|
+
* icon: "mdi:star",
|
|
329
|
+
* description: "A special node for my project"
|
|
330
|
+
* });
|
|
331
|
+
* ```
|
|
332
|
+
*/
|
|
333
|
+
registerCustom(type: string, displayName: string, component: Component<NodeComponentProps>, options?: {
|
|
334
|
+
description?: string;
|
|
335
|
+
icon?: string;
|
|
336
|
+
category?: NodeComponentCategory;
|
|
337
|
+
source?: string;
|
|
338
|
+
statusPosition?: StatusPosition;
|
|
339
|
+
statusSize?: StatusSize;
|
|
340
|
+
}): void;
|
|
341
|
+
/**
|
|
342
|
+
* Register a FlowDrop plugin with custom node components.
|
|
343
|
+
* All node types are automatically namespaced with the plugin namespace.
|
|
344
|
+
*
|
|
345
|
+
* @param config - Plugin configuration with namespace and node definitions
|
|
346
|
+
* @returns Result object with registered types and any errors
|
|
347
|
+
*/
|
|
348
|
+
registerPlugin(config: FlowDropPluginConfig): PluginRegistrationResult;
|
|
349
|
+
/**
|
|
350
|
+
* Unregister all nodes from a plugin by namespace.
|
|
351
|
+
*
|
|
352
|
+
* @param namespace - The plugin namespace to unregister
|
|
353
|
+
* @returns Array of unregistered type identifiers
|
|
354
|
+
*/
|
|
355
|
+
unregisterPlugin(namespace: string): string[];
|
|
356
|
+
/**
|
|
357
|
+
* Get all registered plugins (unique namespaces).
|
|
358
|
+
*
|
|
359
|
+
* @returns Array of namespace strings
|
|
360
|
+
*/
|
|
361
|
+
getRegisteredPlugins(): string[];
|
|
362
|
+
/**
|
|
363
|
+
* Get the count of nodes registered by a plugin.
|
|
364
|
+
*
|
|
365
|
+
* @param namespace - The plugin namespace
|
|
366
|
+
* @returns Number of nodes registered by this plugin
|
|
367
|
+
*/
|
|
368
|
+
getPluginNodeCount(namespace: string): number;
|
|
239
369
|
}
|
|
240
|
-
/**
|
|
241
|
-
|
|
370
|
+
/**
|
|
371
|
+
* Create a plugin builder for a fluent API experience.
|
|
372
|
+
*
|
|
373
|
+
* @param namespace - Plugin namespace
|
|
374
|
+
* @param name - Plugin name
|
|
375
|
+
* @returns Plugin builder with chainable methods
|
|
376
|
+
*
|
|
377
|
+
* @example
|
|
378
|
+
* ```typescript
|
|
379
|
+
* import { createPlugin } from "@flowdrop/flowdrop/editor";
|
|
380
|
+
*
|
|
381
|
+
* createPlugin("awesome", "Awesome Nodes")
|
|
382
|
+
* .version("1.0.0")
|
|
383
|
+
* .node("fancy", "Fancy Node", FancyNode)
|
|
384
|
+
* .node("glow", "Glowing Node", GlowNode, { icon: "mdi:lightbulb" })
|
|
385
|
+
* .register(fd.nodes);
|
|
386
|
+
* ```
|
|
387
|
+
*/
|
|
388
|
+
export declare function createPlugin(namespace: string, name: string): {
|
|
389
|
+
/**
|
|
390
|
+
* Set plugin version
|
|
391
|
+
*/
|
|
392
|
+
version(v: string): /*elided*/ any;
|
|
393
|
+
/**
|
|
394
|
+
* Set plugin description
|
|
395
|
+
*/
|
|
396
|
+
description(desc: string): /*elided*/ any;
|
|
397
|
+
/**
|
|
398
|
+
* Add a node to the plugin
|
|
399
|
+
*/
|
|
400
|
+
node(type: string, displayName: string, component: Component<NodeComponentProps>, options?: Partial<Omit<PluginNodeDefinition, "type" | "displayName" | "component">>): /*elided*/ any;
|
|
401
|
+
/**
|
|
402
|
+
* Register the plugin into a node component registry (e.g. `fd.nodes`).
|
|
403
|
+
*/
|
|
404
|
+
register(registry: NodeComponentRegistry): PluginRegistrationResult;
|
|
405
|
+
/**
|
|
406
|
+
* Get the config without registering (for testing/inspection)
|
|
407
|
+
*/
|
|
408
|
+
getConfig(): FlowDropPluginConfig;
|
|
409
|
+
};
|
|
242
410
|
/**
|
|
243
411
|
* Helper function to create a namespaced type identifier.
|
|
244
412
|
* Use this to avoid conflicts when registering custom nodes.
|
|
@@ -273,4 +441,3 @@ export declare function parseNamespacedType(namespacedType: string): {
|
|
|
273
441
|
namespace: string;
|
|
274
442
|
type: string;
|
|
275
443
|
} | null;
|
|
276
|
-
export {};
|