@likec4/diagram 1.19.1 → 1.20.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/dist/LikeC4Diagram.css.d.ts +0 -1
- package/dist/LikeC4Diagram.css.js +1 -5
- package/dist/LikeC4Diagram.d.ts +1 -4
- package/dist/LikeC4Diagram.js +102 -147
- package/dist/LikeC4Diagram.props.d.ts +10 -16
- package/dist/LikeC4Search.js +7 -15
- package/dist/StaticLikeC4Diagram.d.ts +1 -1
- package/dist/base/Background.d.ts +7 -0
- package/dist/{xyflow/XYFlowBackground.js → base/Background.js} +5 -6
- package/dist/base/BaseXYFlow.d.ts +14 -0
- package/dist/base/BaseXYFlow.js +146 -0
- package/dist/base/example/RelationshipsBrowser.d.ts +6 -0
- package/dist/base/example/_types.d.ts +20 -0
- package/dist/base/example/custom.d.ts +71 -0
- package/dist/base/example/useViewToNodesEdges.d.ts +6 -0
- package/dist/base/index.d.ts +2 -0
- package/dist/base/primitives/NodeHandles.d.ts +4 -0
- package/dist/base/primitives/NodeHandles.js +14 -0
- package/dist/base/primitives/compound/CompoundActionButton.css.d.ts +3 -0
- package/dist/base/primitives/compound/CompoundActionButton.css.js +9 -0
- package/dist/base/primitives/compound/CompoundActionButton.d.ts +7 -0
- package/dist/base/primitives/compound/CompoundActionButton.js +48 -0
- package/dist/base/primitives/compound/CompoundDetailsButton.css.d.ts +3 -0
- package/dist/base/primitives/compound/CompoundDetailsButton.css.js +9 -0
- package/dist/base/primitives/compound/CompoundDetailsButton.d.ts +7 -0
- package/dist/base/primitives/compound/CompoundDetailsButton.js +50 -0
- package/dist/base/primitives/compound/CompoundNodeContainer.css.d.ts +9 -0
- package/dist/base/primitives/compound/CompoundNodeContainer.css.js +17 -0
- package/dist/base/primitives/compound/CompoundNodeContainer.d.ts +26 -0
- package/dist/base/primitives/compound/CompoundNodeContainer.js +86 -0
- package/dist/base/primitives/compound/CompoundTitle.css.d.ts +2 -0
- package/dist/base/primitives/compound/CompoundTitle.css.js +7 -0
- package/dist/base/primitives/compound/CompoundTitle.d.ts +6 -0
- package/dist/base/primitives/compound/CompoundTitle.js +20 -0
- package/dist/base/primitives/customEdge.d.ts +41 -0
- package/dist/base/primitives/customEdge.js +13 -0
- package/dist/base/primitives/customNode.d.ts +7 -0
- package/dist/base/primitives/customNode.js +10 -0
- package/dist/base/primitives/edge/EdgeActionButton.d.ts +7 -0
- package/dist/base/primitives/edge/EdgeActionButton.js +24 -0
- package/dist/base/primitives/edge/EdgeContainer.d.ts +10 -0
- package/dist/base/primitives/edge/EdgeContainer.js +35 -0
- package/dist/{xyflow/edges/edges.css.d.ts → base/primitives/edge/EdgeLabel.css.d.ts} +5 -9
- package/dist/base/primitives/edge/EdgeLabel.css.js +25 -0
- package/dist/base/primitives/edge/EdgeLabel.d.ts +51 -0
- package/dist/base/primitives/edge/EdgeLabel.js +90 -0
- package/dist/{xyflow → base/primitives/edge}/EdgeMarkers.d.ts +2 -0
- package/dist/{xyflow → base/primitives/edge}/EdgeMarkers.js +29 -1
- package/dist/base/primitives/edge/EdgePath.d.ts +44 -0
- package/dist/base/primitives/edge/EdgePath.js +77 -0
- package/dist/base/primitives/edge/edge.css.d.ts +6 -0
- package/dist/base/primitives/edge/edge.css.js +14 -0
- package/dist/base/primitives/element/ElementActionButtons.css.d.ts +3 -0
- package/dist/base/primitives/element/ElementActionButtons.css.js +9 -0
- package/dist/base/primitives/element/ElementActionButtons.d.ts +13 -0
- package/dist/base/primitives/element/ElementActionButtons.js +62 -0
- package/dist/base/primitives/element/ElementDetailsButton.css.d.ts +3 -0
- package/dist/base/primitives/element/ElementDetailsButton.css.js +9 -0
- package/dist/base/primitives/element/ElementDetailsButton.d.ts +7 -0
- package/dist/base/primitives/element/ElementDetailsButton.js +54 -0
- package/dist/base/primitives/element/ElementNodeContainer.css.d.ts +3 -0
- package/dist/base/primitives/element/ElementNodeContainer.css.js +7 -0
- package/dist/base/primitives/element/ElementNodeContainer.d.ts +26 -0
- package/dist/base/primitives/element/ElementNodeContainer.js +60 -0
- package/dist/base/primitives/element/ElementShape.css.d.ts +6 -0
- package/dist/base/primitives/element/ElementShape.css.js +14 -0
- package/dist/base/primitives/element/ElementShape.d.ts +28 -0
- package/dist/{xyflow/nodes/element/ElementShapeSvg.js → base/primitives/element/ElementShape.js} +23 -7
- package/dist/base/primitives/element/ElementTitle.css.d.ts +8 -0
- package/dist/base/primitives/element/ElementTitle.css.js +19 -0
- package/dist/base/primitives/element/ElementTitle.d.ts +10 -0
- package/dist/base/primitives/element/ElementTitle.js +66 -0
- package/dist/base/primitives/index.d.ts +17 -0
- package/dist/base/types.d.ts +90 -0
- package/dist/base/types.js +54 -0
- package/dist/base/updateEdges.d.ts +3 -0
- package/dist/base/updateEdges.js +31 -0
- package/dist/base/updateNodes.d.ts +3 -0
- package/dist/base/updateNodes.js +36 -0
- package/dist/base/xyflowMachine.d.ts +212 -0
- package/dist/context/DiagramEventHandlers.d.ts +10 -0
- package/dist/context/DiagramEventHandlers.js +49 -0
- package/dist/context/DiagramFeatures.d.ts +31 -0
- package/dist/context/DiagramFeatures.js +140 -0
- package/dist/{ui → context}/FramerMotionConfig.js +2 -4
- package/dist/context/IconRenderer.d.ts +11 -0
- package/dist/{xyflow/nodes/shared/ElementIcon.js → context/IconRenderer.js} +14 -14
- package/dist/context/RootContainer.d.ts +9 -0
- package/dist/context/RootContainer.js +20 -0
- package/dist/context/index.d.ts +7 -0
- package/dist/globals.css.js +0 -87
- package/dist/hooks/index.d.ts +7 -5
- package/dist/hooks/useCurrentViewId.d.ts +2 -0
- package/dist/hooks/useCurrentViewId.js +8 -0
- package/dist/hooks/useDiagram.d.ts +10725 -0
- package/dist/hooks/useDiagram.js +119 -0
- package/dist/hooks/useDiagramActor.d.ts +5 -0
- package/dist/hooks/useDiagramActor.js +21 -0
- package/dist/hooks/useDiagramContext.d.ts +3 -0
- package/dist/hooks/useDiagramContext.js +10 -0
- package/dist/hooks/useMantinePortalProps.js +2 -2
- package/dist/hooks/useXYFlow.d.ts +195 -37
- package/dist/hooks/useXYFlow.js +4 -6
- package/dist/index.d.ts +3 -2
- package/dist/index.js +5 -6
- package/dist/likec4diagram/DiagramActor.d.ts +7 -0
- package/dist/likec4diagram/DiagramActor.js +71 -0
- package/dist/likec4diagram/DiagramUI.d.ts +2 -0
- package/dist/likec4diagram/DiagramUI.js +22 -0
- package/dist/likec4diagram/XYFlow.d.ts +6 -0
- package/dist/likec4diagram/XYFlow.js +122 -0
- package/dist/likec4diagram/custom/edges/NotePopover.css.d.ts +2 -0
- package/dist/likec4diagram/custom/edges/NotePopover.css.js +7 -0
- package/dist/likec4diagram/custom/edges/NotePopover.d.ts +4 -0
- package/dist/likec4diagram/custom/edges/NotePopover.js +101 -0
- package/dist/likec4diagram/custom/edges/RelationshipEdge.d.ts +55 -0
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +307 -0
- package/dist/{xyflow → likec4diagram/custom}/edges/RelationshipsDropdownMenu.css.js +4 -4
- package/dist/{xyflow → likec4diagram/custom}/edges/RelationshipsDropdownMenu.d.ts +5 -5
- package/dist/{xyflow → likec4diagram/custom}/edges/RelationshipsDropdownMenu.js +51 -53
- package/dist/likec4diagram/custom/edges/edges.css.d.ts +2 -0
- package/dist/likec4diagram/custom/edges/edges.css.js +7 -0
- package/dist/likec4diagram/custom/edges/utils.d.ts +22 -0
- package/dist/likec4diagram/custom/edges/utils.js +25 -0
- package/dist/likec4diagram/custom/index.d.ts +57 -0
- package/dist/likec4diagram/custom/index.js +7 -0
- package/dist/likec4diagram/custom/nodes/CompoundActions.d.ts +5 -0
- package/dist/likec4diagram/custom/nodes/CompoundActions.js +25 -0
- package/dist/likec4diagram/custom/nodes/ElementActions.d.ts +7 -0
- package/dist/likec4diagram/custom/nodes/ElementActions.js +69 -0
- package/dist/likec4diagram/custom/nodes/nodeTypes.d.ts +10 -0
- package/dist/likec4diagram/custom/nodes/nodeTypes.js +94 -0
- package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.d.ts +21 -0
- package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +159 -0
- package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.d.ts +7 -0
- package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +128 -0
- package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.d.ts +7 -0
- package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.js +149 -0
- package/dist/likec4diagram/custom/nodes/toolbar/Toolbar.d.ts +8 -0
- package/dist/likec4diagram/custom/nodes/toolbar/Toolbar.js +66 -0
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.d.ts +40 -0
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +131 -0
- package/dist/likec4diagram/custom/nodes/toolbar/styles.css.d.ts +1 -0
- package/dist/likec4diagram/custom/nodes/toolbar/styles.css.js +5 -0
- package/dist/likec4diagram/state/actorContext.d.ts +50849 -0
- package/dist/likec4diagram/state/actorContext.js +12 -0
- package/dist/{state → likec4diagram/state}/aligners.d.ts +4 -1
- package/dist/{state → likec4diagram/state}/aligners.js +31 -5
- package/dist/likec4diagram/state/assign.d.ts +18 -0
- package/dist/likec4diagram/state/assign.js +343 -0
- package/dist/likec4diagram/state/hotkeyActor.d.ts +5 -0
- package/dist/likec4diagram/state/hotkeyActor.js +18 -0
- package/dist/likec4diagram/state/inspector.d.ts +5 -0
- package/dist/likec4diagram/state/machine.d.ts +10751 -0
- package/dist/likec4diagram/state/machine.js +783 -0
- package/dist/likec4diagram/state/syncManualLayoutActor.d.ts +113 -0
- package/dist/likec4diagram/state/syncManualLayoutActor.js +178 -0
- package/dist/likec4diagram/state/utils.d.ts +8 -0
- package/dist/likec4diagram/state/utils.js +48 -0
- package/dist/likec4diagram/types.d.ts +74 -0
- package/dist/{ui/top-left → likec4diagram/ui/controls}/ChangeAutoLayoutButton.js +11 -10
- package/dist/likec4diagram/ui/controls/Controls.d.ts +2 -0
- package/dist/likec4diagram/ui/controls/Controls.js +102 -0
- package/dist/likec4diagram/ui/controls/LayoutDriftNotification.d.ts +2 -0
- package/dist/likec4diagram/ui/controls/LayoutDriftNotification.js +43 -0
- package/dist/{ui/top-left → likec4diagram/ui/controls}/ManualLayoutToolsButton.js +11 -11
- package/dist/likec4diagram/ui/controls/NavigationButtons.d.ts +1 -0
- package/dist/likec4diagram/ui/controls/NavigationButtons.js +92 -0
- package/dist/{ui/top-left → likec4diagram/ui/controls}/_shared.js +2 -1
- package/dist/{ui/top-left → likec4diagram/ui/controls}/styles.css.d.ts +1 -1
- package/dist/likec4diagram/ui/controls/styles.css.js +17 -0
- package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.css.js +11 -0
- package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.d.ts +1 -0
- package/dist/{ui → likec4diagram/ui/diagram-title}/DiagramTitlePanel.js +3 -3
- package/dist/likec4diagram/ui/diagram-title/Link.d.ts +4 -0
- package/dist/likec4diagram/ui/index.d.ts +2 -0
- package/dist/likec4diagram/ui/notation/NotationPanel.css.js +13 -0
- package/dist/likec4diagram/ui/notation/NotationPanel.d.ts +2 -0
- package/dist/{ui → likec4diagram/ui}/notation/NotationPanel.js +23 -31
- package/dist/{ui → likec4diagram/ui/walkthrough}/DynamicViewWalkthrough.css.js +4 -4
- package/dist/{ui → likec4diagram/ui/walkthrough}/DynamicViewWalkthrough.js +19 -44
- package/dist/{xyflow → likec4diagram}/useLayoutConstraints.d.ts +11 -6
- package/dist/{xyflow → likec4diagram}/useLayoutConstraints.js +17 -12
- package/dist/likec4diagram/useViewToNodesEdges.d.ts +11 -0
- package/dist/likec4diagram/useViewToNodesEdges.js +245 -0
- package/dist/likec4model/index.d.ts +1 -1
- package/dist/likec4model/useLikeC4Model.d.ts +1 -11
- package/dist/likec4model/useLikeC4Model.js +1 -39
- package/dist/overlays/Overlays.js +61 -105
- package/dist/overlays/element-details/ElementDetailsCard.js +111 -116
- package/dist/overlays/element-details/TabPanelDeployments.js +4 -7
- package/dist/overlays/element-details/TabPanelRelationships.css.js +0 -2
- package/dist/overlays/element-details/TabPanelRelationships.d.ts +1 -1
- package/dist/overlays/element-details/TabPanelRelationships.js +35 -64
- package/dist/overlays/element-details/TabPanelStructure.d.ts +2 -2
- package/dist/overlays/element-details/TabPanelStructure.js +1 -1
- package/dist/overlays/overlay/Overlay.css.d.ts +2 -0
- package/dist/overlays/overlay/Overlay.css.js +93 -0
- package/dist/overlays/overlay/Overlay.d.ts +8 -0
- package/dist/overlays/overlay/Overlay.js +86 -0
- package/dist/overlays/relationship-details/RelationshipDetails.d.ts +5 -0
- package/dist/overlays/relationship-details/RelationshipDetails.js +189 -0
- package/dist/overlays/{edge-details → relationship-details}/SelectEdge.css.d.ts +1 -0
- package/dist/overlays/relationship-details/SelectEdge.css.js +17 -0
- package/dist/overlays/{edge-details → relationship-details}/SelectEdge.d.ts +1 -1
- package/dist/overlays/{edge-details → relationship-details}/SelectEdge.js +8 -8
- package/dist/overlays/relationship-details/_types.d.ts +36 -0
- package/dist/overlays/relationship-details/actor.d.ts +41 -0
- package/dist/overlays/relationship-details/actor.js +113 -0
- package/dist/overlays/relationship-details/custom/ElementActions.d.ts +5 -0
- package/dist/overlays/relationship-details/custom/ElementActions.js +33 -0
- package/dist/overlays/relationship-details/custom/edgeTypes.d.ts +49 -0
- package/dist/overlays/relationship-details/custom/edgeTypes.js +51 -0
- package/dist/overlays/relationship-details/custom/index.d.ts +2 -0
- package/dist/overlays/relationship-details/custom/nodeTypes.d.ts +39 -0
- package/dist/overlays/relationship-details/custom/nodeTypes.js +89 -0
- package/dist/overlays/relationship-details/custom/styles.css.d.ts +1 -0
- package/dist/overlays/relationship-details/hooks.d.ts +59 -0
- package/dist/overlays/relationship-details/hooks.js +46 -0
- package/dist/overlays/{edge-details/use-layouted-edge-details.d.ts → relationship-details/useLayoutedDetails.d.ts} +4 -6
- package/dist/overlays/{edge-details/use-layouted-edge-details.js → relationship-details/useLayoutedDetails.js} +68 -64
- package/dist/overlays/relationships-browser/-useRelationshipsView.d.ts +39 -0
- package/dist/overlays/relationships-browser/-useRelationshipsView.js +488 -0
- package/dist/overlays/relationships-browser/RelationshipsBrowser.d.ts +5 -0
- package/dist/overlays/relationships-browser/RelationshipsBrowser.js +209 -0
- package/dist/overlays/{relationships-of → relationships-browser}/SelectElement.css.d.ts +1 -0
- package/dist/overlays/relationships-browser/SelectElement.css.js +9 -0
- package/dist/overlays/relationships-browser/SelectElement.d.ts +7 -0
- package/dist/overlays/{relationships-of → relationships-browser}/SelectElement.js +11 -7
- package/dist/overlays/relationships-browser/_types.d.ts +40 -0
- package/dist/overlays/relationships-browser/actor.d.ts +66 -0
- package/dist/overlays/relationships-browser/actor.js +159 -0
- package/dist/overlays/relationships-browser/custom/ElementActions.d.ts +5 -0
- package/dist/overlays/relationships-browser/custom/ElementActions.js +43 -0
- package/dist/overlays/relationships-browser/custom/EmptyNode.d.ts +5 -0
- package/dist/overlays/{relationships-of/xyflow → relationships-browser/custom}/EmptyNode.js +1 -3
- package/dist/overlays/relationships-browser/custom/edgeTypes.d.ts +46 -0
- package/dist/overlays/relationships-browser/custom/edgeTypes.js +51 -0
- package/dist/overlays/relationships-browser/custom/index.d.ts +2 -0
- package/dist/overlays/relationships-browser/custom/nodeTypes.d.ts +45 -0
- package/dist/overlays/relationships-browser/custom/nodeTypes.js +93 -0
- package/dist/overlays/relationships-browser/custom/styles.css.d.ts +1 -0
- package/dist/overlays/relationships-browser/custom/styles.css.js +5 -0
- package/dist/overlays/relationships-browser/hooks.d.ts +62 -0
- package/dist/overlays/relationships-browser/hooks.js +46 -0
- package/dist/overlays/relationships-browser/useViewToNodesEdges.d.ts +10 -0
- package/dist/overlays/relationships-browser/useViewToNodesEdges.js +160 -0
- package/dist/style.css +1 -1
- package/dist/theme-vars.css.js +1 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/{xyflow/utils.d.ts → utils/xyflow.d.ts} +4 -4
- package/dist/{xyflow/utils.js → utils/xyflow.js} +14 -20
- package/package.json +24 -21
- package/src/LikeC4Diagram.css.ts +21 -15
- package/src/LikeC4Diagram.props.ts +14 -21
- package/src/LikeC4Diagram.tsx +105 -150
- package/src/LikeC4Search.tsx +21 -28
- package/src/StaticLikeC4Diagram.tsx +0 -1
- package/src/{xyflow/XYFlowBackground.tsx → base/Background.tsx} +8 -8
- package/src/base/BaseXYFlow.tsx +200 -0
- package/src/{xyflow → base}/const.ts +1 -1
- package/src/base/example/RelationshipsBrowser.tsx +62 -0
- package/src/base/example/_types.ts +71 -0
- package/src/base/example/custom.tsx +58 -0
- package/src/base/example/useViewToNodesEdges.ts +193 -0
- package/src/base/index.ts +10 -0
- package/src/base/primitives/NodeHandles.tsx +18 -0
- package/src/base/primitives/compound/CompoundActionButton.css.ts +55 -0
- package/src/base/primitives/compound/CompoundActionButton.tsx +52 -0
- package/src/base/primitives/compound/CompoundDetailsButton.css.ts +56 -0
- package/src/base/primitives/compound/CompoundDetailsButton.tsx +54 -0
- package/src/base/primitives/compound/CompoundNodeContainer.css.ts +161 -0
- package/src/base/primitives/compound/CompoundNodeContainer.tsx +95 -0
- package/src/base/primitives/compound/CompoundTitle.css.ts +43 -0
- package/src/base/primitives/compound/CompoundTitle.tsx +29 -0
- package/src/base/primitives/customEdge.ts +32 -0
- package/src/base/primitives/customNode.ts +21 -0
- package/src/base/primitives/edge/EdgeActionButton.tsx +27 -0
- package/src/base/primitives/edge/EdgeContainer.tsx +48 -0
- package/src/base/primitives/edge/EdgeLabel.css.ts +196 -0
- package/src/base/primitives/edge/EdgeLabel.tsx +136 -0
- package/src/{xyflow → base/primitives/edge}/EdgeMarkers.tsx +29 -1
- package/src/base/primitives/edge/EdgePath.tsx +89 -0
- package/src/base/primitives/edge/edge.css.ts +122 -0
- package/src/base/primitives/element/ElementActionButtons.css.ts +48 -0
- package/src/base/primitives/element/ElementActionButtons.tsx +73 -0
- package/src/base/primitives/element/ElementDetailsButton.css.ts +54 -0
- package/src/base/primitives/element/ElementDetailsButton.tsx +59 -0
- package/src/base/primitives/element/ElementNodeContainer.css.ts +47 -0
- package/src/base/primitives/element/ElementNodeContainer.tsx +72 -0
- package/src/base/primitives/element/ElementShape.css.ts +134 -0
- package/src/{xyflow/nodes/element/ElementShapeSvg.tsx → base/primitives/element/ElementShape.tsx} +64 -19
- package/src/base/primitives/element/ElementTitle.css.ts +156 -0
- package/src/base/primitives/element/ElementTitle.tsx +76 -0
- package/src/base/primitives/index.ts +17 -0
- package/src/base/types.ts +169 -0
- package/src/base/updateEdges.ts +40 -0
- package/src/base/updateNodes.ts +46 -0
- package/src/base/xyflowMachine.ts +75 -0
- package/src/context/DiagramEventHandlers.tsx +53 -0
- package/src/context/DiagramFeatures.tsx +162 -0
- package/src/{ui → context}/FramerMotionConfig.tsx +2 -6
- package/src/context/IconRenderer.tsx +45 -0
- package/src/context/RootContainer.tsx +31 -0
- package/src/context/index.ts +14 -0
- package/src/globals.css.ts +32 -32
- package/src/hooks/index.ts +7 -5
- package/src/hooks/useCurrentViewId.ts +8 -0
- package/src/hooks/useDiagram.ts +129 -0
- package/src/hooks/useDiagramActor.ts +25 -0
- package/src/hooks/useDiagramContext.ts +11 -0
- package/src/hooks/useMantinePortalProps.ts +2 -2
- package/src/hooks/useXYFlow.ts +12 -38
- package/src/index.ts +3 -7
- package/src/likec4diagram/DiagramActor.tsx +79 -0
- package/src/likec4diagram/DiagramUI.tsx +28 -0
- package/src/likec4diagram/XYFlow.tsx +137 -0
- package/src/likec4diagram/custom/edges/NotePopover.css.ts +27 -0
- package/src/likec4diagram/custom/edges/NotePopover.tsx +96 -0
- package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +355 -0
- package/src/{xyflow → likec4diagram/custom}/edges/RelationshipsDropdownMenu.css.ts +7 -7
- package/src/{xyflow → likec4diagram/custom}/edges/RelationshipsDropdownMenu.tsx +91 -70
- package/src/likec4diagram/custom/edges/edges.css.ts +39 -0
- package/src/likec4diagram/custom/edges/utils.ts +126 -0
- package/src/likec4diagram/custom/index.tsx +8 -0
- package/src/likec4diagram/custom/nodes/CompoundActions.tsx +27 -0
- package/src/likec4diagram/custom/nodes/ElementActions.tsx +74 -0
- package/src/likec4diagram/custom/nodes/nodeTypes.tsx +107 -0
- package/src/likec4diagram/custom/nodes/toolbar/ColorButton.tsx +175 -0
- package/src/likec4diagram/custom/nodes/toolbar/CompoundToolbar.tsx +122 -0
- package/src/likec4diagram/custom/nodes/toolbar/ElementToolbar.tsx +140 -0
- package/src/likec4diagram/custom/nodes/toolbar/Toolbar.tsx +77 -0
- package/src/likec4diagram/custom/nodes/toolbar/_shared.tsx +143 -0
- package/src/likec4diagram/custom/nodes/toolbar/styles.css.ts +9 -0
- package/src/likec4diagram/state/actorContext.ts +8 -0
- package/src/{state → likec4diagram/state}/aligners.ts +67 -40
- package/src/likec4diagram/state/assign.ts +384 -0
- package/src/likec4diagram/state/hotkeyActor.ts +20 -0
- package/src/likec4diagram/state/inspector.ts +23 -0
- package/src/likec4diagram/state/machine.ts +946 -0
- package/src/likec4diagram/state/syncManualLayoutActor.ts +219 -0
- package/src/likec4diagram/state/utils.ts +52 -0
- package/src/likec4diagram/types.ts +144 -0
- package/src/{ui/top-left → likec4diagram/ui/controls}/ChangeAutoLayoutButton.tsx +32 -28
- package/src/likec4diagram/ui/controls/Controls.tsx +107 -0
- package/src/likec4diagram/ui/controls/LayoutDriftNotification.tsx +46 -0
- package/src/{ui/top-left → likec4diagram/ui/controls}/ManualLayoutToolsButton.tsx +16 -16
- package/src/likec4diagram/ui/controls/NavigationButtons.tsx +83 -0
- package/src/{ui/top-left → likec4diagram/ui/controls}/_shared.ts +4 -3
- package/src/{ui/top-left → likec4diagram/ui/controls}/styles.css.ts +17 -17
- package/src/{ui → likec4diagram/ui/diagram-title}/DiagramTitlePanel.css.ts +11 -11
- package/src/{ui → likec4diagram/ui/diagram-title}/DiagramTitlePanel.tsx +6 -5
- package/src/likec4diagram/ui/diagram-title/Link.tsx +40 -0
- package/src/likec4diagram/ui/index.ts +2 -0
- package/src/{ui → likec4diagram/ui}/notation/NotationPanel.css.ts +18 -18
- package/src/{ui → likec4diagram/ui}/notation/NotationPanel.tsx +44 -44
- package/src/{ui → likec4diagram/ui/walkthrough}/DynamicViewWalkthrough.css.ts +16 -16
- package/src/{ui → likec4diagram/ui/walkthrough}/DynamicViewWalkthrough.tsx +29 -49
- package/src/{xyflow → likec4diagram}/useLayoutConstraints.ts +54 -43
- package/src/likec4diagram/useViewToNodesEdges.ts +297 -0
- package/src/likec4model/index.ts +0 -6
- package/src/likec4model/useLikeC4Model.ts +1 -43
- package/src/overlays/Overlays.tsx +201 -147
- package/src/overlays/element-details/ElementDetailsCard.css.ts +58 -58
- package/src/overlays/element-details/ElementDetailsCard.tsx +143 -128
- package/src/overlays/element-details/TabPanelDeployments.css.ts +14 -14
- package/src/overlays/element-details/TabPanelDeployments.tsx +22 -22
- package/src/overlays/element-details/TabPanelRelationships.css.ts +19 -19
- package/src/overlays/element-details/TabPanelRelationships.tsx +45 -28
- package/src/overlays/element-details/TabPanelStructure.css.ts +7 -7
- package/src/overlays/element-details/TabPanelStructure.tsx +11 -11
- package/src/overlays/overlay/Overlay.css.ts +73 -0
- package/src/overlays/overlay/Overlay.tsx +99 -0
- package/src/overlays/relationship-details/RelationshipDetails.tsx +234 -0
- package/src/overlays/{edge-details → relationship-details}/SelectEdge.css.ts +20 -13
- package/src/overlays/{edge-details → relationship-details}/SelectEdge.tsx +14 -14
- package/src/overlays/relationship-details/_types.ts +73 -0
- package/src/overlays/relationship-details/actor.ts +162 -0
- package/src/overlays/relationship-details/custom/ElementActions.tsx +45 -0
- package/src/overlays/relationship-details/custom/edgeTypes.tsx +49 -0
- package/src/overlays/relationship-details/custom/index.tsx +2 -0
- package/src/overlays/relationship-details/custom/nodeTypes.tsx +108 -0
- package/src/overlays/relationship-details/custom/styles.css.ts +13 -0
- package/src/overlays/relationship-details/hooks.ts +48 -0
- package/src/overlays/{edge-details/use-layouted-edge-details.ts → relationship-details/useLayoutedDetails.ts} +128 -114
- package/src/overlays/relationships-browser/-useRelationshipsView.ts +642 -0
- package/src/overlays/relationships-browser/RelationshipsBrowser.tsx +247 -0
- package/src/overlays/{relationships-of → relationships-browser}/SelectElement.css.ts +12 -5
- package/src/overlays/{relationships-of → relationships-browser}/SelectElement.tsx +19 -17
- package/src/overlays/relationships-browser/_types.ts +89 -0
- package/src/overlays/relationships-browser/actor.ts +224 -0
- package/src/overlays/relationships-browser/custom/ElementActions.tsx +44 -0
- package/src/overlays/relationships-browser/custom/EmptyNode.tsx +18 -0
- package/src/overlays/relationships-browser/custom/edgeTypes.tsx +49 -0
- package/src/overlays/relationships-browser/custom/index.tsx +2 -0
- package/src/overlays/relationships-browser/custom/nodeTypes.tsx +109 -0
- package/src/overlays/relationships-browser/custom/styles.css.ts +13 -0
- package/src/overlays/relationships-browser/hooks.ts +48 -0
- package/src/overlays/relationships-browser/useViewToNodesEdges.ts +209 -0
- package/src/utils/index.ts +15 -0
- package/src/{xyflow/utils.ts → utils/xyflow.ts} +22 -8
- package/dist/_virtual/_commonjsHelpers.js +0 -6
- package/dist/controls/Text.d.ts +0 -2
- package/dist/controls/Text.js +0 -7
- package/dist/controls/action-button-bar/ActionButtonBar.css.d.ts +0 -1
- package/dist/controls/action-button-bar/ActionButtonBar.css.js +0 -5
- package/dist/controls/action-button-bar/ActionButtonBar.d.ts +0 -9
- package/dist/controls/action-button-bar/ActionButtonBar.js +0 -100
- package/dist/controls/action-button-bar/useActionButtonBarCtx.d.ts +0 -10
- package/dist/controls/action-button-bar/useActionButtonBarCtx.js +0 -9
- package/dist/controls/action-buttons/ActionButton.css.d.ts +0 -1
- package/dist/controls/action-buttons/ActionButton.css.js +0 -5
- package/dist/controls/action-buttons/ActionButton.d.ts +0 -9
- package/dist/controls/action-buttons/ActionButton.js +0 -66
- package/dist/controls/action-buttons/ActionButtons.d.ts +0 -12
- package/dist/controls/action-buttons/ActionButtons.js +0 -99
- package/dist/hooks/useDiagramState.d.ts +0 -6
- package/dist/hooks/useDiagramState.js +0 -27
- package/dist/overlays/OverlayContext.d.ts +0 -10
- package/dist/overlays/OverlayContext.js +0 -9
- package/dist/overlays/Overlays.css.d.ts +0 -3
- package/dist/overlays/Overlays.css.js +0 -7
- package/dist/overlays/edge-details/EdgeDetailsXYFlow.d.ts +0 -5
- package/dist/overlays/edge-details/EdgeDetailsXYFlow.js +0 -185
- package/dist/overlays/edge-details/SelectEdge.css.js +0 -17
- package/dist/overlays/edge-details/_types.d.ts +0 -14
- package/dist/overlays/edge-details/xyflow/CompoundNode.d.ts +0 -5
- package/dist/overlays/edge-details/xyflow/CompoundNode.js +0 -76
- package/dist/overlays/edge-details/xyflow/ElementNode.d.ts +0 -5
- package/dist/overlays/edge-details/xyflow/ElementNode.js +0 -159
- package/dist/overlays/edge-details/xyflow/RelationshipEdge.d.ts +0 -3
- package/dist/overlays/edge-details/xyflow/RelationshipEdge.js +0 -84
- package/dist/overlays/edge-details/xyflow/styles.css.d.ts +0 -9
- package/dist/overlays/edge-details/xyflow/styles.css.js +0 -21
- package/dist/overlays/index.d.ts +0 -1
- package/dist/overlays/relationships-of/RelationshipsOverlay.d.ts +0 -5
- package/dist/overlays/relationships-of/RelationshipsOverlay.js +0 -193
- package/dist/overlays/relationships-of/RelationshipsXYFlow.d.ts +0 -19
- package/dist/overlays/relationships-of/RelationshipsXYFlow.js +0 -290
- package/dist/overlays/relationships-of/SelectElement.css.js +0 -7
- package/dist/overlays/relationships-of/SelectElement.d.ts +0 -7
- package/dist/overlays/relationships-of/_types.d.ts +0 -28
- package/dist/overlays/relationships-of/use-layouted-relationships.d.ts +0 -22
- package/dist/overlays/relationships-of/use-layouted-relationships.js +0 -496
- package/dist/overlays/relationships-of/xyflow/CompoundNode.d.ts +0 -6
- package/dist/overlays/relationships-of/xyflow/CompoundNode.js +0 -120
- package/dist/overlays/relationships-of/xyflow/ElementNode.d.ts +0 -6
- package/dist/overlays/relationships-of/xyflow/ElementNode.js +0 -194
- package/dist/overlays/relationships-of/xyflow/EmptyNode.d.ts +0 -5
- package/dist/overlays/relationships-of/xyflow/RelationshipEdge.d.ts +0 -3
- package/dist/overlays/relationships-of/xyflow/RelationshipEdge.js +0 -123
- package/dist/overlays/relationships-of/xyflow/styles.css.d.ts +0 -14
- package/dist/overlays/relationships-of/xyflow/styles.css.js +0 -24
- package/dist/overlays/shared/xyflow/RelationshipEdge.css.d.ts +0 -4
- package/dist/overlays/shared/xyflow/RelationshipEdge.css.js +0 -12
- package/dist/overlays/shared/xyflow/_types.d.ts +0 -77
- package/dist/state/DiagramContext.d.ts +0 -1609
- package/dist/state/DiagramContext.js +0 -101
- package/dist/state/diagram-to-xyflow.d.ts +0 -11
- package/dist/state/diagram-to-xyflow.js +0 -113
- package/dist/state/diagramStore.d.ts +0 -1705
- package/dist/state/diagramStore.js +0 -808
- package/dist/state/diagramStore.layout.d.ts +0 -4
- package/dist/state/diagramStore.layout.js +0 -56
- package/dist/ui/DiagramTitlePanel.css.js +0 -11
- package/dist/ui/DiagramTitlePanel.d.ts +0 -1
- package/dist/ui/notation/NotationPanel.css.js +0 -16
- package/dist/ui/notation/NotationPanel.d.ts +0 -1
- package/dist/ui/top-left/TopLeftPanel.d.ts +0 -4
- package/dist/ui/top-left/TopLeftPanel.js +0 -211
- package/dist/ui/top-left/styles.css.js +0 -17
- package/dist/xyflow/FitviewOnDiagramChange.d.ts +0 -4
- package/dist/xyflow/FitviewOnDiagramChange.js +0 -72
- package/dist/xyflow/SelectEdgesOnNodeFocus.d.ts +0 -1
- package/dist/xyflow/SelectEdgesOnNodeFocus.js +0 -96
- package/dist/xyflow/XYFlow.d.ts +0 -8
- package/dist/xyflow/XYFlow.js +0 -145
- package/dist/xyflow/XYFlowBackground.d.ts +0 -10
- package/dist/xyflow/XYFlowInner.d.ts +0 -8
- package/dist/xyflow/XYFlowInner.js +0 -41
- package/dist/xyflow/edges/EdgeLabel.d.ts +0 -7
- package/dist/xyflow/edges/EdgeLabel.js +0 -160
- package/dist/xyflow/edges/RelationshipEdge.d.ts +0 -6
- package/dist/xyflow/edges/RelationshipEdge.js +0 -443
- package/dist/xyflow/edges/edges.css.js +0 -37
- package/dist/xyflow/edges/utils.d.ts +0 -16
- package/dist/xyflow/edges/utils.js +0 -24
- package/dist/xyflow/nodes/AnimateVariants.d.ts +0 -1313
- package/dist/xyflow/nodes/AnimateVariants.js +0 -123
- package/dist/xyflow/nodes/Node.css.d.ts +0 -3
- package/dist/xyflow/nodes/Node.css.js +0 -9
- package/dist/xyflow/nodes/compound/CompoundNode.css.d.ts +0 -14
- package/dist/xyflow/nodes/compound/CompoundNode.css.js +0 -27
- package/dist/xyflow/nodes/compound/CompoundNode.d.ts +0 -6
- package/dist/xyflow/nodes/compound/CompoundNode.js +0 -216
- package/dist/xyflow/nodes/compound/index.d.ts +0 -1
- package/dist/xyflow/nodes/element/ElementLink.css.d.ts +0 -3
- package/dist/xyflow/nodes/element/ElementLink.d.ts +0 -6
- package/dist/xyflow/nodes/element/ElementNode.d.ts +0 -6
- package/dist/xyflow/nodes/element/ElementNode.js +0 -190
- package/dist/xyflow/nodes/element/ElementShapeSvg.d.ts +0 -17
- package/dist/xyflow/nodes/element/element.css.d.ts +0 -18
- package/dist/xyflow/nodes/element/element.css.js +0 -31
- package/dist/xyflow/nodes/element/index.d.ts +0 -1
- package/dist/xyflow/nodes/shared/ElementIcon.d.ts +0 -8
- package/dist/xyflow/nodes/shared/Toolbar.d.ts +0 -9
- package/dist/xyflow/nodes/shared/Toolbar.js +0 -436
- package/dist/xyflow/types.d.ts +0 -36
- package/dist/xyflow/useXYFlowEvents.d.ts +0 -160
- package/dist/xyflow/useXYFlowEvents.js +0 -275
- package/src/controls/Text.ts +0 -5
- package/src/controls/action-button-bar/ActionButtonBar.css.ts +0 -13
- package/src/controls/action-button-bar/ActionButtonBar.tsx +0 -138
- package/src/controls/action-button-bar/useActionButtonBarCtx.ts +0 -13
- package/src/controls/action-buttons/ActionButton.css.ts +0 -29
- package/src/controls/action-buttons/ActionButton.tsx +0 -66
- package/src/controls/action-buttons/ActionButtons.tsx +0 -138
- package/src/hooks/useDiagramState.ts +0 -36
- package/src/overlays/OverlayContext.tsx +0 -11
- package/src/overlays/Overlays.css.ts +0 -136
- package/src/overlays/edge-details/EdgeDetailsXYFlow.tsx +0 -255
- package/src/overlays/edge-details/_types.ts +0 -18
- package/src/overlays/edge-details/xyflow/CompoundNode.tsx +0 -72
- package/src/overlays/edge-details/xyflow/ElementNode.tsx +0 -152
- package/src/overlays/edge-details/xyflow/RelationshipEdge.tsx +0 -85
- package/src/overlays/edge-details/xyflow/styles.css.ts +0 -144
- package/src/overlays/index.tsx +0 -1
- package/src/overlays/relationships-of/RelationshipsOverlay.tsx +0 -185
- package/src/overlays/relationships-of/RelationshipsXYFlow.tsx +0 -378
- package/src/overlays/relationships-of/_types.ts +0 -40
- package/src/overlays/relationships-of/use-layouted-relationships.ts +0 -699
- package/src/overlays/relationships-of/xyflow/CompoundNode.tsx +0 -124
- package/src/overlays/relationships-of/xyflow/ElementNode.tsx +0 -194
- package/src/overlays/relationships-of/xyflow/EmptyNode.tsx +0 -19
- package/src/overlays/relationships-of/xyflow/RelationshipEdge.tsx +0 -127
- package/src/overlays/relationships-of/xyflow/styles.css.ts +0 -214
- package/src/overlays/shared/xyflow/RelationshipEdge.css.ts +0 -60
- package/src/overlays/shared/xyflow/_types.ts +0 -87
- package/src/state/DiagramContext.tsx +0 -107
- package/src/state/diagram-to-xyflow.ts +0 -150
- package/src/state/diagramStore.layout.ts +0 -66
- package/src/state/diagramStore.ts +0 -1099
- package/src/ui/top-left/TopLeftPanel.tsx +0 -220
- package/src/xyflow/FitviewOnDiagramChange.tsx +0 -83
- package/src/xyflow/SelectEdgesOnNodeFocus.tsx +0 -106
- package/src/xyflow/XYFlow.tsx +0 -179
- package/src/xyflow/XYFlowInner.tsx +0 -48
- package/src/xyflow/edges/EdgeLabel.tsx +0 -193
- package/src/xyflow/edges/RelationshipEdge.tsx +0 -547
- package/src/xyflow/edges/edges.css.ts +0 -288
- package/src/xyflow/edges/utils.ts +0 -153
- package/src/xyflow/nodes/AnimateVariants.ts +0 -143
- package/src/xyflow/nodes/Node.css.ts +0 -44
- package/src/xyflow/nodes/compound/CompoundNode.css.ts +0 -258
- package/src/xyflow/nodes/compound/CompoundNode.tsx +0 -226
- package/src/xyflow/nodes/compound/index.ts +0 -1
- package/src/xyflow/nodes/element/ElementLink.css.ts +0 -67
- package/src/xyflow/nodes/element/ElementLink.tsx +0 -97
- package/src/xyflow/nodes/element/ElementNode.tsx +0 -208
- package/src/xyflow/nodes/element/element.css.ts +0 -369
- package/src/xyflow/nodes/element/index.ts +0 -1
- package/src/xyflow/nodes/shared/ElementIcon.tsx +0 -43
- package/src/xyflow/nodes/shared/Toolbar.tsx +0 -496
- package/src/xyflow/types.ts +0 -57
- package/src/xyflow/useXYFlowEvents.ts +0 -315
- /package/dist/{xyflow → base}/const.d.ts +0 -0
- /package/dist/{xyflow → base}/const.js +0 -0
- /package/dist/{ui → context}/EnsureMantine.d.ts +0 -0
- /package/dist/{ui → context}/EnsureMantine.js +0 -0
- /package/dist/{ui → context}/FramerMotionConfig.d.ts +0 -0
- /package/dist/{xyflow → likec4diagram/custom}/edges/RelationshipsDropdownMenu.css.d.ts +0 -0
- /package/dist/{ui/top-left → likec4diagram/ui/controls}/ChangeAutoLayoutButton.d.ts +0 -0
- /package/dist/{ui/top-left → likec4diagram/ui/controls}/ManualLayoutToolsButton.d.ts +0 -0
- /package/dist/{ui/top-left → likec4diagram/ui/controls}/_shared.d.ts +0 -0
- /package/dist/{ui → likec4diagram/ui/diagram-title}/DiagramTitlePanel.css.d.ts +0 -0
- /package/dist/{ui → likec4diagram/ui/diagram-title}/Link.js +0 -0
- /package/dist/{ui → likec4diagram/ui}/notation/NotationPanel.css.d.ts +0 -0
- /package/dist/{ui → likec4diagram/ui}/notation/index.d.ts +0 -0
- /package/dist/{ui → likec4diagram/ui/walkthrough}/DynamicViewWalkthrough.css.d.ts +0 -0
- /package/dist/{ui → likec4diagram/ui/walkthrough}/DynamicViewWalkthrough.d.ts +0 -0
- /package/src/{ui → context}/EnsureMantine.tsx +0 -0
- /package/src/{ui → likec4diagram/ui}/notation/index.ts +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// @ts-ignore
|
|
1
2
|
import { type ComputedNode, type ElementNotation as ElementNotationData } from '@likec4/core'
|
|
2
3
|
import {
|
|
3
4
|
ActionIcon,
|
|
@@ -14,19 +15,21 @@ import {
|
|
|
14
15
|
TabsTab,
|
|
15
16
|
Text,
|
|
16
17
|
ThemeIcon,
|
|
17
|
-
Tooltip
|
|
18
|
+
Tooltip,
|
|
18
19
|
} from '@mantine/core'
|
|
19
20
|
import { useLocalStorage } from '@mantine/hooks'
|
|
20
21
|
import { IconAlertTriangle, IconArrowDownRight, IconHelpCircle } from '@tabler/icons-react'
|
|
21
22
|
import clsx from 'clsx'
|
|
22
23
|
import { AnimatePresence, m } from 'framer-motion'
|
|
23
|
-
import { useState } from 'react'
|
|
24
|
-
import { ceil, isNonNullish
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import { useMantinePortalProps } from '
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
24
|
+
import { memo, useState } from 'react'
|
|
25
|
+
import { ceil, isNonNullish } from 'remeda'
|
|
26
|
+
// import { ElementShapeSvg } from '../../xyflow/nodes/element/ElementShapeSvg'
|
|
27
|
+
import { ElementShape } from '../../../base/primitives'
|
|
28
|
+
import { type DiagramContext, useMantinePortalProps } from '../../../hooks'
|
|
29
|
+
import { useDiagram } from '../../../hooks/useDiagram'
|
|
30
|
+
import { useDiagramContext } from '../../../hooks/useDiagramContext'
|
|
31
|
+
import { useXYStore } from '../../../hooks/useXYFlow'
|
|
32
|
+
import { vars } from '../../../theme-vars'
|
|
30
33
|
import * as css from './NotationPanel.css'
|
|
31
34
|
|
|
32
35
|
type NodeKind = ComputedNode['kind']
|
|
@@ -35,10 +38,10 @@ const ElementNotation = ({ value }: { value: ElementNotationData }) => {
|
|
|
35
38
|
const {
|
|
36
39
|
title,
|
|
37
40
|
color = 'primary',
|
|
38
|
-
shape = 'rectangle'
|
|
41
|
+
shape = 'rectangle',
|
|
39
42
|
} = value
|
|
40
43
|
const [onlyKind, setOnlyKind] = useState<NodeKind | null>(null)
|
|
41
|
-
const
|
|
44
|
+
const diagram = useDiagram()
|
|
42
45
|
const w = 300
|
|
43
46
|
const h = 200
|
|
44
47
|
return (
|
|
@@ -48,15 +51,15 @@ const ElementNotation = ({ value }: { value: ElementNotationData }) => {
|
|
|
48
51
|
py={'sm'}
|
|
49
52
|
className={css.elementNotation}
|
|
50
53
|
mod={{
|
|
51
|
-
'
|
|
54
|
+
'likec4-color': color,
|
|
52
55
|
}}
|
|
53
56
|
onMouseEnter={() => {
|
|
54
57
|
setOnlyKind(null)
|
|
55
|
-
diagramStore.getState().highlightByElementNotation(value)
|
|
58
|
+
// diagramStore.getState().highlightByElementNotation(value)
|
|
56
59
|
}}
|
|
57
60
|
onMouseLeave={() => {
|
|
58
61
|
setOnlyKind(null)
|
|
59
|
-
diagramStore.setState({ dimmed: new Set() })
|
|
62
|
+
// diagramStore.setState({ dimmed: new Set() })
|
|
60
63
|
}}
|
|
61
64
|
>
|
|
62
65
|
<Group
|
|
@@ -67,21 +70,17 @@ const ElementNotation = ({ value }: { value: ElementNotationData }) => {
|
|
|
67
70
|
<Box
|
|
68
71
|
flex={'0 0 70px'}
|
|
69
72
|
style={{
|
|
73
|
+
position: 'relative',
|
|
70
74
|
width: 70,
|
|
71
|
-
height: ceil(70 * (h / w), 0)
|
|
75
|
+
height: ceil(70 * (h / w), 0),
|
|
72
76
|
}}>
|
|
73
|
-
<
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
shape={shape}
|
|
81
|
-
w={w}
|
|
82
|
-
h={h}
|
|
83
|
-
/>
|
|
84
|
-
</svg>
|
|
77
|
+
<ElementShape
|
|
78
|
+
data={{
|
|
79
|
+
shape,
|
|
80
|
+
width: w,
|
|
81
|
+
height: h,
|
|
82
|
+
}}
|
|
83
|
+
/>
|
|
85
84
|
</Box>
|
|
86
85
|
<Stack gap={4} flex={1}>
|
|
87
86
|
<Group gap={4} flex={'0 0 auto'}>
|
|
@@ -91,11 +90,11 @@ const ElementNotation = ({ value }: { value: ElementNotationData }) => {
|
|
|
91
90
|
className={css.shapeBadge}
|
|
92
91
|
onMouseEnter={() => {
|
|
93
92
|
setOnlyKind(kind)
|
|
94
|
-
diagramStore.getState().highlightByElementNotation(value, kind)
|
|
93
|
+
// diagramStore.getState().highlightByElementNotation(value, kind)
|
|
95
94
|
}}
|
|
96
95
|
onMouseLeave={() => {
|
|
97
96
|
setOnlyKind(null)
|
|
98
|
-
diagramStore.getState().highlightByElementNotation(value)
|
|
97
|
+
// diagramStore.getState().highlightByElementNotation(value)
|
|
99
98
|
}}
|
|
100
99
|
opacity={isNonNullish(onlyKind) && onlyKind !== kind ? 0.25 : 1}
|
|
101
100
|
color={isNonNullish(onlyKind) && onlyKind !== kind ? 'gray' : vars.element.fill}
|
|
@@ -110,7 +109,7 @@ const ElementNotation = ({ value }: { value: ElementNotationData }) => {
|
|
|
110
109
|
fw={500}
|
|
111
110
|
lh="1.25"
|
|
112
111
|
style={{
|
|
113
|
-
textWrap: 'pretty'
|
|
112
|
+
textWrap: 'pretty',
|
|
114
113
|
}}>
|
|
115
114
|
{title}
|
|
116
115
|
</Text>
|
|
@@ -120,22 +119,23 @@ const ElementNotation = ({ value }: { value: ElementNotationData }) => {
|
|
|
120
119
|
)
|
|
121
120
|
}
|
|
122
121
|
|
|
123
|
-
const selector = (s:
|
|
122
|
+
const selector = (s: DiagramContext) => ({
|
|
124
123
|
id: s.view.id,
|
|
125
124
|
notations: s.view.notation?.elements ?? [],
|
|
126
|
-
isVisible:
|
|
125
|
+
isVisible: true,
|
|
126
|
+
// isVisible: isNullish(s.focusedNodeId ?? s.activeWalkthrough),
|
|
127
127
|
})
|
|
128
128
|
|
|
129
|
-
export
|
|
129
|
+
export const NotationPanel = memo(() => {
|
|
130
130
|
const height = useXYStore(s => s.height)
|
|
131
131
|
const {
|
|
132
132
|
id,
|
|
133
133
|
notations,
|
|
134
|
-
isVisible
|
|
135
|
-
} =
|
|
134
|
+
isVisible,
|
|
135
|
+
} = useDiagramContext(selector)
|
|
136
136
|
const [isCollapsed, setCollapsed] = useLocalStorage({
|
|
137
137
|
key: 'notation-webview-collapsed',
|
|
138
|
-
defaultValue: true
|
|
138
|
+
defaultValue: true,
|
|
139
139
|
})
|
|
140
140
|
const hasNotations = notations.length > 0
|
|
141
141
|
const portalProps = useMantinePortalProps()
|
|
@@ -149,7 +149,7 @@ export function NotationPanel() {
|
|
|
149
149
|
animate={{ opacity: 1, translateX: 0 }}
|
|
150
150
|
exit={{
|
|
151
151
|
translateX: '100%',
|
|
152
|
-
opacity: 0.6
|
|
152
|
+
opacity: 0.6,
|
|
153
153
|
}}
|
|
154
154
|
className={clsx('react-flow__panel', css.container)}>
|
|
155
155
|
<Tooltip label="View has no notations" color="orange" {...portalProps}>
|
|
@@ -171,7 +171,7 @@ export function NotationPanel() {
|
|
|
171
171
|
animate={{ opacity: 1, translateX: 0 }}
|
|
172
172
|
exit={{
|
|
173
173
|
translateX: '100%',
|
|
174
|
-
opacity: 0.6
|
|
174
|
+
opacity: 0.6,
|
|
175
175
|
}}
|
|
176
176
|
className={clsx('react-flow__panel', css.container)}
|
|
177
177
|
>
|
|
@@ -195,16 +195,16 @@ export function NotationPanel() {
|
|
|
195
195
|
initial={{
|
|
196
196
|
opacity: 0.75,
|
|
197
197
|
// translateX: '50%',
|
|
198
|
-
scale: 0.2
|
|
198
|
+
scale: 0.2,
|
|
199
199
|
}}
|
|
200
200
|
animate={{ opacity: 1, scale: 1 }}
|
|
201
201
|
exit={{
|
|
202
202
|
opacity: 0,
|
|
203
|
-
scale: 0.25
|
|
203
|
+
scale: 0.25,
|
|
204
204
|
}}
|
|
205
205
|
className={clsx('react-flow__panel', css.container)}
|
|
206
206
|
style={{
|
|
207
|
-
transformOrigin: 'bottom right'
|
|
207
|
+
transformOrigin: 'bottom right',
|
|
208
208
|
}}
|
|
209
209
|
>
|
|
210
210
|
<Paper
|
|
@@ -221,7 +221,7 @@ export function NotationPanel() {
|
|
|
221
221
|
color="gray"
|
|
222
222
|
ml={2}
|
|
223
223
|
style={{
|
|
224
|
-
alignSelf: 'center'
|
|
224
|
+
alignSelf: 'center',
|
|
225
225
|
}}
|
|
226
226
|
onClick={() => setCollapsed(true)}
|
|
227
227
|
>
|
|
@@ -237,8 +237,8 @@ export function NotationPanel() {
|
|
|
237
237
|
<ScrollAreaAutosize
|
|
238
238
|
viewportProps={{
|
|
239
239
|
style: {
|
|
240
|
-
maxHeight: `min(40vh, ${Math.max(height - 60, 50)}px)
|
|
241
|
-
}
|
|
240
|
+
maxHeight: `min(40vh, ${Math.max(height - 60, 50)}px)`,
|
|
241
|
+
},
|
|
242
242
|
}}>
|
|
243
243
|
<Stack gap={0}>
|
|
244
244
|
{notations.map((n, i) => <ElementNotation key={i} value={n} />)}
|
|
@@ -251,4 +251,4 @@ export function NotationPanel() {
|
|
|
251
251
|
)}
|
|
252
252
|
</AnimatePresence>
|
|
253
253
|
)
|
|
254
|
-
}
|
|
254
|
+
})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createVar, globalStyle, style } from '@vanilla-extract/css'
|
|
2
|
-
import { mantine } from '
|
|
2
|
+
import { mantine } from '../../../theme-vars'
|
|
3
3
|
|
|
4
4
|
export const container = style({
|
|
5
5
|
position: 'absolute',
|
|
@@ -14,9 +14,9 @@ export const container = style({
|
|
|
14
14
|
alignItems: 'center',
|
|
15
15
|
'@media': {
|
|
16
16
|
[mantine.largerThan('md')]: {
|
|
17
|
-
gap: '0.6rem'
|
|
18
|
-
}
|
|
19
|
-
}
|
|
17
|
+
gap: '0.6rem',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
20
|
})
|
|
21
21
|
|
|
22
22
|
export const buttons = style({
|
|
@@ -24,12 +24,12 @@ export const buttons = style({
|
|
|
24
24
|
transition: 'all 175ms ease-in',
|
|
25
25
|
':hover': {
|
|
26
26
|
transitionTimingFunction: 'ease-out',
|
|
27
|
-
transform: 'scale(1.1)'
|
|
27
|
+
transform: 'scale(1.1)',
|
|
28
28
|
},
|
|
29
29
|
':active': {
|
|
30
30
|
transitionDuration: '100ms',
|
|
31
|
-
transform: 'scale(0.98) translateY(3px)'
|
|
32
|
-
}
|
|
31
|
+
transform: 'scale(0.98) translateY(3px)',
|
|
32
|
+
},
|
|
33
33
|
})
|
|
34
34
|
|
|
35
35
|
var transparency = createVar()
|
|
@@ -39,20 +39,20 @@ export const btn = style({
|
|
|
39
39
|
vars: {
|
|
40
40
|
[transparency]: '35%',
|
|
41
41
|
['--button-bg']: `color-mix(in srgb, ${mantine.colors.primaryColors.filled}, transparent ${transparency})`,
|
|
42
|
-
['--button-hover']: `color-mix(in srgb, ${mantine.colors.primaryColors.filledHover}, transparent ${transparency})
|
|
42
|
+
['--button-hover']: `color-mix(in srgb, ${mantine.colors.primaryColors.filledHover}, transparent ${transparency})`,
|
|
43
43
|
},
|
|
44
44
|
selectors: {
|
|
45
45
|
[mantine.lightSelector]: {
|
|
46
46
|
vars: {
|
|
47
|
-
[transparency]: '15%'
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
47
|
+
[transparency]: '15%',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
51
|
})
|
|
52
52
|
|
|
53
53
|
globalStyle(`:where(${buttons}, ${btn}) .tabler-icon`, {
|
|
54
54
|
width: '0.85em',
|
|
55
|
-
height: '0.85em'
|
|
55
|
+
height: '0.85em',
|
|
56
56
|
})
|
|
57
57
|
|
|
58
58
|
export const parallelStateFrame = style({
|
|
@@ -67,7 +67,7 @@ export const parallelStateFrame = style({
|
|
|
67
67
|
pointerEvents: 'none',
|
|
68
68
|
'@media': {
|
|
69
69
|
[mantine.largerThan('md')]: {
|
|
70
|
-
borderWidth: 4
|
|
71
|
-
}
|
|
72
|
-
}
|
|
70
|
+
borderWidth: 4,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
73
|
})
|
|
@@ -1,73 +1,53 @@
|
|
|
1
|
-
import { nonNullable } from '@likec4/core'
|
|
2
1
|
import { Badge, Box, Button, ButtonGroup } from '@mantine/core'
|
|
3
|
-
import { useHotkeys } from '@mantine/hooks'
|
|
4
2
|
import {
|
|
5
3
|
IconPlayerPlayFilled,
|
|
6
4
|
IconPlayerSkipBackFilled,
|
|
7
5
|
IconPlayerSkipForwardFilled,
|
|
8
|
-
IconPlayerStopFilled
|
|
6
|
+
IconPlayerStopFilled,
|
|
9
7
|
} from '@tabler/icons-react'
|
|
10
8
|
import clsx from 'clsx'
|
|
11
9
|
import { AnimatePresence, m } from 'framer-motion'
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
10
|
+
import { isNonNull, isTruthy } from 'remeda'
|
|
11
|
+
import { useXYStore } from '../../../hooks'
|
|
12
|
+
import { useDiagram } from '../../../hooks/useDiagram'
|
|
13
|
+
import { useDiagramContext } from '../../../hooks/useDiagramContext'
|
|
14
14
|
import * as css from './DynamicViewWalkthrough.css'
|
|
15
15
|
|
|
16
16
|
export function DynamicViewWalkthrough() {
|
|
17
17
|
const isMobile = useXYStore(s => s.width <= 750)
|
|
18
18
|
const {
|
|
19
|
-
nextDynamicStep,
|
|
20
|
-
stopDynamicView,
|
|
21
19
|
isActive,
|
|
22
20
|
isParallel,
|
|
23
21
|
hasNext,
|
|
24
|
-
hasPrevious
|
|
25
|
-
} =
|
|
26
|
-
nextDynamicStep: s.nextDynamicStep,
|
|
27
|
-
stopDynamicView: s.stopWalkthrough,
|
|
22
|
+
hasPrevious,
|
|
23
|
+
} = useDiagramContext(s => ({
|
|
28
24
|
isActive: isNonNull(s.activeWalkthrough),
|
|
29
25
|
isParallel: isTruthy(s.activeWalkthrough?.parallelPrefix),
|
|
30
|
-
hasNext: s.activeWalkthrough?.
|
|
31
|
-
hasPrevious: s.activeWalkthrough?.
|
|
26
|
+
hasNext: s.xyedges.findIndex(e => e.id === s.activeWalkthrough?.stepId) < s.xyedges.length - 1,
|
|
27
|
+
hasPrevious: s.xyedges.findIndex(e => e.id === s.activeWalkthrough?.stepId) > 0,
|
|
32
28
|
}))
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
useHotkeys(
|
|
36
|
-
isActive
|
|
37
|
-
? [
|
|
38
|
-
['ArrowLeft', () => nextDynamicStep(-1)],
|
|
39
|
-
['ArrowRight', () => nextDynamicStep()],
|
|
40
|
-
['Escape', (e) => {
|
|
41
|
-
e.stopImmediatePropagation()
|
|
42
|
-
stopDynamicView()
|
|
43
|
-
}, { preventDefault: true }]
|
|
44
|
-
]
|
|
45
|
-
: [
|
|
46
|
-
['ArrowLeft', () => nextDynamicStep()],
|
|
47
|
-
['ArrowRight', () => nextDynamicStep()]
|
|
48
|
-
]
|
|
49
|
-
)
|
|
29
|
+
const diagram = useDiagram()
|
|
50
30
|
|
|
51
31
|
const buttonProps = {
|
|
52
32
|
className: css.btn,
|
|
53
33
|
size: isMobile ? 'compact-md' : 'lg',
|
|
54
|
-
radius: isMobile ? 'lg' : 'xl'
|
|
34
|
+
radius: isMobile ? 'lg' : 'xl',
|
|
55
35
|
}
|
|
56
36
|
|
|
57
|
-
const startWalkthrough = (e: React.MouseEvent) => {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
37
|
+
// const startWalkthrough = (e: React.MouseEvent) => {
|
|
38
|
+
// e.stopPropagation()
|
|
39
|
+
// const {
|
|
40
|
+
// xyedges,
|
|
41
|
+
// activateWalkthrough
|
|
42
|
+
// } = diagramApi.getState()
|
|
43
|
+
// const firstEdge = nonNullable(first(xyedges), 'expected at least one edge')
|
|
44
|
+
// activateWalkthrough(firstEdge.data.edge.id)
|
|
45
|
+
// }
|
|
66
46
|
|
|
67
|
-
const nextStep = (increment = 1) => (e: React.MouseEvent) => {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
47
|
+
// const nextStep = (increment = 1) => (e: React.MouseEvent) => {
|
|
48
|
+
// e.stopPropagation()
|
|
49
|
+
// nextDynamicStep(increment)
|
|
50
|
+
// }
|
|
71
51
|
|
|
72
52
|
return (
|
|
73
53
|
<AnimatePresence>
|
|
@@ -93,7 +73,7 @@ export function DynamicViewWalkthrough() {
|
|
|
93
73
|
{...buttonProps}
|
|
94
74
|
className={clsx(css.buttons, css.btn)}
|
|
95
75
|
rightSection={<IconPlayerPlayFilled />}
|
|
96
|
-
onClick={startWalkthrough}
|
|
76
|
+
onClick={() => diagram.startWalkthrough()}
|
|
97
77
|
px={'xl'}>
|
|
98
78
|
Start
|
|
99
79
|
</Button>
|
|
@@ -106,7 +86,7 @@ export function DynamicViewWalkthrough() {
|
|
|
106
86
|
animate={{ opacity: 1, transform: 'translateY(0)' }}
|
|
107
87
|
exit={{
|
|
108
88
|
opacity: 0,
|
|
109
|
-
transform: 'translateY(20px)'
|
|
89
|
+
transform: 'translateY(20px)',
|
|
110
90
|
}}
|
|
111
91
|
variant="gradient"
|
|
112
92
|
size={isMobile ? 'xs' : 'md'}
|
|
@@ -121,7 +101,7 @@ export function DynamicViewWalkthrough() {
|
|
|
121
101
|
{...buttonProps}
|
|
122
102
|
pl={'lg'}
|
|
123
103
|
disabled={!hasPrevious}
|
|
124
|
-
onClick={
|
|
104
|
+
onClick={() => diagram.walkthroughStep('previous')}>
|
|
125
105
|
<IconPlayerSkipBackFilled />
|
|
126
106
|
</Button>
|
|
127
107
|
|
|
@@ -130,7 +110,7 @@ export function DynamicViewWalkthrough() {
|
|
|
130
110
|
px={hasNext ? 'md' : 'xl'}
|
|
131
111
|
onClick={e => {
|
|
132
112
|
e.stopPropagation()
|
|
133
|
-
|
|
113
|
+
diagram.stopWalkthrough()
|
|
134
114
|
}}>
|
|
135
115
|
{hasNext && <IconPlayerStopFilled />}
|
|
136
116
|
{!hasNext && 'End'}
|
|
@@ -139,7 +119,7 @@ export function DynamicViewWalkthrough() {
|
|
|
139
119
|
<Button
|
|
140
120
|
{...buttonProps}
|
|
141
121
|
pr={'lg'}
|
|
142
|
-
onClick={
|
|
122
|
+
onClick={() => diagram.walkthroughStep('next')}>
|
|
143
123
|
<IconPlayerSkipForwardFilled />
|
|
144
124
|
</Button>
|
|
145
125
|
)}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { type NodeId, type NonEmptyArray, nonNullable } from '@likec4/core'
|
|
2
|
-
import type
|
|
2
|
+
import { type InternalNode as RFInternalNode, type NodeChange, type OnNodeDrag, type XYPosition } from '@xyflow/react'
|
|
3
3
|
import { getNodeDimensions } from '@xyflow/system'
|
|
4
4
|
import { useMemo, useRef } from 'react'
|
|
5
5
|
import { filter, hasAtLeast, isNullish, map, pipe } from 'remeda'
|
|
6
|
-
import {
|
|
7
|
-
import { type XYStoreApi } from '../hooks/useXYFlow'
|
|
8
|
-
import
|
|
6
|
+
import { type XYStoreApi, useXYStoreApi } from '../hooks'
|
|
7
|
+
// import { type XYStoreApi } from '../hooks/useXYFlow'
|
|
8
|
+
import { useSyncedRef } from '@react-hookz/web'
|
|
9
|
+
import { useDiagram } from '../hooks/useDiagram'
|
|
10
|
+
import type { Types } from './types'
|
|
11
|
+
|
|
12
|
+
type InternalNode = RFInternalNode<Types.Node>
|
|
9
13
|
|
|
10
14
|
abstract class Rect {
|
|
11
15
|
static readonly LeftPadding = 40
|
|
@@ -22,22 +26,24 @@ abstract class Rect {
|
|
|
22
26
|
get positionAbsolute(): XYPosition {
|
|
23
27
|
return {
|
|
24
28
|
x: this.minX,
|
|
25
|
-
y: this.minY
|
|
29
|
+
y: this.minY,
|
|
26
30
|
}
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
set positionAbsolute(pos: XYPosition) {
|
|
30
|
-
|
|
31
|
-
|
|
34
|
+
const x = Math.round(pos.x)
|
|
35
|
+
const y = Math.round(pos.y)
|
|
36
|
+
this.maxX += x - this.minX
|
|
37
|
+
this.maxY += y - this.minY
|
|
32
38
|
|
|
33
|
-
this.minX =
|
|
34
|
-
this.minY =
|
|
39
|
+
this.minX = x
|
|
40
|
+
this.minY = y
|
|
35
41
|
}
|
|
36
42
|
|
|
37
43
|
get dimensions() {
|
|
38
44
|
return {
|
|
39
45
|
width: this.maxX - this.minX,
|
|
40
|
-
height: this.maxY - this.minY
|
|
46
|
+
height: this.maxY - this.minY,
|
|
41
47
|
}
|
|
42
48
|
}
|
|
43
49
|
|
|
@@ -50,7 +56,7 @@ abstract class Rect {
|
|
|
50
56
|
const parentPosition = this.parent.positionAbsolute
|
|
51
57
|
return {
|
|
52
58
|
x: positionAbsolute.x - parentPosition.x,
|
|
53
|
-
y: positionAbsolute.y - parentPosition.y
|
|
59
|
+
y: positionAbsolute.y - parentPosition.y,
|
|
54
60
|
}
|
|
55
61
|
}
|
|
56
62
|
protected abstract parent: Compound | null
|
|
@@ -60,8 +66,8 @@ class Compound extends Rect {
|
|
|
60
66
|
public readonly children = [] as Rect[]
|
|
61
67
|
|
|
62
68
|
constructor(
|
|
63
|
-
xynode:
|
|
64
|
-
protected readonly parent: Compound | null = null
|
|
69
|
+
xynode: InternalNode,
|
|
70
|
+
protected readonly parent: Compound | null = null,
|
|
65
71
|
) {
|
|
66
72
|
super()
|
|
67
73
|
this.id = xynode.id
|
|
@@ -74,8 +80,8 @@ class Compound extends Rect {
|
|
|
74
80
|
|
|
75
81
|
class Leaf extends Rect {
|
|
76
82
|
constructor(
|
|
77
|
-
xynode:
|
|
78
|
-
public readonly parent: Compound | null = null
|
|
83
|
+
xynode: InternalNode,
|
|
84
|
+
public readonly parent: Compound | null = null,
|
|
79
85
|
) {
|
|
80
86
|
super()
|
|
81
87
|
this.id = xynode.id
|
|
@@ -94,12 +100,12 @@ class Leaf extends Rect {
|
|
|
94
100
|
}
|
|
95
101
|
|
|
96
102
|
type NodePositionUpdater = (
|
|
97
|
-
nodes: Array<{ rect: Rect | Compound; node:
|
|
103
|
+
nodes: Array<{ rect: Rect | Compound; node: InternalNode }>,
|
|
98
104
|
) => void
|
|
99
105
|
|
|
100
106
|
export function createLayoutConstraints(
|
|
101
107
|
xyflowApi: XYStoreApi,
|
|
102
|
-
editingNodeIds: NonEmptyArray<string
|
|
108
|
+
editingNodeIds: NonEmptyArray<string>,
|
|
103
109
|
) {
|
|
104
110
|
const { parentLookup, nodeLookup } = xyflowApi.getState()
|
|
105
111
|
const rects = new Map<string, Leaf | Compound>()
|
|
@@ -108,7 +114,7 @@ export function createLayoutConstraints(
|
|
|
108
114
|
const ancestors = [] as string[]
|
|
109
115
|
const xynode = nodeLookup.get(nodeId)
|
|
110
116
|
let parent = xynode?.parentId
|
|
111
|
-
let parentNode:
|
|
117
|
+
let parentNode: InternalNode | undefined
|
|
112
118
|
while (parent && (parentNode = nodeLookup.get(parent))) {
|
|
113
119
|
ancestors.push(parentNode.id as NodeId)
|
|
114
120
|
parent = parentNode.parentId
|
|
@@ -117,16 +123,16 @@ export function createLayoutConstraints(
|
|
|
117
123
|
}
|
|
118
124
|
|
|
119
125
|
const ancestorsOfDraggingNodes = new Set(
|
|
120
|
-
editingNodeIds.flatMap(ancestorsOf)
|
|
126
|
+
editingNodeIds.flatMap(ancestorsOf),
|
|
121
127
|
)
|
|
122
128
|
|
|
123
|
-
const traverse = new Array<{ xynode:
|
|
129
|
+
const traverse = new Array<{ xynode: InternalNode; parent: Compound | null }>()
|
|
124
130
|
|
|
125
131
|
for (const [, xynode] of nodeLookup) {
|
|
126
132
|
if (isNullish(xynode.parentId)) {
|
|
127
133
|
traverse.push({
|
|
128
134
|
xynode,
|
|
129
|
-
parent: null
|
|
135
|
+
parent: null,
|
|
130
136
|
})
|
|
131
137
|
}
|
|
132
138
|
}
|
|
@@ -136,7 +142,8 @@ export function createLayoutConstraints(
|
|
|
136
142
|
const isEditing = editingNodeIds.includes(xynode.id)
|
|
137
143
|
|
|
138
144
|
// Traverse children if the node is a compound, not dragging, and is an ancestor of the dragging node
|
|
139
|
-
const shouldTraverse = !isEditing &&
|
|
145
|
+
const shouldTraverse = !isEditing &&
|
|
146
|
+
(xynode.type === 'compound-element' || xynode.type === 'compound-deployment' || xynode.type === 'view-group')
|
|
140
147
|
&& ancestorsOfDraggingNodes.has(xynode.id)
|
|
141
148
|
|
|
142
149
|
const rect = shouldTraverse ? new Compound(xynode, parent) : new Leaf(xynode, parent)
|
|
@@ -146,7 +153,7 @@ export function createLayoutConstraints(
|
|
|
146
153
|
parentLookup.get(xynode.id)?.forEach(child => {
|
|
147
154
|
traverse.push({
|
|
148
155
|
xynode: child,
|
|
149
|
-
parent: rect as Compound
|
|
156
|
+
parent: rect as Compound,
|
|
150
157
|
})
|
|
151
158
|
})
|
|
152
159
|
}
|
|
@@ -165,12 +172,12 @@ export function createLayoutConstraints(
|
|
|
165
172
|
minX: Math.min(acc.minX, r.minX),
|
|
166
173
|
minY: Math.min(acc.minY, r.minY),
|
|
167
174
|
maxX: Math.max(acc.maxX, r.maxX),
|
|
168
|
-
maxY: Math.max(acc.maxY, r.maxY)
|
|
175
|
+
maxY: Math.max(acc.maxY, r.maxY),
|
|
169
176
|
}), {
|
|
170
177
|
minX: Infinity,
|
|
171
178
|
minY: Infinity,
|
|
172
179
|
maxX: -Infinity,
|
|
173
|
-
maxY: -Infinity
|
|
180
|
+
maxY: -Infinity,
|
|
174
181
|
})
|
|
175
182
|
|
|
176
183
|
r.minX = childrenBB.minX - Rect.LeftPadding
|
|
@@ -189,25 +196,25 @@ export function createLayoutConstraints(
|
|
|
189
196
|
type: 'position',
|
|
190
197
|
dragging: false,
|
|
191
198
|
position: r.position,
|
|
192
|
-
positionAbsolute: r.positionAbsolute
|
|
199
|
+
positionAbsolute: r.positionAbsolute,
|
|
193
200
|
})
|
|
194
201
|
if (r instanceof Compound) {
|
|
195
202
|
acc.push({
|
|
196
203
|
id: r.id,
|
|
197
204
|
type: 'dimensions',
|
|
198
205
|
setAttributes: true,
|
|
199
|
-
dimensions: r.dimensions
|
|
206
|
+
dimensions: r.dimensions,
|
|
200
207
|
})
|
|
201
208
|
}
|
|
202
209
|
return acc
|
|
203
|
-
}, [] as NodeChange<
|
|
210
|
+
}, [] as NodeChange<Types.Node>[]),
|
|
204
211
|
)
|
|
205
212
|
}
|
|
206
213
|
|
|
207
214
|
let animationFrameId: number | null = null
|
|
208
215
|
|
|
209
216
|
function onMove(
|
|
210
|
-
updater: NodePositionUpdater
|
|
217
|
+
updater: NodePositionUpdater,
|
|
211
218
|
) {
|
|
212
219
|
if (rectsToUpdate.length === 0) {
|
|
213
220
|
return
|
|
@@ -220,9 +227,9 @@ export function createLayoutConstraints(
|
|
|
220
227
|
filter(id => rects.has(id) && nodeLookup.has(id)),
|
|
221
228
|
map(id => ({
|
|
222
229
|
rect: nonNullable(rects.get(id)),
|
|
223
|
-
node: nonNullable(nodeLookup.get(id))
|
|
224
|
-
}))
|
|
225
|
-
)
|
|
230
|
+
node: nonNullable(nodeLookup.get(id)),
|
|
231
|
+
})),
|
|
232
|
+
),
|
|
226
233
|
)
|
|
227
234
|
updateXYFlowNodes()
|
|
228
235
|
})
|
|
@@ -230,28 +237,31 @@ export function createLayoutConstraints(
|
|
|
230
237
|
|
|
231
238
|
return {
|
|
232
239
|
updateXYFlowNodes,
|
|
233
|
-
onMove
|
|
240
|
+
onMove,
|
|
234
241
|
}
|
|
235
242
|
}
|
|
236
243
|
|
|
237
|
-
type LayoutConstraints =
|
|
244
|
+
type LayoutConstraints = {
|
|
245
|
+
onNodeDragStart: OnNodeDrag<Types.Node>
|
|
246
|
+
onNodeDrag: OnNodeDrag<Types.Node>
|
|
247
|
+
onNodeDragStop: OnNodeDrag<Types.Node>
|
|
248
|
+
}
|
|
238
249
|
/**
|
|
239
250
|
* Keeps the layout constraints (parent nodes and children) when dragging a node
|
|
240
251
|
*/
|
|
241
252
|
export function useLayoutConstraints(): LayoutConstraints {
|
|
242
|
-
const
|
|
243
|
-
const
|
|
253
|
+
const xystore = useXYStoreApi()
|
|
254
|
+
const diagram = useSyncedRef(useDiagram())
|
|
255
|
+
const solverRef = useRef<ReturnType<typeof createLayoutConstraints>>(undefined)
|
|
244
256
|
return useMemo((): LayoutConstraints => ({
|
|
245
257
|
onNodeDragStart: (_event, xynode) => {
|
|
246
|
-
|
|
258
|
+
diagram.current.cancelSaveManualLayout()
|
|
247
259
|
const { nodeLookup } = xystore.getState()
|
|
248
|
-
cancelSaveManualLayout()
|
|
249
|
-
|
|
250
260
|
const draggingNodes = pipe(
|
|
251
261
|
Array.from(nodeLookup.values()),
|
|
252
262
|
filter(n => n.dragging === true || n.id === xynode.id || n.selected === true),
|
|
253
263
|
filter(n => n.draggable !== false),
|
|
254
|
-
map(x => x.id)
|
|
264
|
+
map(x => x.id),
|
|
255
265
|
)
|
|
256
266
|
if (hasAtLeast(draggingNodes, 1)) {
|
|
257
267
|
solverRef.current = createLayoutConstraints(xystore, draggingNodes)
|
|
@@ -266,8 +276,9 @@ export function useLayoutConstraints(): LayoutConstraints {
|
|
|
266
276
|
},
|
|
267
277
|
onNodeDragStop: () => {
|
|
268
278
|
solverRef.current?.updateXYFlowNodes()
|
|
269
|
-
|
|
279
|
+
diagram.current.scheduleSaveManualLayout()
|
|
280
|
+
// diagramApi.getState().scheduleSaveManualLayout()
|
|
270
281
|
solverRef.current = undefined
|
|
271
|
-
}
|
|
272
|
-
}), [
|
|
282
|
+
},
|
|
283
|
+
}), [xystore])
|
|
273
284
|
}
|