@likec4/diagram 1.43.0 → 1.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/index.js +14727 -13166
- package/dist/LikeC4Diagram.d.ts +1 -1
- package/dist/LikeC4Diagram.js +14 -9
- package/dist/LikeC4Diagram.props.d.ts +25 -15
- package/dist/LikeC4ProjectsProvider.js +1 -1
- package/dist/LikeC4Styles.js +0 -3
- package/dist/LikeC4View.d.ts +8 -3
- package/dist/LikeC4View.js +29 -14
- package/dist/ReactLikeC4.d.ts +2 -2
- package/dist/ReactLikeC4.js +2 -2
- package/dist/StaticLikeC4Diagram.js +1 -1
- package/dist/_virtual/_commonjsHelpers.js +3 -0
- package/dist/_virtual/assign-dea9f7c8.cjs.js +3 -0
- package/dist/_virtual/log-ec8d4df4.cjs.js +3 -0
- package/dist/_virtual/raise-da5b247f.cjs.js +3 -0
- package/dist/_virtual/xstate-actions.cjs.js +5 -0
- package/dist/_virtual/xstate-actions.cjs2.js +3 -0
- package/dist/_virtual/xstate-dev.cjs.js +3 -0
- package/dist/_virtual/xstate-guards.cjs.js +5 -0
- package/dist/_virtual/xstate-guards.cjs2.js +3 -0
- package/dist/base/Background.d.ts +2 -1
- package/dist/base/Background.js +11 -2
- package/dist/base/Base.d.ts +28 -0
- package/dist/base/BaseXYFlow.d.ts +5 -5
- package/dist/base/BaseXYFlow.js +38 -44
- package/dist/base/index.d.ts +6 -2
- package/dist/base/types.d.ts +1 -28
- package/dist/base/updateEdges.js +25 -14
- package/dist/base/updateNodes.d.ts +14 -0
- package/dist/base/updateNodes.js +51 -17
- package/dist/base-primitives/Markdown.d.ts +30 -4
- package/dist/base-primitives/Markdown.js +3 -2
- package/dist/base-primitives/compound/CompoundActionButton.d.ts +3 -2
- package/dist/base-primitives/compound/CompoundActionButton.js +1 -1
- package/dist/base-primitives/compound/CompoundDetailsButton.d.ts +3 -2
- package/dist/base-primitives/compound/CompoundDetailsButton.js +1 -1
- package/dist/base-primitives/edge/EdgeActionButton.d.ts +3 -2
- package/dist/base-primitives/edge/EdgeActionButton.js +1 -1
- package/dist/base-primitives/edge/EdgeContainer.d.ts +1 -1
- package/dist/base-primitives/edge/EdgeContainer.js +8 -1
- package/dist/base-primitives/edge/EdgeLabel.d.ts +3 -2
- package/dist/base-primitives/edge/EdgeLabel.js +2 -0
- package/dist/base-primitives/edge/EdgeLabelContainer.d.ts +1 -1
- package/dist/base-primitives/edge/EdgeLabelContainer.js +4 -0
- package/dist/base-primitives/edge/EdgePath.d.ts +4 -0
- package/dist/base-primitives/edge/EdgePath.js +29 -5
- package/dist/base-primitives/element/ElementActionButtons.d.ts +6 -4
- package/dist/base-primitives/element/ElementActionButtons.js +3 -3
- package/dist/base-primitives/element/ElementData.d.ts +3 -3
- package/dist/base-primitives/element/ElementData.js +13 -7
- package/dist/base-primitives/element/ElementDetailsButton.d.ts +3 -2
- package/dist/base-primitives/element/ElementDetailsButton.js +5 -5
- package/dist/base-primitives/element/ElementNodeContainer.css.js +15 -27
- package/dist/base-primitives/element/ElementShape.js +5 -5
- package/dist/base-primitives/element/ElementTags.d.ts +6 -4
- package/dist/base-primitives/element/ElementTags.js +2 -1
- package/dist/base-primitives/memoEdge.js +4 -2
- package/dist/base-primitives/memoNode.d.ts +1 -1
- package/dist/base-primitives/memoNode.js +3 -3
- package/dist/components/ErrorFallback.js +52 -35
- package/dist/components/Link.js +2 -2
- package/dist/context/DiagramEventHandlers.js +2 -1
- package/dist/context/DiagramFeatures.d.ts +25 -6
- package/dist/context/DiagramFeatures.js +28 -56
- package/dist/context/IconRenderer.js +6 -6
- package/dist/context/LikeC4ModelContext.js +3 -10
- package/dist/context/TagStylesContext.js +3 -19
- package/dist/context/index.d.ts +1 -1
- package/dist/custom/customNodes.js +3 -2
- package/dist/custom/hooks.d.ts +3 -3
- package/dist/custom/index.d.ts +1 -1
- package/dist/custom/index.js +5 -5
- package/dist/editor/LikeC4EditorContext.d.ts +21 -0
- package/dist/editor/index.d.ts +2 -0
- package/dist/hooks/index.d.ts +4 -2
- package/dist/hooks/safeContext.d.ts +6 -3
- package/dist/hooks/safeContext.js +10 -3
- package/dist/hooks/useCallbackRef.d.ts +1 -0
- package/dist/hooks/useCallbackRef.js +13 -0
- package/dist/hooks/useCurrentView.d.ts +11 -0
- package/dist/hooks/{useCurrentViewId.js → useCurrentView.js} +7 -3
- package/dist/hooks/useCurrentViewModel.js +4 -1
- package/dist/hooks/useDiagram.d.ts +7 -113
- package/dist/hooks/useDiagram.js +7 -127
- package/dist/hooks/useDiagramCompareLayout.d.ts +35 -0
- package/dist/hooks/useDiagramCompareLayout.js +65 -0
- package/dist/hooks/useLikeC4Project.d.ts +6 -1
- package/dist/hooks/useLikeC4Project.js +14 -2
- package/dist/hooks/useMediaPrint.d.ts +6 -0
- package/dist/hooks/useUpdateEffect.js +2 -4
- package/dist/hooks/useXYFlow.d.ts +1 -0
- package/dist/hooks/useXYFlow.js +4 -7
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -3
- package/dist/likec4diagram/DiagramUI.js +14 -7
- package/dist/likec4diagram/DiagramXYFlow.d.ts +2 -2
- package/dist/likec4diagram/DiagramXYFlow.js +60 -52
- package/dist/likec4diagram/convert-to-xyflow.d.ts +0 -1
- package/dist/likec4diagram/custom/edges/EdgeDrifts.d.ts +6 -0
- package/dist/likec4diagram/custom/edges/EdgeDrifts.js +38 -0
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +256 -217
- package/dist/likec4diagram/custom/edges/SequenceStepEdge.js +9 -2
- package/dist/likec4diagram/custom/edges/edges.css.js +3 -4
- package/dist/likec4diagram/custom/edges/useControlPoints.d.ts +8 -0
- package/dist/likec4diagram/custom/edges/useControlPoints.js +58 -0
- package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.d.ts +7 -0
- package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.js +60 -0
- package/dist/likec4diagram/custom/edges/utils.d.ts +0 -12
- package/dist/likec4diagram/custom/nodes/CompoundActions.js +4 -1
- package/dist/likec4diagram/custom/nodes/ElementActions.d.ts +2 -1
- package/dist/likec4diagram/custom/nodes/ElementActions.js +15 -10
- package/dist/likec4diagram/custom/nodes/NodeDrifts.d.ts +6 -0
- package/dist/likec4diagram/custom/nodes/NodeDrifts.js +50 -0
- package/dist/likec4diagram/custom/nodes/SequenceActorNode.js +7 -2
- package/dist/likec4diagram/custom/nodes/index.d.ts +1 -0
- package/dist/likec4diagram/custom/nodes/nodes.d.ts +9 -1
- package/dist/likec4diagram/custom/nodes/nodes.js +74 -29
- package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.d.ts +1 -1
- package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +1 -1
- package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +2 -1
- package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.js +4 -3
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.d.ts +1 -11
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +7 -51
- package/dist/likec4diagram/custom/nodes/toolbar/types.d.ts +5 -0
- package/dist/likec4diagram/custom/nodes/toolbar/types.js +7 -0
- package/dist/likec4diagram/custom/nodes/toolbar/useHandlers.d.ts +8 -0
- package/dist/likec4diagram/custom/nodes/toolbar/useHandlers.js +44 -0
- package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +8 -10
- package/dist/likec4diagram/relationship-popover/actor.d.ts +1 -1
- package/dist/likec4diagram/state/DiagramActorProvider.d.ts +4 -3
- package/dist/likec4diagram/state/DiagramActorProvider.js +95 -70
- package/dist/likec4diagram/state/assign.d.ts +13 -7
- package/dist/likec4diagram/state/assign.js +43 -282
- package/dist/likec4diagram/state/createViewChange.d.ts +3 -0
- package/dist/likec4diagram/state/createViewChange.js +79 -0
- package/dist/likec4diagram/state/diagram-api.d.ts +109 -0
- package/dist/likec4diagram/state/diagram-api.js +126 -0
- package/dist/likec4diagram/state/machine.actions.d.ts +1783 -0
- package/dist/likec4diagram/state/machine.actions.js +644 -0
- package/dist/likec4diagram/state/machine.actions.layout.d.ts +579 -0
- package/dist/likec4diagram/state/machine.actions.layout.js +129 -0
- package/dist/likec4diagram/state/machine.d.ts +22 -0
- package/dist/likec4diagram/state/machine.js +127 -0
- package/dist/likec4diagram/state/machine.setup.d.ts +327 -0
- package/dist/likec4diagram/state/machine.setup.js +93 -0
- package/dist/likec4diagram/state/machine.state.initializing.d.ts +208 -0
- package/dist/likec4diagram/state/machine.state.initializing.js +55 -0
- package/dist/likec4diagram/state/machine.state.navigating.d.ts +14 -0
- package/dist/likec4diagram/state/machine.state.navigating.js +178 -0
- package/dist/likec4diagram/state/machine.state.ready.d.ts +3131 -0
- package/dist/likec4diagram/state/machine.state.ready.focused.d.ts +386 -0
- package/dist/likec4diagram/state/machine.state.ready.focused.js +85 -0
- package/dist/likec4diagram/state/machine.state.ready.idle.d.ts +474 -0
- package/dist/likec4diagram/state/machine.state.ready.idle.js +96 -0
- package/dist/likec4diagram/state/machine.state.ready.js +262 -0
- package/dist/likec4diagram/state/machine.state.ready.printing.d.ts +128 -0
- package/dist/likec4diagram/state/machine.state.ready.printing.js +40 -0
- package/dist/likec4diagram/state/machine.state.ready.walkthrough.d.ts +511 -0
- package/dist/likec4diagram/state/machine.state.ready.walkthrough.js +177 -0
- package/dist/likec4diagram/state/mediaPrintActor.d.ts +12 -0
- package/dist/likec4diagram/state/mediaPrintActor.js +18 -0
- package/dist/likec4diagram/state/syncManualLayoutActor.d.ts +31 -108
- package/dist/likec4diagram/state/syncManualLayoutActor.js +278 -142
- package/dist/likec4diagram/state/types.d.ts +7 -12
- package/dist/likec4diagram/state/utils.d.ts +19 -4
- package/dist/likec4diagram/state/utils.js +47 -4
- package/dist/likec4diagram/types.d.ts +8 -8
- package/dist/likec4diagram/ui/LayoutDriftFrame.d.ts +2 -0
- package/dist/likec4diagram/ui/LayoutDriftFrame.js +66 -0
- package/dist/likec4diagram/ui/index.d.ts +1 -0
- package/dist/likec4diagram/ui/notation/NotationPanel.css.js +5 -2
- package/dist/likec4diagram/ui/notation/NotationPanel.js +5 -4
- package/dist/likec4diagram/useLayoutConstraints.d.ts +10 -5
- package/dist/likec4diagram/useLayoutConstraints.js +237 -61
- package/dist/likec4diagram/xyflow-diagram/diagram-view.d.ts +0 -1
- package/dist/likec4diagram/xyflow-diagram/diagram-view.js +14 -17
- package/dist/likec4diagram/xyflow-sequence/sequence-layout.js +11 -8
- package/dist/navigationpanel/NavigationPanel.js +16 -8
- package/dist/navigationpanel/NavigationPanelControls.d.ts +2 -1
- package/dist/navigationpanel/NavigationPanelControls.js +23 -17
- package/dist/navigationpanel/NavigationPanelDropdown.d.ts +2 -1
- package/dist/navigationpanel/NavigationPanelDropdown.js +62 -42
- package/dist/navigationpanel/_common.d.ts +1 -1
- package/dist/navigationpanel/_common.js +4 -2
- package/dist/navigationpanel/actor.d.ts +9 -205
- package/dist/navigationpanel/actor.js +6 -5
- package/dist/navigationpanel/comparepanel/CompareActionsMenu.d.ts +3 -0
- package/dist/navigationpanel/comparepanel/CompareActionsMenu.js +59 -0
- package/dist/navigationpanel/comparepanel/ComparePanel.d.ts +2 -0
- package/dist/navigationpanel/comparepanel/ComparePanel.js +42 -0
- package/dist/navigationpanel/comparepanel/ComparePanelControls.d.ts +1 -0
- package/dist/navigationpanel/comparepanel/ComparePanelControls.js +60 -0
- package/dist/navigationpanel/comparepanel/LayoutTypeSwitcher.d.ts +5 -0
- package/dist/navigationpanel/comparepanel/LayoutTypeSwitcher.js +38 -0
- package/dist/navigationpanel/comparepanel/index.d.ts +1 -0
- package/dist/navigationpanel/controls/{ViewDetailsCard.d.ts → DetailsControls.d.ts} +1 -1
- package/dist/navigationpanel/controls/{ViewDetailsCard.js → DetailsControls.js} +18 -14
- package/dist/navigationpanel/controls/LayoutWarning.d.ts +2 -0
- package/dist/navigationpanel/controls/LayoutWarning.js +102 -0
- package/dist/navigationpanel/controls/NavigationButtons.js +4 -3
- package/dist/navigationpanel/controls/OpenSource.js +2 -2
- package/dist/navigationpanel/controls/SearchControl.d.ts +2 -1
- package/dist/navigationpanel/controls/SearchControl.js +15 -17
- package/dist/navigationpanel/controls/ToggleReadonly.d.ts +1 -1
- package/dist/navigationpanel/controls/ToggleReadonly.js +26 -18
- package/dist/navigationpanel/controls/index.d.ts +2 -1
- package/dist/navigationpanel/dropdown/ProjectsMenu.d.ts +2 -2
- package/dist/navigationpanel/dropdown/ProjectsMenu.js +5 -5
- package/dist/navigationpanel/editorpanel/CenterCamera.js +5 -2
- package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.d.ts +1 -1
- package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.js +21 -20
- package/dist/navigationpanel/editorpanel/EditorPanel.js +3 -3
- package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.d.ts +2 -2
- package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.js +16 -13
- package/dist/navigationpanel/editorpanel/ToggleReadonly.d.ts +1 -0
- package/dist/navigationpanel/editorpanel/ToggleReadonly.js +15 -0
- package/dist/navigationpanel/styles.css.d.ts +2 -2
- package/dist/navigationpanel/styles.css.js +4 -4
- package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +14 -8
- package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +66 -66
- package/dist/navigationpanel/walkthrough/DynamicViewControls.js +31 -14
- package/dist/navigationpanel/walkthrough/WalkthroughPanel.d.ts +2 -1
- package/dist/navigationpanel/walkthrough/WalkthroughPanel.js +68 -50
- package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/actions/dist/xstate-actions.cjs.js +37 -0
- package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dev/dist/xstate-dev.cjs.js +59 -0
- package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dist/assign-dea9f7c8.cjs.js +140 -0
- package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dist/log-ec8d4df4.cjs.js +401 -0
- package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dist/raise-da5b247f.cjs.js +2716 -0
- package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/guards/dist/xstate-guards.cjs.js +26 -0
- package/dist/overlays/element-details/ElementDetails.js +7 -7
- package/dist/overlays/element-details/ElementDetailsCard.css.js +3 -3
- package/dist/overlays/element-details/ElementDetailsCard.js +7 -5
- package/dist/overlays/element-details/MetadataValue.d.ts +2 -1
- package/dist/overlays/element-details/MetadataValue.js +2 -2
- package/dist/overlays/element-details/TabPanelDeployments.js +6 -4
- package/dist/overlays/element-details/TabPanelRelationships.js +3 -3
- package/dist/overlays/element-details/TabPanelStructure.js +1 -1
- package/dist/overlays/element-details/actor.d.ts +8 -82
- package/dist/overlays/element-details/actor.js +0 -8
- package/dist/overlays/overlay/Overlay.js +10 -10
- package/dist/overlays/overlaysActor.d.ts +7 -150
- package/dist/overlays/overlaysActor.js +183 -161
- package/dist/overlays/relationship-details/RelationshipDetails.js +4 -3
- package/dist/overlays/relationship-details/SelectEdge.js +2 -2
- package/dist/overlays/relationship-details/_types.d.ts +3 -4
- package/dist/overlays/relationship-details/actor.d.ts +6 -550
- package/dist/overlays/relationship-details/actor.js +18 -3
- package/dist/overlays/relationship-details/custom/ElementActions.js +8 -5
- package/dist/overlays/relationship-details/custom/edgeTypes.js +4 -1
- package/dist/overlays/relationship-details/custom/nodeTypes.js +4 -1
- package/dist/overlays/relationship-details/hooks.js +1 -1
- package/dist/overlays/relationship-details/layout-to-xyflow.js +3 -5
- package/dist/overlays/relationship-details/layout.d.ts +3 -3
- package/dist/overlays/relationship-details/layout.js +4 -4
- package/dist/overlays/relationships-browser/RelationshipsBrowser.js +6 -4
- package/dist/overlays/relationships-browser/SelectElement.js +2 -2
- package/dist/overlays/relationships-browser/_types.d.ts +2 -3
- package/dist/overlays/relationships-browser/actor.d.ts +7 -673
- package/dist/overlays/relationships-browser/actor.js +132 -110
- package/dist/overlays/relationships-browser/custom/ElementActions.js +44 -37
- package/dist/overlays/relationships-browser/custom/edgeTypes.js +4 -1
- package/dist/overlays/relationships-browser/custom/nodeTypes.js +4 -1
- package/dist/overlays/relationships-browser/hooks.js +7 -6
- package/dist/overlays/relationships-browser/layout.d.ts +2 -2
- package/dist/overlays/relationships-browser/layout.js +3 -3
- package/dist/overlays/relationships-browser/useViewToNodesEdges.js +0 -3
- package/dist/overlays/types.d.ts +12 -13
- package/dist/search/Search.js +2 -1
- package/dist/search/components/ElementsColumn.js +5 -3
- package/dist/search/components/PickView.js +1 -1
- package/dist/search/components/SearchByTags.js +21 -44
- package/dist/search/components/SearchInput.js +1 -1
- package/dist/search/components/ViewsColum.js +6 -4
- package/dist/search/components/_shared.css.d.ts +1 -1
- package/dist/search/searchActor.d.ts +3 -66
- package/dist/shadowroot/ShadowRoot.d.ts +5 -7
- package/dist/shadowroot/ShadowRoot.js +8 -6
- package/dist/styles.css2.js +1 -1
- package/dist/utils/index.d.ts +4 -4
- package/dist/utils/vector.d.ts +83 -21
- package/dist/utils/vector.js +98 -24
- package/dist/utils/view-bounds.d.ts +8 -0
- package/dist/utils/view-bounds.js +58 -0
- package/dist/utils/xyflow.d.ts +52 -8
- package/dist/utils/xyflow.js +31 -11
- package/package.json +26 -24
- package/panda.buildinfo.json +124 -71
- package/styles-min.css +1 -1
- package/styles.css +1 -1
- package/dist/hooks/useCurrentViewId.d.ts +0 -6
- package/dist/likec4diagram/custom/edges/utils.js +0 -23
- package/dist/likec4diagram/state/diagram-machine.d.ts +0 -2590
- package/dist/likec4diagram/state/diagram-machine.js +0 -1180
- package/dist/navigationpanel/editorpanel/LayoutDriftNotification.d.ts +0 -1
- package/dist/navigationpanel/editorpanel/LayoutDriftNotification.js +0 -56
- package/dist/utils/get-view-bounds.d.ts +0 -3
- package/dist/utils/get-view-bounds.js +0 -14
- /package/dist/base/{types.js → Base.js} +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/createReactComponent.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertTriangle.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowDownRight.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowLeft.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowRight.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconBolt.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconBrowser.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronDown.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronLeft.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronRight.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconCylinder.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconDeviceMobile.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconDirectionSignFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconExternalLink.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconFileSymlink.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconFocusCentered.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconFolderFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconHelpCircle.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconId.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconInfoCircle.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignBottom.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignCenter.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignLeft.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignMiddle.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignRight.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignTop.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutBoardSplit.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutCollage.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutDashboard.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLink.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLock.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLockOpen2.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerPlayFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipBackFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipForwardFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerStopFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconRectangularPrism.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconReorder.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconRouteOff.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconSearch.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconSelector.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconStack2.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconStarFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconTarget.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconTransform.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconUser.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconX.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconZoomScan.js +0 -0
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { BBox } from '@likec4/core/types';
|
|
2
|
-
import { nonNullable } from '@likec4/core/utils';
|
|
3
|
-
import { getNodesBounds, getNodeDimensions, getEdgePosition } from '@xyflow/system';
|
|
2
|
+
import { nonNullable, nonexhaustive } from '@likec4/core/utils';
|
|
3
|
+
import { getViewportForBounds, getNodesBounds, getNodeDimensions, getEdgePosition } from '@xyflow/system';
|
|
4
|
+
import { MinZoom } from '../../base/const.js';
|
|
4
5
|
|
|
5
6
|
function typedSystem(system) {
|
|
6
7
|
return {
|
|
8
|
+
get syncLayoutActorRef() {
|
|
9
|
+
return system.get("syncLayout") ?? null;
|
|
10
|
+
},
|
|
7
11
|
get overlaysActorRef() {
|
|
8
12
|
return system.get("overlays") ?? null;
|
|
9
13
|
},
|
|
10
14
|
get diagramActorRef() {
|
|
11
|
-
return system.get("diagram")
|
|
15
|
+
return nonNullable(system.get("diagram"), "Diagram actor not found");
|
|
12
16
|
},
|
|
13
17
|
get searchActorRef() {
|
|
14
18
|
return system.get("search") ?? null;
|
|
@@ -121,5 +125,44 @@ function getEdgeBounds(edge, store) {
|
|
|
121
125
|
[edgePosition.targetX, edgePosition.targetY]
|
|
122
126
|
]);
|
|
123
127
|
}
|
|
128
|
+
function nodeRef(node) {
|
|
129
|
+
switch (node.type) {
|
|
130
|
+
case "element":
|
|
131
|
+
case "compound-element":
|
|
132
|
+
case "seq-actor":
|
|
133
|
+
return node.data.modelFqn;
|
|
134
|
+
case "deployment":
|
|
135
|
+
case "compound-deployment":
|
|
136
|
+
return node.data.modelFqn ?? node.data.deploymentFqn;
|
|
137
|
+
case "seq-parallel":
|
|
138
|
+
case "view-group":
|
|
139
|
+
return null;
|
|
140
|
+
default:
|
|
141
|
+
nonexhaustive(node);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
function findCorrespondingNode(context, event) {
|
|
145
|
+
const fromNodeId = context.lastOnNavigate?.fromNode;
|
|
146
|
+
const fromNode = fromNodeId && context.xynodes.find((n) => n.id === fromNodeId);
|
|
147
|
+
const fromRef = fromNode && nodeRef(fromNode);
|
|
148
|
+
const toNode = fromRef && event.xynodes.find((n) => nodeRef(n) === fromRef);
|
|
149
|
+
return { fromNode, toNode };
|
|
150
|
+
}
|
|
151
|
+
function calcViewportForBounds(context, bounds) {
|
|
152
|
+
let currentZoom = context.xyflow.getZoom();
|
|
153
|
+
let {
|
|
154
|
+
width,
|
|
155
|
+
height
|
|
156
|
+
} = context.xystore.getState();
|
|
157
|
+
const maxZoom = Math.max(currentZoom, 1);
|
|
158
|
+
return getViewportForBounds(
|
|
159
|
+
bounds,
|
|
160
|
+
width,
|
|
161
|
+
height,
|
|
162
|
+
MinZoom,
|
|
163
|
+
maxZoom,
|
|
164
|
+
context.fitViewPadding
|
|
165
|
+
);
|
|
166
|
+
}
|
|
124
167
|
|
|
125
|
-
export { activeSequenceBounds, findDiagramEdge, findDiagramNode, focusedBounds, typedSystem };
|
|
168
|
+
export { activeSequenceBounds, calcViewportForBounds, findCorrespondingNode, findDiagramEdge, findDiagramNode, focusedBounds, nodeRef, typedSystem };
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { BBox, DeploymentFqn, DiagramEdge, DiagramNode, ExclusiveUnion, Fqn, IconUrl,
|
|
1
|
+
import { BBox, DeploymentFqn, DiagramEdge, DiagramNode, DiagramNodeDriftReason, ExclusiveUnion, Fqn, IconUrl, MarkdownOrString, NonEmptyReadonlyArray, ViewId } from '@likec4/core/types';
|
|
2
2
|
import { XYPosition } from '@xyflow/system';
|
|
3
3
|
import { FunctionComponent } from 'react';
|
|
4
4
|
import { Simplify } from 'type-fest';
|
|
5
5
|
import { BaseEdge, BaseEdgeData, BaseEdgeProps, BaseNode, BaseNodeData, BaseNodeProps, NonOptional } from '../base/types';
|
|
6
6
|
export declare namespace Types {
|
|
7
|
-
type LeafNodeData = Simplify<BaseNodeData & NonOptional<Pick<DiagramNode, 'id' | 'title' | 'color' | 'shape' | 'width' | 'level' | 'height' | 'style' | 'tags' | 'x' | 'y'>> & {
|
|
8
|
-
technology: string | null;
|
|
9
|
-
description: RichTextOrEmpty;
|
|
7
|
+
type LeafNodeData = Simplify<BaseNodeData & NonOptional<Pick<DiagramNode, 'id' | 'title' | 'technology' | 'description' | 'color' | 'shape' | 'width' | 'level' | 'height' | 'style' | 'tags' | 'x' | 'y'>> & {
|
|
10
8
|
/**
|
|
11
9
|
* View this node belongs to
|
|
12
10
|
*/
|
|
13
11
|
viewId: ViewId;
|
|
14
12
|
isMultiple?: boolean | undefined;
|
|
15
13
|
icon: string | null;
|
|
14
|
+
drifts: NonEmptyReadonlyArray<DiagramNodeDriftReason> | null;
|
|
16
15
|
}>;
|
|
17
16
|
/**
|
|
18
17
|
* Represents element from logical model
|
|
@@ -57,6 +56,7 @@ export declare namespace Types {
|
|
|
57
56
|
viewId: ViewId;
|
|
58
57
|
depth: number;
|
|
59
58
|
icon?: IconUrl;
|
|
59
|
+
drifts: NonEmptyReadonlyArray<DiagramNodeDriftReason> | null;
|
|
60
60
|
}>;
|
|
61
61
|
type CompoundElementNodeData = Simplify<CompoundNodeData & {
|
|
62
62
|
modelFqn: Fqn;
|
|
@@ -102,13 +102,13 @@ export declare namespace Types {
|
|
|
102
102
|
type: Type;
|
|
103
103
|
}>;
|
|
104
104
|
type NodeProps<Type extends NodeType = NodeType> = BaseNodeProps<Node<Type>>;
|
|
105
|
-
type RelationshipEdgeData = Simplify<BaseEdgeData & NonOptional<Pick<DiagramEdge, 'id' | 'label' | 'labelBBox' | 'technology' | 'points' | 'dir' | 'color' | 'line' | 'head' | 'tail' | 'navigateTo' | 'astPath'>> & {
|
|
106
|
-
notes:
|
|
105
|
+
type RelationshipEdgeData = Simplify<BaseEdgeData & NonOptional<Pick<DiagramEdge, 'id' | 'label' | 'labelBBox' | 'technology' | 'points' | 'dir' | 'color' | 'line' | 'head' | 'tail' | 'navigateTo' | 'astPath' | 'drifts'>> & {
|
|
106
|
+
notes: MarkdownOrString | null;
|
|
107
107
|
labelXY: XYPosition | null;
|
|
108
108
|
controlPoints: XYPosition[] | undefined | null;
|
|
109
109
|
}>;
|
|
110
|
-
type SequenceStepEdgeData = Simplify<BaseEdgeData & NonOptional<Pick<DiagramEdge, 'id' | 'label' | 'technology' | 'points' | 'dir' | 'color' | 'line' | 'head' | 'tail' | 'navigateTo' | 'astPath'>> & {
|
|
111
|
-
notes:
|
|
110
|
+
type SequenceStepEdgeData = Simplify<BaseEdgeData & NonOptional<Pick<DiagramEdge, 'id' | 'label' | 'technology' | 'points' | 'dir' | 'color' | 'line' | 'head' | 'tail' | 'navigateTo' | 'astPath' | 'drifts'>> & {
|
|
111
|
+
notes: MarkdownOrString | null;
|
|
112
112
|
labelXY: XYPosition | null;
|
|
113
113
|
labelBBox: BBox;
|
|
114
114
|
controlPoints: XYPosition[] | undefined | null;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { css } from '@likec4/styles/css';
|
|
3
|
+
import { Box } from '@likec4/styles/jsx';
|
|
4
|
+
import { hstack } from '@likec4/styles/patterns';
|
|
5
|
+
import { UnstyledButton } from '@mantine/core';
|
|
6
|
+
import { memo } from 'react';
|
|
7
|
+
import { useDiagramCompareLayout } from '../../hooks/useDiagramCompareLayout.js';
|
|
8
|
+
|
|
9
|
+
const LayoutDriftFrame = memo(() => {
|
|
10
|
+
const [{ layout, isActive }, { toggleCompare }] = useDiagramCompareLayout();
|
|
11
|
+
const bgColor = layout === "manual" ? "var(--mantine-color-orange-6)" : "var(--mantine-color-green-6)";
|
|
12
|
+
return /* @__PURE__ */ jsx(
|
|
13
|
+
Box,
|
|
14
|
+
{
|
|
15
|
+
className: hstack({
|
|
16
|
+
position: "absolute",
|
|
17
|
+
top: "0",
|
|
18
|
+
left: "0",
|
|
19
|
+
width: "full",
|
|
20
|
+
height: "full",
|
|
21
|
+
border: `default`,
|
|
22
|
+
borderWidth: 4,
|
|
23
|
+
pointerEvents: "none",
|
|
24
|
+
alignItems: "flex-start",
|
|
25
|
+
justifyContent: "center"
|
|
26
|
+
}),
|
|
27
|
+
style: {
|
|
28
|
+
zIndex: "9999",
|
|
29
|
+
display: !isActive ? "none" : void 0,
|
|
30
|
+
borderColor: bgColor
|
|
31
|
+
},
|
|
32
|
+
children: /* @__PURE__ */ jsx(
|
|
33
|
+
Btn,
|
|
34
|
+
{
|
|
35
|
+
style: {
|
|
36
|
+
backgroundColor: bgColor
|
|
37
|
+
},
|
|
38
|
+
onClick: (e) => {
|
|
39
|
+
e.stopPropagation();
|
|
40
|
+
toggleCompare();
|
|
41
|
+
},
|
|
42
|
+
children: "Close compare"
|
|
43
|
+
}
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
});
|
|
48
|
+
const Btn = UnstyledButton.withProps({
|
|
49
|
+
className: css({
|
|
50
|
+
fontSize: "xs",
|
|
51
|
+
fontWeight: "medium",
|
|
52
|
+
py: "1.5",
|
|
53
|
+
lineHeight: "1",
|
|
54
|
+
borderBottomLeftRadius: "sm",
|
|
55
|
+
borderBottomRightRadius: "sm",
|
|
56
|
+
transform: "translateY(-4px)",
|
|
57
|
+
px: "4",
|
|
58
|
+
color: "mantine.colors.gray[9]",
|
|
59
|
+
pointerEvents: "all",
|
|
60
|
+
_active: {
|
|
61
|
+
transform: "translateY(-3px)"
|
|
62
|
+
}
|
|
63
|
+
})
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
export { LayoutDriftFrame };
|
|
@@ -7,7 +7,10 @@ const container = css({
|
|
|
7
7
|
padding: "2",
|
|
8
8
|
margin: "0",
|
|
9
9
|
width: "min-content",
|
|
10
|
-
height: "min-content"
|
|
10
|
+
height: "min-content",
|
|
11
|
+
_print: {
|
|
12
|
+
display: "none"
|
|
13
|
+
}
|
|
11
14
|
});
|
|
12
15
|
const icon = css({
|
|
13
16
|
["--ai-radius"]: "0px",
|
|
@@ -43,7 +46,7 @@ const elementNotation = css({
|
|
|
43
46
|
// WebkitBackdropFilter: fallbackVar(vars.safariAnimationHook, 'blur(8px)'),
|
|
44
47
|
// backdropFilter: fallbackVar(vars.safariAnimationHook, 'blur(8px)'),
|
|
45
48
|
// vars: {
|
|
46
|
-
// // [stokeFillMix]: `color-mix(in
|
|
49
|
+
// // [stokeFillMix]: `color-mix(in oklab, ${vars.element.stroke} 90%, ${vars.element.fill})`
|
|
47
50
|
// },
|
|
48
51
|
_hover: {
|
|
49
52
|
transition: "all 120ms ease-out",
|
|
@@ -5,13 +5,14 @@ import { useLocalStorage } from '@mantine/hooks';
|
|
|
5
5
|
import { AnimatePresence, m } from 'motion/react';
|
|
6
6
|
import { memo, useState } from 'react';
|
|
7
7
|
import { ceil, isNonNullish } from 'remeda';
|
|
8
|
-
import { useDiagramContext
|
|
8
|
+
import { useDiagramContext } from '../../../hooks/useDiagram.js';
|
|
9
9
|
import { useXYStore } from '../../../hooks/useXYFlow.js';
|
|
10
10
|
import { container, icon, card, tabPanel, shapeBadge, elementNotation } from './NotationPanel.css.js';
|
|
11
11
|
import { useMantinePortalProps } from '../../../hooks/useMantinePortalProps.js';
|
|
12
|
-
import IconAlertTriangle from '../../../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.
|
|
13
|
-
import IconHelpCircle from '../../../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.
|
|
14
|
-
import IconArrowDownRight from '../../../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.
|
|
12
|
+
import IconAlertTriangle from '../../../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.2.0/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertTriangle.js';
|
|
13
|
+
import IconHelpCircle from '../../../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.2.0/node_modules/@tabler/icons-react/dist/esm/icons/IconHelpCircle.js';
|
|
14
|
+
import IconArrowDownRight from '../../../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.2.0/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowDownRight.js';
|
|
15
|
+
import { useDiagram } from '../../../hooks/safeContext.js';
|
|
15
16
|
import { ElementShape } from '../../../base-primitives/element/ElementShape.js';
|
|
16
17
|
|
|
17
18
|
const ElementNotation = ({ value }) => {
|
|
@@ -4,21 +4,26 @@ import { XYStoreApi } from '../hooks';
|
|
|
4
4
|
import { Types } from './types';
|
|
5
5
|
type InternalNode = RFInternalNode<Types.AnyNode>;
|
|
6
6
|
declare abstract class Rect {
|
|
7
|
-
static readonly LeftPadding =
|
|
8
|
-
static readonly RightPadding =
|
|
9
|
-
static readonly TopPadding =
|
|
10
|
-
static readonly BottomPadding =
|
|
7
|
+
static readonly LeftPadding = 42;
|
|
8
|
+
static readonly RightPadding = 42;
|
|
9
|
+
static readonly TopPadding = 60;
|
|
10
|
+
static readonly BottomPadding = 42;
|
|
11
11
|
id: string;
|
|
12
12
|
minX: number;
|
|
13
13
|
minY: number;
|
|
14
14
|
maxX: number;
|
|
15
15
|
maxY: number;
|
|
16
|
+
readonly initialX: number;
|
|
17
|
+
readonly initialY: number;
|
|
16
18
|
get positionAbsolute(): XYPosition;
|
|
19
|
+
get initialPositionAbsolute(): XYPosition;
|
|
17
20
|
set positionAbsolute(pos: XYPosition);
|
|
18
21
|
get dimensions(): {
|
|
19
22
|
width: number;
|
|
20
23
|
height: number;
|
|
21
24
|
};
|
|
25
|
+
get diff(): XYPosition;
|
|
26
|
+
get isMoved(): boolean;
|
|
22
27
|
get position(): XYPosition;
|
|
23
28
|
protected abstract parent: CompoundRect | null;
|
|
24
29
|
constructor(xynode: InternalNode, parent?: CompoundRect | null);
|
|
@@ -34,8 +39,8 @@ declare class Leaf extends Rect {
|
|
|
34
39
|
}
|
|
35
40
|
export declare function createLayoutConstraints(xyflowApi: XYStoreApi, editingNodeIds: NonEmptyArray<string>): {
|
|
36
41
|
rects: ReadonlyMap<string, Leaf | CompoundRect>;
|
|
37
|
-
updateXYFlowNodes: () => void;
|
|
38
42
|
onMove: () => void;
|
|
43
|
+
updateXYFlow: () => void;
|
|
39
44
|
};
|
|
40
45
|
type LayoutConstraints = {
|
|
41
46
|
onNodeDragStart: OnNodeDrag<Types.Node>;
|
|
@@ -1,26 +1,40 @@
|
|
|
1
|
-
import { nonNullable } from '@likec4/core';
|
|
1
|
+
import { DefaultMap, nonNullable, BBox } from '@likec4/core';
|
|
2
|
+
import { isome, invariant } from '@likec4/core/utils';
|
|
2
3
|
import { getNodeDimensions } from '@xyflow/system';
|
|
4
|
+
import { produce } from 'immer';
|
|
3
5
|
import { useRef, useMemo } from 'react';
|
|
4
|
-
import { pipe, filter, hasAtLeast,
|
|
5
|
-
import
|
|
6
|
+
import { pipe, filter, map, hasAtLeast, flatMap, unique, difference, clamp } from 'remeda';
|
|
7
|
+
import '@xstate/react';
|
|
8
|
+
import 'fast-equals';
|
|
9
|
+
import { useDiagram } from '../hooks/safeContext.js';
|
|
10
|
+
import { nodeToRect, bezierControlPoints } from '../utils/xyflow.js';
|
|
6
11
|
import { useXYStoreApi } from '../hooks/useXYFlow.js';
|
|
12
|
+
import { vector } from '../utils/vector.js';
|
|
7
13
|
|
|
8
14
|
class Rect {
|
|
9
|
-
static LeftPadding =
|
|
10
|
-
static RightPadding =
|
|
11
|
-
static TopPadding =
|
|
12
|
-
static BottomPadding =
|
|
15
|
+
static LeftPadding = 42;
|
|
16
|
+
static RightPadding = 42;
|
|
17
|
+
static TopPadding = 60;
|
|
18
|
+
static BottomPadding = 42;
|
|
13
19
|
id;
|
|
14
20
|
minX = Infinity;
|
|
15
21
|
minY = Infinity;
|
|
16
22
|
maxX = -Infinity;
|
|
17
23
|
maxY = -Infinity;
|
|
24
|
+
initialX;
|
|
25
|
+
initialY;
|
|
18
26
|
get positionAbsolute() {
|
|
19
27
|
return {
|
|
20
28
|
x: this.minX,
|
|
21
29
|
y: this.minY
|
|
22
30
|
};
|
|
23
31
|
}
|
|
32
|
+
get initialPositionAbsolute() {
|
|
33
|
+
return {
|
|
34
|
+
x: this.initialX,
|
|
35
|
+
y: this.initialY
|
|
36
|
+
};
|
|
37
|
+
}
|
|
24
38
|
set positionAbsolute(pos) {
|
|
25
39
|
const x = Math.round(pos.x);
|
|
26
40
|
const y = Math.round(pos.y);
|
|
@@ -31,10 +45,19 @@ class Rect {
|
|
|
31
45
|
}
|
|
32
46
|
get dimensions() {
|
|
33
47
|
return {
|
|
34
|
-
width: this.maxX - this.minX,
|
|
35
|
-
height: this.maxY - this.minY
|
|
48
|
+
width: Math.round(this.maxX - this.minX),
|
|
49
|
+
height: Math.round(this.maxY - this.minY)
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
get diff() {
|
|
53
|
+
return {
|
|
54
|
+
x: Math.round(this.positionAbsolute.x - this.initialX),
|
|
55
|
+
y: Math.round(this.positionAbsolute.y - this.initialY)
|
|
36
56
|
};
|
|
37
57
|
}
|
|
58
|
+
get isMoved() {
|
|
59
|
+
return this.diff.x !== 0 || this.diff.y !== 0;
|
|
60
|
+
}
|
|
38
61
|
// Position relative to parent
|
|
39
62
|
get position() {
|
|
40
63
|
const positionAbsolute = this.positionAbsolute;
|
|
@@ -56,6 +79,8 @@ class Rect {
|
|
|
56
79
|
const { width, height } = getNodeDimensions(xynode);
|
|
57
80
|
this.maxX = this.minX + Math.ceil(width);
|
|
58
81
|
this.maxY = this.minY + Math.ceil(height);
|
|
82
|
+
this.initialX = this.positionAbsolute.x;
|
|
83
|
+
this.initialY = this.positionAbsolute.y;
|
|
59
84
|
if (parent) {
|
|
60
85
|
parent.children.push(this);
|
|
61
86
|
}
|
|
@@ -74,22 +99,132 @@ class Leaf extends Rect {
|
|
|
74
99
|
this.parent = parent;
|
|
75
100
|
}
|
|
76
101
|
}
|
|
102
|
+
function makeEdgeModifier(edge, anchor) {
|
|
103
|
+
const controlPoints = edge.data.controlPoints ?? null;
|
|
104
|
+
return (edgeLookup) => {
|
|
105
|
+
const current = nonNullable(edgeLookup.get(edge.id), `Edge ${edge.id} not found`);
|
|
106
|
+
const { x: dx, y: dy } = anchor.diff;
|
|
107
|
+
if (dx === 0 && dy === 0) {
|
|
108
|
+
return {
|
|
109
|
+
id: edge.id,
|
|
110
|
+
type: "replace",
|
|
111
|
+
item: produce(current, (draft) => {
|
|
112
|
+
draft.data.points = edge.data.points;
|
|
113
|
+
draft.data.controlPoints = controlPoints;
|
|
114
|
+
draft.data.labelBBox = edge.data.labelBBox;
|
|
115
|
+
})
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
id: edge.id,
|
|
120
|
+
type: "replace",
|
|
121
|
+
item: produce(current, (draft) => {
|
|
122
|
+
draft.data.points = map(edge.data.points, (pt) => [pt[0] + dx, pt[1] + dy]);
|
|
123
|
+
if (controlPoints) {
|
|
124
|
+
draft.data.controlPoints = controlPoints.map((pt) => ({
|
|
125
|
+
x: pt.x + dx,
|
|
126
|
+
y: pt.y + dy
|
|
127
|
+
}));
|
|
128
|
+
}
|
|
129
|
+
if (edge.data.labelBBox) {
|
|
130
|
+
draft.data.labelBBox = {
|
|
131
|
+
x: edge.data.labelBBox.x + dx,
|
|
132
|
+
y: edge.data.labelBBox.y + dy,
|
|
133
|
+
width: edge.data.labelBBox.width,
|
|
134
|
+
height: edge.data.labelBBox.height
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
})
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
function makeRelativeEdgeModifier(edge, movingRect, anchorNode, staticNode) {
|
|
142
|
+
const controlPoints = edge.data.controlPoints ?? bezierControlPoints(edge.data.points);
|
|
143
|
+
const anchorV = vector(BBox.center(anchorNode));
|
|
144
|
+
const staticV = vector(BBox.center(staticNode));
|
|
145
|
+
const staticToAnchor = anchorV.subtract(staticV);
|
|
146
|
+
const staticToAnchorLength = staticToAnchor.length();
|
|
147
|
+
return (edgeLookup) => {
|
|
148
|
+
const current = nonNullable(edgeLookup.get(edge.id), `Edge ${edge.id} not found`);
|
|
149
|
+
const { x: dx, y: dy } = movingRect.diff;
|
|
150
|
+
if (dx === 0 && dy === 0) {
|
|
151
|
+
return {
|
|
152
|
+
id: edge.id,
|
|
153
|
+
type: "replace",
|
|
154
|
+
item: produce(current, (draft) => {
|
|
155
|
+
draft.data.points = edge.data.points;
|
|
156
|
+
draft.data.controlPoints = edge.data.controlPoints;
|
|
157
|
+
draft.data.labelBBox = edge.data.labelBBox;
|
|
158
|
+
})
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
const d = vector(dx, dy);
|
|
162
|
+
const relativePoint = (pt) => {
|
|
163
|
+
const p = vector(pt);
|
|
164
|
+
const staticToP = p.subtract(staticV);
|
|
165
|
+
const projLength = staticToP.dot(staticToAnchor);
|
|
166
|
+
const coeff = clamp(projLength / staticToAnchorLength ** 2, {
|
|
167
|
+
min: -1,
|
|
168
|
+
max: 1
|
|
169
|
+
});
|
|
170
|
+
const newP = p.add(d.multiply(coeff)).round();
|
|
171
|
+
return {
|
|
172
|
+
x: newP.x,
|
|
173
|
+
y: newP.y
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
return {
|
|
177
|
+
id: edge.id,
|
|
178
|
+
type: "replace",
|
|
179
|
+
item: produce(current, (draft) => {
|
|
180
|
+
draft.data.controlPoints = controlPoints.map(relativePoint);
|
|
181
|
+
if (edge.data.labelBBox) {
|
|
182
|
+
draft.data.labelBBox ??= edge.data.labelBBox;
|
|
183
|
+
const { x, y } = relativePoint(edge.data.labelBBox);
|
|
184
|
+
draft.data.labelBBox.x = x;
|
|
185
|
+
draft.data.labelBBox.y = y;
|
|
186
|
+
}
|
|
187
|
+
})
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
}
|
|
77
191
|
function createLayoutConstraints(xyflowApi, editingNodeIds) {
|
|
78
|
-
const { parentLookup, nodeLookup } = xyflowApi.getState();
|
|
192
|
+
const { parentLookup, nodeLookup, edges, edgeLookup } = xyflowApi.getState();
|
|
79
193
|
const rects = /* @__PURE__ */ new Map();
|
|
80
|
-
const ancestorsOf = (nodeId) => {
|
|
81
|
-
const ancestors = [];
|
|
194
|
+
const ancestorsOf = new DefaultMap((nodeId) => {
|
|
82
195
|
const xynode = nodeLookup.get(nodeId);
|
|
83
196
|
let parent = xynode?.parentId;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
ancestors.push(parentNode.id);
|
|
87
|
-
parent = parentNode.parentId;
|
|
197
|
+
if (!parent) {
|
|
198
|
+
return [];
|
|
88
199
|
}
|
|
89
|
-
return
|
|
90
|
-
};
|
|
200
|
+
return [parent, ...ancestorsOf.get(parent)];
|
|
201
|
+
});
|
|
202
|
+
const nestedOf = new DefaultMap((nodeId) => {
|
|
203
|
+
const children = parentLookup.get(nodeId);
|
|
204
|
+
if (!children || children.size === 0) {
|
|
205
|
+
return /* @__PURE__ */ new Set();
|
|
206
|
+
}
|
|
207
|
+
const nested = /* @__PURE__ */ new Set();
|
|
208
|
+
for (const child of children.values()) {
|
|
209
|
+
nested.add(child.id);
|
|
210
|
+
for (const desc of nestedOf.get(child.id)) {
|
|
211
|
+
nested.add(desc);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return nested;
|
|
215
|
+
});
|
|
216
|
+
if (hasAtLeast(editingNodeIds, 2)) {
|
|
217
|
+
const leafsOnly = pipe(
|
|
218
|
+
editingNodeIds,
|
|
219
|
+
flatMap((id) => [...nestedOf.get(id)]),
|
|
220
|
+
unique(),
|
|
221
|
+
(exclude) => difference(editingNodeIds, exclude)
|
|
222
|
+
);
|
|
223
|
+
invariant(hasAtLeast(leafsOnly, 1), "All editing nodes are nested within each other");
|
|
224
|
+
editingNodeIds = leafsOnly;
|
|
225
|
+
}
|
|
91
226
|
const ancestorsOfDraggingNodes = new Set(
|
|
92
|
-
editingNodeIds.flatMap(ancestorsOf)
|
|
227
|
+
editingNodeIds.flatMap((i) => ancestorsOf.get(i))
|
|
93
228
|
);
|
|
94
229
|
const traverse = [...nodeLookup.values()].flatMap(
|
|
95
230
|
(x) => !x.parentId ? { xynode: x, parent: null } : []
|
|
@@ -97,7 +232,7 @@ function createLayoutConstraints(xyflowApi, editingNodeIds) {
|
|
|
97
232
|
while (traverse.length > 0) {
|
|
98
233
|
const { xynode, parent } = traverse.shift();
|
|
99
234
|
const isEditing = editingNodeIds.includes(xynode.id);
|
|
100
|
-
const shouldTraverse = !isEditing &&
|
|
235
|
+
const shouldTraverse = !isEditing && ancestorsOfDraggingNodes.has(xynode.id);
|
|
101
236
|
if (shouldTraverse) {
|
|
102
237
|
const rect = new CompoundRect(xynode, parent);
|
|
103
238
|
rects.set(xynode.id, rect);
|
|
@@ -107,12 +242,49 @@ function createLayoutConstraints(xyflowApi, editingNodeIds) {
|
|
|
107
242
|
parent: rect
|
|
108
243
|
});
|
|
109
244
|
});
|
|
110
|
-
|
|
111
|
-
rects.set(xynode.id, new Leaf(xynode, parent));
|
|
245
|
+
continue;
|
|
112
246
|
}
|
|
247
|
+
rects.set(xynode.id, new Leaf(xynode, parent));
|
|
113
248
|
}
|
|
114
249
|
const rectsToUpdate = [...rects.values()];
|
|
115
|
-
|
|
250
|
+
const edgeModifiers = /* @__PURE__ */ new Map();
|
|
251
|
+
const findMovingAncestor = (nodeId) => {
|
|
252
|
+
return rects.get(nodeId) ?? ancestorsOf.get(nodeId).map((id) => rects.get(id)).find((s) => !!s) ?? null;
|
|
253
|
+
};
|
|
254
|
+
const movingNodes = new Set(editingNodeIds.flatMap((id) => [id, ...nestedOf.get(id)]));
|
|
255
|
+
for (const edge of edges) {
|
|
256
|
+
const isSourceMoving = movingNodes.has(edge.source);
|
|
257
|
+
const isTargetMoving = movingNodes.has(edge.target);
|
|
258
|
+
if (isSourceMoving && isTargetMoving) {
|
|
259
|
+
let r = rects.get(edge.source) ?? rects.get(edge.target) ?? findMovingAncestor(edge.source) ?? findMovingAncestor(edge.target);
|
|
260
|
+
if (r) {
|
|
261
|
+
edgeModifiers.set(edge, makeEdgeModifier(edge, r));
|
|
262
|
+
}
|
|
263
|
+
continue;
|
|
264
|
+
}
|
|
265
|
+
if (isSourceMoving !== isTargetMoving) {
|
|
266
|
+
const movingRect = isSourceMoving ? findMovingAncestor(edge.source) : findMovingAncestor(edge.target);
|
|
267
|
+
if (!movingRect) {
|
|
268
|
+
continue;
|
|
269
|
+
}
|
|
270
|
+
const [sourceNode, targetNode] = pipe(
|
|
271
|
+
[edge.source, edge.target],
|
|
272
|
+
map((id) => nonNullable(nodeLookup.get(id), `Node ${id} not found`)),
|
|
273
|
+
map(nodeToRect)
|
|
274
|
+
);
|
|
275
|
+
const [anchorNode, staticNode] = isSourceMoving ? [sourceNode, targetNode] : [targetNode, sourceNode];
|
|
276
|
+
edgeModifiers.set(
|
|
277
|
+
edge,
|
|
278
|
+
makeRelativeEdgeModifier(
|
|
279
|
+
edge,
|
|
280
|
+
movingRect,
|
|
281
|
+
anchorNode,
|
|
282
|
+
staticNode
|
|
283
|
+
)
|
|
284
|
+
);
|
|
285
|
+
continue;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
116
288
|
function applyConstraints(targets) {
|
|
117
289
|
for (const r of targets) {
|
|
118
290
|
if (!(r instanceof CompoundRect)) {
|
|
@@ -137,28 +309,33 @@ function createLayoutConstraints(xyflowApi, editingNodeIds) {
|
|
|
137
309
|
r.maxY = childrenBB.maxY + Rect.BottomPadding;
|
|
138
310
|
}
|
|
139
311
|
}
|
|
140
|
-
|
|
312
|
+
const _edgeModifiers = [...edgeModifiers.values()];
|
|
313
|
+
function updateXYFlow() {
|
|
141
314
|
applyConstraints(rectsToUpdate);
|
|
142
|
-
|
|
143
|
-
|
|
315
|
+
const nodeUpdates = rectsToUpdate.reduce((acc, r) => {
|
|
316
|
+
acc.push({
|
|
317
|
+
id: r.id,
|
|
318
|
+
type: "position",
|
|
319
|
+
dragging: false,
|
|
320
|
+
position: r.position,
|
|
321
|
+
positionAbsolute: r.positionAbsolute
|
|
322
|
+
});
|
|
323
|
+
if (r instanceof CompoundRect) {
|
|
144
324
|
acc.push({
|
|
145
325
|
id: r.id,
|
|
146
|
-
type: "
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
positionAbsolute: r.positionAbsolute
|
|
326
|
+
type: "dimensions",
|
|
327
|
+
setAttributes: true,
|
|
328
|
+
dimensions: r.dimensions
|
|
150
329
|
});
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}, [])
|
|
161
|
-
);
|
|
330
|
+
}
|
|
331
|
+
return acc;
|
|
332
|
+
}, []);
|
|
333
|
+
const { edgeLookup: edgeLookup2, triggerNodeChanges, triggerEdgeChanges } = xyflowApi.getState();
|
|
334
|
+
triggerNodeChanges(nodeUpdates);
|
|
335
|
+
const changes = _edgeModifiers.map((fm) => fm(edgeLookup2));
|
|
336
|
+
if (changes.length > 0) {
|
|
337
|
+
triggerEdgeChanges(changes);
|
|
338
|
+
}
|
|
162
339
|
}
|
|
163
340
|
let animationFrameId = null;
|
|
164
341
|
function onMove() {
|
|
@@ -167,19 +344,26 @@ function createLayoutConstraints(xyflowApi, editingNodeIds) {
|
|
|
167
344
|
}
|
|
168
345
|
animationFrameId ??= requestAnimationFrame(() => {
|
|
169
346
|
animationFrameId = null;
|
|
170
|
-
const { nodeLookup: nodeLookup2 } = xyflowApi.getState();
|
|
171
347
|
for (const id of editingNodeIds) {
|
|
172
|
-
const rect =
|
|
173
|
-
|
|
348
|
+
const rect = rects.get(id);
|
|
349
|
+
if (!rect) {
|
|
350
|
+
console.warn(`Rect not found for id ${id}`);
|
|
351
|
+
continue;
|
|
352
|
+
}
|
|
353
|
+
const node = nodeLookup.get(id);
|
|
354
|
+
if (!node) {
|
|
355
|
+
console.warn(`Node not found for id ${id}`);
|
|
356
|
+
continue;
|
|
357
|
+
}
|
|
174
358
|
rect.positionAbsolute = node.internals.positionAbsolute;
|
|
175
359
|
}
|
|
176
|
-
|
|
360
|
+
updateXYFlow();
|
|
177
361
|
});
|
|
178
362
|
}
|
|
179
363
|
return {
|
|
180
364
|
rects,
|
|
181
|
-
|
|
182
|
-
|
|
365
|
+
onMove,
|
|
366
|
+
updateXYFlow
|
|
183
367
|
};
|
|
184
368
|
}
|
|
185
369
|
function useLayoutConstraints() {
|
|
@@ -187,33 +371,25 @@ function useLayoutConstraints() {
|
|
|
187
371
|
const diagram = useDiagram();
|
|
188
372
|
const solverRef = useRef(void 0);
|
|
189
373
|
return useMemo(() => {
|
|
190
|
-
let wasPending = false;
|
|
191
|
-
const initial = { x: 0, y: 0 };
|
|
192
|
-
let moved = false;
|
|
193
374
|
return {
|
|
194
375
|
onNodeDragStart: (_event, xynode) => {
|
|
195
|
-
|
|
376
|
+
diagram.startEditing("node");
|
|
196
377
|
const { nodeLookup } = xystore.getState();
|
|
197
378
|
const draggingNodes = pipe(
|
|
198
379
|
Array.from(nodeLookup.values()),
|
|
199
|
-
filter((n) => n.
|
|
380
|
+
filter((n) => n.dragging === true || n.id === xynode.id || n.selected === true),
|
|
381
|
+
map((n) => n.id)
|
|
200
382
|
);
|
|
201
383
|
if (hasAtLeast(draggingNodes, 1)) {
|
|
202
|
-
solverRef.current = createLayoutConstraints(xystore,
|
|
384
|
+
solverRef.current = createLayoutConstraints(xystore, draggingNodes);
|
|
203
385
|
}
|
|
204
|
-
initial.x = _event.clientX;
|
|
205
|
-
initial.y = _event.clientY;
|
|
206
|
-
moved = false;
|
|
207
386
|
},
|
|
208
387
|
onNodeDrag: (_event) => {
|
|
209
|
-
moved = Math.abs(_event.clientX - initial.x) > 4 || Math.abs(_event.clientY - initial.y) > 4;
|
|
210
388
|
solverRef.current?.onMove();
|
|
211
389
|
},
|
|
212
390
|
onNodeDragStop: (_event) => {
|
|
213
|
-
moved =
|
|
214
|
-
|
|
215
|
-
diagram.scheduleSaveManualLayout();
|
|
216
|
-
}
|
|
391
|
+
const moved = solverRef.current ? isome(solverRef.current.rects.values(), (r) => r.isMoved) : false;
|
|
392
|
+
diagram.stopEditing(moved);
|
|
217
393
|
solverRef.current = void 0;
|
|
218
394
|
}
|
|
219
395
|
};
|