@flowdrop/flowdrop 1.0.0
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/LICENSE +21 -0
- package/README.md +252 -0
- package/dist/adapters/WorkflowAdapter.d.ts +167 -0
- package/dist/adapters/WorkflowAdapter.js +368 -0
- package/dist/adapters/agentspec/AgentSpecAdapter.d.ts +96 -0
- package/dist/adapters/agentspec/AgentSpecAdapter.js +626 -0
- package/dist/adapters/agentspec/agentAdapter.d.ts +59 -0
- package/dist/adapters/agentspec/agentAdapter.js +91 -0
- package/dist/adapters/agentspec/autoLayout.d.ts +34 -0
- package/dist/adapters/agentspec/autoLayout.js +127 -0
- package/dist/adapters/agentspec/componentTypeDefaults.d.ts +73 -0
- package/dist/adapters/agentspec/componentTypeDefaults.js +238 -0
- package/dist/adapters/agentspec/defaultNodeTypes.d.ts +53 -0
- package/dist/adapters/agentspec/defaultNodeTypes.js +561 -0
- package/dist/adapters/agentspec/index.d.ts +37 -0
- package/dist/adapters/agentspec/index.js +39 -0
- package/dist/adapters/agentspec/validator.d.ts +34 -0
- package/dist/adapters/agentspec/validator.js +169 -0
- package/dist/api/enhanced-client.d.ts +183 -0
- package/dist/api/enhanced-client.js +430 -0
- package/dist/components/App.svelte +981 -0
- package/dist/components/App.svelte.d.ts +54 -0
- package/dist/components/CanvasBanner.stories.svelte +29 -0
- package/dist/components/CanvasBanner.stories.svelte.d.ts +27 -0
- package/dist/components/CanvasBanner.svelte +57 -0
- package/dist/components/CanvasBanner.svelte.d.ts +8 -0
- package/dist/components/ConfigForm.svelte +1138 -0
- package/dist/components/ConfigForm.svelte.d.ts +44 -0
- package/dist/components/ConfigModal.svelte +188 -0
- package/dist/components/ConfigModal.svelte.d.ts +13 -0
- package/dist/components/ConfigPanel.stories.svelte +47 -0
- package/dist/components/ConfigPanel.stories.svelte.d.ts +27 -0
- package/dist/components/ConfigPanel.svelte +182 -0
- package/dist/components/ConfigPanel.svelte.d.ts +32 -0
- package/dist/components/ConnectionLine.svelte +32 -0
- package/dist/components/ConnectionLine.svelte.d.ts +3 -0
- package/dist/components/EdgeRefresher.svelte +41 -0
- package/dist/components/EdgeRefresher.svelte.d.ts +9 -0
- package/dist/components/FlowDropZone.svelte +83 -0
- package/dist/components/FlowDropZone.svelte.d.ts +13 -0
- package/dist/components/LoadingSpinner.stories.svelte +30 -0
- package/dist/components/LoadingSpinner.stories.svelte.d.ts +27 -0
- package/dist/components/LoadingSpinner.svelte +36 -0
- package/dist/components/LoadingSpinner.svelte.d.ts +8 -0
- package/dist/components/Logo.stories.svelte +22 -0
- package/dist/components/Logo.stories.svelte.d.ts +27 -0
- package/dist/components/Logo.svelte +102 -0
- package/dist/components/Logo.svelte.d.ts +26 -0
- package/dist/components/LogsSidebar.svelte +563 -0
- package/dist/components/LogsSidebar.svelte.d.ts +17 -0
- package/dist/components/MarkdownDisplay.stories.svelte +36 -0
- package/dist/components/MarkdownDisplay.stories.svelte.d.ts +27 -0
- package/dist/components/MarkdownDisplay.svelte +29 -0
- package/dist/components/MarkdownDisplay.svelte.d.ts +7 -0
- package/dist/components/Navbar.stories.svelte +53 -0
- package/dist/components/Navbar.stories.svelte.d.ts +27 -0
- package/dist/components/Navbar.svelte +726 -0
- package/dist/components/Navbar.svelte.d.ts +29 -0
- package/dist/components/NodeSidebar.svelte +762 -0
- package/dist/components/NodeSidebar.svelte.d.ts +9 -0
- package/dist/components/NodeStatusOverlay.stories.svelte +85 -0
- package/dist/components/NodeStatusOverlay.stories.svelte.d.ts +27 -0
- package/dist/components/NodeStatusOverlay.svelte +327 -0
- package/dist/components/NodeStatusOverlay.svelte.d.ts +11 -0
- package/dist/components/PipelineStatus.svelte +314 -0
- package/dist/components/PipelineStatus.svelte.d.ts +20 -0
- package/dist/components/PortCoordinateTracker.svelte +58 -0
- package/dist/components/PortCoordinateTracker.svelte.d.ts +12 -0
- package/dist/components/ReadOnlyDetails.svelte +170 -0
- package/dist/components/ReadOnlyDetails.svelte.d.ts +25 -0
- package/dist/components/SchemaForm.stories.svelte +116 -0
- package/dist/components/SchemaForm.stories.svelte.d.ts +27 -0
- package/dist/components/SchemaForm.svelte +536 -0
- package/dist/components/SchemaForm.svelte.d.ts +83 -0
- package/dist/components/SettingsModal.svelte +279 -0
- package/dist/components/SettingsModal.svelte.d.ts +23 -0
- package/dist/components/SettingsPanel.svelte +638 -0
- package/dist/components/SettingsPanel.svelte.d.ts +21 -0
- package/dist/components/StatusIcon.stories.svelte +60 -0
- package/dist/components/StatusIcon.stories.svelte.d.ts +27 -0
- package/dist/components/StatusIcon.svelte +119 -0
- package/dist/components/StatusIcon.svelte.d.ts +10 -0
- package/dist/components/StatusLabel.stories.svelte +17 -0
- package/dist/components/StatusLabel.stories.svelte.d.ts +27 -0
- package/dist/components/StatusLabel.svelte +33 -0
- package/dist/components/StatusLabel.svelte.d.ts +7 -0
- package/dist/components/ThemeToggle.stories.svelte +25 -0
- package/dist/components/ThemeToggle.stories.svelte.d.ts +27 -0
- package/dist/components/ThemeToggle.svelte +185 -0
- package/dist/components/ThemeToggle.svelte.d.ts +14 -0
- package/dist/components/UniversalNode.svelte +155 -0
- package/dist/components/UniversalNode.svelte.d.ts +15 -0
- package/dist/components/WorkflowEditor.svelte +1035 -0
- package/dist/components/WorkflowEditor.svelte.d.ts +23 -0
- package/dist/components/form/FormArray.svelte +1049 -0
- package/dist/components/form/FormArray.svelte.d.ts +22 -0
- package/dist/components/form/FormAutocomplete.svelte +1009 -0
- package/dist/components/form/FormAutocomplete.svelte.d.ts +25 -0
- package/dist/components/form/FormCheckboxGroup.stories.svelte +28 -0
- package/dist/components/form/FormCheckboxGroup.stories.svelte.d.ts +27 -0
- package/dist/components/form/FormCheckboxGroup.svelte +155 -0
- package/dist/components/form/FormCheckboxGroup.svelte.d.ts +17 -0
- package/dist/components/form/FormCodeEditor.svelte +458 -0
- package/dist/components/form/FormCodeEditor.svelte.d.ts +25 -0
- package/dist/components/form/FormField.svelte +417 -0
- package/dist/components/form/FormField.svelte.d.ts +29 -0
- package/dist/components/form/FormFieldLight.svelte +425 -0
- package/dist/components/form/FormFieldLight.svelte.d.ts +18 -0
- package/dist/components/form/FormFieldWrapper.stories.svelte +53 -0
- package/dist/components/form/FormFieldWrapper.stories.svelte.d.ts +27 -0
- package/dist/components/form/FormFieldWrapper.svelte +125 -0
- package/dist/components/form/FormFieldWrapper.svelte.d.ts +18 -0
- package/dist/components/form/FormFieldset.svelte +142 -0
- package/dist/components/form/FormFieldset.svelte.d.ts +11 -0
- package/dist/components/form/FormMarkdownEditor.svelte +752 -0
- package/dist/components/form/FormMarkdownEditor.svelte.d.ts +33 -0
- package/dist/components/form/FormNumberField.stories.svelte +36 -0
- package/dist/components/form/FormNumberField.stories.svelte.d.ts +27 -0
- package/dist/components/form/FormNumberField.svelte +112 -0
- package/dist/components/form/FormNumberField.svelte.d.ts +25 -0
- package/dist/components/form/FormRangeField.stories.svelte +31 -0
- package/dist/components/form/FormRangeField.stories.svelte.d.ts +27 -0
- package/dist/components/form/FormRangeField.svelte +246 -0
- package/dist/components/form/FormRangeField.svelte.d.ts +23 -0
- package/dist/components/form/FormSelect.stories.svelte +50 -0
- package/dist/components/form/FormSelect.stories.svelte.d.ts +27 -0
- package/dist/components/form/FormSelect.svelte +129 -0
- package/dist/components/form/FormSelect.svelte.d.ts +20 -0
- package/dist/components/form/FormTemplateEditor.svelte +825 -0
- package/dist/components/form/FormTemplateEditor.svelte.d.ts +41 -0
- package/dist/components/form/FormTextField.stories.svelte +30 -0
- package/dist/components/form/FormTextField.stories.svelte.d.ts +27 -0
- package/dist/components/form/FormTextField.svelte +91 -0
- package/dist/components/form/FormTextField.svelte.d.ts +19 -0
- package/dist/components/form/FormTextarea.stories.svelte +34 -0
- package/dist/components/form/FormTextarea.stories.svelte.d.ts +27 -0
- package/dist/components/form/FormTextarea.svelte +97 -0
- package/dist/components/form/FormTextarea.svelte.d.ts +21 -0
- package/dist/components/form/FormToggle.stories.svelte +30 -0
- package/dist/components/form/FormToggle.stories.svelte.d.ts +27 -0
- package/dist/components/form/FormToggle.svelte +126 -0
- package/dist/components/form/FormToggle.svelte.d.ts +19 -0
- package/dist/components/form/FormUISchemaRenderer.svelte +136 -0
- package/dist/components/form/FormUISchemaRenderer.svelte.d.ts +32 -0
- package/dist/components/form/index.d.ts +50 -0
- package/dist/components/form/index.js +54 -0
- package/dist/components/form/templateAutocomplete.d.ts +29 -0
- package/dist/components/form/templateAutocomplete.js +254 -0
- package/dist/components/form/types.d.ts +485 -0
- package/dist/components/form/types.js +73 -0
- package/dist/components/interrupt/ChoicePrompt.stories.svelte +52 -0
- package/dist/components/interrupt/ChoicePrompt.stories.svelte.d.ts +27 -0
- package/dist/components/interrupt/ChoicePrompt.svelte +401 -0
- package/dist/components/interrupt/ChoicePrompt.svelte.d.ts +23 -0
- package/dist/components/interrupt/ConfirmationPrompt.stories.svelte +71 -0
- package/dist/components/interrupt/ConfirmationPrompt.stories.svelte.d.ts +27 -0
- package/dist/components/interrupt/ConfirmationPrompt.svelte +292 -0
- package/dist/components/interrupt/ConfirmationPrompt.svelte.d.ts +25 -0
- package/dist/components/interrupt/FormPrompt.svelte +236 -0
- package/dist/components/interrupt/FormPrompt.svelte.d.ts +23 -0
- package/dist/components/interrupt/InterruptBubble.svelte +601 -0
- package/dist/components/interrupt/InterruptBubble.svelte.d.ts +16 -0
- package/dist/components/interrupt/ReviewPrompt.stories.svelte +67 -0
- package/dist/components/interrupt/ReviewPrompt.stories.svelte.d.ts +27 -0
- package/dist/components/interrupt/ReviewPrompt.svelte +861 -0
- package/dist/components/interrupt/ReviewPrompt.svelte.d.ts +23 -0
- package/dist/components/interrupt/TextInputPrompt.stories.svelte +47 -0
- package/dist/components/interrupt/TextInputPrompt.stories.svelte.d.ts +27 -0
- package/dist/components/interrupt/TextInputPrompt.svelte +346 -0
- package/dist/components/interrupt/TextInputPrompt.svelte.d.ts +23 -0
- package/dist/components/interrupt/index.d.ts +13 -0
- package/dist/components/interrupt/index.js +15 -0
- package/dist/components/layouts/MainLayout.svelte +718 -0
- package/dist/components/layouts/MainLayout.svelte.d.ts +62 -0
- package/dist/components/nodes/GatewayNode.stories.svelte +108 -0
- package/dist/components/nodes/GatewayNode.stories.svelte.d.ts +26 -0
- package/dist/components/nodes/GatewayNode.svelte +591 -0
- package/dist/components/nodes/GatewayNode.svelte.d.ts +15 -0
- package/dist/components/nodes/IdeaNode.stories.svelte +52 -0
- package/dist/components/nodes/IdeaNode.stories.svelte.d.ts +26 -0
- package/dist/components/nodes/IdeaNode.svelte +455 -0
- package/dist/components/nodes/IdeaNode.svelte.d.ts +24 -0
- package/dist/components/nodes/NotesNode.stories.svelte +76 -0
- package/dist/components/nodes/NotesNode.stories.svelte.d.ts +26 -0
- package/dist/components/nodes/NotesNode.svelte +378 -0
- package/dist/components/nodes/NotesNode.svelte.d.ts +24 -0
- package/dist/components/nodes/SimpleNode.stories.svelte +159 -0
- package/dist/components/nodes/SimpleNode.stories.svelte.d.ts +26 -0
- package/dist/components/nodes/SimpleNode.svelte +451 -0
- package/dist/components/nodes/SimpleNode.svelte.d.ts +25 -0
- package/dist/components/nodes/SquareNode.stories.svelte +82 -0
- package/dist/components/nodes/SquareNode.stories.svelte.d.ts +26 -0
- package/dist/components/nodes/SquareNode.svelte +407 -0
- package/dist/components/nodes/SquareNode.svelte.d.ts +25 -0
- package/dist/components/nodes/TerminalNode.stories.svelte +25 -0
- package/dist/components/nodes/TerminalNode.stories.svelte.d.ts +26 -0
- package/dist/components/nodes/TerminalNode.svelte +690 -0
- package/dist/components/nodes/TerminalNode.svelte.d.ts +25 -0
- package/dist/components/nodes/ToolNode.stories.svelte +189 -0
- package/dist/components/nodes/ToolNode.stories.svelte.d.ts +26 -0
- package/dist/components/nodes/ToolNode.svelte +471 -0
- package/dist/components/nodes/ToolNode.svelte.d.ts +36 -0
- package/dist/components/nodes/WorkflowNode.stories.svelte +55 -0
- package/dist/components/nodes/WorkflowNode.stories.svelte.d.ts +26 -0
- package/dist/components/nodes/WorkflowNode.svelte +571 -0
- package/dist/components/nodes/WorkflowNode.svelte.d.ts +15 -0
- package/dist/components/playground/ChatPanel.svelte +905 -0
- package/dist/components/playground/ChatPanel.svelte.d.ts +46 -0
- package/dist/components/playground/ExecutionLogs.svelte +488 -0
- package/dist/components/playground/ExecutionLogs.svelte.d.ts +14 -0
- package/dist/components/playground/InputCollector.svelte +444 -0
- package/dist/components/playground/InputCollector.svelte.d.ts +16 -0
- package/dist/components/playground/MessageBubble.stories.svelte +62 -0
- package/dist/components/playground/MessageBubble.stories.svelte.d.ts +27 -0
- package/dist/components/playground/MessageBubble.svelte +633 -0
- package/dist/components/playground/MessageBubble.svelte.d.ts +24 -0
- package/dist/components/playground/Playground.svelte +1075 -0
- package/dist/components/playground/Playground.svelte.d.ts +25 -0
- package/dist/components/playground/PlaygroundModal.svelte +220 -0
- package/dist/components/playground/PlaygroundModal.svelte.d.ts +25 -0
- package/dist/components/playground/SessionManager.svelte +538 -0
- package/dist/components/playground/SessionManager.svelte.d.ts +20 -0
- package/dist/config/agentSpecEndpoints.d.ts +70 -0
- package/dist/config/agentSpecEndpoints.js +65 -0
- package/dist/config/constants.d.ts +43 -0
- package/dist/config/constants.js +31 -0
- package/dist/config/defaultCategories.d.ts +7 -0
- package/dist/config/defaultCategories.js +126 -0
- package/dist/config/defaultPortConfig.d.ts +6 -0
- package/dist/config/defaultPortConfig.js +201 -0
- package/dist/config/endpoints.d.ts +160 -0
- package/dist/config/endpoints.js +146 -0
- package/dist/config/runtimeConfig.d.ts +47 -0
- package/dist/config/runtimeConfig.js +80 -0
- package/dist/core/index.d.ts +75 -0
- package/dist/core/index.js +92 -0
- package/dist/display/index.d.ts +29 -0
- package/dist/display/index.js +36 -0
- package/dist/editor/index.d.ts +95 -0
- package/dist/editor/index.js +138 -0
- package/dist/form/code.d.ts +101 -0
- package/dist/form/code.js +168 -0
- package/dist/form/fieldRegistry.d.ts +169 -0
- package/dist/form/fieldRegistry.js +152 -0
- package/dist/form/full.d.ts +56 -0
- package/dist/form/full.js +80 -0
- package/dist/form/index.d.ts +77 -0
- package/dist/form/index.js +91 -0
- package/dist/form/markdown.d.ts +69 -0
- package/dist/form/markdown.js +103 -0
- package/dist/helpers/nodeLayoutHelper.d.ts +14 -0
- package/dist/helpers/nodeLayoutHelper.js +19 -0
- package/dist/helpers/proximityConnect.d.ts +94 -0
- package/dist/helpers/proximityConnect.js +314 -0
- package/dist/helpers/workflowEditorHelper.d.ts +183 -0
- package/dist/helpers/workflowEditorHelper.js +595 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.js +64 -0
- package/dist/mocks/app-environment.d.ts +8 -0
- package/dist/mocks/app-environment.js +16 -0
- package/dist/mocks/app-forms.d.ts +2 -0
- package/dist/mocks/app-forms.js +22 -0
- package/dist/mocks/app-navigation.d.ts +5 -0
- package/dist/mocks/app-navigation.js +36 -0
- package/dist/mocks/app-stores.d.ts +14 -0
- package/dist/mocks/app-stores.js +26 -0
- package/dist/playground/index.d.ts +131 -0
- package/dist/playground/index.js +172 -0
- package/dist/playground/mount.d.ts +203 -0
- package/dist/playground/mount.js +235 -0
- 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.d.ts +77 -0
- package/dist/registry/builtinNodes.js +211 -0
- package/dist/registry/index.d.ts +8 -0
- package/dist/registry/index.js +12 -0
- package/dist/registry/nodeComponentRegistry.d.ts +276 -0
- package/dist/registry/nodeComponentRegistry.js +262 -0
- package/dist/registry/plugin.d.ts +215 -0
- package/dist/registry/plugin.js +249 -0
- 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/services/agentSpecExecutionService.d.ts +106 -0
- package/dist/services/agentSpecExecutionService.js +334 -0
- package/dist/services/api.d.ts +115 -0
- package/dist/services/api.js +214 -0
- package/dist/services/apiVariableService.d.ts +114 -0
- package/dist/services/apiVariableService.js +338 -0
- package/dist/services/autoSaveService.d.ts +112 -0
- package/dist/services/autoSaveService.js +227 -0
- package/dist/services/categoriesApi.d.ts +14 -0
- package/dist/services/categoriesApi.js +49 -0
- package/dist/services/draftStorage.d.ts +171 -0
- package/dist/services/draftStorage.js +299 -0
- package/dist/services/dynamicSchemaService.d.ts +108 -0
- package/dist/services/dynamicSchemaService.js +444 -0
- package/dist/services/globalSave.d.ts +69 -0
- package/dist/services/globalSave.js +248 -0
- package/dist/services/historyService.d.ts +208 -0
- package/dist/services/historyService.js +321 -0
- package/dist/services/interruptService.d.ts +133 -0
- package/dist/services/interruptService.js +280 -0
- package/dist/services/nodeExecutionService.d.ts +63 -0
- package/dist/services/nodeExecutionService.js +266 -0
- package/dist/services/playgroundService.d.ts +130 -0
- package/dist/services/playgroundService.js +321 -0
- package/dist/services/portConfigApi.d.ts +14 -0
- package/dist/services/portConfigApi.js +54 -0
- package/dist/services/settingsService.d.ts +92 -0
- package/dist/services/settingsService.js +196 -0
- package/dist/services/toastService.d.ts +156 -0
- package/dist/services/toastService.js +265 -0
- package/dist/services/variableService.d.ts +141 -0
- package/dist/services/variableService.js +463 -0
- package/dist/services/workflowStorage.d.ts +37 -0
- package/dist/services/workflowStorage.js +116 -0
- package/dist/settings/index.d.ts +25 -0
- package/dist/settings/index.js +33 -0
- package/dist/stores/categoriesStore.svelte.d.ts +32 -0
- package/dist/stores/categoriesStore.svelte.js +77 -0
- package/dist/stores/editorStateMachine.svelte.d.ts +42 -0
- package/dist/stores/editorStateMachine.svelte.js +132 -0
- package/dist/stores/historyStore.svelte.d.ts +136 -0
- package/dist/stores/historyStore.svelte.js +207 -0
- package/dist/stores/interruptStore.svelte.d.ts +179 -0
- package/dist/stores/interruptStore.svelte.js +346 -0
- package/dist/stores/playgroundStore.svelte.d.ts +230 -0
- package/dist/stores/playgroundStore.svelte.js +515 -0
- package/dist/stores/portCoordinateStore.svelte.d.ts +66 -0
- package/dist/stores/portCoordinateStore.svelte.js +186 -0
- package/dist/stores/settingsStore.svelte.d.ts +158 -0
- package/dist/stores/settingsStore.svelte.js +544 -0
- package/dist/stores/workflowStore.svelte.d.ts +260 -0
- package/dist/stores/workflowStore.svelte.js +649 -0
- package/dist/stories/CanvasDecorator.svelte +49 -0
- package/dist/stories/CanvasDecorator.svelte.d.ts +8 -0
- package/dist/stories/NodeDecorator.svelte +73 -0
- package/dist/stories/NodeDecorator.svelte.d.ts +8 -0
- package/dist/stories/utils.d.ts +93 -0
- package/dist/stories/utils.js +122 -0
- package/dist/styles/base.css +1300 -0
- package/dist/styles/toast.css +35 -0
- package/dist/styles/tokens.css +475 -0
- package/dist/svelte-app.d.ts +150 -0
- package/dist/svelte-app.js +295 -0
- package/dist/types/agentspec.d.ts +318 -0
- package/dist/types/agentspec.js +48 -0
- package/dist/types/auth.d.ts +263 -0
- package/dist/types/auth.js +229 -0
- package/dist/types/config.d.ts +151 -0
- package/dist/types/config.js +7 -0
- package/dist/types/events.d.ts +190 -0
- package/dist/types/events.js +30 -0
- package/dist/types/index.d.ts +1234 -0
- package/dist/types/index.js +27 -0
- package/dist/types/interrupt.d.ts +390 -0
- package/dist/types/interrupt.js +145 -0
- package/dist/types/interruptState.d.ts +211 -0
- package/dist/types/interruptState.js +308 -0
- package/dist/types/playground.d.ts +351 -0
- package/dist/types/playground.js +95 -0
- package/dist/types/settings.d.ts +189 -0
- package/dist/types/settings.js +97 -0
- package/dist/types/uischema.d.ts +144 -0
- package/dist/types/uischema.js +51 -0
- package/dist/utils/colors.d.ts +288 -0
- package/dist/utils/colors.js +548 -0
- package/dist/utils/config.d.ts +37 -0
- package/dist/utils/config.js +226 -0
- package/dist/utils/connections.d.ts +125 -0
- package/dist/utils/connections.js +414 -0
- package/dist/utils/errors.d.ts +28 -0
- package/dist/utils/errors.js +44 -0
- package/dist/utils/fetchWithAuth.d.ts +25 -0
- package/dist/utils/fetchWithAuth.js +34 -0
- package/dist/utils/handleIds.d.ts +35 -0
- package/dist/utils/handleIds.js +58 -0
- package/dist/utils/handlePositioning.d.ts +31 -0
- package/dist/utils/handlePositioning.js +35 -0
- package/dist/utils/icons.d.ts +106 -0
- package/dist/utils/icons.js +157 -0
- package/dist/utils/logger.d.ts +47 -0
- package/dist/utils/logger.js +72 -0
- package/dist/utils/nodeStatus.d.ts +53 -0
- package/dist/utils/nodeStatus.js +183 -0
- package/dist/utils/nodeTypes.d.ts +117 -0
- package/dist/utils/nodeTypes.js +244 -0
- package/dist/utils/nodeWrapper.d.ts +39 -0
- package/dist/utils/nodeWrapper.js +62 -0
- package/dist/utils/performanceUtils.d.ts +30 -0
- package/dist/utils/performanceUtils.js +108 -0
- package/dist/utils/sanitize.d.ts +19 -0
- package/dist/utils/sanitize.js +31 -0
- package/dist/utils/uischema.d.ts +52 -0
- package/dist/utils/uischema.js +88 -0
- package/dist/utils/validation.d.ts +29 -0
- package/dist/utils/validation.js +39 -0
- package/package.json +292 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node type utilities for FlowDrop
|
|
3
|
+
* Handles dynamic node type resolution based on NodeMetadata.
|
|
4
|
+
*
|
|
5
|
+
* This module provides utilities for:
|
|
6
|
+
* - Resolving which node type to use based on metadata and config
|
|
7
|
+
* - Getting available node types for a given metadata
|
|
8
|
+
* - Creating config schema properties for node type selection
|
|
9
|
+
*
|
|
10
|
+
* Works with both built-in types and custom registered types.
|
|
11
|
+
*/
|
|
12
|
+
import type { NodeType, NodeMetadata } from '../types/index.js';
|
|
13
|
+
/**
|
|
14
|
+
* Gets the SvelteFlow component name for a given NodeType.
|
|
15
|
+
* Uses the node component registry to resolve types.
|
|
16
|
+
*
|
|
17
|
+
* @param nodeType - The node type identifier
|
|
18
|
+
* @returns The component name to use
|
|
19
|
+
*/
|
|
20
|
+
export declare function getComponentNameForNodeType(nodeType: NodeType | string): string;
|
|
21
|
+
/**
|
|
22
|
+
* Gets the available node types for a given NodeMetadata.
|
|
23
|
+
* Priority: supportedTypes > type > "default"
|
|
24
|
+
*
|
|
25
|
+
* @param metadata - The node metadata
|
|
26
|
+
* @returns Array of available node type identifiers
|
|
27
|
+
*/
|
|
28
|
+
export declare function getAvailableNodeTypes(metadata: NodeMetadata): (NodeType | string)[];
|
|
29
|
+
/**
|
|
30
|
+
* Gets the primary (default) node type for a given NodeMetadata.
|
|
31
|
+
* This is used when no specific type is configured by the user.
|
|
32
|
+
*
|
|
33
|
+
* @param metadata - The node metadata
|
|
34
|
+
* @returns The primary node type
|
|
35
|
+
*/
|
|
36
|
+
export declare function getPrimaryNodeType(metadata: NodeMetadata): NodeType | string;
|
|
37
|
+
/**
|
|
38
|
+
* Determines the appropriate node type based on configuration and metadata.
|
|
39
|
+
*
|
|
40
|
+
* Priority:
|
|
41
|
+
* 1. configNodeType (if valid for this metadata)
|
|
42
|
+
* 2. metadata.type (if valid)
|
|
43
|
+
* 3. First supportedType
|
|
44
|
+
* 4. "default"
|
|
45
|
+
*
|
|
46
|
+
* @param metadata - The node metadata
|
|
47
|
+
* @param configNodeType - Optional type from user config
|
|
48
|
+
* @returns The resolved node type
|
|
49
|
+
*/
|
|
50
|
+
export declare function resolveNodeType(metadata: NodeMetadata, configNodeType?: string): NodeType | string;
|
|
51
|
+
/**
|
|
52
|
+
* Gets the SvelteFlow component name for resolved node type.
|
|
53
|
+
* This is the main function used by UniversalNode to determine which component to render.
|
|
54
|
+
*
|
|
55
|
+
* @param metadata - The node metadata
|
|
56
|
+
* @param configNodeType - Optional type from user config
|
|
57
|
+
* @returns The component name to use
|
|
58
|
+
*/
|
|
59
|
+
export declare function resolveComponentName(metadata: NodeMetadata, configNodeType?: string): string;
|
|
60
|
+
/**
|
|
61
|
+
* Validates if a node type is supported by the given metadata.
|
|
62
|
+
*
|
|
63
|
+
* @param metadata - The node metadata
|
|
64
|
+
* @param nodeType - The type to check
|
|
65
|
+
* @returns true if the type is supported
|
|
66
|
+
*/
|
|
67
|
+
export declare function isNodeTypeSupported(metadata: NodeMetadata, nodeType: NodeType | string): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Gets oneOf options for node type configuration.
|
|
70
|
+
* Used in config schemas to show available options with labels.
|
|
71
|
+
*
|
|
72
|
+
* This function combines:
|
|
73
|
+
* - Types specified in metadata.supportedTypes
|
|
74
|
+
* - Registered custom types (optionally filtered)
|
|
75
|
+
*
|
|
76
|
+
* @param metadata - The node metadata
|
|
77
|
+
* @param includeCustomTypes - Whether to include registered custom types
|
|
78
|
+
* @returns Array of oneOf items with const (type value) and title (display name)
|
|
79
|
+
*/
|
|
80
|
+
export declare function getNodeTypeOneOfOptions(metadata: NodeMetadata, includeCustomTypes?: boolean): Array<{
|
|
81
|
+
const: string;
|
|
82
|
+
title: string;
|
|
83
|
+
}>;
|
|
84
|
+
/**
|
|
85
|
+
* Creates a nodeType config property that respects supportedTypes.
|
|
86
|
+
* This replaces hardcoded enum values in config schemas.
|
|
87
|
+
*
|
|
88
|
+
* Uses JSON Schema `oneOf` pattern with `const`/`title` for labeled options,
|
|
89
|
+
* which is the standard approach supported by form components.
|
|
90
|
+
*
|
|
91
|
+
* @param metadata - The node metadata
|
|
92
|
+
* @param defaultType - Optional default type override
|
|
93
|
+
* @returns Config schema property object with oneOf for labeled options
|
|
94
|
+
*/
|
|
95
|
+
export declare function createNodeTypeConfigProperty(metadata: NodeMetadata, defaultType?: NodeType | string): {
|
|
96
|
+
type: "string";
|
|
97
|
+
title: string;
|
|
98
|
+
description: string;
|
|
99
|
+
default: string;
|
|
100
|
+
oneOf: {
|
|
101
|
+
const: string;
|
|
102
|
+
title: string;
|
|
103
|
+
}[];
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Check if a type string represents a valid registered or built-in type.
|
|
107
|
+
*
|
|
108
|
+
* @param type - The type to check
|
|
109
|
+
* @returns true if the type is valid
|
|
110
|
+
*/
|
|
111
|
+
export declare function isValidNodeType(type: string): boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Get all available node types (built-in + registered).
|
|
114
|
+
*
|
|
115
|
+
* @returns Array of all valid node type identifiers
|
|
116
|
+
*/
|
|
117
|
+
export declare function getAllNodeTypes(): string[];
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node type utilities for FlowDrop
|
|
3
|
+
* Handles dynamic node type resolution based on NodeMetadata.
|
|
4
|
+
*
|
|
5
|
+
* This module provides utilities for:
|
|
6
|
+
* - Resolving which node type to use based on metadata and config
|
|
7
|
+
* - Getting available node types for a given metadata
|
|
8
|
+
* - Creating config schema properties for node type selection
|
|
9
|
+
*
|
|
10
|
+
* Works with both built-in types and custom registered types.
|
|
11
|
+
*/
|
|
12
|
+
import { nodeComponentRegistry } from '../registry/nodeComponentRegistry.js';
|
|
13
|
+
import { resolveBuiltinAlias, isBuiltinType } from '../registry/builtinNodes.js';
|
|
14
|
+
/**
|
|
15
|
+
* Display names for built-in node types.
|
|
16
|
+
*/
|
|
17
|
+
const TYPE_DISPLAY_NAMES = {
|
|
18
|
+
note: 'Note (sticky note style)',
|
|
19
|
+
simple: 'Simple (compact layout)',
|
|
20
|
+
square: 'Square (geometric layout)',
|
|
21
|
+
tool: 'Tool (specialized for agent tools)',
|
|
22
|
+
gateway: 'Gateway (branching control flow)',
|
|
23
|
+
terminal: 'Terminal (start/end/exit)',
|
|
24
|
+
default: 'Default (standard workflow node)'
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Gets the SvelteFlow component name for a given NodeType.
|
|
28
|
+
* Uses the node component registry to resolve types.
|
|
29
|
+
*
|
|
30
|
+
* @param nodeType - The node type identifier
|
|
31
|
+
* @returns The component name to use
|
|
32
|
+
*/
|
|
33
|
+
export function getComponentNameForNodeType(nodeType) {
|
|
34
|
+
// Resolve aliases first (e.g., "default" -> "workflowNode")
|
|
35
|
+
const resolvedType = resolveBuiltinAlias(nodeType);
|
|
36
|
+
// Check if it's registered in the registry
|
|
37
|
+
if (nodeComponentRegistry.has(resolvedType)) {
|
|
38
|
+
return resolvedType;
|
|
39
|
+
}
|
|
40
|
+
// Unknown type - return workflowNode as default
|
|
41
|
+
return 'workflowNode';
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Gets the available node types for a given NodeMetadata.
|
|
45
|
+
* Priority: supportedTypes > type > "default"
|
|
46
|
+
*
|
|
47
|
+
* @param metadata - The node metadata
|
|
48
|
+
* @returns Array of available node type identifiers
|
|
49
|
+
*/
|
|
50
|
+
export function getAvailableNodeTypes(metadata) {
|
|
51
|
+
if (metadata.supportedTypes && metadata.supportedTypes.length > 0) {
|
|
52
|
+
return metadata.supportedTypes;
|
|
53
|
+
}
|
|
54
|
+
if (metadata.type) {
|
|
55
|
+
return [metadata.type];
|
|
56
|
+
}
|
|
57
|
+
return ['default'];
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Gets the primary (default) node type for a given NodeMetadata.
|
|
61
|
+
* This is used when no specific type is configured by the user.
|
|
62
|
+
*
|
|
63
|
+
* @param metadata - The node metadata
|
|
64
|
+
* @returns The primary node type
|
|
65
|
+
*/
|
|
66
|
+
export function getPrimaryNodeType(metadata) {
|
|
67
|
+
const availableTypes = getAvailableNodeTypes(metadata);
|
|
68
|
+
return availableTypes[0];
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Determines the appropriate node type based on configuration and metadata.
|
|
72
|
+
*
|
|
73
|
+
* Priority:
|
|
74
|
+
* 1. configNodeType (if valid for this metadata)
|
|
75
|
+
* 2. metadata.type (if valid)
|
|
76
|
+
* 3. First supportedType
|
|
77
|
+
* 4. "default"
|
|
78
|
+
*
|
|
79
|
+
* @param metadata - The node metadata
|
|
80
|
+
* @param configNodeType - Optional type from user config
|
|
81
|
+
* @returns The resolved node type
|
|
82
|
+
*/
|
|
83
|
+
export function resolveNodeType(metadata, configNodeType) {
|
|
84
|
+
const availableTypes = getAvailableNodeTypes(metadata);
|
|
85
|
+
// Check if configNodeType is valid for this metadata
|
|
86
|
+
if (configNodeType) {
|
|
87
|
+
// Resolve alias for comparison
|
|
88
|
+
const resolvedConfig = resolveBuiltinAlias(configNodeType);
|
|
89
|
+
// Check if it's in available types
|
|
90
|
+
if (availableTypes.includes(configNodeType) ||
|
|
91
|
+
availableTypes.includes(resolvedConfig)) {
|
|
92
|
+
return configNodeType;
|
|
93
|
+
}
|
|
94
|
+
// Check if it's a registered custom type
|
|
95
|
+
if (nodeComponentRegistry.has(configNodeType) || nodeComponentRegistry.has(resolvedConfig)) {
|
|
96
|
+
return configNodeType;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
// Fall back to primary type
|
|
100
|
+
return getPrimaryNodeType(metadata);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Gets the SvelteFlow component name for resolved node type.
|
|
104
|
+
* This is the main function used by UniversalNode to determine which component to render.
|
|
105
|
+
*
|
|
106
|
+
* @param metadata - The node metadata
|
|
107
|
+
* @param configNodeType - Optional type from user config
|
|
108
|
+
* @returns The component name to use
|
|
109
|
+
*/
|
|
110
|
+
export function resolveComponentName(metadata, configNodeType) {
|
|
111
|
+
const nodeType = resolveNodeType(metadata, configNodeType);
|
|
112
|
+
return getComponentNameForNodeType(nodeType);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Validates if a node type is supported by the given metadata.
|
|
116
|
+
*
|
|
117
|
+
* @param metadata - The node metadata
|
|
118
|
+
* @param nodeType - The type to check
|
|
119
|
+
* @returns true if the type is supported
|
|
120
|
+
*/
|
|
121
|
+
export function isNodeTypeSupported(metadata, nodeType) {
|
|
122
|
+
const availableTypes = getAvailableNodeTypes(metadata);
|
|
123
|
+
// Check direct match
|
|
124
|
+
if (availableTypes.includes(nodeType)) {
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
// Check alias match
|
|
128
|
+
const resolvedType = resolveBuiltinAlias(nodeType);
|
|
129
|
+
if (availableTypes.includes(resolvedType)) {
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
// Check if it's a registered custom type that's in the available list
|
|
133
|
+
if (nodeComponentRegistry.has(nodeType)) {
|
|
134
|
+
return availableTypes.some((t) => t === nodeType || resolveBuiltinAlias(t) === nodeType);
|
|
135
|
+
}
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Gets oneOf options for node type configuration.
|
|
140
|
+
* Used in config schemas to show available options with labels.
|
|
141
|
+
*
|
|
142
|
+
* This function combines:
|
|
143
|
+
* - Types specified in metadata.supportedTypes
|
|
144
|
+
* - Registered custom types (optionally filtered)
|
|
145
|
+
*
|
|
146
|
+
* @param metadata - The node metadata
|
|
147
|
+
* @param includeCustomTypes - Whether to include registered custom types
|
|
148
|
+
* @returns Array of oneOf items with const (type value) and title (display name)
|
|
149
|
+
*/
|
|
150
|
+
export function getNodeTypeOneOfOptions(metadata, includeCustomTypes = false) {
|
|
151
|
+
const availableTypes = getAvailableNodeTypes(metadata);
|
|
152
|
+
const options = [];
|
|
153
|
+
const includedTypes = new Set();
|
|
154
|
+
for (const type of availableTypes) {
|
|
155
|
+
includedTypes.add(type);
|
|
156
|
+
// Get display name from registry or fallback to built-in names
|
|
157
|
+
const registration = nodeComponentRegistry.get(type);
|
|
158
|
+
let title;
|
|
159
|
+
if (registration) {
|
|
160
|
+
title = registration.displayName;
|
|
161
|
+
}
|
|
162
|
+
else if (type in TYPE_DISPLAY_NAMES) {
|
|
163
|
+
title = TYPE_DISPLAY_NAMES[type];
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
// Format unknown type nicely
|
|
167
|
+
title = formatTypeName(type);
|
|
168
|
+
}
|
|
169
|
+
options.push({ const: type, title });
|
|
170
|
+
}
|
|
171
|
+
// Optionally include all registered custom types
|
|
172
|
+
if (includeCustomTypes) {
|
|
173
|
+
const registrations = nodeComponentRegistry.filter({
|
|
174
|
+
predicate: (reg) => !isBuiltinType(reg.type) && !includedTypes.has(reg.type)
|
|
175
|
+
});
|
|
176
|
+
for (const reg of registrations) {
|
|
177
|
+
options.push({ const: reg.type, title: reg.displayName });
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return options;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Creates a nodeType config property that respects supportedTypes.
|
|
184
|
+
* This replaces hardcoded enum values in config schemas.
|
|
185
|
+
*
|
|
186
|
+
* Uses JSON Schema `oneOf` pattern with `const`/`title` for labeled options,
|
|
187
|
+
* which is the standard approach supported by form components.
|
|
188
|
+
*
|
|
189
|
+
* @param metadata - The node metadata
|
|
190
|
+
* @param defaultType - Optional default type override
|
|
191
|
+
* @returns Config schema property object with oneOf for labeled options
|
|
192
|
+
*/
|
|
193
|
+
export function createNodeTypeConfigProperty(metadata, defaultType) {
|
|
194
|
+
const oneOf = getNodeTypeOneOfOptions(metadata);
|
|
195
|
+
const primaryType = defaultType ?? getPrimaryNodeType(metadata);
|
|
196
|
+
return {
|
|
197
|
+
type: 'string',
|
|
198
|
+
title: 'Node Type',
|
|
199
|
+
description: 'Choose the visual representation for this node',
|
|
200
|
+
default: primaryType,
|
|
201
|
+
oneOf
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Check if a type string represents a valid registered or built-in type.
|
|
206
|
+
*
|
|
207
|
+
* @param type - The type to check
|
|
208
|
+
* @returns true if the type is valid
|
|
209
|
+
*/
|
|
210
|
+
export function isValidNodeType(type) {
|
|
211
|
+
return isBuiltinType(type) || nodeComponentRegistry.has(type);
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Get all available node types (built-in + registered).
|
|
215
|
+
*
|
|
216
|
+
* @returns Array of all valid node type identifiers
|
|
217
|
+
*/
|
|
218
|
+
export function getAllNodeTypes() {
|
|
219
|
+
return nodeComponentRegistry.getTypes();
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Format a type name for display when no display name is registered.
|
|
223
|
+
*
|
|
224
|
+
* @param type - The raw type string
|
|
225
|
+
* @returns Formatted display name
|
|
226
|
+
*/
|
|
227
|
+
function formatTypeName(type) {
|
|
228
|
+
// Handle namespaced types (e.g., "mylib:fancy" -> "Mylib: Fancy")
|
|
229
|
+
if (type.includes(':')) {
|
|
230
|
+
const [namespace, name] = type.split(':');
|
|
231
|
+
return `${capitalize(namespace)}: ${capitalize(name)}`;
|
|
232
|
+
}
|
|
233
|
+
// Capitalize and add spaces for camelCase
|
|
234
|
+
return capitalize(type.replace(/([A-Z])/g, ' $1').trim());
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Capitalize the first letter of a string.
|
|
238
|
+
*
|
|
239
|
+
* @param str - The string to capitalize
|
|
240
|
+
* @returns Capitalized string
|
|
241
|
+
*/
|
|
242
|
+
function capitalize(str) {
|
|
243
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
244
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node Wrapper Utilities
|
|
3
|
+
* Provides utilities for wrapping nodes with status overlays
|
|
4
|
+
*/
|
|
5
|
+
import type { NodeExecutionInfo } from '../types/index.js';
|
|
6
|
+
/**
|
|
7
|
+
* Configuration for node status overlay
|
|
8
|
+
*/
|
|
9
|
+
export interface NodeStatusConfig {
|
|
10
|
+
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
11
|
+
size?: 'sm' | 'md' | 'lg';
|
|
12
|
+
showDetails?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Default configuration for node status overlays
|
|
16
|
+
*/
|
|
17
|
+
export declare const DEFAULT_NODE_STATUS_CONFIG: NodeStatusConfig;
|
|
18
|
+
/**
|
|
19
|
+
* Create a node wrapper configuration
|
|
20
|
+
*/
|
|
21
|
+
export declare function createNodeWrapperConfig(nodeId: string, executionInfo?: NodeExecutionInfo, config?: NodeStatusConfig): {
|
|
22
|
+
nodeId: string;
|
|
23
|
+
executionInfo?: NodeExecutionInfo;
|
|
24
|
+
statusPosition: NodeStatusConfig['position'];
|
|
25
|
+
statusSize: NodeStatusConfig['size'];
|
|
26
|
+
showStatusDetails: boolean;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Check if a node should show status overlay
|
|
30
|
+
*/
|
|
31
|
+
export declare function shouldShowNodeStatus(executionInfo?: NodeExecutionInfo): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Get optimal status position based on node type
|
|
34
|
+
*/
|
|
35
|
+
export declare function getOptimalStatusPosition(nodeType: string): NodeStatusConfig['position'];
|
|
36
|
+
/**
|
|
37
|
+
* Get optimal status size based on node type
|
|
38
|
+
*/
|
|
39
|
+
export declare function getOptimalStatusSize(nodeType: string): NodeStatusConfig['size'];
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node Wrapper Utilities
|
|
3
|
+
* Provides utilities for wrapping nodes with status overlays
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Default configuration for node status overlays
|
|
7
|
+
*/
|
|
8
|
+
export const DEFAULT_NODE_STATUS_CONFIG = {
|
|
9
|
+
position: 'top-right',
|
|
10
|
+
size: 'md',
|
|
11
|
+
showDetails: true
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Create a node wrapper configuration
|
|
15
|
+
*/
|
|
16
|
+
export function createNodeWrapperConfig(nodeId, executionInfo, config = {}) {
|
|
17
|
+
return {
|
|
18
|
+
nodeId,
|
|
19
|
+
executionInfo,
|
|
20
|
+
statusPosition: config.position || DEFAULT_NODE_STATUS_CONFIG.position,
|
|
21
|
+
statusSize: config.size || DEFAULT_NODE_STATUS_CONFIG.size,
|
|
22
|
+
showStatusDetails: config.showDetails ?? DEFAULT_NODE_STATUS_CONFIG.showDetails ?? true
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Check if a node should show status overlay
|
|
27
|
+
*/
|
|
28
|
+
export function shouldShowNodeStatus(executionInfo) {
|
|
29
|
+
if (!executionInfo)
|
|
30
|
+
return false;
|
|
31
|
+
return (executionInfo.status !== 'idle' || executionInfo.executionCount > 0 || executionInfo.isExecuting);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Get optimal status position based on node type
|
|
35
|
+
*/
|
|
36
|
+
export function getOptimalStatusPosition(nodeType) {
|
|
37
|
+
switch (nodeType) {
|
|
38
|
+
case 'tool':
|
|
39
|
+
return 'top-left';
|
|
40
|
+
case 'note':
|
|
41
|
+
return 'bottom-right';
|
|
42
|
+
case 'simple':
|
|
43
|
+
case 'square':
|
|
44
|
+
default:
|
|
45
|
+
return 'top-right';
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Get optimal status size based on node type
|
|
50
|
+
*/
|
|
51
|
+
export function getOptimalStatusSize(nodeType) {
|
|
52
|
+
switch (nodeType) {
|
|
53
|
+
case 'tool':
|
|
54
|
+
return 'sm';
|
|
55
|
+
case 'note':
|
|
56
|
+
return 'sm';
|
|
57
|
+
case 'simple':
|
|
58
|
+
case 'square':
|
|
59
|
+
default:
|
|
60
|
+
return 'md';
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Performance Utilities
|
|
3
|
+
* Helper functions for optimizing performance in the FlowDrop app
|
|
4
|
+
*/
|
|
5
|
+
import type { WorkflowNode, WorkflowEdge } from '../types/index.js';
|
|
6
|
+
/**
|
|
7
|
+
* Fast shallow comparison for workflow nodes
|
|
8
|
+
* Avoids expensive JSON.stringify operations
|
|
9
|
+
*/
|
|
10
|
+
export declare function areNodeArraysEqual(nodes1: WorkflowNode[], nodes2: WorkflowNode[]): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Fast shallow comparison for workflow edges
|
|
13
|
+
* Avoids expensive JSON.stringify operations
|
|
14
|
+
*/
|
|
15
|
+
export declare function areEdgeArraysEqual(edges1: WorkflowEdge[], edges2: WorkflowEdge[]): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Throttle function execution to reduce frequency
|
|
18
|
+
* Uses requestAnimationFrame for smooth UI updates
|
|
19
|
+
*/
|
|
20
|
+
export declare function throttle<T extends (...args: any[]) => void>(func: T, wait: number): (...args: Parameters<T>) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Debounce function execution to reduce frequency
|
|
23
|
+
* Waits for a pause in calls before executing
|
|
24
|
+
*/
|
|
25
|
+
export declare function debounce<T extends (...args: any[]) => void>(func: T, wait: number): (...args: Parameters<T>) => void;
|
|
26
|
+
/**
|
|
27
|
+
* RequestAnimationFrame-based throttle for smooth animations
|
|
28
|
+
* Better for visual updates like node dragging
|
|
29
|
+
*/
|
|
30
|
+
export declare function rafThrottle<T extends (...args: any[]) => void>(func: T): (...args: Parameters<T>) => void;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Performance Utilities
|
|
3
|
+
* Helper functions for optimizing performance in the FlowDrop app
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Fast shallow comparison for workflow nodes
|
|
7
|
+
* Avoids expensive JSON.stringify operations
|
|
8
|
+
*/
|
|
9
|
+
export function areNodeArraysEqual(nodes1, nodes2) {
|
|
10
|
+
if (nodes1.length !== nodes2.length)
|
|
11
|
+
return false;
|
|
12
|
+
for (let i = 0; i < nodes1.length; i++) {
|
|
13
|
+
const node1 = nodes1[i];
|
|
14
|
+
const node2 = nodes2[i];
|
|
15
|
+
// Quick ID check
|
|
16
|
+
if (node1?.id !== node2?.id)
|
|
17
|
+
return false;
|
|
18
|
+
// Check position (most common change during drag)
|
|
19
|
+
if (node1?.position?.x !== node2?.position?.x || node1?.position?.y !== node2?.position?.y) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
// Check selected state
|
|
23
|
+
if (node1?.selected !== node2?.selected)
|
|
24
|
+
return false;
|
|
25
|
+
// Skip deep config comparison unless we need to
|
|
26
|
+
// Most updates are position-based
|
|
27
|
+
}
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Fast shallow comparison for workflow edges
|
|
32
|
+
* Avoids expensive JSON.stringify operations
|
|
33
|
+
*/
|
|
34
|
+
export function areEdgeArraysEqual(edges1, edges2) {
|
|
35
|
+
if (edges1.length !== edges2.length)
|
|
36
|
+
return false;
|
|
37
|
+
for (let i = 0; i < edges1.length; i++) {
|
|
38
|
+
const edge1 = edges1[i];
|
|
39
|
+
const edge2 = edges2[i];
|
|
40
|
+
if (edge1?.id !== edge2?.id ||
|
|
41
|
+
edge1?.source !== edge2?.source ||
|
|
42
|
+
edge1?.target !== edge2?.target ||
|
|
43
|
+
edge1?.sourceHandle !== edge2?.sourceHandle ||
|
|
44
|
+
edge1?.targetHandle !== edge2?.targetHandle) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Throttle function execution to reduce frequency
|
|
52
|
+
* Uses requestAnimationFrame for smooth UI updates
|
|
53
|
+
*/
|
|
54
|
+
export function throttle(func, wait) {
|
|
55
|
+
let timeout = null;
|
|
56
|
+
let lastRan = 0;
|
|
57
|
+
return function (...args) {
|
|
58
|
+
const now = Date.now();
|
|
59
|
+
if (!lastRan || now - lastRan >= wait) {
|
|
60
|
+
func(...args);
|
|
61
|
+
lastRan = now;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
if (timeout) {
|
|
65
|
+
clearTimeout(timeout);
|
|
66
|
+
}
|
|
67
|
+
timeout = setTimeout(() => {
|
|
68
|
+
func(...args);
|
|
69
|
+
lastRan = Date.now();
|
|
70
|
+
}, wait - (now - lastRan));
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Debounce function execution to reduce frequency
|
|
76
|
+
* Waits for a pause in calls before executing
|
|
77
|
+
*/
|
|
78
|
+
export function debounce(func, wait) {
|
|
79
|
+
let timeout = null;
|
|
80
|
+
return function (...args) {
|
|
81
|
+
if (timeout) {
|
|
82
|
+
clearTimeout(timeout);
|
|
83
|
+
}
|
|
84
|
+
timeout = setTimeout(() => {
|
|
85
|
+
func(...args);
|
|
86
|
+
}, wait);
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* RequestAnimationFrame-based throttle for smooth animations
|
|
91
|
+
* Better for visual updates like node dragging
|
|
92
|
+
*/
|
|
93
|
+
export function rafThrottle(func) {
|
|
94
|
+
let rafId = null;
|
|
95
|
+
let lastArgs = null;
|
|
96
|
+
return function (...args) {
|
|
97
|
+
lastArgs = args;
|
|
98
|
+
if (rafId === null) {
|
|
99
|
+
rafId = requestAnimationFrame(() => {
|
|
100
|
+
if (lastArgs) {
|
|
101
|
+
func(...lastArgs);
|
|
102
|
+
}
|
|
103
|
+
rafId = null;
|
|
104
|
+
lastArgs = null;
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sanitize an HTML string to prevent XSS attacks.
|
|
3
|
+
*
|
|
4
|
+
* Uses DOMPurify defaults which strip dangerous elements (script, iframe, object)
|
|
5
|
+
* and event handler attributes (onerror, onclick, etc.) while preserving safe HTML
|
|
6
|
+
* elements typically produced by markdown renderers.
|
|
7
|
+
*
|
|
8
|
+
* @param dirty - The untrusted HTML string to sanitize
|
|
9
|
+
* @returns Sanitized HTML string safe for use with {@html}
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* import { sanitizeHtml } from '@flowdrop/flowdrop/core';
|
|
14
|
+
* import { marked } from 'marked';
|
|
15
|
+
*
|
|
16
|
+
* const safeHtml = sanitizeHtml(marked.parse(userInput) as string);
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function sanitizeHtml(dirty: string): string;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTML Sanitization Utility
|
|
3
|
+
*
|
|
4
|
+
* Provides XSS protection for rendered HTML content using DOMPurify.
|
|
5
|
+
* Used internally by components that render user-provided or API-provided HTML
|
|
6
|
+
* (e.g., markdown output, interrupt review diffs).
|
|
7
|
+
*
|
|
8
|
+
* @module utils/sanitize
|
|
9
|
+
*/
|
|
10
|
+
import DOMPurify from 'dompurify';
|
|
11
|
+
/**
|
|
12
|
+
* Sanitize an HTML string to prevent XSS attacks.
|
|
13
|
+
*
|
|
14
|
+
* Uses DOMPurify defaults which strip dangerous elements (script, iframe, object)
|
|
15
|
+
* and event handler attributes (onerror, onclick, etc.) while preserving safe HTML
|
|
16
|
+
* elements typically produced by markdown renderers.
|
|
17
|
+
*
|
|
18
|
+
* @param dirty - The untrusted HTML string to sanitize
|
|
19
|
+
* @returns Sanitized HTML string safe for use with {@html}
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* import { sanitizeHtml } from '@flowdrop/flowdrop/core';
|
|
24
|
+
* import { marked } from 'marked';
|
|
25
|
+
*
|
|
26
|
+
* const safeHtml = sanitizeHtml(marked.parse(userInput) as string);
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export function sanitizeHtml(dirty) {
|
|
30
|
+
return DOMPurify.sanitize(dirty);
|
|
31
|
+
}
|