@likec4/diagram 1.42.1 → 1.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/index.js +6198 -4860
- package/dist/LikeC4Diagram.d.ts +1 -1
- package/dist/LikeC4Diagram.js +15 -12
- package/dist/LikeC4Diagram.props.d.ts +28 -14
- package/dist/LikeC4ProjectsProvider.js +1 -1
- package/dist/LikeC4View.d.ts +28 -4
- package/dist/LikeC4View.js +28 -17
- package/dist/ReactLikeC4.d.ts +1 -1
- package/dist/ReactLikeC4.js +5 -7
- package/dist/StaticLikeC4Diagram.js +2 -2
- package/dist/_virtual/_commonjsHelpers.js +3 -0
- package/dist/_virtual/assign-dea9f7c8.cjs.js +3 -0
- package/dist/_virtual/log-ec8d4df4.cjs.js +3 -0
- package/dist/_virtual/raise-da5b247f.cjs.js +3 -0
- package/dist/_virtual/xstate-actions.cjs.js +5 -0
- package/dist/_virtual/xstate-actions.cjs2.js +3 -0
- package/dist/_virtual/xstate-dev.cjs.js +3 -0
- package/dist/_virtual/xstate-guards.cjs.js +5 -0
- package/dist/_virtual/xstate-guards.cjs2.js +3 -0
- package/dist/base/Background.d.ts +2 -1
- package/dist/base/Background.js +11 -2
- package/dist/base/Base.d.ts +28 -0
- package/dist/base/BaseXYFlow.d.ts +5 -5
- package/dist/base/BaseXYFlow.js +38 -44
- package/dist/base/const.d.ts +1 -1
- package/dist/base/const.js +1 -1
- package/dist/base/index.d.ts +6 -2
- package/dist/base/types.d.ts +1 -28
- package/dist/base/updateEdges.js +4 -3
- package/dist/base/updateNodes.js +3 -2
- package/dist/base-primitives/compound/CompoundActionButton.js +1 -1
- package/dist/base-primitives/compound/CompoundDetailsButton.js +1 -1
- package/dist/base-primitives/edge/EdgeActionButton.js +1 -1
- package/dist/base-primitives/edge/EdgeContainer.d.ts +1 -1
- package/dist/base-primitives/edge/EdgeContainer.js +4 -0
- package/dist/base-primitives/edge/EdgeLabel.d.ts +1 -0
- package/dist/base-primitives/edge/EdgeLabel.js +2 -0
- package/dist/base-primitives/edge/EdgeLabelContainer.d.ts +1 -1
- package/dist/base-primitives/edge/EdgeLabelContainer.js +4 -0
- package/dist/base-primitives/edge/EdgePath.d.ts +4 -0
- package/dist/base-primitives/edge/EdgePath.js +9 -5
- package/dist/base-primitives/element/ElementActionButtons.d.ts +3 -2
- package/dist/base-primitives/element/ElementActionButtons.js +1 -1
- package/dist/base-primitives/element/ElementDetailsButton.js +2 -5
- package/dist/base-primitives/element/ElementNodeContainer.css.js +15 -27
- package/dist/base-primitives/element/ElementTags.js +2 -1
- package/dist/base-primitives/memoEdge.js +4 -2
- package/dist/base-primitives/memoNode.d.ts +1 -1
- package/dist/base-primitives/memoNode.js +3 -3
- package/dist/components/ErrorFallback.js +52 -35
- package/dist/components/Link.js +2 -2
- package/dist/context/DiagramEventHandlers.js +2 -1
- package/dist/context/DiagramFeatures.d.ts +24 -6
- package/dist/context/DiagramFeatures.js +28 -56
- package/dist/context/IconRenderer.js +6 -6
- package/dist/context/LikeC4ModelContext.js +3 -10
- package/dist/context/TagStylesContext.js +2 -18
- package/dist/context/index.d.ts +1 -1
- package/dist/custom/customNodes.js +3 -2
- package/dist/custom/hooks.d.ts +1 -1
- package/dist/custom/index.d.ts +1 -1
- package/dist/custom/index.js +4 -4
- package/dist/editor/LikeC4EditorContext.d.ts +21 -0
- package/dist/editor/index.d.ts +2 -0
- package/dist/hooks/index.d.ts +2 -1
- package/dist/hooks/safeContext.d.ts +6 -3
- package/dist/hooks/safeContext.js +10 -3
- package/dist/hooks/useCallbackRef.d.ts +1 -0
- package/dist/hooks/useCallbackRef.js +13 -0
- package/dist/hooks/useCurrentView.d.ts +11 -0
- package/dist/hooks/{useCurrentViewId.js → useCurrentView.js} +7 -3
- package/dist/hooks/useCurrentViewModel.js +4 -1
- package/dist/hooks/useDiagram.d.ts +7 -113
- package/dist/hooks/useDiagram.js +7 -127
- package/dist/hooks/useDiagramCompareLayout.d.ts +35 -0
- package/dist/hooks/useDiagramCompareLayout.js +60 -0
- package/dist/hooks/useUpdateEffect.js +2 -4
- package/dist/hooks/useXYFlow.d.ts +1 -0
- package/dist/hooks/useXYFlow.js +4 -7
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -3
- package/dist/likec4diagram/DiagramUI.js +14 -7
- package/dist/likec4diagram/DiagramXYFlow.d.ts +2 -2
- package/dist/likec4diagram/DiagramXYFlow.js +54 -51
- package/dist/likec4diagram/convert-to-xyflow.d.ts +0 -1
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +249 -220
- package/dist/likec4diagram/custom/edges/SequenceStepEdge.js +7 -2
- package/dist/likec4diagram/custom/edges/edges.css.js +3 -4
- package/dist/likec4diagram/custom/edges/useControlPoints.d.ts +8 -0
- package/dist/likec4diagram/custom/edges/useControlPoints.js +58 -0
- package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.d.ts +7 -0
- package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.js +60 -0
- package/dist/likec4diagram/custom/edges/utils.d.ts +0 -12
- package/dist/likec4diagram/custom/nodes/CompoundActions.js +4 -1
- package/dist/likec4diagram/custom/nodes/ElementActions.d.ts +2 -1
- package/dist/likec4diagram/custom/nodes/ElementActions.js +15 -10
- package/dist/likec4diagram/custom/nodes/ElementNodeDrifts.d.ts +4 -0
- package/dist/likec4diagram/custom/nodes/ElementNodeDrifts.js +46 -0
- package/dist/likec4diagram/custom/nodes/SequenceActorNode.js +4 -1
- package/dist/likec4diagram/custom/nodes/nodes.d.ts +9 -1
- package/dist/likec4diagram/custom/nodes/nodes.js +13 -9
- package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.d.ts +1 -1
- package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +1 -1
- package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +2 -1
- package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.js +4 -3
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.d.ts +1 -11
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +7 -51
- package/dist/likec4diagram/custom/nodes/toolbar/types.d.ts +5 -0
- package/dist/likec4diagram/custom/nodes/toolbar/types.js +7 -0
- package/dist/likec4diagram/custom/nodes/toolbar/useHandlers.d.ts +8 -0
- package/dist/likec4diagram/custom/nodes/toolbar/useHandlers.js +44 -0
- package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +5 -7
- package/dist/likec4diagram/state/DiagramActorProvider.d.ts +3 -2
- package/dist/likec4diagram/state/DiagramActorProvider.js +96 -70
- package/dist/likec4diagram/state/assign.d.ts +4 -2
- package/dist/likec4diagram/state/assign.js +39 -103
- package/dist/likec4diagram/state/createViewChange.d.ts +3 -0
- package/dist/likec4diagram/state/createViewChange.js +90 -0
- package/dist/likec4diagram/state/diagram-api.d.ts +113 -0
- package/dist/likec4diagram/state/diagram-api.js +134 -0
- package/dist/likec4diagram/state/hotkeyActor.d.ts +7 -0
- package/dist/likec4diagram/state/hotkeyActor.js +17 -1
- package/dist/likec4diagram/state/machine.actions.d.ts +2099 -0
- package/dist/likec4diagram/state/machine.actions.js +735 -0
- package/dist/likec4diagram/state/machine.d.ts +3717 -0
- package/dist/likec4diagram/state/machine.js +141 -0
- package/dist/likec4diagram/state/machine.setup.d.ts +284 -0
- package/dist/likec4diagram/state/machine.setup.js +71 -0
- package/dist/likec4diagram/state/machine.state.initializing.d.ts +183 -0
- package/dist/likec4diagram/state/machine.state.initializing.js +55 -0
- package/dist/likec4diagram/state/machine.state.navigating.d.ts +117 -0
- package/dist/likec4diagram/state/machine.state.navigating.js +45 -0
- package/dist/likec4diagram/state/machine.state.ready.d.ts +3666 -0
- package/dist/likec4diagram/state/machine.state.ready.js +437 -0
- package/dist/likec4diagram/state/syncManualLayoutActor.d.ts +220 -63
- package/dist/likec4diagram/state/syncManualLayoutActor.js +218 -143
- package/dist/likec4diagram/state/types.d.ts +4 -7
- package/dist/likec4diagram/state/utils.d.ts +4 -2
- package/dist/likec4diagram/state/utils.js +4 -1
- package/dist/likec4diagram/types.d.ts +6 -1
- package/dist/likec4diagram/ui/LayoutDriftFrame.d.ts +2 -0
- package/dist/likec4diagram/ui/LayoutDriftFrame.js +66 -0
- package/dist/likec4diagram/ui/index.d.ts +1 -0
- package/dist/likec4diagram/ui/notation/NotationPanel.js +10 -12
- package/dist/likec4diagram/useLayoutConstraints.d.ts +10 -5
- package/dist/likec4diagram/useLayoutConstraints.js +225 -54
- package/dist/likec4diagram/xyflow-diagram/diagram-view.d.ts +0 -1
- package/dist/likec4diagram/xyflow-diagram/diagram-view.js +15 -15
- package/dist/navigationpanel/NavigationPanel.js +11 -7
- package/dist/navigationpanel/NavigationPanelControls.d.ts +2 -1
- package/dist/navigationpanel/NavigationPanelControls.js +23 -17
- package/dist/navigationpanel/NavigationPanelDropdown.d.ts +2 -1
- package/dist/navigationpanel/NavigationPanelDropdown.js +62 -42
- package/dist/navigationpanel/_common.d.ts +1 -1
- package/dist/navigationpanel/_common.js +4 -2
- package/dist/navigationpanel/actor.d.ts +11 -7
- package/dist/navigationpanel/actor.js +5 -4
- package/dist/navigationpanel/comparepanel/CompareActionsMenu.d.ts +3 -0
- package/dist/navigationpanel/comparepanel/CompareActionsMenu.js +59 -0
- package/dist/navigationpanel/comparepanel/ComparePanel.d.ts +2 -0
- package/dist/navigationpanel/comparepanel/ComparePanel.js +42 -0
- package/dist/navigationpanel/comparepanel/ComparePanelControls.d.ts +1 -0
- package/dist/navigationpanel/comparepanel/ComparePanelControls.js +60 -0
- package/dist/navigationpanel/comparepanel/LayoutTypeSwitcher.d.ts +5 -0
- package/dist/navigationpanel/comparepanel/LayoutTypeSwitcher.js +38 -0
- package/dist/navigationpanel/comparepanel/index.d.ts +1 -0
- package/dist/navigationpanel/controls/{ViewDetailsCard.d.ts → DetailsControls.d.ts} +1 -1
- package/dist/navigationpanel/controls/{ViewDetailsCard.js → DetailsControls.js} +18 -14
- package/dist/navigationpanel/controls/LayoutWarning.d.ts +2 -0
- package/dist/navigationpanel/controls/LayoutWarning.js +102 -0
- package/dist/navigationpanel/controls/NavigationButtons.js +4 -3
- package/dist/navigationpanel/controls/OpenSource.js +2 -2
- package/dist/navigationpanel/controls/SearchControl.d.ts +2 -1
- package/dist/navigationpanel/controls/SearchControl.js +15 -17
- package/dist/navigationpanel/controls/ToggleReadonly.d.ts +1 -1
- package/dist/navigationpanel/controls/ToggleReadonly.js +19 -16
- package/dist/navigationpanel/controls/index.d.ts +2 -1
- package/dist/navigationpanel/dropdown/ProjectsMenu.d.ts +2 -2
- package/dist/navigationpanel/dropdown/ProjectsMenu.js +5 -5
- package/dist/navigationpanel/editorpanel/CenterCamera.js +5 -2
- package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.d.ts +1 -1
- package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.js +21 -20
- package/dist/navigationpanel/editorpanel/EditorPanel.js +3 -3
- package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.d.ts +2 -2
- package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.js +16 -13
- package/dist/navigationpanel/editorpanel/ToggleReadonly.d.ts +1 -0
- package/dist/navigationpanel/editorpanel/ToggleReadonly.js +15 -0
- package/dist/navigationpanel/styles.css.d.ts +2 -2
- package/dist/navigationpanel/styles.css.js +4 -4
- package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +14 -8
- package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +10 -10
- package/dist/navigationpanel/walkthrough/DynamicViewControls.js +31 -14
- package/dist/navigationpanel/walkthrough/WalkthroughPanel.d.ts +2 -1
- package/dist/navigationpanel/walkthrough/WalkthroughPanel.js +66 -49
- package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/actions/dist/xstate-actions.cjs.js +37 -0
- package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dev/dist/xstate-dev.cjs.js +59 -0
- package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dist/assign-dea9f7c8.cjs.js +140 -0
- package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dist/log-ec8d4df4.cjs.js +401 -0
- package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dist/raise-da5b247f.cjs.js +2716 -0
- package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/guards/dist/xstate-guards.cjs.js +26 -0
- package/dist/overlays/element-details/ElementDetails.js +7 -7
- package/dist/overlays/element-details/ElementDetailsCard.js +18 -88
- package/dist/overlays/element-details/MetadataValue.d.ts +9 -0
- package/dist/overlays/element-details/MetadataValue.js +261 -0
- package/dist/overlays/element-details/TabPanelDeployments.js +6 -4
- package/dist/overlays/element-details/TabPanelRelationships.js +3 -3
- package/dist/overlays/element-details/TabPanelStructure.js +1 -1
- package/dist/overlays/element-details/actor.d.ts +3 -2
- package/dist/overlays/overlaysActor.d.ts +304 -62
- package/dist/overlays/overlaysActor.js +132 -131
- package/dist/overlays/relationship-details/RelationshipDetails.js +4 -3
- package/dist/overlays/relationship-details/SelectEdge.js +2 -2
- package/dist/overlays/relationship-details/actor.d.ts +14 -2
- package/dist/overlays/relationship-details/actor.js +23 -5
- package/dist/overlays/relationship-details/custom/ElementActions.js +8 -5
- package/dist/overlays/relationship-details/custom/edgeTypes.js +4 -1
- package/dist/overlays/relationship-details/custom/nodeTypes.js +4 -1
- package/dist/overlays/relationship-details/hooks.js +1 -1
- package/dist/overlays/relationships-browser/RelationshipsBrowser.js +6 -4
- package/dist/overlays/relationships-browser/SelectElement.js +2 -2
- package/dist/overlays/relationships-browser/actor.d.ts +239 -173
- package/dist/overlays/relationships-browser/actor.js +132 -110
- package/dist/overlays/relationships-browser/const.d.ts +3 -3
- package/dist/overlays/relationships-browser/const.js +3 -3
- package/dist/overlays/relationships-browser/custom/ElementActions.js +44 -37
- package/dist/overlays/relationships-browser/custom/edgeTypes.js +4 -1
- package/dist/overlays/relationships-browser/custom/nodeTypes.js +4 -1
- package/dist/overlays/relationships-browser/hooks.js +7 -6
- package/dist/search/Search.js +2 -1
- package/dist/search/components/ElementsColumn.js +5 -3
- package/dist/search/components/PickView.js +1 -1
- package/dist/search/components/SearchByTags.js +21 -44
- package/dist/search/components/SearchInput.js +1 -1
- package/dist/search/components/ViewsColum.js +6 -4
- package/dist/shadowroot/ShadowRoot.js +53 -12
- package/dist/shadowroot/styles.css.d.ts +0 -4
- package/dist/shadowroot/styles.css.js +1 -41
- package/dist/styles.css2.js +1 -1
- package/dist/utils/index.d.ts +4 -4
- package/dist/utils/vector.d.ts +78 -21
- package/dist/utils/vector.js +91 -24
- package/dist/utils/view-bounds.d.ts +8 -0
- package/dist/utils/view-bounds.js +57 -0
- package/dist/utils/xyflow.d.ts +49 -7
- package/dist/utils/xyflow.js +63 -11
- package/package.json +28 -27
- package/panda.buildinfo.json +140 -83
- package/styles-min.css +1 -1
- package/styles.css +1 -1
- package/dist/hooks/useCurrentViewId.d.ts +0 -6
- package/dist/likec4diagram/custom/edges/utils.js +0 -23
- package/dist/likec4diagram/state/diagram-machine.d.ts +0 -2590
- package/dist/likec4diagram/state/diagram-machine.js +0 -1180
- package/dist/navigationpanel/editorpanel/LayoutDriftNotification.d.ts +0 -1
- package/dist/navigationpanel/editorpanel/LayoutDriftNotification.js +0 -56
- package/dist/utils/get-view-bounds.d.ts +0 -3
- package/dist/utils/get-view-bounds.js +0 -14
- /package/dist/base/{types.js → Base.js} +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/createReactComponent.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertTriangle.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowDownRight.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowLeft.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowRight.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconBolt.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconBrowser.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronDown.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronLeft.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronRight.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconCylinder.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconDeviceMobile.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconDirectionSignFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconExternalLink.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconFileSymlink.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconFocusCentered.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconFolderFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconHelpCircle.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconId.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconInfoCircle.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignBottom.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignCenter.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignLeft.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignMiddle.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignRight.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignTop.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutBoardSplit.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutCollage.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutDashboard.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLink.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLock.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLockOpen2.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerPlayFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipBackFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipForwardFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerStopFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconRectangularPrism.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconReorder.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconRouteOff.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconSearch.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconSelector.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconStack2.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconStarFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconTarget.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconTransform.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconUser.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconX.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconZoomScan.js +0 -0
|
@@ -1,1180 +0,0 @@
|
|
|
1
|
-
import { invariant, nonNullable, nonexhaustive, BBox, isStepEdgeId, getParallelStepsPrefix } from '@likec4/core';
|
|
2
|
-
import { getViewportForBounds, applyEdgeChanges, applyNodeChanges } from '@xyflow/react';
|
|
3
|
-
import { nodeToRect } from '@xyflow/system';
|
|
4
|
-
import { hasAtLeast, prop, clamp, first } from 'remeda';
|
|
5
|
-
import { setup, assign, emit, sendTo, enqueueActions, assertEvent, cancel, stopChild, raise, spawnChild, and, or } from 'xstate';
|
|
6
|
-
import { MinZoom } from '../../base/const.js';
|
|
7
|
-
import { Base } from '../../base/types.js';
|
|
8
|
-
import { AllDisabled } from '../../context/DiagramFeatures.js';
|
|
9
|
-
import { overlaysActorLogic } from '../../overlays/overlaysActor.js';
|
|
10
|
-
import { searchActorLogic } from '../../search/searchActor.js';
|
|
11
|
-
import { createLayoutConstraints } from '../useLayoutConstraints.js';
|
|
12
|
-
import { SeqParallelAreaColor } from '../xyflow-sequence/const.js';
|
|
13
|
-
import { getAligner, toNodeRect } from './aligners.js';
|
|
14
|
-
import { updateActiveWalkthrough, focusNodesEdges, lastClickedNode, updateNavigationHistory, mergeXYNodesEdges, updateEdgeData, updateNodeData, resetEdgeControlPoints, navigateForward, navigateBack } from './assign.js';
|
|
15
|
-
import { hotkeyActorLogic } from './hotkeyActor.js';
|
|
16
|
-
import { DiagramToggledFeaturesPersistence } from './persistence.js';
|
|
17
|
-
import { syncManualLayoutActorLogic } from './syncManualLayoutActor.js';
|
|
18
|
-
import { findDiagramEdge, findDiagramNode, typedSystem, activeSequenceBounds, focusedBounds } from './utils.js';
|
|
19
|
-
|
|
20
|
-
const _diagramMachine = setup({
|
|
21
|
-
types: {
|
|
22
|
-
context: {},
|
|
23
|
-
input: {},
|
|
24
|
-
children: {},
|
|
25
|
-
events: {},
|
|
26
|
-
emitted: {}
|
|
27
|
-
},
|
|
28
|
-
actors: {
|
|
29
|
-
syncManualLayoutActorLogic,
|
|
30
|
-
hotkeyActorLogic,
|
|
31
|
-
overlaysActorLogic,
|
|
32
|
-
searchActorLogic
|
|
33
|
-
},
|
|
34
|
-
guards: {
|
|
35
|
-
"isReady": ({ context }) => context.initialized.xydata && context.initialized.xyflow,
|
|
36
|
-
"enabled: FitView": ({ context }) => context.features.enableFitView,
|
|
37
|
-
"enabled: FocusMode": ({ context }) => context.features.enableFocusMode && (context.view._type !== "dynamic" || context.dynamicViewVariant !== "sequence"),
|
|
38
|
-
"enabled: Readonly": ({ context }) => context.features.enableReadOnly,
|
|
39
|
-
"enabled: RelationshipDetails": ({ context }) => context.features.enableRelationshipDetails,
|
|
40
|
-
"enabled: Search": ({ context }) => context.features.enableSearch,
|
|
41
|
-
"enabled: ElementDetails": ({ context }) => context.features.enableElementDetails,
|
|
42
|
-
"enabled: DynamicViewWalkthrough": ({ context }) => context.features.enableDynamicViewWalkthrough,
|
|
43
|
-
"not readonly": ({ context }) => !context.features.enableReadOnly,
|
|
44
|
-
"is dynamic view": ({ context }) => context.view._type === "dynamic",
|
|
45
|
-
"is another view": ({ context, event }) => {
|
|
46
|
-
assertEvent(event, ["update.view", "navigate.to"]);
|
|
47
|
-
if (event.type === "update.view") {
|
|
48
|
-
return context.view.id !== event.view.id;
|
|
49
|
-
}
|
|
50
|
-
if (event.type === "navigate.to") {
|
|
51
|
-
return context.view.id !== event.viewId;
|
|
52
|
-
}
|
|
53
|
-
nonexhaustive(event.type);
|
|
54
|
-
},
|
|
55
|
-
"click: node has modelFqn": ({ event }) => {
|
|
56
|
-
assertEvent(event, "xyflow.nodeClick");
|
|
57
|
-
return "modelFqn" in event.node.data;
|
|
58
|
-
},
|
|
59
|
-
"click: selected node": ({ event }) => {
|
|
60
|
-
assertEvent(event, "xyflow.nodeClick");
|
|
61
|
-
return event.node.selected === true;
|
|
62
|
-
},
|
|
63
|
-
"click: same node": ({ context, event }) => {
|
|
64
|
-
assertEvent(event, "xyflow.nodeClick");
|
|
65
|
-
return context.lastClickedNode?.id === event.node.id;
|
|
66
|
-
},
|
|
67
|
-
"click: focused node": ({ context, event }) => {
|
|
68
|
-
assertEvent(event, "xyflow.nodeClick");
|
|
69
|
-
return context.focusedNode === event.node.id;
|
|
70
|
-
},
|
|
71
|
-
"click: node has connections": ({ context, event }) => {
|
|
72
|
-
assertEvent(event, "xyflow.nodeClick");
|
|
73
|
-
return context.xyedges.some((e) => e.source === event.node.id || e.target === event.node.id);
|
|
74
|
-
},
|
|
75
|
-
"click: selected edge": ({ event }) => {
|
|
76
|
-
assertEvent(event, "xyflow.edgeClick");
|
|
77
|
-
return event.edge.selected === true || event.edge.data.active === true;
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
actions: {
|
|
81
|
-
"trigger:NavigateTo": emit(({ context }) => ({
|
|
82
|
-
type: "navigateTo",
|
|
83
|
-
viewId: nonNullable(context.lastOnNavigate, "Invalid state, lastOnNavigate is null").toView
|
|
84
|
-
})),
|
|
85
|
-
"assign lastClickedNode": assign(({ context, event }) => {
|
|
86
|
-
assertEvent(event, "xyflow.nodeClick");
|
|
87
|
-
return {
|
|
88
|
-
lastClickedNode: lastClickedNode({ context, event })
|
|
89
|
-
};
|
|
90
|
-
}),
|
|
91
|
-
"assign: focusedNode": assign(({ event }) => {
|
|
92
|
-
let focusedNode;
|
|
93
|
-
switch (event.type) {
|
|
94
|
-
case "xyflow.nodeClick":
|
|
95
|
-
focusedNode = event.node.data.id;
|
|
96
|
-
break;
|
|
97
|
-
case "focus.node":
|
|
98
|
-
focusedNode = event.nodeId;
|
|
99
|
-
break;
|
|
100
|
-
default:
|
|
101
|
-
throw new Error(`Unexpected event type: ${event.type} in action 'assign: focusedNode'`);
|
|
102
|
-
}
|
|
103
|
-
return {
|
|
104
|
-
focusedNode
|
|
105
|
-
};
|
|
106
|
-
}),
|
|
107
|
-
"reset lastClickedNode": assign(() => ({
|
|
108
|
-
lastClickedNode: null
|
|
109
|
-
})),
|
|
110
|
-
"open source of focused or last clicked node": enqueueActions(({ context, enqueue }) => {
|
|
111
|
-
const nodeId = context.focusedNode ?? context.lastClickedNode?.id;
|
|
112
|
-
if (!nodeId || !context.features.enableVscode) return;
|
|
113
|
-
const diagramNode = findDiagramNode(context, nodeId);
|
|
114
|
-
if (!diagramNode) return;
|
|
115
|
-
if (diagramNode.deploymentRef) {
|
|
116
|
-
enqueue.raise({ type: "open.source", deployment: diagramNode.deploymentRef });
|
|
117
|
-
} else if (diagramNode.modelRef) {
|
|
118
|
-
enqueue.raise({ type: "open.source", element: diagramNode.modelRef });
|
|
119
|
-
}
|
|
120
|
-
}),
|
|
121
|
-
"xyflow:fitDiagram": ({ context }, params) => {
|
|
122
|
-
const {
|
|
123
|
-
bounds = context.view.bounds,
|
|
124
|
-
duration = 450
|
|
125
|
-
} = params ?? {};
|
|
126
|
-
const { width, height, panZoom, transform } = nonNullable(context.xystore).getState();
|
|
127
|
-
const maxZoom = Math.max(1, transform[2]);
|
|
128
|
-
const viewport = getViewportForBounds(
|
|
129
|
-
bounds,
|
|
130
|
-
width,
|
|
131
|
-
height,
|
|
132
|
-
MinZoom,
|
|
133
|
-
maxZoom,
|
|
134
|
-
context.fitViewPadding
|
|
135
|
-
);
|
|
136
|
-
viewport.x = Math.round(viewport.x);
|
|
137
|
-
viewport.y = Math.round(viewport.y);
|
|
138
|
-
panZoom?.setViewport(viewport, duration > 0 ? { duration } : void 0).catch(console.error);
|
|
139
|
-
},
|
|
140
|
-
"xyflow:fitFocusedBounds": ({ context }) => {
|
|
141
|
-
const isActiveSequenceWalkthrough = !!context.activeWalkthrough && context.dynamicViewVariant === "sequence";
|
|
142
|
-
const { bounds, duration = 450 } = isActiveSequenceWalkthrough ? activeSequenceBounds({ context }) : focusedBounds({ context });
|
|
143
|
-
const { width, height, panZoom, transform } = nonNullable(context.xystore).getState();
|
|
144
|
-
const maxZoom = Math.max(1, transform[2]);
|
|
145
|
-
const viewport = getViewportForBounds(
|
|
146
|
-
bounds,
|
|
147
|
-
width,
|
|
148
|
-
height,
|
|
149
|
-
MinZoom,
|
|
150
|
-
maxZoom,
|
|
151
|
-
context.fitViewPadding
|
|
152
|
-
);
|
|
153
|
-
viewport.x = Math.round(viewport.x);
|
|
154
|
-
viewport.y = Math.round(viewport.y);
|
|
155
|
-
panZoom?.setViewport(viewport, duration > 0 ? { duration } : void 0);
|
|
156
|
-
},
|
|
157
|
-
"xyflow:setViewportCenter": ({ context }, params) => {
|
|
158
|
-
const { x, y } = params;
|
|
159
|
-
invariant(context.xyflow, "xyflow is not initialized");
|
|
160
|
-
const zoom = context.xyflow.getZoom();
|
|
161
|
-
context.xyflow.setCenter(Math.round(x), Math.round(y), { zoom });
|
|
162
|
-
},
|
|
163
|
-
"xyflow:setViewport": ({ context }, params) => {
|
|
164
|
-
const {
|
|
165
|
-
viewport,
|
|
166
|
-
duration = 350
|
|
167
|
-
} = params;
|
|
168
|
-
const panZoom = context.xystore?.getState().panZoom;
|
|
169
|
-
panZoom?.setViewport(viewport, duration > 0 ? { duration } : void 0);
|
|
170
|
-
},
|
|
171
|
-
"xyflow:alignNodeFromToAfterNavigate": ({ context }, params) => {
|
|
172
|
-
const xyflow = nonNullable(context.xyflow, "xyflow is not initialized");
|
|
173
|
-
const elFrom = xyflow.getInternalNode(params.fromNode);
|
|
174
|
-
if (!elFrom) return;
|
|
175
|
-
const fromPos = xyflow.flowToScreenPosition({
|
|
176
|
-
x: elFrom.internals.positionAbsolute.x,
|
|
177
|
-
// + dimensions.width / 2,
|
|
178
|
-
y: elFrom.internals.positionAbsolute.y
|
|
179
|
-
// + dimensions.height / 2
|
|
180
|
-
}), toPos = xyflow.flowToScreenPosition(params.toPosition), diff = {
|
|
181
|
-
x: Math.round(fromPos.x - toPos.x),
|
|
182
|
-
y: Math.round(fromPos.y - toPos.y)
|
|
183
|
-
};
|
|
184
|
-
context.xystore.getState().panBy(diff);
|
|
185
|
-
},
|
|
186
|
-
"layout.align": ({ context }, params) => {
|
|
187
|
-
const { mode } = params;
|
|
188
|
-
const xystore = nonNullable(context.xystore, "xystore is not initialized");
|
|
189
|
-
const { nodeLookup, parentLookup } = xystore.getState();
|
|
190
|
-
const selectedNodes = new Set(nodeLookup.values().filter((n) => n.selected).map((n) => n.id));
|
|
191
|
-
const nodesToAlign = [...selectedNodes.difference(new Set(parentLookup.keys()))];
|
|
192
|
-
if (!hasAtLeast(nodesToAlign, 2)) {
|
|
193
|
-
console.warn("At least 2 nodes must be selected to align");
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
const constraints = createLayoutConstraints(xystore, nodesToAlign);
|
|
197
|
-
const aligner = getAligner(mode);
|
|
198
|
-
const nodes = nodesToAlign.map((id) => ({
|
|
199
|
-
node: nonNullable(nodeLookup.get(id)),
|
|
200
|
-
rect: nonNullable(constraints.rects.get(id))
|
|
201
|
-
}));
|
|
202
|
-
aligner.computeLayout(nodes.map(({ node }) => toNodeRect(node)));
|
|
203
|
-
for (const { rect, node } of nodes) {
|
|
204
|
-
rect.positionAbsolute = {
|
|
205
|
-
...rect.positionAbsolute,
|
|
206
|
-
...aligner.applyPosition(toNodeRect(node))
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
constraints.updateXYFlowNodes();
|
|
210
|
-
},
|
|
211
|
-
"ensure overlays actor state": enqueueActions(({ enqueue, context: { features }, system }) => {
|
|
212
|
-
const enableOverlays = features.enableElementDetails || features.enableRelationshipDetails || features.enableRelationshipBrowser;
|
|
213
|
-
const hasRunning = typedSystem(system).overlaysActorRef;
|
|
214
|
-
if (enableOverlays && !hasRunning) {
|
|
215
|
-
enqueue.spawnChild("overlaysActorLogic", { id: "overlays", systemId: "overlays" });
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
if (!enableOverlays && hasRunning) {
|
|
219
|
-
enqueue.sendTo(hasRunning, {
|
|
220
|
-
type: "close.all"
|
|
221
|
-
});
|
|
222
|
-
enqueue.stopChild("overlays");
|
|
223
|
-
}
|
|
224
|
-
}),
|
|
225
|
-
"ensure search actor state": enqueueActions(({ enqueue, context: { features: { enableSearch } }, system }) => {
|
|
226
|
-
const hasRunning = typedSystem(system).searchActorRef;
|
|
227
|
-
if (enableSearch && !hasRunning) {
|
|
228
|
-
enqueue.spawnChild("searchActorLogic", { id: "search", systemId: "search" });
|
|
229
|
-
return;
|
|
230
|
-
}
|
|
231
|
-
if (!enableSearch && hasRunning) {
|
|
232
|
-
enqueue.sendTo(hasRunning, {
|
|
233
|
-
type: "close"
|
|
234
|
-
});
|
|
235
|
-
enqueue.stopChild("search");
|
|
236
|
-
}
|
|
237
|
-
}),
|
|
238
|
-
"updateFeatures": assign(({ event }) => {
|
|
239
|
-
assertEvent(event, "update.features");
|
|
240
|
-
return {
|
|
241
|
-
features: { ...event.features }
|
|
242
|
-
};
|
|
243
|
-
}),
|
|
244
|
-
"updateInputs": assign(({ event }) => {
|
|
245
|
-
assertEvent(event, "update.inputs");
|
|
246
|
-
return { ...event.inputs };
|
|
247
|
-
}),
|
|
248
|
-
"closeSearch": sendTo(
|
|
249
|
-
({ system }) => typedSystem(system).searchActorRef,
|
|
250
|
-
{
|
|
251
|
-
type: "close"
|
|
252
|
-
}
|
|
253
|
-
),
|
|
254
|
-
"closeAllOverlays": sendTo(
|
|
255
|
-
({ system }) => typedSystem(system).overlaysActorRef,
|
|
256
|
-
{
|
|
257
|
-
type: "close.all"
|
|
258
|
-
}
|
|
259
|
-
),
|
|
260
|
-
"startSyncLayout": assign(({ context, spawn, self }) => ({
|
|
261
|
-
syncLayoutActorRef: spawn("syncManualLayoutActorLogic", {
|
|
262
|
-
id: "syncLayout",
|
|
263
|
-
input: { parent: self, viewId: context.view.id }
|
|
264
|
-
})
|
|
265
|
-
})),
|
|
266
|
-
"stopSyncLayout": enqueueActions(({ context, enqueue }) => {
|
|
267
|
-
enqueue.sendTo(context.syncLayoutActorRef, { type: "stop" });
|
|
268
|
-
enqueue.stopChild(context.syncLayoutActorRef);
|
|
269
|
-
enqueue.assign({
|
|
270
|
-
syncLayoutActorRef: null
|
|
271
|
-
});
|
|
272
|
-
}),
|
|
273
|
-
"onNodeMouseEnter": assign(({ context }, params) => {
|
|
274
|
-
return {
|
|
275
|
-
xynodes: context.xynodes.map((n) => {
|
|
276
|
-
if (n.id === params.node.id) {
|
|
277
|
-
return Base.setHovered(n, true);
|
|
278
|
-
}
|
|
279
|
-
return n;
|
|
280
|
-
})
|
|
281
|
-
};
|
|
282
|
-
}),
|
|
283
|
-
"onNodeMouseLeave": assign(({ context }, params) => {
|
|
284
|
-
return {
|
|
285
|
-
xynodes: context.xynodes.map((n) => {
|
|
286
|
-
if (n.id === params.node.id) {
|
|
287
|
-
return Base.setHovered(n, false);
|
|
288
|
-
}
|
|
289
|
-
return n;
|
|
290
|
-
})
|
|
291
|
-
};
|
|
292
|
-
}),
|
|
293
|
-
"onEdgeMouseEnter": enqueueActions(({ enqueue, context, event }) => {
|
|
294
|
-
assertEvent(event, "xyflow.edgeMouseEnter");
|
|
295
|
-
let edge = event.edge;
|
|
296
|
-
enqueue.assign({
|
|
297
|
-
xyedges: context.xyedges.map((e) => {
|
|
298
|
-
if (e.id === event.edge.id) {
|
|
299
|
-
edge = Base.setHovered(e, true);
|
|
300
|
-
return edge;
|
|
301
|
-
}
|
|
302
|
-
return e;
|
|
303
|
-
})
|
|
304
|
-
});
|
|
305
|
-
enqueue.emit({
|
|
306
|
-
type: "edgeMouseEnter",
|
|
307
|
-
edge,
|
|
308
|
-
event: event.event
|
|
309
|
-
});
|
|
310
|
-
}),
|
|
311
|
-
"onEdgeMouseLeave": enqueueActions(({ enqueue, context, event }) => {
|
|
312
|
-
assertEvent(event, "xyflow.edgeMouseLeave");
|
|
313
|
-
let edge = event.edge;
|
|
314
|
-
enqueue.assign({
|
|
315
|
-
xyedges: context.xyedges.map((e) => {
|
|
316
|
-
if (e.id === event.edge.id) {
|
|
317
|
-
edge = Base.setHovered(e, false);
|
|
318
|
-
return edge;
|
|
319
|
-
}
|
|
320
|
-
return e;
|
|
321
|
-
})
|
|
322
|
-
});
|
|
323
|
-
enqueue.emit({
|
|
324
|
-
type: "edgeMouseLeave",
|
|
325
|
-
edge,
|
|
326
|
-
event: event.event
|
|
327
|
-
});
|
|
328
|
-
}),
|
|
329
|
-
"focus on nodes and edges": assign(focusNodesEdges),
|
|
330
|
-
"notations.highlight": assign(({ context }, params) => {
|
|
331
|
-
const kinds = params.kind ? [params.kind] : params.notation.kinds;
|
|
332
|
-
const xynodes = context.xynodes.map((n) => {
|
|
333
|
-
const node = findDiagramNode(context, n.id);
|
|
334
|
-
if (node && node.notation === params.notation.title && node.shape === params.notation.shape && node.color === params.notation.color && kinds.includes(node.kind)) {
|
|
335
|
-
return Base.setDimmed(n, false);
|
|
336
|
-
}
|
|
337
|
-
return Base.setDimmed(n, "immediate");
|
|
338
|
-
});
|
|
339
|
-
return {
|
|
340
|
-
xynodes,
|
|
341
|
-
xyedges: context.xyedges.map(Base.setDimmed("immediate"))
|
|
342
|
-
};
|
|
343
|
-
}),
|
|
344
|
-
"tag.highlight": assign(({ context, event }) => {
|
|
345
|
-
assertEvent(event, "tag.highlight");
|
|
346
|
-
return {
|
|
347
|
-
xynodes: context.xynodes.map((n) => {
|
|
348
|
-
if (n.data.tags?.includes(event.tag)) {
|
|
349
|
-
return Base.setDimmed(n, false);
|
|
350
|
-
}
|
|
351
|
-
return Base.setDimmed(n, true);
|
|
352
|
-
})
|
|
353
|
-
};
|
|
354
|
-
}),
|
|
355
|
-
"undim everything": assign(({ context }) => ({
|
|
356
|
-
xynodes: context.xynodes.map(Base.setDimmed(false)),
|
|
357
|
-
xyedges: context.xyedges.map(Base.setData({
|
|
358
|
-
dimmed: false,
|
|
359
|
-
active: false
|
|
360
|
-
}))
|
|
361
|
-
})),
|
|
362
|
-
"update active walkthrough": assign(updateActiveWalkthrough),
|
|
363
|
-
"open element details": sendTo(
|
|
364
|
-
({ system }) => typedSystem(system).overlaysActorRef,
|
|
365
|
-
({ context, event }, params) => {
|
|
366
|
-
let initiatedFrom = null;
|
|
367
|
-
let fromNodeId, subject;
|
|
368
|
-
if (params) {
|
|
369
|
-
subject = params.fqn;
|
|
370
|
-
fromNodeId = params.fromNode ?? context.view.nodes.find((n) => n.modelRef === params.fqn)?.id;
|
|
371
|
-
} else if (event.type === "xyflow.nodeClick") {
|
|
372
|
-
invariant("modelFqn" in event.node.data && !!event.node.data.modelFqn, "No modelFqn in event node data");
|
|
373
|
-
subject = event.node.data.modelFqn;
|
|
374
|
-
fromNodeId = event.node.data.id;
|
|
375
|
-
} else if (event.type === "open.elementDetails") {
|
|
376
|
-
subject = event.fqn;
|
|
377
|
-
fromNodeId = event.fromNode;
|
|
378
|
-
} else {
|
|
379
|
-
invariant(context.lastClickedNode, "No last clicked node");
|
|
380
|
-
fromNodeId = nonNullable(context.lastClickedNode).id;
|
|
381
|
-
const node = nonNullable(context.xynodes.find((n) => n.id === fromNodeId));
|
|
382
|
-
invariant("modelFqn" in node.data && !!node.data.modelFqn, "No modelFqn in last clicked node");
|
|
383
|
-
subject = node.data.modelFqn;
|
|
384
|
-
}
|
|
385
|
-
const internalNode = fromNodeId ? context.xystore.getState().nodeLookup.get(fromNodeId) : null;
|
|
386
|
-
if (fromNodeId && internalNode) {
|
|
387
|
-
const nodeRect = nodeToRect(internalNode);
|
|
388
|
-
const zoom = context.xyflow.getZoom();
|
|
389
|
-
const clientRect = {
|
|
390
|
-
...context.xyflow.flowToScreenPosition(nodeRect),
|
|
391
|
-
width: nodeRect.width * zoom,
|
|
392
|
-
height: nodeRect.height * zoom
|
|
393
|
-
};
|
|
394
|
-
initiatedFrom = {
|
|
395
|
-
node: fromNodeId,
|
|
396
|
-
clientRect
|
|
397
|
-
};
|
|
398
|
-
}
|
|
399
|
-
return {
|
|
400
|
-
type: "open.elementDetails",
|
|
401
|
-
subject,
|
|
402
|
-
currentView: context.view,
|
|
403
|
-
...initiatedFrom && { initiatedFrom }
|
|
404
|
-
};
|
|
405
|
-
}
|
|
406
|
-
),
|
|
407
|
-
"emit: walkthroughStarted": emit(({ context }) => {
|
|
408
|
-
const edge = context.xyedges.find((x) => x.id === context.activeWalkthrough?.stepId);
|
|
409
|
-
invariant(edge, "Invalid walkthrough state");
|
|
410
|
-
return {
|
|
411
|
-
type: "walkthroughStarted",
|
|
412
|
-
edge
|
|
413
|
-
};
|
|
414
|
-
}),
|
|
415
|
-
"emit: walkthroughStep": emit(({ context }) => {
|
|
416
|
-
const edge = context.xyedges.find((x) => x.id === context.activeWalkthrough?.stepId);
|
|
417
|
-
invariant(edge, "Invalid walkthrough state");
|
|
418
|
-
return {
|
|
419
|
-
type: "walkthroughStep",
|
|
420
|
-
edge
|
|
421
|
-
};
|
|
422
|
-
}),
|
|
423
|
-
"emit: walkthroughStopped": emit(() => ({
|
|
424
|
-
type: "walkthroughStopped"
|
|
425
|
-
})),
|
|
426
|
-
"emit: edgeEditingStarted": emit(({ context, event }) => {
|
|
427
|
-
assertEvent(event, "xyflow.edgeEditingStarted");
|
|
428
|
-
const edge = nonNullable(context.xyedges.find((x) => x.id === event.edge.id), `Edge ${event.edge.id} not found`);
|
|
429
|
-
return {
|
|
430
|
-
type: "edgeEditingStarted",
|
|
431
|
-
edge
|
|
432
|
-
};
|
|
433
|
-
}),
|
|
434
|
-
"emit: paneClick": emit(() => ({
|
|
435
|
-
type: "paneClick"
|
|
436
|
-
})),
|
|
437
|
-
"emit: nodeClick": emit(({ context, event }) => {
|
|
438
|
-
assertEvent(event, "xyflow.nodeClick");
|
|
439
|
-
const node = nonNullable(findDiagramNode(context, event.node.id), `Node ${event.node.id} not found in diagram`);
|
|
440
|
-
return {
|
|
441
|
-
type: "nodeClick",
|
|
442
|
-
node,
|
|
443
|
-
xynode: event.node
|
|
444
|
-
};
|
|
445
|
-
}),
|
|
446
|
-
"emit: edgeClick": emit(({ context, event }) => {
|
|
447
|
-
assertEvent(event, "xyflow.edgeClick");
|
|
448
|
-
const edge = nonNullable(findDiagramEdge(context, event.edge.id), `Edge ${event.edge.id} not found in diagram`);
|
|
449
|
-
return {
|
|
450
|
-
type: "edgeClick",
|
|
451
|
-
edge,
|
|
452
|
-
xyedge: event.edge
|
|
453
|
-
};
|
|
454
|
-
}),
|
|
455
|
-
"emit: initialized": emit(({ context }) => {
|
|
456
|
-
invariant(context.xyflow, "XYFlow instance not found");
|
|
457
|
-
return {
|
|
458
|
-
type: "initialized",
|
|
459
|
-
instance: context.xyflow
|
|
460
|
-
};
|
|
461
|
-
}),
|
|
462
|
-
"emit: openSource": emit((_, _params) => ({
|
|
463
|
-
type: "openSource",
|
|
464
|
-
params: _params
|
|
465
|
-
})),
|
|
466
|
-
"assign: dynamicViewVariant": assign(({ event }) => {
|
|
467
|
-
assertEvent(event, "switch.dynamicViewVariant");
|
|
468
|
-
return {
|
|
469
|
-
dynamicViewVariant: event.variant
|
|
470
|
-
};
|
|
471
|
-
})
|
|
472
|
-
}
|
|
473
|
-
}).createMachine({
|
|
474
|
-
initial: "initializing",
|
|
475
|
-
context: ({ input }) => ({
|
|
476
|
-
...input,
|
|
477
|
-
xyedges: [],
|
|
478
|
-
xynodes: [],
|
|
479
|
-
features: { ...AllDisabled },
|
|
480
|
-
toggledFeatures: DiagramToggledFeaturesPersistence.read() ?? {
|
|
481
|
-
enableReadOnly: true
|
|
482
|
-
},
|
|
483
|
-
initialized: {
|
|
484
|
-
xydata: false,
|
|
485
|
-
xyflow: false
|
|
486
|
-
},
|
|
487
|
-
viewportChangedManually: false,
|
|
488
|
-
lastOnNavigate: null,
|
|
489
|
-
lastClickedNode: null,
|
|
490
|
-
focusedNode: null,
|
|
491
|
-
activeElementDetails: null,
|
|
492
|
-
viewportBeforeFocus: null,
|
|
493
|
-
navigationHistory: {
|
|
494
|
-
currentIndex: 0,
|
|
495
|
-
history: []
|
|
496
|
-
},
|
|
497
|
-
viewport: { x: 0, y: 0, zoom: 1 },
|
|
498
|
-
xyflow: null,
|
|
499
|
-
syncLayoutActorRef: null,
|
|
500
|
-
dynamicViewVariant: input.dynamicViewVariant ?? (input.view._type === "dynamic" ? input.view.variant : "diagram") ?? "diagram",
|
|
501
|
-
activeWalkthrough: null
|
|
502
|
-
}),
|
|
503
|
-
// entry: ({ spawn }) => spawn(layoutActor, { id: 'layout', input: { parent: self } }),
|
|
504
|
-
states: {
|
|
505
|
-
initializing: {
|
|
506
|
-
on: {
|
|
507
|
-
"xyflow.init": {
|
|
508
|
-
actions: assign(({ context, event }) => ({
|
|
509
|
-
initialized: {
|
|
510
|
-
...context.initialized,
|
|
511
|
-
xyflow: true
|
|
512
|
-
},
|
|
513
|
-
xyflow: event.instance
|
|
514
|
-
})),
|
|
515
|
-
target: "isReady"
|
|
516
|
-
},
|
|
517
|
-
"update.view": {
|
|
518
|
-
actions: assign(({ context, event }) => ({
|
|
519
|
-
initialized: {
|
|
520
|
-
...context.initialized,
|
|
521
|
-
xydata: true
|
|
522
|
-
},
|
|
523
|
-
view: event.view,
|
|
524
|
-
xynodes: event.xynodes,
|
|
525
|
-
xyedges: event.xyedges
|
|
526
|
-
})),
|
|
527
|
-
target: "isReady"
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
},
|
|
531
|
-
isReady: {
|
|
532
|
-
always: [{
|
|
533
|
-
guard: "isReady",
|
|
534
|
-
actions: [
|
|
535
|
-
{
|
|
536
|
-
type: "xyflow:fitDiagram",
|
|
537
|
-
params: { duration: 0 }
|
|
538
|
-
},
|
|
539
|
-
assign(({ context }) => ({
|
|
540
|
-
navigationHistory: {
|
|
541
|
-
currentIndex: 0,
|
|
542
|
-
history: [{
|
|
543
|
-
viewId: context.view.id,
|
|
544
|
-
fromNode: null,
|
|
545
|
-
viewport: { ...context.xyflow.getViewport() }
|
|
546
|
-
}]
|
|
547
|
-
}
|
|
548
|
-
})),
|
|
549
|
-
"startSyncLayout",
|
|
550
|
-
"emit: initialized"
|
|
551
|
-
],
|
|
552
|
-
target: "ready"
|
|
553
|
-
}, {
|
|
554
|
-
target: "initializing"
|
|
555
|
-
}]
|
|
556
|
-
},
|
|
557
|
-
ready: {
|
|
558
|
-
initial: "idle",
|
|
559
|
-
on: {
|
|
560
|
-
"navigate.to": {
|
|
561
|
-
guard: "is another view",
|
|
562
|
-
actions: assign({
|
|
563
|
-
lastOnNavigate: ({ context, event }) => ({
|
|
564
|
-
fromView: context.view.id,
|
|
565
|
-
toView: event.viewId,
|
|
566
|
-
fromNode: event.fromNode ?? null
|
|
567
|
-
})
|
|
568
|
-
}),
|
|
569
|
-
target: "#navigating"
|
|
570
|
-
},
|
|
571
|
-
"navigate.back": {
|
|
572
|
-
guard: ({ context }) => context.navigationHistory.currentIndex > 0,
|
|
573
|
-
actions: assign(navigateBack),
|
|
574
|
-
target: "#navigating"
|
|
575
|
-
},
|
|
576
|
-
"navigate.forward": {
|
|
577
|
-
guard: ({ context }) => context.navigationHistory.currentIndex < context.navigationHistory.history.length - 1,
|
|
578
|
-
actions: assign(navigateForward),
|
|
579
|
-
target: "#navigating"
|
|
580
|
-
},
|
|
581
|
-
"layout.align": {
|
|
582
|
-
guard: "not readonly",
|
|
583
|
-
actions: [
|
|
584
|
-
{
|
|
585
|
-
type: "layout.align",
|
|
586
|
-
params: ({ event }) => ({ mode: event.mode })
|
|
587
|
-
},
|
|
588
|
-
raise({ type: "saveManualLayout.schedule" })
|
|
589
|
-
]
|
|
590
|
-
},
|
|
591
|
-
"layout.resetEdgeControlPoints": {
|
|
592
|
-
guard: "not readonly",
|
|
593
|
-
actions: [
|
|
594
|
-
assign(resetEdgeControlPoints),
|
|
595
|
-
raise({ type: "saveManualLayout.schedule" })
|
|
596
|
-
]
|
|
597
|
-
},
|
|
598
|
-
"xyflow.resized": {
|
|
599
|
-
guard: ({ context }) => context.features.enableFitView && !context.viewportChangedManually,
|
|
600
|
-
actions: [
|
|
601
|
-
cancel("fitDiagram"),
|
|
602
|
-
raise({ type: "fitDiagram" }, { id: "fitDiagram", delay: 200 })
|
|
603
|
-
]
|
|
604
|
-
},
|
|
605
|
-
"open.elementDetails": {
|
|
606
|
-
guard: "enabled: ElementDetails",
|
|
607
|
-
actions: "open element details"
|
|
608
|
-
},
|
|
609
|
-
"open.relationshipsBrowser": {
|
|
610
|
-
actions: sendTo(({ system }) => typedSystem(system).overlaysActorRef, ({ context, event }) => ({
|
|
611
|
-
type: "open.relationshipsBrowser",
|
|
612
|
-
subject: event.fqn,
|
|
613
|
-
viewId: context.view.id,
|
|
614
|
-
scope: "view",
|
|
615
|
-
closeable: true,
|
|
616
|
-
enableChangeScope: true,
|
|
617
|
-
enableSelectSubject: true
|
|
618
|
-
}))
|
|
619
|
-
},
|
|
620
|
-
"open.relationshipDetails": {
|
|
621
|
-
actions: sendTo(({ system }) => typedSystem(system).overlaysActorRef, ({ context, event }) => ({
|
|
622
|
-
type: "open.relationshipDetails",
|
|
623
|
-
viewId: context.view.id,
|
|
624
|
-
...event.params
|
|
625
|
-
}))
|
|
626
|
-
},
|
|
627
|
-
"open.source": {
|
|
628
|
-
actions: {
|
|
629
|
-
type: "emit: openSource",
|
|
630
|
-
params: prop("event")
|
|
631
|
-
}
|
|
632
|
-
},
|
|
633
|
-
"walkthrough.start": {
|
|
634
|
-
guard: "is dynamic view",
|
|
635
|
-
target: ".walkthrough"
|
|
636
|
-
},
|
|
637
|
-
"toggle.feature": {
|
|
638
|
-
actions: assign({
|
|
639
|
-
toggledFeatures: ({ context, event }) => {
|
|
640
|
-
return DiagramToggledFeaturesPersistence.write({
|
|
641
|
-
...context.toggledFeatures,
|
|
642
|
-
[`enable${event.feature}`]: event.forceValue ?? !(context.toggledFeatures[`enable${event.feature}`] ?? context.features[`enable${event.feature}`])
|
|
643
|
-
});
|
|
644
|
-
}
|
|
645
|
-
})
|
|
646
|
-
},
|
|
647
|
-
"xyflow.nodeMouseEnter": {
|
|
648
|
-
actions: {
|
|
649
|
-
type: "onNodeMouseEnter",
|
|
650
|
-
params: prop("event")
|
|
651
|
-
}
|
|
652
|
-
},
|
|
653
|
-
"xyflow.nodeMouseLeave": {
|
|
654
|
-
actions: {
|
|
655
|
-
type: "onNodeMouseLeave",
|
|
656
|
-
params: prop("event")
|
|
657
|
-
}
|
|
658
|
-
},
|
|
659
|
-
"xyflow.edgeMouseEnter": {
|
|
660
|
-
actions: "onEdgeMouseEnter"
|
|
661
|
-
},
|
|
662
|
-
"xyflow.edgeMouseLeave": {
|
|
663
|
-
actions: "onEdgeMouseLeave"
|
|
664
|
-
},
|
|
665
|
-
"notations.highlight": {
|
|
666
|
-
actions: {
|
|
667
|
-
type: "notations.highlight",
|
|
668
|
-
params: prop("event")
|
|
669
|
-
}
|
|
670
|
-
},
|
|
671
|
-
"notations.unhighlight": {
|
|
672
|
-
actions: "undim everything"
|
|
673
|
-
},
|
|
674
|
-
"tag.highlight": {
|
|
675
|
-
actions: "tag.highlight"
|
|
676
|
-
},
|
|
677
|
-
"tag.unhighlight": {
|
|
678
|
-
actions: "undim everything"
|
|
679
|
-
},
|
|
680
|
-
"saveManualLayout.*": {
|
|
681
|
-
guard: "not readonly",
|
|
682
|
-
actions: sendTo((c) => c.context.syncLayoutActorRef, ({ event }) => {
|
|
683
|
-
if (event.type === "saveManualLayout.schedule") {
|
|
684
|
-
return { type: "sync" };
|
|
685
|
-
}
|
|
686
|
-
if (event.type === "saveManualLayout.cancel") {
|
|
687
|
-
return { type: "cancel" };
|
|
688
|
-
}
|
|
689
|
-
nonexhaustive(event);
|
|
690
|
-
})
|
|
691
|
-
},
|
|
692
|
-
"open.search": {
|
|
693
|
-
guard: "enabled: Search",
|
|
694
|
-
actions: sendTo(({ system }) => typedSystem(system).searchActorRef, ({ event }) => ({
|
|
695
|
-
type: "open",
|
|
696
|
-
search: event.search
|
|
697
|
-
}))
|
|
698
|
-
}
|
|
699
|
-
},
|
|
700
|
-
exit: [
|
|
701
|
-
cancel("fitDiagram")
|
|
702
|
-
],
|
|
703
|
-
states: {
|
|
704
|
-
idle: {
|
|
705
|
-
id: "idle",
|
|
706
|
-
on: {
|
|
707
|
-
"xyflow.nodeClick": [
|
|
708
|
-
{
|
|
709
|
-
// TODO: xstate fails to infer the type of the guard
|
|
710
|
-
guard: and([
|
|
711
|
-
"enabled: FocusMode",
|
|
712
|
-
"click: node has connections",
|
|
713
|
-
or([
|
|
714
|
-
"click: same node",
|
|
715
|
-
"click: selected node"
|
|
716
|
-
])
|
|
717
|
-
]),
|
|
718
|
-
actions: [
|
|
719
|
-
"assign lastClickedNode",
|
|
720
|
-
"assign: focusedNode",
|
|
721
|
-
"emit: nodeClick"
|
|
722
|
-
],
|
|
723
|
-
target: "focused"
|
|
724
|
-
},
|
|
725
|
-
{
|
|
726
|
-
// TODO: xstate fails to infer the type of the guard
|
|
727
|
-
guard: and([
|
|
728
|
-
"enabled: ElementDetails",
|
|
729
|
-
"click: node has modelFqn",
|
|
730
|
-
or([
|
|
731
|
-
"click: same node",
|
|
732
|
-
"click: selected node"
|
|
733
|
-
])
|
|
734
|
-
]),
|
|
735
|
-
actions: [
|
|
736
|
-
"assign lastClickedNode",
|
|
737
|
-
"open source of focused or last clicked node",
|
|
738
|
-
"open element details",
|
|
739
|
-
"emit: nodeClick"
|
|
740
|
-
]
|
|
741
|
-
},
|
|
742
|
-
{
|
|
743
|
-
actions: [
|
|
744
|
-
"assign lastClickedNode",
|
|
745
|
-
"open source of focused or last clicked node",
|
|
746
|
-
"emit: nodeClick"
|
|
747
|
-
]
|
|
748
|
-
}
|
|
749
|
-
],
|
|
750
|
-
"xyflow.paneClick": {
|
|
751
|
-
actions: [
|
|
752
|
-
"reset lastClickedNode",
|
|
753
|
-
"emit: paneClick"
|
|
754
|
-
]
|
|
755
|
-
},
|
|
756
|
-
"xyflow.paneDblClick": {
|
|
757
|
-
actions: [
|
|
758
|
-
"reset lastClickedNode",
|
|
759
|
-
"xyflow:fitDiagram",
|
|
760
|
-
{ type: "emit: openSource", params: ({ context }) => ({ view: context.view.id }) }
|
|
761
|
-
]
|
|
762
|
-
},
|
|
763
|
-
"focus.node": {
|
|
764
|
-
guard: "enabled: FocusMode",
|
|
765
|
-
actions: "assign: focusedNode",
|
|
766
|
-
target: "focused"
|
|
767
|
-
},
|
|
768
|
-
"xyflow.edgeClick": {
|
|
769
|
-
guard: and([
|
|
770
|
-
"is dynamic view",
|
|
771
|
-
"enabled: DynamicViewWalkthrough",
|
|
772
|
-
"click: selected edge"
|
|
773
|
-
]),
|
|
774
|
-
actions: [
|
|
775
|
-
raise(({ event }) => ({
|
|
776
|
-
type: "walkthrough.start",
|
|
777
|
-
stepId: event.edge.id
|
|
778
|
-
})),
|
|
779
|
-
"emit: edgeClick"
|
|
780
|
-
]
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
|
-
},
|
|
784
|
-
focused: {
|
|
785
|
-
entry: [
|
|
786
|
-
"focus on nodes and edges",
|
|
787
|
-
assign((s) => ({
|
|
788
|
-
viewportBeforeFocus: { ...s.context.viewport }
|
|
789
|
-
})),
|
|
790
|
-
"open source of focused or last clicked node",
|
|
791
|
-
spawnChild("hotkeyActorLogic", { id: "hotkey" }),
|
|
792
|
-
"xyflow:fitFocusedBounds"
|
|
793
|
-
],
|
|
794
|
-
exit: enqueueActions(({ enqueue, context }) => {
|
|
795
|
-
enqueue.stopChild("hotkey");
|
|
796
|
-
if (context.viewportBeforeFocus) {
|
|
797
|
-
enqueue({ type: "xyflow:setViewport", params: { viewport: context.viewportBeforeFocus } });
|
|
798
|
-
} else {
|
|
799
|
-
enqueue("xyflow:fitDiagram");
|
|
800
|
-
}
|
|
801
|
-
enqueue("undim everything");
|
|
802
|
-
enqueue.assign({
|
|
803
|
-
viewportBeforeFocus: null,
|
|
804
|
-
focusedNode: null
|
|
805
|
-
});
|
|
806
|
-
}),
|
|
807
|
-
on: {
|
|
808
|
-
"xyflow.nodeClick": [
|
|
809
|
-
{
|
|
810
|
-
guard: and([
|
|
811
|
-
"click: focused node",
|
|
812
|
-
"click: node has modelFqn"
|
|
813
|
-
]),
|
|
814
|
-
actions: [
|
|
815
|
-
"open element details",
|
|
816
|
-
"emit: nodeClick"
|
|
817
|
-
]
|
|
818
|
-
},
|
|
819
|
-
{
|
|
820
|
-
guard: "click: focused node",
|
|
821
|
-
actions: "emit: nodeClick",
|
|
822
|
-
target: "#idle"
|
|
823
|
-
},
|
|
824
|
-
{
|
|
825
|
-
actions: [
|
|
826
|
-
"assign lastClickedNode",
|
|
827
|
-
raise(({ event }) => ({
|
|
828
|
-
type: "focus.node",
|
|
829
|
-
nodeId: event.node.id
|
|
830
|
-
})),
|
|
831
|
-
"emit: nodeClick"
|
|
832
|
-
]
|
|
833
|
-
}
|
|
834
|
-
],
|
|
835
|
-
"focus.node": {
|
|
836
|
-
actions: [
|
|
837
|
-
"assign: focusedNode",
|
|
838
|
-
"focus on nodes and edges",
|
|
839
|
-
"open source of focused or last clicked node",
|
|
840
|
-
"xyflow:fitFocusedBounds"
|
|
841
|
-
]
|
|
842
|
-
},
|
|
843
|
-
"key.esc": {
|
|
844
|
-
target: "idle"
|
|
845
|
-
},
|
|
846
|
-
"xyflow.paneClick": {
|
|
847
|
-
actions: [
|
|
848
|
-
"reset lastClickedNode",
|
|
849
|
-
"emit: paneClick"
|
|
850
|
-
],
|
|
851
|
-
target: "idle"
|
|
852
|
-
},
|
|
853
|
-
"notations.unhighlight": {
|
|
854
|
-
actions: "focus on nodes and edges"
|
|
855
|
-
},
|
|
856
|
-
"tag.unhighlight": {
|
|
857
|
-
actions: "focus on nodes and edges"
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
|
-
},
|
|
861
|
-
walkthrough: {
|
|
862
|
-
entry: [
|
|
863
|
-
spawnChild("hotkeyActorLogic", { id: "hotkey" }),
|
|
864
|
-
assign({
|
|
865
|
-
viewportBeforeFocus: ({ context }) => context.viewport,
|
|
866
|
-
activeWalkthrough: ({ context, event }) => {
|
|
867
|
-
assertEvent(event, "walkthrough.start");
|
|
868
|
-
const stepId = event.stepId ?? first(context.xyedges).id;
|
|
869
|
-
return {
|
|
870
|
-
stepId,
|
|
871
|
-
parallelPrefix: getParallelStepsPrefix(stepId)
|
|
872
|
-
};
|
|
873
|
-
}
|
|
874
|
-
}),
|
|
875
|
-
"update active walkthrough",
|
|
876
|
-
"xyflow:fitFocusedBounds",
|
|
877
|
-
"emit: walkthroughStarted"
|
|
878
|
-
],
|
|
879
|
-
exit: enqueueActions(({ enqueue, context }) => {
|
|
880
|
-
enqueue.stopChild("hotkey");
|
|
881
|
-
if (context.viewportBeforeFocus) {
|
|
882
|
-
enqueue({ type: "xyflow:setViewport", params: { viewport: context.viewportBeforeFocus } });
|
|
883
|
-
} else {
|
|
884
|
-
enqueue("xyflow:fitDiagram");
|
|
885
|
-
}
|
|
886
|
-
if (context.dynamicViewVariant === "sequence" && context.activeWalkthrough?.parallelPrefix) {
|
|
887
|
-
enqueue.assign({
|
|
888
|
-
xynodes: context.xynodes.map((n) => {
|
|
889
|
-
if (n.type === "seq-parallel") {
|
|
890
|
-
return Base.setData(n, {
|
|
891
|
-
color: SeqParallelAreaColor.default
|
|
892
|
-
});
|
|
893
|
-
}
|
|
894
|
-
return n;
|
|
895
|
-
})
|
|
896
|
-
});
|
|
897
|
-
}
|
|
898
|
-
enqueue("undim everything");
|
|
899
|
-
enqueue.assign({
|
|
900
|
-
activeWalkthrough: null,
|
|
901
|
-
viewportBeforeFocus: null
|
|
902
|
-
});
|
|
903
|
-
enqueue("emit: walkthroughStopped");
|
|
904
|
-
}),
|
|
905
|
-
on: {
|
|
906
|
-
"key.esc": {
|
|
907
|
-
target: "idle"
|
|
908
|
-
},
|
|
909
|
-
"key.arrow.left": {
|
|
910
|
-
actions: raise({ type: "walkthrough.step", direction: "previous" })
|
|
911
|
-
},
|
|
912
|
-
"key.arrow.right": {
|
|
913
|
-
actions: raise({ type: "walkthrough.step", direction: "next" })
|
|
914
|
-
},
|
|
915
|
-
"walkthrough.step": {
|
|
916
|
-
actions: [
|
|
917
|
-
assign(({ context, event }) => {
|
|
918
|
-
const { stepId } = context.activeWalkthrough;
|
|
919
|
-
const stepIndex = context.xyedges.findIndex((e) => e.id === stepId);
|
|
920
|
-
const nextStepIndex = clamp(event.direction === "next" ? stepIndex + 1 : stepIndex - 1, {
|
|
921
|
-
min: 0,
|
|
922
|
-
max: context.xyedges.length - 1
|
|
923
|
-
});
|
|
924
|
-
if (nextStepIndex === stepIndex) {
|
|
925
|
-
return {};
|
|
926
|
-
}
|
|
927
|
-
const nextStepId = context.xyedges[nextStepIndex].id;
|
|
928
|
-
return {
|
|
929
|
-
activeWalkthrough: {
|
|
930
|
-
stepId: nextStepId,
|
|
931
|
-
parallelPrefix: getParallelStepsPrefix(nextStepId)
|
|
932
|
-
}
|
|
933
|
-
};
|
|
934
|
-
}),
|
|
935
|
-
"update active walkthrough",
|
|
936
|
-
"xyflow:fitFocusedBounds",
|
|
937
|
-
"emit: walkthroughStep"
|
|
938
|
-
]
|
|
939
|
-
},
|
|
940
|
-
"xyflow.edgeClick": {
|
|
941
|
-
actions: [
|
|
942
|
-
assign(({ event, context }) => {
|
|
943
|
-
if (!isStepEdgeId(event.edge.id) || event.edge.id === context.activeWalkthrough?.stepId) {
|
|
944
|
-
return {};
|
|
945
|
-
}
|
|
946
|
-
return {
|
|
947
|
-
activeWalkthrough: {
|
|
948
|
-
stepId: event.edge.id,
|
|
949
|
-
parallelPrefix: getParallelStepsPrefix(event.edge.id)
|
|
950
|
-
}
|
|
951
|
-
};
|
|
952
|
-
}),
|
|
953
|
-
"update active walkthrough",
|
|
954
|
-
"xyflow:fitFocusedBounds",
|
|
955
|
-
"emit: edgeClick",
|
|
956
|
-
"emit: walkthroughStep"
|
|
957
|
-
]
|
|
958
|
-
},
|
|
959
|
-
"notations.unhighlight": {
|
|
960
|
-
actions: "update active walkthrough"
|
|
961
|
-
},
|
|
962
|
-
"tag.unhighlight": {
|
|
963
|
-
actions: "update active walkthrough"
|
|
964
|
-
},
|
|
965
|
-
"walkthrough.end": {
|
|
966
|
-
target: "idle"
|
|
967
|
-
},
|
|
968
|
-
"xyflow.paneDblClick": {
|
|
969
|
-
target: "idle"
|
|
970
|
-
},
|
|
971
|
-
// We received another view, close overlay and process event again
|
|
972
|
-
"update.view": {
|
|
973
|
-
guard: "is another view",
|
|
974
|
-
actions: raise(({ event }) => event, { delay: 50 }),
|
|
975
|
-
target: "idle"
|
|
976
|
-
}
|
|
977
|
-
}
|
|
978
|
-
}
|
|
979
|
-
}
|
|
980
|
-
},
|
|
981
|
-
// Navigating to another view (after `navigateTo` event)
|
|
982
|
-
navigating: {
|
|
983
|
-
id: "navigating",
|
|
984
|
-
entry: [
|
|
985
|
-
"closeAllOverlays",
|
|
986
|
-
"closeSearch",
|
|
987
|
-
"stopSyncLayout",
|
|
988
|
-
"trigger:NavigateTo"
|
|
989
|
-
],
|
|
990
|
-
on: {
|
|
991
|
-
"update.view": {
|
|
992
|
-
actions: enqueueActions(({ enqueue, context, event }) => {
|
|
993
|
-
const { fromNode, toNode } = findCorrespondingNode(context, event);
|
|
994
|
-
if (fromNode && toNode) {
|
|
995
|
-
enqueue({
|
|
996
|
-
type: "xyflow:alignNodeFromToAfterNavigate",
|
|
997
|
-
params: {
|
|
998
|
-
fromNode: fromNode.id,
|
|
999
|
-
toPosition: {
|
|
1000
|
-
x: toNode.data.x,
|
|
1001
|
-
y: toNode.data.y
|
|
1002
|
-
}
|
|
1003
|
-
}
|
|
1004
|
-
});
|
|
1005
|
-
} else {
|
|
1006
|
-
enqueue({
|
|
1007
|
-
type: "xyflow:setViewportCenter",
|
|
1008
|
-
params: BBox.center(event.view.bounds)
|
|
1009
|
-
});
|
|
1010
|
-
}
|
|
1011
|
-
enqueue.assign(updateNavigationHistory);
|
|
1012
|
-
enqueue.assign({
|
|
1013
|
-
...mergeXYNodesEdges({ context, event }),
|
|
1014
|
-
lastOnNavigate: null
|
|
1015
|
-
});
|
|
1016
|
-
enqueue("startSyncLayout");
|
|
1017
|
-
enqueue.raise({ type: "fitDiagram" }, { id: "fitDiagram", delay: 25 });
|
|
1018
|
-
}),
|
|
1019
|
-
target: "#idle"
|
|
1020
|
-
}
|
|
1021
|
-
}
|
|
1022
|
-
}
|
|
1023
|
-
},
|
|
1024
|
-
on: {
|
|
1025
|
-
"xyflow.paneClick": {
|
|
1026
|
-
actions: "emit: paneClick"
|
|
1027
|
-
},
|
|
1028
|
-
"xyflow.nodeClick": {
|
|
1029
|
-
actions: "emit: nodeClick"
|
|
1030
|
-
},
|
|
1031
|
-
"xyflow.edgeClick": {
|
|
1032
|
-
actions: "emit: edgeClick"
|
|
1033
|
-
},
|
|
1034
|
-
"xyflow.applyNodeChanges": {
|
|
1035
|
-
actions: assign({
|
|
1036
|
-
xynodes: ({ context, event }) => applyNodeChanges(event.changes, context.xynodes)
|
|
1037
|
-
})
|
|
1038
|
-
},
|
|
1039
|
-
"xyflow.applyEdgeChanges": {
|
|
1040
|
-
actions: assign({
|
|
1041
|
-
xyedges: ({ context, event }) => applyEdgeChanges(event.changes, context.xyedges)
|
|
1042
|
-
})
|
|
1043
|
-
},
|
|
1044
|
-
"xyflow.viewportMoved": {
|
|
1045
|
-
actions: assign({
|
|
1046
|
-
viewportChangedManually: (({ event }) => event.manually),
|
|
1047
|
-
viewport: (({ event }) => event.viewport)
|
|
1048
|
-
})
|
|
1049
|
-
},
|
|
1050
|
-
"xyflow.edgeEditingStarted": {
|
|
1051
|
-
actions: "emit: edgeEditingStarted"
|
|
1052
|
-
},
|
|
1053
|
-
"fitDiagram": {
|
|
1054
|
-
guard: "enabled: FitView",
|
|
1055
|
-
actions: {
|
|
1056
|
-
type: "xyflow:fitDiagram",
|
|
1057
|
-
params: prop("event")
|
|
1058
|
-
}
|
|
1059
|
-
},
|
|
1060
|
-
"update.nodeData": {
|
|
1061
|
-
actions: assign(updateNodeData)
|
|
1062
|
-
},
|
|
1063
|
-
"update.edgeData": {
|
|
1064
|
-
actions: assign(updateEdgeData)
|
|
1065
|
-
},
|
|
1066
|
-
"update.view": {
|
|
1067
|
-
actions: [
|
|
1068
|
-
assign(updateNavigationHistory),
|
|
1069
|
-
enqueueActions(({ enqueue, event, check, context }) => {
|
|
1070
|
-
const isAnotherView = check("is another view");
|
|
1071
|
-
if (isAnotherView) {
|
|
1072
|
-
enqueue("closeAllOverlays");
|
|
1073
|
-
enqueue("closeSearch");
|
|
1074
|
-
enqueue("stopSyncLayout");
|
|
1075
|
-
enqueue.assign({
|
|
1076
|
-
focusedNode: null
|
|
1077
|
-
});
|
|
1078
|
-
const { fromNode, toNode } = findCorrespondingNode(context, event);
|
|
1079
|
-
if (fromNode && toNode) {
|
|
1080
|
-
enqueue({
|
|
1081
|
-
type: "xyflow:alignNodeFromToAfterNavigate",
|
|
1082
|
-
params: {
|
|
1083
|
-
fromNode: fromNode.id,
|
|
1084
|
-
toPosition: {
|
|
1085
|
-
x: toNode.data.x,
|
|
1086
|
-
y: toNode.data.y
|
|
1087
|
-
}
|
|
1088
|
-
}
|
|
1089
|
-
});
|
|
1090
|
-
enqueue.raise({ type: "fitDiagram" }, { id: "fitDiagram", delay: 80 });
|
|
1091
|
-
} else {
|
|
1092
|
-
enqueue({
|
|
1093
|
-
type: "xyflow:setViewportCenter",
|
|
1094
|
-
params: BBox.center(event.view.bounds)
|
|
1095
|
-
});
|
|
1096
|
-
enqueue.raise({ type: "fitDiagram", duration: 200 }, { id: "fitDiagram", delay: 25 });
|
|
1097
|
-
}
|
|
1098
|
-
} else {
|
|
1099
|
-
const nextView = event.view;
|
|
1100
|
-
if (nextView._type === "dynamic" && context.view._type === "dynamic" && nextView.variant !== context.view.variant) {
|
|
1101
|
-
enqueue({
|
|
1102
|
-
type: "xyflow:setViewportCenter",
|
|
1103
|
-
params: BBox.center(nextView.bounds)
|
|
1104
|
-
});
|
|
1105
|
-
}
|
|
1106
|
-
}
|
|
1107
|
-
enqueue.assign({
|
|
1108
|
-
...mergeXYNodesEdges({ context, event }),
|
|
1109
|
-
lastOnNavigate: null
|
|
1110
|
-
});
|
|
1111
|
-
if (isAnotherView) {
|
|
1112
|
-
enqueue("startSyncLayout");
|
|
1113
|
-
} else {
|
|
1114
|
-
enqueue.sendTo((c) => c.context.syncLayoutActorRef, { type: "synced" });
|
|
1115
|
-
if (!context.viewportChangedManually) {
|
|
1116
|
-
enqueue.raise({ type: "fitDiagram" }, { id: "fitDiagram", delay: 50 });
|
|
1117
|
-
}
|
|
1118
|
-
}
|
|
1119
|
-
})
|
|
1120
|
-
]
|
|
1121
|
-
},
|
|
1122
|
-
"update.inputs": {
|
|
1123
|
-
actions: "updateInputs"
|
|
1124
|
-
},
|
|
1125
|
-
"update.features": {
|
|
1126
|
-
actions: [
|
|
1127
|
-
"updateFeatures",
|
|
1128
|
-
"ensure overlays actor state",
|
|
1129
|
-
"ensure search actor state"
|
|
1130
|
-
]
|
|
1131
|
-
},
|
|
1132
|
-
"switch.dynamicViewVariant": {
|
|
1133
|
-
actions: "assign: dynamicViewVariant"
|
|
1134
|
-
}
|
|
1135
|
-
},
|
|
1136
|
-
exit: [
|
|
1137
|
-
"stopSyncLayout",
|
|
1138
|
-
cancel("fitDiagram"),
|
|
1139
|
-
stopChild("hotkey"),
|
|
1140
|
-
stopChild("overlays"),
|
|
1141
|
-
stopChild("search"),
|
|
1142
|
-
assign({
|
|
1143
|
-
xyflow: null,
|
|
1144
|
-
xystore: null,
|
|
1145
|
-
xyedges: [],
|
|
1146
|
-
xynodes: [],
|
|
1147
|
-
initialized: {
|
|
1148
|
-
xydata: false,
|
|
1149
|
-
xyflow: false
|
|
1150
|
-
},
|
|
1151
|
-
syncLayoutActorRef: null
|
|
1152
|
-
})
|
|
1153
|
-
]
|
|
1154
|
-
});
|
|
1155
|
-
function nodeRef(node) {
|
|
1156
|
-
switch (node.type) {
|
|
1157
|
-
case "element":
|
|
1158
|
-
case "compound-element":
|
|
1159
|
-
case "seq-actor":
|
|
1160
|
-
return node.data.modelFqn;
|
|
1161
|
-
case "deployment":
|
|
1162
|
-
case "compound-deployment":
|
|
1163
|
-
return node.data.modelFqn ?? node.data.deploymentFqn;
|
|
1164
|
-
case "seq-parallel":
|
|
1165
|
-
case "view-group":
|
|
1166
|
-
return null;
|
|
1167
|
-
default:
|
|
1168
|
-
nonexhaustive(node);
|
|
1169
|
-
}
|
|
1170
|
-
}
|
|
1171
|
-
function findCorrespondingNode(context, event) {
|
|
1172
|
-
const fromNodeId = context.lastOnNavigate?.fromNode;
|
|
1173
|
-
const fromNode = fromNodeId && context.xynodes.find((n) => n.id === fromNodeId);
|
|
1174
|
-
const fromRef = fromNode && nodeRef(fromNode);
|
|
1175
|
-
const toNode = fromRef && event.xynodes.find((n) => nodeRef(n) === fromRef);
|
|
1176
|
-
return { fromNode, toNode };
|
|
1177
|
-
}
|
|
1178
|
-
const diagramMachine = _diagramMachine;
|
|
1179
|
-
|
|
1180
|
-
export { diagramMachine };
|