@d34dman/flowdrop 0.0.57 → 0.0.59
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/README.md +9 -8
- package/dist/adapters/WorkflowAdapter.d.ts +2 -1
- package/dist/adapters/agentspec/AgentSpecAdapter.d.ts +4 -0
- package/dist/adapters/agentspec/AgentSpecAdapter.js +27 -22
- package/dist/adapters/agentspec/componentTypeDefaults.d.ts +73 -0
- package/dist/adapters/agentspec/componentTypeDefaults.js +238 -0
- package/dist/adapters/agentspec/{nodeTypeRegistry.d.ts → defaultNodeTypes.d.ts} +21 -30
- package/dist/adapters/agentspec/{nodeTypeRegistry.js → defaultNodeTypes.js} +31 -59
- package/dist/adapters/agentspec/index.d.ts +3 -1
- package/dist/adapters/agentspec/index.js +4 -2
- package/dist/components/App.svelte +57 -13
- package/dist/components/NodeSidebar.svelte +20 -8
- package/dist/components/NodeSidebar.svelte.d.ts +2 -1
- package/dist/components/WorkflowEditor.svelte +14 -13
- package/dist/components/form/FormMarkdownEditor.svelte +546 -422
- package/dist/components/form/FormMarkdownEditor.svelte.d.ts +2 -0
- package/dist/components/form/FormUISchemaRenderer.svelte +4 -8
- package/dist/components/form/types.d.ts +1 -1
- package/dist/components/nodes/WorkflowNode.svelte +1 -2
- package/dist/core/index.d.ts +13 -3
- package/dist/core/index.js +16 -3
- package/dist/form/code.js +6 -1
- package/dist/form/fieldRegistry.d.ts +79 -15
- package/dist/form/fieldRegistry.js +104 -49
- package/dist/form/full.d.ts +2 -2
- package/dist/form/full.js +2 -2
- package/dist/form/index.d.ts +3 -3
- package/dist/form/index.js +6 -2
- package/dist/form/markdown.d.ts +3 -3
- package/dist/form/markdown.js +8 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/registry/BaseRegistry.d.ts +92 -0
- package/dist/registry/BaseRegistry.js +124 -0
- package/dist/registry/builtinFormats.d.ts +23 -0
- package/dist/registry/builtinFormats.js +70 -0
- package/dist/registry/builtinNodes.js +4 -0
- package/dist/registry/index.d.ts +2 -1
- package/dist/registry/index.js +2 -0
- package/dist/registry/nodeComponentRegistry.d.ts +26 -57
- package/dist/registry/nodeComponentRegistry.js +29 -82
- package/dist/registry/workflowFormatRegistry.d.ts +122 -0
- package/dist/registry/workflowFormatRegistry.js +96 -0
- package/dist/schema/index.d.ts +23 -0
- package/dist/schema/index.js +23 -0
- package/dist/schemas/v1/workflow.schema.json +1078 -0
- package/dist/stores/portCoordinateStore.js +1 -4
- package/dist/stores/workflowStore.d.ts +3 -0
- package/dist/stores/workflowStore.js +3 -0
- package/dist/svelte-app.d.ts +4 -0
- package/dist/svelte-app.js +9 -1
- package/dist/types/index.d.ts +18 -0
- package/dist/types/index.js +4 -0
- package/package.json +20 -13
package/dist/form/markdown.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* FlowDrop Form Markdown Editor Module
|
|
3
3
|
*
|
|
4
|
-
* Adds
|
|
5
|
-
*
|
|
4
|
+
* Adds CodeMirror 6-based markdown editor support to SchemaForm.
|
|
5
|
+
* Uses @codemirror/lang-markdown for syntax highlighting and marked for preview.
|
|
6
6
|
*
|
|
7
7
|
* @module form/markdown
|
|
8
8
|
*
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* };
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
|
-
import { registerFieldComponent } from './fieldRegistry.js';
|
|
26
|
+
import { registerFieldComponent, fieldComponentRegistry } from './fieldRegistry.js';
|
|
27
27
|
// Re-export the component for direct usage if needed
|
|
28
28
|
export { default as FormMarkdownEditor } from '../components/form/FormMarkdownEditor.svelte';
|
|
29
29
|
/**
|
|
@@ -37,11 +37,15 @@ export function markdownEditorFieldMatcher(schema) {
|
|
|
37
37
|
* Track if markdown editor is registered
|
|
38
38
|
*/
|
|
39
39
|
let markdownEditorRegistered = false;
|
|
40
|
+
// Sync registration flag with registry.clear() for test isolation
|
|
41
|
+
fieldComponentRegistry.onClear(() => {
|
|
42
|
+
markdownEditorRegistered = false;
|
|
43
|
+
});
|
|
40
44
|
/**
|
|
41
45
|
* Register the markdown editor field component
|
|
42
46
|
*
|
|
43
47
|
* Call this function once at application startup to enable
|
|
44
|
-
* markdown editor fields in SchemaForm.
|
|
48
|
+
* markdown editor fields in SchemaForm.
|
|
45
49
|
*
|
|
46
50
|
* @param priority - Priority for field matching (default: 100)
|
|
47
51
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* - `@d34dman/flowdrop/editor` - WorkflowEditor with @xyflow/svelte
|
|
12
12
|
* - `@d34dman/flowdrop/form` - SchemaForm with basic fields
|
|
13
13
|
* - `@d34dman/flowdrop/form/code` - Code editor support (adds CodeMirror)
|
|
14
|
-
* - `@d34dman/flowdrop/form/markdown` - Markdown editor support (
|
|
14
|
+
* - `@d34dman/flowdrop/form/markdown` - Markdown editor support (CodeMirror 6)
|
|
15
15
|
* - `@d34dman/flowdrop/display` - MarkdownDisplay (adds marked)
|
|
16
16
|
* - `@d34dman/flowdrop/playground` - Playground for interactive workflow testing
|
|
17
17
|
* - `@d34dman/flowdrop/styles` - CSS styles
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* ```
|
|
26
26
|
*
|
|
27
27
|
* **Note**: This will bundle ALL dependencies including @xyflow/svelte,
|
|
28
|
-
* CodeMirror
|
|
28
|
+
* CodeMirror and marked. For smaller bundles, use sub-modules.
|
|
29
29
|
*
|
|
30
30
|
* @module flowdrop
|
|
31
31
|
*/
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* - `@d34dman/flowdrop/editor` - WorkflowEditor with @xyflow/svelte
|
|
12
12
|
* - `@d34dman/flowdrop/form` - SchemaForm with basic fields
|
|
13
13
|
* - `@d34dman/flowdrop/form/code` - Code editor support (adds CodeMirror)
|
|
14
|
-
* - `@d34dman/flowdrop/form/markdown` - Markdown editor support (
|
|
14
|
+
* - `@d34dman/flowdrop/form/markdown` - Markdown editor support (CodeMirror 6)
|
|
15
15
|
* - `@d34dman/flowdrop/display` - MarkdownDisplay (adds marked)
|
|
16
16
|
* - `@d34dman/flowdrop/playground` - Playground for interactive workflow testing
|
|
17
17
|
* - `@d34dman/flowdrop/styles` - CSS styles
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* ```
|
|
26
26
|
*
|
|
27
27
|
* **Note**: This will bundle ALL dependencies including @xyflow/svelte,
|
|
28
|
-
* CodeMirror
|
|
28
|
+
* CodeMirror and marked. For smaller bundles, use sub-modules.
|
|
29
29
|
*
|
|
30
30
|
* @module flowdrop
|
|
31
31
|
*/
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base Registry
|
|
3
|
+
*
|
|
4
|
+
* Generic base class for all FlowDrop registries. Provides the shared
|
|
5
|
+
* mechanics: Map storage, subscribe/notify, onClear callbacks, and size tracking.
|
|
6
|
+
*
|
|
7
|
+
* Subclasses define their own `register()` method with domain-appropriate
|
|
8
|
+
* signatures, using `this.items` and `this.notifyListeners()` directly.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* class MyRegistry extends BaseRegistry<string, MyItem> {
|
|
13
|
+
* register(item: MyItem, overwrite = false): void {
|
|
14
|
+
* if (this.items.has(item.id) && !overwrite) {
|
|
15
|
+
* throw new Error(`Already registered: ${item.id}`);
|
|
16
|
+
* }
|
|
17
|
+
* this.items.set(item.id, item);
|
|
18
|
+
* this.notifyListeners();
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare class BaseRegistry<K, V> {
|
|
24
|
+
/** Internal storage map */
|
|
25
|
+
protected items: Map<K, V>;
|
|
26
|
+
/** Change listeners */
|
|
27
|
+
private listeners;
|
|
28
|
+
/** Callbacks invoked when the registry is cleared (for resetting flags) */
|
|
29
|
+
private clearCallbacks;
|
|
30
|
+
/**
|
|
31
|
+
* Unregister an item by key.
|
|
32
|
+
*
|
|
33
|
+
* @param key - The key to remove
|
|
34
|
+
* @returns true if the key was found and removed, false otherwise
|
|
35
|
+
*/
|
|
36
|
+
unregister(key: K): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Get an item by key.
|
|
39
|
+
*
|
|
40
|
+
* @param key - The key to look up
|
|
41
|
+
* @returns The item if found, undefined otherwise
|
|
42
|
+
*/
|
|
43
|
+
get(key: K): V | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Check if a key is registered.
|
|
46
|
+
*
|
|
47
|
+
* @param key - The key to check
|
|
48
|
+
* @returns true if the key is registered
|
|
49
|
+
*/
|
|
50
|
+
has(key: K): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Get all registered keys.
|
|
53
|
+
*
|
|
54
|
+
* @returns Array of registered keys
|
|
55
|
+
*/
|
|
56
|
+
getKeys(): K[];
|
|
57
|
+
/**
|
|
58
|
+
* Get all registered values.
|
|
59
|
+
*
|
|
60
|
+
* @returns Array of all registered items
|
|
61
|
+
*/
|
|
62
|
+
getAll(): V[];
|
|
63
|
+
/**
|
|
64
|
+
* Subscribe to registry changes.
|
|
65
|
+
* Called whenever items are registered, unregistered, or cleared.
|
|
66
|
+
*
|
|
67
|
+
* @param listener - Callback to invoke on changes
|
|
68
|
+
* @returns Unsubscribe function
|
|
69
|
+
*/
|
|
70
|
+
subscribe(listener: () => void): () => void;
|
|
71
|
+
/**
|
|
72
|
+
* Register a callback invoked when the registry is cleared.
|
|
73
|
+
* Useful for resetting module-level registration flags in tests.
|
|
74
|
+
*
|
|
75
|
+
* @param callback - Function to call on clear
|
|
76
|
+
* @returns Unsubscribe function
|
|
77
|
+
*/
|
|
78
|
+
onClear(callback: () => void): () => void;
|
|
79
|
+
/**
|
|
80
|
+
* Clear all registrations.
|
|
81
|
+
* Invokes onClear callbacks first, then notifies listeners.
|
|
82
|
+
*/
|
|
83
|
+
clear(): void;
|
|
84
|
+
/**
|
|
85
|
+
* Get the count of registered items.
|
|
86
|
+
*/
|
|
87
|
+
get size(): number;
|
|
88
|
+
/**
|
|
89
|
+
* Notify all change listeners.
|
|
90
|
+
*/
|
|
91
|
+
protected notifyListeners(): void;
|
|
92
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base Registry
|
|
3
|
+
*
|
|
4
|
+
* Generic base class for all FlowDrop registries. Provides the shared
|
|
5
|
+
* mechanics: Map storage, subscribe/notify, onClear callbacks, and size tracking.
|
|
6
|
+
*
|
|
7
|
+
* Subclasses define their own `register()` method with domain-appropriate
|
|
8
|
+
* signatures, using `this.items` and `this.notifyListeners()` directly.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* class MyRegistry extends BaseRegistry<string, MyItem> {
|
|
13
|
+
* register(item: MyItem, overwrite = false): void {
|
|
14
|
+
* if (this.items.has(item.id) && !overwrite) {
|
|
15
|
+
* throw new Error(`Already registered: ${item.id}`);
|
|
16
|
+
* }
|
|
17
|
+
* this.items.set(item.id, item);
|
|
18
|
+
* this.notifyListeners();
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export class BaseRegistry {
|
|
24
|
+
/** Internal storage map */
|
|
25
|
+
items = new Map();
|
|
26
|
+
/** Change listeners */
|
|
27
|
+
listeners = new Set();
|
|
28
|
+
/** Callbacks invoked when the registry is cleared (for resetting flags) */
|
|
29
|
+
clearCallbacks = new Set();
|
|
30
|
+
/**
|
|
31
|
+
* Unregister an item by key.
|
|
32
|
+
*
|
|
33
|
+
* @param key - The key to remove
|
|
34
|
+
* @returns true if the key was found and removed, false otherwise
|
|
35
|
+
*/
|
|
36
|
+
unregister(key) {
|
|
37
|
+
const result = this.items.delete(key);
|
|
38
|
+
if (result) {
|
|
39
|
+
this.notifyListeners();
|
|
40
|
+
}
|
|
41
|
+
return result;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Get an item by key.
|
|
45
|
+
*
|
|
46
|
+
* @param key - The key to look up
|
|
47
|
+
* @returns The item if found, undefined otherwise
|
|
48
|
+
*/
|
|
49
|
+
get(key) {
|
|
50
|
+
return this.items.get(key);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Check if a key is registered.
|
|
54
|
+
*
|
|
55
|
+
* @param key - The key to check
|
|
56
|
+
* @returns true if the key is registered
|
|
57
|
+
*/
|
|
58
|
+
has(key) {
|
|
59
|
+
return this.items.has(key);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Get all registered keys.
|
|
63
|
+
*
|
|
64
|
+
* @returns Array of registered keys
|
|
65
|
+
*/
|
|
66
|
+
getKeys() {
|
|
67
|
+
return Array.from(this.items.keys());
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Get all registered values.
|
|
71
|
+
*
|
|
72
|
+
* @returns Array of all registered items
|
|
73
|
+
*/
|
|
74
|
+
getAll() {
|
|
75
|
+
return Array.from(this.items.values());
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Subscribe to registry changes.
|
|
79
|
+
* Called whenever items are registered, unregistered, or cleared.
|
|
80
|
+
*
|
|
81
|
+
* @param listener - Callback to invoke on changes
|
|
82
|
+
* @returns Unsubscribe function
|
|
83
|
+
*/
|
|
84
|
+
subscribe(listener) {
|
|
85
|
+
this.listeners.add(listener);
|
|
86
|
+
return () => this.listeners.delete(listener);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Register a callback invoked when the registry is cleared.
|
|
90
|
+
* Useful for resetting module-level registration flags in tests.
|
|
91
|
+
*
|
|
92
|
+
* @param callback - Function to call on clear
|
|
93
|
+
* @returns Unsubscribe function
|
|
94
|
+
*/
|
|
95
|
+
onClear(callback) {
|
|
96
|
+
this.clearCallbacks.add(callback);
|
|
97
|
+
return () => this.clearCallbacks.delete(callback);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Clear all registrations.
|
|
101
|
+
* Invokes onClear callbacks first, then notifies listeners.
|
|
102
|
+
*/
|
|
103
|
+
clear() {
|
|
104
|
+
this.items.clear();
|
|
105
|
+
for (const cb of this.clearCallbacks) {
|
|
106
|
+
cb();
|
|
107
|
+
}
|
|
108
|
+
this.notifyListeners();
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Get the count of registered items.
|
|
112
|
+
*/
|
|
113
|
+
get size() {
|
|
114
|
+
return this.items.size;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Notify all change listeners.
|
|
118
|
+
*/
|
|
119
|
+
notifyListeners() {
|
|
120
|
+
for (const listener of this.listeners) {
|
|
121
|
+
listener();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in Workflow Format Registration
|
|
3
|
+
*
|
|
4
|
+
* Registers the default FlowDrop and Agent Spec format adapters
|
|
5
|
+
* with the workflow format registry.
|
|
6
|
+
*
|
|
7
|
+
* This module is automatically loaded when imported,
|
|
8
|
+
* ensuring built-in formats are available without user action.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Register all built-in workflow format adapters.
|
|
12
|
+
* Safe to call multiple times — will only register once.
|
|
13
|
+
*/
|
|
14
|
+
export declare function registerBuiltinFormats(): void;
|
|
15
|
+
/**
|
|
16
|
+
* Check if built-in formats have been registered.
|
|
17
|
+
*/
|
|
18
|
+
export declare function areBuiltinFormatsRegistered(): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Reset the registration state.
|
|
21
|
+
* Primarily useful for testing.
|
|
22
|
+
*/
|
|
23
|
+
export declare function resetBuiltinFormatRegistration(): void;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in Workflow Format Registration
|
|
3
|
+
*
|
|
4
|
+
* Registers the default FlowDrop and Agent Spec format adapters
|
|
5
|
+
* with the workflow format registry.
|
|
6
|
+
*
|
|
7
|
+
* This module is automatically loaded when imported,
|
|
8
|
+
* ensuring built-in formats are available without user action.
|
|
9
|
+
*/
|
|
10
|
+
import { workflowFormatRegistry } from './workflowFormatRegistry.js';
|
|
11
|
+
import { AgentSpecAdapter } from '../adapters/agentspec/AgentSpecAdapter.js';
|
|
12
|
+
import { validateForAgentSpecExport } from '../adapters/agentspec/validator.js';
|
|
13
|
+
/**
|
|
14
|
+
* Track whether built-in formats have been registered.
|
|
15
|
+
* Prevents duplicate registration on hot reload.
|
|
16
|
+
*/
|
|
17
|
+
let registered = false;
|
|
18
|
+
/**
|
|
19
|
+
* Register all built-in workflow format adapters.
|
|
20
|
+
* Safe to call multiple times — will only register once.
|
|
21
|
+
*/
|
|
22
|
+
export function registerBuiltinFormats() {
|
|
23
|
+
if (registered)
|
|
24
|
+
return;
|
|
25
|
+
// FlowDrop native — passthrough (StandardWorkflow ↔ JSON)
|
|
26
|
+
const flowdropAdapter = {
|
|
27
|
+
id: 'flowdrop',
|
|
28
|
+
name: 'FlowDrop',
|
|
29
|
+
description: 'FlowDrop native workflow format',
|
|
30
|
+
version: '1.0.0',
|
|
31
|
+
// No nodes — FlowDrop nodes are universal (no formats restriction)
|
|
32
|
+
export: (workflow) => JSON.stringify(workflow, null, 2),
|
|
33
|
+
import: (data) => JSON.parse(data)
|
|
34
|
+
};
|
|
35
|
+
workflowFormatRegistry.register(flowdropAdapter);
|
|
36
|
+
// Agent Spec — wraps existing AgentSpecAdapter
|
|
37
|
+
// No bundled nodes — Agent Spec node types are user-provided via
|
|
38
|
+
// getDefaultAgentSpecNodeTypes() or custom definitions passed to mountFlowDropApp()
|
|
39
|
+
const agentSpecAdapter = new AgentSpecAdapter();
|
|
40
|
+
const agentSpecFormatAdapter = {
|
|
41
|
+
id: 'agentspec',
|
|
42
|
+
name: 'Agent Spec (Oracle)',
|
|
43
|
+
description: 'Oracle Open Agent Spec format',
|
|
44
|
+
version: '1.0.0',
|
|
45
|
+
export: (workflow) => agentSpecAdapter.exportJSON(workflow),
|
|
46
|
+
import: (data) => agentSpecAdapter.importJSON(data),
|
|
47
|
+
validate: (workflow) => validateForAgentSpecExport(workflow)
|
|
48
|
+
};
|
|
49
|
+
workflowFormatRegistry.register(agentSpecFormatAdapter);
|
|
50
|
+
registered = true;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Check if built-in formats have been registered.
|
|
54
|
+
*/
|
|
55
|
+
export function areBuiltinFormatsRegistered() {
|
|
56
|
+
return registered;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Reset the registration state.
|
|
60
|
+
* Primarily useful for testing.
|
|
61
|
+
*/
|
|
62
|
+
export function resetBuiltinFormatRegistration() {
|
|
63
|
+
registered = false;
|
|
64
|
+
}
|
|
65
|
+
// Sync registration flag with registry.clear() for test isolation
|
|
66
|
+
workflowFormatRegistry.onClear(() => {
|
|
67
|
+
registered = false;
|
|
68
|
+
});
|
|
69
|
+
// Auto-register built-in formats when this module is imported
|
|
70
|
+
registerBuiltinFormats();
|
|
@@ -203,5 +203,9 @@ export const BUILTIN_NODE_TYPES = [
|
|
|
203
203
|
'terminal',
|
|
204
204
|
'idea'
|
|
205
205
|
];
|
|
206
|
+
// Sync registration flag with registry.clear() for test isolation
|
|
207
|
+
nodeComponentRegistry.onClear(() => {
|
|
208
|
+
builtinsRegistered = false;
|
|
209
|
+
});
|
|
206
210
|
// Auto-register built-ins when this module is imported
|
|
207
211
|
registerBuiltinNodes();
|
package/dist/registry/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Node Component Registry Module
|
|
3
3
|
* Exports all registry-related functionality.
|
|
4
4
|
*/
|
|
5
|
-
export {
|
|
5
|
+
export { BaseRegistry } from './BaseRegistry.js';
|
|
6
|
+
export { nodeComponentRegistry, createNamespacedType, parseNamespacedType, type NodeComponentProps, type NodeTypeInfo, type NodeComponentRegistration, type NodeComponentCategory, type StatusPosition, type StatusSize, type NodeRegistrationFilter } from './nodeComponentRegistry.js';
|
|
6
7
|
export { BUILTIN_NODE_COMPONENTS, BUILTIN_NODE_TYPES, FLOWDROP_SOURCE, registerBuiltinNodes, areBuiltinsRegistered, resetBuiltinRegistration, resolveBuiltinAlias, isBuiltinType, getBuiltinTypes, type BuiltinNodeType } from './builtinNodes.js';
|
|
7
8
|
export { registerFlowDropPlugin, unregisterFlowDropPlugin, registerCustomNode, createPlugin, isValidNamespace, getRegisteredPlugins, getPluginNodeCount, type FlowDropPluginConfig, type PluginNodeDefinition, type PluginRegistrationResult } from './plugin.js';
|
package/dist/registry/index.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
* Node Component Registry Module
|
|
3
3
|
* Exports all registry-related functionality.
|
|
4
4
|
*/
|
|
5
|
+
// Base registry
|
|
6
|
+
export { BaseRegistry } from './BaseRegistry.js';
|
|
5
7
|
// Core registry
|
|
6
8
|
export { nodeComponentRegistry, createNamespacedType, parseNamespacedType } from './nodeComponentRegistry.js';
|
|
7
9
|
// Built-in nodes
|
|
@@ -10,6 +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
14
|
/**
|
|
14
15
|
* Props interface that all node components must accept.
|
|
15
16
|
* Any component registered in the registry must be compatible with these props.
|
|
@@ -44,18 +45,17 @@ export type StatusSize = 'sm' | 'md' | 'lg';
|
|
|
44
45
|
*/
|
|
45
46
|
export type NodeComponentCategory = 'visual' | 'functional' | 'layout' | 'custom';
|
|
46
47
|
/**
|
|
47
|
-
*
|
|
48
|
-
* Contains all information
|
|
48
|
+
* Framework-agnostic metadata for a node type.
|
|
49
|
+
* Contains all display/organizational information without any Svelte dependency.
|
|
50
|
+
* Use this interface when you only need node metadata (e.g., in adapters, headless consumers).
|
|
49
51
|
*/
|
|
50
|
-
export interface
|
|
52
|
+
export interface NodeTypeInfo {
|
|
51
53
|
/** Unique identifier for this node type (e.g., "simple", "mylib:custom") */
|
|
52
54
|
type: string;
|
|
53
55
|
/** Display name for UI purposes (e.g., "Simple Node") */
|
|
54
56
|
displayName: string;
|
|
55
57
|
/** Description of what this node type is for */
|
|
56
58
|
description?: string;
|
|
57
|
-
/** The Svelte component to render for this node type */
|
|
58
|
-
component: Component<NodeComponentProps>;
|
|
59
59
|
/** Icon to show in the node type selector (iconify format) */
|
|
60
60
|
icon?: string;
|
|
61
61
|
/** Category for grouping in UI */
|
|
@@ -67,6 +67,14 @@ export interface NodeComponentRegistration {
|
|
|
67
67
|
/** Default status overlay size for this node type */
|
|
68
68
|
statusSize?: StatusSize;
|
|
69
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Full registration for a node component.
|
|
72
|
+
* Extends NodeTypeInfo with the Svelte component needed for rendering.
|
|
73
|
+
*/
|
|
74
|
+
export interface NodeComponentRegistration extends NodeTypeInfo {
|
|
75
|
+
/** The Svelte component to render for this node type */
|
|
76
|
+
component: Component<NodeComponentProps>;
|
|
77
|
+
}
|
|
70
78
|
/**
|
|
71
79
|
* Options for filtering node registrations
|
|
72
80
|
*/
|
|
@@ -82,6 +90,8 @@ export interface NodeRegistrationFilter {
|
|
|
82
90
|
* Central registry for node component types.
|
|
83
91
|
* Allows built-in and third-party components to be registered and resolved.
|
|
84
92
|
*
|
|
93
|
+
* Extends BaseRegistry for shared mechanics (subscribe, onClear, etc.).
|
|
94
|
+
*
|
|
85
95
|
* @example
|
|
86
96
|
* ```typescript
|
|
87
97
|
* // Register a custom node
|
|
@@ -97,13 +107,11 @@ export interface NodeRegistrationFilter {
|
|
|
97
107
|
* const component = nodeComponentRegistry.getComponent("myCustomNode");
|
|
98
108
|
* ```
|
|
99
109
|
*/
|
|
100
|
-
declare class NodeComponentRegistry {
|
|
101
|
-
/** Map of type -> registration */
|
|
102
|
-
private components;
|
|
110
|
+
declare class NodeComponentRegistry extends BaseRegistry<string, NodeComponentRegistration> {
|
|
103
111
|
/** Default type to use when requested type is not found */
|
|
104
112
|
private defaultType;
|
|
105
|
-
/**
|
|
106
|
-
private
|
|
113
|
+
/** Initial default type, restored on clear() */
|
|
114
|
+
private static readonly INITIAL_DEFAULT_TYPE;
|
|
107
115
|
/**
|
|
108
116
|
* Register a node component type.
|
|
109
117
|
*
|
|
@@ -121,6 +129,10 @@ declare class NodeComponentRegistry {
|
|
|
121
129
|
* });
|
|
122
130
|
* ```
|
|
123
131
|
*/
|
|
132
|
+
/**
|
|
133
|
+
* Clear all registrations and reset default type.
|
|
134
|
+
*/
|
|
135
|
+
clear(): void;
|
|
124
136
|
register(registration: NodeComponentRegistration, overwrite?: boolean): void;
|
|
125
137
|
/**
|
|
126
138
|
* Register multiple components at once.
|
|
@@ -130,20 +142,6 @@ declare class NodeComponentRegistry {
|
|
|
130
142
|
* @param overwrite - If true, allows overwriting existing registrations
|
|
131
143
|
*/
|
|
132
144
|
registerAll(registrations: NodeComponentRegistration[], overwrite?: boolean): void;
|
|
133
|
-
/**
|
|
134
|
-
* Unregister a node component type.
|
|
135
|
-
*
|
|
136
|
-
* @param type - The type identifier to remove
|
|
137
|
-
* @returns true if the type was found and removed, false otherwise
|
|
138
|
-
*/
|
|
139
|
-
unregister(type: string): boolean;
|
|
140
|
-
/**
|
|
141
|
-
* Get a registration by type.
|
|
142
|
-
*
|
|
143
|
-
* @param type - The type identifier to look up
|
|
144
|
-
* @returns The registration if found, undefined otherwise
|
|
145
|
-
*/
|
|
146
|
-
get(type: string): NodeComponentRegistration | undefined;
|
|
147
145
|
/**
|
|
148
146
|
* Get the component for a type, with fallback to default.
|
|
149
147
|
*
|
|
@@ -152,24 +150,18 @@ declare class NodeComponentRegistry {
|
|
|
152
150
|
*/
|
|
153
151
|
getComponent(type: string): Component<NodeComponentProps> | undefined;
|
|
154
152
|
/**
|
|
155
|
-
*
|
|
153
|
+
* Get framework-agnostic metadata for a type, without the Svelte component.
|
|
156
154
|
*
|
|
157
|
-
* @param type - The type identifier to
|
|
158
|
-
* @returns
|
|
155
|
+
* @param type - The type identifier to look up
|
|
156
|
+
* @returns The metadata if found, undefined otherwise
|
|
159
157
|
*/
|
|
160
|
-
|
|
158
|
+
getMetadata(type: string): NodeTypeInfo | undefined;
|
|
161
159
|
/**
|
|
162
160
|
* Get all registered type identifiers.
|
|
163
161
|
*
|
|
164
162
|
* @returns Array of registered type strings
|
|
165
163
|
*/
|
|
166
164
|
getTypes(): string[];
|
|
167
|
-
/**
|
|
168
|
-
* Get all registrations.
|
|
169
|
-
*
|
|
170
|
-
* @returns Array of all registered node component metadata
|
|
171
|
-
*/
|
|
172
|
-
getAll(): NodeComponentRegistration[];
|
|
173
165
|
/**
|
|
174
166
|
* Get registrations filtered by criteria.
|
|
175
167
|
*
|
|
@@ -213,18 +205,6 @@ declare class NodeComponentRegistry {
|
|
|
213
205
|
* @returns The default type identifier
|
|
214
206
|
*/
|
|
215
207
|
getDefaultType(): string;
|
|
216
|
-
/**
|
|
217
|
-
* Subscribe to registry changes.
|
|
218
|
-
* Called whenever components are registered or unregistered.
|
|
219
|
-
*
|
|
220
|
-
* @param listener - Callback to invoke on changes
|
|
221
|
-
* @returns Unsubscribe function
|
|
222
|
-
*/
|
|
223
|
-
subscribe(listener: () => void): () => void;
|
|
224
|
-
/**
|
|
225
|
-
* Notify all listeners of a change.
|
|
226
|
-
*/
|
|
227
|
-
private notifyListeners;
|
|
228
208
|
/**
|
|
229
209
|
* Get oneOf options for config forms.
|
|
230
210
|
* Returns array suitable for JSON Schema oneOf with const/title.
|
|
@@ -256,17 +236,6 @@ declare class NodeComponentRegistry {
|
|
|
256
236
|
* @returns The status size, or default "md"
|
|
257
237
|
*/
|
|
258
238
|
getStatusSize(type: string): StatusSize;
|
|
259
|
-
/**
|
|
260
|
-
* Clear all registrations.
|
|
261
|
-
* Primarily useful for testing.
|
|
262
|
-
*/
|
|
263
|
-
clear(): void;
|
|
264
|
-
/**
|
|
265
|
-
* Get the count of registered components.
|
|
266
|
-
*
|
|
267
|
-
* @returns Number of registered node types
|
|
268
|
-
*/
|
|
269
|
-
get size(): number;
|
|
270
239
|
}
|
|
271
240
|
/** Singleton instance of the node component registry */
|
|
272
241
|
export declare const nodeComponentRegistry: NodeComponentRegistry;
|