@likec4/diagram 1.30.0 → 1.32.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/README.md +324 -5
- package/bundle/chunk-BvTQaUYl.js +21851 -0
- package/bundle/custom.js +65 -0
- package/bundle/index.js +19910 -40570
- package/dist/LikeC4CustomColors.d.ts +2 -7
- package/dist/LikeC4CustomColors.js +17 -6
- package/dist/LikeC4Diagram.d.ts +3 -2
- package/dist/LikeC4Diagram.js +14 -16
- package/dist/LikeC4Diagram.props.d.ts +34 -23
- package/dist/LikeC4ModelProvider.d.ts +5 -4
- package/dist/LikeC4ModelProvider.js +0 -1
- package/dist/StaticLikeC4Diagram.d.ts +3 -2
- package/dist/StaticLikeC4Diagram.js +2 -2
- package/dist/base/BaseXYFlow.js +8 -8
- package/dist/base/const.d.ts +1 -1
- package/dist/base/const.js +1 -1
- package/dist/base/index.d.ts +2 -1
- package/dist/base/primitives/compound/CompoundActionButton.d.ts +3 -2
- package/dist/base/primitives/compound/CompoundActionButton.js +2 -1
- package/dist/base/primitives/compound/CompoundDetailsButton.d.ts +3 -2
- package/dist/base/primitives/compound/CompoundDetailsButton.js +2 -1
- package/dist/base/primitives/compound/CompoundNodeContainer.d.ts +7 -3
- package/dist/base/primitives/compound/CompoundNodeContainer.js +3 -2
- package/dist/base/primitives/compound/CompoundTitle.d.ts +1 -1
- package/dist/base/primitives/compound/CompoundTitle.js +2 -1
- package/dist/base/primitives/customEdge.d.ts +2 -35
- package/dist/base/primitives/customEdge.js +2 -2
- package/dist/base/primitives/customNode.d.ts +2 -2
- package/dist/base/primitives/customNode.js +9 -2
- package/dist/base/primitives/edge/EdgeContainer.d.ts +1 -1
- package/dist/base/primitives/edge/EdgeContainer.js +0 -1
- package/dist/base/primitives/edge/EdgeLabel.css.js +1 -0
- package/dist/base/primitives/edge/EdgeLabel.d.ts +3 -3
- package/dist/base/primitives/edge/EdgeLabel.js +6 -5
- package/dist/base/primitives/edge/EdgeLabelContainer.d.ts +1 -1
- package/dist/base/primitives/edge/EdgeLabelContainer.js +0 -2
- package/dist/base/primitives/edge/EdgeMarkers.d.ts +1 -1
- package/dist/base/primitives/edge/EdgePath.d.ts +1 -1
- package/dist/base/primitives/edge/EdgePath.js +2 -2
- package/dist/base/primitives/element/ElementActionButtons.js +10 -9
- package/dist/base/primitives/element/ElementDetailsButton.js +2 -1
- package/dist/base/primitives/element/ElementNodeContainer.d.ts +24 -22
- package/dist/base/primitives/element/ElementNodeContainer.js +66 -68
- package/dist/base/primitives/element/ElementShape.d.ts +8 -4
- package/dist/base/primitives/element/ElementShape.js +4 -3
- package/dist/base/primitives/element/ElementTags.d.ts +14 -0
- package/dist/base/primitives/element/ElementTags.js +176 -0
- package/dist/base/primitives/element/ElementTitle.css.d.ts +1 -1
- package/dist/base/primitives/element/ElementTitle.d.ts +5 -4
- package/dist/base/primitives/element/ElementTitle.js +6 -7
- package/dist/base/primitives/index.d.ts +1 -0
- package/dist/base/types.Base.d.ts +54 -0
- package/dist/base/types.Base.js +48 -0
- package/dist/base/types.d.ts +3 -53
- package/dist/bundle/LikeC4View.d.ts +2 -1
- package/dist/bundle/LikeC4View.js +13 -8
- package/dist/bundle/LikeC4View.props.d.ts +20 -5
- package/dist/bundle/ReactLikeC4.d.ts +4 -7
- package/dist/bundle/ReactLikeC4.js +4 -4
- package/dist/bundle/ShadowRoot.js +3 -3
- package/dist/bundle/custom.d.ts +1 -0
- package/dist/bundle/index.d.ts +3 -1
- package/dist/bundle/index.js +9 -0
- package/dist/bundle/styles.css.js +5 -5
- package/dist/components/ErrorFallback.d.ts +2 -0
- package/dist/components/ErrorFallback.js +29 -0
- package/dist/components/SearchControl.js +2 -2
- package/dist/context/ControlsCustomLayout.js +0 -1
- package/dist/context/DiagramEventHandlers.d.ts +6 -5
- package/dist/context/DiagramEventHandlers.js +5 -5
- package/dist/context/DiagramFeatures.d.ts +3 -5
- package/dist/context/DiagramFeatures.js +11 -40
- package/dist/context/EnsureMantine.js +9 -4
- package/dist/context/FramerMotionConfig.js +0 -1
- package/dist/context/IconRenderer.js +8 -11
- package/dist/context/ReduceGraphics.js +6 -6
- package/dist/context/RootContainer.js +10 -6
- package/dist/context/TagStylesContext.d.ts +7 -0
- package/dist/context/TagStylesContext.js +85 -0
- package/dist/context/index.d.ts +1 -1
- package/dist/custom/components.d.ts +5 -0
- package/dist/custom/customNodes.d.ts +228 -0
- package/dist/custom/hooks.d.ts +10 -0
- package/dist/custom/index.d.ts +4 -0
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/safeContext.js +3 -3
- package/dist/hooks/useCurrentViewId.d.ts +5 -1
- package/dist/hooks/useCurrentViewId.js +1 -2
- package/dist/hooks/useDiagram.d.ts +77 -12572
- package/dist/hooks/useDiagram.js +9 -7
- package/dist/hooks/useMantinePortalProps.d.ts +2 -2
- package/dist/hooks/useMantinePortalProps.js +2 -2
- package/dist/hooks/useSearchActor.d.ts +2 -0
- package/dist/hooks/useSearchActor.js +10 -0
- package/dist/hooks/useSetState.js +3 -3
- package/dist/hooks/useUpdateEffect.js +3 -1
- package/dist/hooks/useXYFlow.d.ts +75 -73
- package/dist/hooks/useXYFlow.js +7 -3
- package/dist/index.d.ts +2 -4
- package/dist/index.js +8 -3
- package/dist/likec4diagram/DiagramUI.js +9 -4
- package/dist/likec4diagram/DiagramXYFlow.d.ts +4 -3
- package/dist/likec4diagram/DiagramXYFlow.js +124 -109
- package/dist/likec4diagram/custom/edges/NotePopover.js +2 -2
- package/dist/likec4diagram/custom/edges/RelationshipEdge.d.ts +12 -15
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +16 -8
- package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.js +19 -15
- package/dist/likec4diagram/custom/index.d.ts +18 -21
- package/dist/likec4diagram/custom/index.js +3 -3
- package/dist/likec4diagram/custom/nodes/CompoundActions.js +2 -2
- package/dist/likec4diagram/custom/nodes/ElementActions.d.ts +27 -4
- package/dist/likec4diagram/custom/nodes/ElementActions.js +67 -53
- package/dist/likec4diagram/custom/nodes/index.d.ts +8 -0
- package/dist/likec4diagram/custom/nodes/nodes.d.ts +10 -0
- package/dist/likec4diagram/custom/nodes/nodes.js +105 -0
- package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +2 -2
- package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +6 -7
- package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.js +3 -3
- package/dist/likec4diagram/custom/nodes/toolbar/Toolbar.d.ts +3 -2
- package/dist/likec4diagram/custom/nodes/toolbar/Toolbar.js +2 -2
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.d.ts +5 -5
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +2 -2
- package/dist/likec4diagram/types.d.ts +18 -10
- package/dist/likec4diagram/ui/controls/ChangeAutoLayoutButton.js +4 -4
- package/dist/likec4diagram/ui/controls/Controls.js +14 -6
- package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.js +2 -2
- package/dist/likec4diagram/ui/notation/NotationPanel.js +7 -9
- package/dist/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.js +4 -4
- package/dist/likec4diagram/useLayoutConstraints.js +3 -4
- package/dist/likec4diagram/useViewToNodesEdges.d.ts +5 -3
- package/dist/likec4diagram/useViewToNodesEdges.js +22 -30
- package/dist/likec4model/LikeC4ModelContext.d.ts +2 -2
- package/dist/likec4model/LikeC4ModelContext.js +2 -2
- package/dist/likec4model/useLikeC4ElementsTree.d.ts +1 -1
- package/dist/likec4model/useLikeC4ElementsTree.js +4 -4
- package/dist/likec4model/useLikeC4Model.d.ts +22 -10
- package/dist/likec4model/useLikeC4Model.js +13 -9
- package/dist/overlays/Overlays.d.ts +2 -3
- package/dist/overlays/Overlays.js +9 -33
- package/dist/overlays/element-details/ElementDetailsCard.css.js +13 -9
- package/dist/overlays/element-details/ElementDetailsCard.d.ts +1 -1
- package/dist/overlays/element-details/ElementDetailsCard.js +110 -110
- package/dist/overlays/element-details/TabPanelDeployments.d.ts +1 -1
- package/dist/overlays/element-details/TabPanelDeployments.js +5 -5
- package/dist/overlays/element-details/TabPanelRelationships.d.ts +1 -1
- package/dist/overlays/element-details/TabPanelRelationships.js +2 -2
- package/dist/overlays/element-details/TabPanelStructure.d.ts +1 -1
- package/dist/overlays/element-details/TabPanelStructure.js +3 -3
- package/dist/overlays/element-details/actor.d.ts +5482 -18265
- package/dist/overlays/element-details/actor.js +0 -2
- package/dist/overlays/element-details/actorContext.js +3 -3
- package/dist/overlays/overlay/Overlay.css.d.ts +57 -2
- package/dist/overlays/overlay/Overlay.css.js +76 -39
- package/dist/overlays/overlay/Overlay.d.ts +23 -1
- package/dist/overlays/overlay/Overlay.js +40 -29
- package/dist/overlays/overlaysActor.d.ts +5 -3
- package/dist/overlays/overlaysActor.js +2 -1
- package/dist/overlays/relationship-details/RelationshipDetails.d.ts +6 -9
- package/dist/overlays/relationship-details/RelationshipDetails.js +15 -15
- package/dist/overlays/relationship-details/SelectEdge.js +2 -3
- package/dist/overlays/relationship-details/_types.d.ts +7 -6
- package/dist/overlays/relationship-details/actor.d.ts +3 -3
- package/dist/overlays/relationship-details/actor.js +7 -7
- package/dist/overlays/relationship-details/compute.js +3 -3
- package/dist/overlays/relationship-details/custom/edgeTypes.d.ts +6 -9
- package/dist/overlays/relationship-details/custom/edgeTypes.js +2 -2
- package/dist/overlays/relationship-details/custom/nodeTypes.d.ts +3 -31
- package/dist/overlays/relationship-details/custom/nodeTypes.js +4 -0
- package/dist/overlays/relationship-details/hooks.d.ts +28 -27
- package/dist/overlays/relationship-details/hooks.js +4 -4
- package/dist/overlays/relationship-details/layout-to-xyflow.js +1 -0
- package/dist/overlays/relationship-details/layout.js +5 -4
- package/dist/overlays/relationships-browser/RelationshipsBrowser.d.ts +6 -9
- package/dist/overlays/relationships-browser/RelationshipsBrowser.js +8 -8
- package/dist/overlays/relationships-browser/SelectElement.js +6 -6
- package/dist/overlays/relationships-browser/_types.d.ts +7 -6
- package/dist/overlays/relationships-browser/actor.d.ts +64 -429
- package/dist/overlays/relationships-browser/actor.js +7 -7
- package/dist/overlays/relationships-browser/custom/edgeTypes.d.ts +6 -9
- package/dist/overlays/relationships-browser/custom/edgeTypes.js +2 -2
- package/dist/overlays/relationships-browser/custom/nodeTypes.d.ts +17 -18
- package/dist/overlays/relationships-browser/custom/nodeTypes.js +5 -2
- package/dist/overlays/relationships-browser/hooks.d.ts +4 -61
- package/dist/overlays/relationships-browser/hooks.js +4 -4
- package/dist/overlays/relationships-browser/layout.d.ts +2 -2
- package/dist/overlays/relationships-browser/layout.js +13 -10
- package/dist/overlays/relationships-browser/useViewToNodesEdges.js +4 -3
- package/dist/search/Search.d.ts +5 -0
- package/dist/search/Search.js +192 -0
- package/dist/{likec4diagram/ui/search → search/components}/ElementsColumn.css.js +0 -1
- package/dist/search/components/ElementsColumn.d.ts +2 -0
- package/dist/{likec4diagram/ui/search → search/components}/ElementsColumn.js +26 -25
- package/dist/search/components/PickView.d.ts +4 -0
- package/dist/search/components/PickView.js +135 -0
- package/dist/search/components/SearchByTags.d.ts +1 -0
- package/dist/search/components/SearchByTags.js +116 -0
- package/dist/search/components/SearchInput.d.ts +2 -0
- package/dist/{likec4diagram/ui/search → search/components}/SearchInput.js +53 -35
- package/dist/{likec4diagram/ui/search → search/components}/ViewsColum.d.ts +3 -2
- package/dist/{likec4diagram/ui/search → search/components}/ViewsColum.js +14 -13
- package/dist/search/components/_shared.css.d.ts +4 -0
- package/dist/{likec4diagram/ui/search → search/components}/_shared.css.js +26 -35
- package/dist/{likec4diagram/ui/search/LikeC4Search.css.d.ts → search/components/styles.css.d.ts} +0 -2
- package/dist/search/components/styles.css.js +60 -0
- package/dist/{likec4diagram/ui/search → search/components}/utils.d.ts +1 -0
- package/dist/{likec4diagram/ui/search → search/components}/utils.js +7 -1
- package/dist/search/hooks.d.ts +16 -0
- package/dist/search/hooks.js +35 -0
- package/dist/search/searchActor.d.ts +90 -0
- package/dist/search/searchActor.js +75 -0
- package/dist/state/DiagramActorProvider.d.ts +9 -7
- package/dist/state/DiagramActorProvider.js +24 -18
- package/dist/state/assign.d.ts +0 -1
- package/dist/state/assign.js +9 -19
- package/dist/state/diagram-machine.d.ts +749 -10678
- package/dist/state/diagram-machine.js +121 -55
- package/dist/state/hotkeyActor.d.ts +4 -2
- package/dist/state/syncManualLayoutActor.d.ts +15 -4
- package/dist/state/syncManualLayoutActor.js +2 -1
- package/dist/state/types.d.ts +7 -4
- package/dist/state/utils.d.ts +3 -1
- package/dist/state/utils.js +3 -0
- package/dist/styles-font.css +1 -0
- package/dist/styles-min.css +1 -0
- package/dist/styles-xyflow.css +1 -0
- package/dist/styles.css +1 -0
- package/dist/styles.css2.js +3 -0
- package/package.json +50 -25
- package/panda.buildinfo.json +1002 -0
- package/src/LikeC4CustomColors.tsx +21 -6
- package/src/LikeC4Diagram.props.ts +42 -31
- package/src/LikeC4Diagram.tsx +21 -20
- package/src/LikeC4ModelProvider.tsx +7 -6
- package/src/StaticLikeC4Diagram.tsx +9 -6
- package/src/base/Background.tsx +0 -4
- package/src/base/const.ts +1 -1
- package/src/base/index.ts +2 -1
- package/src/base/primitives/compound/CompoundActionButton.tsx +9 -5
- package/src/base/primitives/compound/CompoundDetailsButton.tsx +9 -5
- package/src/base/primitives/compound/CompoundNodeContainer.tsx +8 -7
- package/src/base/primitives/compound/CompoundTitle.tsx +3 -2
- package/src/base/primitives/customEdge.ts +1 -1
- package/src/base/primitives/{customNode.ts → customNode.tsx} +11 -3
- package/src/base/primitives/edge/EdgeContainer.tsx +2 -1
- package/src/base/primitives/edge/EdgeLabel.css.ts +1 -0
- package/src/base/primitives/edge/EdgeLabel.tsx +20 -15
- package/src/base/primitives/edge/EdgeLabelContainer.tsx +1 -1
- package/src/base/primitives/edge/EdgeMarkers.tsx +2 -1
- package/src/base/primitives/edge/EdgePath.tsx +1 -1
- package/src/base/primitives/element/ElementActionButtons.tsx +11 -10
- package/src/base/primitives/element/ElementDetailsButton.tsx +2 -1
- package/src/base/primitives/element/ElementNodeContainer.tsx +87 -80
- package/src/base/primitives/element/ElementShape.tsx +12 -10
- package/src/base/primitives/element/ElementTags.tsx +182 -0
- package/src/base/primitives/element/ElementTitle.tsx +21 -15
- package/src/base/primitives/index.ts +1 -0
- package/src/base/types.Base.ts +104 -0
- package/src/base/types.ts +4 -106
- package/src/bundle/LikeC4View.props.ts +23 -5
- package/src/bundle/LikeC4View.tsx +20 -19
- package/src/bundle/ReactLikeC4.tsx +15 -27
- package/src/bundle/custom.ts +1 -0
- package/src/bundle/index.ts +20 -1
- package/src/bundle/styles.css.ts +1 -1
- package/src/components/ErrorFallback.tsx +30 -0
- package/src/components/SearchControl.tsx +1 -1
- package/src/context/DiagramEventHandlers.tsx +5 -4
- package/src/context/DiagramFeatures.tsx +15 -30
- package/src/context/EnsureMantine.tsx +13 -3
- package/src/context/IconRenderer.tsx +2 -5
- package/src/context/ReduceGraphics.tsx +6 -6
- package/src/context/RootContainer.tsx +9 -3
- package/src/context/TagStylesContext.tsx +96 -0
- package/src/context/index.ts +0 -1
- package/src/custom/components.ts +49 -0
- package/src/custom/customNodes.tsx +254 -0
- package/src/custom/hooks.ts +36 -0
- package/src/custom/index.ts +5 -0
- package/src/hooks/index.ts +1 -1
- package/src/hooks/useCurrentViewId.ts +6 -1
- package/src/hooks/useDiagram.ts +131 -18
- package/src/hooks/useMantinePortalProps.ts +10 -1
- package/src/hooks/useSearchActor.ts +11 -0
- package/src/hooks/useUpdateEffect.ts +7 -4
- package/src/hooks/useXYFlow.ts +5 -0
- package/src/index.ts +4 -8
- package/src/likec4diagram/DiagramUI.tsx +5 -0
- package/src/likec4diagram/DiagramXYFlow.tsx +135 -115
- package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +10 -1
- package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.tsx +17 -14
- package/src/likec4diagram/custom/{index.tsx → index.ts} +2 -2
- package/src/likec4diagram/custom/nodes/CompoundActions.tsx +2 -2
- package/src/likec4diagram/custom/nodes/ElementActions.tsx +100 -57
- package/src/likec4diagram/custom/nodes/index.ts +17 -0
- package/src/likec4diagram/custom/nodes/nodes.tsx +127 -0
- package/src/likec4diagram/custom/nodes/toolbar/CompoundToolbar.tsx +3 -4
- package/src/likec4diagram/custom/nodes/toolbar/ElementToolbar.tsx +3 -3
- package/src/likec4diagram/custom/nodes/toolbar/Toolbar.tsx +5 -4
- package/src/likec4diagram/custom/nodes/toolbar/_shared.tsx +11 -3
- package/src/likec4diagram/types.ts +24 -12
- package/src/likec4diagram/ui/controls/Controls.tsx +11 -4
- package/src/likec4diagram/ui/diagram-title/DiagramTitlePanel.tsx +1 -1
- package/src/likec4diagram/ui/notation/NotationPanel.tsx +3 -4
- package/src/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.tsx +1 -1
- package/src/likec4diagram/useViewToNodesEdges.ts +36 -36
- package/src/likec4model/LikeC4ModelContext.ts +2 -2
- package/src/likec4model/useLikeC4ElementsTree.ts +4 -2
- package/src/likec4model/useLikeC4Model.ts +18 -16
- package/src/overlays/Overlays.tsx +7 -35
- package/src/overlays/element-details/ElementDetailsCard.css.ts +14 -22
- package/src/overlays/element-details/ElementDetailsCard.tsx +43 -34
- package/src/overlays/element-details/TabPanelDeployments.tsx +3 -2
- package/src/overlays/element-details/TabPanelRelationships.tsx +2 -1
- package/src/overlays/element-details/TabPanelStructure.tsx +1 -1
- package/src/overlays/element-details/actor.ts +2 -2
- package/src/overlays/overlay/Overlay.css.ts +75 -38
- package/src/overlays/overlay/Overlay.tsx +45 -29
- package/src/overlays/overlaysActor.ts +5 -4
- package/src/overlays/relationship-details/RelationshipDetails.tsx +5 -5
- package/src/overlays/relationship-details/SelectEdge.tsx +0 -2
- package/src/overlays/relationship-details/_types.ts +18 -14
- package/src/overlays/relationship-details/custom/edgeTypes.tsx +2 -2
- package/src/overlays/relationship-details/custom/nodeTypes.tsx +4 -0
- package/src/overlays/relationship-details/layout-to-xyflow.ts +1 -0
- package/src/overlays/relationship-details/layout.ts +3 -1
- package/src/overlays/relationships-browser/SelectElement.tsx +1 -1
- package/src/overlays/relationships-browser/_types.ts +20 -16
- package/src/overlays/relationships-browser/actor.ts +2 -2
- package/src/overlays/relationships-browser/custom/edgeTypes.tsx +2 -2
- package/src/overlays/relationships-browser/custom/nodeTypes.tsx +5 -2
- package/src/overlays/relationships-browser/layout.ts +12 -7
- package/src/overlays/relationships-browser/useViewToNodesEdges.ts +4 -4
- package/src/search/Search.tsx +237 -0
- package/src/{likec4diagram/ui/search → search/components}/ElementsColumn.css.ts +0 -29
- package/src/{likec4diagram/ui/search → search/components}/ElementsColumn.tsx +25 -25
- package/src/search/components/PickView.tsx +140 -0
- package/src/search/components/SearchByTags.tsx +109 -0
- package/src/{likec4diagram/ui/search → search/components}/SearchInput.tsx +63 -36
- package/src/{likec4diagram/ui/search → search/components}/ViewsColum.tsx +17 -18
- package/src/{likec4diagram/ui/search → search/components}/_shared.css.ts +26 -37
- package/src/{likec4diagram/ui/search/LikeC4Search.css.ts → search/components/styles.css.ts} +9 -36
- package/src/{likec4diagram/ui/search → search/components}/utils.ts +7 -0
- package/src/search/hooks.ts +41 -0
- package/src/search/searchActor.ts +99 -0
- package/src/state/DiagramActorProvider.tsx +36 -25
- package/src/state/assign.ts +10 -10
- package/src/state/diagram-machine.ts +128 -60
- package/src/state/hotkeyActor.ts +4 -2
- package/src/state/syncManualLayoutActor.ts +10 -4
- package/src/state/types.ts +11 -3
- package/src/state/utils.ts +7 -3
- package/src/styles-min.css +2 -0
- package/src/styles-xyflow.css +1 -0
- package/dist/_virtual/_commonjsHelpers.js +0 -5
- package/dist/_virtual/default-map.js +0 -7
- package/dist/_virtual/index.js +0 -5
- package/dist/_virtual/index2.js +0 -3
- package/dist/_virtual/react.production.js +0 -3
- package/dist/_virtual/set.js +0 -5
- package/dist/_virtual/set2.js +0 -3
- package/dist/base/types.js +0 -54
- package/dist/base/xyflowMachine.d.ts +0 -212
- package/dist/likec4diagram/custom/nodes/nodeTypes.d.ts +0 -8
- package/dist/likec4diagram/custom/nodes/nodeTypes.js +0 -92
- package/dist/likec4diagram/ui/search/ElementsColumn.d.ts +0 -1
- package/dist/likec4diagram/ui/search/LikeC4Search.css.js +0 -87
- package/dist/likec4diagram/ui/search/LikeC4Search.d.ts +0 -2
- package/dist/likec4diagram/ui/search/LikeC4Search.js +0 -267
- package/dist/likec4diagram/ui/search/SearchInput.d.ts +0 -1
- package/dist/likec4diagram/ui/search/_shared.css.d.ts +0 -4
- package/dist/likec4diagram/ui/search/state.d.ts +0 -19
- package/dist/likec4diagram/ui/search/state.js +0 -64
- package/dist/node_modules/.pnpm/mnemonist@0.40.3_patch_hash_5c12abb43fcff6fd81e53021b89075d53249640d165a2556cc1e58d71201a13a/node_modules/mnemonist/default-map.js +0 -172
- package/dist/node_modules/.pnpm/mnemonist@0.40.3_patch_hash_5c12abb43fcff6fd81e53021b89075d53249640d165a2556cc1e58d71201a13a/node_modules/mnemonist/set.js +0 -369
- package/dist/node_modules/.pnpm/react@19.1.0/node_modules/react/cjs/react.production.js +0 -556
- package/dist/node_modules/.pnpm/react@19.1.0/node_modules/react/index.js +0 -15
- package/dist/packages/core/src/compute-view/relationships-view/compute.js +0 -123
- package/dist/packages/core/src/compute-view/relationships-view/utils.js +0 -68
- package/dist/packages/core/src/errors/index.js +0 -15
- package/dist/packages/core/src/model/connection/model/ConnectionModel.js +0 -121
- package/dist/packages/core/src/model/connection/model/find.js +0 -39
- package/dist/packages/core/src/model/connection/ops.js +0 -7
- package/dist/packages/core/src/utils/const.js +0 -3
- package/dist/packages/core/src/utils/fqn.js +0 -51
- package/dist/packages/core/src/utils/guards.js +0 -7
- package/dist/packages/core/src/utils/iterable/filter.js +0 -21
- package/dist/packages/core/src/utils/iterable/find.js +0 -21
- package/dist/packages/core/src/utils/iterable/map.js +0 -18
- package/dist/packages/core/src/utils/iterable/some.js +0 -21
- package/dist/packages/core/src/utils/iterable/to.js +0 -14
- package/dist/packages/core/src/utils/set.js +0 -48
- package/dist/packages/core/src/utils/string-hash.js +0 -13
- package/dist/styles.css.js +0 -3
- package/src/base/xyflowMachine.ts +0 -75
- package/src/likec4diagram/custom/nodes/nodeTypes.tsx +0 -109
- package/src/likec4diagram/ui/search/LikeC4Search.tsx +0 -301
- package/src/likec4diagram/ui/search/state.ts +0 -78
- /package/dist/{likec4diagram/ui/search → search/components}/ElementsColumn.css.d.ts +0 -0
- /package/dist/{likec4diagram/ui/search → search/components}/ViewsColumn.css.d.ts +0 -0
- /package/dist/{likec4diagram/ui/search → search/components}/ViewsColumn.css.js +0 -0
- /package/dist/{bundle/font.css.js → styles-font.css2.js} +0 -0
- /package/src/{likec4diagram/ui/search → search/components}/ViewsColumn.css.ts +0 -0
- /package/src/{bundle/font.css → styles-font.css} +0 -0
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { nonNullable, invariant,
|
|
1
|
+
import { nonNullable, invariant, nonexhaustive, BBox, isStepEdgeId, getParallelStepsPrefix } from '@likec4/core';
|
|
2
2
|
import { getViewportForBounds, applyEdgeChanges, applyNodeChanges } from '@xyflow/react';
|
|
3
3
|
import { nodeToRect } from '@xyflow/system';
|
|
4
4
|
import { hasAtLeast, prop, clamp, first } from 'remeda';
|
|
5
5
|
import { setup, assign, enqueueActions, sendTo, assertEvent, cancel, stopChild, raise, spawnChild, and, or } from 'xstate';
|
|
6
6
|
import { MinZoom } from '../base/const.js';
|
|
7
|
-
import { Base } from '../base/types.js';
|
|
8
7
|
import { AllDisabled } from '../context/DiagramFeatures.js';
|
|
9
8
|
import { createLayoutConstraints } from '../likec4diagram/useLayoutConstraints.js';
|
|
10
9
|
import { overlaysActorLogic } from '../overlays/overlaysActor.js';
|
|
10
|
+
import { searchActorLogic } from '../search/searchActor.js';
|
|
11
11
|
import { getAligner, toNodeRect } from './aligners.js';
|
|
12
|
-
import { lastClickedNode, updateNavigationHistory, mergeXYNodesEdges, updateEdgeData, updateNodeData,
|
|
12
|
+
import { updateActiveWalkthrough, focusNodesEdges, lastClickedNode, updateNavigationHistory, mergeXYNodesEdges, updateEdgeData, updateNodeData, resetEdgeControlPoints, navigateForward, navigateBack } from './assign.js';
|
|
13
13
|
import { hotkeyActorLogic } from './hotkeyActor.js';
|
|
14
14
|
import { DiagramToggledFeaturesPersistence } from './persistence.js';
|
|
15
15
|
import { syncManualLayoutActorLogic } from './syncManualLayoutActor.js';
|
|
16
16
|
import { findDiagramNode, typedSystem, focusedBounds } from './utils.js';
|
|
17
|
+
import { setData, setDimmed, setHovered } from '../base/types.Base.js';
|
|
17
18
|
|
|
18
|
-
const
|
|
19
|
+
const _diagramMachine = setup({
|
|
19
20
|
types: {
|
|
20
21
|
context: {},
|
|
21
22
|
input: {},
|
|
@@ -25,7 +26,8 @@ const diagramMachine = setup({
|
|
|
25
26
|
actors: {
|
|
26
27
|
syncManualLayoutActorLogic,
|
|
27
28
|
hotkeyActorLogic,
|
|
28
|
-
overlaysActorLogic
|
|
29
|
+
overlaysActorLogic,
|
|
30
|
+
searchActorLogic
|
|
29
31
|
},
|
|
30
32
|
guards: {
|
|
31
33
|
"isReady": ({ context }) => context.initialized.xydata && context.initialized.xyflow,
|
|
@@ -33,8 +35,9 @@ const diagramMachine = setup({
|
|
|
33
35
|
"enabled: FocusMode": ({ context }) => context.features.enableFocusMode,
|
|
34
36
|
"enabled: Readonly": ({ context }) => context.features.enableReadOnly,
|
|
35
37
|
"enabled: RelationshipDetails": ({ context }) => context.features.enableRelationshipDetails,
|
|
38
|
+
"enabled: Search": ({ context }) => context.features.enableSearch,
|
|
36
39
|
"not readonly": ({ context }) => !context.features.enableReadOnly,
|
|
37
|
-
"is dynamic view": ({ context }) => context.view.
|
|
40
|
+
"is dynamic view": ({ context }) => context.view._type === "dynamic",
|
|
38
41
|
"is another view": ({ context, event }) => {
|
|
39
42
|
assertEvent(event, ["update.view", "navigate.to"]);
|
|
40
43
|
if (event.type === "update.view") {
|
|
@@ -84,10 +87,10 @@ const diagramMachine = setup({
|
|
|
84
87
|
if (!nodeId || !context.features.enableVscode) return;
|
|
85
88
|
const diagramNode = findDiagramNode(context, nodeId);
|
|
86
89
|
if (!diagramNode) return;
|
|
87
|
-
if (
|
|
88
|
-
enqueue.raise({ type: "open.source", deployment:
|
|
89
|
-
} else if (
|
|
90
|
-
enqueue.raise({ type: "open.source", element:
|
|
90
|
+
if (diagramNode.deploymentRef) {
|
|
91
|
+
enqueue.raise({ type: "open.source", deployment: diagramNode.deploymentRef });
|
|
92
|
+
} else if (diagramNode.modelRef) {
|
|
93
|
+
enqueue.raise({ type: "open.source", element: diagramNode.modelRef });
|
|
91
94
|
}
|
|
92
95
|
}),
|
|
93
96
|
"xyflow:fitDiagram": ({ context }, params) => {
|
|
@@ -95,7 +98,7 @@ const diagramMachine = setup({
|
|
|
95
98
|
bounds = context.view.bounds,
|
|
96
99
|
duration = 450
|
|
97
100
|
} = params ?? {};
|
|
98
|
-
const { width, height, panZoom, transform } = context.xystore.getState();
|
|
101
|
+
const { width, height, panZoom, transform } = nonNullable(context.xystore).getState();
|
|
99
102
|
const maxZoom = Math.max(1, transform[2]);
|
|
100
103
|
const viewport = getViewportForBounds(
|
|
101
104
|
bounds,
|
|
@@ -111,7 +114,7 @@ const diagramMachine = setup({
|
|
|
111
114
|
},
|
|
112
115
|
"xyflow:fitFocusedBounds": ({ context }) => {
|
|
113
116
|
const { bounds, duration = 450 } = focusedBounds({ context });
|
|
114
|
-
const { width, height, panZoom, transform } = context.xystore.getState();
|
|
117
|
+
const { width, height, panZoom, transform } = nonNullable(context.xystore).getState();
|
|
115
118
|
const maxZoom = Math.max(1, transform[2]);
|
|
116
119
|
const viewport = getViewportForBounds(
|
|
117
120
|
bounds,
|
|
@@ -136,7 +139,7 @@ const diagramMachine = setup({
|
|
|
136
139
|
viewport,
|
|
137
140
|
duration = 350
|
|
138
141
|
} = params;
|
|
139
|
-
const
|
|
142
|
+
const panZoom = context.xystore?.getState().panZoom;
|
|
140
143
|
panZoom?.setViewport(viewport, duration > 0 ? { duration } : void 0);
|
|
141
144
|
},
|
|
142
145
|
"xyflow:alignNodeFromToAfterNavigate": ({ context }, params) => {
|
|
@@ -156,7 +159,7 @@ const diagramMachine = setup({
|
|
|
156
159
|
},
|
|
157
160
|
"layout.align": ({ context }, params) => {
|
|
158
161
|
const { mode } = params;
|
|
159
|
-
const
|
|
162
|
+
const xystore = nonNullable(context.xystore, "xystore is not initialized");
|
|
160
163
|
const { nodeLookup, parentLookup } = xystore.getState();
|
|
161
164
|
const selectedNodes = new Set(nodeLookup.values().filter((n) => n.selected).map((n) => n.id));
|
|
162
165
|
const nodesToAlign = [...selectedNodes.difference(new Set(parentLookup.keys()))];
|
|
@@ -179,12 +182,7 @@ const diagramMachine = setup({
|
|
|
179
182
|
}
|
|
180
183
|
constraints.updateXYFlowNodes();
|
|
181
184
|
},
|
|
182
|
-
"
|
|
183
|
-
assertEvent(event, "update.features");
|
|
184
|
-
const { features } = event;
|
|
185
|
-
enqueue.assign({
|
|
186
|
-
features: { ...features }
|
|
187
|
-
});
|
|
185
|
+
"ensure overlays actor state": enqueueActions(({ enqueue, context: { features }, system }) => {
|
|
188
186
|
const enableOverlays = features.enableElementDetails || features.enableRelationshipDetails || features.enableRelationshipBrowser;
|
|
189
187
|
const hasRunning = typedSystem(system).overlaysActorRef;
|
|
190
188
|
if (enableOverlays && !hasRunning) {
|
|
@@ -198,6 +196,31 @@ const diagramMachine = setup({
|
|
|
198
196
|
enqueue.stopChild("overlays");
|
|
199
197
|
}
|
|
200
198
|
}),
|
|
199
|
+
"ensure search actor state": enqueueActions(({ enqueue, context: { features: { enableSearch } }, system }) => {
|
|
200
|
+
const hasRunning = typedSystem(system).searchActorRef;
|
|
201
|
+
if (enableSearch && !hasRunning) {
|
|
202
|
+
enqueue.spawnChild("searchActorLogic", { id: "search", systemId: "search" });
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
if (!enableSearch && hasRunning) {
|
|
206
|
+
enqueue.sendTo(hasRunning, {
|
|
207
|
+
type: "close"
|
|
208
|
+
});
|
|
209
|
+
enqueue.stopChild("search");
|
|
210
|
+
}
|
|
211
|
+
}),
|
|
212
|
+
"updateFeatures": assign(({ event }) => {
|
|
213
|
+
assertEvent(event, "update.features");
|
|
214
|
+
return {
|
|
215
|
+
features: { ...event.features }
|
|
216
|
+
};
|
|
217
|
+
}),
|
|
218
|
+
"closeSearch": sendTo(
|
|
219
|
+
({ system }) => typedSystem(system).searchActorRef,
|
|
220
|
+
{
|
|
221
|
+
type: "close"
|
|
222
|
+
}
|
|
223
|
+
),
|
|
201
224
|
"closeAllOverlays": sendTo(
|
|
202
225
|
({ system }) => typedSystem(system).overlaysActorRef,
|
|
203
226
|
{
|
|
@@ -221,7 +244,7 @@ const diagramMachine = setup({
|
|
|
221
244
|
return {
|
|
222
245
|
xynodes: context.xynodes.map((n) => {
|
|
223
246
|
if (n.id === params.node.id) {
|
|
224
|
-
return
|
|
247
|
+
return setHovered(n, true);
|
|
225
248
|
}
|
|
226
249
|
return n;
|
|
227
250
|
})
|
|
@@ -231,7 +254,7 @@ const diagramMachine = setup({
|
|
|
231
254
|
return {
|
|
232
255
|
xynodes: context.xynodes.map((n) => {
|
|
233
256
|
if (n.id === params.node.id) {
|
|
234
|
-
return
|
|
257
|
+
return setHovered(n, false);
|
|
235
258
|
}
|
|
236
259
|
return n;
|
|
237
260
|
})
|
|
@@ -241,7 +264,7 @@ const diagramMachine = setup({
|
|
|
241
264
|
return {
|
|
242
265
|
xyedges: context.xyedges.map((e) => {
|
|
243
266
|
if (e.id === params.edge.id) {
|
|
244
|
-
return
|
|
267
|
+
return setHovered(e, true);
|
|
245
268
|
}
|
|
246
269
|
return e;
|
|
247
270
|
})
|
|
@@ -251,30 +274,50 @@ const diagramMachine = setup({
|
|
|
251
274
|
return {
|
|
252
275
|
xyedges: context.xyedges.map((e) => {
|
|
253
276
|
if (e.id === params.edge.id) {
|
|
254
|
-
return
|
|
277
|
+
return setHovered(e, false);
|
|
255
278
|
}
|
|
256
279
|
return e;
|
|
257
280
|
})
|
|
258
281
|
};
|
|
259
282
|
}),
|
|
283
|
+
"focus on nodes and edges": assign(focusNodesEdges),
|
|
260
284
|
"notations.highlight": assign(({ context }, params) => {
|
|
261
285
|
const kinds = params.kind ? [params.kind] : params.notation.kinds;
|
|
262
286
|
const xynodes = context.xynodes.map((n) => {
|
|
263
287
|
const node = findDiagramNode(context, n.id);
|
|
264
288
|
if (node && node.notation === params.notation.title && node.shape === params.notation.shape && node.color === params.notation.color && kinds.includes(node.kind)) {
|
|
265
|
-
return
|
|
289
|
+
return setDimmed(n, false);
|
|
266
290
|
}
|
|
267
|
-
return
|
|
291
|
+
return setDimmed(n, "immediate");
|
|
268
292
|
});
|
|
269
293
|
return {
|
|
270
294
|
xynodes,
|
|
271
|
-
xyedges: context.xyedges.map(
|
|
295
|
+
xyedges: context.xyedges.map(setDimmed("immediate"))
|
|
272
296
|
};
|
|
273
|
-
})
|
|
297
|
+
}),
|
|
298
|
+
"tag.highlight": assign(({ context, event }) => {
|
|
299
|
+
assertEvent(event, "tag.highlight");
|
|
300
|
+
return {
|
|
301
|
+
xynodes: context.xynodes.map((n) => {
|
|
302
|
+
if (n.data.tags?.includes(event.tag)) {
|
|
303
|
+
return setDimmed(n, false);
|
|
304
|
+
}
|
|
305
|
+
return setDimmed(n, "immediate");
|
|
306
|
+
})
|
|
307
|
+
};
|
|
308
|
+
}),
|
|
309
|
+
"undim everything": assign(({ context }) => ({
|
|
310
|
+
xynodes: context.xynodes.map(setDimmed(false)),
|
|
311
|
+
xyedges: context.xyedges.map(setData({
|
|
312
|
+
dimmed: false,
|
|
313
|
+
active: false
|
|
314
|
+
}))
|
|
315
|
+
})),
|
|
316
|
+
"update active walkthrough": assign(updateActiveWalkthrough)
|
|
274
317
|
}
|
|
275
318
|
}).createMachine({
|
|
276
319
|
initial: "initializing",
|
|
277
|
-
context: ({ input
|
|
320
|
+
context: ({ input }) => ({
|
|
278
321
|
...input,
|
|
279
322
|
xyedges: [],
|
|
280
323
|
xynodes: [],
|
|
@@ -329,7 +372,7 @@ const diagramMachine = setup({
|
|
|
329
372
|
}
|
|
330
373
|
}
|
|
331
374
|
},
|
|
332
|
-
|
|
375
|
+
isReady: {
|
|
333
376
|
always: [{
|
|
334
377
|
guard: "isReady",
|
|
335
378
|
actions: [
|
|
@@ -405,8 +448,8 @@ const diagramMachine = setup({
|
|
|
405
448
|
"open.elementDetails": {
|
|
406
449
|
actions: sendTo(({ system }) => typedSystem(system).overlaysActorRef, ({ context, event }) => {
|
|
407
450
|
let initiatedFrom = null;
|
|
408
|
-
const fromNodeId = event.fromNode ?? context.view.nodes.find((n) =>
|
|
409
|
-
const internalNode = fromNodeId ? context.xystore.getState().nodeLookup.get(fromNodeId) : null;
|
|
451
|
+
const fromNodeId = event.fromNode ?? context.view.nodes.find((n) => n.modelRef === event.fqn)?.id;
|
|
452
|
+
const internalNode = fromNodeId ? nonNullable(context.xystore).getState().nodeLookup.get(fromNodeId) : null;
|
|
410
453
|
if (fromNodeId && internalNode) {
|
|
411
454
|
const nodeRect = nodeToRect(internalNode);
|
|
412
455
|
const zoom = context.xyflow.getZoom();
|
|
@@ -497,10 +540,13 @@ const diagramMachine = setup({
|
|
|
497
540
|
}
|
|
498
541
|
},
|
|
499
542
|
"notations.unhighlight": {
|
|
500
|
-
actions:
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
543
|
+
actions: "undim everything"
|
|
544
|
+
},
|
|
545
|
+
"tag.highlight": {
|
|
546
|
+
actions: "tag.highlight"
|
|
547
|
+
},
|
|
548
|
+
"tag.unhighlight": {
|
|
549
|
+
actions: "undim everything"
|
|
504
550
|
},
|
|
505
551
|
"saveManualLayout.*": {
|
|
506
552
|
guard: "not readonly",
|
|
@@ -513,6 +559,13 @@ const diagramMachine = setup({
|
|
|
513
559
|
}
|
|
514
560
|
nonexhaustive(event);
|
|
515
561
|
})
|
|
562
|
+
},
|
|
563
|
+
"open.search": {
|
|
564
|
+
guard: "enabled: Search",
|
|
565
|
+
actions: sendTo(({ system }) => typedSystem(system).searchActorRef, ({ event }) => ({
|
|
566
|
+
type: "open",
|
|
567
|
+
search: event.search
|
|
568
|
+
}))
|
|
516
569
|
}
|
|
517
570
|
},
|
|
518
571
|
exit: [
|
|
@@ -592,8 +645,8 @@ const diagramMachine = setup({
|
|
|
592
645
|
},
|
|
593
646
|
focused: {
|
|
594
647
|
entry: [
|
|
648
|
+
"focus on nodes and edges",
|
|
595
649
|
assign((s) => ({
|
|
596
|
-
...focusNodesEdges(s),
|
|
597
650
|
viewportBeforeFocus: { ...s.context.viewport }
|
|
598
651
|
})),
|
|
599
652
|
"open source of focused or last clicked node",
|
|
@@ -605,10 +658,10 @@ const diagramMachine = setup({
|
|
|
605
658
|
if (context.viewportBeforeFocus) {
|
|
606
659
|
enqueue({ type: "xyflow:setViewport", params: { viewport: context.viewportBeforeFocus } });
|
|
607
660
|
} else {
|
|
608
|
-
enqueue(
|
|
661
|
+
enqueue("xyflow:fitDiagram");
|
|
609
662
|
}
|
|
663
|
+
enqueue("undim everything");
|
|
610
664
|
enqueue.assign({
|
|
611
|
-
...unfocusNodesEdges({ context}),
|
|
612
665
|
viewportBeforeFocus: null,
|
|
613
666
|
focusedNode: null
|
|
614
667
|
});
|
|
@@ -636,7 +689,7 @@ const diagramMachine = setup({
|
|
|
636
689
|
assign({
|
|
637
690
|
focusedNode: ({ event }) => event.nodeId
|
|
638
691
|
}),
|
|
639
|
-
|
|
692
|
+
"focus on nodes and edges",
|
|
640
693
|
"open source of focused or last clicked node",
|
|
641
694
|
"xyflow:fitFocusedBounds"
|
|
642
695
|
]
|
|
@@ -651,9 +704,10 @@ const diagramMachine = setup({
|
|
|
651
704
|
target: "idle"
|
|
652
705
|
},
|
|
653
706
|
"notations.unhighlight": {
|
|
654
|
-
actions:
|
|
655
|
-
|
|
656
|
-
|
|
707
|
+
actions: "focus on nodes and edges"
|
|
708
|
+
},
|
|
709
|
+
"tag.unhighlight": {
|
|
710
|
+
actions: "focus on nodes and edges"
|
|
657
711
|
}
|
|
658
712
|
}
|
|
659
713
|
},
|
|
@@ -671,7 +725,7 @@ const diagramMachine = setup({
|
|
|
671
725
|
};
|
|
672
726
|
}
|
|
673
727
|
}),
|
|
674
|
-
|
|
728
|
+
"update active walkthrough",
|
|
675
729
|
"xyflow:fitFocusedBounds"
|
|
676
730
|
],
|
|
677
731
|
on: {
|
|
@@ -702,7 +756,7 @@ const diagramMachine = setup({
|
|
|
702
756
|
parallelPrefix: getParallelStepsPrefix(nextStepId)
|
|
703
757
|
}
|
|
704
758
|
});
|
|
705
|
-
enqueue
|
|
759
|
+
enqueue("update active walkthrough");
|
|
706
760
|
enqueue("xyflow:fitFocusedBounds");
|
|
707
761
|
})
|
|
708
762
|
},
|
|
@@ -719,14 +773,15 @@ const diagramMachine = setup({
|
|
|
719
773
|
}
|
|
720
774
|
};
|
|
721
775
|
}),
|
|
722
|
-
|
|
776
|
+
"update active walkthrough",
|
|
723
777
|
"xyflow:fitFocusedBounds"
|
|
724
778
|
]
|
|
725
779
|
},
|
|
726
780
|
"notations.unhighlight": {
|
|
727
|
-
actions:
|
|
728
|
-
|
|
729
|
-
|
|
781
|
+
actions: "update active walkthrough"
|
|
782
|
+
},
|
|
783
|
+
"tag.unhighlight": {
|
|
784
|
+
actions: "update active walkthrough"
|
|
730
785
|
},
|
|
731
786
|
"walkthrough.end": {
|
|
732
787
|
target: "idle"
|
|
@@ -746,11 +801,11 @@ const diagramMachine = setup({
|
|
|
746
801
|
if (context.viewportBeforeFocus) {
|
|
747
802
|
enqueue({ type: "xyflow:setViewport", params: { viewport: context.viewportBeforeFocus } });
|
|
748
803
|
} else {
|
|
749
|
-
enqueue(
|
|
804
|
+
enqueue("xyflow:fitDiagram");
|
|
750
805
|
}
|
|
806
|
+
enqueue("undim everything");
|
|
751
807
|
enqueue.assign({
|
|
752
808
|
activeWalkthrough: null,
|
|
753
|
-
...unfocusNodesEdges({ context}),
|
|
754
809
|
viewportBeforeFocus: null
|
|
755
810
|
});
|
|
756
811
|
})
|
|
@@ -762,6 +817,7 @@ const diagramMachine = setup({
|
|
|
762
817
|
id: "navigating",
|
|
763
818
|
entry: [
|
|
764
819
|
"closeAllOverlays",
|
|
820
|
+
"closeSearch",
|
|
765
821
|
"stopSyncLayout",
|
|
766
822
|
{
|
|
767
823
|
type: "trigger:NavigateTo",
|
|
@@ -788,7 +844,7 @@ const diagramMachine = setup({
|
|
|
788
844
|
} else {
|
|
789
845
|
enqueue({
|
|
790
846
|
type: "xyflow:setViewportCenter",
|
|
791
|
-
params:
|
|
847
|
+
params: BBox.center(event.view.bounds)
|
|
792
848
|
});
|
|
793
849
|
}
|
|
794
850
|
enqueue.assign(updateNavigationHistory);
|
|
@@ -841,6 +897,7 @@ const diagramMachine = setup({
|
|
|
841
897
|
const isAnotherView = check("is another view");
|
|
842
898
|
if (isAnotherView) {
|
|
843
899
|
enqueue("closeAllOverlays");
|
|
900
|
+
enqueue("closeSearch");
|
|
844
901
|
enqueue("stopSyncLayout");
|
|
845
902
|
enqueue.assign({
|
|
846
903
|
focusedNode: null
|
|
@@ -861,7 +918,7 @@ const diagramMachine = setup({
|
|
|
861
918
|
} else {
|
|
862
919
|
enqueue({
|
|
863
920
|
type: "xyflow:setViewportCenter",
|
|
864
|
-
params:
|
|
921
|
+
params: BBox.center(event.view.bounds)
|
|
865
922
|
});
|
|
866
923
|
enqueue.raise({ type: "fitDiagram", duration: 200 }, { id: "fitDiagram", delay: 25 });
|
|
867
924
|
}
|
|
@@ -885,13 +942,19 @@ const diagramMachine = setup({
|
|
|
885
942
|
actions: assign(({ event }) => ({ ...event.inputs }))
|
|
886
943
|
},
|
|
887
944
|
"update.features": {
|
|
888
|
-
actions:
|
|
945
|
+
actions: [
|
|
946
|
+
"updateFeatures",
|
|
947
|
+
"ensure overlays actor state",
|
|
948
|
+
"ensure search actor state"
|
|
949
|
+
]
|
|
889
950
|
}
|
|
890
951
|
},
|
|
891
952
|
exit: [
|
|
892
953
|
"stopSyncLayout",
|
|
893
954
|
cancel("fitDiagram"),
|
|
894
955
|
stopChild("hotkey"),
|
|
956
|
+
stopChild("overlays"),
|
|
957
|
+
stopChild("search"),
|
|
895
958
|
assign({
|
|
896
959
|
xyflow: null,
|
|
897
960
|
xystore: null,
|
|
@@ -905,7 +968,9 @@ const diagramMachine = setup({
|
|
|
905
968
|
})
|
|
906
969
|
]
|
|
907
970
|
});
|
|
908
|
-
|
|
971
|
+
function nodeRef(node) {
|
|
972
|
+
return node.modelRef ?? node.deploymentRef;
|
|
973
|
+
}
|
|
909
974
|
function findCorrespondingNode(context, event) {
|
|
910
975
|
const fromNodeId = context.lastOnNavigate?.fromNode;
|
|
911
976
|
const fromNode = fromNodeId && context.view.nodes.find((n) => n.id === fromNodeId);
|
|
@@ -913,5 +978,6 @@ function findCorrespondingNode(context, event) {
|
|
|
913
978
|
const toNode = fromRef && event.view.nodes.find((n) => nodeRef(n) === fromRef);
|
|
914
979
|
return { fromNode, toNode };
|
|
915
980
|
}
|
|
981
|
+
const diagramMachine = _diagramMachine;
|
|
916
982
|
|
|
917
983
|
export { diagramMachine };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { AnyEventObject,
|
|
1
|
+
import { AnyEventObject, CallbackActorLogic, NonReducibleUnknown } from 'xstate';
|
|
2
2
|
export type HotKeyEvent = {
|
|
3
3
|
type: 'key.esc' | `key.arrow.${'left' | 'right'}`;
|
|
4
4
|
};
|
|
5
|
-
export
|
|
5
|
+
export interface HotkeyActorLogic extends CallbackActorLogic<AnyEventObject, NonReducibleUnknown, HotKeyEvent> {
|
|
6
|
+
}
|
|
7
|
+
export declare const hotkeyActorLogic: HotkeyActorLogic;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { ViewChange, ViewId } from '@likec4/core';
|
|
1
|
+
import { ViewChange, ViewId } from '@likec4/core/types';
|
|
2
2
|
import { ActorLogicFrom, ActorRef, MachineSnapshot, StateMachine, NonReducibleUnknown, EventObject, MetaObject, ActorRefFromLogic, AnyActorLogic, ConditionalRequired, InputFrom, RequiredLogicInput, IsNotNever, AnyActorRef, StateValue, AnyEventObject, ActionFunction } from 'xstate';
|
|
3
3
|
import { Context as DiagramContext, Events as DiagramEvents } from './diagram-machine';
|
|
4
4
|
export type Input = {
|
|
5
|
+
/**
|
|
6
|
+
* Actually this is DiagramActorRef
|
|
7
|
+
* But we can't use it here due to circular type inference
|
|
8
|
+
*/
|
|
5
9
|
parent: ActorRef<MachineSnapshot<DiagramContext, DiagramEvents, any, any, any, any, any, any>, DiagramEvents, any>;
|
|
6
10
|
viewId: ViewId;
|
|
7
11
|
};
|
|
@@ -15,7 +19,7 @@ export type Events = {
|
|
|
15
19
|
} | {
|
|
16
20
|
type: 'stop';
|
|
17
21
|
};
|
|
18
|
-
|
|
22
|
+
declare const _syncManualLayoutActorLogic: StateMachine<Readonly<Input>, Events, {}, never, {
|
|
19
23
|
type: "trigger:OnChange";
|
|
20
24
|
params: {
|
|
21
25
|
change: ViewChange;
|
|
@@ -23,7 +27,7 @@ export declare const syncManualLayoutActorLogic: StateMachine<Readonly<Input>, E
|
|
|
23
27
|
}, {
|
|
24
28
|
type: "same view";
|
|
25
29
|
params: unknown;
|
|
26
|
-
}, "timeout", "
|
|
30
|
+
}, "timeout", "paused" | "stopped" | "synced" | "pending" | "idle", "pending" | "ready", Input, NonReducibleUnknown, EventObject, MetaObject, {
|
|
27
31
|
readonly initial: "idle";
|
|
28
32
|
readonly context: ({ input }: {
|
|
29
33
|
spawn: {
|
|
@@ -38,6 +42,10 @@ export declare const syncManualLayoutActorLogic: StateMachine<Readonly<Input>, E
|
|
|
38
42
|
input: Input;
|
|
39
43
|
self: ActorRef<MachineSnapshot<Readonly<Input>, Events, Record<string, AnyActorRef | undefined>, StateValue, string, unknown, any, any>, Events, AnyEventObject>;
|
|
40
44
|
}) => {
|
|
45
|
+
/**
|
|
46
|
+
* Actually this is DiagramActorRef
|
|
47
|
+
* But we can't use it here due to circular type inference
|
|
48
|
+
*/
|
|
41
49
|
parent: ActorRef<MachineSnapshot<DiagramContext, DiagramEvents, any, any, any, any, any, any>, DiagramEvents, any>;
|
|
42
50
|
viewId: ViewId;
|
|
43
51
|
};
|
|
@@ -109,4 +117,7 @@ export declare const syncManualLayoutActorLogic: StateMachine<Readonly<Input>, E
|
|
|
109
117
|
};
|
|
110
118
|
};
|
|
111
119
|
}>;
|
|
112
|
-
export
|
|
120
|
+
export interface SyncLayoutActorLogic extends ActorLogicFrom<typeof _syncManualLayoutActorLogic> {
|
|
121
|
+
}
|
|
122
|
+
export declare const syncManualLayoutActorLogic: SyncLayoutActorLogic;
|
|
123
|
+
export {};
|
|
@@ -3,7 +3,7 @@ import { reduce, hasAtLeast } from 'remeda';
|
|
|
3
3
|
import { setup, assign } from 'xstate';
|
|
4
4
|
import { isSamePoint, bezierControlPoints } from '../utils/xyflow.js';
|
|
5
5
|
|
|
6
|
-
const
|
|
6
|
+
const _syncManualLayoutActorLogic = setup({
|
|
7
7
|
types: {
|
|
8
8
|
context: {},
|
|
9
9
|
input: {},
|
|
@@ -93,6 +93,7 @@ const syncManualLayoutActorLogic = setup({
|
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
});
|
|
96
|
+
const syncManualLayoutActorLogic = _syncManualLayoutActorLogic;
|
|
96
97
|
function createViewChange(parentContext) {
|
|
97
98
|
const { view, xystore, xyflow } = parentContext;
|
|
98
99
|
const { nodeLookup } = xystore.getState();
|
package/dist/state/types.d.ts
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import { ActorRefFromLogic, ActorSystem, SnapshotFrom } from 'xstate';
|
|
1
|
+
import { ActorRefFromLogic, ActorSystem, EventFromLogic, SnapshotFrom } from 'xstate';
|
|
2
2
|
import { OverlaysActorRef } from '../overlays/overlaysActor';
|
|
3
|
+
import { SearchActorRef } from '../search/searchActor';
|
|
3
4
|
import { DiagramMachineLogic } from './diagram-machine';
|
|
4
5
|
import { SyncLayoutActorLogic } from './syncManualLayoutActor';
|
|
5
6
|
export type System = ActorSystem<{
|
|
6
7
|
actors: {
|
|
7
|
-
diagram:
|
|
8
|
+
diagram: ActorRefFromLogic<DiagramMachineLogic>;
|
|
8
9
|
overlays: OverlaysActorRef;
|
|
10
|
+
search: SearchActorRef;
|
|
9
11
|
};
|
|
10
12
|
}>;
|
|
11
|
-
export
|
|
13
|
+
export interface DiagramActorRef extends ActorRefFromLogic<DiagramMachineLogic> {
|
|
12
14
|
system: System;
|
|
13
|
-
}
|
|
15
|
+
}
|
|
14
16
|
export type DiagramActorSnapshot = SnapshotFrom<DiagramMachineLogic>;
|
|
17
|
+
export type DiagramActorEvent = EventFromLogic<DiagramMachineLogic>;
|
|
15
18
|
export type { Context as DiagramContext } from './diagram-machine';
|
|
16
19
|
export type SyncLayoutActorRef = Omit<ActorRefFromLogic<SyncLayoutActorLogic>, 'system'> & {
|
|
17
20
|
system: System;
|
package/dist/state/utils.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { BBox,
|
|
1
|
+
import { BBox, DiagramEdge, DiagramNode } from '@likec4/core/types';
|
|
2
2
|
import { ActorSystem } from 'xstate';
|
|
3
3
|
import { OverlaysActorRef } from '../overlays/overlaysActor';
|
|
4
|
+
import { SearchActorRef } from '../search/searchActor';
|
|
4
5
|
import { Context } from './diagram-machine';
|
|
5
6
|
import { DiagramActorRef } from './types';
|
|
6
7
|
export declare function typedSystem(system: ActorSystem<any>): {
|
|
7
8
|
readonly overlaysActorRef: OverlaysActorRef | null;
|
|
8
9
|
readonly diagramActorRef: DiagramActorRef | null;
|
|
10
|
+
readonly searchActorRef: SearchActorRef | null;
|
|
9
11
|
};
|
|
10
12
|
export declare function findDiagramNode(ctx: Context, xynodeId: string): DiagramNode | null;
|
|
11
13
|
export declare function findDiagramEdge(ctx: Context, xyedgeId: string): DiagramEdge | null;
|
package/dist/state/utils.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@font-face{font-family:IBM Plex Sans;font-style:normal;font-display:swap;font-weight:400;src:url(https://cdn.jsdelivr.net/fontsource/fonts/ibm-plex-sans@latest/latin-400-normal.woff2) format("woff2"),url(https://cdn.jsdelivr.net/fontsource/fonts/ibm-plex-sans@latest/latin-400-normal.woff) format("woff");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:IBM Plex Sans;font-style:normal;font-display:swap;font-weight:500;src:url(https://cdn.jsdelivr.net/fontsource/fonts/ibm-plex-sans@latest/latin-500-normal.woff2) format("woff2"),url(https://cdn.jsdelivr.net/fontsource/fonts/ibm-plex-sans@latest/latin-500-normal.woff) format("woff");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:IBM Plex Sans;font-style:normal;font-display:swap;font-weight:600;src:url(https://cdn.jsdelivr.net/fontsource/fonts/ibm-plex-sans@latest/latin-600-normal.woff2) format("woff2"),url(https://cdn.jsdelivr.net/fontsource/fonts/ibm-plex-sans@latest/latin-600-normal.woff) format("woff");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:IBM Plex Sans;font-style:normal;font-display:swap;font-weight:400;src:url(https://cdn.jsdelivr.net/fontsource/fonts/ibm-plex-sans@latest/cyrillic-400-normal.woff2) format("woff2"),url(https://cdn.jsdelivr.net/fontsource/fonts/ibm-plex-sans@latest/cyrillic-400-normal.woff) format("woff");unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:IBM Plex Sans;font-style:normal;font-display:swap;font-weight:500;src:url(https://cdn.jsdelivr.net/fontsource/fonts/ibm-plex-sans@latest/cyrillic-500-normal.woff2) format("woff2"),url(https://cdn.jsdelivr.net/fontsource/fonts/ibm-plex-sans@latest/cyrillic-500-normal.woff) format("woff");unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:IBM Plex Sans;font-style:normal;font-display:swap;font-weight:600;src:url(https://cdn.jsdelivr.net/fontsource/fonts/ibm-plex-sans@latest/cyrillic-600-normal.woff2) format("woff2"),url(https://cdn.jsdelivr.net/fontsource/fonts/ibm-plex-sans@latest/cyrillic-600-normal.woff) format("woff");unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:IBM Plex Sans;font-style:normal;font-display:swap;font-weight:400;src:url(https://cdn.jsdelivr.net/fontsource/fonts/ibm-plex-sans@latest/cyrillic-ext-400-normal.woff2) format("woff2"),url(https://cdn.jsdelivr.net/fontsource/fonts/ibm-plex-sans@latest/cyrillic-ext-400-normal.woff) format("woff");unicode-range:U+0460-052F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:IBM Plex Sans;font-style:normal;font-display:swap;font-weight:500;src:url(https://cdn.jsdelivr.net/fontsource/fonts/ibm-plex-sans@latest/cyrillic-ext-500-normal.woff2) format("woff2"),url(https://cdn.jsdelivr.net/fontsource/fonts/ibm-plex-sans@latest/cyrillic-ext-500-normal.woff) format("woff");unicode-range:U+0460-052F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:IBM Plex Sans;font-style:normal;font-display:swap;font-weight:600;src:url(https://cdn.jsdelivr.net/fontsource/fonts/ibm-plex-sans@latest/cyrillic-ext-600-normal.woff2) format("woff2"),url(https://cdn.jsdelivr.net/fontsource/fonts/ibm-plex-sans@latest/cyrillic-ext-600-normal.woff) format("woff");unicode-range:U+0460-052F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:IBM Plex Sans;font-style:normal;font-display:swap;font-weight:400;src:url(https://cdn.jsdelivr.net/fontsource/fonts/ibm-plex-sans@latest/latin-ext-400-normal.woff2) format("woff2"),url(https://cdn.jsdelivr.net/fontsource/fonts/ibm-plex-sans@latest/latin-ext-400-normal.woff) format("woff");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:IBM Plex Sans;font-style:normal;font-display:swap;font-weight:500;src:url(https://cdn.jsdelivr.net/fontsource/fonts/ibm-plex-sans@latest/latin-ext-500-normal.woff2) format("woff2"),url(https://cdn.jsdelivr.net/fontsource/fonts/ibm-plex-sans@latest/latin-ext-500-normal.woff) format("woff");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:IBM Plex Sans;font-style:normal;font-display:swap;font-weight:600;src:url(https://cdn.jsdelivr.net/fontsource/fonts/ibm-plex-sans@latest/latin-ext-600-normal.woff2) format("woff2"),url(https://cdn.jsdelivr.net/fontsource/fonts/ibm-plex-sans@latest/latin-ext-600-normal.woff) format("woff");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}
|