@likec4/diagram 1.19.2 → 1.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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 -86
- 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 +24 -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 -8
- 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/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 +23 -20
- 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 +125 -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 -18
- 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 -227
- 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 -209
- 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
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DiagramView, WhereOperator } from '@likec4/core';
|
|
2
|
+
import { Types } from './types';
|
|
3
|
+
export declare function useViewToNodesEdges({ view: { id, nodes, edges, __, }, ...opts }: {
|
|
4
|
+
view: DiagramView;
|
|
5
|
+
where: WhereOperator<string, string> | undefined;
|
|
6
|
+
nodesDraggable: boolean;
|
|
7
|
+
nodesSelectable: boolean;
|
|
8
|
+
}): {
|
|
9
|
+
xynodes: Types.Node[];
|
|
10
|
+
xyedges: Types.Edge[];
|
|
11
|
+
};
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { Queue, whereOperatorAsPredicate, nonNullable, ElementKind, DiagramNode, invariant } from "@likec4/core";
|
|
2
|
+
import { useDeepCompareMemo } from "@react-hookz/web";
|
|
3
|
+
import { pick, hasAtLeast } from "remeda";
|
|
4
|
+
import { ZIndexes } from "../base/const.js";
|
|
5
|
+
function viewToNodesEdge(opts) {
|
|
6
|
+
const {
|
|
7
|
+
view,
|
|
8
|
+
nodesDraggable: draggable,
|
|
9
|
+
nodesSelectable: selectable
|
|
10
|
+
} = opts;
|
|
11
|
+
view.__ === "dynamic";
|
|
12
|
+
const xynodes = [], xyedges = [], nodeLookup = /* @__PURE__ */ new Map();
|
|
13
|
+
const queue = Queue.from(view.nodes.reduce(
|
|
14
|
+
(acc, node) => {
|
|
15
|
+
nodeLookup.set(node.id, node);
|
|
16
|
+
if (!node.parent) {
|
|
17
|
+
acc.push({ node, parent: null });
|
|
18
|
+
}
|
|
19
|
+
return acc;
|
|
20
|
+
},
|
|
21
|
+
[]
|
|
22
|
+
));
|
|
23
|
+
let visiblePredicate = (_nodeOrEdge) => true;
|
|
24
|
+
if (opts.where) {
|
|
25
|
+
try {
|
|
26
|
+
const filterablePredicate = whereOperatorAsPredicate(opts.where);
|
|
27
|
+
visiblePredicate = (i) => filterablePredicate({
|
|
28
|
+
...pick(i, ["tags", "kind"]),
|
|
29
|
+
..."source" in i ? { source: nodeById(i.source) } : i,
|
|
30
|
+
..."target" in i ? { target: nodeById(i.target) } : i
|
|
31
|
+
});
|
|
32
|
+
} catch (e) {
|
|
33
|
+
console.error("Error in where filter:", e);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const ns = "";
|
|
37
|
+
const nodeById = (id) => nonNullable(nodeLookup.get(id), `Node not found: ${id}`);
|
|
38
|
+
let next;
|
|
39
|
+
while (next = queue.dequeue()) {
|
|
40
|
+
const { node, parent } = next;
|
|
41
|
+
const isCompound = hasAtLeast(node.children, 1) || node.kind == ElementKind.Group;
|
|
42
|
+
if (isCompound) {
|
|
43
|
+
for (const child of node.children) {
|
|
44
|
+
queue.enqueue({ node: nodeById(child), parent: node });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const position = {
|
|
48
|
+
x: node.position[0],
|
|
49
|
+
y: node.position[1]
|
|
50
|
+
};
|
|
51
|
+
if (parent) {
|
|
52
|
+
position.x -= parent.position[0];
|
|
53
|
+
position.y -= parent.position[1];
|
|
54
|
+
}
|
|
55
|
+
const id = ns + node.id;
|
|
56
|
+
const base = {
|
|
57
|
+
id,
|
|
58
|
+
draggable,
|
|
59
|
+
selectable: selectable && node.kind !== ElementKind.Group,
|
|
60
|
+
focusable: selectable && !isCompound,
|
|
61
|
+
deletable: false,
|
|
62
|
+
position,
|
|
63
|
+
zIndex: isCompound ? ZIndexes.Compound : ZIndexes.Element,
|
|
64
|
+
style: {
|
|
65
|
+
width: node.width,
|
|
66
|
+
height: node.height
|
|
67
|
+
},
|
|
68
|
+
initialWidth: node.width,
|
|
69
|
+
initialHeight: node.height,
|
|
70
|
+
hidden: node.kind !== ElementKind.Group && !visiblePredicate(node),
|
|
71
|
+
...parent && {
|
|
72
|
+
parentId: ns + parent.id
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
const compoundData = {
|
|
76
|
+
id: node.id,
|
|
77
|
+
title: node.title,
|
|
78
|
+
color: node.color,
|
|
79
|
+
shape: node.shape,
|
|
80
|
+
style: node.style,
|
|
81
|
+
depth: node.depth ?? 0,
|
|
82
|
+
icon: node.icon ?? null,
|
|
83
|
+
position: node.position
|
|
84
|
+
};
|
|
85
|
+
const leafNodeData = {
|
|
86
|
+
id: node.id,
|
|
87
|
+
title: node.title,
|
|
88
|
+
technology: node.technology,
|
|
89
|
+
description: node.description,
|
|
90
|
+
height: node.height,
|
|
91
|
+
width: node.width,
|
|
92
|
+
level: node.level,
|
|
93
|
+
color: node.color,
|
|
94
|
+
shape: node.shape,
|
|
95
|
+
style: node.style,
|
|
96
|
+
icon: node.icon ?? null,
|
|
97
|
+
position: node.position
|
|
98
|
+
};
|
|
99
|
+
if (node.kind === ElementKind.Group) {
|
|
100
|
+
xynodes.push({
|
|
101
|
+
...base,
|
|
102
|
+
type: "view-group",
|
|
103
|
+
data: {
|
|
104
|
+
isViewGroup: true,
|
|
105
|
+
...compoundData
|
|
106
|
+
},
|
|
107
|
+
dragHandle: ".likec4-compound-title"
|
|
108
|
+
});
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
const modelFqn = DiagramNode.modelRef(node);
|
|
112
|
+
const deploymentFqn = DiagramNode.deploymentRef(node);
|
|
113
|
+
if (!modelFqn && !deploymentFqn) {
|
|
114
|
+
console.error("Invalid node", node);
|
|
115
|
+
throw new Error("Element should have either modelRef or deploymentRef");
|
|
116
|
+
}
|
|
117
|
+
const navigateTo = { navigateTo: node.navigateTo ?? null };
|
|
118
|
+
switch (true) {
|
|
119
|
+
case (isCompound && !!deploymentFqn): {
|
|
120
|
+
xynodes.push(
|
|
121
|
+
{
|
|
122
|
+
...base,
|
|
123
|
+
type: "compound-deployment",
|
|
124
|
+
data: {
|
|
125
|
+
...compoundData,
|
|
126
|
+
...navigateTo,
|
|
127
|
+
deploymentFqn,
|
|
128
|
+
modelFqn
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
);
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
case isCompound: {
|
|
135
|
+
invariant(!!modelFqn, "ModelRef expected");
|
|
136
|
+
xynodes.push(
|
|
137
|
+
{
|
|
138
|
+
...base,
|
|
139
|
+
type: "compound-element",
|
|
140
|
+
data: {
|
|
141
|
+
...compoundData,
|
|
142
|
+
...navigateTo,
|
|
143
|
+
modelFqn
|
|
144
|
+
},
|
|
145
|
+
dragHandle: ".likec4-compound-title"
|
|
146
|
+
}
|
|
147
|
+
);
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
case !!deploymentFqn: {
|
|
151
|
+
xynodes.push(
|
|
152
|
+
{
|
|
153
|
+
...base,
|
|
154
|
+
type: "deployment",
|
|
155
|
+
data: {
|
|
156
|
+
...leafNodeData,
|
|
157
|
+
...navigateTo,
|
|
158
|
+
deploymentFqn,
|
|
159
|
+
modelFqn
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
);
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
default: {
|
|
166
|
+
invariant(!!modelFqn, "ModelRef expected");
|
|
167
|
+
xynodes.push(
|
|
168
|
+
{
|
|
169
|
+
...base,
|
|
170
|
+
type: "element",
|
|
171
|
+
data: {
|
|
172
|
+
...leafNodeData,
|
|
173
|
+
...navigateTo,
|
|
174
|
+
modelFqn
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
for (const edge of view.edges) {
|
|
182
|
+
const source = edge.source;
|
|
183
|
+
const target = edge.target;
|
|
184
|
+
const id = ns + edge.id;
|
|
185
|
+
if (!hasAtLeast(edge.points, 2)) {
|
|
186
|
+
console.error("edge should have at least 2 points", edge);
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
xyedges.push({
|
|
190
|
+
id,
|
|
191
|
+
type: "relationship",
|
|
192
|
+
source: ns + source,
|
|
193
|
+
target: ns + target,
|
|
194
|
+
zIndex: ZIndexes.Edge,
|
|
195
|
+
selectable,
|
|
196
|
+
hidden: !visiblePredicate(edge),
|
|
197
|
+
deletable: false,
|
|
198
|
+
data: {
|
|
199
|
+
id: edge.id,
|
|
200
|
+
label: edge.label,
|
|
201
|
+
technology: edge.technology,
|
|
202
|
+
notes: edge.notes,
|
|
203
|
+
navigateTo: edge.navigateTo,
|
|
204
|
+
controlPoints: edge.controlPoints ?? null,
|
|
205
|
+
labelBBox: edge.labelBBox ?? null,
|
|
206
|
+
labelXY: edge.labelBBox ? { x: edge.labelBBox.x, y: edge.labelBBox.y } : null,
|
|
207
|
+
points: edge.points,
|
|
208
|
+
color: edge.color ?? "gray",
|
|
209
|
+
line: edge.line ?? "dashed",
|
|
210
|
+
dir: edge.dir ?? "forward",
|
|
211
|
+
head: edge.head ?? "normal",
|
|
212
|
+
tail: edge.tail ?? "none"
|
|
213
|
+
},
|
|
214
|
+
interactionWidth: 20
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
return {
|
|
218
|
+
xynodes,
|
|
219
|
+
xyedges
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
function useViewToNodesEdges({
|
|
223
|
+
view: {
|
|
224
|
+
id,
|
|
225
|
+
nodes,
|
|
226
|
+
edges,
|
|
227
|
+
__ = "element"
|
|
228
|
+
},
|
|
229
|
+
...opts
|
|
230
|
+
}) {
|
|
231
|
+
return useDeepCompareMemo(() => {
|
|
232
|
+
return viewToNodesEdge({
|
|
233
|
+
view: {
|
|
234
|
+
id,
|
|
235
|
+
nodes,
|
|
236
|
+
edges,
|
|
237
|
+
__
|
|
238
|
+
},
|
|
239
|
+
...opts
|
|
240
|
+
});
|
|
241
|
+
}, [id, __, nodes, edges, opts]);
|
|
242
|
+
}
|
|
243
|
+
export {
|
|
244
|
+
useViewToNodesEdges
|
|
245
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { useLikeC4ElementsTree, } from './useLikeC4ElementsTree';
|
|
2
|
-
export {
|
|
2
|
+
export { useLikeC4Model, } from './useLikeC4Model';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { LiteralUnion } from 'type-fest';
|
|
1
|
+
import { LikeC4Model } from '@likec4/core';
|
|
3
2
|
export declare function useLikeC4Model(): LikeC4Model | null;
|
|
4
3
|
export declare function useLikeC4Model(strict: true): LikeC4Model;
|
|
5
4
|
export declare function useLikeC4Model(strict: boolean): LikeC4Model | null;
|
|
@@ -9,12 +8,3 @@ export declare function useLikeC4Model(strict: true, type: 'layouted' | 'compute
|
|
|
9
8
|
export declare function useLikeC4Model(strict: boolean, type: 'layouted'): LikeC4Model.Layouted | null;
|
|
10
9
|
export declare function useLikeC4Model(strict: boolean, type: 'computed'): LikeC4Model.Computed | null;
|
|
11
10
|
export declare function useLikeC4Model(strict: boolean, type: 'layouted' | 'computed' | undefined): LikeC4Model | null;
|
|
12
|
-
export declare function useLikeC4Views(): Record<ViewId, ComputedView | DiagramView>;
|
|
13
|
-
export declare function useLikeC4ViewModel(viewId: LiteralUnion<ViewId, string>): LikeC4Model.View;
|
|
14
|
-
export declare function useLikeC4CurrentViewModel(): LikeC4Model.View;
|
|
15
|
-
/**
|
|
16
|
-
* Parsed view, computed or layouted
|
|
17
|
-
*/
|
|
18
|
-
export declare function useLikeC4View(viewId: LiteralUnion<ViewId, string>): ComputedView | DiagramView | null;
|
|
19
|
-
export declare function useLikeC4DiagramView(viewId: LiteralUnion<ViewId, string>): DiagramView | null;
|
|
20
|
-
export declare function useLikeC4ElementModel(fqn: LiteralUnion<Fqn, string>): LikeC4Model.Element;
|
|
@@ -2,7 +2,6 @@ import "@likec4/core";
|
|
|
2
2
|
import { useContext } from "react";
|
|
3
3
|
import { isString, isNonNullish, isDefined } from "remeda";
|
|
4
4
|
import { LikeC4ModelContext } from "./LikeC4ModelContext.js";
|
|
5
|
-
import { useCurrentViewId } from "../hooks/useDiagramState.js";
|
|
6
5
|
function useLikeC4Model(strict, type) {
|
|
7
6
|
const model = useContext(LikeC4ModelContext);
|
|
8
7
|
if (isString(type) && isNonNullish(model) && model.type !== type) {
|
|
@@ -13,43 +12,6 @@ function useLikeC4Model(strict, type) {
|
|
|
13
12
|
}
|
|
14
13
|
return model;
|
|
15
14
|
}
|
|
16
|
-
function useLikeC4Views() {
|
|
17
|
-
return useLikeC4Model(true).$model.views;
|
|
18
|
-
}
|
|
19
|
-
function useLikeC4ViewModel(viewId) {
|
|
20
|
-
return useLikeC4Model(true).view(viewId);
|
|
21
|
-
}
|
|
22
|
-
function useLikeC4CurrentViewModel() {
|
|
23
|
-
const viewId = useCurrentViewId();
|
|
24
|
-
return useLikeC4Model(true).view(viewId);
|
|
25
|
-
}
|
|
26
|
-
function useLikeC4View(viewId) {
|
|
27
|
-
const model = useLikeC4Model(true);
|
|
28
|
-
try {
|
|
29
|
-
return model.view(viewId).$view;
|
|
30
|
-
} catch (error) {
|
|
31
|
-
console.warn(error);
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
function useLikeC4DiagramView(viewId) {
|
|
36
|
-
const model = useLikeC4Model(true, "layouted");
|
|
37
|
-
try {
|
|
38
|
-
return model.view(viewId).$view;
|
|
39
|
-
} catch (error) {
|
|
40
|
-
console.warn(error);
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
function useLikeC4ElementModel(fqn) {
|
|
45
|
-
return useLikeC4Model(true).element(fqn);
|
|
46
|
-
}
|
|
47
15
|
export {
|
|
48
|
-
|
|
49
|
-
useLikeC4DiagramView,
|
|
50
|
-
useLikeC4ElementModel,
|
|
51
|
-
useLikeC4Model,
|
|
52
|
-
useLikeC4View,
|
|
53
|
-
useLikeC4ViewModel,
|
|
54
|
-
useLikeC4Views
|
|
16
|
+
useLikeC4Model
|
|
55
17
|
};
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { useHotkeys } from "@mantine/hooks";
|
|
2
|
+
import { Box, Notification, Code, Group, Button } from "@mantine/core";
|
|
4
3
|
import { IconX } from "@tabler/icons-react";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { memo,
|
|
4
|
+
import { useReducedMotion, AnimatePresence } from "framer-motion";
|
|
5
|
+
import { animate } from "framer-motion/dom";
|
|
6
|
+
import { memo, useMemo, useEffect } from "react";
|
|
8
7
|
import { ErrorBoundary } from "react-error-boundary";
|
|
9
|
-
import {
|
|
10
|
-
import { useDiagramStoreApi, useDiagramState } from "../hooks/useDiagramState.js";
|
|
11
|
-
import { EdgeDetailsXYFlow } from "./edge-details/EdgeDetailsXYFlow.js";
|
|
8
|
+
import { useDiagramActor, useDiagramActorState } from "../hooks/useDiagramActor.js";
|
|
12
9
|
import { ElementDetailsCard } from "./element-details/ElementDetailsCard.js";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
10
|
+
import { Overlay } from "./overlay/Overlay.js";
|
|
11
|
+
import { RelationshipDetails } from "./relationship-details/RelationshipDetails.js";
|
|
12
|
+
import { RelationshipsBrowser } from "./relationships-browser/RelationshipsBrowser.js";
|
|
13
|
+
import { useXYStore } from "../hooks/useXYFlow.js";
|
|
14
|
+
import { DiagramFeatures } from "../context/DiagramFeatures.js";
|
|
16
15
|
function Fallback({ error, resetErrorBoundary }) {
|
|
17
16
|
const errorString = error instanceof Error ? error.message : "Unknown error";
|
|
18
|
-
return /* @__PURE__ */ jsx(Box, {
|
|
17
|
+
return /* @__PURE__ */ jsx(Box, { pos: "fixed", top: 0, left: 0, w: "100%", p: 0, style: { zIndex: 1e3 }, children: /* @__PURE__ */ jsxs(
|
|
19
18
|
Notification,
|
|
20
19
|
{
|
|
21
20
|
icon: /* @__PURE__ */ jsx(IconX, { style: { width: 16, height: 16 } }),
|
|
@@ -26,111 +25,68 @@ function Fallback({ error, resetErrorBoundary }) {
|
|
|
26
25
|
},
|
|
27
26
|
color: "red",
|
|
28
27
|
title: "Oops, something went wrong",
|
|
29
|
-
|
|
28
|
+
p: "xl",
|
|
30
29
|
withCloseButton: false,
|
|
31
30
|
children: [
|
|
32
|
-
/* @__PURE__ */ jsx(
|
|
33
|
-
|
|
34
|
-
{
|
|
35
|
-
style: {
|
|
36
|
-
whiteSpace: "preserve-breaks"
|
|
37
|
-
},
|
|
38
|
-
children: errorString
|
|
39
|
-
}
|
|
40
|
-
),
|
|
41
|
-
/* @__PURE__ */ jsx(Group, { gap: "xs", mt: "sm", children: /* @__PURE__ */ jsx(Button, { color: "gray", size: "xs", variant: "light", onClick: () => resetErrorBoundary(), children: "Reset" }) })
|
|
31
|
+
/* @__PURE__ */ jsx(Code, { block: true, children: errorString }),
|
|
32
|
+
/* @__PURE__ */ jsx(Group, { gap: "xs", mt: "xl", children: /* @__PURE__ */ jsx(Button, { color: "gray", size: "xs", variant: "light", onClick: () => resetErrorBoundary(), children: "Reset" }) })
|
|
42
33
|
]
|
|
43
34
|
}
|
|
44
35
|
) });
|
|
45
36
|
}
|
|
46
37
|
const Overlays = memo(() => {
|
|
47
|
-
const
|
|
38
|
+
const xyflowDomNode = useXYStore((s) => s.domNode);
|
|
39
|
+
const xyflowRendererDom = useMemo(() => (xyflowDomNode == null ? void 0 : xyflowDomNode.querySelector(".react-flow__renderer")) ?? null, [
|
|
40
|
+
xyflowDomNode
|
|
41
|
+
]);
|
|
42
|
+
const { send } = useDiagramActor();
|
|
48
43
|
const {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
viewId: s.view.id
|
|
54
|
-
}));
|
|
55
|
-
const onCloseCbRef = useRef();
|
|
56
|
-
const ctxValue = useMemo(() => ({
|
|
57
|
-
openOverlay: (overlay) => {
|
|
58
|
-
diagramStore.getState().openOverlay(overlay);
|
|
59
|
-
},
|
|
60
|
-
close: (cb) => {
|
|
61
|
-
onCloseCbRef.current = cb;
|
|
62
|
-
diagramStore.getState().closeOverlay();
|
|
63
|
-
}
|
|
64
|
-
}), [diagramStore]);
|
|
65
|
-
const onExitComplete = () => {
|
|
44
|
+
relationshipsBrowserActor,
|
|
45
|
+
relationshipDetailsActor,
|
|
46
|
+
activeElementDetailsOf
|
|
47
|
+
} = useDiagramActorState((s) => {
|
|
66
48
|
var _a;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
49
|
+
return {
|
|
50
|
+
relationshipsBrowserActor: s.children.relationshipsBrowser,
|
|
51
|
+
relationshipDetailsActor: s.children.relationshipDetails,
|
|
52
|
+
activeElementDetailsOf: ((_a = s.context.activeElementDetails) == null ? void 0 : _a.fqn) ?? null
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
const isMotionReduced = useReducedMotion() ?? false;
|
|
56
|
+
const isActiveOverlay = !!activeElementDetailsOf;
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
if (!xyflowRendererDom || isMotionReduced) return;
|
|
59
|
+
animate(xyflowRendererDom, {
|
|
60
|
+
opacity: isActiveOverlay ? 0.7 : 1,
|
|
61
|
+
filter: isActiveOverlay ? "grayscale(1)" : "grayscale(0)",
|
|
62
|
+
transform: isActiveOverlay ? `perspective(400px) translateZ(-12px) translateY(3px)` : `translateY(0)`
|
|
63
|
+
}, {
|
|
64
|
+
duration: isActiveOverlay ? 0.35 : 0.17
|
|
65
|
+
});
|
|
66
|
+
}, [isActiveOverlay, xyflowRendererDom]);
|
|
67
|
+
return /* @__PURE__ */ jsx(DiagramFeatures.Overlays, { children: /* @__PURE__ */ jsx(ErrorBoundary, { FallbackComponent: Fallback, onReset: () => send({ type: "close.overlay" }), children: /* @__PURE__ */ jsxs(AnimatePresence, { children: [
|
|
68
|
+
relationshipsBrowserActor && /* @__PURE__ */ jsx(
|
|
69
|
+
Overlay,
|
|
83
70
|
{
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
"data-likec4-color": "gray",
|
|
87
|
-
initial: {
|
|
88
|
-
"--backdrop-blur": "0px",
|
|
89
|
-
"--backdrop-opacity": "0%",
|
|
90
|
-
opacity: 0,
|
|
91
|
-
translateY: -15
|
|
92
|
-
},
|
|
93
|
-
animate: {
|
|
94
|
-
"--backdrop-blur": "10px",
|
|
95
|
-
"--backdrop-opacity": "70%",
|
|
96
|
-
opacity: 1,
|
|
97
|
-
translateY: 0
|
|
71
|
+
onClose: () => {
|
|
72
|
+
relationshipsBrowserActor.send({ type: "close" });
|
|
98
73
|
},
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
74
|
+
children: /* @__PURE__ */ jsx(RelationshipsBrowser, { actorRef: relationshipsBrowserActor })
|
|
75
|
+
},
|
|
76
|
+
"relationships-browser"
|
|
77
|
+
),
|
|
78
|
+
relationshipDetailsActor && /* @__PURE__ */ jsx(
|
|
79
|
+
Overlay,
|
|
80
|
+
{
|
|
81
|
+
onClose: () => {
|
|
82
|
+
relationshipDetailsActor.send({ type: "close" });
|
|
107
83
|
},
|
|
108
|
-
children: /* @__PURE__ */
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
defaultEdges: [],
|
|
115
|
-
children: /* @__PURE__ */ jsx(EdgeDetailsXYFlow, { edgeId: activeOverlay.edgeDetails })
|
|
116
|
-
}
|
|
117
|
-
),
|
|
118
|
-
/* @__PURE__ */ jsx(Box, { pos: "absolute", top: "1rem", right: "1rem", children: /* @__PURE__ */ jsx(
|
|
119
|
-
ActionIcon,
|
|
120
|
-
{
|
|
121
|
-
variant: "default",
|
|
122
|
-
size: "lg",
|
|
123
|
-
onClick: (e) => {
|
|
124
|
-
e.stopPropagation();
|
|
125
|
-
ctxValue.close();
|
|
126
|
-
},
|
|
127
|
-
children: /* @__PURE__ */ jsx(IconX, {})
|
|
128
|
-
}
|
|
129
|
-
) })
|
|
130
|
-
] })
|
|
131
|
-
}
|
|
132
|
-
) }) })
|
|
133
|
-
] }) });
|
|
84
|
+
children: /* @__PURE__ */ jsx(RelationshipDetails, { actorRef: relationshipDetailsActor })
|
|
85
|
+
},
|
|
86
|
+
"relationship-details"
|
|
87
|
+
),
|
|
88
|
+
activeElementDetailsOf && /* @__PURE__ */ jsx(ElementDetailsCard, { fqn: activeElementDetailsOf })
|
|
89
|
+
] }) }) });
|
|
134
90
|
});
|
|
135
91
|
export {
|
|
136
92
|
Overlays
|