@loopstack/loopstack-studio 0.21.0 → 0.21.1
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/dist/components/LoadingCentered.js +2 -2
- package/dist/components/ai-elements/code-block.js +96 -0
- package/dist/components/ai-elements/message.js +87 -0
- package/dist/components/ai-elements/prompt-input.js +321 -0
- package/dist/components/ai-elements/reasoning.js +124 -0
- package/dist/components/ai-elements/shimmer.js +37 -0
- package/dist/components/ai-elements/sources.js +65 -0
- package/dist/components/ai-elements/tool.js +158 -0
- package/dist/components/content/ErrorAlert.js +17 -0
- package/dist/components/data-table/DataTable.js +99 -96
- package/dist/components/dynamic-form/CodeContent.js +2 -2
- package/dist/components/dynamic-form/FormElement.js +3 -3
- package/dist/components/dynamic-form/FormElementHeader.js +2 -2
- package/dist/components/dynamic-form/ObjectController.js +2 -2
- package/dist/components/layout/MainLayout.js +0 -1
- package/dist/components/lists/ListView.js +62 -59
- package/dist/components/loopstack-elements/link.js +115 -0
- package/dist/components/ui/button-group.js +13 -0
- package/dist/components/ui/command.js +7 -0
- package/dist/components/ui/context-menu.js +63 -0
- package/dist/components/ui/hover-card.js +6 -0
- package/dist/components/ui/input-group.js +85 -0
- package/dist/components/ui/table.js +2 -2
- package/dist/components/ui/tabs.js +54 -0
- package/dist/components/ui-widgets/UiActions.js +24 -0
- package/dist/components/ui-widgets/UiWidget.js +43 -0
- package/dist/components/ui-widgets/widgets/AiPromptInput.js +43 -0
- package/dist/components/ui-widgets/widgets/ButtonFullWidth.js +23 -0
- package/dist/components/ui-widgets/widgets/SubmitButton.js +23 -0
- package/dist/features/code-explorer/CodeExplorer.js +69 -0
- package/dist/features/code-explorer/components/CodeExplorerTree.js +43 -0
- package/dist/features/code-explorer/components/CodeExplorerTreeNode.js +82 -0
- package/dist/features/code-explorer/components/FileContentViewer.js +237 -0
- package/dist/features/code-explorer/components/FileTabsBar.js +191 -0
- package/dist/features/code-explorer/providers/CodeExplorerProvider.js +165 -0
- package/dist/features/code-explorer/utils/fileIcons.js +42 -0
- package/dist/features/dashboard/Dashboard.js +125 -0
- package/dist/features/dashboard/RunItem.js +76 -0
- package/dist/features/dashboard/RunList.js +32 -0
- package/dist/features/debug/components/ConfigFlowViewer.js +79 -0
- package/dist/features/debug/components/PipelineDebugHeader.js +48 -0
- package/dist/features/debug/components/PipelineDebugLegend.js +68 -0
- package/dist/features/debug/components/PipelineFlowViewer.js +109 -0
- package/dist/features/debug/components/pipeline-flow/StateNode.js +111 -0
- package/dist/features/debug/components/pipeline-flow/WorkflowGraph.js +41 -0
- package/dist/features/debug/components/pipeline-flow/WorkflowTransitionEdge.js +97 -0
- package/dist/features/debug/lib/edge-paths.js +47 -0
- package/dist/features/debug/lib/flow-utils.js +247 -0
- package/dist/features/health/LocalHealthCheck.js +1 -1
- package/dist/features/oauth/OAuthCallbackPage.js +2 -0
- package/dist/features/oauth/OAuthPromptRenderer.js +223 -0
- package/dist/features/oauth/index.js +3 -0
- package/dist/features/oauth/useOAuthPopup.js +83 -0
- package/dist/features/workbench/NavigationItems.js +52 -0
- package/dist/features/workbench/Workbench.js +101 -0
- package/dist/features/workbench/WorkbenchNavigation.js +38 -0
- package/dist/features/workbench/WorkflowItem.js +67 -0
- package/dist/features/workbench/WorkflowList.js +110 -0
- package/dist/features/workbench/components/DocumentItem.js +27 -0
- package/dist/features/workbench/components/DocumentList.js +40 -0
- package/dist/features/workbench/components/DocumentMetadataPills.js +63 -0
- package/dist/features/workbench/components/DocumentRenderer.js +54 -0
- package/dist/features/workbench/components/NavigationItem.js +68 -0
- package/dist/features/workbench/components/PipelineHistoryList.js +56 -0
- package/dist/features/workbench/components/WorkbenchSettingsModal.js +89 -0
- package/dist/features/workbench/components/WorkbenchSidebar.js +109 -0
- package/dist/features/workbench/components/WorkflowForms.js +22 -0
- package/dist/features/workbench/components/WorkflowHistoryItem.js +144 -0
- package/dist/features/workbench/components/buttons/WorkflowButtons.js +85 -0
- package/dist/features/workbench/components/document-details/DocumentDetails.js +425 -0
- package/dist/features/workbench/components/document-details/PromptDetails.js +146 -0
- package/dist/features/workbench/components/document-renderer/AiMessage.js +56 -0
- package/dist/features/workbench/components/document-renderer/AiMessageContent.js +174 -0
- package/dist/features/workbench/components/document-renderer/DocumentDebugRenderer.js +30 -0
- package/dist/features/workbench/components/document-renderer/DocumentFormRenderer.js +79 -0
- package/dist/features/workbench/components/document-renderer/DocumentMessageRenderer.js +10 -0
- package/dist/features/workbench/components/document-renderer/ErrorMessageRenderer.js +13 -0
- package/dist/features/workbench/components/document-renderer/LinkMessageRenderer.js +17 -0
- package/dist/features/workbench/components/document-renderer/MarkdownMessageRenderer.js +10 -0
- package/dist/features/workbench/components/document-renderer/PlainMessageRenderer.js +9 -0
- package/dist/features/workbench/hooks/useAutoScrollBottom.js +29 -0
- package/dist/features/workbench/hooks/useIntersectionObserver.js +44 -0
- package/dist/features/workbench/hooks/useScrollToListItem.js +23 -0
- package/dist/features/workbench/providers/ScrollProvider.js +22 -0
- package/dist/features/workbench/providers/WorkbenchContextProvider.js +3 -0
- package/dist/features/workspaces/Workspaces.js +156 -89
- package/dist/features/workspaces/components/CreateWorkspace.js +101 -78
- package/dist/features/workspaces/components/ExecutionTimeline.js +1 -1
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useDashboard.js +23 -0
- package/dist/hooks/useDocuments.js +45 -0
- package/dist/hooks/useFiles.js +63 -0
- package/dist/hooks/useNamespaceTree.js +27 -0
- package/dist/hooks/useNamespaces.js +34 -0
- package/dist/hooks/usePipelines.js +83 -6
- package/dist/hooks/useWorkflows.js +122 -0
- package/dist/hooks/useWorkspaces.js +49 -29
- package/dist/index.d.ts +75 -9
- package/dist/index.js +9 -1
- package/dist/lib/requireParam.js +6 -0
- package/dist/loopstack-studio.css +1 -1
- package/dist/node_modules/@ai-sdk/provider/dist/index.js +65 -0
- package/dist/node_modules/@ai-sdk/provider-utils/dist/index.js +1008 -0
- package/dist/node_modules/@dagrejs/dagre/dist/dagre.esm.js +1968 -0
- package/dist/node_modules/@shikijs/core/dist/index.js +1420 -0
- package/dist/node_modules/@shikijs/engine-oniguruma/dist/index.js +236 -0
- package/dist/node_modules/@shikijs/engine-oniguruma/dist/wasm-inlined.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/abap.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/actionscript-3.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/ada.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/angular-expression.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/angular-html.js +14 -0
- package/dist/node_modules/@shikijs/langs/dist/angular-inline-style.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/angular-inline-template.js +8 -0
- package/dist/node_modules/@shikijs/langs/dist/angular-let-declaration.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/angular-template-blocks.js +8 -0
- package/dist/node_modules/@shikijs/langs/dist/angular-template.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/angular-ts.js +16 -0
- package/dist/node_modules/@shikijs/langs/dist/apache.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/apex.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/apl.js +14 -0
- package/dist/node_modules/@shikijs/langs/dist/applescript.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/ara.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/asciidoc.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/asm.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/astro.js +16 -0
- package/dist/node_modules/@shikijs/langs/dist/awk.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/ballerina.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/bat.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/beancount.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/berry.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/bibtex.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/bicep.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/bird2.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/blade.js +18 -0
- package/dist/node_modules/@shikijs/langs/dist/bsl.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/c.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/c3.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/cadence.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/cairo.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/clarity.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/clojure.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/cmake.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/cobol.js +8 -0
- package/dist/node_modules/@shikijs/langs/dist/codeowners.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/codeql.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/coffee.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/common-lisp.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/coq.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/cpp-macro.js +10 -0
- package/dist/node_modules/@shikijs/langs/dist/cpp.js +12 -0
- package/dist/node_modules/@shikijs/langs/dist/crystal.js +16 -0
- package/dist/node_modules/@shikijs/langs/dist/csharp.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/css.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/csv.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/cue.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/cypher.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/d.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/dart.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/dax.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/desktop.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/diff.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/docker.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/dotenv.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/dream-maker.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/edge.js +10 -0
- package/dist/node_modules/@shikijs/langs/dist/elixir.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/elm.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/emacs-lisp.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/erb.js +8 -0
- package/dist/node_modules/@shikijs/langs/dist/erlang.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/es-tag-css.js +10 -0
- package/dist/node_modules/@shikijs/langs/dist/es-tag-glsl.js +10 -0
- package/dist/node_modules/@shikijs/langs/dist/es-tag-html.js +10 -0
- package/dist/node_modules/@shikijs/langs/dist/es-tag-sql.js +8 -0
- package/dist/node_modules/@shikijs/langs/dist/es-tag-xml.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/fennel.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/fish.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/fluent.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/fortran-fixed-form.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/fortran-free-form.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/fsharp.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/gdresource.js +8 -0
- package/dist/node_modules/@shikijs/langs/dist/gdscript.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/gdshader.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/genie.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/gherkin.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/git-commit.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/git-rebase.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/gleam.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/glimmer-js.js +12 -0
- package/dist/node_modules/@shikijs/langs/dist/glimmer-ts.js +12 -0
- package/dist/node_modules/@shikijs/langs/dist/glsl.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/gn.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/gnuplot.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/go.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/graphql.js +12 -0
- package/dist/node_modules/@shikijs/langs/dist/groovy.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/hack.js +8 -0
- package/dist/node_modules/@shikijs/langs/dist/haml.js +8 -0
- package/dist/node_modules/@shikijs/langs/dist/handlebars.js +12 -0
- package/dist/node_modules/@shikijs/langs/dist/haskell.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/haxe.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/hcl.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/hjson.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/hlsl.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/html-derivative.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/html.js +8 -0
- package/dist/node_modules/@shikijs/langs/dist/http.js +12 -0
- package/dist/node_modules/@shikijs/langs/dist/hurl.js +10 -0
- package/dist/node_modules/@shikijs/langs/dist/hxml.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/hy.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/imba.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/ini.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/java.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/javascript.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/jinja-html.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/jinja.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/jison.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/json.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/json5.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/jsonc.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/jsonl.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/jsonnet.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/jssm.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/jsx.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/julia.js +14 -0
- package/dist/node_modules/@shikijs/langs/dist/just.js +16 -0
- package/dist/node_modules/@shikijs/langs/dist/kdl.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/kotlin.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/kusto.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/latex.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/lean.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/less.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/liquid.js +12 -0
- package/dist/node_modules/@shikijs/langs/dist/llvm.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/log.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/logo.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/lua.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/luau.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/make.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/markdown-nix.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/markdown-vue.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/markdown.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/marko.js +12 -0
- package/dist/node_modules/@shikijs/langs/dist/matlab.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/mdc.js +10 -0
- package/dist/node_modules/@shikijs/langs/dist/mdx.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/mermaid.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/mipsasm.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/mojo.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/moonbit.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/move.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/narrat.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/nextflow-groovy.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/nextflow.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/nginx.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/nim.js +18 -0
- package/dist/node_modules/@shikijs/langs/dist/nix.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/nushell.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/objective-c.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/objective-cpp.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/ocaml.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/odin.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/openscad.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/pascal.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/perl.js +14 -0
- package/dist/node_modules/@shikijs/langs/dist/php.js +16 -0
- package/dist/node_modules/@shikijs/langs/dist/pkl.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/plsql.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/po.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/polar.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/postcss.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/powerquery.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/powershell.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/prisma.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/prolog.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/proto.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/pug.js +10 -0
- package/dist/node_modules/@shikijs/langs/dist/puppet.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/purescript.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/python.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/qml.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/qmldir.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/qss.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/r.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/racket.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/raku.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/razor.js +8 -0
- package/dist/node_modules/@shikijs/langs/dist/reg.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/regexp.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/rel.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/riscv.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/ron.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/rosmsg.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/rst.js +20 -0
- package/dist/node_modules/@shikijs/langs/dist/ruby.js +28 -0
- package/dist/node_modules/@shikijs/langs/dist/rust.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/sas.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/sass.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/scala.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/scheme.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/scss.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/sdbl.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/shaderlab.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/shellscript.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/shellsession.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/smalltalk.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/solidity.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/soy.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/sparql.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/splunk.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/sql.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/ssh-config.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/stata.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/stylus.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/surrealql.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/svelte.js +12 -0
- package/dist/node_modules/@shikijs/langs/dist/swift.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/system-verilog.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/systemd.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/talonscript.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/tasl.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/tcl.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/templ.js +10 -0
- package/dist/node_modules/@shikijs/langs/dist/terraform.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/tex.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/toml.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/ts-tags.js +16 -0
- package/dist/node_modules/@shikijs/langs/dist/tsv.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/tsx.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/turtle.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/twig.js +16 -0
- package/dist/node_modules/@shikijs/langs/dist/typescript.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/typespec.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/typst.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/v.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/vala.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/vb.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/verilog.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/vhdl.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/viml.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/vue-directives.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/vue-html.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/vue-interpolations.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/vue-sfc-style-variable-injection.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/vue-vine.js +16 -0
- package/dist/node_modules/@shikijs/langs/dist/vue.js +24 -0
- package/dist/node_modules/@shikijs/langs/dist/vyper.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/wasm.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/wenyan.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/wgsl.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/wikitext.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/wit.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/wolfram.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/xml.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/xsl.js +3 -0
- package/dist/node_modules/@shikijs/langs/dist/yaml.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/zenscript.js +2 -0
- package/dist/node_modules/@shikijs/langs/dist/zig.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/andromeeda.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/aurora-x.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/ayu-dark.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/ayu-light.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/ayu-mirage.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/catppuccin-frappe.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/catppuccin-latte.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/catppuccin-macchiato.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/catppuccin-mocha.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/dark-plus.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/dracula-soft.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/dracula.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/everforest-dark.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/everforest-light.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/github-dark-default.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/github-dark-dimmed.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/github-dark-high-contrast.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/github-dark.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/github-light-default.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/github-light-high-contrast.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/github-light.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/gruvbox-dark-hard.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/gruvbox-dark-medium.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/gruvbox-dark-soft.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/gruvbox-light-hard.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/gruvbox-light-medium.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/gruvbox-light-soft.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/horizon-bright.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/horizon.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/houston.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/kanagawa-dragon.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/kanagawa-lotus.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/kanagawa-wave.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/laserwave.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/light-plus.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/material-theme-darker.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/material-theme-lighter.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/material-theme-ocean.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/material-theme-palenight.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/material-theme.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/min-dark.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/min-light.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/monokai.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/night-owl-light.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/night-owl.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/nord.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/one-dark-pro.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/one-light.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/plastic.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/poimandres.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/red.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/rose-pine-dawn.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/rose-pine-moon.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/rose-pine.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/slack-dark.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/slack-ochin.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/snazzy-light.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/solarized-dark.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/solarized-light.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/synthwave-84.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/tokyo-night.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/vesper.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/vitesse-black.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/vitesse-dark.js +2 -0
- package/dist/node_modules/@shikijs/themes/dist/vitesse-light.js +2 -0
- package/dist/node_modules/@shikijs/types/dist/index.js +6 -0
- package/dist/node_modules/@shikijs/vscode-textmate/dist/index.js +1580 -0
- package/dist/node_modules/@ungap/structured-clone/esm/deserialize.js +51 -0
- package/dist/node_modules/@ungap/structured-clone/esm/index.js +4 -0
- package/dist/node_modules/@ungap/structured-clone/esm/serialize.js +91 -0
- package/dist/node_modules/@ungap/structured-clone/esm/types.js +2 -0
- package/dist/node_modules/@xyflow/react/dist/esm/index.js +3280 -0
- package/dist/node_modules/@xyflow/system/dist/esm/index.js +1839 -0
- package/dist/node_modules/ai/dist/index.js +1083 -0
- package/dist/node_modules/bail/index.js +4 -0
- package/dist/node_modules/character-entities-html4/index.js +255 -0
- package/dist/node_modules/character-entities-legacy/index.js +2 -0
- package/dist/node_modules/chevrotain/lib/src/parse/errors_public.js +6 -1
- package/dist/node_modules/chevrotain/lib/src/scan/lexer.js +4 -10
- package/dist/node_modules/chevrotain/lib/src/scan/lexer_public.js +56 -65
- package/dist/node_modules/classcat/index.js +8 -0
- package/dist/node_modules/comma-separated-tokens/index.js +5 -1
- package/dist/node_modules/d3/src/index.js +5 -0
- package/dist/node_modules/d3-drag/src/constant.js +2 -0
- package/dist/node_modules/d3-drag/src/drag.js +112 -0
- package/dist/node_modules/d3-drag/src/event.js +60 -0
- package/dist/node_modules/d3-drag/src/nodrag.js +13 -0
- package/dist/node_modules/d3-drag/src/noevent.js +11 -0
- package/dist/node_modules/d3-interpolate/src/zoom.js +39 -0
- package/dist/node_modules/d3-selection/src/pointer.js +16 -0
- package/dist/node_modules/d3-selection/src/sourceEvent.js +6 -0
- package/dist/node_modules/d3-zoom/src/constant.js +2 -0
- package/dist/node_modules/d3-zoom/src/event.js +26 -0
- package/dist/node_modules/d3-zoom/src/index.js +1 -1
- package/dist/node_modules/d3-zoom/src/noevent.js +7 -0
- package/dist/node_modules/d3-zoom/src/zoom.js +214 -1
- package/dist/node_modules/decode-named-character-reference/index.dom.js +8 -0
- package/dist/node_modules/entities/dist/esm/decode-codepoint.js +35 -0
- package/dist/node_modules/entities/dist/esm/decode.js +129 -0
- package/dist/node_modules/entities/dist/esm/generated/decode-data-html.js +2 -0
- package/dist/node_modules/estree-util-is-identifier-name/lib/index.js +5 -0
- package/dist/node_modules/extend/index.js +37 -0
- package/dist/node_modules/hast-util-from-parse5/lib/index.js +121 -0
- package/dist/node_modules/hast-util-raw/lib/index.js +204 -0
- package/dist/node_modules/hast-util-raw/node_modules/parse5/dist/common/doctype.js +34 -0
- package/dist/node_modules/hast-util-raw/node_modules/parse5/dist/common/error-codes.js +5 -0
- package/dist/node_modules/hast-util-raw/node_modules/parse5/dist/common/foreign-content.js +150 -0
- package/dist/node_modules/hast-util-raw/node_modules/parse5/dist/common/html.js +267 -0
- package/dist/node_modules/hast-util-raw/node_modules/parse5/dist/common/token.js +9 -0
- package/dist/node_modules/hast-util-raw/node_modules/parse5/dist/common/unicode.js +65 -0
- package/dist/node_modules/hast-util-raw/node_modules/parse5/dist/index.js +8 -0
- package/dist/node_modules/hast-util-raw/node_modules/parse5/dist/parser/formatting-element-list.js +69 -0
- package/dist/node_modules/hast-util-raw/node_modules/parse5/dist/parser/index.js +1936 -0
- package/dist/node_modules/hast-util-raw/node_modules/parse5/dist/parser/open-element-stack.js +239 -0
- package/dist/node_modules/hast-util-raw/node_modules/parse5/dist/serializer/index.js +22 -0
- package/dist/node_modules/hast-util-raw/node_modules/parse5/dist/tokenizer/index.js +1451 -0
- package/dist/node_modules/hast-util-raw/node_modules/parse5/dist/tokenizer/preprocessor.js +75 -0
- package/dist/node_modules/hast-util-raw/node_modules/parse5/dist/tree-adapters/default.js +155 -0
- package/dist/node_modules/hast-util-sanitize/lib/index.js +159 -0
- package/dist/node_modules/hast-util-sanitize/lib/schema.js +73 -0
- package/dist/node_modules/hast-util-to-html/lib/handle/comment.js +9 -0
- package/dist/node_modules/hast-util-to-html/lib/handle/doctype.js +4 -0
- package/dist/node_modules/hast-util-to-html/lib/handle/element.js +47 -0
- package/dist/node_modules/hast-util-to-html/lib/handle/index.js +27 -0
- package/dist/node_modules/hast-util-to-html/lib/handle/raw.js +5 -0
- package/dist/node_modules/hast-util-to-html/lib/handle/root.js +4 -0
- package/dist/node_modules/hast-util-to-html/lib/handle/text.js +6 -0
- package/dist/node_modules/hast-util-to-html/lib/index.js +46 -0
- package/dist/node_modules/hast-util-to-html/lib/omission/closing.js +84 -0
- package/dist/node_modules/hast-util-to-html/lib/omission/omission.js +8 -0
- package/dist/node_modules/hast-util-to-html/lib/omission/opening.js +37 -0
- package/dist/node_modules/hast-util-to-html/lib/omission/util/siblings.js +12 -0
- package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.js +251 -0
- package/dist/node_modules/hast-util-to-parse5/lib/index.js +113 -0
- package/dist/node_modules/hast-util-whitespace/lib/index.js +8 -0
- package/dist/node_modules/html-url-attributes/lib/index.js +34 -0
- package/dist/node_modules/html-void-elements/index.js +23 -0
- package/dist/node_modules/inline-style-parser/cjs/index.js +88 -0
- package/dist/node_modules/mdast-util-from-markdown/lib/index.js +555 -0
- package/dist/node_modules/mdast-util-to-hast/lib/footer.js +101 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/blockquote.js +10 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/break.js +13 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/code.js +20 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/delete.js +10 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/emphasis.js +10 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/footnote-reference.js +28 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/heading.js +10 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/html.js +10 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/image-reference.js +19 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/image.js +13 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/index.js +54 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/inline-code.js +15 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/link-reference.js +16 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/link.js +13 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/list-item.js +57 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/list.js +18 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/paragraph.js +10 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/root.js +8 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/strong.js +10 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/table-cell.js +10 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/table-row.js +22 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/table.js +33 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/text.js +9 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/thematic-break.js +10 -0
- package/dist/node_modules/mdast-util-to-hast/lib/index.js +17 -0
- package/dist/node_modules/mdast-util-to-hast/lib/revert.js +18 -0
- package/dist/node_modules/mdast-util-to-hast/lib/state.js +106 -0
- package/dist/node_modules/micromark/lib/constructs.js +79 -0
- package/dist/node_modules/micromark/lib/create-tokenizer.js +175 -0
- package/dist/node_modules/micromark/lib/initialize/content.js +32 -0
- package/dist/node_modules/micromark/lib/initialize/document.js +101 -0
- package/dist/node_modules/micromark/lib/initialize/flow.js +23 -0
- package/dist/node_modules/micromark/lib/initialize/text.js +84 -0
- package/dist/node_modules/micromark/lib/parse.js +27 -0
- package/dist/node_modules/micromark/lib/postprocess.js +6 -0
- package/dist/node_modules/micromark/lib/preprocess.js +30 -0
- package/dist/node_modules/micromark-core-commonmark/lib/attention.js +112 -0
- package/dist/node_modules/micromark-core-commonmark/lib/autolink.js +41 -0
- package/dist/node_modules/micromark-core-commonmark/lib/block-quote.js +36 -0
- package/dist/node_modules/micromark-core-commonmark/lib/character-escape.js +15 -0
- package/dist/node_modules/micromark-core-commonmark/lib/character-reference.js +27 -0
- package/dist/node_modules/micromark-core-commonmark/lib/code-fenced.js +88 -0
- package/dist/node_modules/micromark-core-commonmark/lib/code-indented.js +42 -0
- package/dist/node_modules/micromark-core-commonmark/lib/code-text.js +41 -0
- package/dist/node_modules/micromark-core-commonmark/lib/content.js +46 -0
- package/dist/node_modules/micromark-core-commonmark/lib/definition.js +59 -0
- package/dist/node_modules/micromark-core-commonmark/lib/hard-break-escape.js +15 -0
- package/dist/node_modules/micromark-core-commonmark/lib/heading-atx.js +65 -0
- package/dist/node_modules/micromark-core-commonmark/lib/html-flow.js +140 -0
- package/dist/node_modules/micromark-core-commonmark/lib/html-text.js +98 -0
- package/dist/node_modules/micromark-core-commonmark/lib/label-end.js +157 -0
- package/dist/node_modules/micromark-core-commonmark/lib/label-start-image.js +21 -0
- package/dist/node_modules/micromark-core-commonmark/lib/label-start-link.js +18 -0
- package/dist/node_modules/micromark-core-commonmark/lib/line-ending.js +12 -0
- package/dist/node_modules/micromark-core-commonmark/lib/list.js +77 -0
- package/dist/node_modules/micromark-core-commonmark/lib/setext-underline.js +57 -0
- package/dist/node_modules/micromark-core-commonmark/lib/thematic-break.js +23 -0
- package/dist/node_modules/micromark-factory-destination/index.js +24 -0
- package/dist/node_modules/micromark-factory-label/index.js +18 -0
- package/dist/node_modules/micromark-factory-title/index.js +22 -0
- package/dist/node_modules/micromark-factory-whitespace/index.js +10 -0
- package/dist/node_modules/micromark-util-character/index.js +6 -5
- package/dist/node_modules/micromark-util-chunked/index.js +4 -1
- package/dist/node_modules/micromark-util-decode-numeric-character-reference/index.js +5 -0
- package/dist/node_modules/micromark-util-decode-string/index.js +15 -0
- package/dist/node_modules/micromark-util-html-tag-name/index.js +7 -0
- package/dist/node_modules/micromark-util-sanitize-uri/index.js +16 -0
- package/dist/node_modules/micromark-util-subtokenize/index.js +33 -0
- package/dist/node_modules/micromark-util-subtokenize/lib/splice-buffer.js +55 -0
- package/dist/node_modules/motion/dist/es/react.js +3 -0
- package/dist/node_modules/nanoid/index.browser.js +7 -0
- package/dist/node_modules/nanoid/url-alphabet/index.js +2 -0
- package/dist/node_modules/property-information/index.js +1 -0
- package/dist/node_modules/property-information/lib/hast-to-react.js +20 -0
- package/dist/node_modules/rehype-harden/dist/index.js +168 -0
- package/dist/node_modules/rehype-raw/lib/index.js +10 -0
- package/dist/node_modules/rehype-sanitize/lib/index.js +7 -0
- package/dist/node_modules/remark-parse/lib/index.js +14 -0
- package/dist/node_modules/remark-rehype/lib/index.js +16 -0
- package/dist/node_modules/remend/dist/index.js +459 -0
- package/dist/node_modules/shiki/dist/bundle-full.js +11 -0
- package/dist/node_modules/shiki/dist/langs.js +1278 -0
- package/dist/node_modules/shiki/dist/themes.js +393 -0
- package/dist/node_modules/shiki/dist/wasm.js +2 -0
- package/dist/node_modules/space-separated-tokens/index.js +4 -1
- package/dist/node_modules/streamdown/dist/chunk-RLXIAIE6.js +2189 -0
- package/dist/node_modules/streamdown/dist/highlighted-body-B3W2YXNL.js +33 -0
- package/dist/node_modules/streamdown/dist/index.js +2 -0
- package/dist/node_modules/streamdown/dist/mermaid-3ZIDBTTL.js +3 -0
- package/dist/node_modules/streamdown/node_modules/marked/lib/marked.esm.js +1421 -0
- package/dist/node_modules/stringify-entities/lib/constant/dangerous.js +11 -0
- package/dist/node_modules/stringify-entities/lib/core.js +21 -0
- package/dist/node_modules/stringify-entities/lib/index.js +6 -0
- package/dist/node_modules/stringify-entities/lib/util/format-smart.js +12 -0
- package/dist/node_modules/stringify-entities/lib/util/to-decimal.js +6 -0
- package/dist/node_modules/stringify-entities/lib/util/to-hexadecimal.js +6 -0
- package/dist/node_modules/stringify-entities/lib/util/to-named.js +15 -0
- package/dist/node_modules/style-to-js/cjs/index.js +17 -0
- package/dist/node_modules/style-to-js/cjs/utilities.js +16 -0
- package/dist/node_modules/style-to-object/cjs/index.js +21 -0
- package/dist/node_modules/trim-lines/index.js +19 -0
- package/dist/node_modules/trough/lib/index.js +48 -0
- package/dist/node_modules/unified/lib/callable-instance.js +7 -0
- package/dist/node_modules/unified/lib/index.js +160 -0
- package/dist/node_modules/unified/node_modules/is-plain-obj/index.js +6 -0
- package/dist/node_modules/unist-util-position/lib/index.js +20 -0
- package/dist/node_modules/unist-util-stringify-position/lib/index.js +13 -0
- package/dist/node_modules/vfile/lib/index.js +87 -0
- package/dist/node_modules/vfile/lib/minpath.browser.js +97 -0
- package/dist/node_modules/vfile/lib/minproc.browser.js +5 -0
- package/dist/node_modules/vfile/lib/minurl.browser.js +29 -0
- package/dist/node_modules/vfile/lib/minurl.shared.js +4 -0
- package/dist/node_modules/vfile-location/lib/index.js +41 -0
- package/dist/node_modules/vfile-message/lib/index.js +22 -0
- package/dist/node_modules/zod/v3/ZodError.js +79 -0
- package/dist/node_modules/zod/v3/errors.js +6 -0
- package/dist/node_modules/zod/v3/helpers/errorUtil.js +5 -0
- package/dist/node_modules/zod/v3/helpers/parseUtil.js +90 -0
- package/dist/node_modules/zod/v3/helpers/util.js +72 -0
- package/dist/node_modules/zod/v3/locales/en.js +58 -0
- package/dist/node_modules/zod/v3/types.js +2425 -0
- package/dist/node_modules/zod/v4/classic/errors.js +21 -0
- package/dist/node_modules/zod/v4/classic/iso.js +29 -0
- package/dist/node_modules/zod/v4/classic/parse.js +4 -0
- package/dist/node_modules/zod/v4/classic/schemas.js +392 -0
- package/dist/node_modules/zod/v4/core/api.js +532 -0
- package/dist/node_modules/zod/v4/core/checks.js +283 -0
- package/dist/node_modules/zod/v4/core/core.js +44 -0
- package/dist/node_modules/zod/v4/core/doc.js +21 -0
- package/dist/node_modules/zod/v4/core/errors.js +40 -0
- package/dist/node_modules/zod/v4/core/json-schema-processors.js +305 -0
- package/dist/node_modules/zod/v4/core/parse.js +66 -0
- package/dist/node_modules/zod/v4/core/regexes.js +28 -0
- package/dist/node_modules/zod/v4/core/registries.js +38 -0
- package/dist/node_modules/zod/v4/core/schemas.js +863 -0
- package/dist/node_modules/zod/v4/core/to-json-schema.js +220 -0
- package/dist/node_modules/zod/v4/core/util.js +267 -0
- package/dist/node_modules/zod/v4/core/versions.js +6 -0
- package/dist/node_modules/zwitch/index.js +14 -0
- package/dist/pages/DashboardPage.js +58 -0
- package/dist/pages/DebugWorkflowDetailsPage.js +121 -0
- package/dist/pages/DebugWorkflowsPage.js +130 -0
- package/dist/pages/EmbedWorkbenchPage.js +73 -0
- package/dist/pages/PipelineDebugPage.js +114 -0
- package/dist/pages/WorkbenchPage.js +67 -0
- package/dist/pages/WorkspacePage.js +1 -1
- package/dist/providers/ComponentOverridesProvider.js +12 -0
- package/dist/routing/LocalRouter.js +3 -0
- package/package.json +3 -3
|
@@ -0,0 +1,3280 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import cc from "../../../../classcat/index.js";
|
|
3
|
+
import { ConnectionLineType, ConnectionMode, MarkerType, PanOnScrollMode, Position, ResizeControlVariant, SelectionMode, XYDrag, XYHandle, XYMinimap, XYPanZoom, XYResizer, addEdge, adoptUserNodes, areSetsEqual, calculateNodePosition, createMarkerIds, defaultAriaLabelConfig, devWarn, elementSelectionKeys, errorMessages, evaluateAbsolutePosition, fitViewport, getBezierEdgeCenter, getBezierPath, getBoundsOfRects, getConnectedEdges, getConnectionStatus, getDimensions, getEdgeCenter, getEdgePosition, getElementsToRemove, getElevatedEdgeZIndex, getEventPosition, getHandlePosition, getHostForElement, getInternalNodesBounds, getMarkerId, getNodeDimensions, getNodesBounds, getNodesInside, getOverlappingArea, getSmoothStepPath, getStraightPath, getViewportForBounds, handleExpandParent, infiniteExtent, initialConnection, isEdgeBase, isEdgeVisible, isInputDOMNode, isMacOs, isMouseEvent, isNodeBase, isNumeric, isRectObject, mergeAriaLabelConfig, nodeHasDimensions, nodeToRect, panBy, pointToRendererPoint, rendererPointToPoint, snapPosition, updateAbsolutePositions, updateConnectionLookup, updateNodeInternals, withResolvers } from "../../../system/dist/esm/index.js";
|
|
4
|
+
import { createContext, forwardRef, memo, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
5
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { createWithEqualityFn, useStoreWithEqualityFn } from "zustand/traditional";
|
|
7
|
+
import { shallow } from "zustand/shallow";
|
|
8
|
+
import { createPortal } from "react-dom";
|
|
9
|
+
var StoreContext = createContext(null), Provider$1 = StoreContext.Provider, zustandErrorMessage = errorMessages.error001();
|
|
10
|
+
function useStore(e, t) {
|
|
11
|
+
let n = useContext(StoreContext);
|
|
12
|
+
if (n === null) throw Error(zustandErrorMessage);
|
|
13
|
+
return useStoreWithEqualityFn(n, e, t);
|
|
14
|
+
}
|
|
15
|
+
function useStoreApi() {
|
|
16
|
+
let e = useContext(StoreContext);
|
|
17
|
+
if (e === null) throw Error(zustandErrorMessage);
|
|
18
|
+
return useMemo(() => ({
|
|
19
|
+
getState: e.getState,
|
|
20
|
+
setState: e.setState,
|
|
21
|
+
subscribe: e.subscribe
|
|
22
|
+
}), [e]);
|
|
23
|
+
}
|
|
24
|
+
var style = { display: "none" }, ariaLiveStyle = {
|
|
25
|
+
position: "absolute",
|
|
26
|
+
width: 1,
|
|
27
|
+
height: 1,
|
|
28
|
+
margin: -1,
|
|
29
|
+
border: 0,
|
|
30
|
+
padding: 0,
|
|
31
|
+
overflow: "hidden",
|
|
32
|
+
clip: "rect(0px, 0px, 0px, 0px)",
|
|
33
|
+
clipPath: "inset(100%)"
|
|
34
|
+
}, ARIA_NODE_DESC_KEY = "react-flow__node-desc", ARIA_EDGE_DESC_KEY = "react-flow__edge-desc", ARIA_LIVE_MESSAGE = "react-flow__aria-live", ariaLiveSelector = (e) => e.ariaLiveMessage, ariaLabelConfigSelector = (e) => e.ariaLabelConfig;
|
|
35
|
+
function AriaLiveMessage({ rfId: e }) {
|
|
36
|
+
let t = useStore(ariaLiveSelector);
|
|
37
|
+
return jsx("div", {
|
|
38
|
+
id: `${ARIA_LIVE_MESSAGE}-${e}`,
|
|
39
|
+
"aria-live": "assertive",
|
|
40
|
+
"aria-atomic": "true",
|
|
41
|
+
style: ariaLiveStyle,
|
|
42
|
+
children: t
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function A11yDescriptions({ rfId: e, disableKeyboardA11y: t }) {
|
|
46
|
+
let n = useStore(ariaLabelConfigSelector);
|
|
47
|
+
return jsxs(Fragment$1, { children: [
|
|
48
|
+
jsx("div", {
|
|
49
|
+
id: `${ARIA_NODE_DESC_KEY}-${e}`,
|
|
50
|
+
style,
|
|
51
|
+
children: t ? n["node.a11yDescription.default"] : n["node.a11yDescription.keyboardDisabled"]
|
|
52
|
+
}),
|
|
53
|
+
jsx("div", {
|
|
54
|
+
id: `${ARIA_EDGE_DESC_KEY}-${e}`,
|
|
55
|
+
style,
|
|
56
|
+
children: n["edge.a11yDescription.default"]
|
|
57
|
+
}),
|
|
58
|
+
!t && jsx(AriaLiveMessage, { rfId: e })
|
|
59
|
+
] });
|
|
60
|
+
}
|
|
61
|
+
var Panel = forwardRef(({ position: t = "top-left", children: n, className: r, style: i, ...a }, o) => jsx("div", {
|
|
62
|
+
className: cc([
|
|
63
|
+
"react-flow__panel",
|
|
64
|
+
r,
|
|
65
|
+
...`${t}`.split("-")
|
|
66
|
+
]),
|
|
67
|
+
style: i,
|
|
68
|
+
ref: o,
|
|
69
|
+
...a,
|
|
70
|
+
children: n
|
|
71
|
+
}));
|
|
72
|
+
Panel.displayName = "Panel";
|
|
73
|
+
function Attribution({ proOptions: e, position: t = "bottom-right" }) {
|
|
74
|
+
return e?.hideAttribution ? null : jsx(Panel, {
|
|
75
|
+
position: t,
|
|
76
|
+
className: "react-flow__attribution",
|
|
77
|
+
"data-message": "Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",
|
|
78
|
+
children: jsx("a", {
|
|
79
|
+
href: "https://reactflow.dev",
|
|
80
|
+
target: "_blank",
|
|
81
|
+
rel: "noopener noreferrer",
|
|
82
|
+
"aria-label": "React Flow attribution",
|
|
83
|
+
children: "React Flow"
|
|
84
|
+
})
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
var selector$m = (e) => {
|
|
88
|
+
let t = [], n = [];
|
|
89
|
+
for (let [, n] of e.nodeLookup) n.selected && t.push(n.internals.userNode);
|
|
90
|
+
for (let [, t] of e.edgeLookup) t.selected && n.push(t);
|
|
91
|
+
return {
|
|
92
|
+
selectedNodes: t,
|
|
93
|
+
selectedEdges: n
|
|
94
|
+
};
|
|
95
|
+
}, selectId = (e) => e.id;
|
|
96
|
+
function areEqual(e, t) {
|
|
97
|
+
return shallow(e.selectedNodes.map(selectId), t.selectedNodes.map(selectId)) && shallow(e.selectedEdges.map(selectId), t.selectedEdges.map(selectId));
|
|
98
|
+
}
|
|
99
|
+
function SelectionListenerInner({ onSelectionChange: e }) {
|
|
100
|
+
let t = useStoreApi(), { selectedNodes: n, selectedEdges: r } = useStore(selector$m, areEqual);
|
|
101
|
+
return useEffect(() => {
|
|
102
|
+
let i = {
|
|
103
|
+
nodes: n,
|
|
104
|
+
edges: r
|
|
105
|
+
};
|
|
106
|
+
e?.(i), t.getState().onSelectionChangeHandlers.forEach((e) => e(i));
|
|
107
|
+
}, [
|
|
108
|
+
n,
|
|
109
|
+
r,
|
|
110
|
+
e
|
|
111
|
+
]), null;
|
|
112
|
+
}
|
|
113
|
+
var changeSelector = (e) => !!e.onSelectionChangeHandlers;
|
|
114
|
+
function SelectionListener({ onSelectionChange: e }) {
|
|
115
|
+
let t = useStore(changeSelector);
|
|
116
|
+
return e || t ? jsx(SelectionListenerInner, { onSelectionChange: e }) : null;
|
|
117
|
+
}
|
|
118
|
+
var defaultNodeOrigin = [0, 0], defaultViewport = {
|
|
119
|
+
x: 0,
|
|
120
|
+
y: 0,
|
|
121
|
+
zoom: 1
|
|
122
|
+
}, fieldsToTrack = [.../* @__PURE__ */ "nodes.edges.defaultNodes.defaultEdges.onConnect.onConnectStart.onConnectEnd.onClickConnectStart.onClickConnectEnd.nodesDraggable.autoPanOnNodeFocus.nodesConnectable.nodesFocusable.edgesFocusable.edgesReconnectable.elevateNodesOnSelect.elevateEdgesOnSelect.minZoom.maxZoom.nodeExtent.onNodesChange.onEdgesChange.elementsSelectable.connectionMode.snapGrid.snapToGrid.translateExtent.connectOnClick.defaultEdgeOptions.fitView.fitViewOptions.onNodesDelete.onEdgesDelete.onDelete.onNodeDrag.onNodeDragStart.onNodeDragStop.onSelectionDrag.onSelectionDragStart.onSelectionDragStop.onMoveStart.onMove.onMoveEnd.noPanClassName.nodeOrigin.autoPanOnConnect.autoPanOnNodeDrag.onError.connectionRadius.isValidConnection.selectNodesOnDrag.nodeDragThreshold.connectionDragThreshold.onBeforeDelete.debug.autoPanSpeed.ariaLabelConfig.zIndexMode".split("."), "rfId"], selector$l = (e) => ({
|
|
123
|
+
setNodes: e.setNodes,
|
|
124
|
+
setEdges: e.setEdges,
|
|
125
|
+
setMinZoom: e.setMinZoom,
|
|
126
|
+
setMaxZoom: e.setMaxZoom,
|
|
127
|
+
setTranslateExtent: e.setTranslateExtent,
|
|
128
|
+
setNodeExtent: e.setNodeExtent,
|
|
129
|
+
reset: e.reset,
|
|
130
|
+
setDefaultNodesAndEdges: e.setDefaultNodesAndEdges
|
|
131
|
+
}), initPrevValues = {
|
|
132
|
+
translateExtent: infiniteExtent,
|
|
133
|
+
nodeOrigin: defaultNodeOrigin,
|
|
134
|
+
minZoom: .5,
|
|
135
|
+
maxZoom: 2,
|
|
136
|
+
elementsSelectable: !0,
|
|
137
|
+
noPanClassName: "nopan",
|
|
138
|
+
rfId: "1"
|
|
139
|
+
};
|
|
140
|
+
function StoreUpdater(e) {
|
|
141
|
+
let { setNodes: t, setEdges: n, setMinZoom: r, setMaxZoom: i, setTranslateExtent: a, setNodeExtent: o, reset: s, setDefaultNodesAndEdges: c } = useStore(selector$l, shallow), l = useStoreApi();
|
|
142
|
+
useEffect(() => (c(e.defaultNodes, e.defaultEdges), () => {
|
|
143
|
+
u.current = initPrevValues, s();
|
|
144
|
+
}), []);
|
|
145
|
+
let u = useRef(initPrevValues);
|
|
146
|
+
return useEffect(() => {
|
|
147
|
+
for (let s of fieldsToTrack) {
|
|
148
|
+
let c = e[s];
|
|
149
|
+
c !== u.current[s] && e[s] !== void 0 && (s === "nodes" ? t(c) : s === "edges" ? n(c) : s === "minZoom" ? r(c) : s === "maxZoom" ? i(c) : s === "translateExtent" ? a(c) : s === "nodeExtent" ? o(c) : s === "ariaLabelConfig" ? l.setState({ ariaLabelConfig: mergeAriaLabelConfig(c) }) : s === "fitView" ? l.setState({ fitViewQueued: c }) : s === "fitViewOptions" ? l.setState({ fitViewOptions: c }) : l.setState({ [s]: c }));
|
|
150
|
+
}
|
|
151
|
+
u.current = e;
|
|
152
|
+
}, fieldsToTrack.map((t) => e[t])), null;
|
|
153
|
+
}
|
|
154
|
+
function getMediaQuery() {
|
|
155
|
+
return typeof window > "u" || !window.matchMedia ? null : window.matchMedia("(prefers-color-scheme: dark)");
|
|
156
|
+
}
|
|
157
|
+
function useColorModeClass(e) {
|
|
158
|
+
let [t, n] = useState(e === "system" ? null : e);
|
|
159
|
+
return useEffect(() => {
|
|
160
|
+
if (e !== "system") {
|
|
161
|
+
n(e);
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
let t = getMediaQuery(), r = () => n(t?.matches ? "dark" : "light");
|
|
165
|
+
return r(), t?.addEventListener("change", r), () => {
|
|
166
|
+
t?.removeEventListener("change", r);
|
|
167
|
+
};
|
|
168
|
+
}, [e]), t === null ? getMediaQuery()?.matches ? "dark" : "light" : t;
|
|
169
|
+
}
|
|
170
|
+
var defaultDoc = typeof document < "u" ? document : null;
|
|
171
|
+
function useKeyPress(e = null, t = {
|
|
172
|
+
target: defaultDoc,
|
|
173
|
+
actInsideInputWithModifier: !0
|
|
174
|
+
}) {
|
|
175
|
+
let [n, r] = useState(!1), i = useRef(!1), a = useRef(/* @__PURE__ */ new Set([])), [o, s] = useMemo(() => {
|
|
176
|
+
if (e !== null) {
|
|
177
|
+
let t = (Array.isArray(e) ? e : [e]).filter((e) => typeof e == "string").map((e) => e.replace("+", "\n").replace("\n\n", "\n+").split("\n"));
|
|
178
|
+
return [t, t.reduce((e, t) => e.concat(...t), [])];
|
|
179
|
+
}
|
|
180
|
+
return [[], []];
|
|
181
|
+
}, [e]);
|
|
182
|
+
return useEffect(() => {
|
|
183
|
+
let n = t?.target ?? defaultDoc, c = t?.actInsideInputWithModifier ?? !0;
|
|
184
|
+
if (e !== null) {
|
|
185
|
+
let e = (e) => {
|
|
186
|
+
if (i.current = e.ctrlKey || e.metaKey || e.shiftKey || e.altKey, (!i.current || i.current && !c) && isInputDOMNode(e)) return !1;
|
|
187
|
+
let n = useKeyOrCode(e.code, s);
|
|
188
|
+
if (a.current.add(e[n]), isMatchingKey(o, a.current, !1)) {
|
|
189
|
+
let n = e.composedPath?.()?.[0] || e.target, a = n?.nodeName === "BUTTON" || n?.nodeName === "A";
|
|
190
|
+
t.preventDefault !== !1 && (i.current || !a) && e.preventDefault(), r(!0);
|
|
191
|
+
}
|
|
192
|
+
}, l = (e) => {
|
|
193
|
+
let t = useKeyOrCode(e.code, s);
|
|
194
|
+
isMatchingKey(o, a.current, !0) ? (r(!1), a.current.clear()) : a.current.delete(e[t]), e.key === "Meta" && a.current.clear(), i.current = !1;
|
|
195
|
+
}, u = () => {
|
|
196
|
+
a.current.clear(), r(!1);
|
|
197
|
+
};
|
|
198
|
+
return n?.addEventListener("keydown", e), n?.addEventListener("keyup", l), window.addEventListener("blur", u), window.addEventListener("contextmenu", u), () => {
|
|
199
|
+
n?.removeEventListener("keydown", e), n?.removeEventListener("keyup", l), window.removeEventListener("blur", u), window.removeEventListener("contextmenu", u);
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
}, [e, r]), n;
|
|
203
|
+
}
|
|
204
|
+
function isMatchingKey(e, t, n) {
|
|
205
|
+
return e.filter((e) => n || e.length === t.size).some((e) => e.every((e) => t.has(e)));
|
|
206
|
+
}
|
|
207
|
+
function useKeyOrCode(e, t) {
|
|
208
|
+
return t.includes(e) ? "code" : "key";
|
|
209
|
+
}
|
|
210
|
+
var useViewportHelper = () => {
|
|
211
|
+
let e = useStoreApi();
|
|
212
|
+
return useMemo(() => ({
|
|
213
|
+
zoomIn: (t) => {
|
|
214
|
+
let { panZoom: n } = e.getState();
|
|
215
|
+
return n ? n.scaleBy(1.2, { duration: t?.duration }) : Promise.resolve(!1);
|
|
216
|
+
},
|
|
217
|
+
zoomOut: (t) => {
|
|
218
|
+
let { panZoom: n } = e.getState();
|
|
219
|
+
return n ? n.scaleBy(1 / 1.2, { duration: t?.duration }) : Promise.resolve(!1);
|
|
220
|
+
},
|
|
221
|
+
zoomTo: (t, n) => {
|
|
222
|
+
let { panZoom: r } = e.getState();
|
|
223
|
+
return r ? r.scaleTo(t, { duration: n?.duration }) : Promise.resolve(!1);
|
|
224
|
+
},
|
|
225
|
+
getZoom: () => e.getState().transform[2],
|
|
226
|
+
setViewport: async (t, n) => {
|
|
227
|
+
let { transform: [r, i, a], panZoom: o } = e.getState();
|
|
228
|
+
return o ? (await o.setViewport({
|
|
229
|
+
x: t.x ?? r,
|
|
230
|
+
y: t.y ?? i,
|
|
231
|
+
zoom: t.zoom ?? a
|
|
232
|
+
}, n), Promise.resolve(!0)) : Promise.resolve(!1);
|
|
233
|
+
},
|
|
234
|
+
getViewport: () => {
|
|
235
|
+
let [t, n, r] = e.getState().transform;
|
|
236
|
+
return {
|
|
237
|
+
x: t,
|
|
238
|
+
y: n,
|
|
239
|
+
zoom: r
|
|
240
|
+
};
|
|
241
|
+
},
|
|
242
|
+
setCenter: async (t, n, r) => e.getState().setCenter(t, n, r),
|
|
243
|
+
fitBounds: async (t, n) => {
|
|
244
|
+
let { width: r, height: i, minZoom: a, maxZoom: o, panZoom: s } = e.getState(), c = getViewportForBounds(t, r, i, a, o, n?.padding ?? .1);
|
|
245
|
+
return s ? (await s.setViewport(c, {
|
|
246
|
+
duration: n?.duration,
|
|
247
|
+
ease: n?.ease,
|
|
248
|
+
interpolate: n?.interpolate
|
|
249
|
+
}), Promise.resolve(!0)) : Promise.resolve(!1);
|
|
250
|
+
},
|
|
251
|
+
screenToFlowPosition: (t, n = {}) => {
|
|
252
|
+
let { transform: r, snapGrid: i, snapToGrid: a, domNode: o } = e.getState();
|
|
253
|
+
if (!o) return t;
|
|
254
|
+
let { x: s, y: c } = o.getBoundingClientRect(), l = {
|
|
255
|
+
x: t.x - s,
|
|
256
|
+
y: t.y - c
|
|
257
|
+
}, u = n.snapGrid ?? i;
|
|
258
|
+
return pointToRendererPoint(l, r, n.snapToGrid ?? a, u);
|
|
259
|
+
},
|
|
260
|
+
flowToScreenPosition: (t) => {
|
|
261
|
+
let { transform: n, domNode: r } = e.getState();
|
|
262
|
+
if (!r) return t;
|
|
263
|
+
let { x: i, y: a } = r.getBoundingClientRect(), o = rendererPointToPoint(t, n);
|
|
264
|
+
return {
|
|
265
|
+
x: o.x + i,
|
|
266
|
+
y: o.y + a
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
}), []);
|
|
270
|
+
};
|
|
271
|
+
function applyChanges(e, t) {
|
|
272
|
+
let n = [], r = /* @__PURE__ */ new Map(), i = [];
|
|
273
|
+
for (let t of e) if (t.type === "add") {
|
|
274
|
+
i.push(t);
|
|
275
|
+
continue;
|
|
276
|
+
} else if (t.type === "remove" || t.type === "replace") r.set(t.id, [t]);
|
|
277
|
+
else {
|
|
278
|
+
let e = r.get(t.id);
|
|
279
|
+
e ? e.push(t) : r.set(t.id, [t]);
|
|
280
|
+
}
|
|
281
|
+
for (let e of t) {
|
|
282
|
+
let t = r.get(e.id);
|
|
283
|
+
if (!t) {
|
|
284
|
+
n.push(e);
|
|
285
|
+
continue;
|
|
286
|
+
}
|
|
287
|
+
if (t[0].type === "remove") continue;
|
|
288
|
+
if (t[0].type === "replace") {
|
|
289
|
+
n.push({ ...t[0].item });
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
292
|
+
let i = { ...e };
|
|
293
|
+
for (let e of t) applyChange(e, i);
|
|
294
|
+
n.push(i);
|
|
295
|
+
}
|
|
296
|
+
return i.length && i.forEach((e) => {
|
|
297
|
+
e.index === void 0 ? n.push({ ...e.item }) : n.splice(e.index, 0, { ...e.item });
|
|
298
|
+
}), n;
|
|
299
|
+
}
|
|
300
|
+
function applyChange(e, t) {
|
|
301
|
+
switch (e.type) {
|
|
302
|
+
case "select":
|
|
303
|
+
t.selected = e.selected;
|
|
304
|
+
break;
|
|
305
|
+
case "position":
|
|
306
|
+
e.position !== void 0 && (t.position = e.position), e.dragging !== void 0 && (t.dragging = e.dragging);
|
|
307
|
+
break;
|
|
308
|
+
case "dimensions":
|
|
309
|
+
e.dimensions !== void 0 && (t.measured = { ...e.dimensions }, e.setAttributes && ((e.setAttributes === !0 || e.setAttributes === "width") && (t.width = e.dimensions.width), (e.setAttributes === !0 || e.setAttributes === "height") && (t.height = e.dimensions.height))), typeof e.resizing == "boolean" && (t.resizing = e.resizing);
|
|
310
|
+
break;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
function applyNodeChanges(e, t) {
|
|
314
|
+
return applyChanges(e, t);
|
|
315
|
+
}
|
|
316
|
+
function applyEdgeChanges(e, t) {
|
|
317
|
+
return applyChanges(e, t);
|
|
318
|
+
}
|
|
319
|
+
function createSelectionChange(e, t) {
|
|
320
|
+
return {
|
|
321
|
+
id: e,
|
|
322
|
+
type: "select",
|
|
323
|
+
selected: t
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
function getSelectionChanges(e, t = /* @__PURE__ */ new Set(), n = !1) {
|
|
327
|
+
let r = [];
|
|
328
|
+
for (let [i, a] of e) {
|
|
329
|
+
let e = t.has(i);
|
|
330
|
+
!(a.selected === void 0 && !e) && a.selected !== e && (n && (a.selected = e), r.push(createSelectionChange(a.id, e)));
|
|
331
|
+
}
|
|
332
|
+
return r;
|
|
333
|
+
}
|
|
334
|
+
function getElementsDiffChanges({ items: e = [], lookup: t }) {
|
|
335
|
+
let n = [], r = new Map(e.map((e) => [e.id, e]));
|
|
336
|
+
for (let [r, i] of e.entries()) {
|
|
337
|
+
let e = t.get(i.id), a = e?.internals?.userNode ?? e;
|
|
338
|
+
a !== void 0 && a !== i && n.push({
|
|
339
|
+
id: i.id,
|
|
340
|
+
item: i,
|
|
341
|
+
type: "replace"
|
|
342
|
+
}), a === void 0 && n.push({
|
|
343
|
+
item: i,
|
|
344
|
+
type: "add",
|
|
345
|
+
index: r
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
for (let [e] of t) r.get(e) === void 0 && n.push({
|
|
349
|
+
id: e,
|
|
350
|
+
type: "remove"
|
|
351
|
+
});
|
|
352
|
+
return n;
|
|
353
|
+
}
|
|
354
|
+
function elementToRemoveChange(e) {
|
|
355
|
+
return {
|
|
356
|
+
id: e.id,
|
|
357
|
+
type: "remove"
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
var isNode = (e) => isNodeBase(e), isEdge = (e) => isEdgeBase(e);
|
|
361
|
+
function fixedForwardRef(e) {
|
|
362
|
+
return forwardRef(e);
|
|
363
|
+
}
|
|
364
|
+
var useIsomorphicLayoutEffect = typeof window < "u" ? useLayoutEffect : useEffect;
|
|
365
|
+
function useQueue(e) {
|
|
366
|
+
let [t, n] = useState(BigInt(0)), [r] = useState(() => createQueue(() => n((e) => e + BigInt(1))));
|
|
367
|
+
return useIsomorphicLayoutEffect(() => {
|
|
368
|
+
let t = r.get();
|
|
369
|
+
t.length && (e(t), r.reset());
|
|
370
|
+
}, [t]), r;
|
|
371
|
+
}
|
|
372
|
+
function createQueue(e) {
|
|
373
|
+
let t = [];
|
|
374
|
+
return {
|
|
375
|
+
get: () => t,
|
|
376
|
+
reset: () => {
|
|
377
|
+
t = [];
|
|
378
|
+
},
|
|
379
|
+
push: (n) => {
|
|
380
|
+
t.push(n), e();
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
var BatchContext = createContext(null);
|
|
385
|
+
function BatchProvider({ children: e }) {
|
|
386
|
+
let t = useStoreApi(), n = useQueue(useCallback((e) => {
|
|
387
|
+
let { nodes: n = [], setNodes: r, hasDefaultNodes: i, onNodesChange: a, nodeLookup: o, fitViewQueued: s, onNodesChangeMiddlewareMap: c } = t.getState(), l = n;
|
|
388
|
+
for (let t of e) l = typeof t == "function" ? t(l) : t;
|
|
389
|
+
let u = getElementsDiffChanges({
|
|
390
|
+
items: l,
|
|
391
|
+
lookup: o
|
|
392
|
+
});
|
|
393
|
+
for (let e of c.values()) u = e(u);
|
|
394
|
+
i && r(l), u.length > 0 ? a?.(u) : s && window.requestAnimationFrame(() => {
|
|
395
|
+
let { fitViewQueued: e, nodes: n, setNodes: r } = t.getState();
|
|
396
|
+
e && r(n);
|
|
397
|
+
});
|
|
398
|
+
}, [])), r = useQueue(useCallback((e) => {
|
|
399
|
+
let { edges: n = [], setEdges: r, hasDefaultEdges: i, onEdgesChange: a, edgeLookup: o } = t.getState(), s = n;
|
|
400
|
+
for (let t of e) s = typeof t == "function" ? t(s) : t;
|
|
401
|
+
i ? r(s) : a && a(getElementsDiffChanges({
|
|
402
|
+
items: s,
|
|
403
|
+
lookup: o
|
|
404
|
+
}));
|
|
405
|
+
}, [])), i = useMemo(() => ({
|
|
406
|
+
nodeQueue: n,
|
|
407
|
+
edgeQueue: r
|
|
408
|
+
}), []);
|
|
409
|
+
return jsx(BatchContext.Provider, {
|
|
410
|
+
value: i,
|
|
411
|
+
children: e
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
function useBatchContext() {
|
|
415
|
+
let e = useContext(BatchContext);
|
|
416
|
+
if (!e) throw Error("useBatchContext must be used within a BatchProvider");
|
|
417
|
+
return e;
|
|
418
|
+
}
|
|
419
|
+
var selector$k = (e) => !!e.panZoom;
|
|
420
|
+
function useReactFlow() {
|
|
421
|
+
let e = useViewportHelper(), t = useStoreApi(), n = useBatchContext(), r = useStore(selector$k), i = useMemo(() => {
|
|
422
|
+
let e = (e) => t.getState().nodeLookup.get(e), r = (e) => {
|
|
423
|
+
n.nodeQueue.push(e);
|
|
424
|
+
}, i = (e) => {
|
|
425
|
+
n.edgeQueue.push(e);
|
|
426
|
+
}, a = (e) => {
|
|
427
|
+
let { nodeLookup: n, nodeOrigin: r } = t.getState(), i = isNode(e) ? e : n.get(e.id), a = i.parentId ? evaluateAbsolutePosition(i.position, i.measured, i.parentId, n, r) : i.position;
|
|
428
|
+
return nodeToRect({
|
|
429
|
+
...i,
|
|
430
|
+
position: a,
|
|
431
|
+
width: i.measured?.width ?? i.width,
|
|
432
|
+
height: i.measured?.height ?? i.height
|
|
433
|
+
});
|
|
434
|
+
}, o = (e, t, n = { replace: !1 }) => {
|
|
435
|
+
r((r) => r.map((r) => {
|
|
436
|
+
if (r.id === e) {
|
|
437
|
+
let e = typeof t == "function" ? t(r) : t;
|
|
438
|
+
return n.replace && isNode(e) ? e : {
|
|
439
|
+
...r,
|
|
440
|
+
...e
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
return r;
|
|
444
|
+
}));
|
|
445
|
+
}, s = (e, t, n = { replace: !1 }) => {
|
|
446
|
+
i((r) => r.map((r) => {
|
|
447
|
+
if (r.id === e) {
|
|
448
|
+
let e = typeof t == "function" ? t(r) : t;
|
|
449
|
+
return n.replace && isEdge(e) ? e : {
|
|
450
|
+
...r,
|
|
451
|
+
...e
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
return r;
|
|
455
|
+
}));
|
|
456
|
+
};
|
|
457
|
+
return {
|
|
458
|
+
getNodes: () => t.getState().nodes.map((e) => ({ ...e })),
|
|
459
|
+
getNode: (t) => e(t)?.internals.userNode,
|
|
460
|
+
getInternalNode: e,
|
|
461
|
+
getEdges: () => {
|
|
462
|
+
let { edges: e = [] } = t.getState();
|
|
463
|
+
return e.map((e) => ({ ...e }));
|
|
464
|
+
},
|
|
465
|
+
getEdge: (e) => t.getState().edgeLookup.get(e),
|
|
466
|
+
setNodes: r,
|
|
467
|
+
setEdges: i,
|
|
468
|
+
addNodes: (e) => {
|
|
469
|
+
let t = Array.isArray(e) ? e : [e];
|
|
470
|
+
n.nodeQueue.push((e) => [...e, ...t]);
|
|
471
|
+
},
|
|
472
|
+
addEdges: (e) => {
|
|
473
|
+
let t = Array.isArray(e) ? e : [e];
|
|
474
|
+
n.edgeQueue.push((e) => [...e, ...t]);
|
|
475
|
+
},
|
|
476
|
+
toObject: () => {
|
|
477
|
+
let { nodes: e = [], edges: n = [], transform: r } = t.getState(), [i, a, o] = r;
|
|
478
|
+
return {
|
|
479
|
+
nodes: e.map((e) => ({ ...e })),
|
|
480
|
+
edges: n.map((e) => ({ ...e })),
|
|
481
|
+
viewport: {
|
|
482
|
+
x: i,
|
|
483
|
+
y: a,
|
|
484
|
+
zoom: o
|
|
485
|
+
}
|
|
486
|
+
};
|
|
487
|
+
},
|
|
488
|
+
deleteElements: async ({ nodes: e = [], edges: n = [] }) => {
|
|
489
|
+
let { nodes: r, edges: i, onNodesDelete: a, onEdgesDelete: o, triggerNodeChanges: s, triggerEdgeChanges: c, onDelete: l, onBeforeDelete: u } = t.getState(), { nodes: d, edges: f } = await getElementsToRemove({
|
|
490
|
+
nodesToRemove: e,
|
|
491
|
+
edgesToRemove: n,
|
|
492
|
+
nodes: r,
|
|
493
|
+
edges: i,
|
|
494
|
+
onBeforeDelete: u
|
|
495
|
+
}), p = f.length > 0, m = d.length > 0;
|
|
496
|
+
if (p) {
|
|
497
|
+
let e = f.map(elementToRemoveChange);
|
|
498
|
+
o?.(f), c(e);
|
|
499
|
+
}
|
|
500
|
+
if (m) {
|
|
501
|
+
let e = d.map(elementToRemoveChange);
|
|
502
|
+
a?.(d), s(e);
|
|
503
|
+
}
|
|
504
|
+
return (m || p) && l?.({
|
|
505
|
+
nodes: d,
|
|
506
|
+
edges: f
|
|
507
|
+
}), {
|
|
508
|
+
deletedNodes: d,
|
|
509
|
+
deletedEdges: f
|
|
510
|
+
};
|
|
511
|
+
},
|
|
512
|
+
getIntersectingNodes: (e, n = !0, r) => {
|
|
513
|
+
let i = isRectObject(e), o = i ? e : a(e), s = r !== void 0;
|
|
514
|
+
return o ? (r || t.getState().nodes).filter((r) => {
|
|
515
|
+
let a = t.getState().nodeLookup.get(r.id);
|
|
516
|
+
if (a && !i && (r.id === e.id || !a.internals.positionAbsolute)) return !1;
|
|
517
|
+
let c = nodeToRect(s ? r : a), l = getOverlappingArea(c, o);
|
|
518
|
+
return n && l > 0 || l >= c.width * c.height || l >= o.width * o.height;
|
|
519
|
+
}) : [];
|
|
520
|
+
},
|
|
521
|
+
isNodeIntersecting: (e, t, n = !0) => {
|
|
522
|
+
let r = isRectObject(e) ? e : a(e);
|
|
523
|
+
if (!r) return !1;
|
|
524
|
+
let i = getOverlappingArea(r, t);
|
|
525
|
+
return n && i > 0 || i >= t.width * t.height || i >= r.width * r.height;
|
|
526
|
+
},
|
|
527
|
+
updateNode: o,
|
|
528
|
+
updateNodeData: (e, t, n = { replace: !1 }) => {
|
|
529
|
+
o(e, (e) => {
|
|
530
|
+
let r = typeof t == "function" ? t(e) : t;
|
|
531
|
+
return n.replace ? {
|
|
532
|
+
...e,
|
|
533
|
+
data: r
|
|
534
|
+
} : {
|
|
535
|
+
...e,
|
|
536
|
+
data: {
|
|
537
|
+
...e.data,
|
|
538
|
+
...r
|
|
539
|
+
}
|
|
540
|
+
};
|
|
541
|
+
}, n);
|
|
542
|
+
},
|
|
543
|
+
updateEdge: s,
|
|
544
|
+
updateEdgeData: (e, t, n = { replace: !1 }) => {
|
|
545
|
+
s(e, (e) => {
|
|
546
|
+
let r = typeof t == "function" ? t(e) : t;
|
|
547
|
+
return n.replace ? {
|
|
548
|
+
...e,
|
|
549
|
+
data: r
|
|
550
|
+
} : {
|
|
551
|
+
...e,
|
|
552
|
+
data: {
|
|
553
|
+
...e.data,
|
|
554
|
+
...r
|
|
555
|
+
}
|
|
556
|
+
};
|
|
557
|
+
}, n);
|
|
558
|
+
},
|
|
559
|
+
getNodesBounds: (e) => {
|
|
560
|
+
let { nodeLookup: n, nodeOrigin: r } = t.getState();
|
|
561
|
+
return getNodesBounds(e, {
|
|
562
|
+
nodeLookup: n,
|
|
563
|
+
nodeOrigin: r
|
|
564
|
+
});
|
|
565
|
+
},
|
|
566
|
+
getHandleConnections: ({ type: e, id: n, nodeId: r }) => Array.from(t.getState().connectionLookup.get(`${r}-${e}${n ? `-${n}` : ""}`)?.values() ?? []),
|
|
567
|
+
getNodeConnections: ({ type: e, handleId: n, nodeId: r }) => Array.from(t.getState().connectionLookup.get(`${r}${e ? n ? `-${e}-${n}` : `-${e}` : ""}`)?.values() ?? []),
|
|
568
|
+
fitView: async (e) => {
|
|
569
|
+
let r = t.getState().fitViewResolver ?? withResolvers();
|
|
570
|
+
return t.setState({
|
|
571
|
+
fitViewQueued: !0,
|
|
572
|
+
fitViewOptions: e,
|
|
573
|
+
fitViewResolver: r
|
|
574
|
+
}), n.nodeQueue.push((e) => [...e]), r.promise;
|
|
575
|
+
}
|
|
576
|
+
};
|
|
577
|
+
}, []);
|
|
578
|
+
return useMemo(() => ({
|
|
579
|
+
...i,
|
|
580
|
+
...e,
|
|
581
|
+
viewportInitialized: r
|
|
582
|
+
}), [r]);
|
|
583
|
+
}
|
|
584
|
+
var selected = (e) => e.selected, win$1 = typeof window < "u" ? window : void 0;
|
|
585
|
+
function useGlobalKeyHandler({ deleteKeyCode: e, multiSelectionKeyCode: t }) {
|
|
586
|
+
let n = useStoreApi(), { deleteElements: r } = useReactFlow(), i = useKeyPress(e, { actInsideInputWithModifier: !1 }), a = useKeyPress(t, { target: win$1 });
|
|
587
|
+
useEffect(() => {
|
|
588
|
+
if (i) {
|
|
589
|
+
let { edges: e, nodes: t } = n.getState();
|
|
590
|
+
r({
|
|
591
|
+
nodes: t.filter(selected),
|
|
592
|
+
edges: e.filter(selected)
|
|
593
|
+
}), n.setState({ nodesSelectionActive: !1 });
|
|
594
|
+
}
|
|
595
|
+
}, [i]), useEffect(() => {
|
|
596
|
+
n.setState({ multiSelectionActive: a });
|
|
597
|
+
}, [a]);
|
|
598
|
+
}
|
|
599
|
+
function useResizeHandler(e) {
|
|
600
|
+
let t = useStoreApi();
|
|
601
|
+
useEffect(() => {
|
|
602
|
+
let n = () => {
|
|
603
|
+
if (!e.current || !(e.current.checkVisibility?.() ?? !0)) return !1;
|
|
604
|
+
let n = getDimensions(e.current);
|
|
605
|
+
(n.height === 0 || n.width === 0) && t.getState().onError?.("004", errorMessages.error004()), t.setState({
|
|
606
|
+
width: n.width || 500,
|
|
607
|
+
height: n.height || 500
|
|
608
|
+
});
|
|
609
|
+
};
|
|
610
|
+
if (e.current) {
|
|
611
|
+
n(), window.addEventListener("resize", n);
|
|
612
|
+
let t = new ResizeObserver(() => n());
|
|
613
|
+
return t.observe(e.current), () => {
|
|
614
|
+
window.removeEventListener("resize", n), t && e.current && t.unobserve(e.current);
|
|
615
|
+
};
|
|
616
|
+
}
|
|
617
|
+
}, []);
|
|
618
|
+
}
|
|
619
|
+
var containerStyle = {
|
|
620
|
+
position: "absolute",
|
|
621
|
+
width: "100%",
|
|
622
|
+
height: "100%",
|
|
623
|
+
top: 0,
|
|
624
|
+
left: 0
|
|
625
|
+
}, selector$j = (e) => ({
|
|
626
|
+
userSelectionActive: e.userSelectionActive,
|
|
627
|
+
lib: e.lib,
|
|
628
|
+
connectionInProgress: e.connection.inProgress
|
|
629
|
+
});
|
|
630
|
+
function ZoomPane({ onPaneContextMenu: e, zoomOnScroll: t = !0, zoomOnPinch: n = !0, panOnScroll: r = !1, panOnScrollSpeed: a = .5, panOnScrollMode: o = PanOnScrollMode.Free, zoomOnDoubleClick: s = !0, panOnDrag: c = !0, defaultViewport: l, translateExtent: u, minZoom: f, maxZoom: p, zoomActivationKeyCode: m, preventScrolling: h = !0, children: g, noWheelClassName: _, noPanClassName: v, onViewportChange: y, isControlledViewport: b, paneClickDistance: x, selectionOnDrag: S }) {
|
|
631
|
+
let C = useStoreApi(), w = useRef(null), { userSelectionActive: T, lib: E, connectionInProgress: D } = useStore(selector$j, shallow), O = useKeyPress(m), k = useRef();
|
|
632
|
+
useResizeHandler(w);
|
|
633
|
+
let A = useCallback((e) => {
|
|
634
|
+
y?.({
|
|
635
|
+
x: e[0],
|
|
636
|
+
y: e[1],
|
|
637
|
+
zoom: e[2]
|
|
638
|
+
}), b || C.setState({ transform: e });
|
|
639
|
+
}, [y, b]);
|
|
640
|
+
return useEffect(() => {
|
|
641
|
+
if (w.current) {
|
|
642
|
+
k.current = XYPanZoom({
|
|
643
|
+
domNode: w.current,
|
|
644
|
+
minZoom: f,
|
|
645
|
+
maxZoom: p,
|
|
646
|
+
translateExtent: u,
|
|
647
|
+
viewport: l,
|
|
648
|
+
onDraggingChange: (e) => C.setState((t) => t.paneDragging === e ? t : { paneDragging: e }),
|
|
649
|
+
onPanZoomStart: (e, t) => {
|
|
650
|
+
let { onViewportChangeStart: n, onMoveStart: r } = C.getState();
|
|
651
|
+
r?.(e, t), n?.(t);
|
|
652
|
+
},
|
|
653
|
+
onPanZoom: (e, t) => {
|
|
654
|
+
let { onViewportChange: n, onMove: r } = C.getState();
|
|
655
|
+
r?.(e, t), n?.(t);
|
|
656
|
+
},
|
|
657
|
+
onPanZoomEnd: (e, t) => {
|
|
658
|
+
let { onViewportChangeEnd: n, onMoveEnd: r } = C.getState();
|
|
659
|
+
r?.(e, t), n?.(t);
|
|
660
|
+
}
|
|
661
|
+
});
|
|
662
|
+
let { x: e, y: t, zoom: n } = k.current.getViewport();
|
|
663
|
+
return C.setState({
|
|
664
|
+
panZoom: k.current,
|
|
665
|
+
transform: [
|
|
666
|
+
e,
|
|
667
|
+
t,
|
|
668
|
+
n
|
|
669
|
+
],
|
|
670
|
+
domNode: w.current.closest(".react-flow")
|
|
671
|
+
}), () => {
|
|
672
|
+
k.current?.destroy();
|
|
673
|
+
};
|
|
674
|
+
}
|
|
675
|
+
}, []), useEffect(() => {
|
|
676
|
+
k.current?.update({
|
|
677
|
+
onPaneContextMenu: e,
|
|
678
|
+
zoomOnScroll: t,
|
|
679
|
+
zoomOnPinch: n,
|
|
680
|
+
panOnScroll: r,
|
|
681
|
+
panOnScrollSpeed: a,
|
|
682
|
+
panOnScrollMode: o,
|
|
683
|
+
zoomOnDoubleClick: s,
|
|
684
|
+
panOnDrag: c,
|
|
685
|
+
zoomActivationKeyPressed: O,
|
|
686
|
+
preventScrolling: h,
|
|
687
|
+
noPanClassName: v,
|
|
688
|
+
userSelectionActive: T,
|
|
689
|
+
noWheelClassName: _,
|
|
690
|
+
lib: E,
|
|
691
|
+
onTransformChange: A,
|
|
692
|
+
connectionInProgress: D,
|
|
693
|
+
selectionOnDrag: S,
|
|
694
|
+
paneClickDistance: x
|
|
695
|
+
});
|
|
696
|
+
}, [
|
|
697
|
+
e,
|
|
698
|
+
t,
|
|
699
|
+
n,
|
|
700
|
+
r,
|
|
701
|
+
a,
|
|
702
|
+
o,
|
|
703
|
+
s,
|
|
704
|
+
c,
|
|
705
|
+
O,
|
|
706
|
+
h,
|
|
707
|
+
v,
|
|
708
|
+
T,
|
|
709
|
+
_,
|
|
710
|
+
E,
|
|
711
|
+
A,
|
|
712
|
+
D,
|
|
713
|
+
S,
|
|
714
|
+
x
|
|
715
|
+
]), jsx("div", {
|
|
716
|
+
className: "react-flow__renderer",
|
|
717
|
+
ref: w,
|
|
718
|
+
style: containerStyle,
|
|
719
|
+
children: g
|
|
720
|
+
});
|
|
721
|
+
}
|
|
722
|
+
var selector$i = (e) => ({
|
|
723
|
+
userSelectionActive: e.userSelectionActive,
|
|
724
|
+
userSelectionRect: e.userSelectionRect
|
|
725
|
+
});
|
|
726
|
+
function UserSelection() {
|
|
727
|
+
let { userSelectionActive: e, userSelectionRect: t } = useStore(selector$i, shallow);
|
|
728
|
+
return e && t ? jsx("div", {
|
|
729
|
+
className: "react-flow__selection react-flow__container",
|
|
730
|
+
style: {
|
|
731
|
+
width: t.width,
|
|
732
|
+
height: t.height,
|
|
733
|
+
transform: `translate(${t.x}px, ${t.y}px)`
|
|
734
|
+
}
|
|
735
|
+
}) : null;
|
|
736
|
+
}
|
|
737
|
+
var wrapHandler = (e, t) => (n) => {
|
|
738
|
+
n.target === t.current && e?.(n);
|
|
739
|
+
}, selector$h = (e) => ({
|
|
740
|
+
userSelectionActive: e.userSelectionActive,
|
|
741
|
+
elementsSelectable: e.elementsSelectable,
|
|
742
|
+
connectionInProgress: e.connection.inProgress,
|
|
743
|
+
dragging: e.paneDragging
|
|
744
|
+
});
|
|
745
|
+
function Pane({ isSelecting: t, selectionKeyPressed: n, selectionMode: r = SelectionMode.Full, panOnDrag: i, paneClickDistance: a, selectionOnDrag: o, onSelectionStart: c, onSelectionEnd: l, onPaneClick: u, onPaneContextMenu: d, onPaneScroll: f, onPaneMouseEnter: p, onPaneMouseMove: m, onPaneMouseLeave: g, children: _ }) {
|
|
746
|
+
let v = useStoreApi(), { userSelectionActive: y, elementsSelectable: b, dragging: x, connectionInProgress: S } = useStore(selector$h, shallow), C = b && (t || y), w = useRef(null), T = useRef(), E = useRef(/* @__PURE__ */ new Set()), D = useRef(/* @__PURE__ */ new Set()), O = useRef(!1), k = (e) => {
|
|
747
|
+
if (O.current || S) {
|
|
748
|
+
O.current = !1;
|
|
749
|
+
return;
|
|
750
|
+
}
|
|
751
|
+
u?.(e), v.getState().resetSelectedElements(), v.setState({ nodesSelectionActive: !1 });
|
|
752
|
+
}, A = (e) => {
|
|
753
|
+
if (Array.isArray(i) && i?.includes(2)) {
|
|
754
|
+
e.preventDefault();
|
|
755
|
+
return;
|
|
756
|
+
}
|
|
757
|
+
d?.(e);
|
|
758
|
+
}, j = f ? (e) => f(e) : void 0;
|
|
759
|
+
return jsxs("div", {
|
|
760
|
+
className: cc(["react-flow__pane", {
|
|
761
|
+
draggable: i === !0 || Array.isArray(i) && i.includes(0),
|
|
762
|
+
dragging: x,
|
|
763
|
+
selection: t
|
|
764
|
+
}]),
|
|
765
|
+
onClick: C ? void 0 : wrapHandler(k, w),
|
|
766
|
+
onContextMenu: wrapHandler(A, w),
|
|
767
|
+
onWheel: wrapHandler(j, w),
|
|
768
|
+
onPointerEnter: C ? void 0 : p,
|
|
769
|
+
onPointerMove: C ? (e) => {
|
|
770
|
+
let { userSelectionRect: t, transform: i, nodeLookup: o, edgeLookup: l, connectionLookup: u, triggerNodeChanges: d, triggerEdgeChanges: f, defaultEdgeOptions: p, resetSelectedElements: m } = v.getState();
|
|
771
|
+
if (!T.current || !t) return;
|
|
772
|
+
let { x: g, y: _ } = getEventPosition(e.nativeEvent, T.current), { startX: y, startY: b } = t;
|
|
773
|
+
if (!O.current) {
|
|
774
|
+
let t = n ? 0 : a;
|
|
775
|
+
if (Math.hypot(g - y, _ - b) <= t) return;
|
|
776
|
+
m(), c?.(e);
|
|
777
|
+
}
|
|
778
|
+
O.current = !0;
|
|
779
|
+
let x = {
|
|
780
|
+
startX: y,
|
|
781
|
+
startY: b,
|
|
782
|
+
x: g < y ? g : y,
|
|
783
|
+
y: _ < b ? _ : b,
|
|
784
|
+
width: Math.abs(g - y),
|
|
785
|
+
height: Math.abs(_ - b)
|
|
786
|
+
}, S = E.current, C = D.current;
|
|
787
|
+
E.current = new Set(getNodesInside(o, x, i, r === SelectionMode.Partial, !0).map((e) => e.id)), D.current = /* @__PURE__ */ new Set();
|
|
788
|
+
let w = p?.selectable ?? !0;
|
|
789
|
+
for (let e of E.current) {
|
|
790
|
+
let t = u.get(e);
|
|
791
|
+
if (t) for (let { edgeId: e } of t.values()) {
|
|
792
|
+
let t = l.get(e);
|
|
793
|
+
t && (t.selectable ?? w) && D.current.add(e);
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
areSetsEqual(S, E.current) || d(getSelectionChanges(o, E.current, !0)), areSetsEqual(C, D.current) || f(getSelectionChanges(l, D.current)), v.setState({
|
|
797
|
+
userSelectionRect: x,
|
|
798
|
+
userSelectionActive: !0,
|
|
799
|
+
nodesSelectionActive: !1
|
|
800
|
+
});
|
|
801
|
+
} : m,
|
|
802
|
+
onPointerUp: C ? (e) => {
|
|
803
|
+
e.button === 0 && (e.target?.releasePointerCapture?.(e.pointerId), !y && e.target === w.current && v.getState().userSelectionRect && k?.(e), v.setState({
|
|
804
|
+
userSelectionActive: !1,
|
|
805
|
+
userSelectionRect: null
|
|
806
|
+
}), O.current && (l?.(e), v.setState({ nodesSelectionActive: E.current.size > 0 })));
|
|
807
|
+
} : void 0,
|
|
808
|
+
onPointerDownCapture: C ? (e) => {
|
|
809
|
+
let { domNode: r } = v.getState();
|
|
810
|
+
if (T.current = r?.getBoundingClientRect(), !T.current) return;
|
|
811
|
+
let i = e.target === w.current;
|
|
812
|
+
if (!i && e.target.closest(".nokey") || !t || !(o && i || n) || e.button !== 0 || !e.isPrimary) return;
|
|
813
|
+
e.target?.setPointerCapture?.(e.pointerId), O.current = !1;
|
|
814
|
+
let { x: a, y: s } = getEventPosition(e.nativeEvent, T.current);
|
|
815
|
+
v.setState({ userSelectionRect: {
|
|
816
|
+
width: 0,
|
|
817
|
+
height: 0,
|
|
818
|
+
startX: a,
|
|
819
|
+
startY: s,
|
|
820
|
+
x: a,
|
|
821
|
+
y: s
|
|
822
|
+
} }), i || (e.stopPropagation(), e.preventDefault());
|
|
823
|
+
} : void 0,
|
|
824
|
+
onClickCapture: C ? (e) => {
|
|
825
|
+
O.current &&= (e.stopPropagation(), !1);
|
|
826
|
+
} : void 0,
|
|
827
|
+
onPointerLeave: g,
|
|
828
|
+
ref: w,
|
|
829
|
+
style: containerStyle,
|
|
830
|
+
children: [_, jsx(UserSelection, {})]
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
function handleNodeClick({ id: e, store: t, unselect: n = !1, nodeRef: r }) {
|
|
834
|
+
let { addSelectedNodes: i, unselectNodesAndEdges: a, multiSelectionActive: o, nodeLookup: s, onError: c } = t.getState(), l = s.get(e);
|
|
835
|
+
if (!l) {
|
|
836
|
+
c?.("012", errorMessages.error012(e));
|
|
837
|
+
return;
|
|
838
|
+
}
|
|
839
|
+
t.setState({ nodesSelectionActive: !1 }), l.selected ? (n || l.selected && o) && (a({
|
|
840
|
+
nodes: [l],
|
|
841
|
+
edges: []
|
|
842
|
+
}), requestAnimationFrame(() => r?.current?.blur())) : i([e]);
|
|
843
|
+
}
|
|
844
|
+
function useDrag({ nodeRef: e, disabled: t = !1, noDragClassName: n, handleSelector: r, nodeId: i, isSelectable: a, nodeClickDistance: o }) {
|
|
845
|
+
let s = useStoreApi(), [l, u] = useState(!1), d = useRef();
|
|
846
|
+
return useEffect(() => {
|
|
847
|
+
d.current = XYDrag({
|
|
848
|
+
getStoreItems: () => s.getState(),
|
|
849
|
+
onNodeMouseDown: (t) => {
|
|
850
|
+
handleNodeClick({
|
|
851
|
+
id: t,
|
|
852
|
+
store: s,
|
|
853
|
+
nodeRef: e
|
|
854
|
+
});
|
|
855
|
+
},
|
|
856
|
+
onDragStart: () => {
|
|
857
|
+
u(!0);
|
|
858
|
+
},
|
|
859
|
+
onDragStop: () => {
|
|
860
|
+
u(!1);
|
|
861
|
+
}
|
|
862
|
+
});
|
|
863
|
+
}, []), useEffect(() => {
|
|
864
|
+
if (!(t || !e.current || !d.current)) return d.current.update({
|
|
865
|
+
noDragClassName: n,
|
|
866
|
+
handleSelector: r,
|
|
867
|
+
domNode: e.current,
|
|
868
|
+
isSelectable: a,
|
|
869
|
+
nodeId: i,
|
|
870
|
+
nodeClickDistance: o
|
|
871
|
+
}), () => {
|
|
872
|
+
d.current?.destroy();
|
|
873
|
+
};
|
|
874
|
+
}, [
|
|
875
|
+
n,
|
|
876
|
+
r,
|
|
877
|
+
t,
|
|
878
|
+
a,
|
|
879
|
+
e,
|
|
880
|
+
i,
|
|
881
|
+
o
|
|
882
|
+
]), l;
|
|
883
|
+
}
|
|
884
|
+
var selectedAndDraggable = (e) => (t) => t.selected && (t.draggable || e && t.draggable === void 0);
|
|
885
|
+
function useMoveSelectedNodes() {
|
|
886
|
+
let e = useStoreApi();
|
|
887
|
+
return useCallback((t) => {
|
|
888
|
+
let { nodeExtent: n, snapToGrid: r, snapGrid: i, nodesDraggable: a, onError: o, updateNodePositions: s, nodeLookup: c, nodeOrigin: l } = e.getState(), u = /* @__PURE__ */ new Map(), d = selectedAndDraggable(a), f = r ? i[0] : 5, p = r ? i[1] : 5, m = t.direction.x * f * t.factor, h = t.direction.y * p * t.factor;
|
|
889
|
+
for (let [, e] of c) {
|
|
890
|
+
if (!d(e)) continue;
|
|
891
|
+
let t = {
|
|
892
|
+
x: e.internals.positionAbsolute.x + m,
|
|
893
|
+
y: e.internals.positionAbsolute.y + h
|
|
894
|
+
};
|
|
895
|
+
r && (t = snapPosition(t, i));
|
|
896
|
+
let { position: a, positionAbsolute: s } = calculateNodePosition({
|
|
897
|
+
nodeId: e.id,
|
|
898
|
+
nextPosition: t,
|
|
899
|
+
nodeLookup: c,
|
|
900
|
+
nodeExtent: n,
|
|
901
|
+
nodeOrigin: l,
|
|
902
|
+
onError: o
|
|
903
|
+
});
|
|
904
|
+
e.position = a, e.internals.positionAbsolute = s, u.set(e.id, e);
|
|
905
|
+
}
|
|
906
|
+
s(u);
|
|
907
|
+
}, []);
|
|
908
|
+
}
|
|
909
|
+
var NodeIdContext = createContext(null), Provider = NodeIdContext.Provider;
|
|
910
|
+
NodeIdContext.Consumer;
|
|
911
|
+
var useNodeId = () => useContext(NodeIdContext), selector$g = (e) => ({
|
|
912
|
+
connectOnClick: e.connectOnClick,
|
|
913
|
+
noPanClassName: e.noPanClassName,
|
|
914
|
+
rfId: e.rfId
|
|
915
|
+
}), connectingSelector = (e, t, r) => (i) => {
|
|
916
|
+
let { connectionClickStartHandle: a, connectionMode: o, connection: s } = i, { fromHandle: c, toHandle: l, isValid: u } = s, d = l?.nodeId === e && l?.id === t && l?.type === r;
|
|
917
|
+
return {
|
|
918
|
+
connectingFrom: c?.nodeId === e && c?.id === t && c?.type === r,
|
|
919
|
+
connectingTo: d,
|
|
920
|
+
clickConnecting: a?.nodeId === e && a?.id === t && a?.type === r,
|
|
921
|
+
isPossibleEndHandle: o === ConnectionMode.Strict ? c?.type !== r : e !== c?.nodeId || t !== c?.id,
|
|
922
|
+
connectionInProcess: !!c,
|
|
923
|
+
clickConnectionInProcess: !!a,
|
|
924
|
+
valid: d && u
|
|
925
|
+
};
|
|
926
|
+
};
|
|
927
|
+
function HandleComponent({ type: t = "source", position: n = Position.Top, isValidConnection: r, isConnectable: i = !0, isConnectableStart: o = !0, isConnectableEnd: s = !0, id: c, onConnect: u, children: d, className: f, onMouseDown: m, onTouchStart: h, ...g }, _) {
|
|
928
|
+
let v = c || null, y = t === "target", b = useStoreApi(), S = useNodeId(), { connectOnClick: C, noPanClassName: w, rfId: T } = useStore(selector$g, shallow), { connectingFrom: E, connectingTo: D, clickConnecting: O, isPossibleEndHandle: k, connectionInProcess: A, clickConnectionInProcess: j, valid: M } = useStore(connectingSelector(S, v, t), shallow);
|
|
929
|
+
S || b.getState().onError?.("010", errorMessages.error010());
|
|
930
|
+
let N = (e) => {
|
|
931
|
+
let { defaultEdgeOptions: t, onConnect: n, hasDefaultEdges: r } = b.getState(), i = {
|
|
932
|
+
...t,
|
|
933
|
+
...e
|
|
934
|
+
};
|
|
935
|
+
if (r) {
|
|
936
|
+
let { edges: e, setEdges: t } = b.getState();
|
|
937
|
+
t(addEdge(i, e));
|
|
938
|
+
}
|
|
939
|
+
n?.(i), u?.(i);
|
|
940
|
+
}, P = (e) => {
|
|
941
|
+
if (!S) return;
|
|
942
|
+
let t = isMouseEvent(e.nativeEvent);
|
|
943
|
+
if (o && (t && e.button === 0 || !t)) {
|
|
944
|
+
let t = b.getState();
|
|
945
|
+
XYHandle.onPointerDown(e.nativeEvent, {
|
|
946
|
+
handleDomNode: e.currentTarget,
|
|
947
|
+
autoPanOnConnect: t.autoPanOnConnect,
|
|
948
|
+
connectionMode: t.connectionMode,
|
|
949
|
+
connectionRadius: t.connectionRadius,
|
|
950
|
+
domNode: t.domNode,
|
|
951
|
+
nodeLookup: t.nodeLookup,
|
|
952
|
+
lib: t.lib,
|
|
953
|
+
isTarget: y,
|
|
954
|
+
handleId: v,
|
|
955
|
+
nodeId: S,
|
|
956
|
+
flowId: t.rfId,
|
|
957
|
+
panBy: t.panBy,
|
|
958
|
+
cancelConnection: t.cancelConnection,
|
|
959
|
+
onConnectStart: t.onConnectStart,
|
|
960
|
+
onConnectEnd: (...e) => b.getState().onConnectEnd?.(...e),
|
|
961
|
+
updateConnection: t.updateConnection,
|
|
962
|
+
onConnect: N,
|
|
963
|
+
isValidConnection: r || ((...e) => b.getState().isValidConnection?.(...e) ?? !0),
|
|
964
|
+
getTransform: () => b.getState().transform,
|
|
965
|
+
getFromHandle: () => b.getState().connection.fromHandle,
|
|
966
|
+
autoPanSpeed: t.autoPanSpeed,
|
|
967
|
+
dragThreshold: t.connectionDragThreshold
|
|
968
|
+
});
|
|
969
|
+
}
|
|
970
|
+
t ? m?.(e) : h?.(e);
|
|
971
|
+
}, F = (e) => {
|
|
972
|
+
let { onClickConnectStart: n, onClickConnectEnd: i, connectionClickStartHandle: a, connectionMode: s, isValidConnection: c, lib: u, rfId: d, nodeLookup: f, connection: p } = b.getState();
|
|
973
|
+
if (!S || !a && !o) return;
|
|
974
|
+
if (!a) {
|
|
975
|
+
n?.(e.nativeEvent, {
|
|
976
|
+
nodeId: S,
|
|
977
|
+
handleId: v,
|
|
978
|
+
handleType: t
|
|
979
|
+
}), b.setState({ connectionClickStartHandle: {
|
|
980
|
+
nodeId: S,
|
|
981
|
+
type: t,
|
|
982
|
+
id: v
|
|
983
|
+
} });
|
|
984
|
+
return;
|
|
985
|
+
}
|
|
986
|
+
let m = getHostForElement(e.target), h = r || c, { connection: g, isValid: _ } = XYHandle.isValid(e.nativeEvent, {
|
|
987
|
+
handle: {
|
|
988
|
+
nodeId: S,
|
|
989
|
+
id: v,
|
|
990
|
+
type: t
|
|
991
|
+
},
|
|
992
|
+
connectionMode: s,
|
|
993
|
+
fromNodeId: a.nodeId,
|
|
994
|
+
fromHandleId: a.id || null,
|
|
995
|
+
fromType: a.type,
|
|
996
|
+
isValidConnection: h,
|
|
997
|
+
flowId: d,
|
|
998
|
+
doc: m,
|
|
999
|
+
lib: u,
|
|
1000
|
+
nodeLookup: f
|
|
1001
|
+
});
|
|
1002
|
+
_ && g && N(g);
|
|
1003
|
+
let y = structuredClone(p);
|
|
1004
|
+
delete y.inProgress, y.toPosition = y.toHandle ? y.toHandle.position : null, i?.(e, y), b.setState({ connectionClickStartHandle: null });
|
|
1005
|
+
};
|
|
1006
|
+
return jsx("div", {
|
|
1007
|
+
"data-handleid": v,
|
|
1008
|
+
"data-nodeid": S,
|
|
1009
|
+
"data-handlepos": n,
|
|
1010
|
+
"data-id": `${T}-${S}-${v}-${t}`,
|
|
1011
|
+
className: cc([
|
|
1012
|
+
"react-flow__handle",
|
|
1013
|
+
`react-flow__handle-${n}`,
|
|
1014
|
+
"nodrag",
|
|
1015
|
+
w,
|
|
1016
|
+
f,
|
|
1017
|
+
{
|
|
1018
|
+
source: !y,
|
|
1019
|
+
target: y,
|
|
1020
|
+
connectable: i,
|
|
1021
|
+
connectablestart: o,
|
|
1022
|
+
connectableend: s,
|
|
1023
|
+
clickconnecting: O,
|
|
1024
|
+
connectingfrom: E,
|
|
1025
|
+
connectingto: D,
|
|
1026
|
+
valid: M,
|
|
1027
|
+
connectionindicator: i && (!A || k) && (A || j ? s : o)
|
|
1028
|
+
}
|
|
1029
|
+
]),
|
|
1030
|
+
onMouseDown: P,
|
|
1031
|
+
onTouchStart: P,
|
|
1032
|
+
onClick: C ? F : void 0,
|
|
1033
|
+
ref: _,
|
|
1034
|
+
...g,
|
|
1035
|
+
children: d
|
|
1036
|
+
});
|
|
1037
|
+
}
|
|
1038
|
+
var Handle = memo(fixedForwardRef(HandleComponent));
|
|
1039
|
+
function InputNode({ data: e, isConnectable: t, sourcePosition: n = Position.Bottom }) {
|
|
1040
|
+
return jsxs(Fragment$1, { children: [e?.label, jsx(Handle, {
|
|
1041
|
+
type: "source",
|
|
1042
|
+
position: n,
|
|
1043
|
+
isConnectable: t
|
|
1044
|
+
})] });
|
|
1045
|
+
}
|
|
1046
|
+
function DefaultNode({ data: e, isConnectable: t, targetPosition: n = Position.Top, sourcePosition: r = Position.Bottom }) {
|
|
1047
|
+
return jsxs(Fragment$1, { children: [
|
|
1048
|
+
jsx(Handle, {
|
|
1049
|
+
type: "target",
|
|
1050
|
+
position: n,
|
|
1051
|
+
isConnectable: t
|
|
1052
|
+
}),
|
|
1053
|
+
e?.label,
|
|
1054
|
+
jsx(Handle, {
|
|
1055
|
+
type: "source",
|
|
1056
|
+
position: r,
|
|
1057
|
+
isConnectable: t
|
|
1058
|
+
})
|
|
1059
|
+
] });
|
|
1060
|
+
}
|
|
1061
|
+
function GroupNode() {
|
|
1062
|
+
return null;
|
|
1063
|
+
}
|
|
1064
|
+
function OutputNode({ data: e, isConnectable: t, targetPosition: n = Position.Top }) {
|
|
1065
|
+
return jsxs(Fragment$1, { children: [jsx(Handle, {
|
|
1066
|
+
type: "target",
|
|
1067
|
+
position: n,
|
|
1068
|
+
isConnectable: t
|
|
1069
|
+
}), e?.label] });
|
|
1070
|
+
}
|
|
1071
|
+
var arrowKeyDiffs = {
|
|
1072
|
+
ArrowUp: {
|
|
1073
|
+
x: 0,
|
|
1074
|
+
y: -1
|
|
1075
|
+
},
|
|
1076
|
+
ArrowDown: {
|
|
1077
|
+
x: 0,
|
|
1078
|
+
y: 1
|
|
1079
|
+
},
|
|
1080
|
+
ArrowLeft: {
|
|
1081
|
+
x: -1,
|
|
1082
|
+
y: 0
|
|
1083
|
+
},
|
|
1084
|
+
ArrowRight: {
|
|
1085
|
+
x: 1,
|
|
1086
|
+
y: 0
|
|
1087
|
+
}
|
|
1088
|
+
}, builtinNodeTypes = {
|
|
1089
|
+
input: InputNode,
|
|
1090
|
+
default: DefaultNode,
|
|
1091
|
+
output: OutputNode,
|
|
1092
|
+
group: GroupNode
|
|
1093
|
+
};
|
|
1094
|
+
function getNodeInlineStyleDimensions(e) {
|
|
1095
|
+
return e.internals.handleBounds === void 0 ? {
|
|
1096
|
+
width: e.width ?? e.initialWidth ?? e.style?.width,
|
|
1097
|
+
height: e.height ?? e.initialHeight ?? e.style?.height
|
|
1098
|
+
} : {
|
|
1099
|
+
width: e.width ?? e.style?.width,
|
|
1100
|
+
height: e.height ?? e.style?.height
|
|
1101
|
+
};
|
|
1102
|
+
}
|
|
1103
|
+
var selector$f = (e) => {
|
|
1104
|
+
let { width: t, height: n, x: r, y: i } = getInternalNodesBounds(e.nodeLookup, { filter: (e) => !!e.selected });
|
|
1105
|
+
return {
|
|
1106
|
+
width: isNumeric(t) ? t : null,
|
|
1107
|
+
height: isNumeric(n) ? n : null,
|
|
1108
|
+
userSelectionActive: e.userSelectionActive,
|
|
1109
|
+
transformString: `translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`
|
|
1110
|
+
};
|
|
1111
|
+
};
|
|
1112
|
+
function NodesSelection({ onSelectionContextMenu: t, noPanClassName: n, disableKeyboardA11y: r }) {
|
|
1113
|
+
let i = useStoreApi(), { width: a, height: o, transformString: s, userSelectionActive: c } = useStore(selector$f, shallow), l = useMoveSelectedNodes(), u = useRef(null);
|
|
1114
|
+
useEffect(() => {
|
|
1115
|
+
r || u.current?.focus({ preventScroll: !0 });
|
|
1116
|
+
}, [r]);
|
|
1117
|
+
let d = !c && a !== null && o !== null;
|
|
1118
|
+
if (useDrag({
|
|
1119
|
+
nodeRef: u,
|
|
1120
|
+
disabled: !d
|
|
1121
|
+
}), !d) return null;
|
|
1122
|
+
let f = t ? (e) => {
|
|
1123
|
+
t(e, i.getState().nodes.filter((e) => e.selected));
|
|
1124
|
+
} : void 0;
|
|
1125
|
+
return jsx("div", {
|
|
1126
|
+
className: cc([
|
|
1127
|
+
"react-flow__nodesselection",
|
|
1128
|
+
"react-flow__container",
|
|
1129
|
+
n
|
|
1130
|
+
]),
|
|
1131
|
+
style: { transform: s },
|
|
1132
|
+
children: jsx("div", {
|
|
1133
|
+
ref: u,
|
|
1134
|
+
className: "react-flow__nodesselection-rect",
|
|
1135
|
+
onContextMenu: f,
|
|
1136
|
+
tabIndex: r ? void 0 : -1,
|
|
1137
|
+
onKeyDown: r ? void 0 : (e) => {
|
|
1138
|
+
Object.prototype.hasOwnProperty.call(arrowKeyDiffs, e.key) && (e.preventDefault(), l({
|
|
1139
|
+
direction: arrowKeyDiffs[e.key],
|
|
1140
|
+
factor: e.shiftKey ? 4 : 1
|
|
1141
|
+
}));
|
|
1142
|
+
},
|
|
1143
|
+
style: {
|
|
1144
|
+
width: a,
|
|
1145
|
+
height: o
|
|
1146
|
+
}
|
|
1147
|
+
})
|
|
1148
|
+
});
|
|
1149
|
+
}
|
|
1150
|
+
var win = typeof window < "u" ? window : void 0, selector$e = (e) => ({
|
|
1151
|
+
nodesSelectionActive: e.nodesSelectionActive,
|
|
1152
|
+
userSelectionActive: e.userSelectionActive
|
|
1153
|
+
});
|
|
1154
|
+
function FlowRendererComponent({ children: e, onPaneClick: t, onPaneMouseEnter: n, onPaneMouseMove: r, onPaneMouseLeave: i, onPaneContextMenu: a, onPaneScroll: o, paneClickDistance: s, deleteKeyCode: c, selectionKeyCode: l, selectionOnDrag: u, selectionMode: d, onSelectionStart: f, onSelectionEnd: p, multiSelectionKeyCode: m, panActivationKeyCode: h, zoomActivationKeyCode: g, elementsSelectable: _, zoomOnScroll: v, zoomOnPinch: y, panOnScroll: b, panOnScrollSpeed: x, panOnScrollMode: S, zoomOnDoubleClick: C, panOnDrag: w, defaultViewport: T, translateExtent: E, minZoom: D, maxZoom: O, preventScrolling: k, onSelectionContextMenu: A, noWheelClassName: j, noPanClassName: M, disableKeyboardA11y: N, onViewportChange: P, isControlledViewport: F }) {
|
|
1155
|
+
let { nodesSelectionActive: I, userSelectionActive: L } = useStore(selector$e, shallow), R = useKeyPress(l, { target: win }), z = useKeyPress(h, { target: win }), B = z || w, V = z || b, H = u && B !== !0, U = R || L || H;
|
|
1156
|
+
return useGlobalKeyHandler({
|
|
1157
|
+
deleteKeyCode: c,
|
|
1158
|
+
multiSelectionKeyCode: m
|
|
1159
|
+
}), jsx(ZoomPane, {
|
|
1160
|
+
onPaneContextMenu: a,
|
|
1161
|
+
elementsSelectable: _,
|
|
1162
|
+
zoomOnScroll: v,
|
|
1163
|
+
zoomOnPinch: y,
|
|
1164
|
+
panOnScroll: V,
|
|
1165
|
+
panOnScrollSpeed: x,
|
|
1166
|
+
panOnScrollMode: S,
|
|
1167
|
+
zoomOnDoubleClick: C,
|
|
1168
|
+
panOnDrag: !R && B,
|
|
1169
|
+
defaultViewport: T,
|
|
1170
|
+
translateExtent: E,
|
|
1171
|
+
minZoom: D,
|
|
1172
|
+
maxZoom: O,
|
|
1173
|
+
zoomActivationKeyCode: g,
|
|
1174
|
+
preventScrolling: k,
|
|
1175
|
+
noWheelClassName: j,
|
|
1176
|
+
noPanClassName: M,
|
|
1177
|
+
onViewportChange: P,
|
|
1178
|
+
isControlledViewport: F,
|
|
1179
|
+
paneClickDistance: s,
|
|
1180
|
+
selectionOnDrag: H,
|
|
1181
|
+
children: jsxs(Pane, {
|
|
1182
|
+
onSelectionStart: f,
|
|
1183
|
+
onSelectionEnd: p,
|
|
1184
|
+
onPaneClick: t,
|
|
1185
|
+
onPaneMouseEnter: n,
|
|
1186
|
+
onPaneMouseMove: r,
|
|
1187
|
+
onPaneMouseLeave: i,
|
|
1188
|
+
onPaneContextMenu: a,
|
|
1189
|
+
onPaneScroll: o,
|
|
1190
|
+
panOnDrag: B,
|
|
1191
|
+
isSelecting: !!U,
|
|
1192
|
+
selectionMode: d,
|
|
1193
|
+
selectionKeyPressed: R,
|
|
1194
|
+
paneClickDistance: s,
|
|
1195
|
+
selectionOnDrag: H,
|
|
1196
|
+
children: [e, I && jsx(NodesSelection, {
|
|
1197
|
+
onSelectionContextMenu: A,
|
|
1198
|
+
noPanClassName: M,
|
|
1199
|
+
disableKeyboardA11y: N
|
|
1200
|
+
})]
|
|
1201
|
+
})
|
|
1202
|
+
});
|
|
1203
|
+
}
|
|
1204
|
+
FlowRendererComponent.displayName = "FlowRenderer";
|
|
1205
|
+
var FlowRenderer = memo(FlowRendererComponent), selector$d = (e) => (t) => e ? getNodesInside(t.nodeLookup, {
|
|
1206
|
+
x: 0,
|
|
1207
|
+
y: 0,
|
|
1208
|
+
width: t.width,
|
|
1209
|
+
height: t.height
|
|
1210
|
+
}, t.transform, !0).map((e) => e.id) : Array.from(t.nodeLookup.keys());
|
|
1211
|
+
function useVisibleNodeIds(e) {
|
|
1212
|
+
return useStore(useCallback(selector$d(e), [e]), shallow);
|
|
1213
|
+
}
|
|
1214
|
+
var selector$c = (e) => e.updateNodeInternals;
|
|
1215
|
+
function useResizeObserver() {
|
|
1216
|
+
let e = useStore(selector$c), [t] = useState(() => typeof ResizeObserver > "u" ? null : new ResizeObserver((t) => {
|
|
1217
|
+
let n = /* @__PURE__ */ new Map();
|
|
1218
|
+
t.forEach((e) => {
|
|
1219
|
+
let t = e.target.getAttribute("data-id");
|
|
1220
|
+
n.set(t, {
|
|
1221
|
+
id: t,
|
|
1222
|
+
nodeElement: e.target,
|
|
1223
|
+
force: !0
|
|
1224
|
+
});
|
|
1225
|
+
}), e(n);
|
|
1226
|
+
}));
|
|
1227
|
+
return useEffect(() => () => {
|
|
1228
|
+
t?.disconnect();
|
|
1229
|
+
}, [t]), t;
|
|
1230
|
+
}
|
|
1231
|
+
function useNodeObserver({ node: e, nodeType: t, hasDimensions: n, resizeObserver: r }) {
|
|
1232
|
+
let i = useStoreApi(), a = useRef(null), o = useRef(null), s = useRef(e.sourcePosition), c = useRef(e.targetPosition), l = useRef(t), u = n && !!e.internals.handleBounds;
|
|
1233
|
+
return useEffect(() => {
|
|
1234
|
+
a.current && !e.hidden && (!u || o.current !== a.current) && (o.current && r?.unobserve(o.current), r?.observe(a.current), o.current = a.current);
|
|
1235
|
+
}, [u, e.hidden]), useEffect(() => () => {
|
|
1236
|
+
o.current &&= (r?.unobserve(o.current), null);
|
|
1237
|
+
}, []), useEffect(() => {
|
|
1238
|
+
if (a.current) {
|
|
1239
|
+
let n = l.current !== t, r = s.current !== e.sourcePosition, o = c.current !== e.targetPosition;
|
|
1240
|
+
(n || r || o) && (l.current = t, s.current = e.sourcePosition, c.current = e.targetPosition, i.getState().updateNodeInternals(new Map([[e.id, {
|
|
1241
|
+
id: e.id,
|
|
1242
|
+
nodeElement: a.current,
|
|
1243
|
+
force: !0
|
|
1244
|
+
}]])));
|
|
1245
|
+
}
|
|
1246
|
+
}, [
|
|
1247
|
+
e.id,
|
|
1248
|
+
t,
|
|
1249
|
+
e.sourcePosition,
|
|
1250
|
+
e.targetPosition
|
|
1251
|
+
]), a;
|
|
1252
|
+
}
|
|
1253
|
+
function NodeWrapper({ id: t, onClick: n, onMouseEnter: r, onMouseMove: i, onMouseLeave: a, onContextMenu: o, onDoubleClick: s, nodesDraggable: c, elementsSelectable: l, nodesConnectable: u, nodesFocusable: d, resizeObserver: f, noDragClassName: p, noPanClassName: m, disableKeyboardA11y: h, rfId: g, nodeTypes: _, nodeClickDistance: v, onError: y }) {
|
|
1254
|
+
let { node: S, internals: C, isParent: w } = useStore((e) => {
|
|
1255
|
+
let n = e.nodeLookup.get(t), r = e.parentLookup.has(t);
|
|
1256
|
+
return {
|
|
1257
|
+
node: n,
|
|
1258
|
+
internals: n.internals,
|
|
1259
|
+
isParent: r
|
|
1260
|
+
};
|
|
1261
|
+
}, shallow), T = S.type || "default", E = _?.[T] || builtinNodeTypes[T];
|
|
1262
|
+
E === void 0 && (y?.("003", errorMessages.error003(T)), T = "default", E = _?.default || builtinNodeTypes.default);
|
|
1263
|
+
let D = !!(S.draggable || c && S.draggable === void 0), O = !!(S.selectable || l && S.selectable === void 0), k = !!(S.connectable || u && S.connectable === void 0), A = !!(S.focusable || d && S.focusable === void 0), j = useStoreApi(), M = nodeHasDimensions(S), N = useNodeObserver({
|
|
1264
|
+
node: S,
|
|
1265
|
+
nodeType: T,
|
|
1266
|
+
hasDimensions: M,
|
|
1267
|
+
resizeObserver: f
|
|
1268
|
+
}), P = useDrag({
|
|
1269
|
+
nodeRef: N,
|
|
1270
|
+
disabled: S.hidden || !D,
|
|
1271
|
+
noDragClassName: p,
|
|
1272
|
+
handleSelector: S.dragHandle,
|
|
1273
|
+
nodeId: t,
|
|
1274
|
+
isSelectable: O,
|
|
1275
|
+
nodeClickDistance: v
|
|
1276
|
+
}), F = useMoveSelectedNodes();
|
|
1277
|
+
if (S.hidden) return null;
|
|
1278
|
+
let I = getNodeDimensions(S), L = getNodeInlineStyleDimensions(S), R = O || D || n || r || i || a, B = r ? (e) => r(e, { ...C.userNode }) : void 0, H = i ? (e) => i(e, { ...C.userNode }) : void 0, U = a ? (e) => a(e, { ...C.userNode }) : void 0, W = o ? (e) => o(e, { ...C.userNode }) : void 0, G = s ? (e) => s(e, { ...C.userNode }) : void 0, K = (e) => {
|
|
1279
|
+
let { selectNodesOnDrag: r, nodeDragThreshold: i } = j.getState();
|
|
1280
|
+
O && (!r || !D || i > 0) && handleNodeClick({
|
|
1281
|
+
id: t,
|
|
1282
|
+
store: j,
|
|
1283
|
+
nodeRef: N
|
|
1284
|
+
}), n && n(e, { ...C.userNode });
|
|
1285
|
+
}, q = (e) => {
|
|
1286
|
+
if (!(isInputDOMNode(e.nativeEvent) || h)) {
|
|
1287
|
+
if (elementSelectionKeys.includes(e.key) && O) handleNodeClick({
|
|
1288
|
+
id: t,
|
|
1289
|
+
store: j,
|
|
1290
|
+
unselect: e.key === "Escape",
|
|
1291
|
+
nodeRef: N
|
|
1292
|
+
});
|
|
1293
|
+
else if (D && S.selected && Object.prototype.hasOwnProperty.call(arrowKeyDiffs, e.key)) {
|
|
1294
|
+
e.preventDefault();
|
|
1295
|
+
let { ariaLabelConfig: t } = j.getState();
|
|
1296
|
+
j.setState({ ariaLiveMessage: t["node.a11yDescription.ariaLiveMessage"]({
|
|
1297
|
+
direction: e.key.replace("Arrow", "").toLowerCase(),
|
|
1298
|
+
x: ~~C.positionAbsolute.x,
|
|
1299
|
+
y: ~~C.positionAbsolute.y
|
|
1300
|
+
}) }), F({
|
|
1301
|
+
direction: arrowKeyDiffs[e.key],
|
|
1302
|
+
factor: e.shiftKey ? 4 : 1
|
|
1303
|
+
});
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
}, J = () => {
|
|
1307
|
+
if (h || !N.current?.matches(":focus-visible")) return;
|
|
1308
|
+
let { transform: e, width: n, height: r, autoPanOnNodeFocus: i, setCenter: a } = j.getState();
|
|
1309
|
+
i && (getNodesInside(new Map([[t, S]]), {
|
|
1310
|
+
x: 0,
|
|
1311
|
+
y: 0,
|
|
1312
|
+
width: n,
|
|
1313
|
+
height: r
|
|
1314
|
+
}, e, !0).length > 0 || a(S.position.x + I.width / 2, S.position.y + I.height / 2, { zoom: e[2] }));
|
|
1315
|
+
};
|
|
1316
|
+
return jsx("div", {
|
|
1317
|
+
className: cc([
|
|
1318
|
+
"react-flow__node",
|
|
1319
|
+
`react-flow__node-${T}`,
|
|
1320
|
+
{ [m]: D },
|
|
1321
|
+
S.className,
|
|
1322
|
+
{
|
|
1323
|
+
selected: S.selected,
|
|
1324
|
+
selectable: O,
|
|
1325
|
+
parent: w,
|
|
1326
|
+
draggable: D,
|
|
1327
|
+
dragging: P
|
|
1328
|
+
}
|
|
1329
|
+
]),
|
|
1330
|
+
ref: N,
|
|
1331
|
+
style: {
|
|
1332
|
+
zIndex: C.z,
|
|
1333
|
+
transform: `translate(${C.positionAbsolute.x}px,${C.positionAbsolute.y}px)`,
|
|
1334
|
+
pointerEvents: R ? "all" : "none",
|
|
1335
|
+
visibility: M ? "visible" : "hidden",
|
|
1336
|
+
...S.style,
|
|
1337
|
+
...L
|
|
1338
|
+
},
|
|
1339
|
+
"data-id": t,
|
|
1340
|
+
"data-testid": `rf__node-${t}`,
|
|
1341
|
+
onMouseEnter: B,
|
|
1342
|
+
onMouseMove: H,
|
|
1343
|
+
onMouseLeave: U,
|
|
1344
|
+
onContextMenu: W,
|
|
1345
|
+
onClick: K,
|
|
1346
|
+
onDoubleClick: G,
|
|
1347
|
+
onKeyDown: A ? q : void 0,
|
|
1348
|
+
tabIndex: A ? 0 : void 0,
|
|
1349
|
+
onFocus: A ? J : void 0,
|
|
1350
|
+
role: S.ariaRole ?? (A ? "group" : void 0),
|
|
1351
|
+
"aria-roledescription": "node",
|
|
1352
|
+
"aria-describedby": h ? void 0 : `${ARIA_NODE_DESC_KEY}-${g}`,
|
|
1353
|
+
"aria-label": S.ariaLabel,
|
|
1354
|
+
...S.domAttributes,
|
|
1355
|
+
children: jsx(Provider, {
|
|
1356
|
+
value: t,
|
|
1357
|
+
children: jsx(E, {
|
|
1358
|
+
id: t,
|
|
1359
|
+
data: S.data,
|
|
1360
|
+
type: T,
|
|
1361
|
+
positionAbsoluteX: C.positionAbsolute.x,
|
|
1362
|
+
positionAbsoluteY: C.positionAbsolute.y,
|
|
1363
|
+
selected: S.selected ?? !1,
|
|
1364
|
+
selectable: O,
|
|
1365
|
+
draggable: D,
|
|
1366
|
+
deletable: S.deletable ?? !0,
|
|
1367
|
+
isConnectable: k,
|
|
1368
|
+
sourcePosition: S.sourcePosition,
|
|
1369
|
+
targetPosition: S.targetPosition,
|
|
1370
|
+
dragging: P,
|
|
1371
|
+
dragHandle: S.dragHandle,
|
|
1372
|
+
zIndex: C.z,
|
|
1373
|
+
parentId: S.parentId,
|
|
1374
|
+
...I
|
|
1375
|
+
})
|
|
1376
|
+
})
|
|
1377
|
+
});
|
|
1378
|
+
}
|
|
1379
|
+
var NodeWrapper$1 = memo(NodeWrapper), selector$b = (e) => ({
|
|
1380
|
+
nodesDraggable: e.nodesDraggable,
|
|
1381
|
+
nodesConnectable: e.nodesConnectable,
|
|
1382
|
+
nodesFocusable: e.nodesFocusable,
|
|
1383
|
+
elementsSelectable: e.elementsSelectable,
|
|
1384
|
+
onError: e.onError
|
|
1385
|
+
});
|
|
1386
|
+
function NodeRendererComponent(e) {
|
|
1387
|
+
let { nodesDraggable: t, nodesConnectable: n, nodesFocusable: r, elementsSelectable: i, onError: a } = useStore(selector$b, shallow), o = useVisibleNodeIds(e.onlyRenderVisibleElements), s = useResizeObserver();
|
|
1388
|
+
return jsx("div", {
|
|
1389
|
+
className: "react-flow__nodes",
|
|
1390
|
+
style: containerStyle,
|
|
1391
|
+
children: o.map((o) => jsx(NodeWrapper$1, {
|
|
1392
|
+
id: o,
|
|
1393
|
+
nodeTypes: e.nodeTypes,
|
|
1394
|
+
nodeExtent: e.nodeExtent,
|
|
1395
|
+
onClick: e.onNodeClick,
|
|
1396
|
+
onMouseEnter: e.onNodeMouseEnter,
|
|
1397
|
+
onMouseMove: e.onNodeMouseMove,
|
|
1398
|
+
onMouseLeave: e.onNodeMouseLeave,
|
|
1399
|
+
onContextMenu: e.onNodeContextMenu,
|
|
1400
|
+
onDoubleClick: e.onNodeDoubleClick,
|
|
1401
|
+
noDragClassName: e.noDragClassName,
|
|
1402
|
+
noPanClassName: e.noPanClassName,
|
|
1403
|
+
rfId: e.rfId,
|
|
1404
|
+
disableKeyboardA11y: e.disableKeyboardA11y,
|
|
1405
|
+
resizeObserver: s,
|
|
1406
|
+
nodesDraggable: t,
|
|
1407
|
+
nodesConnectable: n,
|
|
1408
|
+
nodesFocusable: r,
|
|
1409
|
+
elementsSelectable: i,
|
|
1410
|
+
nodeClickDistance: e.nodeClickDistance,
|
|
1411
|
+
onError: a
|
|
1412
|
+
}, o))
|
|
1413
|
+
});
|
|
1414
|
+
}
|
|
1415
|
+
NodeRendererComponent.displayName = "NodeRenderer";
|
|
1416
|
+
var NodeRenderer = memo(NodeRendererComponent);
|
|
1417
|
+
function useVisibleEdgeIds(e) {
|
|
1418
|
+
return useStore(useCallback((t) => {
|
|
1419
|
+
if (!e) return t.edges.map((e) => e.id);
|
|
1420
|
+
let n = [];
|
|
1421
|
+
if (t.width && t.height) for (let e of t.edges) {
|
|
1422
|
+
let r = t.nodeLookup.get(e.source), i = t.nodeLookup.get(e.target);
|
|
1423
|
+
r && i && isEdgeVisible({
|
|
1424
|
+
sourceNode: r,
|
|
1425
|
+
targetNode: i,
|
|
1426
|
+
width: t.width,
|
|
1427
|
+
height: t.height,
|
|
1428
|
+
transform: t.transform
|
|
1429
|
+
}) && n.push(e.id);
|
|
1430
|
+
}
|
|
1431
|
+
return n;
|
|
1432
|
+
}, [e]), shallow);
|
|
1433
|
+
}
|
|
1434
|
+
var ArrowSymbol = ({ color: e = "none", strokeWidth: t = 1 }) => jsx("polyline", {
|
|
1435
|
+
className: "arrow",
|
|
1436
|
+
style: {
|
|
1437
|
+
strokeWidth: t,
|
|
1438
|
+
...e && { stroke: e }
|
|
1439
|
+
},
|
|
1440
|
+
strokeLinecap: "round",
|
|
1441
|
+
fill: "none",
|
|
1442
|
+
strokeLinejoin: "round",
|
|
1443
|
+
points: "-5,-4 0,0 -5,4"
|
|
1444
|
+
}), ArrowClosedSymbol = ({ color: e = "none", strokeWidth: t = 1 }) => jsx("polyline", {
|
|
1445
|
+
className: "arrowclosed",
|
|
1446
|
+
style: {
|
|
1447
|
+
strokeWidth: t,
|
|
1448
|
+
...e && {
|
|
1449
|
+
stroke: e,
|
|
1450
|
+
fill: e
|
|
1451
|
+
}
|
|
1452
|
+
},
|
|
1453
|
+
strokeLinecap: "round",
|
|
1454
|
+
strokeLinejoin: "round",
|
|
1455
|
+
points: "-5,-4 0,0 -5,4 -5,-4"
|
|
1456
|
+
}), MarkerSymbols = {
|
|
1457
|
+
[MarkerType.Arrow]: ArrowSymbol,
|
|
1458
|
+
[MarkerType.ArrowClosed]: ArrowClosedSymbol
|
|
1459
|
+
};
|
|
1460
|
+
function useMarkerSymbol(e) {
|
|
1461
|
+
let t = useStoreApi();
|
|
1462
|
+
return useMemo(() => Object.prototype.hasOwnProperty.call(MarkerSymbols, e) ? MarkerSymbols[e] : (t.getState().onError?.("009", errorMessages.error009(e)), null), [e]);
|
|
1463
|
+
}
|
|
1464
|
+
var Marker = ({ id: e, type: t, color: n, width: r = 12.5, height: i = 12.5, markerUnits: a = "strokeWidth", strokeWidth: o, orient: s = "auto-start-reverse" }) => {
|
|
1465
|
+
let c = useMarkerSymbol(t);
|
|
1466
|
+
return c ? jsx("marker", {
|
|
1467
|
+
className: "react-flow__arrowhead",
|
|
1468
|
+
id: e,
|
|
1469
|
+
markerWidth: `${r}`,
|
|
1470
|
+
markerHeight: `${i}`,
|
|
1471
|
+
viewBox: "-10 -10 20 20",
|
|
1472
|
+
markerUnits: a,
|
|
1473
|
+
orient: s,
|
|
1474
|
+
refX: "0",
|
|
1475
|
+
refY: "0",
|
|
1476
|
+
children: jsx(c, {
|
|
1477
|
+
color: n,
|
|
1478
|
+
strokeWidth: o
|
|
1479
|
+
})
|
|
1480
|
+
}) : null;
|
|
1481
|
+
}, MarkerDefinitions = ({ defaultColor: e, rfId: t }) => {
|
|
1482
|
+
let n = useStore((e) => e.edges), r = useStore((e) => e.defaultEdgeOptions), i = useMemo(() => createMarkerIds(n, {
|
|
1483
|
+
id: t,
|
|
1484
|
+
defaultColor: e,
|
|
1485
|
+
defaultMarkerStart: r?.markerStart,
|
|
1486
|
+
defaultMarkerEnd: r?.markerEnd
|
|
1487
|
+
}), [
|
|
1488
|
+
n,
|
|
1489
|
+
r,
|
|
1490
|
+
t,
|
|
1491
|
+
e
|
|
1492
|
+
]);
|
|
1493
|
+
return i.length ? jsx("svg", {
|
|
1494
|
+
className: "react-flow__marker",
|
|
1495
|
+
"aria-hidden": "true",
|
|
1496
|
+
children: jsx("defs", { children: i.map((e) => jsx(Marker, {
|
|
1497
|
+
id: e.id,
|
|
1498
|
+
type: e.type,
|
|
1499
|
+
color: e.color,
|
|
1500
|
+
width: e.width,
|
|
1501
|
+
height: e.height,
|
|
1502
|
+
markerUnits: e.markerUnits,
|
|
1503
|
+
strokeWidth: e.strokeWidth,
|
|
1504
|
+
orient: e.orient
|
|
1505
|
+
}, e.id)) })
|
|
1506
|
+
}) : null;
|
|
1507
|
+
};
|
|
1508
|
+
MarkerDefinitions.displayName = "MarkerDefinitions";
|
|
1509
|
+
var MarkerDefinitions$1 = memo(MarkerDefinitions);
|
|
1510
|
+
function EdgeTextComponent({ x: t, y: n, label: r, labelStyle: i, labelShowBg: a = !0, labelBgStyle: o, labelBgPadding: s = [2, 4], labelBgBorderRadius: c = 2, children: l, className: u, ...d }) {
|
|
1511
|
+
let [f, p] = useState({
|
|
1512
|
+
x: 1,
|
|
1513
|
+
y: 0,
|
|
1514
|
+
width: 0,
|
|
1515
|
+
height: 0
|
|
1516
|
+
}), m = cc(["react-flow__edge-textwrapper", u]), h = useRef(null);
|
|
1517
|
+
return useEffect(() => {
|
|
1518
|
+
if (h.current) {
|
|
1519
|
+
let e = h.current.getBBox();
|
|
1520
|
+
p({
|
|
1521
|
+
x: e.x,
|
|
1522
|
+
y: e.y,
|
|
1523
|
+
width: e.width,
|
|
1524
|
+
height: e.height
|
|
1525
|
+
});
|
|
1526
|
+
}
|
|
1527
|
+
}, [r]), r ? jsxs("g", {
|
|
1528
|
+
transform: `translate(${t - f.width / 2} ${n - f.height / 2})`,
|
|
1529
|
+
className: m,
|
|
1530
|
+
visibility: f.width ? "visible" : "hidden",
|
|
1531
|
+
...d,
|
|
1532
|
+
children: [
|
|
1533
|
+
a && jsx("rect", {
|
|
1534
|
+
width: f.width + 2 * s[0],
|
|
1535
|
+
x: -s[0],
|
|
1536
|
+
y: -s[1],
|
|
1537
|
+
height: f.height + 2 * s[1],
|
|
1538
|
+
className: "react-flow__edge-textbg",
|
|
1539
|
+
style: o,
|
|
1540
|
+
rx: c,
|
|
1541
|
+
ry: c
|
|
1542
|
+
}),
|
|
1543
|
+
jsx("text", {
|
|
1544
|
+
className: "react-flow__edge-text",
|
|
1545
|
+
y: f.height / 2,
|
|
1546
|
+
dy: "0.3em",
|
|
1547
|
+
ref: h,
|
|
1548
|
+
style: i,
|
|
1549
|
+
children: r
|
|
1550
|
+
}),
|
|
1551
|
+
l
|
|
1552
|
+
]
|
|
1553
|
+
}) : null;
|
|
1554
|
+
}
|
|
1555
|
+
EdgeTextComponent.displayName = "EdgeText";
|
|
1556
|
+
var EdgeText = memo(EdgeTextComponent);
|
|
1557
|
+
function BaseEdge({ path: t, labelX: n, labelY: r, label: i, labelStyle: a, labelShowBg: o, labelBgStyle: s, labelBgPadding: c, labelBgBorderRadius: l, interactionWidth: u = 20, ...d }) {
|
|
1558
|
+
return jsxs(Fragment$1, { children: [
|
|
1559
|
+
jsx("path", {
|
|
1560
|
+
...d,
|
|
1561
|
+
d: t,
|
|
1562
|
+
fill: "none",
|
|
1563
|
+
className: cc(["react-flow__edge-path", d.className])
|
|
1564
|
+
}),
|
|
1565
|
+
u ? jsx("path", {
|
|
1566
|
+
d: t,
|
|
1567
|
+
fill: "none",
|
|
1568
|
+
strokeOpacity: 0,
|
|
1569
|
+
strokeWidth: u,
|
|
1570
|
+
className: "react-flow__edge-interaction"
|
|
1571
|
+
}) : null,
|
|
1572
|
+
i && isNumeric(n) && isNumeric(r) ? jsx(EdgeText, {
|
|
1573
|
+
x: n,
|
|
1574
|
+
y: r,
|
|
1575
|
+
label: i,
|
|
1576
|
+
labelStyle: a,
|
|
1577
|
+
labelShowBg: o,
|
|
1578
|
+
labelBgStyle: s,
|
|
1579
|
+
labelBgPadding: c,
|
|
1580
|
+
labelBgBorderRadius: l
|
|
1581
|
+
}) : null
|
|
1582
|
+
] });
|
|
1583
|
+
}
|
|
1584
|
+
function getControl({ pos: e, x1: t, y1: n, x2: r, y2: i }) {
|
|
1585
|
+
return e === Position.Left || e === Position.Right ? [.5 * (t + r), n] : [t, .5 * (n + i)];
|
|
1586
|
+
}
|
|
1587
|
+
function getSimpleBezierPath({ sourceX: e, sourceY: t, sourcePosition: n = Position.Bottom, targetX: r, targetY: i, targetPosition: o = Position.Top }) {
|
|
1588
|
+
let [s, c] = getControl({
|
|
1589
|
+
pos: n,
|
|
1590
|
+
x1: e,
|
|
1591
|
+
y1: t,
|
|
1592
|
+
x2: r,
|
|
1593
|
+
y2: i
|
|
1594
|
+
}), [l, u] = getControl({
|
|
1595
|
+
pos: o,
|
|
1596
|
+
x1: r,
|
|
1597
|
+
y1: i,
|
|
1598
|
+
x2: e,
|
|
1599
|
+
y2: t
|
|
1600
|
+
}), [d, f, p, m] = getBezierEdgeCenter({
|
|
1601
|
+
sourceX: e,
|
|
1602
|
+
sourceY: t,
|
|
1603
|
+
targetX: r,
|
|
1604
|
+
targetY: i,
|
|
1605
|
+
sourceControlX: s,
|
|
1606
|
+
sourceControlY: c,
|
|
1607
|
+
targetControlX: l,
|
|
1608
|
+
targetControlY: u
|
|
1609
|
+
});
|
|
1610
|
+
return [
|
|
1611
|
+
`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,
|
|
1612
|
+
d,
|
|
1613
|
+
f,
|
|
1614
|
+
p,
|
|
1615
|
+
m
|
|
1616
|
+
];
|
|
1617
|
+
}
|
|
1618
|
+
function createSimpleBezierEdge(e) {
|
|
1619
|
+
return memo(({ id: t, sourceX: n, sourceY: r, targetX: i, targetY: a, sourcePosition: o, targetPosition: s, label: c, labelStyle: l, labelShowBg: u, labelBgStyle: d, labelBgPadding: f, labelBgBorderRadius: p, style: m, markerEnd: h, markerStart: g, interactionWidth: _ }) => {
|
|
1620
|
+
let [v, y, b] = getSimpleBezierPath({
|
|
1621
|
+
sourceX: n,
|
|
1622
|
+
sourceY: r,
|
|
1623
|
+
sourcePosition: o,
|
|
1624
|
+
targetX: i,
|
|
1625
|
+
targetY: a,
|
|
1626
|
+
targetPosition: s
|
|
1627
|
+
});
|
|
1628
|
+
return jsx(BaseEdge, {
|
|
1629
|
+
id: e.isInternal ? void 0 : t,
|
|
1630
|
+
path: v,
|
|
1631
|
+
labelX: y,
|
|
1632
|
+
labelY: b,
|
|
1633
|
+
label: c,
|
|
1634
|
+
labelStyle: l,
|
|
1635
|
+
labelShowBg: u,
|
|
1636
|
+
labelBgStyle: d,
|
|
1637
|
+
labelBgPadding: f,
|
|
1638
|
+
labelBgBorderRadius: p,
|
|
1639
|
+
style: m,
|
|
1640
|
+
markerEnd: h,
|
|
1641
|
+
markerStart: g,
|
|
1642
|
+
interactionWidth: _
|
|
1643
|
+
});
|
|
1644
|
+
});
|
|
1645
|
+
}
|
|
1646
|
+
var SimpleBezierEdge = createSimpleBezierEdge({ isInternal: !1 }), SimpleBezierEdgeInternal = createSimpleBezierEdge({ isInternal: !0 });
|
|
1647
|
+
SimpleBezierEdge.displayName = "SimpleBezierEdge", SimpleBezierEdgeInternal.displayName = "SimpleBezierEdgeInternal";
|
|
1648
|
+
function createSmoothStepEdge(e) {
|
|
1649
|
+
return memo(({ id: t, sourceX: n, sourceY: r, targetX: i, targetY: o, label: s, labelStyle: c, labelShowBg: l, labelBgStyle: u, labelBgPadding: d, labelBgBorderRadius: f, style: p, sourcePosition: m = Position.Bottom, targetPosition: h = Position.Top, markerEnd: g, markerStart: _, pathOptions: v, interactionWidth: y }) => {
|
|
1650
|
+
let [b, x, S] = getSmoothStepPath({
|
|
1651
|
+
sourceX: n,
|
|
1652
|
+
sourceY: r,
|
|
1653
|
+
sourcePosition: m,
|
|
1654
|
+
targetX: i,
|
|
1655
|
+
targetY: o,
|
|
1656
|
+
targetPosition: h,
|
|
1657
|
+
borderRadius: v?.borderRadius,
|
|
1658
|
+
offset: v?.offset,
|
|
1659
|
+
stepPosition: v?.stepPosition
|
|
1660
|
+
});
|
|
1661
|
+
return jsx(BaseEdge, {
|
|
1662
|
+
id: e.isInternal ? void 0 : t,
|
|
1663
|
+
path: b,
|
|
1664
|
+
labelX: x,
|
|
1665
|
+
labelY: S,
|
|
1666
|
+
label: s,
|
|
1667
|
+
labelStyle: c,
|
|
1668
|
+
labelShowBg: l,
|
|
1669
|
+
labelBgStyle: u,
|
|
1670
|
+
labelBgPadding: d,
|
|
1671
|
+
labelBgBorderRadius: f,
|
|
1672
|
+
style: p,
|
|
1673
|
+
markerEnd: g,
|
|
1674
|
+
markerStart: _,
|
|
1675
|
+
interactionWidth: y
|
|
1676
|
+
});
|
|
1677
|
+
});
|
|
1678
|
+
}
|
|
1679
|
+
var SmoothStepEdge = createSmoothStepEdge({ isInternal: !1 }), SmoothStepEdgeInternal = createSmoothStepEdge({ isInternal: !0 });
|
|
1680
|
+
SmoothStepEdge.displayName = "SmoothStepEdge", SmoothStepEdgeInternal.displayName = "SmoothStepEdgeInternal";
|
|
1681
|
+
function createStepEdge(e) {
|
|
1682
|
+
return memo(({ id: t, ...n }) => {
|
|
1683
|
+
let r = e.isInternal ? void 0 : t;
|
|
1684
|
+
return jsx(SmoothStepEdge, {
|
|
1685
|
+
...n,
|
|
1686
|
+
id: r,
|
|
1687
|
+
pathOptions: useMemo(() => ({
|
|
1688
|
+
borderRadius: 0,
|
|
1689
|
+
offset: n.pathOptions?.offset
|
|
1690
|
+
}), [n.pathOptions?.offset])
|
|
1691
|
+
});
|
|
1692
|
+
});
|
|
1693
|
+
}
|
|
1694
|
+
var StepEdge = createStepEdge({ isInternal: !1 }), StepEdgeInternal = createStepEdge({ isInternal: !0 });
|
|
1695
|
+
StepEdge.displayName = "StepEdge", StepEdgeInternal.displayName = "StepEdgeInternal";
|
|
1696
|
+
function createStraightEdge(e) {
|
|
1697
|
+
return memo(({ id: t, sourceX: n, sourceY: r, targetX: i, targetY: a, label: o, labelStyle: s, labelShowBg: c, labelBgStyle: l, labelBgPadding: u, labelBgBorderRadius: d, style: f, markerEnd: p, markerStart: m, interactionWidth: h }) => {
|
|
1698
|
+
let [g, _, v] = getStraightPath({
|
|
1699
|
+
sourceX: n,
|
|
1700
|
+
sourceY: r,
|
|
1701
|
+
targetX: i,
|
|
1702
|
+
targetY: a
|
|
1703
|
+
});
|
|
1704
|
+
return jsx(BaseEdge, {
|
|
1705
|
+
id: e.isInternal ? void 0 : t,
|
|
1706
|
+
path: g,
|
|
1707
|
+
labelX: _,
|
|
1708
|
+
labelY: v,
|
|
1709
|
+
label: o,
|
|
1710
|
+
labelStyle: s,
|
|
1711
|
+
labelShowBg: c,
|
|
1712
|
+
labelBgStyle: l,
|
|
1713
|
+
labelBgPadding: u,
|
|
1714
|
+
labelBgBorderRadius: d,
|
|
1715
|
+
style: f,
|
|
1716
|
+
markerEnd: p,
|
|
1717
|
+
markerStart: m,
|
|
1718
|
+
interactionWidth: h
|
|
1719
|
+
});
|
|
1720
|
+
});
|
|
1721
|
+
}
|
|
1722
|
+
var StraightEdge = createStraightEdge({ isInternal: !1 }), StraightEdgeInternal = createStraightEdge({ isInternal: !0 });
|
|
1723
|
+
StraightEdge.displayName = "StraightEdge", StraightEdgeInternal.displayName = "StraightEdgeInternal";
|
|
1724
|
+
function createBezierEdge(e) {
|
|
1725
|
+
return memo(({ id: t, sourceX: n, sourceY: r, targetX: i, targetY: o, sourcePosition: s = Position.Bottom, targetPosition: c = Position.Top, label: l, labelStyle: u, labelShowBg: d, labelBgStyle: f, labelBgPadding: p, labelBgBorderRadius: m, style: h, markerEnd: g, markerStart: _, pathOptions: v, interactionWidth: y }) => {
|
|
1726
|
+
let [b, x, S] = getBezierPath({
|
|
1727
|
+
sourceX: n,
|
|
1728
|
+
sourceY: r,
|
|
1729
|
+
sourcePosition: s,
|
|
1730
|
+
targetX: i,
|
|
1731
|
+
targetY: o,
|
|
1732
|
+
targetPosition: c,
|
|
1733
|
+
curvature: v?.curvature
|
|
1734
|
+
});
|
|
1735
|
+
return jsx(BaseEdge, {
|
|
1736
|
+
id: e.isInternal ? void 0 : t,
|
|
1737
|
+
path: b,
|
|
1738
|
+
labelX: x,
|
|
1739
|
+
labelY: S,
|
|
1740
|
+
label: l,
|
|
1741
|
+
labelStyle: u,
|
|
1742
|
+
labelShowBg: d,
|
|
1743
|
+
labelBgStyle: f,
|
|
1744
|
+
labelBgPadding: p,
|
|
1745
|
+
labelBgBorderRadius: m,
|
|
1746
|
+
style: h,
|
|
1747
|
+
markerEnd: g,
|
|
1748
|
+
markerStart: _,
|
|
1749
|
+
interactionWidth: y
|
|
1750
|
+
});
|
|
1751
|
+
});
|
|
1752
|
+
}
|
|
1753
|
+
var BezierEdge = createBezierEdge({ isInternal: !1 }), BezierEdgeInternal = createBezierEdge({ isInternal: !0 });
|
|
1754
|
+
BezierEdge.displayName = "BezierEdge", BezierEdgeInternal.displayName = "BezierEdgeInternal";
|
|
1755
|
+
var builtinEdgeTypes = {
|
|
1756
|
+
default: BezierEdgeInternal,
|
|
1757
|
+
straight: StraightEdgeInternal,
|
|
1758
|
+
step: StepEdgeInternal,
|
|
1759
|
+
smoothstep: SmoothStepEdgeInternal,
|
|
1760
|
+
simplebezier: SimpleBezierEdgeInternal
|
|
1761
|
+
}, nullPosition = {
|
|
1762
|
+
sourceX: null,
|
|
1763
|
+
sourceY: null,
|
|
1764
|
+
targetX: null,
|
|
1765
|
+
targetY: null,
|
|
1766
|
+
sourcePosition: null,
|
|
1767
|
+
targetPosition: null
|
|
1768
|
+
}, shiftX = (e, t, n) => n === Position.Left ? e - t : n === Position.Right ? e + t : e, shiftY = (e, t, n) => n === Position.Top ? e - t : n === Position.Bottom ? e + t : e, EdgeUpdaterClassName = "react-flow__edgeupdater";
|
|
1769
|
+
function EdgeAnchor({ position: t, centerX: n, centerY: r, radius: i = 10, onMouseDown: a, onMouseEnter: o, onMouseOut: s, type: c }) {
|
|
1770
|
+
return jsx("circle", {
|
|
1771
|
+
onMouseDown: a,
|
|
1772
|
+
onMouseEnter: o,
|
|
1773
|
+
onMouseOut: s,
|
|
1774
|
+
className: cc([EdgeUpdaterClassName, `${EdgeUpdaterClassName}-${c}`]),
|
|
1775
|
+
cx: shiftX(n, i, t),
|
|
1776
|
+
cy: shiftY(r, i, t),
|
|
1777
|
+
r: i,
|
|
1778
|
+
stroke: "transparent",
|
|
1779
|
+
fill: "transparent"
|
|
1780
|
+
});
|
|
1781
|
+
}
|
|
1782
|
+
function EdgeUpdateAnchors({ isReconnectable: e, reconnectRadius: t, edge: n, sourceX: r, sourceY: i, targetX: a, targetY: o, sourcePosition: s, targetPosition: c, onReconnect: u, onReconnectStart: d, onReconnectEnd: f, setReconnecting: p, setUpdateHover: m }) {
|
|
1783
|
+
let h = useStoreApi(), g = (e, t) => {
|
|
1784
|
+
if (e.button !== 0) return;
|
|
1785
|
+
let { autoPanOnConnect: r, domNode: i, connectionMode: a, connectionRadius: o, lib: s, onConnectStart: c, cancelConnection: m, nodeLookup: g, rfId: _, panBy: v, updateConnection: y } = h.getState(), b = t.type === "target";
|
|
1786
|
+
XYHandle.onPointerDown(e.nativeEvent, {
|
|
1787
|
+
autoPanOnConnect: r,
|
|
1788
|
+
connectionMode: a,
|
|
1789
|
+
connectionRadius: o,
|
|
1790
|
+
domNode: i,
|
|
1791
|
+
handleId: t.id,
|
|
1792
|
+
nodeId: t.nodeId,
|
|
1793
|
+
nodeLookup: g,
|
|
1794
|
+
isTarget: b,
|
|
1795
|
+
edgeUpdaterType: t.type,
|
|
1796
|
+
lib: s,
|
|
1797
|
+
flowId: _,
|
|
1798
|
+
cancelConnection: m,
|
|
1799
|
+
panBy: v,
|
|
1800
|
+
isValidConnection: (...e) => h.getState().isValidConnection?.(...e) ?? !0,
|
|
1801
|
+
onConnect: (e) => u?.(n, e),
|
|
1802
|
+
onConnectStart: (r, i) => {
|
|
1803
|
+
p(!0), d?.(e, n, t.type), c?.(r, i);
|
|
1804
|
+
},
|
|
1805
|
+
onConnectEnd: (...e) => h.getState().onConnectEnd?.(...e),
|
|
1806
|
+
onReconnectEnd: (e, r) => {
|
|
1807
|
+
p(!1), f?.(e, n, t.type, r);
|
|
1808
|
+
},
|
|
1809
|
+
updateConnection: y,
|
|
1810
|
+
getTransform: () => h.getState().transform,
|
|
1811
|
+
getFromHandle: () => h.getState().connection.fromHandle,
|
|
1812
|
+
dragThreshold: h.getState().connectionDragThreshold,
|
|
1813
|
+
handleDomNode: e.currentTarget
|
|
1814
|
+
});
|
|
1815
|
+
}, _ = (e) => g(e, {
|
|
1816
|
+
nodeId: n.target,
|
|
1817
|
+
id: n.targetHandle ?? null,
|
|
1818
|
+
type: "target"
|
|
1819
|
+
}), v = (e) => g(e, {
|
|
1820
|
+
nodeId: n.source,
|
|
1821
|
+
id: n.sourceHandle ?? null,
|
|
1822
|
+
type: "source"
|
|
1823
|
+
}), y = () => m(!0), b = () => m(!1);
|
|
1824
|
+
return jsxs(Fragment$1, { children: [(e === !0 || e === "source") && jsx(EdgeAnchor, {
|
|
1825
|
+
position: s,
|
|
1826
|
+
centerX: r,
|
|
1827
|
+
centerY: i,
|
|
1828
|
+
radius: t,
|
|
1829
|
+
onMouseDown: _,
|
|
1830
|
+
onMouseEnter: y,
|
|
1831
|
+
onMouseOut: b,
|
|
1832
|
+
type: "source"
|
|
1833
|
+
}), (e === !0 || e === "target") && jsx(EdgeAnchor, {
|
|
1834
|
+
position: c,
|
|
1835
|
+
centerX: a,
|
|
1836
|
+
centerY: o,
|
|
1837
|
+
radius: t,
|
|
1838
|
+
onMouseDown: v,
|
|
1839
|
+
onMouseEnter: y,
|
|
1840
|
+
onMouseOut: b,
|
|
1841
|
+
type: "target"
|
|
1842
|
+
})] });
|
|
1843
|
+
}
|
|
1844
|
+
function EdgeWrapper({ id: t, edgesFocusable: n, edgesReconnectable: r, elementsSelectable: i, onClick: a, onDoubleClick: o, onContextMenu: s, onMouseEnter: c, onMouseMove: l, onMouseLeave: u, reconnectRadius: d, onReconnect: f, onReconnectStart: p, onReconnectEnd: m, rfId: h, edgeTypes: g, noPanClassName: _, onError: v, disableKeyboardA11y: y }) {
|
|
1845
|
+
let S = useStore((e) => e.edgeLookup.get(t)), C = useStore((e) => e.defaultEdgeOptions);
|
|
1846
|
+
S = C ? {
|
|
1847
|
+
...C,
|
|
1848
|
+
...S
|
|
1849
|
+
} : S;
|
|
1850
|
+
let w = S.type || "default", T = g?.[w] || builtinEdgeTypes[w];
|
|
1851
|
+
T === void 0 && (v?.("011", errorMessages.error011(w)), w = "default", T = g?.default || builtinEdgeTypes.default);
|
|
1852
|
+
let E = !!(S.focusable || n && S.focusable === void 0), D = f !== void 0 && (S.reconnectable || r && S.reconnectable === void 0), O = !!(S.selectable || i && S.selectable === void 0), k = useRef(null), [A, M] = useState(!1), [P, F] = useState(!1), I = useStoreApi(), { zIndex: L, sourceX: z, sourceY: B, targetX: V, targetY: H, sourcePosition: U, targetPosition: W } = useStore(useCallback((e) => {
|
|
1853
|
+
let n = e.nodeLookup.get(S.source), r = e.nodeLookup.get(S.target);
|
|
1854
|
+
if (!n || !r) return {
|
|
1855
|
+
zIndex: S.zIndex,
|
|
1856
|
+
...nullPosition
|
|
1857
|
+
};
|
|
1858
|
+
let i = getEdgePosition({
|
|
1859
|
+
id: t,
|
|
1860
|
+
sourceNode: n,
|
|
1861
|
+
targetNode: r,
|
|
1862
|
+
sourceHandle: S.sourceHandle || null,
|
|
1863
|
+
targetHandle: S.targetHandle || null,
|
|
1864
|
+
connectionMode: e.connectionMode,
|
|
1865
|
+
onError: v
|
|
1866
|
+
});
|
|
1867
|
+
return {
|
|
1868
|
+
zIndex: getElevatedEdgeZIndex({
|
|
1869
|
+
selected: S.selected,
|
|
1870
|
+
zIndex: S.zIndex,
|
|
1871
|
+
sourceNode: n,
|
|
1872
|
+
targetNode: r,
|
|
1873
|
+
elevateOnSelect: e.elevateEdgesOnSelect,
|
|
1874
|
+
zIndexMode: e.zIndexMode
|
|
1875
|
+
}),
|
|
1876
|
+
...i || nullPosition
|
|
1877
|
+
};
|
|
1878
|
+
}, [
|
|
1879
|
+
S.source,
|
|
1880
|
+
S.target,
|
|
1881
|
+
S.sourceHandle,
|
|
1882
|
+
S.targetHandle,
|
|
1883
|
+
S.selected,
|
|
1884
|
+
S.zIndex
|
|
1885
|
+
]), shallow), G = useMemo(() => S.markerStart ? `url('#${getMarkerId(S.markerStart, h)}')` : void 0, [S.markerStart, h]), K = useMemo(() => S.markerEnd ? `url('#${getMarkerId(S.markerEnd, h)}')` : void 0, [S.markerEnd, h]);
|
|
1886
|
+
if (S.hidden || z === null || B === null || V === null || H === null) return null;
|
|
1887
|
+
let q = (e) => {
|
|
1888
|
+
let { addSelectedEdges: n, unselectNodesAndEdges: r, multiSelectionActive: i } = I.getState();
|
|
1889
|
+
O && (I.setState({ nodesSelectionActive: !1 }), S.selected && i ? (r({
|
|
1890
|
+
nodes: [],
|
|
1891
|
+
edges: [S]
|
|
1892
|
+
}), k.current?.blur()) : n([t])), a && a(e, S);
|
|
1893
|
+
}, J = o ? (e) => {
|
|
1894
|
+
o(e, { ...S });
|
|
1895
|
+
} : void 0, Y = s ? (e) => {
|
|
1896
|
+
s(e, { ...S });
|
|
1897
|
+
} : void 0, X = c ? (e) => {
|
|
1898
|
+
c(e, { ...S });
|
|
1899
|
+
} : void 0, Z = l ? (e) => {
|
|
1900
|
+
l(e, { ...S });
|
|
1901
|
+
} : void 0, Vn = u ? (e) => {
|
|
1902
|
+
u(e, { ...S });
|
|
1903
|
+
} : void 0;
|
|
1904
|
+
return jsx("svg", {
|
|
1905
|
+
style: { zIndex: L },
|
|
1906
|
+
children: jsxs("g", {
|
|
1907
|
+
className: cc([
|
|
1908
|
+
"react-flow__edge",
|
|
1909
|
+
`react-flow__edge-${w}`,
|
|
1910
|
+
S.className,
|
|
1911
|
+
_,
|
|
1912
|
+
{
|
|
1913
|
+
selected: S.selected,
|
|
1914
|
+
animated: S.animated,
|
|
1915
|
+
inactive: !O && !a,
|
|
1916
|
+
updating: A,
|
|
1917
|
+
selectable: O
|
|
1918
|
+
}
|
|
1919
|
+
]),
|
|
1920
|
+
onClick: q,
|
|
1921
|
+
onDoubleClick: J,
|
|
1922
|
+
onContextMenu: Y,
|
|
1923
|
+
onMouseEnter: X,
|
|
1924
|
+
onMouseMove: Z,
|
|
1925
|
+
onMouseLeave: Vn,
|
|
1926
|
+
onKeyDown: E ? (e) => {
|
|
1927
|
+
if (!y && elementSelectionKeys.includes(e.key) && O) {
|
|
1928
|
+
let { unselectNodesAndEdges: n, addSelectedEdges: r } = I.getState();
|
|
1929
|
+
e.key === "Escape" ? (k.current?.blur(), n({ edges: [S] })) : r([t]);
|
|
1930
|
+
}
|
|
1931
|
+
} : void 0,
|
|
1932
|
+
tabIndex: E ? 0 : void 0,
|
|
1933
|
+
role: S.ariaRole ?? (E ? "group" : "img"),
|
|
1934
|
+
"aria-roledescription": "edge",
|
|
1935
|
+
"data-id": t,
|
|
1936
|
+
"data-testid": `rf__edge-${t}`,
|
|
1937
|
+
"aria-label": S.ariaLabel === null ? void 0 : S.ariaLabel || `Edge from ${S.source} to ${S.target}`,
|
|
1938
|
+
"aria-describedby": E ? `${ARIA_EDGE_DESC_KEY}-${h}` : void 0,
|
|
1939
|
+
ref: k,
|
|
1940
|
+
...S.domAttributes,
|
|
1941
|
+
children: [!P && jsx(T, {
|
|
1942
|
+
id: t,
|
|
1943
|
+
source: S.source,
|
|
1944
|
+
target: S.target,
|
|
1945
|
+
type: S.type,
|
|
1946
|
+
selected: S.selected,
|
|
1947
|
+
animated: S.animated,
|
|
1948
|
+
selectable: O,
|
|
1949
|
+
deletable: S.deletable ?? !0,
|
|
1950
|
+
label: S.label,
|
|
1951
|
+
labelStyle: S.labelStyle,
|
|
1952
|
+
labelShowBg: S.labelShowBg,
|
|
1953
|
+
labelBgStyle: S.labelBgStyle,
|
|
1954
|
+
labelBgPadding: S.labelBgPadding,
|
|
1955
|
+
labelBgBorderRadius: S.labelBgBorderRadius,
|
|
1956
|
+
sourceX: z,
|
|
1957
|
+
sourceY: B,
|
|
1958
|
+
targetX: V,
|
|
1959
|
+
targetY: H,
|
|
1960
|
+
sourcePosition: U,
|
|
1961
|
+
targetPosition: W,
|
|
1962
|
+
data: S.data,
|
|
1963
|
+
style: S.style,
|
|
1964
|
+
sourceHandleId: S.sourceHandle,
|
|
1965
|
+
targetHandleId: S.targetHandle,
|
|
1966
|
+
markerStart: G,
|
|
1967
|
+
markerEnd: K,
|
|
1968
|
+
pathOptions: "pathOptions" in S ? S.pathOptions : void 0,
|
|
1969
|
+
interactionWidth: S.interactionWidth
|
|
1970
|
+
}), D && jsx(EdgeUpdateAnchors, {
|
|
1971
|
+
edge: S,
|
|
1972
|
+
isReconnectable: D,
|
|
1973
|
+
reconnectRadius: d,
|
|
1974
|
+
onReconnect: f,
|
|
1975
|
+
onReconnectStart: p,
|
|
1976
|
+
onReconnectEnd: m,
|
|
1977
|
+
sourceX: z,
|
|
1978
|
+
sourceY: B,
|
|
1979
|
+
targetX: V,
|
|
1980
|
+
targetY: H,
|
|
1981
|
+
sourcePosition: U,
|
|
1982
|
+
targetPosition: W,
|
|
1983
|
+
setUpdateHover: M,
|
|
1984
|
+
setReconnecting: F
|
|
1985
|
+
})]
|
|
1986
|
+
})
|
|
1987
|
+
});
|
|
1988
|
+
}
|
|
1989
|
+
var EdgeWrapper$1 = memo(EdgeWrapper), selector$a = (e) => ({
|
|
1990
|
+
edgesFocusable: e.edgesFocusable,
|
|
1991
|
+
edgesReconnectable: e.edgesReconnectable,
|
|
1992
|
+
elementsSelectable: e.elementsSelectable,
|
|
1993
|
+
connectionMode: e.connectionMode,
|
|
1994
|
+
onError: e.onError
|
|
1995
|
+
});
|
|
1996
|
+
function EdgeRendererComponent({ defaultMarkerColor: e, onlyRenderVisibleElements: t, rfId: n, edgeTypes: r, noPanClassName: i, onReconnect: a, onEdgeContextMenu: o, onEdgeMouseEnter: s, onEdgeMouseMove: c, onEdgeMouseLeave: l, onEdgeClick: u, reconnectRadius: d, onEdgeDoubleClick: f, onReconnectStart: p, onReconnectEnd: m, disableKeyboardA11y: h }) {
|
|
1997
|
+
let { edgesFocusable: g, edgesReconnectable: _, elementsSelectable: v, onError: y } = useStore(selector$a, shallow), b = useVisibleEdgeIds(t);
|
|
1998
|
+
return jsxs("div", {
|
|
1999
|
+
className: "react-flow__edges",
|
|
2000
|
+
children: [jsx(MarkerDefinitions$1, {
|
|
2001
|
+
defaultColor: e,
|
|
2002
|
+
rfId: n
|
|
2003
|
+
}), b.map((e) => jsx(EdgeWrapper$1, {
|
|
2004
|
+
id: e,
|
|
2005
|
+
edgesFocusable: g,
|
|
2006
|
+
edgesReconnectable: _,
|
|
2007
|
+
elementsSelectable: v,
|
|
2008
|
+
noPanClassName: i,
|
|
2009
|
+
onReconnect: a,
|
|
2010
|
+
onContextMenu: o,
|
|
2011
|
+
onMouseEnter: s,
|
|
2012
|
+
onMouseMove: c,
|
|
2013
|
+
onMouseLeave: l,
|
|
2014
|
+
onClick: u,
|
|
2015
|
+
reconnectRadius: d,
|
|
2016
|
+
onDoubleClick: f,
|
|
2017
|
+
onReconnectStart: p,
|
|
2018
|
+
onReconnectEnd: m,
|
|
2019
|
+
rfId: n,
|
|
2020
|
+
onError: y,
|
|
2021
|
+
edgeTypes: r,
|
|
2022
|
+
disableKeyboardA11y: h
|
|
2023
|
+
}, e))]
|
|
2024
|
+
});
|
|
2025
|
+
}
|
|
2026
|
+
EdgeRendererComponent.displayName = "EdgeRenderer";
|
|
2027
|
+
var EdgeRenderer = memo(EdgeRendererComponent), selector$9 = (e) => `translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;
|
|
2028
|
+
function Viewport({ children: e }) {
|
|
2029
|
+
return jsx("div", {
|
|
2030
|
+
className: "react-flow__viewport xyflow__viewport react-flow__container",
|
|
2031
|
+
style: { transform: useStore(selector$9) },
|
|
2032
|
+
children: e
|
|
2033
|
+
});
|
|
2034
|
+
}
|
|
2035
|
+
function useOnInitHandler(e) {
|
|
2036
|
+
let t = useReactFlow(), n = useRef(!1);
|
|
2037
|
+
useEffect(() => {
|
|
2038
|
+
!n.current && t.viewportInitialized && e && (setTimeout(() => e(t), 1), n.current = !0);
|
|
2039
|
+
}, [e, t.viewportInitialized]);
|
|
2040
|
+
}
|
|
2041
|
+
var selector$8 = (e) => e.panZoom?.syncViewport;
|
|
2042
|
+
function useViewportSync(e) {
|
|
2043
|
+
let t = useStore(selector$8), n = useStoreApi();
|
|
2044
|
+
return useEffect(() => {
|
|
2045
|
+
e && (t?.(e), n.setState({ transform: [
|
|
2046
|
+
e.x,
|
|
2047
|
+
e.y,
|
|
2048
|
+
e.zoom
|
|
2049
|
+
] }));
|
|
2050
|
+
}, [e, t]), null;
|
|
2051
|
+
}
|
|
2052
|
+
function storeSelector$1(e) {
|
|
2053
|
+
return e.connection.inProgress ? {
|
|
2054
|
+
...e.connection,
|
|
2055
|
+
to: pointToRendererPoint(e.connection.to, e.transform)
|
|
2056
|
+
} : { ...e.connection };
|
|
2057
|
+
}
|
|
2058
|
+
function getSelector(e) {
|
|
2059
|
+
return e ? (t) => e(storeSelector$1(t)) : storeSelector$1;
|
|
2060
|
+
}
|
|
2061
|
+
function useConnection(e) {
|
|
2062
|
+
return useStore(getSelector(e), shallow);
|
|
2063
|
+
}
|
|
2064
|
+
var selector$7 = (e) => ({
|
|
2065
|
+
nodesConnectable: e.nodesConnectable,
|
|
2066
|
+
isValid: e.connection.isValid,
|
|
2067
|
+
inProgress: e.connection.inProgress,
|
|
2068
|
+
width: e.width,
|
|
2069
|
+
height: e.height
|
|
2070
|
+
});
|
|
2071
|
+
function ConnectionLineWrapper({ containerStyle: t, style: n, type: r, component: i }) {
|
|
2072
|
+
let { nodesConnectable: a, width: o, height: s, isValid: c, inProgress: l } = useStore(selector$7, shallow);
|
|
2073
|
+
return o && a && l ? jsx("svg", {
|
|
2074
|
+
style: t,
|
|
2075
|
+
width: o,
|
|
2076
|
+
height: s,
|
|
2077
|
+
className: "react-flow__connectionline react-flow__container",
|
|
2078
|
+
children: jsx("g", {
|
|
2079
|
+
className: cc(["react-flow__connection", getConnectionStatus(c)]),
|
|
2080
|
+
children: jsx(ConnectionLine, {
|
|
2081
|
+
style: n,
|
|
2082
|
+
type: r,
|
|
2083
|
+
CustomComponent: i,
|
|
2084
|
+
isValid: c
|
|
2085
|
+
})
|
|
2086
|
+
})
|
|
2087
|
+
}) : null;
|
|
2088
|
+
}
|
|
2089
|
+
var ConnectionLine = ({ style: e, type: n = ConnectionLineType.Bezier, CustomComponent: r, isValid: i }) => {
|
|
2090
|
+
let { inProgress: a, from: o, fromNode: s, fromHandle: c, fromPosition: l, to: u, toNode: d, toHandle: f, toPosition: p, pointer: m } = useConnection();
|
|
2091
|
+
if (!a) return;
|
|
2092
|
+
if (r) return jsx(r, {
|
|
2093
|
+
connectionLineType: n,
|
|
2094
|
+
connectionLineStyle: e,
|
|
2095
|
+
fromNode: s,
|
|
2096
|
+
fromHandle: c,
|
|
2097
|
+
fromX: o.x,
|
|
2098
|
+
fromY: o.y,
|
|
2099
|
+
toX: u.x,
|
|
2100
|
+
toY: u.y,
|
|
2101
|
+
fromPosition: l,
|
|
2102
|
+
toPosition: p,
|
|
2103
|
+
connectionStatus: getConnectionStatus(i),
|
|
2104
|
+
toNode: d,
|
|
2105
|
+
toHandle: f,
|
|
2106
|
+
pointer: m
|
|
2107
|
+
});
|
|
2108
|
+
let h = "", g = {
|
|
2109
|
+
sourceX: o.x,
|
|
2110
|
+
sourceY: o.y,
|
|
2111
|
+
sourcePosition: l,
|
|
2112
|
+
targetX: u.x,
|
|
2113
|
+
targetY: u.y,
|
|
2114
|
+
targetPosition: p
|
|
2115
|
+
};
|
|
2116
|
+
switch (n) {
|
|
2117
|
+
case ConnectionLineType.Bezier:
|
|
2118
|
+
[h] = getBezierPath(g);
|
|
2119
|
+
break;
|
|
2120
|
+
case ConnectionLineType.SimpleBezier:
|
|
2121
|
+
[h] = getSimpleBezierPath(g);
|
|
2122
|
+
break;
|
|
2123
|
+
case ConnectionLineType.Step:
|
|
2124
|
+
[h] = getSmoothStepPath({
|
|
2125
|
+
...g,
|
|
2126
|
+
borderRadius: 0
|
|
2127
|
+
});
|
|
2128
|
+
break;
|
|
2129
|
+
case ConnectionLineType.SmoothStep:
|
|
2130
|
+
[h] = getSmoothStepPath(g);
|
|
2131
|
+
break;
|
|
2132
|
+
default: [h] = getStraightPath(g);
|
|
2133
|
+
}
|
|
2134
|
+
return jsx("path", {
|
|
2135
|
+
d: h,
|
|
2136
|
+
fill: "none",
|
|
2137
|
+
className: "react-flow__connection-path",
|
|
2138
|
+
style: e
|
|
2139
|
+
});
|
|
2140
|
+
};
|
|
2141
|
+
ConnectionLine.displayName = "ConnectionLine";
|
|
2142
|
+
var emptyTypes = {};
|
|
2143
|
+
function useNodeOrEdgeTypesWarning(e = emptyTypes) {
|
|
2144
|
+
let t = useRef(e), n = useStoreApi();
|
|
2145
|
+
useEffect(() => {
|
|
2146
|
+
if (process.env.NODE_ENV === "development") {
|
|
2147
|
+
let r = new Set([...Object.keys(t.current), ...Object.keys(e)]);
|
|
2148
|
+
for (let i of r) if (t.current[i] !== e[i]) {
|
|
2149
|
+
n.getState().onError?.("002", errorMessages.error002());
|
|
2150
|
+
break;
|
|
2151
|
+
}
|
|
2152
|
+
t.current = e;
|
|
2153
|
+
}
|
|
2154
|
+
}, [e]);
|
|
2155
|
+
}
|
|
2156
|
+
function useStylesLoadedWarning() {
|
|
2157
|
+
let e = useStoreApi(), t = useRef(!1);
|
|
2158
|
+
useEffect(() => {
|
|
2159
|
+
if (process.env.NODE_ENV === "development" && !t.current) {
|
|
2160
|
+
let n = document.querySelector(".react-flow__pane");
|
|
2161
|
+
n && window.getComputedStyle(n).zIndex !== "1" && e.getState().onError?.("013", errorMessages.error013("react")), t.current = !0;
|
|
2162
|
+
}
|
|
2163
|
+
}, []);
|
|
2164
|
+
}
|
|
2165
|
+
function GraphViewComponent({ nodeTypes: e, edgeTypes: t, onInit: n, onNodeClick: r, onEdgeClick: i, onNodeDoubleClick: a, onEdgeDoubleClick: o, onNodeMouseEnter: s, onNodeMouseMove: c, onNodeMouseLeave: l, onNodeContextMenu: u, onSelectionContextMenu: d, onSelectionStart: f, onSelectionEnd: p, connectionLineType: m, connectionLineStyle: h, connectionLineComponent: g, connectionLineContainerStyle: _, selectionKeyCode: v, selectionOnDrag: y, selectionMode: b, multiSelectionKeyCode: x, panActivationKeyCode: S, zoomActivationKeyCode: C, deleteKeyCode: w, onlyRenderVisibleElements: T, elementsSelectable: E, defaultViewport: D, translateExtent: O, minZoom: k, maxZoom: A, preventScrolling: j, defaultMarkerColor: M, zoomOnScroll: N, zoomOnPinch: P, panOnScroll: F, panOnScrollSpeed: I, panOnScrollMode: L, zoomOnDoubleClick: R, panOnDrag: z, onPaneClick: B, onPaneMouseEnter: V, onPaneMouseMove: H, onPaneMouseLeave: U, onPaneScroll: W, onPaneContextMenu: G, paneClickDistance: K, nodeClickDistance: q, onEdgeContextMenu: J, onEdgeMouseEnter: Y, onEdgeMouseMove: X, onEdgeMouseLeave: Z, reconnectRadius: Vn, onReconnect: Hn, onReconnectStart: Un, onReconnectEnd: Wn, noDragClassName: Gn, noWheelClassName: Kn, noPanClassName: Q, disableKeyboardA11y: $, nodeExtent: qn, rfId: Jn, viewport: Yn, onViewportChange: Xn }) {
|
|
2166
|
+
return useNodeOrEdgeTypesWarning(e), useNodeOrEdgeTypesWarning(t), useStylesLoadedWarning(), useOnInitHandler(n), useViewportSync(Yn), jsx(FlowRenderer, {
|
|
2167
|
+
onPaneClick: B,
|
|
2168
|
+
onPaneMouseEnter: V,
|
|
2169
|
+
onPaneMouseMove: H,
|
|
2170
|
+
onPaneMouseLeave: U,
|
|
2171
|
+
onPaneContextMenu: G,
|
|
2172
|
+
onPaneScroll: W,
|
|
2173
|
+
paneClickDistance: K,
|
|
2174
|
+
deleteKeyCode: w,
|
|
2175
|
+
selectionKeyCode: v,
|
|
2176
|
+
selectionOnDrag: y,
|
|
2177
|
+
selectionMode: b,
|
|
2178
|
+
onSelectionStart: f,
|
|
2179
|
+
onSelectionEnd: p,
|
|
2180
|
+
multiSelectionKeyCode: x,
|
|
2181
|
+
panActivationKeyCode: S,
|
|
2182
|
+
zoomActivationKeyCode: C,
|
|
2183
|
+
elementsSelectable: E,
|
|
2184
|
+
zoomOnScroll: N,
|
|
2185
|
+
zoomOnPinch: P,
|
|
2186
|
+
zoomOnDoubleClick: R,
|
|
2187
|
+
panOnScroll: F,
|
|
2188
|
+
panOnScrollSpeed: I,
|
|
2189
|
+
panOnScrollMode: L,
|
|
2190
|
+
panOnDrag: z,
|
|
2191
|
+
defaultViewport: D,
|
|
2192
|
+
translateExtent: O,
|
|
2193
|
+
minZoom: k,
|
|
2194
|
+
maxZoom: A,
|
|
2195
|
+
onSelectionContextMenu: d,
|
|
2196
|
+
preventScrolling: j,
|
|
2197
|
+
noDragClassName: Gn,
|
|
2198
|
+
noWheelClassName: Kn,
|
|
2199
|
+
noPanClassName: Q,
|
|
2200
|
+
disableKeyboardA11y: $,
|
|
2201
|
+
onViewportChange: Xn,
|
|
2202
|
+
isControlledViewport: !!Yn,
|
|
2203
|
+
children: jsxs(Viewport, { children: [
|
|
2204
|
+
jsx(EdgeRenderer, {
|
|
2205
|
+
edgeTypes: t,
|
|
2206
|
+
onEdgeClick: i,
|
|
2207
|
+
onEdgeDoubleClick: o,
|
|
2208
|
+
onReconnect: Hn,
|
|
2209
|
+
onReconnectStart: Un,
|
|
2210
|
+
onReconnectEnd: Wn,
|
|
2211
|
+
onlyRenderVisibleElements: T,
|
|
2212
|
+
onEdgeContextMenu: J,
|
|
2213
|
+
onEdgeMouseEnter: Y,
|
|
2214
|
+
onEdgeMouseMove: X,
|
|
2215
|
+
onEdgeMouseLeave: Z,
|
|
2216
|
+
reconnectRadius: Vn,
|
|
2217
|
+
defaultMarkerColor: M,
|
|
2218
|
+
noPanClassName: Q,
|
|
2219
|
+
disableKeyboardA11y: $,
|
|
2220
|
+
rfId: Jn
|
|
2221
|
+
}),
|
|
2222
|
+
jsx(ConnectionLineWrapper, {
|
|
2223
|
+
style: h,
|
|
2224
|
+
type: m,
|
|
2225
|
+
component: g,
|
|
2226
|
+
containerStyle: _
|
|
2227
|
+
}),
|
|
2228
|
+
jsx("div", { className: "react-flow__edgelabel-renderer" }),
|
|
2229
|
+
jsx(NodeRenderer, {
|
|
2230
|
+
nodeTypes: e,
|
|
2231
|
+
onNodeClick: r,
|
|
2232
|
+
onNodeDoubleClick: a,
|
|
2233
|
+
onNodeMouseEnter: s,
|
|
2234
|
+
onNodeMouseMove: c,
|
|
2235
|
+
onNodeMouseLeave: l,
|
|
2236
|
+
onNodeContextMenu: u,
|
|
2237
|
+
nodeClickDistance: q,
|
|
2238
|
+
onlyRenderVisibleElements: T,
|
|
2239
|
+
noPanClassName: Q,
|
|
2240
|
+
noDragClassName: Gn,
|
|
2241
|
+
disableKeyboardA11y: $,
|
|
2242
|
+
nodeExtent: qn,
|
|
2243
|
+
rfId: Jn
|
|
2244
|
+
}),
|
|
2245
|
+
jsx("div", { className: "react-flow__viewport-portal" })
|
|
2246
|
+
] })
|
|
2247
|
+
});
|
|
2248
|
+
}
|
|
2249
|
+
GraphViewComponent.displayName = "GraphView";
|
|
2250
|
+
var GraphView = memo(GraphViewComponent), getInitialState = ({ nodes: e, edges: t, defaultNodes: r, defaultEdges: i, width: a, height: o, fitView: s, fitViewOptions: c, minZoom: l = .5, maxZoom: u = 2, nodeOrigin: d, nodeExtent: f, zIndexMode: p = "basic" } = {}) => {
|
|
2251
|
+
let h = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map(), _ = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Map(), x = i ?? t ?? [], S = r ?? e ?? [], C = d ?? [0, 0], w = f ?? infiniteExtent;
|
|
2252
|
+
updateConnectionLookup(_, b, x);
|
|
2253
|
+
let T = adoptUserNodes(S, h, g, {
|
|
2254
|
+
nodeOrigin: C,
|
|
2255
|
+
nodeExtent: w,
|
|
2256
|
+
zIndexMode: p
|
|
2257
|
+
}), E = [
|
|
2258
|
+
0,
|
|
2259
|
+
0,
|
|
2260
|
+
1
|
|
2261
|
+
];
|
|
2262
|
+
if (s && a && o) {
|
|
2263
|
+
let { x: e, y: t, zoom: n } = getViewportForBounds(getInternalNodesBounds(h, { filter: (e) => !!((e.width || e.initialWidth) && (e.height || e.initialHeight)) }), a, o, l, u, c?.padding ?? .1);
|
|
2264
|
+
E = [
|
|
2265
|
+
e,
|
|
2266
|
+
t,
|
|
2267
|
+
n
|
|
2268
|
+
];
|
|
2269
|
+
}
|
|
2270
|
+
return {
|
|
2271
|
+
rfId: "1",
|
|
2272
|
+
width: a ?? 0,
|
|
2273
|
+
height: o ?? 0,
|
|
2274
|
+
transform: E,
|
|
2275
|
+
nodes: S,
|
|
2276
|
+
nodesInitialized: T,
|
|
2277
|
+
nodeLookup: h,
|
|
2278
|
+
parentLookup: g,
|
|
2279
|
+
edges: x,
|
|
2280
|
+
edgeLookup: b,
|
|
2281
|
+
connectionLookup: _,
|
|
2282
|
+
onNodesChange: null,
|
|
2283
|
+
onEdgesChange: null,
|
|
2284
|
+
hasDefaultNodes: r !== void 0,
|
|
2285
|
+
hasDefaultEdges: i !== void 0,
|
|
2286
|
+
panZoom: null,
|
|
2287
|
+
minZoom: l,
|
|
2288
|
+
maxZoom: u,
|
|
2289
|
+
translateExtent: infiniteExtent,
|
|
2290
|
+
nodeExtent: w,
|
|
2291
|
+
nodesSelectionActive: !1,
|
|
2292
|
+
userSelectionActive: !1,
|
|
2293
|
+
userSelectionRect: null,
|
|
2294
|
+
connectionMode: ConnectionMode.Strict,
|
|
2295
|
+
domNode: null,
|
|
2296
|
+
paneDragging: !1,
|
|
2297
|
+
noPanClassName: "nopan",
|
|
2298
|
+
nodeOrigin: C,
|
|
2299
|
+
nodeDragThreshold: 1,
|
|
2300
|
+
connectionDragThreshold: 1,
|
|
2301
|
+
snapGrid: [15, 15],
|
|
2302
|
+
snapToGrid: !1,
|
|
2303
|
+
nodesDraggable: !0,
|
|
2304
|
+
nodesConnectable: !0,
|
|
2305
|
+
nodesFocusable: !0,
|
|
2306
|
+
edgesFocusable: !0,
|
|
2307
|
+
edgesReconnectable: !0,
|
|
2308
|
+
elementsSelectable: !0,
|
|
2309
|
+
elevateNodesOnSelect: !0,
|
|
2310
|
+
elevateEdgesOnSelect: !0,
|
|
2311
|
+
selectNodesOnDrag: !0,
|
|
2312
|
+
multiSelectionActive: !1,
|
|
2313
|
+
fitViewQueued: s ?? !1,
|
|
2314
|
+
fitViewOptions: c,
|
|
2315
|
+
fitViewResolver: null,
|
|
2316
|
+
connection: { ...initialConnection },
|
|
2317
|
+
connectionClickStartHandle: null,
|
|
2318
|
+
connectOnClick: !0,
|
|
2319
|
+
ariaLiveMessage: "",
|
|
2320
|
+
autoPanOnConnect: !0,
|
|
2321
|
+
autoPanOnNodeDrag: !0,
|
|
2322
|
+
autoPanOnNodeFocus: !0,
|
|
2323
|
+
autoPanSpeed: 15,
|
|
2324
|
+
connectionRadius: 20,
|
|
2325
|
+
onError: devWarn,
|
|
2326
|
+
isValidConnection: void 0,
|
|
2327
|
+
onSelectionChangeHandlers: [],
|
|
2328
|
+
lib: "react",
|
|
2329
|
+
debug: !1,
|
|
2330
|
+
ariaLabelConfig: defaultAriaLabelConfig,
|
|
2331
|
+
zIndexMode: p,
|
|
2332
|
+
onNodesChangeMiddlewareMap: /* @__PURE__ */ new Map(),
|
|
2333
|
+
onEdgesChangeMiddlewareMap: /* @__PURE__ */ new Map()
|
|
2334
|
+
};
|
|
2335
|
+
}, createStore = ({ nodes: e, edges: t, defaultNodes: n, defaultEdges: r, width: i, height: o, fitView: s, fitViewOptions: c, minZoom: l, maxZoom: u, nodeOrigin: d, nodeExtent: f, zIndexMode: p }) => createWithEqualityFn((h, g) => {
|
|
2336
|
+
async function _() {
|
|
2337
|
+
let { nodeLookup: e, panZoom: t, fitViewOptions: n, fitViewResolver: r, width: i, height: a, minZoom: o, maxZoom: s } = g();
|
|
2338
|
+
t && (await fitViewport({
|
|
2339
|
+
nodes: e,
|
|
2340
|
+
width: i,
|
|
2341
|
+
height: a,
|
|
2342
|
+
panZoom: t,
|
|
2343
|
+
minZoom: o,
|
|
2344
|
+
maxZoom: s
|
|
2345
|
+
}, n), r?.resolve(!0), h({ fitViewResolver: null }));
|
|
2346
|
+
}
|
|
2347
|
+
return {
|
|
2348
|
+
...getInitialState({
|
|
2349
|
+
nodes: e,
|
|
2350
|
+
edges: t,
|
|
2351
|
+
width: i,
|
|
2352
|
+
height: o,
|
|
2353
|
+
fitView: s,
|
|
2354
|
+
fitViewOptions: c,
|
|
2355
|
+
minZoom: l,
|
|
2356
|
+
maxZoom: u,
|
|
2357
|
+
nodeOrigin: d,
|
|
2358
|
+
nodeExtent: f,
|
|
2359
|
+
defaultNodes: n,
|
|
2360
|
+
defaultEdges: r,
|
|
2361
|
+
zIndexMode: p
|
|
2362
|
+
}),
|
|
2363
|
+
setNodes: (e) => {
|
|
2364
|
+
let { nodeLookup: t, parentLookup: n, nodeOrigin: r, elevateNodesOnSelect: i, fitViewQueued: a, zIndexMode: o } = g(), s = adoptUserNodes(e, t, n, {
|
|
2365
|
+
nodeOrigin: r,
|
|
2366
|
+
nodeExtent: f,
|
|
2367
|
+
elevateNodesOnSelect: i,
|
|
2368
|
+
checkEquality: !0,
|
|
2369
|
+
zIndexMode: o
|
|
2370
|
+
});
|
|
2371
|
+
a && s ? (_(), h({
|
|
2372
|
+
nodes: e,
|
|
2373
|
+
nodesInitialized: s,
|
|
2374
|
+
fitViewQueued: !1,
|
|
2375
|
+
fitViewOptions: void 0
|
|
2376
|
+
})) : h({
|
|
2377
|
+
nodes: e,
|
|
2378
|
+
nodesInitialized: s
|
|
2379
|
+
});
|
|
2380
|
+
},
|
|
2381
|
+
setEdges: (e) => {
|
|
2382
|
+
let { connectionLookup: t, edgeLookup: n } = g();
|
|
2383
|
+
updateConnectionLookup(t, n, e), h({ edges: e });
|
|
2384
|
+
},
|
|
2385
|
+
setDefaultNodesAndEdges: (e, t) => {
|
|
2386
|
+
if (e) {
|
|
2387
|
+
let { setNodes: t } = g();
|
|
2388
|
+
t(e), h({ hasDefaultNodes: !0 });
|
|
2389
|
+
}
|
|
2390
|
+
if (t) {
|
|
2391
|
+
let { setEdges: e } = g();
|
|
2392
|
+
e(t), h({ hasDefaultEdges: !0 });
|
|
2393
|
+
}
|
|
2394
|
+
},
|
|
2395
|
+
updateNodeInternals: (e) => {
|
|
2396
|
+
let { triggerNodeChanges: t, nodeLookup: n, parentLookup: r, domNode: i, nodeOrigin: a, nodeExtent: o, debug: s, fitViewQueued: c, zIndexMode: l } = g(), { changes: u, updatedInternals: d } = updateNodeInternals(e, n, r, i, a, o, l);
|
|
2397
|
+
d && (updateAbsolutePositions(n, r, {
|
|
2398
|
+
nodeOrigin: a,
|
|
2399
|
+
nodeExtent: o,
|
|
2400
|
+
zIndexMode: l
|
|
2401
|
+
}), c ? (_(), h({
|
|
2402
|
+
fitViewQueued: !1,
|
|
2403
|
+
fitViewOptions: void 0
|
|
2404
|
+
})) : h({}), u?.length > 0 && (s && console.log("React Flow: trigger node changes", u), t?.(u)));
|
|
2405
|
+
},
|
|
2406
|
+
updateNodePositions: (e, t = !1) => {
|
|
2407
|
+
let n = [], r = [], { nodeLookup: i, triggerNodeChanges: o, connection: s, updateConnection: c, onNodesChangeMiddlewareMap: l } = g();
|
|
2408
|
+
for (let [o, l] of e) {
|
|
2409
|
+
let e = i.get(o), u = !!(e?.expandParent && e?.parentId && l?.position), d = {
|
|
2410
|
+
id: o,
|
|
2411
|
+
type: "position",
|
|
2412
|
+
position: u ? {
|
|
2413
|
+
x: Math.max(0, l.position.x),
|
|
2414
|
+
y: Math.max(0, l.position.y)
|
|
2415
|
+
} : l.position,
|
|
2416
|
+
dragging: t
|
|
2417
|
+
};
|
|
2418
|
+
if (e && s.inProgress && s.fromNode.id === e.id) {
|
|
2419
|
+
let t = getHandlePosition(e, s.fromHandle, Position.Left, !0);
|
|
2420
|
+
c({
|
|
2421
|
+
...s,
|
|
2422
|
+
from: t
|
|
2423
|
+
});
|
|
2424
|
+
}
|
|
2425
|
+
u && e.parentId && n.push({
|
|
2426
|
+
id: o,
|
|
2427
|
+
parentId: e.parentId,
|
|
2428
|
+
rect: {
|
|
2429
|
+
...l.internals.positionAbsolute,
|
|
2430
|
+
width: l.measured.width ?? 0,
|
|
2431
|
+
height: l.measured.height ?? 0
|
|
2432
|
+
}
|
|
2433
|
+
}), r.push(d);
|
|
2434
|
+
}
|
|
2435
|
+
if (n.length > 0) {
|
|
2436
|
+
let { parentLookup: e, nodeOrigin: t } = g(), a = handleExpandParent(n, i, e, t);
|
|
2437
|
+
r.push(...a);
|
|
2438
|
+
}
|
|
2439
|
+
for (let e of l.values()) r = e(r);
|
|
2440
|
+
o(r);
|
|
2441
|
+
},
|
|
2442
|
+
triggerNodeChanges: (e) => {
|
|
2443
|
+
let { onNodesChange: t, setNodes: n, nodes: r, hasDefaultNodes: i, debug: a } = g();
|
|
2444
|
+
e?.length && (i && n(applyNodeChanges(e, r)), a && console.log("React Flow: trigger node changes", e), t?.(e));
|
|
2445
|
+
},
|
|
2446
|
+
triggerEdgeChanges: (e) => {
|
|
2447
|
+
let { onEdgesChange: t, setEdges: n, edges: r, hasDefaultEdges: i, debug: a } = g();
|
|
2448
|
+
e?.length && (i && n(applyEdgeChanges(e, r)), a && console.log("React Flow: trigger edge changes", e), t?.(e));
|
|
2449
|
+
},
|
|
2450
|
+
addSelectedNodes: (e) => {
|
|
2451
|
+
let { multiSelectionActive: t, edgeLookup: n, nodeLookup: r, triggerNodeChanges: i, triggerEdgeChanges: a } = g();
|
|
2452
|
+
if (t) {
|
|
2453
|
+
i(e.map((e) => createSelectionChange(e, !0)));
|
|
2454
|
+
return;
|
|
2455
|
+
}
|
|
2456
|
+
i(getSelectionChanges(r, new Set([...e]), !0)), a(getSelectionChanges(n));
|
|
2457
|
+
},
|
|
2458
|
+
addSelectedEdges: (e) => {
|
|
2459
|
+
let { multiSelectionActive: t, edgeLookup: n, nodeLookup: r, triggerNodeChanges: i, triggerEdgeChanges: a } = g();
|
|
2460
|
+
if (t) {
|
|
2461
|
+
a(e.map((e) => createSelectionChange(e, !0)));
|
|
2462
|
+
return;
|
|
2463
|
+
}
|
|
2464
|
+
a(getSelectionChanges(n, new Set([...e]))), i(getSelectionChanges(r, /* @__PURE__ */ new Set(), !0));
|
|
2465
|
+
},
|
|
2466
|
+
unselectNodesAndEdges: ({ nodes: e, edges: t } = {}) => {
|
|
2467
|
+
let { edges: n, nodes: r, nodeLookup: i, triggerNodeChanges: a, triggerEdgeChanges: o } = g(), s = e || r, c = t || n, l = [];
|
|
2468
|
+
for (let e of s) {
|
|
2469
|
+
if (!e.selected) continue;
|
|
2470
|
+
let t = i.get(e.id);
|
|
2471
|
+
t && (t.selected = !1), l.push(createSelectionChange(e.id, !1));
|
|
2472
|
+
}
|
|
2473
|
+
let u = [];
|
|
2474
|
+
for (let e of c) e.selected && u.push(createSelectionChange(e.id, !1));
|
|
2475
|
+
a(l), o(u);
|
|
2476
|
+
},
|
|
2477
|
+
setMinZoom: (e) => {
|
|
2478
|
+
let { panZoom: t, maxZoom: n } = g();
|
|
2479
|
+
t?.setScaleExtent([e, n]), h({ minZoom: e });
|
|
2480
|
+
},
|
|
2481
|
+
setMaxZoom: (e) => {
|
|
2482
|
+
let { panZoom: t, minZoom: n } = g();
|
|
2483
|
+
t?.setScaleExtent([n, e]), h({ maxZoom: e });
|
|
2484
|
+
},
|
|
2485
|
+
setTranslateExtent: (e) => {
|
|
2486
|
+
g().panZoom?.setTranslateExtent(e), h({ translateExtent: e });
|
|
2487
|
+
},
|
|
2488
|
+
resetSelectedElements: () => {
|
|
2489
|
+
let { edges: e, nodes: t, triggerNodeChanges: n, triggerEdgeChanges: r, elementsSelectable: i } = g();
|
|
2490
|
+
if (!i) return;
|
|
2491
|
+
let a = t.reduce((e, t) => t.selected ? [...e, createSelectionChange(t.id, !1)] : e, []), o = e.reduce((e, t) => t.selected ? [...e, createSelectionChange(t.id, !1)] : e, []);
|
|
2492
|
+
n(a), r(o);
|
|
2493
|
+
},
|
|
2494
|
+
setNodeExtent: (e) => {
|
|
2495
|
+
let { nodes: t, nodeLookup: n, parentLookup: r, nodeOrigin: i, elevateNodesOnSelect: a, nodeExtent: o, zIndexMode: s } = g();
|
|
2496
|
+
e[0][0] === o[0][0] && e[0][1] === o[0][1] && e[1][0] === o[1][0] && e[1][1] === o[1][1] || (adoptUserNodes(t, n, r, {
|
|
2497
|
+
nodeOrigin: i,
|
|
2498
|
+
nodeExtent: e,
|
|
2499
|
+
elevateNodesOnSelect: a,
|
|
2500
|
+
checkEquality: !1,
|
|
2501
|
+
zIndexMode: s
|
|
2502
|
+
}), h({ nodeExtent: e }));
|
|
2503
|
+
},
|
|
2504
|
+
panBy: (e) => {
|
|
2505
|
+
let { transform: t, width: n, height: r, panZoom: i, translateExtent: a } = g();
|
|
2506
|
+
return panBy({
|
|
2507
|
+
delta: e,
|
|
2508
|
+
panZoom: i,
|
|
2509
|
+
transform: t,
|
|
2510
|
+
translateExtent: a,
|
|
2511
|
+
width: n,
|
|
2512
|
+
height: r
|
|
2513
|
+
});
|
|
2514
|
+
},
|
|
2515
|
+
setCenter: async (e, t, n) => {
|
|
2516
|
+
let { width: r, height: i, maxZoom: a, panZoom: o } = g();
|
|
2517
|
+
if (!o) return Promise.resolve(!1);
|
|
2518
|
+
let s = n?.zoom === void 0 ? a : n.zoom;
|
|
2519
|
+
return await o.setViewport({
|
|
2520
|
+
x: r / 2 - e * s,
|
|
2521
|
+
y: i / 2 - t * s,
|
|
2522
|
+
zoom: s
|
|
2523
|
+
}, {
|
|
2524
|
+
duration: n?.duration,
|
|
2525
|
+
ease: n?.ease,
|
|
2526
|
+
interpolate: n?.interpolate
|
|
2527
|
+
}), Promise.resolve(!0);
|
|
2528
|
+
},
|
|
2529
|
+
cancelConnection: () => {
|
|
2530
|
+
h({ connection: { ...initialConnection } });
|
|
2531
|
+
},
|
|
2532
|
+
updateConnection: (e) => {
|
|
2533
|
+
h({ connection: e });
|
|
2534
|
+
},
|
|
2535
|
+
reset: () => h({ ...getInitialState() })
|
|
2536
|
+
};
|
|
2537
|
+
}, Object.is);
|
|
2538
|
+
function ReactFlowProvider({ initialNodes: e, initialEdges: t, defaultNodes: n, defaultEdges: r, initialWidth: i, initialHeight: a, initialMinZoom: o, initialMaxZoom: s, initialFitViewOptions: c, fitView: l, nodeOrigin: u, nodeExtent: d, zIndexMode: f, children: p }) {
|
|
2539
|
+
let [m] = useState(() => createStore({
|
|
2540
|
+
nodes: e,
|
|
2541
|
+
edges: t,
|
|
2542
|
+
defaultNodes: n,
|
|
2543
|
+
defaultEdges: r,
|
|
2544
|
+
width: i,
|
|
2545
|
+
height: a,
|
|
2546
|
+
fitView: l,
|
|
2547
|
+
minZoom: o,
|
|
2548
|
+
maxZoom: s,
|
|
2549
|
+
fitViewOptions: c,
|
|
2550
|
+
nodeOrigin: u,
|
|
2551
|
+
nodeExtent: d,
|
|
2552
|
+
zIndexMode: f
|
|
2553
|
+
}));
|
|
2554
|
+
return jsx(Provider$1, {
|
|
2555
|
+
value: m,
|
|
2556
|
+
children: jsx(BatchProvider, { children: p })
|
|
2557
|
+
});
|
|
2558
|
+
}
|
|
2559
|
+
function Wrapper({ children: e, nodes: t, edges: n, defaultNodes: r, defaultEdges: i, width: a, height: o, fitView: s, fitViewOptions: c, minZoom: l, maxZoom: u, nodeOrigin: d, nodeExtent: f, zIndexMode: p }) {
|
|
2560
|
+
return useContext(StoreContext) ? jsx(Fragment$1, { children: e }) : jsx(ReactFlowProvider, {
|
|
2561
|
+
initialNodes: t,
|
|
2562
|
+
initialEdges: n,
|
|
2563
|
+
defaultNodes: r,
|
|
2564
|
+
defaultEdges: i,
|
|
2565
|
+
initialWidth: a,
|
|
2566
|
+
initialHeight: o,
|
|
2567
|
+
fitView: s,
|
|
2568
|
+
initialFitViewOptions: c,
|
|
2569
|
+
initialMinZoom: l,
|
|
2570
|
+
initialMaxZoom: u,
|
|
2571
|
+
nodeOrigin: d,
|
|
2572
|
+
nodeExtent: f,
|
|
2573
|
+
zIndexMode: p,
|
|
2574
|
+
children: e
|
|
2575
|
+
});
|
|
2576
|
+
}
|
|
2577
|
+
var wrapperStyle = {
|
|
2578
|
+
width: "100%",
|
|
2579
|
+
height: "100%",
|
|
2580
|
+
overflow: "hidden",
|
|
2581
|
+
position: "relative",
|
|
2582
|
+
zIndex: 0
|
|
2583
|
+
};
|
|
2584
|
+
function ReactFlow({ nodes: n, edges: r, defaultNodes: a, defaultEdges: o, className: c, nodeTypes: l, edgeTypes: u, onNodeClick: d, onEdgeClick: f, onInit: p, onMove: m, onMoveStart: h, onMoveEnd: g, onConnect: _, onConnectStart: v, onConnectEnd: y, onClickConnectStart: b, onClickConnectEnd: x, onNodeMouseEnter: S, onNodeMouseMove: C, onNodeMouseLeave: w, onNodeContextMenu: T, onNodeDoubleClick: E, onNodeDragStart: D, onNodeDrag: O, onNodeDragStop: k, onNodesDelete: A, onEdgesDelete: j, onDelete: M, onSelectionChange: N, onSelectionDragStart: P, onSelectionDrag: F, onSelectionDragStop: I, onSelectionContextMenu: L, onSelectionStart: R, onSelectionEnd: z, onBeforeDelete: B, connectionMode: V, connectionLineType: H = ConnectionLineType.Bezier, connectionLineStyle: U, connectionLineComponent: W, connectionLineContainerStyle: G, deleteKeyCode: K = "Backspace", selectionKeyCode: J = "Shift", selectionOnDrag: Y = !1, selectionMode: X = SelectionMode.Full, panActivationKeyCode: Z = "Space", multiSelectionKeyCode: Hn = isMacOs() ? "Meta" : "Control", zoomActivationKeyCode: Un = isMacOs() ? "Meta" : "Control", snapToGrid: Wn, snapGrid: Gn, onlyRenderVisibleElements: Kn = !1, selectNodesOnDrag: Q, nodesDraggable: $, autoPanOnNodeFocus: qn, nodesConnectable: Jn, nodesFocusable: Yn, nodeOrigin: Xn = defaultNodeOrigin, edgesFocusable: Zn, edgesReconnectable: Qn, elementsSelectable: $n = !0, defaultViewport: er = defaultViewport, minZoom: tr = .5, maxZoom: nr = 2, translateExtent: rr = infiniteExtent, preventScrolling: ir = !0, nodeExtent: ar, defaultMarkerColor: or = "#b1b1b7", zoomOnScroll: sr = !0, zoomOnPinch: cr = !0, panOnScroll: lr = !1, panOnScrollSpeed: ur = .5, panOnScrollMode: dr = PanOnScrollMode.Free, zoomOnDoubleClick: fr = !0, panOnDrag: pr = !0, onPaneClick: mr, onPaneMouseEnter: hr, onPaneMouseMove: gr, onPaneMouseLeave: _r, onPaneScroll: vr, onPaneContextMenu: yr, paneClickDistance: br = 1, nodeClickDistance: xr = 0, children: Sr, onReconnect: Cr, onReconnectStart: wr, onReconnectEnd: Tr, onEdgeContextMenu: Er, onEdgeDoubleClick: Dr, onEdgeMouseEnter: Or, onEdgeMouseMove: kr, onEdgeMouseLeave: Ar, reconnectRadius: jr = 10, onNodesChange: Mr, onEdgesChange: Nr, noDragClassName: Pr = "nodrag", noWheelClassName: Fr = "nowheel", noPanClassName: Ir = "nopan", fitView: Lr, fitViewOptions: Rr, connectOnClick: zr, attributionPosition: Br, proOptions: Vr, defaultEdgeOptions: Hr, elevateNodesOnSelect: Ur = !0, elevateEdgesOnSelect: Wr = !1, disableKeyboardA11y: Gr = !1, autoPanOnConnect: Kr, autoPanOnNodeDrag: qr, autoPanSpeed: Jr, connectionRadius: Yr, isValidConnection: Xr, onError: Zr, style: Qr, id: $r, nodeDragThreshold: ei, connectionDragThreshold: ti, viewport: ni, onViewportChange: ri, width: ii, height: ai, colorMode: oi = "light", debug: si, onScroll: ci, ariaLabelConfig: li, zIndexMode: ui = "basic", ...di }, fi) {
|
|
2585
|
+
let pi = $r || "1", mi = useColorModeClass(oi), hi = useCallback((e) => {
|
|
2586
|
+
e.currentTarget.scrollTo({
|
|
2587
|
+
top: 0,
|
|
2588
|
+
left: 0,
|
|
2589
|
+
behavior: "instant"
|
|
2590
|
+
}), ci?.(e);
|
|
2591
|
+
}, [ci]);
|
|
2592
|
+
return jsx("div", {
|
|
2593
|
+
"data-testid": "rf__wrapper",
|
|
2594
|
+
...di,
|
|
2595
|
+
onScroll: hi,
|
|
2596
|
+
style: {
|
|
2597
|
+
...Qr,
|
|
2598
|
+
...wrapperStyle
|
|
2599
|
+
},
|
|
2600
|
+
ref: fi,
|
|
2601
|
+
className: cc([
|
|
2602
|
+
"react-flow",
|
|
2603
|
+
c,
|
|
2604
|
+
mi
|
|
2605
|
+
]),
|
|
2606
|
+
id: $r,
|
|
2607
|
+
role: "application",
|
|
2608
|
+
children: jsxs(Wrapper, {
|
|
2609
|
+
nodes: n,
|
|
2610
|
+
edges: r,
|
|
2611
|
+
width: ii,
|
|
2612
|
+
height: ai,
|
|
2613
|
+
fitView: Lr,
|
|
2614
|
+
fitViewOptions: Rr,
|
|
2615
|
+
minZoom: tr,
|
|
2616
|
+
maxZoom: nr,
|
|
2617
|
+
nodeOrigin: Xn,
|
|
2618
|
+
nodeExtent: ar,
|
|
2619
|
+
zIndexMode: ui,
|
|
2620
|
+
children: [
|
|
2621
|
+
jsx(GraphView, {
|
|
2622
|
+
onInit: p,
|
|
2623
|
+
onNodeClick: d,
|
|
2624
|
+
onEdgeClick: f,
|
|
2625
|
+
onNodeMouseEnter: S,
|
|
2626
|
+
onNodeMouseMove: C,
|
|
2627
|
+
onNodeMouseLeave: w,
|
|
2628
|
+
onNodeContextMenu: T,
|
|
2629
|
+
onNodeDoubleClick: E,
|
|
2630
|
+
nodeTypes: l,
|
|
2631
|
+
edgeTypes: u,
|
|
2632
|
+
connectionLineType: H,
|
|
2633
|
+
connectionLineStyle: U,
|
|
2634
|
+
connectionLineComponent: W,
|
|
2635
|
+
connectionLineContainerStyle: G,
|
|
2636
|
+
selectionKeyCode: J,
|
|
2637
|
+
selectionOnDrag: Y,
|
|
2638
|
+
selectionMode: X,
|
|
2639
|
+
deleteKeyCode: K,
|
|
2640
|
+
multiSelectionKeyCode: Hn,
|
|
2641
|
+
panActivationKeyCode: Z,
|
|
2642
|
+
zoomActivationKeyCode: Un,
|
|
2643
|
+
onlyRenderVisibleElements: Kn,
|
|
2644
|
+
defaultViewport: er,
|
|
2645
|
+
translateExtent: rr,
|
|
2646
|
+
minZoom: tr,
|
|
2647
|
+
maxZoom: nr,
|
|
2648
|
+
preventScrolling: ir,
|
|
2649
|
+
zoomOnScroll: sr,
|
|
2650
|
+
zoomOnPinch: cr,
|
|
2651
|
+
zoomOnDoubleClick: fr,
|
|
2652
|
+
panOnScroll: lr,
|
|
2653
|
+
panOnScrollSpeed: ur,
|
|
2654
|
+
panOnScrollMode: dr,
|
|
2655
|
+
panOnDrag: pr,
|
|
2656
|
+
onPaneClick: mr,
|
|
2657
|
+
onPaneMouseEnter: hr,
|
|
2658
|
+
onPaneMouseMove: gr,
|
|
2659
|
+
onPaneMouseLeave: _r,
|
|
2660
|
+
onPaneScroll: vr,
|
|
2661
|
+
onPaneContextMenu: yr,
|
|
2662
|
+
paneClickDistance: br,
|
|
2663
|
+
nodeClickDistance: xr,
|
|
2664
|
+
onSelectionContextMenu: L,
|
|
2665
|
+
onSelectionStart: R,
|
|
2666
|
+
onSelectionEnd: z,
|
|
2667
|
+
onReconnect: Cr,
|
|
2668
|
+
onReconnectStart: wr,
|
|
2669
|
+
onReconnectEnd: Tr,
|
|
2670
|
+
onEdgeContextMenu: Er,
|
|
2671
|
+
onEdgeDoubleClick: Dr,
|
|
2672
|
+
onEdgeMouseEnter: Or,
|
|
2673
|
+
onEdgeMouseMove: kr,
|
|
2674
|
+
onEdgeMouseLeave: Ar,
|
|
2675
|
+
reconnectRadius: jr,
|
|
2676
|
+
defaultMarkerColor: or,
|
|
2677
|
+
noDragClassName: Pr,
|
|
2678
|
+
noWheelClassName: Fr,
|
|
2679
|
+
noPanClassName: Ir,
|
|
2680
|
+
rfId: pi,
|
|
2681
|
+
disableKeyboardA11y: Gr,
|
|
2682
|
+
nodeExtent: ar,
|
|
2683
|
+
viewport: ni,
|
|
2684
|
+
onViewportChange: ri
|
|
2685
|
+
}),
|
|
2686
|
+
jsx(StoreUpdater, {
|
|
2687
|
+
nodes: n,
|
|
2688
|
+
edges: r,
|
|
2689
|
+
defaultNodes: a,
|
|
2690
|
+
defaultEdges: o,
|
|
2691
|
+
onConnect: _,
|
|
2692
|
+
onConnectStart: v,
|
|
2693
|
+
onConnectEnd: y,
|
|
2694
|
+
onClickConnectStart: b,
|
|
2695
|
+
onClickConnectEnd: x,
|
|
2696
|
+
nodesDraggable: $,
|
|
2697
|
+
autoPanOnNodeFocus: qn,
|
|
2698
|
+
nodesConnectable: Jn,
|
|
2699
|
+
nodesFocusable: Yn,
|
|
2700
|
+
edgesFocusable: Zn,
|
|
2701
|
+
edgesReconnectable: Qn,
|
|
2702
|
+
elementsSelectable: $n,
|
|
2703
|
+
elevateNodesOnSelect: Ur,
|
|
2704
|
+
elevateEdgesOnSelect: Wr,
|
|
2705
|
+
minZoom: tr,
|
|
2706
|
+
maxZoom: nr,
|
|
2707
|
+
nodeExtent: ar,
|
|
2708
|
+
onNodesChange: Mr,
|
|
2709
|
+
onEdgesChange: Nr,
|
|
2710
|
+
snapToGrid: Wn,
|
|
2711
|
+
snapGrid: Gn,
|
|
2712
|
+
connectionMode: V,
|
|
2713
|
+
translateExtent: rr,
|
|
2714
|
+
connectOnClick: zr,
|
|
2715
|
+
defaultEdgeOptions: Hr,
|
|
2716
|
+
fitView: Lr,
|
|
2717
|
+
fitViewOptions: Rr,
|
|
2718
|
+
onNodesDelete: A,
|
|
2719
|
+
onEdgesDelete: j,
|
|
2720
|
+
onDelete: M,
|
|
2721
|
+
onNodeDragStart: D,
|
|
2722
|
+
onNodeDrag: O,
|
|
2723
|
+
onNodeDragStop: k,
|
|
2724
|
+
onSelectionDrag: F,
|
|
2725
|
+
onSelectionDragStart: P,
|
|
2726
|
+
onSelectionDragStop: I,
|
|
2727
|
+
onMove: m,
|
|
2728
|
+
onMoveStart: h,
|
|
2729
|
+
onMoveEnd: g,
|
|
2730
|
+
noPanClassName: Ir,
|
|
2731
|
+
nodeOrigin: Xn,
|
|
2732
|
+
rfId: pi,
|
|
2733
|
+
autoPanOnConnect: Kr,
|
|
2734
|
+
autoPanOnNodeDrag: qr,
|
|
2735
|
+
autoPanSpeed: Jr,
|
|
2736
|
+
onError: Zr,
|
|
2737
|
+
connectionRadius: Yr,
|
|
2738
|
+
isValidConnection: Xr,
|
|
2739
|
+
selectNodesOnDrag: Q,
|
|
2740
|
+
nodeDragThreshold: ei,
|
|
2741
|
+
connectionDragThreshold: ti,
|
|
2742
|
+
onBeforeDelete: B,
|
|
2743
|
+
debug: si,
|
|
2744
|
+
ariaLabelConfig: li,
|
|
2745
|
+
zIndexMode: ui
|
|
2746
|
+
}),
|
|
2747
|
+
jsx(SelectionListener, { onSelectionChange: N }),
|
|
2748
|
+
Sr,
|
|
2749
|
+
jsx(Attribution, {
|
|
2750
|
+
proOptions: Vr,
|
|
2751
|
+
position: Br
|
|
2752
|
+
}),
|
|
2753
|
+
jsx(A11yDescriptions, {
|
|
2754
|
+
rfId: pi,
|
|
2755
|
+
disableKeyboardA11y: Gr
|
|
2756
|
+
})
|
|
2757
|
+
]
|
|
2758
|
+
})
|
|
2759
|
+
});
|
|
2760
|
+
}
|
|
2761
|
+
var index = fixedForwardRef(ReactFlow), selector$6 = (e) => e.domNode?.querySelector(".react-flow__edgelabel-renderer");
|
|
2762
|
+
function EdgeLabelRenderer({ children: e }) {
|
|
2763
|
+
let t = useStore(selector$6);
|
|
2764
|
+
return t ? createPortal(e, t) : null;
|
|
2765
|
+
}
|
|
2766
|
+
function useNodesState(e) {
|
|
2767
|
+
let [t, n] = useState(e);
|
|
2768
|
+
return [
|
|
2769
|
+
t,
|
|
2770
|
+
n,
|
|
2771
|
+
useCallback((e) => n((t) => applyNodeChanges(e, t)), [])
|
|
2772
|
+
];
|
|
2773
|
+
}
|
|
2774
|
+
function useEdgesState(e) {
|
|
2775
|
+
let [t, n] = useState(e);
|
|
2776
|
+
return [
|
|
2777
|
+
t,
|
|
2778
|
+
n,
|
|
2779
|
+
useCallback((e) => n((t) => applyEdgeChanges(e, t)), [])
|
|
2780
|
+
];
|
|
2781
|
+
}
|
|
2782
|
+
errorMessages.error014();
|
|
2783
|
+
function LinePattern({ dimensions: t, lineWidth: n, variant: r, className: i }) {
|
|
2784
|
+
return jsx("path", {
|
|
2785
|
+
strokeWidth: n,
|
|
2786
|
+
d: `M${t[0] / 2} 0 V${t[1]} M0 ${t[1] / 2} H${t[0]}`,
|
|
2787
|
+
className: cc([
|
|
2788
|
+
"react-flow__background-pattern",
|
|
2789
|
+
r,
|
|
2790
|
+
i
|
|
2791
|
+
])
|
|
2792
|
+
});
|
|
2793
|
+
}
|
|
2794
|
+
function DotPattern({ radius: t, className: n }) {
|
|
2795
|
+
return jsx("circle", {
|
|
2796
|
+
cx: t,
|
|
2797
|
+
cy: t,
|
|
2798
|
+
r: t,
|
|
2799
|
+
className: cc([
|
|
2800
|
+
"react-flow__background-pattern",
|
|
2801
|
+
"dots",
|
|
2802
|
+
n
|
|
2803
|
+
])
|
|
2804
|
+
});
|
|
2805
|
+
}
|
|
2806
|
+
var BackgroundVariant;
|
|
2807
|
+
(function(e) {
|
|
2808
|
+
e.Lines = "lines", e.Dots = "dots", e.Cross = "cross";
|
|
2809
|
+
})(BackgroundVariant ||= {});
|
|
2810
|
+
var defaultSize = {
|
|
2811
|
+
[BackgroundVariant.Dots]: 1,
|
|
2812
|
+
[BackgroundVariant.Lines]: 1,
|
|
2813
|
+
[BackgroundVariant.Cross]: 6
|
|
2814
|
+
}, selector$3 = (e) => ({
|
|
2815
|
+
transform: e.transform,
|
|
2816
|
+
patternId: `pattern-${e.rfId}`
|
|
2817
|
+
});
|
|
2818
|
+
function BackgroundComponent({ id: t, variant: n = BackgroundVariant.Dots, gap: r = 20, size: i, lineWidth: a = 1, offset: o = 0, color: s, bgColor: c, style: l, className: u, patternClassName: d }) {
|
|
2819
|
+
let f = useRef(null), { transform: p, patternId: m } = useStore(selector$3, shallow), h = i || defaultSize[n], g = n === BackgroundVariant.Dots, _ = n === BackgroundVariant.Cross, v = Array.isArray(r) ? r : [r, r], y = [v[0] * p[2] || 1, v[1] * p[2] || 1], b = h * p[2], x = Array.isArray(o) ? o : [o, o], S = _ ? [b, b] : y, C = [x[0] * p[2] || 1 + S[0] / 2, x[1] * p[2] || 1 + S[1] / 2], w = `${m}${t || ""}`;
|
|
2820
|
+
return jsxs("svg", {
|
|
2821
|
+
className: cc(["react-flow__background", u]),
|
|
2822
|
+
style: {
|
|
2823
|
+
...l,
|
|
2824
|
+
...containerStyle,
|
|
2825
|
+
"--xy-background-color-props": c,
|
|
2826
|
+
"--xy-background-pattern-color-props": s
|
|
2827
|
+
},
|
|
2828
|
+
ref: f,
|
|
2829
|
+
"data-testid": "rf__background",
|
|
2830
|
+
children: [jsx("pattern", {
|
|
2831
|
+
id: w,
|
|
2832
|
+
x: p[0] % y[0],
|
|
2833
|
+
y: p[1] % y[1],
|
|
2834
|
+
width: y[0],
|
|
2835
|
+
height: y[1],
|
|
2836
|
+
patternUnits: "userSpaceOnUse",
|
|
2837
|
+
patternTransform: `translate(-${C[0]},-${C[1]})`,
|
|
2838
|
+
children: g ? jsx(DotPattern, {
|
|
2839
|
+
radius: b / 2,
|
|
2840
|
+
className: d
|
|
2841
|
+
}) : jsx(LinePattern, {
|
|
2842
|
+
dimensions: S,
|
|
2843
|
+
lineWidth: a,
|
|
2844
|
+
variant: n,
|
|
2845
|
+
className: d
|
|
2846
|
+
})
|
|
2847
|
+
}), jsx("rect", {
|
|
2848
|
+
x: "0",
|
|
2849
|
+
y: "0",
|
|
2850
|
+
width: "100%",
|
|
2851
|
+
height: "100%",
|
|
2852
|
+
fill: `url(#${w})`
|
|
2853
|
+
})]
|
|
2854
|
+
});
|
|
2855
|
+
}
|
|
2856
|
+
BackgroundComponent.displayName = "Background";
|
|
2857
|
+
var Background = memo(BackgroundComponent);
|
|
2858
|
+
function PlusIcon() {
|
|
2859
|
+
return jsx("svg", {
|
|
2860
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2861
|
+
viewBox: "0 0 32 32",
|
|
2862
|
+
children: jsx("path", { d: "M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z" })
|
|
2863
|
+
});
|
|
2864
|
+
}
|
|
2865
|
+
function MinusIcon() {
|
|
2866
|
+
return jsx("svg", {
|
|
2867
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2868
|
+
viewBox: "0 0 32 5",
|
|
2869
|
+
children: jsx("path", { d: "M0 0h32v4.2H0z" })
|
|
2870
|
+
});
|
|
2871
|
+
}
|
|
2872
|
+
function FitViewIcon() {
|
|
2873
|
+
return jsx("svg", {
|
|
2874
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2875
|
+
viewBox: "0 0 32 30",
|
|
2876
|
+
children: jsx("path", { d: "M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z" })
|
|
2877
|
+
});
|
|
2878
|
+
}
|
|
2879
|
+
function LockIcon() {
|
|
2880
|
+
return jsx("svg", {
|
|
2881
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2882
|
+
viewBox: "0 0 25 32",
|
|
2883
|
+
children: jsx("path", { d: "M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z" })
|
|
2884
|
+
});
|
|
2885
|
+
}
|
|
2886
|
+
function UnlockIcon() {
|
|
2887
|
+
return jsx("svg", {
|
|
2888
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2889
|
+
viewBox: "0 0 25 32",
|
|
2890
|
+
children: jsx("path", { d: "M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z" })
|
|
2891
|
+
});
|
|
2892
|
+
}
|
|
2893
|
+
function ControlButton({ children: t, className: n, ...r }) {
|
|
2894
|
+
return jsx("button", {
|
|
2895
|
+
type: "button",
|
|
2896
|
+
className: cc(["react-flow__controls-button", n]),
|
|
2897
|
+
...r,
|
|
2898
|
+
children: t
|
|
2899
|
+
});
|
|
2900
|
+
}
|
|
2901
|
+
var selector$2 = (e) => ({
|
|
2902
|
+
isInteractive: e.nodesDraggable || e.nodesConnectable || e.elementsSelectable,
|
|
2903
|
+
minZoomReached: e.transform[2] <= e.minZoom,
|
|
2904
|
+
maxZoomReached: e.transform[2] >= e.maxZoom,
|
|
2905
|
+
ariaLabelConfig: e.ariaLabelConfig
|
|
2906
|
+
});
|
|
2907
|
+
function ControlsComponent({ style: t, showZoom: n = !0, showFitView: r = !0, showInteractive: i = !0, fitViewOptions: a, onZoomIn: o, onZoomOut: s, onFitView: c, onInteractiveChange: l, className: u, children: d, position: f = "bottom-left", orientation: p = "vertical", "aria-label": m }) {
|
|
2908
|
+
let h = useStoreApi(), { isInteractive: g, minZoomReached: _, maxZoomReached: v, ariaLabelConfig: y } = useStore(selector$2, shallow), { zoomIn: b, zoomOut: x, fitView: S } = useReactFlow(), C = () => {
|
|
2909
|
+
b(), o?.();
|
|
2910
|
+
}, w = () => {
|
|
2911
|
+
x(), s?.();
|
|
2912
|
+
}, T = () => {
|
|
2913
|
+
S(a), c?.();
|
|
2914
|
+
}, E = () => {
|
|
2915
|
+
h.setState({
|
|
2916
|
+
nodesDraggable: !g,
|
|
2917
|
+
nodesConnectable: !g,
|
|
2918
|
+
elementsSelectable: !g
|
|
2919
|
+
}), l?.(!g);
|
|
2920
|
+
};
|
|
2921
|
+
return jsxs(Panel, {
|
|
2922
|
+
className: cc([
|
|
2923
|
+
"react-flow__controls",
|
|
2924
|
+
p === "horizontal" ? "horizontal" : "vertical",
|
|
2925
|
+
u
|
|
2926
|
+
]),
|
|
2927
|
+
position: f,
|
|
2928
|
+
style: t,
|
|
2929
|
+
"data-testid": "rf__controls",
|
|
2930
|
+
"aria-label": m ?? y["controls.ariaLabel"],
|
|
2931
|
+
children: [
|
|
2932
|
+
n && jsxs(Fragment$1, { children: [jsx(ControlButton, {
|
|
2933
|
+
onClick: C,
|
|
2934
|
+
className: "react-flow__controls-zoomin",
|
|
2935
|
+
title: y["controls.zoomIn.ariaLabel"],
|
|
2936
|
+
"aria-label": y["controls.zoomIn.ariaLabel"],
|
|
2937
|
+
disabled: v,
|
|
2938
|
+
children: jsx(PlusIcon, {})
|
|
2939
|
+
}), jsx(ControlButton, {
|
|
2940
|
+
onClick: w,
|
|
2941
|
+
className: "react-flow__controls-zoomout",
|
|
2942
|
+
title: y["controls.zoomOut.ariaLabel"],
|
|
2943
|
+
"aria-label": y["controls.zoomOut.ariaLabel"],
|
|
2944
|
+
disabled: _,
|
|
2945
|
+
children: jsx(MinusIcon, {})
|
|
2946
|
+
})] }),
|
|
2947
|
+
r && jsx(ControlButton, {
|
|
2948
|
+
className: "react-flow__controls-fitview",
|
|
2949
|
+
onClick: T,
|
|
2950
|
+
title: y["controls.fitView.ariaLabel"],
|
|
2951
|
+
"aria-label": y["controls.fitView.ariaLabel"],
|
|
2952
|
+
children: jsx(FitViewIcon, {})
|
|
2953
|
+
}),
|
|
2954
|
+
i && jsx(ControlButton, {
|
|
2955
|
+
className: "react-flow__controls-interactive",
|
|
2956
|
+
onClick: E,
|
|
2957
|
+
title: y["controls.interactive.ariaLabel"],
|
|
2958
|
+
"aria-label": y["controls.interactive.ariaLabel"],
|
|
2959
|
+
children: jsx(g ? UnlockIcon : LockIcon, {})
|
|
2960
|
+
}),
|
|
2961
|
+
d
|
|
2962
|
+
]
|
|
2963
|
+
});
|
|
2964
|
+
}
|
|
2965
|
+
ControlsComponent.displayName = "Controls";
|
|
2966
|
+
var Controls = memo(ControlsComponent);
|
|
2967
|
+
function MiniMapNodeComponent({ id: t, x: n, y: r, width: i, height: a, style: o, color: s, strokeColor: c, strokeWidth: l, className: u, borderRadius: d, shapeRendering: f, selected: p, onClick: m }) {
|
|
2968
|
+
let { background: h, backgroundColor: g } = o || {}, _ = s || h || g;
|
|
2969
|
+
return jsx("rect", {
|
|
2970
|
+
className: cc([
|
|
2971
|
+
"react-flow__minimap-node",
|
|
2972
|
+
{ selected: p },
|
|
2973
|
+
u
|
|
2974
|
+
]),
|
|
2975
|
+
x: n,
|
|
2976
|
+
y: r,
|
|
2977
|
+
rx: d,
|
|
2978
|
+
ry: d,
|
|
2979
|
+
width: i,
|
|
2980
|
+
height: a,
|
|
2981
|
+
style: {
|
|
2982
|
+
fill: _,
|
|
2983
|
+
stroke: c,
|
|
2984
|
+
strokeWidth: l
|
|
2985
|
+
},
|
|
2986
|
+
shapeRendering: f,
|
|
2987
|
+
onClick: m ? (e) => m(e, t) : void 0
|
|
2988
|
+
});
|
|
2989
|
+
}
|
|
2990
|
+
var MiniMapNode = memo(MiniMapNodeComponent), selectorNodeIds = (e) => e.nodes.map((e) => e.id), getAttrFunction = (e) => e instanceof Function ? e : () => e;
|
|
2991
|
+
function MiniMapNodes({ nodeStrokeColor: e, nodeColor: t, nodeClassName: n = "", nodeBorderRadius: r = 5, nodeStrokeWidth: i, nodeComponent: a = MiniMapNode, onClick: o }) {
|
|
2992
|
+
let s = useStore(selectorNodeIds, shallow), c = getAttrFunction(t), l = getAttrFunction(e), u = getAttrFunction(n), d = typeof window > "u" || window.chrome ? "crispEdges" : "geometricPrecision";
|
|
2993
|
+
return jsx(Fragment$1, { children: s.map((e) => jsx(NodeComponentWrapper, {
|
|
2994
|
+
id: e,
|
|
2995
|
+
nodeColorFunc: c,
|
|
2996
|
+
nodeStrokeColorFunc: l,
|
|
2997
|
+
nodeClassNameFunc: u,
|
|
2998
|
+
nodeBorderRadius: r,
|
|
2999
|
+
nodeStrokeWidth: i,
|
|
3000
|
+
NodeComponent: a,
|
|
3001
|
+
onClick: o,
|
|
3002
|
+
shapeRendering: d
|
|
3003
|
+
}, e)) });
|
|
3004
|
+
}
|
|
3005
|
+
function NodeComponentWrapperInner({ id: e, nodeColorFunc: t, nodeStrokeColorFunc: n, nodeClassNameFunc: r, nodeBorderRadius: i, nodeStrokeWidth: a, shapeRendering: o, NodeComponent: s, onClick: c }) {
|
|
3006
|
+
let { node: l, x: u, y: d, width: f, height: p } = useStore((t) => {
|
|
3007
|
+
let n = t.nodeLookup.get(e);
|
|
3008
|
+
if (!n) return {
|
|
3009
|
+
node: void 0,
|
|
3010
|
+
x: 0,
|
|
3011
|
+
y: 0,
|
|
3012
|
+
width: 0,
|
|
3013
|
+
height: 0
|
|
3014
|
+
};
|
|
3015
|
+
let r = n.internals.userNode, { x: i, y: a } = n.internals.positionAbsolute, { width: o, height: s } = getNodeDimensions(r);
|
|
3016
|
+
return {
|
|
3017
|
+
node: r,
|
|
3018
|
+
x: i,
|
|
3019
|
+
y: a,
|
|
3020
|
+
width: o,
|
|
3021
|
+
height: s
|
|
3022
|
+
};
|
|
3023
|
+
}, shallow);
|
|
3024
|
+
return !l || l.hidden || !nodeHasDimensions(l) ? null : jsx(s, {
|
|
3025
|
+
x: u,
|
|
3026
|
+
y: d,
|
|
3027
|
+
width: f,
|
|
3028
|
+
height: p,
|
|
3029
|
+
style: l.style,
|
|
3030
|
+
selected: !!l.selected,
|
|
3031
|
+
className: r(l),
|
|
3032
|
+
color: t(l),
|
|
3033
|
+
borderRadius: i,
|
|
3034
|
+
strokeColor: n(l),
|
|
3035
|
+
strokeWidth: a,
|
|
3036
|
+
shapeRendering: o,
|
|
3037
|
+
onClick: c,
|
|
3038
|
+
id: l.id
|
|
3039
|
+
});
|
|
3040
|
+
}
|
|
3041
|
+
var NodeComponentWrapper = memo(NodeComponentWrapperInner), MiniMapNodes$1 = memo(MiniMapNodes), defaultWidth = 200, defaultHeight = 150, filterHidden = (e) => !e.hidden, selector$1 = (e) => {
|
|
3042
|
+
let t = {
|
|
3043
|
+
x: -e.transform[0] / e.transform[2],
|
|
3044
|
+
y: -e.transform[1] / e.transform[2],
|
|
3045
|
+
width: e.width / e.transform[2],
|
|
3046
|
+
height: e.height / e.transform[2]
|
|
3047
|
+
};
|
|
3048
|
+
return {
|
|
3049
|
+
viewBB: t,
|
|
3050
|
+
boundingRect: e.nodeLookup.size > 0 ? getBoundsOfRects(getInternalNodesBounds(e.nodeLookup, { filter: filterHidden }), t) : t,
|
|
3051
|
+
rfId: e.rfId,
|
|
3052
|
+
panZoom: e.panZoom,
|
|
3053
|
+
translateExtent: e.translateExtent,
|
|
3054
|
+
flowWidth: e.width,
|
|
3055
|
+
flowHeight: e.height,
|
|
3056
|
+
ariaLabelConfig: e.ariaLabelConfig
|
|
3057
|
+
};
|
|
3058
|
+
}, ARIA_LABEL_KEY = "react-flow__minimap-desc";
|
|
3059
|
+
function MiniMapComponent({ style: t, className: n, nodeStrokeColor: r, nodeColor: i, nodeClassName: a = "", nodeBorderRadius: o = 5, nodeStrokeWidth: s, nodeComponent: c, bgColor: l, maskColor: d, maskStrokeColor: f, maskStrokeWidth: p, position: m = "bottom-right", onClick: h, onNodeClick: g, pannable: _ = !1, zoomable: v = !1, ariaLabel: y, inversePan: b, zoomStep: x = 1, offsetScale: S = 5 }) {
|
|
3060
|
+
let C = useStoreApi(), w = useRef(null), { boundingRect: T, viewBB: E, rfId: D, panZoom: O, translateExtent: k, flowWidth: A, flowHeight: j, ariaLabelConfig: M } = useStore(selector$1, shallow), N = t?.width ?? defaultWidth, P = t?.height ?? defaultHeight, F = T.width / N, I = T.height / P, L = Math.max(F, I), R = L * N, z = L * P, B = S * L, V = T.x - (R - T.width) / 2 - B, H = T.y - (z - T.height) / 2 - B, U = R + B * 2, W = z + B * 2, G = `${ARIA_LABEL_KEY}-${D}`, K = useRef(0), q = useRef();
|
|
3061
|
+
K.current = L, useEffect(() => {
|
|
3062
|
+
if (w.current && O) return q.current = XYMinimap({
|
|
3063
|
+
domNode: w.current,
|
|
3064
|
+
panZoom: O,
|
|
3065
|
+
getTransform: () => C.getState().transform,
|
|
3066
|
+
getViewScale: () => K.current
|
|
3067
|
+
}), () => {
|
|
3068
|
+
q.current?.destroy();
|
|
3069
|
+
};
|
|
3070
|
+
}, [O]), useEffect(() => {
|
|
3071
|
+
q.current?.update({
|
|
3072
|
+
translateExtent: k,
|
|
3073
|
+
width: A,
|
|
3074
|
+
height: j,
|
|
3075
|
+
inversePan: b,
|
|
3076
|
+
pannable: _,
|
|
3077
|
+
zoomStep: x,
|
|
3078
|
+
zoomable: v
|
|
3079
|
+
});
|
|
3080
|
+
}, [
|
|
3081
|
+
_,
|
|
3082
|
+
v,
|
|
3083
|
+
b,
|
|
3084
|
+
x,
|
|
3085
|
+
k,
|
|
3086
|
+
A,
|
|
3087
|
+
j
|
|
3088
|
+
]);
|
|
3089
|
+
let J = h ? (e) => {
|
|
3090
|
+
let [t, n] = q.current?.pointer(e) || [0, 0];
|
|
3091
|
+
h(e, {
|
|
3092
|
+
x: t,
|
|
3093
|
+
y: n
|
|
3094
|
+
});
|
|
3095
|
+
} : void 0, Y = g ? useCallback((e, t) => {
|
|
3096
|
+
let n = C.getState().nodeLookup.get(t).internals.userNode;
|
|
3097
|
+
g(e, n);
|
|
3098
|
+
}, []) : void 0, X = y ?? M["minimap.ariaLabel"];
|
|
3099
|
+
return jsx(Panel, {
|
|
3100
|
+
position: m,
|
|
3101
|
+
style: {
|
|
3102
|
+
...t,
|
|
3103
|
+
"--xy-minimap-background-color-props": typeof l == "string" ? l : void 0,
|
|
3104
|
+
"--xy-minimap-mask-background-color-props": typeof d == "string" ? d : void 0,
|
|
3105
|
+
"--xy-minimap-mask-stroke-color-props": typeof f == "string" ? f : void 0,
|
|
3106
|
+
"--xy-minimap-mask-stroke-width-props": typeof p == "number" ? p * L : void 0,
|
|
3107
|
+
"--xy-minimap-node-background-color-props": typeof i == "string" ? i : void 0,
|
|
3108
|
+
"--xy-minimap-node-stroke-color-props": typeof r == "string" ? r : void 0,
|
|
3109
|
+
"--xy-minimap-node-stroke-width-props": typeof s == "number" ? s : void 0
|
|
3110
|
+
},
|
|
3111
|
+
className: cc(["react-flow__minimap", n]),
|
|
3112
|
+
"data-testid": "rf__minimap",
|
|
3113
|
+
children: jsxs("svg", {
|
|
3114
|
+
width: N,
|
|
3115
|
+
height: P,
|
|
3116
|
+
viewBox: `${V} ${H} ${U} ${W}`,
|
|
3117
|
+
className: "react-flow__minimap-svg",
|
|
3118
|
+
role: "img",
|
|
3119
|
+
"aria-labelledby": G,
|
|
3120
|
+
ref: w,
|
|
3121
|
+
onClick: J,
|
|
3122
|
+
children: [
|
|
3123
|
+
X && jsx("title", {
|
|
3124
|
+
id: G,
|
|
3125
|
+
children: X
|
|
3126
|
+
}),
|
|
3127
|
+
jsx(MiniMapNodes$1, {
|
|
3128
|
+
onClick: Y,
|
|
3129
|
+
nodeColor: i,
|
|
3130
|
+
nodeStrokeColor: r,
|
|
3131
|
+
nodeBorderRadius: o,
|
|
3132
|
+
nodeClassName: a,
|
|
3133
|
+
nodeStrokeWidth: s,
|
|
3134
|
+
nodeComponent: c
|
|
3135
|
+
}),
|
|
3136
|
+
jsx("path", {
|
|
3137
|
+
className: "react-flow__minimap-mask",
|
|
3138
|
+
d: `M${V - B},${H - B}h${U + B * 2}v${W + B * 2}h${-U - B * 2}z
|
|
3139
|
+
M${E.x},${E.y}h${E.width}v${E.height}h${-E.width}z`,
|
|
3140
|
+
fillRule: "evenodd",
|
|
3141
|
+
pointerEvents: "none"
|
|
3142
|
+
})
|
|
3143
|
+
]
|
|
3144
|
+
})
|
|
3145
|
+
});
|
|
3146
|
+
}
|
|
3147
|
+
MiniMapComponent.displayName = "MiniMap", memo(MiniMapComponent);
|
|
3148
|
+
var scaleSelector = (e) => (t) => e ? `${Math.max(1 / t.transform[2], 1)}` : void 0, defaultPositions = {
|
|
3149
|
+
[ResizeControlVariant.Line]: "right",
|
|
3150
|
+
[ResizeControlVariant.Handle]: "bottom-right"
|
|
3151
|
+
};
|
|
3152
|
+
function ResizeControl({ nodeId: t, position: n, variant: r = ResizeControlVariant.Handle, className: i, style: a = void 0, children: s, color: c, minWidth: l = 10, minHeight: u = 10, maxWidth: d = Number.MAX_VALUE, maxHeight: p = Number.MAX_VALUE, keepAspectRatio: m = !1, resizeDirection: h, autoScale: g = !0, shouldResize: _, onResizeStart: v, onResize: y, onResizeEnd: b }) {
|
|
3153
|
+
let x = useNodeId(), C = typeof t == "string" ? t : x, w = useStoreApi(), T = useRef(null), E = r === ResizeControlVariant.Handle, D = useStore(useCallback(scaleSelector(E && g), [E, g]), shallow), O = useRef(null), k = n ?? defaultPositions[r];
|
|
3154
|
+
return useEffect(() => {
|
|
3155
|
+
if (!(!T.current || !C)) return O.current ||= XYResizer({
|
|
3156
|
+
domNode: T.current,
|
|
3157
|
+
nodeId: C,
|
|
3158
|
+
getStoreItems: () => {
|
|
3159
|
+
let { nodeLookup: e, transform: t, snapGrid: n, snapToGrid: r, nodeOrigin: i, domNode: a } = w.getState();
|
|
3160
|
+
return {
|
|
3161
|
+
nodeLookup: e,
|
|
3162
|
+
transform: t,
|
|
3163
|
+
snapGrid: n,
|
|
3164
|
+
snapToGrid: r,
|
|
3165
|
+
nodeOrigin: i,
|
|
3166
|
+
paneDomNode: a
|
|
3167
|
+
};
|
|
3168
|
+
},
|
|
3169
|
+
onChange: (e, t) => {
|
|
3170
|
+
let { triggerNodeChanges: n, nodeLookup: r, parentLookup: i, nodeOrigin: a } = w.getState(), o = [], s = {
|
|
3171
|
+
x: e.x,
|
|
3172
|
+
y: e.y
|
|
3173
|
+
}, c = r.get(C);
|
|
3174
|
+
if (c && c.expandParent && c.parentId) {
|
|
3175
|
+
let t = c.origin ?? a, n = e.width ?? c.measured.width ?? 0, l = e.height ?? c.measured.height ?? 0, u = handleExpandParent([{
|
|
3176
|
+
id: c.id,
|
|
3177
|
+
parentId: c.parentId,
|
|
3178
|
+
rect: {
|
|
3179
|
+
width: n,
|
|
3180
|
+
height: l,
|
|
3181
|
+
...evaluateAbsolutePosition({
|
|
3182
|
+
x: e.x ?? c.position.x,
|
|
3183
|
+
y: e.y ?? c.position.y
|
|
3184
|
+
}, {
|
|
3185
|
+
width: n,
|
|
3186
|
+
height: l
|
|
3187
|
+
}, c.parentId, r, t)
|
|
3188
|
+
}
|
|
3189
|
+
}], r, i, a);
|
|
3190
|
+
o.push(...u), s.x = e.x ? Math.max(t[0] * n, e.x) : void 0, s.y = e.y ? Math.max(t[1] * l, e.y) : void 0;
|
|
3191
|
+
}
|
|
3192
|
+
if (s.x !== void 0 && s.y !== void 0) {
|
|
3193
|
+
let e = {
|
|
3194
|
+
id: C,
|
|
3195
|
+
type: "position",
|
|
3196
|
+
position: { ...s }
|
|
3197
|
+
};
|
|
3198
|
+
o.push(e);
|
|
3199
|
+
}
|
|
3200
|
+
if (e.width !== void 0 && e.height !== void 0) {
|
|
3201
|
+
let t = {
|
|
3202
|
+
id: C,
|
|
3203
|
+
type: "dimensions",
|
|
3204
|
+
resizing: !0,
|
|
3205
|
+
setAttributes: h ? h === "horizontal" ? "width" : "height" : !0,
|
|
3206
|
+
dimensions: {
|
|
3207
|
+
width: e.width,
|
|
3208
|
+
height: e.height
|
|
3209
|
+
}
|
|
3210
|
+
};
|
|
3211
|
+
o.push(t);
|
|
3212
|
+
}
|
|
3213
|
+
for (let e of t) {
|
|
3214
|
+
let t = {
|
|
3215
|
+
...e,
|
|
3216
|
+
type: "position"
|
|
3217
|
+
};
|
|
3218
|
+
o.push(t);
|
|
3219
|
+
}
|
|
3220
|
+
n(o);
|
|
3221
|
+
},
|
|
3222
|
+
onEnd: ({ width: e, height: t }) => {
|
|
3223
|
+
let n = {
|
|
3224
|
+
id: C,
|
|
3225
|
+
type: "dimensions",
|
|
3226
|
+
resizing: !1,
|
|
3227
|
+
dimensions: {
|
|
3228
|
+
width: e,
|
|
3229
|
+
height: t
|
|
3230
|
+
}
|
|
3231
|
+
};
|
|
3232
|
+
w.getState().triggerNodeChanges([n]);
|
|
3233
|
+
}
|
|
3234
|
+
}), O.current.update({
|
|
3235
|
+
controlPosition: k,
|
|
3236
|
+
boundaries: {
|
|
3237
|
+
minWidth: l,
|
|
3238
|
+
minHeight: u,
|
|
3239
|
+
maxWidth: d,
|
|
3240
|
+
maxHeight: p
|
|
3241
|
+
},
|
|
3242
|
+
keepAspectRatio: m,
|
|
3243
|
+
resizeDirection: h,
|
|
3244
|
+
onResizeStart: v,
|
|
3245
|
+
onResize: y,
|
|
3246
|
+
onResizeEnd: b,
|
|
3247
|
+
shouldResize: _
|
|
3248
|
+
}), () => {
|
|
3249
|
+
O.current?.destroy();
|
|
3250
|
+
};
|
|
3251
|
+
}, [
|
|
3252
|
+
k,
|
|
3253
|
+
l,
|
|
3254
|
+
u,
|
|
3255
|
+
d,
|
|
3256
|
+
p,
|
|
3257
|
+
m,
|
|
3258
|
+
v,
|
|
3259
|
+
y,
|
|
3260
|
+
b,
|
|
3261
|
+
_
|
|
3262
|
+
]), jsx("div", {
|
|
3263
|
+
className: cc([
|
|
3264
|
+
"react-flow__resize-control",
|
|
3265
|
+
"nodrag",
|
|
3266
|
+
...k.split("-"),
|
|
3267
|
+
r,
|
|
3268
|
+
i
|
|
3269
|
+
]),
|
|
3270
|
+
ref: T,
|
|
3271
|
+
style: {
|
|
3272
|
+
...a,
|
|
3273
|
+
scale: D,
|
|
3274
|
+
...c && { [E ? "backgroundColor" : "borderColor"]: c }
|
|
3275
|
+
},
|
|
3276
|
+
children: s
|
|
3277
|
+
});
|
|
3278
|
+
}
|
|
3279
|
+
memo(ResizeControl);
|
|
3280
|
+
export { Background, BackgroundVariant, BaseEdge, Controls, EdgeLabelRenderer, Handle, ReactFlowProvider, index, useEdgesState, useNodesState, useReactFlow };
|