@likec4/diagram 1.43.0 → 1.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/index.js +14727 -13166
- package/dist/LikeC4Diagram.d.ts +1 -1
- package/dist/LikeC4Diagram.js +14 -9
- package/dist/LikeC4Diagram.props.d.ts +25 -15
- package/dist/LikeC4ProjectsProvider.js +1 -1
- package/dist/LikeC4Styles.js +0 -3
- package/dist/LikeC4View.d.ts +8 -3
- package/dist/LikeC4View.js +29 -14
- package/dist/ReactLikeC4.d.ts +2 -2
- package/dist/ReactLikeC4.js +2 -2
- package/dist/StaticLikeC4Diagram.js +1 -1
- package/dist/_virtual/_commonjsHelpers.js +3 -0
- package/dist/_virtual/assign-dea9f7c8.cjs.js +3 -0
- package/dist/_virtual/log-ec8d4df4.cjs.js +3 -0
- package/dist/_virtual/raise-da5b247f.cjs.js +3 -0
- package/dist/_virtual/xstate-actions.cjs.js +5 -0
- package/dist/_virtual/xstate-actions.cjs2.js +3 -0
- package/dist/_virtual/xstate-dev.cjs.js +3 -0
- package/dist/_virtual/xstate-guards.cjs.js +5 -0
- package/dist/_virtual/xstate-guards.cjs2.js +3 -0
- package/dist/base/Background.d.ts +2 -1
- package/dist/base/Background.js +11 -2
- package/dist/base/Base.d.ts +28 -0
- package/dist/base/BaseXYFlow.d.ts +5 -5
- package/dist/base/BaseXYFlow.js +38 -44
- package/dist/base/index.d.ts +6 -2
- package/dist/base/types.d.ts +1 -28
- package/dist/base/updateEdges.js +25 -14
- package/dist/base/updateNodes.d.ts +14 -0
- package/dist/base/updateNodes.js +51 -17
- package/dist/base-primitives/Markdown.d.ts +30 -4
- package/dist/base-primitives/Markdown.js +3 -2
- package/dist/base-primitives/compound/CompoundActionButton.d.ts +3 -2
- package/dist/base-primitives/compound/CompoundActionButton.js +1 -1
- package/dist/base-primitives/compound/CompoundDetailsButton.d.ts +3 -2
- package/dist/base-primitives/compound/CompoundDetailsButton.js +1 -1
- package/dist/base-primitives/edge/EdgeActionButton.d.ts +3 -2
- package/dist/base-primitives/edge/EdgeActionButton.js +1 -1
- package/dist/base-primitives/edge/EdgeContainer.d.ts +1 -1
- package/dist/base-primitives/edge/EdgeContainer.js +8 -1
- package/dist/base-primitives/edge/EdgeLabel.d.ts +3 -2
- package/dist/base-primitives/edge/EdgeLabel.js +2 -0
- package/dist/base-primitives/edge/EdgeLabelContainer.d.ts +1 -1
- package/dist/base-primitives/edge/EdgeLabelContainer.js +4 -0
- package/dist/base-primitives/edge/EdgePath.d.ts +4 -0
- package/dist/base-primitives/edge/EdgePath.js +29 -5
- package/dist/base-primitives/element/ElementActionButtons.d.ts +6 -4
- package/dist/base-primitives/element/ElementActionButtons.js +3 -3
- package/dist/base-primitives/element/ElementData.d.ts +3 -3
- package/dist/base-primitives/element/ElementData.js +13 -7
- package/dist/base-primitives/element/ElementDetailsButton.d.ts +3 -2
- package/dist/base-primitives/element/ElementDetailsButton.js +5 -5
- package/dist/base-primitives/element/ElementNodeContainer.css.js +15 -27
- package/dist/base-primitives/element/ElementShape.js +5 -5
- package/dist/base-primitives/element/ElementTags.d.ts +6 -4
- package/dist/base-primitives/element/ElementTags.js +2 -1
- package/dist/base-primitives/memoEdge.js +4 -2
- package/dist/base-primitives/memoNode.d.ts +1 -1
- package/dist/base-primitives/memoNode.js +3 -3
- package/dist/components/ErrorFallback.js +52 -35
- package/dist/components/Link.js +2 -2
- package/dist/context/DiagramEventHandlers.js +2 -1
- package/dist/context/DiagramFeatures.d.ts +25 -6
- package/dist/context/DiagramFeatures.js +28 -56
- package/dist/context/IconRenderer.js +6 -6
- package/dist/context/LikeC4ModelContext.js +3 -10
- package/dist/context/TagStylesContext.js +3 -19
- package/dist/context/index.d.ts +1 -1
- package/dist/custom/customNodes.js +3 -2
- package/dist/custom/hooks.d.ts +3 -3
- package/dist/custom/index.d.ts +1 -1
- package/dist/custom/index.js +5 -5
- package/dist/editor/LikeC4EditorContext.d.ts +21 -0
- package/dist/editor/index.d.ts +2 -0
- package/dist/hooks/index.d.ts +4 -2
- package/dist/hooks/safeContext.d.ts +6 -3
- package/dist/hooks/safeContext.js +10 -3
- package/dist/hooks/useCallbackRef.d.ts +1 -0
- package/dist/hooks/useCallbackRef.js +13 -0
- package/dist/hooks/useCurrentView.d.ts +11 -0
- package/dist/hooks/{useCurrentViewId.js → useCurrentView.js} +7 -3
- package/dist/hooks/useCurrentViewModel.js +4 -1
- package/dist/hooks/useDiagram.d.ts +7 -113
- package/dist/hooks/useDiagram.js +7 -127
- package/dist/hooks/useDiagramCompareLayout.d.ts +35 -0
- package/dist/hooks/useDiagramCompareLayout.js +65 -0
- package/dist/hooks/useLikeC4Project.d.ts +6 -1
- package/dist/hooks/useLikeC4Project.js +14 -2
- package/dist/hooks/useMediaPrint.d.ts +6 -0
- package/dist/hooks/useUpdateEffect.js +2 -4
- package/dist/hooks/useXYFlow.d.ts +1 -0
- package/dist/hooks/useXYFlow.js +4 -7
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -3
- package/dist/likec4diagram/DiagramUI.js +14 -7
- package/dist/likec4diagram/DiagramXYFlow.d.ts +2 -2
- package/dist/likec4diagram/DiagramXYFlow.js +60 -52
- package/dist/likec4diagram/convert-to-xyflow.d.ts +0 -1
- package/dist/likec4diagram/custom/edges/EdgeDrifts.d.ts +6 -0
- package/dist/likec4diagram/custom/edges/EdgeDrifts.js +38 -0
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +256 -217
- package/dist/likec4diagram/custom/edges/SequenceStepEdge.js +9 -2
- package/dist/likec4diagram/custom/edges/edges.css.js +3 -4
- package/dist/likec4diagram/custom/edges/useControlPoints.d.ts +8 -0
- package/dist/likec4diagram/custom/edges/useControlPoints.js +58 -0
- package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.d.ts +7 -0
- package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.js +60 -0
- package/dist/likec4diagram/custom/edges/utils.d.ts +0 -12
- package/dist/likec4diagram/custom/nodes/CompoundActions.js +4 -1
- package/dist/likec4diagram/custom/nodes/ElementActions.d.ts +2 -1
- package/dist/likec4diagram/custom/nodes/ElementActions.js +15 -10
- package/dist/likec4diagram/custom/nodes/NodeDrifts.d.ts +6 -0
- package/dist/likec4diagram/custom/nodes/NodeDrifts.js +50 -0
- package/dist/likec4diagram/custom/nodes/SequenceActorNode.js +7 -2
- package/dist/likec4diagram/custom/nodes/index.d.ts +1 -0
- package/dist/likec4diagram/custom/nodes/nodes.d.ts +9 -1
- package/dist/likec4diagram/custom/nodes/nodes.js +74 -29
- package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.d.ts +1 -1
- package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +1 -1
- package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +2 -1
- package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.js +4 -3
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.d.ts +1 -11
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +7 -51
- package/dist/likec4diagram/custom/nodes/toolbar/types.d.ts +5 -0
- package/dist/likec4diagram/custom/nodes/toolbar/types.js +7 -0
- package/dist/likec4diagram/custom/nodes/toolbar/useHandlers.d.ts +8 -0
- package/dist/likec4diagram/custom/nodes/toolbar/useHandlers.js +44 -0
- package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +8 -10
- package/dist/likec4diagram/relationship-popover/actor.d.ts +1 -1
- package/dist/likec4diagram/state/DiagramActorProvider.d.ts +4 -3
- package/dist/likec4diagram/state/DiagramActorProvider.js +95 -70
- package/dist/likec4diagram/state/assign.d.ts +13 -7
- package/dist/likec4diagram/state/assign.js +43 -282
- package/dist/likec4diagram/state/createViewChange.d.ts +3 -0
- package/dist/likec4diagram/state/createViewChange.js +79 -0
- package/dist/likec4diagram/state/diagram-api.d.ts +109 -0
- package/dist/likec4diagram/state/diagram-api.js +126 -0
- package/dist/likec4diagram/state/machine.actions.d.ts +1783 -0
- package/dist/likec4diagram/state/machine.actions.js +644 -0
- package/dist/likec4diagram/state/machine.actions.layout.d.ts +579 -0
- package/dist/likec4diagram/state/machine.actions.layout.js +129 -0
- package/dist/likec4diagram/state/machine.d.ts +22 -0
- package/dist/likec4diagram/state/machine.js +127 -0
- package/dist/likec4diagram/state/machine.setup.d.ts +327 -0
- package/dist/likec4diagram/state/machine.setup.js +93 -0
- package/dist/likec4diagram/state/machine.state.initializing.d.ts +208 -0
- package/dist/likec4diagram/state/machine.state.initializing.js +55 -0
- package/dist/likec4diagram/state/machine.state.navigating.d.ts +14 -0
- package/dist/likec4diagram/state/machine.state.navigating.js +178 -0
- package/dist/likec4diagram/state/machine.state.ready.d.ts +3131 -0
- package/dist/likec4diagram/state/machine.state.ready.focused.d.ts +386 -0
- package/dist/likec4diagram/state/machine.state.ready.focused.js +85 -0
- package/dist/likec4diagram/state/machine.state.ready.idle.d.ts +474 -0
- package/dist/likec4diagram/state/machine.state.ready.idle.js +96 -0
- package/dist/likec4diagram/state/machine.state.ready.js +262 -0
- package/dist/likec4diagram/state/machine.state.ready.printing.d.ts +128 -0
- package/dist/likec4diagram/state/machine.state.ready.printing.js +40 -0
- package/dist/likec4diagram/state/machine.state.ready.walkthrough.d.ts +511 -0
- package/dist/likec4diagram/state/machine.state.ready.walkthrough.js +177 -0
- package/dist/likec4diagram/state/mediaPrintActor.d.ts +12 -0
- package/dist/likec4diagram/state/mediaPrintActor.js +18 -0
- package/dist/likec4diagram/state/syncManualLayoutActor.d.ts +31 -108
- package/dist/likec4diagram/state/syncManualLayoutActor.js +278 -142
- package/dist/likec4diagram/state/types.d.ts +7 -12
- package/dist/likec4diagram/state/utils.d.ts +19 -4
- package/dist/likec4diagram/state/utils.js +47 -4
- package/dist/likec4diagram/types.d.ts +8 -8
- package/dist/likec4diagram/ui/LayoutDriftFrame.d.ts +2 -0
- package/dist/likec4diagram/ui/LayoutDriftFrame.js +66 -0
- package/dist/likec4diagram/ui/index.d.ts +1 -0
- package/dist/likec4diagram/ui/notation/NotationPanel.css.js +5 -2
- package/dist/likec4diagram/ui/notation/NotationPanel.js +5 -4
- package/dist/likec4diagram/useLayoutConstraints.d.ts +10 -5
- package/dist/likec4diagram/useLayoutConstraints.js +237 -61
- package/dist/likec4diagram/xyflow-diagram/diagram-view.d.ts +0 -1
- package/dist/likec4diagram/xyflow-diagram/diagram-view.js +14 -17
- package/dist/likec4diagram/xyflow-sequence/sequence-layout.js +11 -8
- package/dist/navigationpanel/NavigationPanel.js +16 -8
- package/dist/navigationpanel/NavigationPanelControls.d.ts +2 -1
- package/dist/navigationpanel/NavigationPanelControls.js +23 -17
- package/dist/navigationpanel/NavigationPanelDropdown.d.ts +2 -1
- package/dist/navigationpanel/NavigationPanelDropdown.js +62 -42
- package/dist/navigationpanel/_common.d.ts +1 -1
- package/dist/navigationpanel/_common.js +4 -2
- package/dist/navigationpanel/actor.d.ts +9 -205
- package/dist/navigationpanel/actor.js +6 -5
- package/dist/navigationpanel/comparepanel/CompareActionsMenu.d.ts +3 -0
- package/dist/navigationpanel/comparepanel/CompareActionsMenu.js +59 -0
- package/dist/navigationpanel/comparepanel/ComparePanel.d.ts +2 -0
- package/dist/navigationpanel/comparepanel/ComparePanel.js +42 -0
- package/dist/navigationpanel/comparepanel/ComparePanelControls.d.ts +1 -0
- package/dist/navigationpanel/comparepanel/ComparePanelControls.js +60 -0
- package/dist/navigationpanel/comparepanel/LayoutTypeSwitcher.d.ts +5 -0
- package/dist/navigationpanel/comparepanel/LayoutTypeSwitcher.js +38 -0
- package/dist/navigationpanel/comparepanel/index.d.ts +1 -0
- package/dist/navigationpanel/controls/{ViewDetailsCard.d.ts → DetailsControls.d.ts} +1 -1
- package/dist/navigationpanel/controls/{ViewDetailsCard.js → DetailsControls.js} +18 -14
- package/dist/navigationpanel/controls/LayoutWarning.d.ts +2 -0
- package/dist/navigationpanel/controls/LayoutWarning.js +102 -0
- package/dist/navigationpanel/controls/NavigationButtons.js +4 -3
- package/dist/navigationpanel/controls/OpenSource.js +2 -2
- package/dist/navigationpanel/controls/SearchControl.d.ts +2 -1
- package/dist/navigationpanel/controls/SearchControl.js +15 -17
- package/dist/navigationpanel/controls/ToggleReadonly.d.ts +1 -1
- package/dist/navigationpanel/controls/ToggleReadonly.js +26 -18
- package/dist/navigationpanel/controls/index.d.ts +2 -1
- package/dist/navigationpanel/dropdown/ProjectsMenu.d.ts +2 -2
- package/dist/navigationpanel/dropdown/ProjectsMenu.js +5 -5
- package/dist/navigationpanel/editorpanel/CenterCamera.js +5 -2
- package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.d.ts +1 -1
- package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.js +21 -20
- package/dist/navigationpanel/editorpanel/EditorPanel.js +3 -3
- package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.d.ts +2 -2
- package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.js +16 -13
- package/dist/navigationpanel/editorpanel/ToggleReadonly.d.ts +1 -0
- package/dist/navigationpanel/editorpanel/ToggleReadonly.js +15 -0
- package/dist/navigationpanel/styles.css.d.ts +2 -2
- package/dist/navigationpanel/styles.css.js +4 -4
- package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +14 -8
- package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +66 -66
- package/dist/navigationpanel/walkthrough/DynamicViewControls.js +31 -14
- package/dist/navigationpanel/walkthrough/WalkthroughPanel.d.ts +2 -1
- package/dist/navigationpanel/walkthrough/WalkthroughPanel.js +68 -50
- package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/actions/dist/xstate-actions.cjs.js +37 -0
- package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dev/dist/xstate-dev.cjs.js +59 -0
- package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dist/assign-dea9f7c8.cjs.js +140 -0
- package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dist/log-ec8d4df4.cjs.js +401 -0
- package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dist/raise-da5b247f.cjs.js +2716 -0
- package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/guards/dist/xstate-guards.cjs.js +26 -0
- package/dist/overlays/element-details/ElementDetails.js +7 -7
- package/dist/overlays/element-details/ElementDetailsCard.css.js +3 -3
- package/dist/overlays/element-details/ElementDetailsCard.js +7 -5
- package/dist/overlays/element-details/MetadataValue.d.ts +2 -1
- package/dist/overlays/element-details/MetadataValue.js +2 -2
- package/dist/overlays/element-details/TabPanelDeployments.js +6 -4
- package/dist/overlays/element-details/TabPanelRelationships.js +3 -3
- package/dist/overlays/element-details/TabPanelStructure.js +1 -1
- package/dist/overlays/element-details/actor.d.ts +8 -82
- package/dist/overlays/element-details/actor.js +0 -8
- package/dist/overlays/overlay/Overlay.js +10 -10
- package/dist/overlays/overlaysActor.d.ts +7 -150
- package/dist/overlays/overlaysActor.js +183 -161
- package/dist/overlays/relationship-details/RelationshipDetails.js +4 -3
- package/dist/overlays/relationship-details/SelectEdge.js +2 -2
- package/dist/overlays/relationship-details/_types.d.ts +3 -4
- package/dist/overlays/relationship-details/actor.d.ts +6 -550
- package/dist/overlays/relationship-details/actor.js +18 -3
- package/dist/overlays/relationship-details/custom/ElementActions.js +8 -5
- package/dist/overlays/relationship-details/custom/edgeTypes.js +4 -1
- package/dist/overlays/relationship-details/custom/nodeTypes.js +4 -1
- package/dist/overlays/relationship-details/hooks.js +1 -1
- package/dist/overlays/relationship-details/layout-to-xyflow.js +3 -5
- package/dist/overlays/relationship-details/layout.d.ts +3 -3
- package/dist/overlays/relationship-details/layout.js +4 -4
- package/dist/overlays/relationships-browser/RelationshipsBrowser.js +6 -4
- package/dist/overlays/relationships-browser/SelectElement.js +2 -2
- package/dist/overlays/relationships-browser/_types.d.ts +2 -3
- package/dist/overlays/relationships-browser/actor.d.ts +7 -673
- package/dist/overlays/relationships-browser/actor.js +132 -110
- package/dist/overlays/relationships-browser/custom/ElementActions.js +44 -37
- package/dist/overlays/relationships-browser/custom/edgeTypes.js +4 -1
- package/dist/overlays/relationships-browser/custom/nodeTypes.js +4 -1
- package/dist/overlays/relationships-browser/hooks.js +7 -6
- package/dist/overlays/relationships-browser/layout.d.ts +2 -2
- package/dist/overlays/relationships-browser/layout.js +3 -3
- package/dist/overlays/relationships-browser/useViewToNodesEdges.js +0 -3
- package/dist/overlays/types.d.ts +12 -13
- package/dist/search/Search.js +2 -1
- package/dist/search/components/ElementsColumn.js +5 -3
- package/dist/search/components/PickView.js +1 -1
- package/dist/search/components/SearchByTags.js +21 -44
- package/dist/search/components/SearchInput.js +1 -1
- package/dist/search/components/ViewsColum.js +6 -4
- package/dist/search/components/_shared.css.d.ts +1 -1
- package/dist/search/searchActor.d.ts +3 -66
- package/dist/shadowroot/ShadowRoot.d.ts +5 -7
- package/dist/shadowroot/ShadowRoot.js +8 -6
- package/dist/styles.css2.js +1 -1
- package/dist/utils/index.d.ts +4 -4
- package/dist/utils/vector.d.ts +83 -21
- package/dist/utils/vector.js +98 -24
- package/dist/utils/view-bounds.d.ts +8 -0
- package/dist/utils/view-bounds.js +58 -0
- package/dist/utils/xyflow.d.ts +52 -8
- package/dist/utils/xyflow.js +31 -11
- package/package.json +26 -24
- package/panda.buildinfo.json +124 -71
- package/styles-min.css +1 -1
- package/styles.css +1 -1
- package/dist/hooks/useCurrentViewId.d.ts +0 -6
- package/dist/likec4diagram/custom/edges/utils.js +0 -23
- package/dist/likec4diagram/state/diagram-machine.d.ts +0 -2590
- package/dist/likec4diagram/state/diagram-machine.js +0 -1180
- package/dist/navigationpanel/editorpanel/LayoutDriftNotification.d.ts +0 -1
- package/dist/navigationpanel/editorpanel/LayoutDriftNotification.js +0 -56
- package/dist/utils/get-view-bounds.d.ts +0 -3
- package/dist/utils/get-view-bounds.js +0 -14
- /package/dist/base/{types.js → Base.js} +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/createReactComponent.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertTriangle.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowDownRight.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowLeft.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowRight.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconBolt.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconBrowser.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronDown.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronLeft.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronRight.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconCylinder.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconDeviceMobile.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconDirectionSignFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconExternalLink.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconFileSymlink.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconFocusCentered.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconFolderFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconHelpCircle.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconId.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconInfoCircle.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignBottom.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignCenter.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignLeft.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignMiddle.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignRight.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignTop.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutBoardSplit.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutCollage.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutDashboard.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLink.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLock.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLockOpen2.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerPlayFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipBackFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipForwardFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerStopFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconRectangularPrism.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconReorder.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconRouteOff.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconSearch.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconSelector.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconStack2.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconStarFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconTarget.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconTransform.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconUser.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconX.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconZoomScan.js +0 -0
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { ActionFunction, Values } from 'xstate';
|
|
2
|
+
import { Context, Events, EmittedEvents } from './machine.setup';
|
|
3
|
+
import { XYFlowInstance } from '../../hooks';
|
|
4
|
+
import { SyncLayoutActorLogic } from './syncManualLayoutActor';
|
|
5
|
+
import { HotkeyActorLogic } from './hotkeyActor';
|
|
6
|
+
import { OverlaysActorLogic } from '../../overlays/overlaysActor';
|
|
7
|
+
import { SearchActorLogic } from '../../search/searchActor';
|
|
8
|
+
import { MediaPrintActorLogic } from './mediaPrintActor';
|
|
9
|
+
import { DiagramView } from '@likec4/core';
|
|
10
|
+
/**
|
|
11
|
+
* To be in `initializing` state, the diagram must wait for two events:
|
|
12
|
+
* - `xyflow.init` - indicates that the `xyflow` instance is ready
|
|
13
|
+
* - `update.view` - provides the initial diagram data (nodes and edges)
|
|
14
|
+
*
|
|
15
|
+
* Once both events have been received, the diagram transitions to `isReady` state.
|
|
16
|
+
*/
|
|
17
|
+
export declare const initializing: {
|
|
18
|
+
on: {
|
|
19
|
+
'xyflow.init': {
|
|
20
|
+
actions: ActionFunction<Context, {
|
|
21
|
+
type: "xyflow.init";
|
|
22
|
+
instance: XYFlowInstance;
|
|
23
|
+
}, Events, undefined, Values<{
|
|
24
|
+
syncManualLayoutActorLogic: {
|
|
25
|
+
src: "syncManualLayoutActorLogic";
|
|
26
|
+
logic: SyncLayoutActorLogic;
|
|
27
|
+
id: "syncLayout";
|
|
28
|
+
};
|
|
29
|
+
hotkeyActorLogic: {
|
|
30
|
+
src: "hotkeyActorLogic";
|
|
31
|
+
logic: HotkeyActorLogic;
|
|
32
|
+
id: "hotkey";
|
|
33
|
+
};
|
|
34
|
+
overlaysActorLogic: {
|
|
35
|
+
src: "overlaysActorLogic";
|
|
36
|
+
logic: OverlaysActorLogic;
|
|
37
|
+
id: "overlays";
|
|
38
|
+
};
|
|
39
|
+
searchActorLogic: {
|
|
40
|
+
src: "searchActorLogic";
|
|
41
|
+
logic: SearchActorLogic;
|
|
42
|
+
id: "search";
|
|
43
|
+
};
|
|
44
|
+
mediaPrintActorLogic: {
|
|
45
|
+
src: "mediaPrintActorLogic";
|
|
46
|
+
logic: MediaPrintActorLogic;
|
|
47
|
+
id: "mediaPrint";
|
|
48
|
+
};
|
|
49
|
+
}>, never, never, never, never>;
|
|
50
|
+
target: string;
|
|
51
|
+
};
|
|
52
|
+
'update.view': {
|
|
53
|
+
actions: ActionFunction<Context, {
|
|
54
|
+
type: "update.view";
|
|
55
|
+
view: DiagramView;
|
|
56
|
+
xynodes: import("../types").Types.Node[];
|
|
57
|
+
xyedges: import("../types").Types.Edge[];
|
|
58
|
+
source?: "internal" | "external";
|
|
59
|
+
}, Events, undefined, Values<{
|
|
60
|
+
syncManualLayoutActorLogic: {
|
|
61
|
+
src: "syncManualLayoutActorLogic";
|
|
62
|
+
logic: SyncLayoutActorLogic;
|
|
63
|
+
id: "syncLayout";
|
|
64
|
+
};
|
|
65
|
+
hotkeyActorLogic: {
|
|
66
|
+
src: "hotkeyActorLogic";
|
|
67
|
+
logic: HotkeyActorLogic;
|
|
68
|
+
id: "hotkey";
|
|
69
|
+
};
|
|
70
|
+
overlaysActorLogic: {
|
|
71
|
+
src: "overlaysActorLogic";
|
|
72
|
+
logic: OverlaysActorLogic;
|
|
73
|
+
id: "overlays";
|
|
74
|
+
};
|
|
75
|
+
searchActorLogic: {
|
|
76
|
+
src: "searchActorLogic";
|
|
77
|
+
logic: SearchActorLogic;
|
|
78
|
+
id: "search";
|
|
79
|
+
};
|
|
80
|
+
mediaPrintActorLogic: {
|
|
81
|
+
src: "mediaPrintActorLogic";
|
|
82
|
+
logic: MediaPrintActorLogic;
|
|
83
|
+
id: "mediaPrint";
|
|
84
|
+
};
|
|
85
|
+
}>, never, never, never, never>;
|
|
86
|
+
target: string;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* State that checks whether the diagram is ready to be used.
|
|
92
|
+
* Transitions to `ready` state if both `xyflow` and `xydata` are initialized,
|
|
93
|
+
* otherwise goes back to `initializing` state.`
|
|
94
|
+
*/
|
|
95
|
+
export declare const isReady: {
|
|
96
|
+
always: ({
|
|
97
|
+
guard: "isReady";
|
|
98
|
+
actions: ActionFunction<Context, Events, Events, undefined, Values<{
|
|
99
|
+
syncManualLayoutActorLogic: {
|
|
100
|
+
src: "syncManualLayoutActorLogic";
|
|
101
|
+
logic: SyncLayoutActorLogic;
|
|
102
|
+
id: "syncLayout";
|
|
103
|
+
};
|
|
104
|
+
hotkeyActorLogic: {
|
|
105
|
+
src: "hotkeyActorLogic";
|
|
106
|
+
logic: HotkeyActorLogic;
|
|
107
|
+
id: "hotkey";
|
|
108
|
+
};
|
|
109
|
+
overlaysActorLogic: {
|
|
110
|
+
src: "overlaysActorLogic";
|
|
111
|
+
logic: OverlaysActorLogic;
|
|
112
|
+
id: "overlays";
|
|
113
|
+
};
|
|
114
|
+
searchActorLogic: {
|
|
115
|
+
src: "searchActorLogic";
|
|
116
|
+
logic: SearchActorLogic;
|
|
117
|
+
id: "search";
|
|
118
|
+
};
|
|
119
|
+
mediaPrintActorLogic: {
|
|
120
|
+
src: "mediaPrintActorLogic";
|
|
121
|
+
logic: MediaPrintActorLogic;
|
|
122
|
+
id: "mediaPrint";
|
|
123
|
+
};
|
|
124
|
+
}>, never, Values<{
|
|
125
|
+
isReady: {
|
|
126
|
+
type: "isReady";
|
|
127
|
+
params: unknown;
|
|
128
|
+
};
|
|
129
|
+
"enabled: FitView": {
|
|
130
|
+
type: "enabled: FitView";
|
|
131
|
+
params: unknown;
|
|
132
|
+
};
|
|
133
|
+
"enabled: FocusMode": {
|
|
134
|
+
type: "enabled: FocusMode";
|
|
135
|
+
params: unknown;
|
|
136
|
+
};
|
|
137
|
+
"enabled: Readonly": {
|
|
138
|
+
type: "enabled: Readonly";
|
|
139
|
+
params: unknown;
|
|
140
|
+
};
|
|
141
|
+
"enabled: RelationshipDetails": {
|
|
142
|
+
type: "enabled: RelationshipDetails";
|
|
143
|
+
params: unknown;
|
|
144
|
+
};
|
|
145
|
+
"enabled: Search": {
|
|
146
|
+
type: "enabled: Search";
|
|
147
|
+
params: unknown;
|
|
148
|
+
};
|
|
149
|
+
"enabled: ElementDetails": {
|
|
150
|
+
type: "enabled: ElementDetails";
|
|
151
|
+
params: unknown;
|
|
152
|
+
};
|
|
153
|
+
"enabled: OpenSource": {
|
|
154
|
+
type: "enabled: OpenSource";
|
|
155
|
+
params: unknown;
|
|
156
|
+
};
|
|
157
|
+
"enabled: DynamicViewWalkthrough": {
|
|
158
|
+
type: "enabled: DynamicViewWalkthrough";
|
|
159
|
+
params: unknown;
|
|
160
|
+
};
|
|
161
|
+
"enabled: Overlays": {
|
|
162
|
+
type: "enabled: Overlays";
|
|
163
|
+
params: unknown;
|
|
164
|
+
};
|
|
165
|
+
"not readonly": {
|
|
166
|
+
type: "not readonly";
|
|
167
|
+
params: unknown;
|
|
168
|
+
};
|
|
169
|
+
"is dynamic view": {
|
|
170
|
+
type: "is dynamic view";
|
|
171
|
+
params: unknown;
|
|
172
|
+
};
|
|
173
|
+
"is another view": {
|
|
174
|
+
type: "is another view";
|
|
175
|
+
params: unknown;
|
|
176
|
+
};
|
|
177
|
+
"click: node has modelFqn": {
|
|
178
|
+
type: "click: node has modelFqn";
|
|
179
|
+
params: unknown;
|
|
180
|
+
};
|
|
181
|
+
"click: selected node": {
|
|
182
|
+
type: "click: selected node";
|
|
183
|
+
params: unknown;
|
|
184
|
+
};
|
|
185
|
+
"click: same node": {
|
|
186
|
+
type: "click: same node";
|
|
187
|
+
params: unknown;
|
|
188
|
+
};
|
|
189
|
+
"click: focused node": {
|
|
190
|
+
type: "click: focused node";
|
|
191
|
+
params: unknown;
|
|
192
|
+
};
|
|
193
|
+
"click: node has connections": {
|
|
194
|
+
type: "click: node has connections";
|
|
195
|
+
params: unknown;
|
|
196
|
+
};
|
|
197
|
+
"click: selected edge": {
|
|
198
|
+
type: "click: selected edge";
|
|
199
|
+
params: unknown;
|
|
200
|
+
};
|
|
201
|
+
}>, never, EmittedEvents>[];
|
|
202
|
+
target: string;
|
|
203
|
+
} | {
|
|
204
|
+
target: string;
|
|
205
|
+
guard?: never;
|
|
206
|
+
actions?: never;
|
|
207
|
+
})[];
|
|
208
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { emitInitialized } from './machine.actions.js';
|
|
2
|
+
import { fitDiagram } from './machine.actions.layout.js';
|
|
3
|
+
import { machine } from './machine.setup.js';
|
|
4
|
+
import { x as xstateActions_cjsExports } from '../../_virtual/xstate-actions.cjs.js';
|
|
5
|
+
|
|
6
|
+
const initializing = machine.createStateConfig({
|
|
7
|
+
on: {
|
|
8
|
+
"xyflow.init": {
|
|
9
|
+
actions: xstateActions_cjsExports.assign(({ context, event }) => ({
|
|
10
|
+
initialized: {
|
|
11
|
+
...context.initialized,
|
|
12
|
+
xyflow: true
|
|
13
|
+
},
|
|
14
|
+
xyflow: event.instance
|
|
15
|
+
})),
|
|
16
|
+
target: "isReady"
|
|
17
|
+
},
|
|
18
|
+
"update.view": {
|
|
19
|
+
actions: xstateActions_cjsExports.assign(({ context, event }) => ({
|
|
20
|
+
initialized: {
|
|
21
|
+
...context.initialized,
|
|
22
|
+
xydata: true
|
|
23
|
+
},
|
|
24
|
+
view: event.view,
|
|
25
|
+
xynodes: event.xynodes,
|
|
26
|
+
xyedges: event.xyedges
|
|
27
|
+
})),
|
|
28
|
+
target: "isReady"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
const isReady = machine.createStateConfig({
|
|
33
|
+
always: [{
|
|
34
|
+
guard: "isReady",
|
|
35
|
+
actions: [
|
|
36
|
+
fitDiagram({ duration: 0 }),
|
|
37
|
+
xstateActions_cjsExports.assign(({ context }) => ({
|
|
38
|
+
navigationHistory: {
|
|
39
|
+
currentIndex: 0,
|
|
40
|
+
history: [{
|
|
41
|
+
viewId: context.view.id,
|
|
42
|
+
viewport: { ...context.xyflow.getViewport() },
|
|
43
|
+
viewportChangedManually: false
|
|
44
|
+
}]
|
|
45
|
+
}
|
|
46
|
+
})),
|
|
47
|
+
emitInitialized()
|
|
48
|
+
],
|
|
49
|
+
target: "ready"
|
|
50
|
+
}, {
|
|
51
|
+
target: "initializing"
|
|
52
|
+
}]
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
export { initializing, isReady };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CancelAction } from 'xstate';
|
|
2
|
+
import { Context, Events } from './machine.setup';
|
|
3
|
+
/**
|
|
4
|
+
* State for handling navigation to a different view.
|
|
5
|
+
* Closes overlays and search, stops sync layout and fit diagram actions,
|
|
6
|
+
* then processes the view update and transitions back to idle state.
|
|
7
|
+
*/
|
|
8
|
+
export declare const navigating: {
|
|
9
|
+
id: string;
|
|
10
|
+
always: {
|
|
11
|
+
target: string;
|
|
12
|
+
actions: CancelAction<Context, Events, undefined, Events>[];
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { BBox } from '@likec4/core/types';
|
|
2
|
+
import { invariant, nonNullable } from '@likec4/core/utils';
|
|
3
|
+
import { enqueueActions, assertEvent } from 'xstate';
|
|
4
|
+
import { mergeXYNodesEdges } from './assign.js';
|
|
5
|
+
import { disableCompareWithLatest } from './machine.actions.js';
|
|
6
|
+
import { machine, targetState } from './machine.setup.js';
|
|
7
|
+
import { calcViewportForBounds, findCorrespondingNode, nodeRef } from './utils.js';
|
|
8
|
+
import { cancelFitDiagram, raiseSetViewport, raiseFitDiagram } from './machine.actions.layout.js';
|
|
9
|
+
|
|
10
|
+
const handleBrowserForwardBackward = () => machine.assign(({ context, event }) => {
|
|
11
|
+
assertEvent(event, "update.view");
|
|
12
|
+
let {
|
|
13
|
+
lastOnNavigate,
|
|
14
|
+
navigationHistory: {
|
|
15
|
+
currentIndex,
|
|
16
|
+
history
|
|
17
|
+
}
|
|
18
|
+
} = context;
|
|
19
|
+
const stepCurrent = history[currentIndex];
|
|
20
|
+
if (!stepCurrent || stepCurrent.viewId === event.view.id || !!lastOnNavigate) {
|
|
21
|
+
return {};
|
|
22
|
+
}
|
|
23
|
+
const stepBack = currentIndex > 0 ? nonNullable(history[currentIndex - 1]) : null;
|
|
24
|
+
if (stepBack && stepBack.viewId === event.view.id) {
|
|
25
|
+
return {
|
|
26
|
+
navigationHistory: {
|
|
27
|
+
currentIndex: currentIndex - 1,
|
|
28
|
+
history
|
|
29
|
+
},
|
|
30
|
+
lastOnNavigate: null
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const stepForward = currentIndex < history.length - 1 ? nonNullable(history[currentIndex + 1]) : null;
|
|
34
|
+
if (stepForward && stepForward.viewId === event.view.id) {
|
|
35
|
+
return {
|
|
36
|
+
navigationHistory: {
|
|
37
|
+
currentIndex: currentIndex + 1,
|
|
38
|
+
history
|
|
39
|
+
},
|
|
40
|
+
lastOnNavigate: null
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
if (event.view._type === "element" && event.view.viewOf) {
|
|
44
|
+
const toRef = event.view.viewOf;
|
|
45
|
+
const existingNode = context.xynodes.find((n) => nodeRef(n) === toRef);
|
|
46
|
+
if (existingNode) {
|
|
47
|
+
return {
|
|
48
|
+
lastOnNavigate: {
|
|
49
|
+
fromView: context.view.id,
|
|
50
|
+
toView: event.view.id,
|
|
51
|
+
fromNode: existingNode.id
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return {};
|
|
57
|
+
});
|
|
58
|
+
const navigating = machine.createStateConfig({
|
|
59
|
+
id: targetState.navigating.slice(1),
|
|
60
|
+
always: {
|
|
61
|
+
target: targetState.idle,
|
|
62
|
+
actions: [
|
|
63
|
+
cancelFitDiagram(),
|
|
64
|
+
handleBrowserForwardBackward(),
|
|
65
|
+
disableCompareWithLatest(),
|
|
66
|
+
enqueueActions(({ enqueue, context, event }) => {
|
|
67
|
+
assertEvent(event, "update.view");
|
|
68
|
+
const {
|
|
69
|
+
xyflow,
|
|
70
|
+
xystore,
|
|
71
|
+
navigationHistory: {
|
|
72
|
+
currentIndex,
|
|
73
|
+
history
|
|
74
|
+
}
|
|
75
|
+
} = context;
|
|
76
|
+
invariant(xyflow, "xyflow is not initialized");
|
|
77
|
+
const calcZoomTowardsNextViewport = (nextViewport2) => {
|
|
78
|
+
const zoom = xyflow.getZoom();
|
|
79
|
+
const coef = nextViewport2.zoom < zoom ? 0.7 : 0.3;
|
|
80
|
+
return zoom + (nextViewport2.zoom - zoom) * coef;
|
|
81
|
+
};
|
|
82
|
+
const fromHistory = history[currentIndex];
|
|
83
|
+
if (fromHistory && fromHistory.viewId === event.view.id) {
|
|
84
|
+
console.log("Navigating: fromHistory", fromHistory);
|
|
85
|
+
enqueue.assign({
|
|
86
|
+
...mergeXYNodesEdges(context, event),
|
|
87
|
+
dynamicViewVariant: fromHistory.dynamicViewVariant ?? context.dynamicViewVariant,
|
|
88
|
+
viewportChangedManually: fromHistory.viewportChangedManually
|
|
89
|
+
});
|
|
90
|
+
const wasFocused = fromHistory.focusedNode;
|
|
91
|
+
const wasActiveWalkthrough = fromHistory.activeWalkthrough;
|
|
92
|
+
const viewportBefore = fromHistory.viewportBefore;
|
|
93
|
+
if (viewportBefore && (wasFocused || wasActiveWalkthrough)) {
|
|
94
|
+
enqueue.assign({
|
|
95
|
+
viewport: viewportBefore.value,
|
|
96
|
+
viewportChangedManually: viewportBefore.wasChangedManually,
|
|
97
|
+
viewportBefore: null
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
const center = BBox.center(event.view.bounds);
|
|
101
|
+
const zoom = calcZoomTowardsNextViewport(fromHistory.viewport);
|
|
102
|
+
xyflow.setCenter(
|
|
103
|
+
center.x,
|
|
104
|
+
center.y,
|
|
105
|
+
{ zoom, duration: 0 }
|
|
106
|
+
);
|
|
107
|
+
if (wasFocused) {
|
|
108
|
+
enqueue.raise({
|
|
109
|
+
type: "focus.node",
|
|
110
|
+
nodeId: wasFocused
|
|
111
|
+
}, { delay: 50 });
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (wasActiveWalkthrough) {
|
|
115
|
+
enqueue.raise({
|
|
116
|
+
type: "walkthrough.start",
|
|
117
|
+
stepId: wasActiveWalkthrough
|
|
118
|
+
}, { delay: 50 });
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
enqueue(raiseSetViewport({
|
|
122
|
+
delay: 80,
|
|
123
|
+
viewport: fromHistory.viewport
|
|
124
|
+
}));
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
const nextViewport = calcViewportForBounds(
|
|
128
|
+
context,
|
|
129
|
+
event.view.bounds
|
|
130
|
+
);
|
|
131
|
+
const { fromNode, toNode } = findCorrespondingNode(context, event);
|
|
132
|
+
if (fromNode && toNode) {
|
|
133
|
+
const elFrom = xyflow.getInternalNode(fromNode.id);
|
|
134
|
+
const fromPoint = xyflow.flowToScreenPosition({
|
|
135
|
+
x: elFrom.internals.positionAbsolute.x,
|
|
136
|
+
y: elFrom.internals.positionAbsolute.y
|
|
137
|
+
});
|
|
138
|
+
const toPoint = xyflow.flowToScreenPosition({
|
|
139
|
+
x: toNode.data.x,
|
|
140
|
+
y: toNode.data.y
|
|
141
|
+
});
|
|
142
|
+
xystore.getState().panBy({
|
|
143
|
+
x: Math.round(fromPoint.x - toPoint.x),
|
|
144
|
+
y: Math.round(fromPoint.y - toPoint.y)
|
|
145
|
+
});
|
|
146
|
+
} else {
|
|
147
|
+
const zoom = calcZoomTowardsNextViewport(nextViewport);
|
|
148
|
+
const center = BBox.center(event.view.bounds);
|
|
149
|
+
xyflow.setCenter(
|
|
150
|
+
center.x,
|
|
151
|
+
center.y,
|
|
152
|
+
{ zoom, duration: 0 }
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
const updatedHistory = currentIndex < history.length - 1 ? history.slice(0, currentIndex + 1) : [...history];
|
|
156
|
+
updatedHistory.push({
|
|
157
|
+
viewId: event.view.id,
|
|
158
|
+
viewport: { ...nextViewport },
|
|
159
|
+
viewportChangedManually: false
|
|
160
|
+
});
|
|
161
|
+
enqueue.assign({
|
|
162
|
+
...mergeXYNodesEdges(context, event),
|
|
163
|
+
viewportChangedManually: false,
|
|
164
|
+
lastOnNavigate: null,
|
|
165
|
+
navigationHistory: {
|
|
166
|
+
currentIndex: updatedHistory.length - 1,
|
|
167
|
+
history: updatedHistory
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
enqueue(raiseFitDiagram({
|
|
171
|
+
delay: 100
|
|
172
|
+
}));
|
|
173
|
+
})
|
|
174
|
+
]
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
export { navigating };
|