@likec4/diagram 1.42.1 → 1.44.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 +6198 -4860
- package/dist/LikeC4Diagram.d.ts +1 -1
- package/dist/LikeC4Diagram.js +15 -12
- package/dist/LikeC4Diagram.props.d.ts +28 -14
- package/dist/LikeC4ProjectsProvider.js +1 -1
- package/dist/LikeC4View.d.ts +28 -4
- package/dist/LikeC4View.js +28 -17
- package/dist/ReactLikeC4.d.ts +1 -1
- package/dist/ReactLikeC4.js +5 -7
- package/dist/StaticLikeC4Diagram.js +2 -2
- 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/const.d.ts +1 -1
- package/dist/base/const.js +1 -1
- package/dist/base/index.d.ts +6 -2
- package/dist/base/types.d.ts +1 -28
- package/dist/base/updateEdges.js +4 -3
- package/dist/base/updateNodes.js +3 -2
- package/dist/base-primitives/compound/CompoundActionButton.js +1 -1
- package/dist/base-primitives/compound/CompoundDetailsButton.js +1 -1
- 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 +4 -0
- package/dist/base-primitives/edge/EdgeLabel.d.ts +1 -0
- 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 +9 -5
- package/dist/base-primitives/element/ElementActionButtons.d.ts +3 -2
- package/dist/base-primitives/element/ElementActionButtons.js +1 -1
- package/dist/base-primitives/element/ElementDetailsButton.js +2 -5
- package/dist/base-primitives/element/ElementNodeContainer.css.js +15 -27
- 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 +24 -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 +2 -18
- package/dist/context/index.d.ts +1 -1
- package/dist/custom/customNodes.js +3 -2
- package/dist/custom/hooks.d.ts +1 -1
- package/dist/custom/index.d.ts +1 -1
- package/dist/custom/index.js +4 -4
- package/dist/editor/LikeC4EditorContext.d.ts +21 -0
- package/dist/editor/index.d.ts +2 -0
- package/dist/hooks/index.d.ts +2 -1
- 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 +60 -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 +54 -51
- package/dist/likec4diagram/convert-to-xyflow.d.ts +0 -1
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +249 -220
- package/dist/likec4diagram/custom/edges/SequenceStepEdge.js +7 -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/ElementNodeDrifts.d.ts +4 -0
- package/dist/likec4diagram/custom/nodes/ElementNodeDrifts.js +46 -0
- package/dist/likec4diagram/custom/nodes/SequenceActorNode.js +4 -1
- package/dist/likec4diagram/custom/nodes/nodes.d.ts +9 -1
- package/dist/likec4diagram/custom/nodes/nodes.js +13 -9
- 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 +5 -7
- package/dist/likec4diagram/state/DiagramActorProvider.d.ts +3 -2
- package/dist/likec4diagram/state/DiagramActorProvider.js +96 -70
- package/dist/likec4diagram/state/assign.d.ts +4 -2
- package/dist/likec4diagram/state/assign.js +39 -103
- package/dist/likec4diagram/state/createViewChange.d.ts +3 -0
- package/dist/likec4diagram/state/createViewChange.js +90 -0
- package/dist/likec4diagram/state/diagram-api.d.ts +113 -0
- package/dist/likec4diagram/state/diagram-api.js +134 -0
- package/dist/likec4diagram/state/hotkeyActor.d.ts +7 -0
- package/dist/likec4diagram/state/hotkeyActor.js +17 -1
- package/dist/likec4diagram/state/machine.actions.d.ts +2099 -0
- package/dist/likec4diagram/state/machine.actions.js +735 -0
- package/dist/likec4diagram/state/machine.d.ts +3717 -0
- package/dist/likec4diagram/state/machine.js +141 -0
- package/dist/likec4diagram/state/machine.setup.d.ts +284 -0
- package/dist/likec4diagram/state/machine.setup.js +71 -0
- package/dist/likec4diagram/state/machine.state.initializing.d.ts +183 -0
- package/dist/likec4diagram/state/machine.state.initializing.js +55 -0
- package/dist/likec4diagram/state/machine.state.navigating.d.ts +117 -0
- package/dist/likec4diagram/state/machine.state.navigating.js +45 -0
- package/dist/likec4diagram/state/machine.state.ready.d.ts +3666 -0
- package/dist/likec4diagram/state/machine.state.ready.js +437 -0
- package/dist/likec4diagram/state/syncManualLayoutActor.d.ts +220 -63
- package/dist/likec4diagram/state/syncManualLayoutActor.js +218 -143
- package/dist/likec4diagram/state/types.d.ts +4 -7
- package/dist/likec4diagram/state/utils.d.ts +4 -2
- package/dist/likec4diagram/state/utils.js +4 -1
- package/dist/likec4diagram/types.d.ts +6 -1
- 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.js +10 -12
- package/dist/likec4diagram/useLayoutConstraints.d.ts +10 -5
- package/dist/likec4diagram/useLayoutConstraints.js +225 -54
- package/dist/likec4diagram/xyflow-diagram/diagram-view.d.ts +0 -1
- package/dist/likec4diagram/xyflow-diagram/diagram-view.js +15 -15
- package/dist/navigationpanel/NavigationPanel.js +11 -7
- 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 +11 -7
- package/dist/navigationpanel/actor.js +5 -4
- 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 +19 -16
- 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 +10 -10
- package/dist/navigationpanel/walkthrough/DynamicViewControls.js +31 -14
- package/dist/navigationpanel/walkthrough/WalkthroughPanel.d.ts +2 -1
- package/dist/navigationpanel/walkthrough/WalkthroughPanel.js +66 -49
- 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.js +18 -88
- package/dist/overlays/element-details/MetadataValue.d.ts +9 -0
- package/dist/overlays/element-details/MetadataValue.js +261 -0
- 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 +3 -2
- package/dist/overlays/overlaysActor.d.ts +304 -62
- package/dist/overlays/overlaysActor.js +132 -131
- package/dist/overlays/relationship-details/RelationshipDetails.js +4 -3
- package/dist/overlays/relationship-details/SelectEdge.js +2 -2
- package/dist/overlays/relationship-details/actor.d.ts +14 -2
- package/dist/overlays/relationship-details/actor.js +23 -5
- 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/relationships-browser/RelationshipsBrowser.js +6 -4
- package/dist/overlays/relationships-browser/SelectElement.js +2 -2
- package/dist/overlays/relationships-browser/actor.d.ts +239 -173
- package/dist/overlays/relationships-browser/actor.js +132 -110
- package/dist/overlays/relationships-browser/const.d.ts +3 -3
- package/dist/overlays/relationships-browser/const.js +3 -3
- 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/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/shadowroot/ShadowRoot.js +53 -12
- package/dist/shadowroot/styles.css.d.ts +0 -4
- package/dist/shadowroot/styles.css.js +1 -41
- package/dist/styles.css2.js +1 -1
- package/dist/utils/index.d.ts +4 -4
- package/dist/utils/vector.d.ts +78 -21
- package/dist/utils/vector.js +91 -24
- package/dist/utils/view-bounds.d.ts +8 -0
- package/dist/utils/view-bounds.js +57 -0
- package/dist/utils/xyflow.d.ts +49 -7
- package/dist/utils/xyflow.js +63 -11
- package/package.json +28 -27
- package/panda.buildinfo.json +140 -83
- 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,26 +1,40 @@
|
|
|
1
|
-
import { nonNullable } from '@likec4/core';
|
|
1
|
+
import { DefaultMap, nonNullable } from '@likec4/core';
|
|
2
|
+
import { isome } 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, map } from 'remeda';
|
|
5
|
-
import
|
|
6
|
+
import { pipe, filter, hasAtLeast, map, forEach } from 'remeda';
|
|
7
|
+
import '@xstate/react';
|
|
8
|
+
import 'fast-equals';
|
|
9
|
+
import { useDiagram } from '../hooks/safeContext.js';
|
|
10
|
+
import { bezierControlPoints, getNodeIntersection } 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);
|
|
@@ -35,6 +49,15 @@ class Rect {
|
|
|
35
49
|
height: this.maxY - this.minY
|
|
36
50
|
};
|
|
37
51
|
}
|
|
52
|
+
get diff() {
|
|
53
|
+
return {
|
|
54
|
+
x: this.positionAbsolute.x - this.initialX,
|
|
55
|
+
y: this.positionAbsolute.y - this.initialY
|
|
56
|
+
};
|
|
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,78 @@ class Leaf extends Rect {
|
|
|
74
99
|
this.parent = parent;
|
|
75
100
|
}
|
|
76
101
|
}
|
|
102
|
+
function makeEdgeModifier(edge, anchor) {
|
|
103
|
+
return (edgeLookup) => {
|
|
104
|
+
const current = nonNullable(edgeLookup.get(edge.id), `Edge ${edge.id} not found`);
|
|
105
|
+
const { x: dx, y: dy } = anchor.diff;
|
|
106
|
+
if (dx === 0 && dy === 0) {
|
|
107
|
+
return {
|
|
108
|
+
id: edge.id,
|
|
109
|
+
type: "replace",
|
|
110
|
+
item: produce(current, (draft) => {
|
|
111
|
+
draft.data.points = edge.data.points;
|
|
112
|
+
draft.data.controlPoints = edge.data.controlPoints;
|
|
113
|
+
draft.data.labelXY = edge.data.labelXY;
|
|
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 (edge.data.controlPoints) {
|
|
124
|
+
draft.data.controlPoints = (edge.data.controlPoints ?? []).map((pt) => ({
|
|
125
|
+
x: pt.x + dx,
|
|
126
|
+
y: pt.y + dy
|
|
127
|
+
}));
|
|
128
|
+
}
|
|
129
|
+
if (edge.data.labelXY) {
|
|
130
|
+
draft.data.labelXY = {
|
|
131
|
+
x: edge.data.labelXY.x + dx,
|
|
132
|
+
y: edge.data.labelXY.y + dy
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
if (edge.data.labelBBox) {
|
|
136
|
+
draft.data.labelBBox = {
|
|
137
|
+
x: edge.data.labelBBox.x + dx,
|
|
138
|
+
y: edge.data.labelBBox.y + dy,
|
|
139
|
+
width: edge.data.labelBBox.width,
|
|
140
|
+
height: edge.data.labelBBox.height
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
})
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
}
|
|
77
147
|
function createLayoutConstraints(xyflowApi, editingNodeIds) {
|
|
78
|
-
const { parentLookup, nodeLookup } = xyflowApi.getState();
|
|
148
|
+
const { parentLookup, nodeLookup, edges, edgeLookup } = xyflowApi.getState();
|
|
79
149
|
const rects = /* @__PURE__ */ new Map();
|
|
80
|
-
const ancestorsOf = (nodeId) => {
|
|
81
|
-
const ancestors = [];
|
|
150
|
+
const ancestorsOf = new DefaultMap((nodeId) => {
|
|
82
151
|
const xynode = nodeLookup.get(nodeId);
|
|
83
152
|
let parent = xynode?.parentId;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
ancestors.push(parentNode.id);
|
|
87
|
-
parent = parentNode.parentId;
|
|
153
|
+
if (!parent) {
|
|
154
|
+
return [];
|
|
88
155
|
}
|
|
89
|
-
return
|
|
90
|
-
};
|
|
156
|
+
return [parent, ...ancestorsOf.get(parent)];
|
|
157
|
+
});
|
|
158
|
+
const nestedOf = new DefaultMap((nodeId) => {
|
|
159
|
+
const children = parentLookup.get(nodeId);
|
|
160
|
+
if (!children || children.size === 0) {
|
|
161
|
+
return /* @__PURE__ */ new Set();
|
|
162
|
+
}
|
|
163
|
+
const nested = /* @__PURE__ */ new Set();
|
|
164
|
+
for (const child of children.values()) {
|
|
165
|
+
nested.add(child.id);
|
|
166
|
+
for (const desc of nestedOf.get(child.id)) {
|
|
167
|
+
nested.add(desc);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return nested;
|
|
171
|
+
});
|
|
91
172
|
const ancestorsOfDraggingNodes = new Set(
|
|
92
|
-
editingNodeIds.flatMap(ancestorsOf)
|
|
173
|
+
editingNodeIds.flatMap((i) => ancestorsOf.get(i))
|
|
93
174
|
);
|
|
94
175
|
const traverse = [...nodeLookup.values()].flatMap(
|
|
95
176
|
(x) => !x.parentId ? { xynode: x, parent: null } : []
|
|
@@ -97,7 +178,7 @@ function createLayoutConstraints(xyflowApi, editingNodeIds) {
|
|
|
97
178
|
while (traverse.length > 0) {
|
|
98
179
|
const { xynode, parent } = traverse.shift();
|
|
99
180
|
const isEditing = editingNodeIds.includes(xynode.id);
|
|
100
|
-
const shouldTraverse = !isEditing &&
|
|
181
|
+
const shouldTraverse = !isEditing && ancestorsOfDraggingNodes.has(xynode.id);
|
|
101
182
|
if (shouldTraverse) {
|
|
102
183
|
const rect = new CompoundRect(xynode, parent);
|
|
103
184
|
rects.set(xynode.id, rect);
|
|
@@ -112,7 +193,103 @@ function createLayoutConstraints(xyflowApi, editingNodeIds) {
|
|
|
112
193
|
}
|
|
113
194
|
}
|
|
114
195
|
const rectsToUpdate = [...rects.values()];
|
|
115
|
-
|
|
196
|
+
const edgeModifiers = /* @__PURE__ */ new Map();
|
|
197
|
+
for (const r of rectsToUpdate) {
|
|
198
|
+
if (r instanceof CompoundRect) {
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
const nested = nestedOf.get(r.id);
|
|
202
|
+
if (nested.size === 0) {
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
pipe(
|
|
206
|
+
edges,
|
|
207
|
+
filter((e) => !edgeModifiers.has(e) && nested.has(e.source) && nested.has(e.target)),
|
|
208
|
+
forEach((e) => {
|
|
209
|
+
edgeModifiers.set(e, makeEdgeModifier(e, r));
|
|
210
|
+
})
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
const findMovingAncestor = (nodeId) => {
|
|
214
|
+
return rects.get(nodeId) ?? ancestorsOf.get(nodeId).map((id) => rects.get(id)).find((s) => !!s) ?? null;
|
|
215
|
+
};
|
|
216
|
+
const movingNodes = new Set(editingNodeIds.flatMap((id) => [id, ...nestedOf.get(id)]));
|
|
217
|
+
for (const edge of edges) {
|
|
218
|
+
if (edgeModifiers.has(edge)) {
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
const isSourceMoving = movingNodes.has(edge.source);
|
|
222
|
+
const isTargetMoving = movingNodes.has(edge.target);
|
|
223
|
+
if (isSourceMoving && isTargetMoving) {
|
|
224
|
+
let r = rects.get(edge.source) ?? rects.get(edge.target) ?? ancestorsOf.get(edge.source).map((id) => rects.get(id)).find((s) => !!s) ?? ancestorsOf.get(edge.target).map((id) => rects.get(id)).find((s) => !!s);
|
|
225
|
+
if (r) {
|
|
226
|
+
edgeModifiers.set(edge, makeEdgeModifier(edge, r));
|
|
227
|
+
}
|
|
228
|
+
continue;
|
|
229
|
+
}
|
|
230
|
+
if (isSourceMoving !== isTargetMoving) {
|
|
231
|
+
const movingRect = isSourceMoving ? findMovingAncestor(edge.source) : findMovingAncestor(edge.target);
|
|
232
|
+
if (!movingRect) {
|
|
233
|
+
continue;
|
|
234
|
+
}
|
|
235
|
+
const controlPoints = edge.data.controlPoints ?? bezierControlPoints(edge.data.points);
|
|
236
|
+
const sourceNode = nonNullable(nodeLookup.get(edge.source), `Source node ${edge.source} not found`);
|
|
237
|
+
const targetNode = nonNullable(nodeLookup.get(edge.target), `Target node ${edge.target} not found`);
|
|
238
|
+
const sourceIntersectionPoint = vector(getNodeIntersection(sourceNode, targetNode));
|
|
239
|
+
const targetIntersectionPoint = vector(getNodeIntersection(targetNode, sourceNode));
|
|
240
|
+
const [anchorV, staticV] = isSourceMoving ? [sourceIntersectionPoint, targetIntersectionPoint] : [targetIntersectionPoint, sourceIntersectionPoint];
|
|
241
|
+
const staticToAnchor = anchorV.subtract(staticV);
|
|
242
|
+
const staticToAnchorLength = staticToAnchor.length();
|
|
243
|
+
edgeModifiers.set(edge, (edgeLookup2) => {
|
|
244
|
+
const current = nonNullable(edgeLookup2.get(edge.id), `Edge ${edge.id} not found`);
|
|
245
|
+
const { x: dx, y: dy } = movingRect.diff;
|
|
246
|
+
if (dx === 0 && dy === 0) {
|
|
247
|
+
return {
|
|
248
|
+
id: edge.id,
|
|
249
|
+
type: "replace",
|
|
250
|
+
item: produce(current, (draft) => {
|
|
251
|
+
draft.data.points = edge.data.points;
|
|
252
|
+
draft.data.controlPoints = edge.data.controlPoints;
|
|
253
|
+
draft.data.labelXY = edge.data.labelXY;
|
|
254
|
+
draft.data.labelBBox = edge.data.labelBBox;
|
|
255
|
+
})
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
const d = vector(dx, dy);
|
|
259
|
+
const relativePoint = (pt) => {
|
|
260
|
+
const p = vector(pt);
|
|
261
|
+
const staticToP = p.subtract(staticV);
|
|
262
|
+
const projLength = staticToP.dot(staticToAnchor);
|
|
263
|
+
const coeff = Math.min(projLength / staticToAnchorLength ** 2, 1);
|
|
264
|
+
const newP = p.add(d.multiply(coeff));
|
|
265
|
+
return {
|
|
266
|
+
x: Math.round(newP.x),
|
|
267
|
+
y: Math.round(newP.y)
|
|
268
|
+
};
|
|
269
|
+
};
|
|
270
|
+
return {
|
|
271
|
+
id: edge.id,
|
|
272
|
+
type: "replace",
|
|
273
|
+
item: produce(current, (draft) => {
|
|
274
|
+
draft.data.controlPoints = controlPoints.map(relativePoint);
|
|
275
|
+
if (edge.data.labelBBox) {
|
|
276
|
+
const { x, y } = relativePoint(edge.data.labelBBox);
|
|
277
|
+
draft.data.labelBBox = {
|
|
278
|
+
x,
|
|
279
|
+
y,
|
|
280
|
+
width: edge.data.labelBBox.width,
|
|
281
|
+
height: edge.data.labelBBox.height
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
if (edge.data.labelXY) {
|
|
285
|
+
draft.data.labelXY = relativePoint(edge.data.labelXY);
|
|
286
|
+
}
|
|
287
|
+
})
|
|
288
|
+
};
|
|
289
|
+
});
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
116
293
|
function applyConstraints(targets) {
|
|
117
294
|
for (const r of targets) {
|
|
118
295
|
if (!(r instanceof CompoundRect)) {
|
|
@@ -137,28 +314,32 @@ function createLayoutConstraints(xyflowApi, editingNodeIds) {
|
|
|
137
314
|
r.maxY = childrenBB.maxY + Rect.BottomPadding;
|
|
138
315
|
}
|
|
139
316
|
}
|
|
140
|
-
|
|
317
|
+
const _edgeModifiers = [...edgeModifiers.values()];
|
|
318
|
+
function updateXYFlow() {
|
|
141
319
|
applyConstraints(rectsToUpdate);
|
|
142
|
-
|
|
143
|
-
|
|
320
|
+
const nodeUpdates = rectsToUpdate.reduce((acc, r) => {
|
|
321
|
+
acc.push({
|
|
322
|
+
id: r.id,
|
|
323
|
+
type: "position",
|
|
324
|
+
dragging: false,
|
|
325
|
+
position: r.position,
|
|
326
|
+
positionAbsolute: r.positionAbsolute
|
|
327
|
+
});
|
|
328
|
+
if (r instanceof CompoundRect) {
|
|
144
329
|
acc.push({
|
|
145
330
|
id: r.id,
|
|
146
|
-
type: "
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
positionAbsolute: r.positionAbsolute
|
|
331
|
+
type: "dimensions",
|
|
332
|
+
setAttributes: true,
|
|
333
|
+
dimensions: r.dimensions
|
|
150
334
|
});
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
return acc;
|
|
160
|
-
}, [])
|
|
161
|
-
);
|
|
335
|
+
}
|
|
336
|
+
return acc;
|
|
337
|
+
}, []);
|
|
338
|
+
xyflowApi.getState().triggerNodeChanges(nodeUpdates);
|
|
339
|
+
const changes = _edgeModifiers.map((fm) => fm(edgeLookup));
|
|
340
|
+
if (changes.length > 0) {
|
|
341
|
+
xyflowApi.getState().triggerEdgeChanges(changes);
|
|
342
|
+
}
|
|
162
343
|
}
|
|
163
344
|
let animationFrameId = null;
|
|
164
345
|
function onMove() {
|
|
@@ -167,19 +348,18 @@ function createLayoutConstraints(xyflowApi, editingNodeIds) {
|
|
|
167
348
|
}
|
|
168
349
|
animationFrameId ??= requestAnimationFrame(() => {
|
|
169
350
|
animationFrameId = null;
|
|
170
|
-
const { nodeLookup: nodeLookup2 } = xyflowApi.getState();
|
|
171
351
|
for (const id of editingNodeIds) {
|
|
172
352
|
const rect = nonNullable(rects.get(id));
|
|
173
|
-
const node = nonNullable(
|
|
353
|
+
const node = nonNullable(nodeLookup.get(id));
|
|
174
354
|
rect.positionAbsolute = node.internals.positionAbsolute;
|
|
175
355
|
}
|
|
176
|
-
|
|
356
|
+
updateXYFlow();
|
|
177
357
|
});
|
|
178
358
|
}
|
|
179
359
|
return {
|
|
180
360
|
rects,
|
|
181
|
-
|
|
182
|
-
|
|
361
|
+
onMove,
|
|
362
|
+
updateXYFlow
|
|
183
363
|
};
|
|
184
364
|
}
|
|
185
365
|
function useLayoutConstraints() {
|
|
@@ -187,12 +367,9 @@ function useLayoutConstraints() {
|
|
|
187
367
|
const diagram = useDiagram();
|
|
188
368
|
const solverRef = useRef(void 0);
|
|
189
369
|
return useMemo(() => {
|
|
190
|
-
let wasPending = false;
|
|
191
|
-
const initial = { x: 0, y: 0 };
|
|
192
|
-
let moved = false;
|
|
193
370
|
return {
|
|
194
371
|
onNodeDragStart: (_event, xynode) => {
|
|
195
|
-
|
|
372
|
+
diagram.startEditing("node");
|
|
196
373
|
const { nodeLookup } = xystore.getState();
|
|
197
374
|
const draggingNodes = pipe(
|
|
198
375
|
Array.from(nodeLookup.values()),
|
|
@@ -201,19 +378,13 @@ function useLayoutConstraints() {
|
|
|
201
378
|
if (hasAtLeast(draggingNodes, 1)) {
|
|
202
379
|
solverRef.current = createLayoutConstraints(xystore, map(draggingNodes, (x) => x.id));
|
|
203
380
|
}
|
|
204
|
-
initial.x = _event.clientX;
|
|
205
|
-
initial.y = _event.clientY;
|
|
206
|
-
moved = false;
|
|
207
381
|
},
|
|
208
382
|
onNodeDrag: (_event) => {
|
|
209
|
-
moved = Math.abs(_event.clientX - initial.x) > 4 || Math.abs(_event.clientY - initial.y) > 4;
|
|
210
383
|
solverRef.current?.onMove();
|
|
211
384
|
},
|
|
212
385
|
onNodeDragStop: (_event) => {
|
|
213
|
-
moved =
|
|
214
|
-
|
|
215
|
-
diagram.scheduleSaveManualLayout();
|
|
216
|
-
}
|
|
386
|
+
const moved = solverRef.current ? isome(solverRef.current.rects.values(), (r) => r.isMoved) : false;
|
|
387
|
+
diagram.stopEditing(moved);
|
|
217
388
|
solverRef.current = void 0;
|
|
218
389
|
}
|
|
219
390
|
};
|
|
@@ -4,8 +4,7 @@ import { ZIndexes } from '../../base/const.js';
|
|
|
4
4
|
|
|
5
5
|
function diagramToXY(opts) {
|
|
6
6
|
const {
|
|
7
|
-
view
|
|
8
|
-
nodesSelectable: selectable
|
|
7
|
+
view
|
|
9
8
|
} = opts;
|
|
10
9
|
const xynodes = [], xyedges = [], nodeLookup = /* @__PURE__ */ new Map();
|
|
11
10
|
const queue = Queue.from(view.nodes.reduce(
|
|
@@ -51,10 +50,9 @@ function diagramToXY(opts) {
|
|
|
51
50
|
position.y -= parent.y;
|
|
52
51
|
}
|
|
53
52
|
const id = ns + node.id;
|
|
53
|
+
const drifts = node.drifts ?? null;
|
|
54
54
|
const base = {
|
|
55
55
|
id,
|
|
56
|
-
selectable: selectable && node.kind !== GroupElementKind,
|
|
57
|
-
focusable: selectable && node.kind !== GroupElementKind,
|
|
58
56
|
deletable: false,
|
|
59
57
|
position,
|
|
60
58
|
zIndex: isCompound ? ZIndexes.Compound : ZIndexes.Element,
|
|
@@ -108,7 +106,7 @@ function diagramToXY(opts) {
|
|
|
108
106
|
isViewGroup: true,
|
|
109
107
|
...compoundData
|
|
110
108
|
},
|
|
111
|
-
dragHandle: ".likec4-compound-title"
|
|
109
|
+
dragHandle: ".likec4-compound-title-container"
|
|
112
110
|
});
|
|
113
111
|
continue;
|
|
114
112
|
}
|
|
@@ -129,9 +127,9 @@ function diagramToXY(opts) {
|
|
|
129
127
|
...compoundData,
|
|
130
128
|
...navigateTo,
|
|
131
129
|
deploymentFqn,
|
|
132
|
-
modelFqn
|
|
133
|
-
|
|
134
|
-
|
|
130
|
+
modelFqn,
|
|
131
|
+
drifts
|
|
132
|
+
}
|
|
135
133
|
}
|
|
136
134
|
);
|
|
137
135
|
break;
|
|
@@ -145,9 +143,9 @@ function diagramToXY(opts) {
|
|
|
145
143
|
data: {
|
|
146
144
|
...compoundData,
|
|
147
145
|
...navigateTo,
|
|
148
|
-
modelFqn
|
|
149
|
-
|
|
150
|
-
|
|
146
|
+
modelFqn,
|
|
147
|
+
drifts
|
|
148
|
+
}
|
|
151
149
|
}
|
|
152
150
|
);
|
|
153
151
|
break;
|
|
@@ -161,7 +159,8 @@ function diagramToXY(opts) {
|
|
|
161
159
|
...leafNodeData,
|
|
162
160
|
...navigateTo,
|
|
163
161
|
deploymentFqn,
|
|
164
|
-
modelFqn
|
|
162
|
+
modelFqn,
|
|
163
|
+
drifts
|
|
165
164
|
}
|
|
166
165
|
}
|
|
167
166
|
);
|
|
@@ -176,7 +175,8 @@ function diagramToXY(opts) {
|
|
|
176
175
|
data: {
|
|
177
176
|
...leafNodeData,
|
|
178
177
|
...navigateTo,
|
|
179
|
-
modelFqn
|
|
178
|
+
modelFqn,
|
|
179
|
+
drifts
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
);
|
|
@@ -197,7 +197,6 @@ function diagramToXY(opts) {
|
|
|
197
197
|
source: ns + source,
|
|
198
198
|
target: ns + target,
|
|
199
199
|
zIndex: ZIndexes.Edge,
|
|
200
|
-
selectable,
|
|
201
200
|
hidden: !visiblePredicate(edge),
|
|
202
201
|
deletable: false,
|
|
203
202
|
data: {
|
|
@@ -215,7 +214,8 @@ function diagramToXY(opts) {
|
|
|
215
214
|
dir: edge.dir ?? "forward",
|
|
216
215
|
head: edge.head ?? "normal",
|
|
217
216
|
tail: edge.tail ?? "none",
|
|
218
|
-
astPath: edge.astPath
|
|
217
|
+
astPath: edge.astPath,
|
|
218
|
+
drifts: edge.drifts ?? null
|
|
219
219
|
},
|
|
220
220
|
interactionWidth: 20
|
|
221
221
|
});
|
|
@@ -8,7 +8,8 @@ import { LayoutGroup, AnimatePresence } from 'motion/react';
|
|
|
8
8
|
import * as m from 'motion/react-m';
|
|
9
9
|
import { memo, useEffect } from 'react';
|
|
10
10
|
import { useDiagramActorRef } from '../hooks/safeContext.js';
|
|
11
|
-
import {
|
|
11
|
+
import { useCurrentView } from '../hooks/useCurrentView.js';
|
|
12
|
+
import { useOptionalCurrentViewModel } from '../hooks/useCurrentViewModel.js';
|
|
12
13
|
import { useDiagramContext } from '../hooks/useDiagram.js';
|
|
13
14
|
import { useMantinePortalProps } from '../hooks/useMantinePortalProps.js';
|
|
14
15
|
import { navigationPanelActorLogic } from './actor.js';
|
|
@@ -16,16 +17,19 @@ import { NavigationPanelActorContextProvider } from './hooks.js';
|
|
|
16
17
|
import { NavigationPanelControls } from './NavigationPanelControls.js';
|
|
17
18
|
import { NavigationPanelDropdown } from './NavigationPanelDropdown.js';
|
|
18
19
|
import { WalkthroughPanel } from './walkthrough/WalkthroughPanel.js';
|
|
20
|
+
import { ComparePanel } from './comparepanel/ComparePanel.js';
|
|
19
21
|
import { EditorPanel } from './editorpanel/EditorPanel.js';
|
|
20
22
|
import { ActiveWalkthroughControls } from './walkthrough/ActiveWalkthroughControls.js';
|
|
21
23
|
|
|
22
24
|
const NavigationPanel = memo(() => {
|
|
23
25
|
const diagramActor = useDiagramActorRef();
|
|
24
|
-
const
|
|
26
|
+
const view = useCurrentView();
|
|
27
|
+
const viewModel = useOptionalCurrentViewModel();
|
|
25
28
|
const actorRef = useActorRef(
|
|
26
29
|
navigationPanelActorLogic,
|
|
27
30
|
{
|
|
28
31
|
input: {
|
|
32
|
+
view,
|
|
29
33
|
viewModel
|
|
30
34
|
}
|
|
31
35
|
}
|
|
@@ -39,8 +43,8 @@ const NavigationPanel = memo(() => {
|
|
|
39
43
|
return () => subscription.unsubscribe();
|
|
40
44
|
}, [actorRef, diagramActor]);
|
|
41
45
|
useUpdateEffect(() => {
|
|
42
|
-
actorRef.send({ type: "update.inputs", inputs: { viewModel } });
|
|
43
|
-
}, [viewModel]);
|
|
46
|
+
actorRef.send({ type: "update.inputs", inputs: { viewModel, view } });
|
|
47
|
+
}, [viewModel, view]);
|
|
44
48
|
return /* @__PURE__ */ jsx(
|
|
45
49
|
VStack,
|
|
46
50
|
{
|
|
@@ -69,8 +73,9 @@ const NavigationPanel = memo(() => {
|
|
|
69
73
|
},
|
|
70
74
|
children: /* @__PURE__ */ jsxs(NavigationPanelActorContextProvider, { value: actorRef, children: [
|
|
71
75
|
/* @__PURE__ */ jsx(NavigationPanelImpl, { actor: actorRef }),
|
|
72
|
-
/* @__PURE__ */ jsx(
|
|
73
|
-
/* @__PURE__ */ jsx(WalkthroughPanel, {})
|
|
76
|
+
/* @__PURE__ */ jsx(ComparePanel, {}),
|
|
77
|
+
/* @__PURE__ */ jsx(WalkthroughPanel, {}),
|
|
78
|
+
/* @__PURE__ */ jsx(EditorPanel, {})
|
|
74
79
|
] })
|
|
75
80
|
}
|
|
76
81
|
);
|
|
@@ -109,7 +114,6 @@ const NavigationPanelPopoverTarget = ({ actor }) => {
|
|
|
109
114
|
position: "relative",
|
|
110
115
|
gap: "xs",
|
|
111
116
|
cursor: "pointer",
|
|
112
|
-
paddingRight: "md",
|
|
113
117
|
pointerEvents: "all",
|
|
114
118
|
width: "100%"
|
|
115
119
|
}),
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { MemoExoticComponent } from 'react';
|
|
2
|
+
export declare const NavigationPanelControls: MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { extractViewTitleFromPath } from '@likec4/core/model';
|
|
2
3
|
import { cx, css } from '@likec4/styles/css';
|
|
3
4
|
import { hstack } from '@likec4/styles/patterns';
|
|
4
5
|
import { UnstyledButton } from '@mantine/core';
|
|
@@ -6,34 +7,36 @@ import { useSelector } from '@xstate/react';
|
|
|
6
7
|
import { deepEqual } from 'fast-equals';
|
|
7
8
|
import { AnimatePresence } from 'motion/react';
|
|
8
9
|
import * as m from 'motion/react-m';
|
|
10
|
+
import { memo } from 'react';
|
|
9
11
|
import { useEnabledFeatures } from '../context/DiagramFeatures.js';
|
|
10
12
|
import { BreadcrumbsSeparator } from './_common.js';
|
|
11
13
|
import { useNavigationActor } from './hooks.js';
|
|
12
14
|
import { breadcrumbTitle } from './styles.css.js';
|
|
13
15
|
import { BurgerButton } from './controls/BurgerButton.js';
|
|
14
16
|
import { NavigationButtons } from './controls/NavigationButtons.js';
|
|
15
|
-
import {
|
|
17
|
+
import { DetailsControls } from './controls/DetailsControls.js';
|
|
16
18
|
import { OpenSource } from './controls/OpenSource.js';
|
|
17
19
|
import { ToggleReadonly } from './controls/ToggleReadonly.js';
|
|
18
20
|
import { DynamicViewControls } from './walkthrough/DynamicViewControls.js';
|
|
19
21
|
import { SearchControl } from './controls/SearchControl.js';
|
|
22
|
+
import { LayoutWarning } from './controls/LayoutWarning.js';
|
|
20
23
|
|
|
21
24
|
const selectBreadcrumbs = ({ context }) => {
|
|
22
|
-
const
|
|
25
|
+
const view = context.view;
|
|
26
|
+
const folder = context.viewModel?.folder;
|
|
23
27
|
return {
|
|
24
|
-
folders: folder.isRoot ? [] : folder.breadcrumbs.map((s) => ({
|
|
28
|
+
folders: !folder || folder.isRoot ? [] : folder.breadcrumbs.map((s) => ({
|
|
25
29
|
folderPath: s.path,
|
|
26
30
|
title: s.title
|
|
27
31
|
})),
|
|
28
|
-
viewId:
|
|
29
|
-
viewTitle: context.viewModel.
|
|
30
|
-
isDynamicView: context.viewModel.
|
|
32
|
+
viewId: view.id,
|
|
33
|
+
viewTitle: context.viewModel?.title ?? (view.title && extractViewTitleFromPath(view.title)) ?? "Untitled View",
|
|
34
|
+
isDynamicView: (context.viewModel?._type ?? view._type) === "dynamic"
|
|
31
35
|
};
|
|
32
36
|
};
|
|
33
|
-
const NavigationPanelControls = () => {
|
|
37
|
+
const NavigationPanelControls = memo(() => {
|
|
34
38
|
const actor = useNavigationActor();
|
|
35
39
|
const {
|
|
36
|
-
enableSearch,
|
|
37
40
|
enableNavigationButtons,
|
|
38
41
|
enableDynamicViewWalkthrough
|
|
39
42
|
} = useEnabledFeatures();
|
|
@@ -59,6 +62,9 @@ const NavigationPanelControls = () => {
|
|
|
59
62
|
}
|
|
60
63
|
})
|
|
61
64
|
),
|
|
65
|
+
initial: { opacity: 0 },
|
|
66
|
+
animate: { opacity: 1 },
|
|
67
|
+
exit: { opacity: 0 },
|
|
62
68
|
title,
|
|
63
69
|
onMouseEnter: () => actor.send({ type: "breadcrumbs.mouseEnter.folder", folderPath }),
|
|
64
70
|
onMouseLeave: () => actor.send({ type: "breadcrumbs.mouseLeave.folder", folderPath }),
|
|
@@ -76,6 +82,9 @@ const NavigationPanelControls = () => {
|
|
|
76
82
|
UnstyledButton,
|
|
77
83
|
{
|
|
78
84
|
component: m.button,
|
|
85
|
+
initial: { opacity: 0 },
|
|
86
|
+
animate: { opacity: 1 },
|
|
87
|
+
exit: { opacity: 0 },
|
|
79
88
|
className: cx(
|
|
80
89
|
"mantine-active",
|
|
81
90
|
breadcrumbTitle({ truncate: true }),
|
|
@@ -94,7 +103,7 @@ const NavigationPanelControls = () => {
|
|
|
94
103
|
},
|
|
95
104
|
"view-title"
|
|
96
105
|
);
|
|
97
|
-
return /* @__PURE__ */ jsxs(AnimatePresence, { propagate: true, children: [
|
|
106
|
+
return /* @__PURE__ */ jsxs(AnimatePresence, { propagate: true, mode: "popLayout", children: [
|
|
98
107
|
/* @__PURE__ */ jsx(BurgerButton, {}, "burger-button"),
|
|
99
108
|
enableNavigationButtons && /* @__PURE__ */ jsx(NavigationButtons, {}, "nav-buttons"),
|
|
100
109
|
/* @__PURE__ */ jsxs(
|
|
@@ -126,12 +135,7 @@ const NavigationPanelControls = () => {
|
|
|
126
135
|
}
|
|
127
136
|
}),
|
|
128
137
|
children: [
|
|
129
|
-
/* @__PURE__ */ jsx(
|
|
130
|
-
ViewDetailsCard,
|
|
131
|
-
{
|
|
132
|
-
onOpen: () => actor.closeDropdown()
|
|
133
|
-
}
|
|
134
|
-
),
|
|
138
|
+
/* @__PURE__ */ jsx(DetailsControls, { onOpen: () => actor.closeDropdown() }),
|
|
135
139
|
/* @__PURE__ */ jsx(OpenSource, {}),
|
|
136
140
|
/* @__PURE__ */ jsx(ToggleReadonly, {})
|
|
137
141
|
]
|
|
@@ -139,8 +143,10 @@ const NavigationPanelControls = () => {
|
|
|
139
143
|
"actions"
|
|
140
144
|
),
|
|
141
145
|
enableDynamicViewWalkthrough && isDynamicView && /* @__PURE__ */ jsx(DynamicViewControls, {}, "dynamic-view-controls"),
|
|
142
|
-
|
|
146
|
+
/* @__PURE__ */ jsx(SearchControl, {}, "search-control"),
|
|
147
|
+
/* @__PURE__ */ jsx(LayoutWarning, {}, "outdated-manual-layout-warning")
|
|
143
148
|
] });
|
|
144
|
-
};
|
|
149
|
+
});
|
|
150
|
+
NavigationPanelControls.displayName = "NavigationPanelControls";
|
|
145
151
|
|
|
146
152
|
export { NavigationPanelControls };
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { MemoExoticComponent } from 'react';
|
|
2
|
+
export declare const NavigationPanelDropdown: MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
|