windmill-components 1.70.0 → 1.75.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/assets/app.css +12 -1
- package/components/AppConnect.svelte +4 -3
- package/components/DisplayResult.svelte +27 -9
- package/components/FieldHeader.svelte +12 -8
- package/components/FlowBuilder.svelte +107 -39
- package/components/FlowBuilder.svelte.d.ts +5 -0
- package/components/FlowGraphViewer.svelte +5 -4
- package/components/FlowJobResult.svelte +3 -3
- package/components/FlowPreviewContent.svelte +3 -8
- package/components/FlowStatusViewer.svelte +21 -8
- package/components/GroupEditor.svelte +8 -0
- package/components/InputTransformForm.svelte +13 -20
- package/components/InputTransformSchemaForm.svelte +103 -0
- package/components/InputTransformSchemaForm.svelte.d.ts +24 -0
- package/components/LogViewer.svelte +1 -1
- package/components/ModulePreview.svelte +3 -2
- package/components/Multiselect.svelte +1 -1
- package/components/Path.svelte +15 -11
- package/components/Popover.svelte +2 -13
- package/components/ResourcePicker.svelte +33 -14
- package/components/RunChart.svelte +24 -5
- package/components/RunForm.svelte +5 -6
- package/components/RunForm.svelte.d.ts +1 -0
- package/components/SchemaForm.svelte +59 -57
- package/components/SchemaForm.svelte.d.ts +0 -5
- package/components/ScriptBuilder.svelte +30 -14
- package/components/ScriptPicker.svelte +3 -0
- package/components/SimpleEditor.svelte +4 -1
- package/components/SimpleEditor.svelte.d.ts +2 -0
- package/components/Slider.svelte +6 -1
- package/components/Slider.svelte.d.ts +1 -0
- package/components/TemplateEditor.svelte +1 -1
- package/components/TestJobLoader.svelte +2 -2
- package/components/Toggle.svelte +17 -4
- package/components/Toggle.svelte.d.ts +2 -0
- package/components/Tooltip.svelte +1 -1
- package/components/UserSettings.svelte +2 -0
- package/components/apps/components/buttons/AppButton.svelte +38 -22
- package/components/apps/components/buttons/AppButton.svelte.d.ts +1 -0
- package/components/apps/components/buttons/AppForm.svelte +16 -6
- package/components/apps/components/buttons/AppForm.svelte.d.ts +3 -0
- package/components/apps/components/buttons/AppFormButton.svelte +12 -4
- package/components/apps/components/buttons/AppFormButton.svelte.d.ts +3 -0
- package/components/apps/components/display/AppBarChart.svelte +15 -7
- package/components/apps/components/display/AppBarChart.svelte.d.ts +3 -0
- package/components/apps/components/display/AppDisplayComponent.svelte +17 -12
- package/components/apps/components/display/AppDisplayComponent.svelte.d.ts +1 -0
- package/components/apps/components/display/AppHtml.svelte +18 -4
- package/components/apps/components/display/AppHtml.svelte.d.ts +3 -0
- package/components/apps/components/display/AppIcon.svelte +20 -8
- package/components/apps/components/display/AppIcon.svelte.d.ts +3 -0
- package/components/apps/components/display/AppImage.svelte +17 -10
- package/components/apps/components/display/AppImage.svelte.d.ts +3 -0
- package/components/apps/components/display/AppMap.svelte +214 -0
- package/components/apps/components/display/AppMap.svelte.d.ts +23 -0
- package/components/apps/components/display/AppPdf.svelte +304 -0
- package/components/apps/components/display/AppPdf.svelte.d.ts +24 -0
- package/components/apps/components/display/AppPieChart.svelte +15 -7
- package/components/apps/components/display/AppPieChart.svelte.d.ts +3 -0
- package/components/apps/components/display/AppScatterChart.svelte +12 -4
- package/components/apps/components/display/AppScatterChart.svelte.d.ts +3 -0
- package/components/apps/components/display/AppText.svelte +38 -32
- package/components/apps/components/display/AppText.svelte.d.ts +1 -0
- package/components/apps/components/display/AppTimeseries.svelte +12 -4
- package/components/apps/components/display/AppTimeseries.svelte.d.ts +3 -0
- package/components/apps/components/display/PlotlyHtml.svelte +8 -14
- package/components/apps/components/display/PlotlyHtml.svelte.d.ts +1 -1
- package/components/apps/components/display/VegaLiteHtml.svelte +3 -8
- package/components/apps/components/display/VegaLiteHtml.svelte.d.ts +1 -0
- package/components/apps/components/display/index.d.ts +3 -0
- package/components/apps/components/display/index.js +3 -0
- package/components/apps/components/display/table/AppAggridTable.svelte +16 -7
- package/components/apps/components/display/table/AppAggridTable.svelte.d.ts +1 -0
- package/components/apps/components/display/table/AppTable.svelte +65 -20
- package/components/apps/components/display/table/AppTable.svelte.d.ts +3 -1
- package/components/apps/components/display/table/AppTableFooter.svelte +8 -1
- package/components/apps/components/display/table/AppTableFooter.svelte.d.ts +2 -0
- package/components/apps/components/helpers/AlignWrapper.svelte +13 -7
- package/components/apps/components/helpers/AlignWrapper.svelte.d.ts +3 -1
- package/components/apps/components/helpers/HiddenComponent.svelte +2 -1
- package/components/apps/components/helpers/InputValue.svelte +38 -15
- package/components/apps/components/helpers/NonRunnableComponent.svelte +18 -3
- package/components/apps/components/helpers/NonRunnableComponent.svelte.d.ts +1 -0
- package/components/apps/components/helpers/RefreshButton.svelte +1 -1
- package/components/apps/components/helpers/ResizeWrapper.svelte +24 -0
- package/components/apps/components/helpers/ResizeWrapper.svelte.d.ts +19 -0
- package/components/apps/components/helpers/RunnableComponent.svelte +76 -68
- package/components/apps/components/helpers/RunnableComponent.svelte.d.ts +3 -1
- package/components/apps/components/helpers/RunnableWrapper.svelte +9 -5
- package/components/apps/components/helpers/RunnableWrapper.svelte.d.ts +3 -1
- package/components/apps/components/inputs/AppCheckbox.svelte +8 -2
- package/components/apps/components/inputs/AppCheckbox.svelte.d.ts +3 -0
- package/components/apps/components/inputs/AppDateInput.svelte +25 -18
- package/components/apps/components/inputs/AppDateInput.svelte.d.ts +6 -1
- package/components/apps/components/inputs/AppFileInput.svelte +22 -14
- package/components/apps/components/inputs/AppFileInput.svelte.d.ts +3 -0
- package/components/apps/components/inputs/AppMultiSelect.svelte +82 -0
- package/components/apps/components/inputs/AppMultiSelect.svelte.d.ts +27 -0
- package/components/apps/components/inputs/AppNumberInput.svelte +20 -16
- package/components/apps/components/inputs/AppNumberInput.svelte.d.ts +5 -0
- package/components/apps/components/inputs/AppRangeInput.svelte +55 -14
- package/components/apps/components/inputs/AppRangeInput.svelte.d.ts +3 -0
- package/components/apps/components/inputs/AppSelect.svelte +58 -21
- package/components/apps/components/inputs/AppSelect.svelte.d.ts +3 -0
- package/components/apps/components/inputs/AppSliderInputs.svelte +41 -9
- package/components/apps/components/inputs/AppSliderInputs.svelte.d.ts +3 -0
- package/components/apps/components/inputs/AppTextInput.svelte +53 -19
- package/components/apps/components/inputs/AppTextInput.svelte.d.ts +6 -0
- package/components/apps/components/inputs/currency/AppCurrencyInput.svelte +13 -3
- package/components/apps/components/inputs/currency/AppCurrencyInput.svelte.d.ts +3 -0
- package/components/apps/components/inputs/currency/CurrencyInput.svelte +2 -0
- package/components/apps/components/inputs/currency/CurrencyInput.svelte.d.ts +1 -0
- package/components/apps/components/layout/AppContainer.svelte +21 -13
- package/components/apps/components/layout/AppContainer.svelte.d.ts +3 -0
- package/components/apps/components/layout/AppDivider.svelte +24 -4
- package/components/apps/components/layout/AppDivider.svelte.d.ts +3 -1
- package/components/apps/components/layout/AppDrawer.svelte +89 -0
- package/components/apps/components/layout/AppDrawer.svelte.d.ts +24 -0
- package/components/apps/components/layout/AppSplitpanes.svelte +88 -0
- package/components/apps/components/layout/AppSplitpanes.svelte.d.ts +26 -0
- package/components/apps/components/layout/AppTabs.svelte +62 -21
- package/components/apps/components/layout/AppTabs.svelte.d.ts +3 -0
- package/components/apps/components/layout/index.d.ts +2 -0
- package/components/apps/components/layout/index.js +2 -0
- package/components/apps/editor/AppEditor.svelte +83 -19
- package/components/apps/editor/AppEditor.svelte.d.ts +3 -1
- package/components/apps/editor/AppEditorHeader.svelte +107 -32
- package/components/apps/editor/AppInputs.svelte +3 -3
- package/components/apps/editor/AppPreview.svelte +20 -7
- package/components/apps/editor/ComponentHeader.svelte +14 -3
- package/components/apps/editor/ComponentHeader.svelte.d.ts +1 -0
- package/components/apps/editor/GridEditor.svelte +85 -71
- package/components/apps/editor/GridPanel.svelte +29 -0
- package/components/apps/editor/GridPanel.svelte.d.ts +18 -0
- package/components/apps/editor/RecomputeAllComponents.svelte +8 -6
- package/components/apps/editor/SettingsPanel.svelte +14 -24
- package/components/apps/editor/SubGridEditor.svelte +46 -18
- package/components/apps/editor/SubGridEditor.svelte.d.ts +5 -0
- package/components/apps/editor/appUtils.d.ts +12 -2
- package/components/apps/editor/appUtils.js +121 -21
- package/components/apps/editor/component/Component.svelte +282 -57
- package/components/apps/editor/component/Component.svelte.d.ts +3 -1
- package/components/apps/editor/component/ComponentNavigation.svelte +125 -0
- package/components/apps/editor/component/ComponentNavigation.svelte.d.ts +14 -0
- package/components/apps/editor/component/components.d.ts +14 -2
- package/components/apps/editor/component/components.js +417 -43
- package/components/apps/editor/component/default-codes.js +6 -6
- package/components/apps/editor/component/sets.js +11 -3
- package/components/apps/editor/componentsPanel/ComponentList.svelte +72 -29
- package/components/apps/editor/componentsPanel/CssProperty.svelte +59 -23
- package/components/apps/editor/componentsPanel/CssProperty.svelte.d.ts +2 -1
- package/components/apps/editor/componentsPanel/CssSettings.svelte +56 -9
- package/components/apps/editor/componentsPanel/ListItem.svelte +23 -12
- package/components/apps/editor/componentsPanel/componentStaticValues.d.ts +1 -0
- package/components/apps/editor/componentsPanel/componentStaticValues.js +14 -2
- package/components/apps/editor/contextPanel/ComponentOutputViewer.svelte +1 -1
- package/components/apps/editor/contextPanel/ContextPanel.svelte +107 -61
- package/components/apps/editor/inlineScriptsPanel/EmptyInlineScript.svelte +13 -3
- package/components/apps/editor/inlineScriptsPanel/EmptyInlineScript.svelte.d.ts +1 -0
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte +63 -25
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte.d.ts +5 -0
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte +11 -5
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte.d.ts +1 -0
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanel.svelte +26 -17
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelList.svelte +95 -85
- package/components/apps/editor/inlineScriptsPanel/utils.d.ts +5 -9
- package/components/apps/editor/inlineScriptsPanel/utils.js +19 -8
- package/components/apps/editor/settingsPanel/ArrayStaticInputEditor.svelte +10 -9
- package/components/apps/editor/settingsPanel/ArrayStaticInputEditor.svelte.d.ts +21 -12
- package/components/apps/editor/settingsPanel/ComponentInputTypeEditor.svelte +1 -1
- package/components/apps/editor/settingsPanel/ComponentPanel.svelte +95 -56
- package/components/apps/editor/settingsPanel/ComponentPanel.svelte.d.ts +1 -0
- package/components/apps/editor/settingsPanel/GridPane.svelte +75 -0
- package/components/apps/editor/settingsPanel/GridPane.svelte.d.ts +20 -0
- package/components/apps/editor/settingsPanel/GridTab.svelte +5 -5
- package/components/apps/editor/settingsPanel/GridTab.svelte.d.ts +2 -0
- package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte +2 -1
- package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte +1 -1
- package/components/apps/editor/settingsPanel/MoveToOtherGrid.svelte +13 -6
- package/components/apps/editor/settingsPanel/Recompute.svelte +1 -1
- package/components/apps/editor/settingsPanel/SelectedRunnable.svelte +1 -1
- package/components/apps/editor/settingsPanel/TableActions.svelte +28 -1
- package/components/apps/editor/settingsPanel/common/PanelSection.svelte +2 -2
- package/components/apps/editor/settingsPanel/inputEditor/ColorInput.svelte +48 -0
- package/components/apps/editor/settingsPanel/inputEditor/ColorInput.svelte.d.ts +19 -0
- package/components/apps/editor/settingsPanel/inputEditor/ConnectedInputEditor.svelte +1 -1
- package/components/apps/editor/settingsPanel/inputEditor/EvalInputEditor.svelte +1 -1
- package/components/apps/editor/settingsPanel/inputEditor/IconSelectInput.svelte +27 -3
- package/components/apps/editor/settingsPanel/inputEditor/IconSelectInput.svelte.d.ts +2 -0
- package/components/apps/editor/settingsPanel/inputEditor/JsonEditor.svelte +2 -2
- package/components/apps/editor/settingsPanel/inputEditor/JsonEditor.svelte.d.ts +2 -1
- package/components/apps/editor/settingsPanel/inputEditor/StaticInputEditor.svelte +54 -6
- package/components/apps/editor/settingsPanel/inputEditor/StaticInputEditor.svelte.d.ts +1 -0
- package/components/apps/editor/settingsPanel/inputEditor/UploadInputEditor.svelte +7 -9
- package/components/apps/editor/settingsPanel/inputEditor/UploadInputEditor.svelte.d.ts +1 -1
- package/components/apps/editor/settingsPanel/mainInput/InlineScriptList.svelte +1 -0
- package/components/apps/editor/settingsPanel/mainInput/InlineScriptList.svelte.d.ts +1 -0
- package/components/apps/editor/settingsPanel/mainInput/RunnableSelector.svelte +1 -1
- package/components/apps/inputType.d.ts +6 -5
- package/components/apps/rx.js +2 -1
- package/components/apps/store.d.ts +6 -1
- package/components/apps/types.d.ts +14 -4
- package/components/apps/utils.d.ts +2 -2
- package/components/apps/utils.js +21 -49
- package/components/common/button/ButtonPopup.svelte +2 -0
- package/components/common/button/ButtonPopup.svelte.d.ts +1 -0
- package/components/common/button/UndoRedo.svelte +32 -0
- package/components/common/button/UndoRedo.svelte.d.ts +20 -0
- package/components/common/drawer/Drawer.svelte +10 -4
- package/components/common/drawer/Drawer.svelte.d.ts +3 -1
- package/components/common/drawer/DrawerContent.svelte +0 -1
- package/components/common/fileInput/FileInput.svelte +47 -21
- package/components/common/fileInput/FileInput.svelte.d.ts +3 -1
- package/components/common/fileInput/model.d.ts +1 -0
- package/components/common/fileInput/model.js +1 -0
- package/components/common/index.d.ts +1 -0
- package/components/common/index.js +1 -0
- package/components/common/menu/Menu.svelte +3 -2
- package/components/common/menu/Menu.svelte.d.ts +2 -1
- package/components/common/modal/Modal.svelte +9 -4
- package/components/common/modal/Modal.svelte.d.ts +2 -0
- package/components/common/table/AppRow.svelte +13 -4
- package/components/common/table/AppRow.svelte.d.ts +1 -0
- package/components/common/table/FlowRow.svelte +21 -8
- package/components/common/table/FlowRow.svelte.d.ts +1 -0
- package/components/common/table/ScriptRow.svelte +42 -10
- package/components/common/table/ScriptRow.svelte.d.ts +1 -0
- package/components/common/tabs/Tab.svelte +12 -5
- package/components/common/tabs/Tab.svelte.d.ts +4 -1
- package/components/common/tabs/Tabs.svelte +8 -6
- package/components/common/tabs/Tabs.svelte.d.ts +3 -1
- package/components/flows/FlowEditor.svelte +6 -4
- package/components/flows/common/FlowCardHeader.svelte +4 -1
- package/components/flows/content/BranchPredicateEditor.svelte +3 -4
- package/components/flows/content/CapturePayload.svelte +1 -2
- package/components/flows/content/FlowBranchesAllWrapper.svelte +1 -1
- package/components/flows/content/FlowConstants.svelte +7 -13
- package/components/flows/content/FlowEditorPanel.svelte +4 -3
- package/components/flows/content/FlowFailureModule.svelte +2 -1
- package/components/flows/content/FlowInput.svelte +4 -2
- package/components/flows/content/FlowLoop.svelte +3 -4
- package/components/flows/content/FlowModuleComponent.svelte +23 -11
- package/components/flows/content/FlowModuleEarlyStop.svelte +3 -1
- package/components/flows/content/FlowModuleHeader.svelte +26 -3
- package/components/flows/content/FlowModuleHeader.svelte.d.ts +1 -0
- package/components/flows/content/FlowModuleSleep.svelte +2 -2
- package/components/flows/content/FlowModuleWrapper.svelte +2 -8
- package/components/flows/content/FlowSchedules.svelte +1 -2
- package/components/flows/content/FlowSettings.svelte +17 -37
- package/components/flows/content/ScriptEditorDrawer.svelte +98 -0
- package/components/flows/content/ScriptEditorDrawer.svelte.d.ts +19 -0
- package/components/flows/flowState.d.ts +2 -3
- package/components/flows/flowState.js +1 -4
- package/components/flows/flowStateUtils.d.ts +7 -6
- package/components/flows/flowStateUtils.js +5 -9
- package/components/flows/flowStore.d.ts +5 -4
- package/components/flows/flowStore.js +5 -17
- package/components/flows/header/FlowImportExportMenu.svelte +2 -1
- package/components/flows/map/FlowConstantsItem.svelte +2 -2
- package/components/flows/map/FlowErrorHandlerItem.svelte +12 -13
- package/components/flows/map/FlowInputsItem.svelte +2 -3
- package/components/flows/map/FlowModuleSchemaItem.svelte +88 -91
- package/components/flows/map/FlowModuleSchemaItem.svelte.d.ts +3 -3
- package/components/flows/map/FlowModuleSchemaMap.svelte +164 -138
- package/components/flows/map/FlowModuleSchemaMap.svelte.d.ts +1 -2
- package/components/flows/map/FlowSettingsItem.svelte +5 -4
- package/components/flows/map/InsertModuleButton.svelte +12 -10
- package/components/flows/map/InsertModuleButton.svelte.d.ts +1 -0
- package/components/flows/map/MapItem.svelte +176 -103
- package/components/flows/map/MapItem.svelte.d.ts +20 -2
- package/components/flows/map/VirtualItem.svelte +129 -0
- package/components/flows/map/VirtualItem.svelte.d.ts +44 -0
- package/components/flows/pickers/WorkspaceScriptPicker.svelte +1 -1
- package/components/flows/previousResults.d.ts +1 -1
- package/components/flows/previousResults.js +32 -17
- package/components/flows/types.d.ts +13 -1
- package/components/flows/utils.js +1 -1
- package/components/graph/FlowGraph.svelte +227 -167
- package/components/graph/FlowGraph.svelte.d.ts +14 -1
- package/components/graph/model.d.ts +6 -36
- package/components/graph/model.js +1 -1
- package/components/graph/svelvet/LICENSE +21 -0
- package/components/graph/svelvet/collapsible/controllers/util.d.ts +15 -0
- package/components/graph/svelvet/collapsible/controllers/util.js +144 -0
- package/components/graph/svelvet/collapsible/models/Collapsible.d.ts +17 -0
- package/components/graph/svelvet/collapsible/models/Collapsible.js +25 -0
- package/components/graph/svelvet/collapsible/types/types.d.ts +8 -0
- package/components/graph/svelvet/collapsible/types/types.js +1 -0
- package/components/graph/svelvet/container/README.md +7 -0
- package/components/graph/svelvet/container/controllers/middleware.d.ts +18 -0
- package/components/graph/svelvet/container/controllers/middleware.js +101 -0
- package/components/graph/svelvet/container/views/GraphView.svelte +252 -0
- package/components/graph/svelvet/container/views/GraphView.svelte.d.ts +25 -0
- package/components/graph/svelvet/container/views/Svelvet.svelte +131 -0
- package/components/graph/svelvet/container/views/Svelvet.svelte.d.ts +41 -0
- package/components/graph/svelvet/customCss/controllers/getCss.d.ts +2 -0
- package/components/graph/svelvet/customCss/controllers/getCss.js +57 -0
- package/components/graph/svelvet/d3/controllers/README.md +3 -0
- package/components/graph/svelvet/d3/controllers/d3.d.ts +5 -0
- package/components/graph/svelvet/d3/controllers/d3.js +59 -0
- package/components/graph/svelvet/d3/controllers/d3Old.d.ts +1 -0
- package/components/graph/svelvet/d3/controllers/d3Old.js +43 -0
- package/components/graph/svelvet/docs/CHANGELOG.md +145 -0
- package/components/graph/svelvet/docs/DESIGN_PATTERNS.md +44 -0
- package/components/graph/svelvet/docs/DOCUMENTATION.md +5 -0
- package/components/graph/svelvet/docs/README.md +34 -0
- package/components/graph/svelvet/docs/TODO.md +14 -0
- package/components/graph/svelvet/docs/Tutorials.md +25 -0
- package/components/graph/svelvet/docs/images/css-background-after.png +0 -0
- package/components/graph/svelvet/docs/images/css-background-before.png +0 -0
- package/components/graph/svelvet/docs/images/custom-edges-after.png +0 -0
- package/components/graph/svelvet/docs/images/custom-edges-before.png +0 -0
- package/components/graph/svelvet/docs/images/custom-nodes-after.png +0 -0
- package/components/graph/svelvet/docs/images/custom-nodes-before.png +0 -0
- package/components/graph/svelvet/docs/images/custom-svelte-components-after.png +0 -0
- package/components/graph/svelvet/docs/images/custom-svelte-components-before.png +0 -0
- package/components/graph/svelvet/docs/images/html-docs-after.png +0 -0
- package/components/graph/svelvet/docs/images/html-docs-before.png +0 -0
- package/components/graph/svelvet/docs/images/minimap-after.png +0 -0
- package/components/graph/svelvet/docs/images/minimap-before.png +0 -0
- package/components/graph/svelvet/docs/images/node-classes-after.png +0 -0
- package/components/graph/svelvet/docs/images/node-classes-before.png +0 -0
- package/components/graph/svelvet/docs/images/node-create-after.png +0 -0
- package/components/graph/svelvet/docs/images/node-create-before.png +0 -0
- package/components/graph/svelvet/edges/controllers/anchorCbDev.d.ts +4 -0
- package/components/graph/svelvet/edges/controllers/anchorCbDev.js +92 -0
- package/components/graph/svelvet/edges/controllers/anchorCbUser.d.ts +57 -0
- package/components/graph/svelvet/edges/controllers/anchorCbUser.js +73 -0
- package/components/graph/svelvet/edges/controllers/util.d.ts +37 -0
- package/components/graph/svelvet/edges/controllers/util.js +72 -0
- package/components/graph/svelvet/edges/models/Anchor.d.ts +48 -0
- package/components/graph/svelvet/edges/models/Anchor.js +122 -0
- package/components/graph/svelvet/edges/models/Edge.d.ts +47 -0
- package/components/graph/svelvet/edges/models/Edge.js +107 -0
- package/components/graph/svelvet/edges/types/types.d.ts +18 -0
- package/components/graph/svelvet/edges/types/types.js +1 -0
- package/components/graph/svelvet/edges/views/Edges/BaseEdge.svelte +105 -0
- package/components/graph/svelvet/edges/views/Edges/BaseEdge.svelte.d.ts +18 -0
- package/components/graph/svelvet/edges/views/Edges/EdgeAnchor.svelte +12 -0
- package/components/graph/svelvet/edges/views/Edges/EdgeAnchor.svelte.d.ts +17 -0
- package/components/graph/svelvet/edges/views/Edges/EdgeText.svelte +43 -0
- package/components/graph/svelvet/edges/views/Edges/EdgeText.svelte.d.ts +17 -0
- package/components/graph/svelvet/edges/views/Edges/SimpleBezierEdge.svelte +137 -0
- package/components/graph/svelvet/edges/views/Edges/SimpleBezierEdge.svelte.d.ts +17 -0
- package/components/graph/svelvet/edges/views/Edges/SmoothStepEdge.svelte +176 -0
- package/components/graph/svelvet/edges/views/Edges/SmoothStepEdge.svelte.d.ts +60 -0
- package/components/graph/svelvet/edges/views/Edges/StepEdge.svelte +8 -0
- package/components/graph/svelvet/edges/views/Edges/StepEdge.svelte.d.ts +25 -0
- package/components/graph/svelvet/edges/views/Edges/types.d.ts +52 -0
- package/components/graph/svelvet/edges/views/Edges/types.js +1 -0
- package/components/graph/svelvet/edges/views/Edges/utils.d.ts +33 -0
- package/components/graph/svelvet/edges/views/Edges/utils.js +31 -0
- package/components/graph/svelvet/editEdges/views/EditEdge.svelte +151 -0
- package/components/graph/svelvet/editEdges/views/EditEdge.svelte.d.ts +20 -0
- package/components/graph/svelvet/nodes/controllers/util.d.ts +9 -0
- package/components/graph/svelvet/nodes/controllers/util.js +13 -0
- package/components/graph/svelvet/nodes/models/Node.d.ts +78 -0
- package/components/graph/svelvet/nodes/models/Node.js +195 -0
- package/components/graph/svelvet/nodes/views/EditNode.svelte +147 -0
- package/components/graph/svelvet/nodes/views/EditNode.svelte.d.ts +33 -0
- package/components/graph/svelvet/nodes/views/Node.svelte +85 -0
- package/components/graph/svelvet/nodes/views/Node.svelte.d.ts +22 -0
- package/components/graph/svelvet/resizableNodes/controllers/util.d.ts +11 -0
- package/components/graph/svelvet/resizableNodes/controllers/util.js +24 -0
- package/components/graph/svelvet/resizableNodes/models/ResizeNode.d.ts +33 -0
- package/components/graph/svelvet/resizableNodes/models/ResizeNode.js +71 -0
- package/components/graph/svelvet/resizableNodes/views/ResizeNode.svelte +81 -0
- package/components/graph/svelvet/resizableNodes/views/ResizeNode.svelte.d.ts +20 -0
- package/components/graph/svelvet/store/controllers/storeApi.d.ts +32 -0
- package/components/graph/svelvet/store/controllers/storeApi.js +111 -0
- package/components/graph/svelvet/store/controllers/userApi.d.ts +3 -0
- package/components/graph/svelvet/store/controllers/userApi.js +18 -0
- package/components/graph/svelvet/store/controllers/util.d.ts +31 -0
- package/components/graph/svelvet/store/controllers/util.js +180 -0
- package/components/graph/svelvet/store/models/store.d.ts +12 -0
- package/components/graph/svelvet/store/models/store.js +9 -0
- package/components/graph/svelvet/store/types/types.d.ts +134 -0
- package/components/graph/svelvet/store/types/types.js +1 -0
- package/components/graph/svelvet/types/README.md +3 -0
- package/components/graph/svelvet/types/index.d.ts +2 -0
- package/components/graph/svelvet/types/index.js +1 -0
- package/components/graph/svelvet/types/types.d.ts +49 -0
- package/components/graph/svelvet/types/types.js +18 -0
- package/components/graph/util.js +2 -2
- package/components/home/ItemsList.svelte +53 -5
- package/components/home/ItemsList.svelte.d.ts +1 -0
- package/components/home/ListFilters.svelte +7 -2
- package/components/jobs/JobDetail.svelte +12 -1
- package/components/propertyPicker/ObjectViewer.svelte +6 -4
- package/consts.d.ts +1 -0
- package/consts.js +1 -0
- package/defaults.d.ts +4 -0
- package/defaults.js +4 -0
- package/history.d.ts +9 -0
- package/history.js +56 -0
- package/package.json +92 -8
- package/script_helpers.d.ts +1 -1
- package/script_helpers.js +1 -0
- package/scripts.d.ts +1 -1
- package/scripts.js +8 -1
- package/utils.d.ts +9 -4
- package/utils.js +44 -8
- package/components/apps/editor/TablePanel.svelte +0 -19
- package/components/apps/editor/TablePanel.svelte.d.ts +0 -17
- package/components/flows/map/FlowBranchAllMap.svelte +0 -100
- package/components/flows/map/FlowBranchAllMap.svelte.d.ts +0 -17
- package/components/flows/map/FlowBranchOneMap.svelte +0 -124
- package/components/flows/map/FlowBranchOneMap.svelte.d.ts +0 -17
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { findStore } from '../../store/controllers/storeApi';
|
|
2
|
+
import { stores } from '../../store/models/store';
|
|
3
|
+
import { getAnchors, getAnchorFromEdge } from '../../edges/controllers/util';
|
|
4
|
+
/**
|
|
5
|
+
* Class Edge that implements EdgeType.
|
|
6
|
+
* @param id The id of the Edge
|
|
7
|
+
* @param sourceX The X coordinate of the source Anchor
|
|
8
|
+
* @param sourceY The Y coordinate of the source Anchor
|
|
9
|
+
* @param targetX The X coordinate of the target Anchor
|
|
10
|
+
* @param targetY The Y coordinate of the target Anchor
|
|
11
|
+
* @param canvasId The canvasId of the Svelvet component that holds the instantiated Edge
|
|
12
|
+
* @param label The label of the Edge
|
|
13
|
+
* @param type The type of the Edge (options: 'straight', 'smoothstep', 'step', or 'bezier'). If user doesn't specify, the type will default to 'bezier'.
|
|
14
|
+
* @param labelBgColor The background color of the Edge label
|
|
15
|
+
* @param labelTextColor The text color of the Edge label
|
|
16
|
+
* @param edgeColor The color of the Edge
|
|
17
|
+
* @param animate Boolean value to specify whether the Edge should be animated
|
|
18
|
+
* @param noHandle Boolean value but looks like it is already depracated and can be removed without damage
|
|
19
|
+
* @param arraw Boolean value to specify whether the Edge displays an arrow near its target Anchor
|
|
20
|
+
*/
|
|
21
|
+
export class Edge {
|
|
22
|
+
id;
|
|
23
|
+
sourceX;
|
|
24
|
+
sourceY;
|
|
25
|
+
targetX;
|
|
26
|
+
targetY;
|
|
27
|
+
canvasId;
|
|
28
|
+
label;
|
|
29
|
+
type;
|
|
30
|
+
labelBgColor;
|
|
31
|
+
labelTextColor;
|
|
32
|
+
edgeColor;
|
|
33
|
+
animate;
|
|
34
|
+
noHandle;
|
|
35
|
+
arrow;
|
|
36
|
+
clickCallback;
|
|
37
|
+
className;
|
|
38
|
+
constructor(id, sourceX, sourceY, targetX, targetY, canvasId, label, type, labelBgColor, labelTextColor, edgeColor, animate, noHandle, arrow, clickCallback, className) {
|
|
39
|
+
this.id = id;
|
|
40
|
+
this.sourceX = sourceX;
|
|
41
|
+
this.sourceY = sourceY;
|
|
42
|
+
this.targetX = targetX;
|
|
43
|
+
this.targetY = targetY;
|
|
44
|
+
this.canvasId = canvasId;
|
|
45
|
+
this.label = label;
|
|
46
|
+
this.type = type;
|
|
47
|
+
this.labelBgColor = labelBgColor;
|
|
48
|
+
this.labelTextColor = labelTextColor;
|
|
49
|
+
this.edgeColor = edgeColor;
|
|
50
|
+
this.animate = animate;
|
|
51
|
+
this.noHandle = noHandle;
|
|
52
|
+
this.arrow = arrow;
|
|
53
|
+
this.clickCallback = clickCallback;
|
|
54
|
+
this.className = className;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* delete is going to delete the Edge and also delete associated Anchors
|
|
58
|
+
*/
|
|
59
|
+
delete() {
|
|
60
|
+
const store = stores[this.canvasId];
|
|
61
|
+
const { nodesStore, anchorsStore, edgesStore } = store;
|
|
62
|
+
const sourceAnchor = getAnchorFromEdge(store, this.id, 'source'); // this is a bit wasteful
|
|
63
|
+
const targetAnchor = getAnchorFromEdge(store, this.id, 'target');
|
|
64
|
+
anchorsStore.update((anchors) => {
|
|
65
|
+
for (const anchorId in anchors) {
|
|
66
|
+
if (anchorId === sourceAnchor.id || anchorId == targetAnchor.id)
|
|
67
|
+
delete anchors[anchorId];
|
|
68
|
+
}
|
|
69
|
+
return { ...anchors };
|
|
70
|
+
});
|
|
71
|
+
edgesStore.update((edges) => {
|
|
72
|
+
delete edges[this.id];
|
|
73
|
+
return { ...edges };
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* setExportableData will construct an object that holds all the edge data that can be exported. This is needed for the Exporting Diagram feature.
|
|
78
|
+
* @returns The object of exportable edge data. The format of the object should be as close as what user initially passes in to Svelvet.
|
|
79
|
+
*/
|
|
80
|
+
setExportableData() {
|
|
81
|
+
const exportableData = {
|
|
82
|
+
id: this.id,
|
|
83
|
+
label: this.label,
|
|
84
|
+
type: this.type,
|
|
85
|
+
labelBgColor: this.labelBgColor,
|
|
86
|
+
labelTextColor: this.labelTextColor,
|
|
87
|
+
edgeColor: this.edgeColor,
|
|
88
|
+
animate: this.animate,
|
|
89
|
+
noHandle: this.noHandle,
|
|
90
|
+
arrow: this.arrow,
|
|
91
|
+
source: 'dummy',
|
|
92
|
+
target: 'dummy', // these will be set later
|
|
93
|
+
};
|
|
94
|
+
// set source, target on exportableData
|
|
95
|
+
const store = findStore(this.canvasId);
|
|
96
|
+
const anchors = getAnchors(store, { edgeId: this.id });
|
|
97
|
+
if (anchors.length !== 2)
|
|
98
|
+
throw 'there should be two anchors per edge';
|
|
99
|
+
for (const anchor of anchors) {
|
|
100
|
+
if (anchor.sourceOrTarget === 'target')
|
|
101
|
+
exportableData.target = anchor.nodeId;
|
|
102
|
+
if (anchor.sourceOrTarget === 'source')
|
|
103
|
+
exportableData.source = anchor.nodeId;
|
|
104
|
+
}
|
|
105
|
+
return exportableData;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type AnchorCbType = {
|
|
2
|
+
(): void;
|
|
3
|
+
type: 'dynamic' | 'fixed';
|
|
4
|
+
};
|
|
5
|
+
export interface AnchorType {
|
|
6
|
+
id: string;
|
|
7
|
+
nodeId: string;
|
|
8
|
+
edgeId: string;
|
|
9
|
+
sourceOrTarget: 'source' | 'target';
|
|
10
|
+
positionX: number;
|
|
11
|
+
positionY: number;
|
|
12
|
+
callback: AnchorCbType;
|
|
13
|
+
angle: number;
|
|
14
|
+
setPositionFromNode: Function;
|
|
15
|
+
setPosition: Function;
|
|
16
|
+
updateEdges: Function;
|
|
17
|
+
getOtherAnchorId: Function;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
<script>import { findStore } from '../../../store/controllers/storeApi';
|
|
2
|
+
import { getEdgeById } from '../../../edges/controllers/util';
|
|
3
|
+
import EdgeText from '../Edges/EdgeText.svelte';
|
|
4
|
+
import { get } from 'svelte/store';
|
|
5
|
+
export let baseEdgeProps;
|
|
6
|
+
export let canvasId;
|
|
7
|
+
// destructuring the props passed in from the parent component
|
|
8
|
+
$: ({ path, animate, arrow, label, labelBgColor, labelTextColor, edgeColor, centerX, centerY } =
|
|
9
|
+
baseEdgeProps);
|
|
10
|
+
// setting edge text props
|
|
11
|
+
$: edgeTextProps = {
|
|
12
|
+
label: label,
|
|
13
|
+
labelBgColor: labelBgColor,
|
|
14
|
+
labelTextColor: labelTextColor,
|
|
15
|
+
centerX: centerX,
|
|
16
|
+
centerY: centerY
|
|
17
|
+
};
|
|
18
|
+
// Click event handlers
|
|
19
|
+
// At some point in the future, it would be good to refactor event handling to use the flux architecture
|
|
20
|
+
// ie, events will create an action that will be dispatched to some centralized reducer.
|
|
21
|
+
// or in other words, the creators of Redux knew what they were doing.
|
|
22
|
+
// The advantage of this re-design would be greater modularity; views would be agnostic to the exact features implmemented,
|
|
23
|
+
// and they would be only responsible to detecting events and dispatch actions.
|
|
24
|
+
const edgeId = baseEdgeProps.id;
|
|
25
|
+
const store = findStore(canvasId);
|
|
26
|
+
const edge = getEdgeById(store, edgeId);
|
|
27
|
+
const highlightEdgesOption = get(store.highlightEdgesOption);
|
|
28
|
+
const handleRightClick = () => {
|
|
29
|
+
const store = findStore(canvasId);
|
|
30
|
+
const { editableOption } = store;
|
|
31
|
+
// handles edgeEdit feature
|
|
32
|
+
if (get(editableOption))
|
|
33
|
+
store.edgeEditModal.set(edgeId);
|
|
34
|
+
};
|
|
35
|
+
const handleClick = () => {
|
|
36
|
+
const store = findStore(canvasId);
|
|
37
|
+
const edge = getEdgeById(store, edgeId);
|
|
38
|
+
// handles edge clickCallback feature
|
|
39
|
+
if (edge.clickCallback)
|
|
40
|
+
edge.clickCallback(edge);
|
|
41
|
+
console.log(edge.className);
|
|
42
|
+
};
|
|
43
|
+
const defaultArrow = `0 0, 9 4.5, 0 9`;
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<defs>
|
|
47
|
+
<marker id="arrow" markerWidth="9" markerHeight="9" refX="8" refY="4" orient="auto">
|
|
48
|
+
<polygon points={defaultArrow} fill="gray" />
|
|
49
|
+
</marker>
|
|
50
|
+
</defs>
|
|
51
|
+
|
|
52
|
+
<!-- This is an invisible edge that is used to implement event events, because the visible edge is thin and hard to click on. It
|
|
53
|
+
highlights on hover -->
|
|
54
|
+
{#if highlightEdgesOption}
|
|
55
|
+
<path
|
|
56
|
+
id={`edgeSelector`}
|
|
57
|
+
d={path}
|
|
58
|
+
fill="transparent"
|
|
59
|
+
stroke={'red'}
|
|
60
|
+
stroke-opacity="0"
|
|
61
|
+
stroke-width="10"
|
|
62
|
+
on:contextmenu={handleRightClick}
|
|
63
|
+
on:click={handleClick}
|
|
64
|
+
on:keypress={() => {}}
|
|
65
|
+
/>
|
|
66
|
+
{/if}
|
|
67
|
+
|
|
68
|
+
{#if arrow}
|
|
69
|
+
<path
|
|
70
|
+
class={animate ? `animate ${edge.className}` : `${edge.className}`}
|
|
71
|
+
d={path}
|
|
72
|
+
fill="transparent"
|
|
73
|
+
stroke={edgeColor ? edgeColor : 'gray'}
|
|
74
|
+
marker-end="url(#arrow)"
|
|
75
|
+
aria-label="svg-path"
|
|
76
|
+
/>
|
|
77
|
+
{:else}
|
|
78
|
+
<path
|
|
79
|
+
class={animate ? `animate ${edge.className}` : `${edge.className}`}
|
|
80
|
+
d={path}
|
|
81
|
+
fill="transparent"
|
|
82
|
+
stroke={edgeColor ? edgeColor : 'gray'}
|
|
83
|
+
aria-label="svg-path"
|
|
84
|
+
/>
|
|
85
|
+
{/if}
|
|
86
|
+
|
|
87
|
+
{#if edgeTextProps.label}
|
|
88
|
+
<EdgeText {edgeTextProps} />
|
|
89
|
+
{/if}
|
|
90
|
+
|
|
91
|
+
<style>
|
|
92
|
+
.animate {
|
|
93
|
+
stroke-dasharray: 5;
|
|
94
|
+
animation: dash 50000s linear;
|
|
95
|
+
}
|
|
96
|
+
@keyframes dash {
|
|
97
|
+
from {
|
|
98
|
+
stroke-dashoffset: 1000000;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
#edgeSelector:hover {
|
|
103
|
+
stroke: 'red';
|
|
104
|
+
stroke-opacity: 0.5;
|
|
105
|
+
}</style>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { EdgeProps } from '../Edges/types';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
baseEdgeProps: EdgeProps;
|
|
6
|
+
canvasId: any;
|
|
7
|
+
};
|
|
8
|
+
events: {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
};
|
|
11
|
+
slots: {};
|
|
12
|
+
};
|
|
13
|
+
export type BaseEdgeProps = typeof __propDef.props;
|
|
14
|
+
export type BaseEdgeEvents = typeof __propDef.events;
|
|
15
|
+
export type BaseEdgeSlots = typeof __propDef.slots;
|
|
16
|
+
export default class BaseEdge extends SvelteComponentTyped<BaseEdgeProps, BaseEdgeEvents, BaseEdgeSlots> {
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {};
|
|
11
|
+
};
|
|
12
|
+
export type EdgeAnchorProps = typeof __propDef.props;
|
|
13
|
+
export type EdgeAnchorEvents = typeof __propDef.events;
|
|
14
|
+
export type EdgeAnchorSlots = typeof __propDef.slots;
|
|
15
|
+
export default class EdgeAnchor extends SvelteComponentTyped<EdgeAnchorProps, EdgeAnchorEvents, EdgeAnchorSlots> {
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script>// destructuring props to pass into BaseEdge component
|
|
2
|
+
export let edgeTextProps;
|
|
3
|
+
$: ({ label, labelBgColor, labelTextColor, centerX, centerY } =
|
|
4
|
+
edgeTextProps);
|
|
5
|
+
const shiftRectY = 7;
|
|
6
|
+
$: pxRatio = label.length < 3 ? 9 : 7;
|
|
7
|
+
// determine the center point of the edge to be used in the EdgeText component
|
|
8
|
+
$: textCenterX = centerX;
|
|
9
|
+
$: textCenterY = centerY;
|
|
10
|
+
// determine width of rect to render based on label.length (removing spaces)
|
|
11
|
+
// pxRatio is an estimate of how many pixels 1 character might take up
|
|
12
|
+
// pxRatio not 100% accurate as font is not monospace
|
|
13
|
+
$: spaces = label.split(' ').length - 1;
|
|
14
|
+
$: newLength = label.length - spaces;
|
|
15
|
+
$: labelPx = newLength * pxRatio;
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
{#if typeof label === 'undefined' || !label}
|
|
19
|
+
{null}
|
|
20
|
+
{:else}
|
|
21
|
+
<g>
|
|
22
|
+
<rect
|
|
23
|
+
class="EdgeTextBg"
|
|
24
|
+
data-testid="edge-text-bg"
|
|
25
|
+
fill={labelBgColor ? labelBgColor : 'white'}
|
|
26
|
+
x={textCenterX - labelPx / 2}
|
|
27
|
+
y={textCenterY - shiftRectY}
|
|
28
|
+
width={labelPx}
|
|
29
|
+
height={16}
|
|
30
|
+
/>
|
|
31
|
+
<text
|
|
32
|
+
class="EdgeText"
|
|
33
|
+
x={textCenterX}
|
|
34
|
+
y={textCenterY}
|
|
35
|
+
font-size="12px"
|
|
36
|
+
dominant-baseline="central"
|
|
37
|
+
text-anchor="middle"
|
|
38
|
+
fill={labelTextColor ? labelTextColor : 'black'}
|
|
39
|
+
>
|
|
40
|
+
{label}
|
|
41
|
+
</text>
|
|
42
|
+
</g>
|
|
43
|
+
{/if}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { EdgeTextProps } from './types';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
edgeTextProps: EdgeTextProps;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {};
|
|
11
|
+
};
|
|
12
|
+
export type EdgeTextProps = typeof __propDef.props;
|
|
13
|
+
export type EdgeTextEvents = typeof __propDef.events;
|
|
14
|
+
export type EdgeTextSlots = typeof __propDef.slots;
|
|
15
|
+
export default class EdgeText extends SvelteComponentTyped<EdgeTextProps, EdgeTextEvents, EdgeTextSlots> {
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
<script>import BaseEdge from './BaseEdge.svelte';
|
|
2
|
+
// import { Position } from '../types/utils';
|
|
3
|
+
// // enumerable values (static) set for Position
|
|
4
|
+
// export var Position;
|
|
5
|
+
// (function (Position) {
|
|
6
|
+
// Position["Left"] = "left";
|
|
7
|
+
// Position["Right"] = "right";
|
|
8
|
+
// Position["Top"] = "top";
|
|
9
|
+
// Position["Bottom"] = "bottom";
|
|
10
|
+
// })(Position || (Position = {}));
|
|
11
|
+
// //
|
|
12
|
+
// // export type CoordinateExtent = [[number, number], [number, number]];
|
|
13
|
+
const Position = { Left: 'left', Right: 'right', Top: 'top', Bottom: 'bottom' };
|
|
14
|
+
import { findStore } from '../../../store/controllers/storeApi';
|
|
15
|
+
import { getAnchorFromEdge } from '../../../edges/controllers/util';
|
|
16
|
+
function calculateControlOffset(distance, curvature) {
|
|
17
|
+
if (distance >= 0) {
|
|
18
|
+
return 0.5 * distance;
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
return curvature * 25 * Math.sqrt(-distance);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
// get the control point for the bezier curve (in the middle of the edge)
|
|
25
|
+
function getControlWithCurvature({ pos, x1, y1, x2, y2, c }) {
|
|
26
|
+
let ctX, ctY;
|
|
27
|
+
switch (pos) {
|
|
28
|
+
case Position.Left:
|
|
29
|
+
{
|
|
30
|
+
ctX = x1 - calculateControlOffset(x1 - x2, c);
|
|
31
|
+
ctY = y1;
|
|
32
|
+
}
|
|
33
|
+
break;
|
|
34
|
+
case Position.Right:
|
|
35
|
+
{
|
|
36
|
+
ctX = x1 + calculateControlOffset(x2 - x1, c);
|
|
37
|
+
ctY = y1;
|
|
38
|
+
}
|
|
39
|
+
break;
|
|
40
|
+
case Position.Top:
|
|
41
|
+
{
|
|
42
|
+
ctX = x1;
|
|
43
|
+
ctY = y1 - calculateControlOffset(y1 - y2, c);
|
|
44
|
+
}
|
|
45
|
+
break;
|
|
46
|
+
case Position.Bottom:
|
|
47
|
+
{
|
|
48
|
+
ctX = x1;
|
|
49
|
+
ctY = y1 + calculateControlOffset(y2 - y1, c);
|
|
50
|
+
}
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
return [ctX, ctY];
|
|
54
|
+
}
|
|
55
|
+
// returns string to pass into edge 'path' svg d attribute (where to be drawn)
|
|
56
|
+
// referenced from ReactFlow.dev
|
|
57
|
+
function getSimpleBezierPath({ sourceX, sourceY, sourcePosition = Position.Bottom, targetX, targetY, targetPosition = Position.Top, curvature = 0.25 }) {
|
|
58
|
+
const [sourceControlX, sourceControlY] = getControlWithCurvature({
|
|
59
|
+
pos: sourcePosition,
|
|
60
|
+
x1: sourceX,
|
|
61
|
+
y1: sourceY,
|
|
62
|
+
x2: targetX,
|
|
63
|
+
y2: targetY,
|
|
64
|
+
c: curvature
|
|
65
|
+
});
|
|
66
|
+
const [targetControlX, targetControlY] = getControlWithCurvature({
|
|
67
|
+
pos: targetPosition,
|
|
68
|
+
x1: targetX,
|
|
69
|
+
y1: targetY,
|
|
70
|
+
x2: sourceX,
|
|
71
|
+
y2: sourceY,
|
|
72
|
+
c: curvature
|
|
73
|
+
});
|
|
74
|
+
return `M${sourceX},${sourceY} C${sourceControlX},${sourceControlY} ${targetControlX},${targetControlY} ${targetX},${targetY}`;
|
|
75
|
+
}
|
|
76
|
+
// determining center of the bezier curve to know where to place the bezier edge text label
|
|
77
|
+
function getSimpleBezierCenter({ sourceX, sourceY, sourcePosition = Position.Bottom, targetX, targetY, targetPosition = Position.Top, curvature = 0.25 }) {
|
|
78
|
+
const [sourceControlX, sourceControlY] = getControlWithCurvature({
|
|
79
|
+
pos: sourcePosition,
|
|
80
|
+
x1: sourceX,
|
|
81
|
+
y1: sourceY,
|
|
82
|
+
x2: targetX,
|
|
83
|
+
y2: targetY,
|
|
84
|
+
c: curvature
|
|
85
|
+
});
|
|
86
|
+
const [targetControlX, targetControlY] = getControlWithCurvature({
|
|
87
|
+
pos: targetPosition,
|
|
88
|
+
x1: targetX,
|
|
89
|
+
y1: targetY,
|
|
90
|
+
x2: sourceX,
|
|
91
|
+
y2: sourceY,
|
|
92
|
+
c: curvature
|
|
93
|
+
});
|
|
94
|
+
// cubic bezier t=0.5 mid point, not the actual mid point, but easy to calculate
|
|
95
|
+
// https://stackoverflow.com/questions/67516101/how-to-find-distance-mid-point-of-bezier-curve
|
|
96
|
+
const centerX = sourceX * 0.125 + sourceControlX * 0.375 + targetControlX * 0.375 + targetX * 0.125;
|
|
97
|
+
const centerY = sourceY * 0.125 + sourceControlY * 0.375 + targetControlY * 0.375 + targetY * 0.125;
|
|
98
|
+
const xOffset = Math.abs(centerX - sourceX);
|
|
99
|
+
const yOffset = Math.abs(centerY - sourceY);
|
|
100
|
+
return [centerX, centerY, xOffset, yOffset];
|
|
101
|
+
}
|
|
102
|
+
export let canvasId;
|
|
103
|
+
export let edgeId;
|
|
104
|
+
const store = findStore(canvasId);
|
|
105
|
+
const { nodesStore, edgesStore, anchorsStore } = store;
|
|
106
|
+
let edge;
|
|
107
|
+
$: edge = $edgesStore[edgeId];
|
|
108
|
+
let params;
|
|
109
|
+
$: {
|
|
110
|
+
const store = findStore(canvasId);
|
|
111
|
+
const sourceAnchor = getAnchorFromEdge(store, edge.id, 'source');
|
|
112
|
+
const targetAnchor = getAnchorFromEdge(store, edge.id, 'target');
|
|
113
|
+
const mapAngle = { 0: 'right', 90: 'top', 180: 'left', 270: 'bottom' };
|
|
114
|
+
params = {
|
|
115
|
+
sourceX: edge.sourceX,
|
|
116
|
+
sourceY: edge.sourceY,
|
|
117
|
+
sourcePosition: mapAngle[sourceAnchor.angle],
|
|
118
|
+
targetX: edge.targetX,
|
|
119
|
+
targetY: edge.targetY,
|
|
120
|
+
targetPosition: mapAngle[targetAnchor.angle],
|
|
121
|
+
curvature: 0.25
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
// pass in params to function that returns a string value for SVG path d attribute (where to be drawn)
|
|
125
|
+
$: path = getSimpleBezierPath(params);
|
|
126
|
+
$: [centerX, centerY] = getSimpleBezierCenter(params);
|
|
127
|
+
// pass necessary values to BaseEdge component
|
|
128
|
+
// BaseEdge renders a 'base' path that can be customized by parent Edge components
|
|
129
|
+
$: baseEdgeProps = {
|
|
130
|
+
...edge,
|
|
131
|
+
path: path,
|
|
132
|
+
centerX: centerX,
|
|
133
|
+
centerY: centerY
|
|
134
|
+
};
|
|
135
|
+
</script>
|
|
136
|
+
|
|
137
|
+
<BaseEdge {baseEdgeProps} {canvasId} />
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
canvasId: string;
|
|
5
|
+
edgeId: string;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {};
|
|
11
|
+
};
|
|
12
|
+
export type SimpleBezierEdgeProps = typeof __propDef.props;
|
|
13
|
+
export type SimpleBezierEdgeEvents = typeof __propDef.events;
|
|
14
|
+
export type SimpleBezierEdgeSlots = typeof __propDef.slots;
|
|
15
|
+
export default class SimpleBezierEdge extends SvelteComponentTyped<SimpleBezierEdgeProps, SimpleBezierEdgeEvents, SimpleBezierEdgeSlots> {
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import BaseEdge from './BaseEdge.svelte';
|
|
3
|
+
import { getCenter } from './utils';
|
|
4
|
+
|
|
5
|
+
const Position = {};
|
|
6
|
+
Position['Left'] = 'left';
|
|
7
|
+
Position['Right'] = 'right';
|
|
8
|
+
Position['Top'] = 'top';
|
|
9
|
+
Position['Bottom'] = 'bottom';
|
|
10
|
+
// These are some helper methods for drawing the round corners
|
|
11
|
+
// The name indicates the direction of the path. "bottomLeftCorner" goes
|
|
12
|
+
// from bottom to the left and "leftBottomCorner" goes from left to the bottom.
|
|
13
|
+
// We have to consider the direction of the paths because of the animated lines.
|
|
14
|
+
const bottomLeftCorner = (x, y, size) =>
|
|
15
|
+
`L ${x},${y - size}Q ${x},${y} ${x + size},${y}`;
|
|
16
|
+
const leftBottomCorner = (x, y, size) =>
|
|
17
|
+
`L ${x + size},${y}Q ${x},${y} ${x},${y - size}`;
|
|
18
|
+
const bottomRightCorner = (x, y, size) =>
|
|
19
|
+
`L ${x},${y - size}Q ${x},${y} ${x - size},${y}`;
|
|
20
|
+
const rightBottomCorner = (x, y, size) =>
|
|
21
|
+
`L ${x - size},${y}Q ${x},${y} ${x},${y - size}`;
|
|
22
|
+
const leftTopCorner = (x, y, size) =>
|
|
23
|
+
`L ${x + size},${y}Q ${x},${y} ${x},${y + size}`;
|
|
24
|
+
const topLeftCorner = (x, y, size) =>
|
|
25
|
+
`L ${x},${y + size}Q ${x},${y} ${x + size},${y}`;
|
|
26
|
+
const topRightCorner = (x, y, size) =>
|
|
27
|
+
`L ${x},${y + size}Q ${x},${y} ${x - size},${y}`;
|
|
28
|
+
const rightTopCorner = (x, y, size) =>
|
|
29
|
+
`L ${x - size},${y}Q ${x},${y} ${x},${y + size}`;
|
|
30
|
+
// returns string to pass into edge 'path' svg d attribute (where to be drawn)
|
|
31
|
+
export function getSmoothStepPath({
|
|
32
|
+
sourceX,
|
|
33
|
+
sourceY,
|
|
34
|
+
sourcePosition = Position.Bottom,
|
|
35
|
+
targetX,
|
|
36
|
+
targetY,
|
|
37
|
+
targetPosition = Position.Top,
|
|
38
|
+
borderRadius = 5,
|
|
39
|
+
centerX,
|
|
40
|
+
centerY,
|
|
41
|
+
}) {
|
|
42
|
+
const [_centerX, _centerY, offsetX, offsetY] = getCenter({
|
|
43
|
+
sourceX,
|
|
44
|
+
sourceY,
|
|
45
|
+
targetX,
|
|
46
|
+
targetY,
|
|
47
|
+
});
|
|
48
|
+
const cornerWidth = Math.min(borderRadius, Math.abs(targetX - sourceX));
|
|
49
|
+
const cornerHeight = Math.min(borderRadius, Math.abs(targetY - sourceY));
|
|
50
|
+
const cornerSize = Math.min(cornerWidth, cornerHeight, offsetX, offsetY);
|
|
51
|
+
const leftAndRight = [Position.Left, Position.Right];
|
|
52
|
+
const cX = typeof centerX !== 'undefined' ? centerX : _centerX;
|
|
53
|
+
const cY = typeof centerY !== 'undefined' ? centerY : _centerY;
|
|
54
|
+
let firstCornerPath = null;
|
|
55
|
+
let secondCornerPath = null;
|
|
56
|
+
// for non-mixed edge top/bottom
|
|
57
|
+
if (sourceX <= targetX) {
|
|
58
|
+
firstCornerPath =
|
|
59
|
+
sourceY <= targetY
|
|
60
|
+
? bottomLeftCorner(sourceX, cY, cornerSize)
|
|
61
|
+
: topLeftCorner(sourceX, cY, cornerSize);
|
|
62
|
+
secondCornerPath =
|
|
63
|
+
sourceY <= targetY
|
|
64
|
+
? rightTopCorner(targetX, cY, cornerSize)
|
|
65
|
+
: rightBottomCorner(targetX, cY, cornerSize);
|
|
66
|
+
} else {
|
|
67
|
+
firstCornerPath =
|
|
68
|
+
sourceY < targetY
|
|
69
|
+
? bottomRightCorner(sourceX, cY, cornerSize)
|
|
70
|
+
: topRightCorner(sourceX, cY, cornerSize);
|
|
71
|
+
secondCornerPath =
|
|
72
|
+
sourceY < targetY
|
|
73
|
+
? leftTopCorner(targetX, cY, cornerSize)
|
|
74
|
+
: leftBottomCorner(targetX, cY, cornerSize);
|
|
75
|
+
}
|
|
76
|
+
// for non-mixed edge left/right
|
|
77
|
+
if (
|
|
78
|
+
leftAndRight.includes(sourcePosition) &&
|
|
79
|
+
leftAndRight.includes(targetPosition)
|
|
80
|
+
) {
|
|
81
|
+
if (sourceX <= targetX) {
|
|
82
|
+
firstCornerPath =
|
|
83
|
+
sourceY <= targetY
|
|
84
|
+
? rightTopCorner(cX, sourceY, cornerSize)
|
|
85
|
+
: rightBottomCorner(cX, sourceY, cornerSize);
|
|
86
|
+
secondCornerPath =
|
|
87
|
+
sourceY <= targetY
|
|
88
|
+
? bottomLeftCorner(cX, targetY, cornerSize)
|
|
89
|
+
: topLeftCorner(cX, targetY, cornerSize);
|
|
90
|
+
} else if (
|
|
91
|
+
(sourcePosition === Position.Right &&
|
|
92
|
+
targetPosition === Position.Left) ||
|
|
93
|
+
(sourcePosition === Position.Left &&
|
|
94
|
+
targetPosition === Position.Right) ||
|
|
95
|
+
(sourcePosition === Position.Left && targetPosition === Position.Left)
|
|
96
|
+
) {
|
|
97
|
+
// and sourceX > targetX
|
|
98
|
+
firstCornerPath =
|
|
99
|
+
sourceY <= targetY
|
|
100
|
+
? leftTopCorner(cX, sourceY, cornerSize)
|
|
101
|
+
: leftBottomCorner(cX, sourceY, cornerSize);
|
|
102
|
+
secondCornerPath =
|
|
103
|
+
sourceY <= targetY
|
|
104
|
+
? bottomRightCorner(cX, targetY, cornerSize)
|
|
105
|
+
: topRightCorner(cX, targetY, cornerSize);
|
|
106
|
+
}
|
|
107
|
+
// for mixed edges (top/bottom to left/right) OR (left/right to top/bottom)
|
|
108
|
+
} else if (
|
|
109
|
+
leftAndRight.includes(sourcePosition) &&
|
|
110
|
+
!leftAndRight.includes(targetPosition)
|
|
111
|
+
) {
|
|
112
|
+
if (sourceX <= targetX) {
|
|
113
|
+
firstCornerPath =
|
|
114
|
+
sourceY <= targetY
|
|
115
|
+
? rightTopCorner(targetX, sourceY, cornerSize)
|
|
116
|
+
: rightBottomCorner(targetX, sourceY, cornerSize);
|
|
117
|
+
} else {
|
|
118
|
+
firstCornerPath =
|
|
119
|
+
sourceY <= targetY
|
|
120
|
+
? leftTopCorner(targetX, sourceY, cornerSize)
|
|
121
|
+
: leftBottomCorner(targetX, sourceY, cornerSize);
|
|
122
|
+
}
|
|
123
|
+
secondCornerPath = '';
|
|
124
|
+
} else if (
|
|
125
|
+
!leftAndRight.includes(sourcePosition) &&
|
|
126
|
+
leftAndRight.includes(targetPosition)
|
|
127
|
+
) {
|
|
128
|
+
if (sourceX <= targetX) {
|
|
129
|
+
firstCornerPath =
|
|
130
|
+
sourceY <= targetY
|
|
131
|
+
? bottomLeftCorner(sourceX, targetY, cornerSize)
|
|
132
|
+
: topLeftCorner(sourceX, targetY, cornerSize);
|
|
133
|
+
} else {
|
|
134
|
+
firstCornerPath =
|
|
135
|
+
sourceY <= targetY
|
|
136
|
+
? bottomRightCorner(sourceX, targetY, cornerSize)
|
|
137
|
+
: topRightCorner(sourceX, targetY, cornerSize);
|
|
138
|
+
}
|
|
139
|
+
secondCornerPath = '';
|
|
140
|
+
}
|
|
141
|
+
return `M ${sourceX},${sourceY}${firstCornerPath}${secondCornerPath}L ${targetX},${targetY}`;
|
|
142
|
+
}
|
|
143
|
+
export let edge;
|
|
144
|
+
export let borderRadius = 5;
|
|
145
|
+
export let canvasId;
|
|
146
|
+
|
|
147
|
+
import { findStore } from '../../../store/controllers/storeApi';
|
|
148
|
+
import { getAnchorFromEdge } from '../../../edges/controllers/util';
|
|
149
|
+
|
|
150
|
+
let params;
|
|
151
|
+
$: {
|
|
152
|
+
const store = findStore(canvasId);
|
|
153
|
+
const sourceAnchor = getAnchorFromEdge(store, edge.id, 'source');
|
|
154
|
+
const targetAnchor = getAnchorFromEdge(store, edge.id, 'target');
|
|
155
|
+
const mapAngle = { 0: 'right', 90: 'top', 180: 'left', 270: 'bottom' };
|
|
156
|
+
params = {
|
|
157
|
+
sourceX: edge.sourceX,
|
|
158
|
+
sourceY: edge.sourceY,
|
|
159
|
+
targetX: edge.targetX,
|
|
160
|
+
targetY: edge.targetY,
|
|
161
|
+
sourcePosition: mapAngle[sourceAnchor.angle],
|
|
162
|
+
targetPosition: mapAngle[targetAnchor.angle],
|
|
163
|
+
borderRadius: borderRadius,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
$: [centerX, centerY] = getCenter(params);
|
|
167
|
+
$: path = getSmoothStepPath(params);
|
|
168
|
+
$: baseEdgeProps = {
|
|
169
|
+
...edge,
|
|
170
|
+
path: path,
|
|
171
|
+
centerX: centerX,
|
|
172
|
+
centerY: centerY,
|
|
173
|
+
};
|
|
174
|
+
</script>
|
|
175
|
+
|
|
176
|
+
<BaseEdge {baseEdgeProps} {canvasId} />
|