@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
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { applyEdgeChanges, applyNodeChanges } from '@xyflow/react';
|
|
2
|
+
import { DefaultFeatures } from '../../context/DiagramFeatures.js';
|
|
3
|
+
import { updateNavigationHistory, updateEdgeData, updateNodeData } from './assign.js';
|
|
4
|
+
import { stopSyncLayout, cancelFitDiagram, emitOnLayoutTypeChange, emitOnChange, assignDynamicViewVariant, updateFeatures, ensureOverlaysActorState, ensureSearchActorState, updateInputs, updateView, xyflow, resetLastClickedNode, emitEdgeClick, assignLastClickedNode, emitNodeClick, emitPaneClick } from './machine.actions.js';
|
|
5
|
+
import { machine } from './machine.setup.js';
|
|
6
|
+
import { isReady, initializing } from './machine.state.initializing.js';
|
|
7
|
+
import { navigating } from './machine.state.navigating.js';
|
|
8
|
+
import { ready } from './machine.state.ready.js';
|
|
9
|
+
import { DiagramToggledFeaturesPersistence } from './persistence.js';
|
|
10
|
+
import { x as xstateActions_cjsExports } from '../../_virtual/xstate-actions.cjs.js';
|
|
11
|
+
|
|
12
|
+
const _diagramMachine = machine.createMachine({
|
|
13
|
+
initial: "initializing",
|
|
14
|
+
context: ({ input }) => ({
|
|
15
|
+
...input,
|
|
16
|
+
xyedges: [],
|
|
17
|
+
xynodes: [],
|
|
18
|
+
features: { ...DefaultFeatures },
|
|
19
|
+
toggledFeatures: DiagramToggledFeaturesPersistence.read() ?? {
|
|
20
|
+
enableReadOnly: true,
|
|
21
|
+
enableCompareWithLatest: false
|
|
22
|
+
},
|
|
23
|
+
initialized: {
|
|
24
|
+
xydata: false,
|
|
25
|
+
xyflow: false
|
|
26
|
+
},
|
|
27
|
+
viewportChangedManually: false,
|
|
28
|
+
lastOnNavigate: null,
|
|
29
|
+
lastClickedNode: null,
|
|
30
|
+
focusedNode: null,
|
|
31
|
+
activeElementDetails: null,
|
|
32
|
+
viewportBeforeFocus: null,
|
|
33
|
+
viewportOnManualLayout: null,
|
|
34
|
+
viewportOnAutoLayout: null,
|
|
35
|
+
navigationHistory: {
|
|
36
|
+
currentIndex: 0,
|
|
37
|
+
history: []
|
|
38
|
+
},
|
|
39
|
+
viewport: { x: 0, y: 0, zoom: 1 },
|
|
40
|
+
xyflow: null,
|
|
41
|
+
dynamicViewVariant: input.dynamicViewVariant ?? (input.view._type === "dynamic" ? input.view.variant : "diagram") ?? "diagram",
|
|
42
|
+
activeWalkthrough: null
|
|
43
|
+
}),
|
|
44
|
+
states: {
|
|
45
|
+
initializing,
|
|
46
|
+
isReady,
|
|
47
|
+
ready,
|
|
48
|
+
navigating
|
|
49
|
+
},
|
|
50
|
+
on: {
|
|
51
|
+
"xyflow.paneClick": {
|
|
52
|
+
actions: [
|
|
53
|
+
resetLastClickedNode(),
|
|
54
|
+
emitPaneClick()
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
"xyflow.nodeClick": {
|
|
58
|
+
actions: [
|
|
59
|
+
assignLastClickedNode(),
|
|
60
|
+
emitNodeClick()
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
"xyflow.edgeClick": {
|
|
64
|
+
actions: [
|
|
65
|
+
resetLastClickedNode(),
|
|
66
|
+
emitEdgeClick()
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
"xyflow.applyNodeChanges": {
|
|
70
|
+
actions: xstateActions_cjsExports.assign({
|
|
71
|
+
xynodes: ({ context, event }) => applyNodeChanges(event.changes, context.xynodes)
|
|
72
|
+
})
|
|
73
|
+
},
|
|
74
|
+
"xyflow.applyEdgeChanges": {
|
|
75
|
+
actions: xstateActions_cjsExports.assign({
|
|
76
|
+
xyedges: ({ context, event }) => applyEdgeChanges(event.changes, context.xyedges)
|
|
77
|
+
})
|
|
78
|
+
},
|
|
79
|
+
"xyflow.viewportMoved": {
|
|
80
|
+
actions: xstateActions_cjsExports.assign({
|
|
81
|
+
viewportChangedManually: (({ event }) => event.manually),
|
|
82
|
+
viewport: (({ event }) => event.viewport)
|
|
83
|
+
})
|
|
84
|
+
},
|
|
85
|
+
"fitDiagram": {
|
|
86
|
+
guard: "enabled: FitView",
|
|
87
|
+
actions: xyflow.fitDiagram()
|
|
88
|
+
},
|
|
89
|
+
"update.nodeData": {
|
|
90
|
+
actions: xstateActions_cjsExports.assign(updateNodeData)
|
|
91
|
+
},
|
|
92
|
+
"update.edgeData": {
|
|
93
|
+
actions: xstateActions_cjsExports.assign(updateEdgeData)
|
|
94
|
+
},
|
|
95
|
+
"update.view": {
|
|
96
|
+
actions: [
|
|
97
|
+
xstateActions_cjsExports.assign(updateNavigationHistory),
|
|
98
|
+
updateView()
|
|
99
|
+
]
|
|
100
|
+
},
|
|
101
|
+
"update.inputs": {
|
|
102
|
+
actions: updateInputs()
|
|
103
|
+
},
|
|
104
|
+
"update.features": {
|
|
105
|
+
actions: [
|
|
106
|
+
updateFeatures(),
|
|
107
|
+
ensureOverlaysActorState(),
|
|
108
|
+
ensureSearchActorState()
|
|
109
|
+
]
|
|
110
|
+
},
|
|
111
|
+
"switch.dynamicViewVariant": {
|
|
112
|
+
actions: assignDynamicViewVariant()
|
|
113
|
+
},
|
|
114
|
+
"emit.onChange": {
|
|
115
|
+
actions: emitOnChange()
|
|
116
|
+
},
|
|
117
|
+
"emit.onLayoutTypeChange": {
|
|
118
|
+
actions: emitOnLayoutTypeChange()
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
exit: [
|
|
122
|
+
stopSyncLayout(),
|
|
123
|
+
cancelFitDiagram(),
|
|
124
|
+
xstateActions_cjsExports.stopChild("hotkey"),
|
|
125
|
+
xstateActions_cjsExports.stopChild("overlays"),
|
|
126
|
+
xstateActions_cjsExports.stopChild("search"),
|
|
127
|
+
xstateActions_cjsExports.assign({
|
|
128
|
+
xyflow: null,
|
|
129
|
+
xystore: null,
|
|
130
|
+
xyedges: [],
|
|
131
|
+
xynodes: [],
|
|
132
|
+
initialized: {
|
|
133
|
+
xydata: false,
|
|
134
|
+
xyflow: false
|
|
135
|
+
}
|
|
136
|
+
})
|
|
137
|
+
]
|
|
138
|
+
});
|
|
139
|
+
const diagramMachine = _diagramMachine;
|
|
140
|
+
|
|
141
|
+
export { diagramMachine };
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import { BBox } from '@likec4/core';
|
|
2
|
+
import { DiagramEdge, DiagramNode, DiagramView, DynamicViewDisplayVariant, EdgeId, Fqn, LayoutType, NodeId, NodeNotation as ElementNotation, StepEdgeId, ViewChange, ViewId } from '@likec4/core/types';
|
|
3
|
+
import { EdgeChange, NodeChange, Rect, Viewport } from '@xyflow/system';
|
|
4
|
+
import { MouseEvent } from 'react';
|
|
5
|
+
import { PartialDeep } from 'type-fest';
|
|
6
|
+
import { EnabledFeatures, FeatureName } from '../../context/DiagramFeatures';
|
|
7
|
+
import { XYFlowInstance, XYStoreApi } from '../../hooks/useXYFlow';
|
|
8
|
+
import { OpenSourceParams, ViewPadding } from '../../LikeC4Diagram.props';
|
|
9
|
+
import { Types } from '../types';
|
|
10
|
+
import { AlignmentMode } from './aligners';
|
|
11
|
+
import { HotKeyEvent, HotkeyActorLogic } from './hotkeyActor';
|
|
12
|
+
import { SetupReturn, NonReducibleUnknown, MetaObject } from 'xstate';
|
|
13
|
+
import { SyncLayoutActorLogic } from './syncManualLayoutActor';
|
|
14
|
+
import { OverlaysActorLogic } from '../../overlays/overlaysActor';
|
|
15
|
+
import { SearchActorLogic } from '../../search/searchActor';
|
|
16
|
+
export interface NavigationHistory {
|
|
17
|
+
history: ReadonlyArray<{
|
|
18
|
+
viewId: ViewId;
|
|
19
|
+
fromNode: NodeId | null;
|
|
20
|
+
viewport: Viewport;
|
|
21
|
+
}>;
|
|
22
|
+
currentIndex: number;
|
|
23
|
+
}
|
|
24
|
+
export interface Input {
|
|
25
|
+
view: DiagramView;
|
|
26
|
+
xystore: XYStoreApi;
|
|
27
|
+
zoomable: boolean;
|
|
28
|
+
pannable: boolean;
|
|
29
|
+
nodesDraggable: boolean;
|
|
30
|
+
nodesSelectable: boolean;
|
|
31
|
+
fitViewPadding: ViewPadding;
|
|
32
|
+
dynamicViewVariant?: DynamicViewDisplayVariant | undefined;
|
|
33
|
+
}
|
|
34
|
+
export type ToggledFeatures = Partial<EnabledFeatures>;
|
|
35
|
+
export interface Context extends Input {
|
|
36
|
+
xynodes: Types.Node[];
|
|
37
|
+
xyedges: Types.Edge[];
|
|
38
|
+
features: EnabledFeatures;
|
|
39
|
+
toggledFeatures: ToggledFeatures;
|
|
40
|
+
initialized: {
|
|
41
|
+
xydata: boolean;
|
|
42
|
+
xyflow: boolean;
|
|
43
|
+
};
|
|
44
|
+
viewport: Viewport;
|
|
45
|
+
viewportChangedManually: boolean;
|
|
46
|
+
lastOnNavigate: null | {
|
|
47
|
+
fromView: ViewId;
|
|
48
|
+
toView: ViewId;
|
|
49
|
+
fromNode: NodeId | null;
|
|
50
|
+
};
|
|
51
|
+
navigationHistory: NavigationHistory;
|
|
52
|
+
lastClickedNode: null | {
|
|
53
|
+
id: NodeId;
|
|
54
|
+
clicks: number;
|
|
55
|
+
timestamp: number;
|
|
56
|
+
};
|
|
57
|
+
focusedNode: NodeId | null;
|
|
58
|
+
activeElementDetails: null | {
|
|
59
|
+
fqn: Fqn;
|
|
60
|
+
fromNode: NodeId | null;
|
|
61
|
+
nodeRect?: Rect | null;
|
|
62
|
+
nodeRectScreen?: Rect | null;
|
|
63
|
+
};
|
|
64
|
+
viewportBeforeFocus: null | Viewport;
|
|
65
|
+
viewportOnManualLayout: null | Viewport;
|
|
66
|
+
viewportOnAutoLayout: null | Viewport;
|
|
67
|
+
xyflow: XYFlowInstance | null;
|
|
68
|
+
dynamicViewVariant: DynamicViewDisplayVariant;
|
|
69
|
+
activeWalkthrough: null | {
|
|
70
|
+
stepId: StepEdgeId;
|
|
71
|
+
parallelPrefix: string | null;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
export type Events = HotKeyEvent | {
|
|
75
|
+
type: 'xyflow.init';
|
|
76
|
+
instance: XYFlowInstance;
|
|
77
|
+
} | {
|
|
78
|
+
type: 'xyflow.applyNodeChanges';
|
|
79
|
+
changes: NodeChange<Types.Node>[];
|
|
80
|
+
} | {
|
|
81
|
+
type: 'xyflow.applyEdgeChanges';
|
|
82
|
+
changes: EdgeChange<Types.Edge>[];
|
|
83
|
+
} | {
|
|
84
|
+
type: 'xyflow.viewportMoved';
|
|
85
|
+
viewport: Viewport;
|
|
86
|
+
manually: boolean;
|
|
87
|
+
} | {
|
|
88
|
+
type: 'xyflow.nodeClick';
|
|
89
|
+
node: Types.Node;
|
|
90
|
+
} | {
|
|
91
|
+
type: 'xyflow.edgeClick';
|
|
92
|
+
edge: Types.Edge;
|
|
93
|
+
} | {
|
|
94
|
+
type: 'xyflow.edgeDoubleClick';
|
|
95
|
+
edge: Types.Edge;
|
|
96
|
+
} | {
|
|
97
|
+
type: 'xyflow.paneClick';
|
|
98
|
+
} | {
|
|
99
|
+
type: 'xyflow.paneDblClick';
|
|
100
|
+
} | {
|
|
101
|
+
type: 'xyflow.resized';
|
|
102
|
+
} | {
|
|
103
|
+
type: 'xyflow.nodeMouseEnter';
|
|
104
|
+
node: Types.Node;
|
|
105
|
+
} | {
|
|
106
|
+
type: 'xyflow.nodeMouseLeave';
|
|
107
|
+
node: Types.Node;
|
|
108
|
+
} | {
|
|
109
|
+
type: 'xyflow.edgeMouseEnter';
|
|
110
|
+
edge: Types.Edge;
|
|
111
|
+
event: MouseEvent;
|
|
112
|
+
} | {
|
|
113
|
+
type: 'xyflow.edgeMouseLeave';
|
|
114
|
+
edge: Types.Edge;
|
|
115
|
+
event: MouseEvent;
|
|
116
|
+
} | {
|
|
117
|
+
type: 'update.nodeData';
|
|
118
|
+
nodeId: NodeId;
|
|
119
|
+
data: PartialDeep<Types.NodeData>;
|
|
120
|
+
} | {
|
|
121
|
+
type: 'update.edgeData';
|
|
122
|
+
edgeId: EdgeId;
|
|
123
|
+
data: PartialDeep<Types.EdgeData>;
|
|
124
|
+
} | {
|
|
125
|
+
type: 'update.view';
|
|
126
|
+
view: DiagramView;
|
|
127
|
+
xynodes: Types.Node[];
|
|
128
|
+
xyedges: Types.Edge[];
|
|
129
|
+
} | {
|
|
130
|
+
type: 'update.inputs';
|
|
131
|
+
inputs: Partial<Omit<Input, 'view' | 'xystore' | 'dynamicViewVariant'>>;
|
|
132
|
+
} | {
|
|
133
|
+
type: 'update.features';
|
|
134
|
+
features: EnabledFeatures;
|
|
135
|
+
} | {
|
|
136
|
+
type: 'fitDiagram';
|
|
137
|
+
duration?: number;
|
|
138
|
+
bounds?: BBox;
|
|
139
|
+
} | ({
|
|
140
|
+
type: 'open.source';
|
|
141
|
+
} & OpenSourceParams) | {
|
|
142
|
+
type: 'open.elementDetails';
|
|
143
|
+
fqn: Fqn;
|
|
144
|
+
fromNode?: NodeId | undefined;
|
|
145
|
+
} | {
|
|
146
|
+
type: 'open.relationshipDetails';
|
|
147
|
+
params: {
|
|
148
|
+
edgeId: EdgeId;
|
|
149
|
+
} | {
|
|
150
|
+
source: Fqn;
|
|
151
|
+
target: Fqn;
|
|
152
|
+
};
|
|
153
|
+
} | {
|
|
154
|
+
type: 'open.relationshipsBrowser';
|
|
155
|
+
fqn: Fqn;
|
|
156
|
+
} | {
|
|
157
|
+
type: 'open.search';
|
|
158
|
+
search?: string;
|
|
159
|
+
} | {
|
|
160
|
+
type: 'navigate.to';
|
|
161
|
+
viewId: ViewId;
|
|
162
|
+
fromNode?: NodeId | undefined;
|
|
163
|
+
} | {
|
|
164
|
+
type: 'navigate.back';
|
|
165
|
+
} | {
|
|
166
|
+
type: 'navigate.forward';
|
|
167
|
+
} | {
|
|
168
|
+
type: 'layout.align';
|
|
169
|
+
mode: AlignmentMode;
|
|
170
|
+
} | {
|
|
171
|
+
type: 'layout.resetEdgeControlPoints';
|
|
172
|
+
} | {
|
|
173
|
+
type: 'layout.resetManualLayout';
|
|
174
|
+
} | {
|
|
175
|
+
type: 'focus.node';
|
|
176
|
+
nodeId: NodeId;
|
|
177
|
+
} | {
|
|
178
|
+
type: 'switch.dynamicViewVariant';
|
|
179
|
+
variant: DynamicViewDisplayVariant;
|
|
180
|
+
} | {
|
|
181
|
+
type: 'walkthrough.start';
|
|
182
|
+
stepId?: StepEdgeId;
|
|
183
|
+
} | {
|
|
184
|
+
type: 'walkthrough.step';
|
|
185
|
+
direction: 'next' | 'previous';
|
|
186
|
+
} | {
|
|
187
|
+
type: 'walkthrough.end';
|
|
188
|
+
} | {
|
|
189
|
+
type: 'notations.highlight';
|
|
190
|
+
notation: ElementNotation;
|
|
191
|
+
kind?: string;
|
|
192
|
+
} | {
|
|
193
|
+
type: 'notations.unhighlight';
|
|
194
|
+
} | {
|
|
195
|
+
type: 'tag.highlight';
|
|
196
|
+
tag: string;
|
|
197
|
+
} | {
|
|
198
|
+
type: 'tag.unhighlight';
|
|
199
|
+
} | {
|
|
200
|
+
type: 'toggle.feature';
|
|
201
|
+
feature: FeatureName;
|
|
202
|
+
forceValue?: boolean;
|
|
203
|
+
} | {
|
|
204
|
+
type: 'emit.onChange';
|
|
205
|
+
change: ViewChange;
|
|
206
|
+
} | {
|
|
207
|
+
type: 'emit.onLayoutTypeChange';
|
|
208
|
+
layoutType: LayoutType;
|
|
209
|
+
};
|
|
210
|
+
export type EmittedEvents = {
|
|
211
|
+
type: 'initialized';
|
|
212
|
+
instance: XYFlowInstance;
|
|
213
|
+
} | {
|
|
214
|
+
type: 'navigateTo';
|
|
215
|
+
viewId: ViewId;
|
|
216
|
+
} | {
|
|
217
|
+
type: 'openSource';
|
|
218
|
+
params: OpenSourceParams;
|
|
219
|
+
} | {
|
|
220
|
+
type: 'paneClick';
|
|
221
|
+
} | {
|
|
222
|
+
type: 'nodeClick';
|
|
223
|
+
node: DiagramNode;
|
|
224
|
+
xynode: Types.Node;
|
|
225
|
+
} | {
|
|
226
|
+
type: 'edgeClick';
|
|
227
|
+
edge: DiagramEdge;
|
|
228
|
+
xyedge: Types.Edge;
|
|
229
|
+
} | {
|
|
230
|
+
type: 'edgeMouseEnter';
|
|
231
|
+
edge: Types.Edge;
|
|
232
|
+
event: MouseEvent;
|
|
233
|
+
} | {
|
|
234
|
+
type: 'edgeMouseLeave';
|
|
235
|
+
edge: Types.Edge;
|
|
236
|
+
event: MouseEvent;
|
|
237
|
+
} | {
|
|
238
|
+
type: 'walkthroughStarted';
|
|
239
|
+
edge: Types.Edge;
|
|
240
|
+
} | {
|
|
241
|
+
type: 'walkthroughStep';
|
|
242
|
+
edge: Types.Edge;
|
|
243
|
+
} | {
|
|
244
|
+
type: 'walkthroughStopped';
|
|
245
|
+
} | {
|
|
246
|
+
type: 'onChange';
|
|
247
|
+
change: ViewChange;
|
|
248
|
+
} | {
|
|
249
|
+
type: 'onLayoutTypeChange';
|
|
250
|
+
layoutType: LayoutType;
|
|
251
|
+
};
|
|
252
|
+
export type ActionArg = {
|
|
253
|
+
context: Context;
|
|
254
|
+
event: Events;
|
|
255
|
+
};
|
|
256
|
+
export declare const machine: SetupReturn<Context, Events, {
|
|
257
|
+
syncManualLayoutActorLogic: SyncLayoutActorLogic;
|
|
258
|
+
hotkeyActorLogic: HotkeyActorLogic;
|
|
259
|
+
overlaysActorLogic: OverlaysActorLogic;
|
|
260
|
+
searchActorLogic: SearchActorLogic;
|
|
261
|
+
}, {
|
|
262
|
+
syncLayout: "syncManualLayoutActorLogic";
|
|
263
|
+
hotkey: "hotkeyActorLogic";
|
|
264
|
+
overlays: "overlaysActorLogic";
|
|
265
|
+
search: "searchActorLogic";
|
|
266
|
+
}, {}, {
|
|
267
|
+
isReady: unknown;
|
|
268
|
+
'enabled: FitView': unknown;
|
|
269
|
+
'enabled: FocusMode': unknown;
|
|
270
|
+
'enabled: Readonly': unknown;
|
|
271
|
+
'enabled: RelationshipDetails': unknown;
|
|
272
|
+
'enabled: Search': unknown;
|
|
273
|
+
'enabled: ElementDetails': unknown;
|
|
274
|
+
'enabled: DynamicViewWalkthrough': unknown;
|
|
275
|
+
'not readonly': unknown;
|
|
276
|
+
'is dynamic view': unknown;
|
|
277
|
+
'is another view': unknown;
|
|
278
|
+
'click: node has modelFqn': unknown;
|
|
279
|
+
'click: selected node': unknown;
|
|
280
|
+
'click: same node': unknown;
|
|
281
|
+
'click: focused node': unknown;
|
|
282
|
+
'click: node has connections': unknown;
|
|
283
|
+
'click: selected edge': unknown;
|
|
284
|
+
}, never, string, Input, NonReducibleUnknown, EmittedEvents, MetaObject>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { nonexhaustive } from '@likec4/core';
|
|
2
|
+
import { setup, assertEvent } from 'xstate';
|
|
3
|
+
import { overlaysActorLogic } from '../../overlays/overlaysActor.js';
|
|
4
|
+
import { searchActorLogic } from '../../search/searchActor.js';
|
|
5
|
+
import { hotkeyActorLogic } from './hotkeyActor.js';
|
|
6
|
+
import { syncManualLayoutActorLogic } from './syncManualLayoutActor.js';
|
|
7
|
+
|
|
8
|
+
const isReadOnly = (context) => (context.features.enableReadOnly || context.toggledFeatures.enableReadOnly === true) && (context.view._type !== "dynamic" || context.dynamicViewVariant !== "sequence");
|
|
9
|
+
const machine = setup({
|
|
10
|
+
types: {
|
|
11
|
+
context: {},
|
|
12
|
+
input: {},
|
|
13
|
+
children: {},
|
|
14
|
+
events: {},
|
|
15
|
+
emitted: {}
|
|
16
|
+
},
|
|
17
|
+
actors: {
|
|
18
|
+
syncManualLayoutActorLogic,
|
|
19
|
+
hotkeyActorLogic,
|
|
20
|
+
overlaysActorLogic,
|
|
21
|
+
searchActorLogic
|
|
22
|
+
},
|
|
23
|
+
guards: {
|
|
24
|
+
"isReady": ({ context }) => context.initialized.xydata && context.initialized.xyflow,
|
|
25
|
+
"enabled: FitView": ({ context }) => context.features.enableFitView,
|
|
26
|
+
"enabled: FocusMode": ({ context }) => (context.toggledFeatures.enableFocusMode ?? context.features.enableFocusMode) === true && isReadOnly(context),
|
|
27
|
+
"enabled: Readonly": ({ context }) => isReadOnly(context),
|
|
28
|
+
"enabled: RelationshipDetails": ({ context }) => context.features.enableRelationshipDetails,
|
|
29
|
+
"enabled: Search": ({ context }) => context.features.enableSearch,
|
|
30
|
+
"enabled: ElementDetails": ({ context }) => context.features.enableElementDetails,
|
|
31
|
+
"enabled: DynamicViewWalkthrough": ({ context }) => isReadOnly(context) && context.features.enableDynamicViewWalkthrough,
|
|
32
|
+
"not readonly": ({ context }) => !isReadOnly(context),
|
|
33
|
+
"is dynamic view": ({ context }) => context.view._type === "dynamic",
|
|
34
|
+
"is another view": ({ context, event }) => {
|
|
35
|
+
assertEvent(event, ["update.view", "navigate.to"]);
|
|
36
|
+
if (event.type === "update.view") {
|
|
37
|
+
return context.view.id !== event.view.id;
|
|
38
|
+
}
|
|
39
|
+
if (event.type === "navigate.to") {
|
|
40
|
+
return context.view.id !== event.viewId;
|
|
41
|
+
}
|
|
42
|
+
nonexhaustive(event.type);
|
|
43
|
+
},
|
|
44
|
+
"click: node has modelFqn": ({ event }) => {
|
|
45
|
+
assertEvent(event, "xyflow.nodeClick");
|
|
46
|
+
return "modelFqn" in event.node.data;
|
|
47
|
+
},
|
|
48
|
+
"click: selected node": ({ event }) => {
|
|
49
|
+
assertEvent(event, "xyflow.nodeClick");
|
|
50
|
+
return event.node.selected === true;
|
|
51
|
+
},
|
|
52
|
+
"click: same node": ({ context, event }) => {
|
|
53
|
+
assertEvent(event, "xyflow.nodeClick");
|
|
54
|
+
return context.lastClickedNode?.id === event.node.id;
|
|
55
|
+
},
|
|
56
|
+
"click: focused node": ({ context, event }) => {
|
|
57
|
+
assertEvent(event, "xyflow.nodeClick");
|
|
58
|
+
return context.focusedNode === event.node.id;
|
|
59
|
+
},
|
|
60
|
+
"click: node has connections": ({ context, event }) => {
|
|
61
|
+
assertEvent(event, "xyflow.nodeClick");
|
|
62
|
+
return context.xyedges.some((e) => e.source === event.node.id || e.target === event.node.id);
|
|
63
|
+
},
|
|
64
|
+
"click: selected edge": ({ event }) => {
|
|
65
|
+
assertEvent(event, ["xyflow.edgeClick", "xyflow.edgeDoubleClick"]);
|
|
66
|
+
return event.edge.selected === true || event.edge.data.active === true;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
export { machine };
|
|
@@ -0,0 +1,183 @@
|
|
|
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 { DiagramView } from '@likec4/core';
|
|
9
|
+
/**
|
|
10
|
+
* To be in `initializing` state, the diagram must wait for two events:
|
|
11
|
+
* - `xyflow.init` - indicates that the `xyflow` instance is ready
|
|
12
|
+
* - `update.view` - provides the initial diagram data (nodes and edges)
|
|
13
|
+
*
|
|
14
|
+
* Once both events have been received, the diagram transitions to `isReady` state.
|
|
15
|
+
*/
|
|
16
|
+
export declare const initializing: {
|
|
17
|
+
on: {
|
|
18
|
+
'xyflow.init': {
|
|
19
|
+
actions: ActionFunction<Context, {
|
|
20
|
+
type: "xyflow.init";
|
|
21
|
+
instance: XYFlowInstance;
|
|
22
|
+
}, Events, undefined, Values<{
|
|
23
|
+
syncManualLayoutActorLogic: {
|
|
24
|
+
src: "syncManualLayoutActorLogic";
|
|
25
|
+
logic: SyncLayoutActorLogic;
|
|
26
|
+
id: "syncLayout";
|
|
27
|
+
};
|
|
28
|
+
hotkeyActorLogic: {
|
|
29
|
+
src: "hotkeyActorLogic";
|
|
30
|
+
logic: HotkeyActorLogic;
|
|
31
|
+
id: "hotkey";
|
|
32
|
+
};
|
|
33
|
+
overlaysActorLogic: {
|
|
34
|
+
src: "overlaysActorLogic";
|
|
35
|
+
logic: OverlaysActorLogic;
|
|
36
|
+
id: "overlays";
|
|
37
|
+
};
|
|
38
|
+
searchActorLogic: {
|
|
39
|
+
src: "searchActorLogic";
|
|
40
|
+
logic: SearchActorLogic;
|
|
41
|
+
id: "search";
|
|
42
|
+
};
|
|
43
|
+
}>, never, never, never, never>;
|
|
44
|
+
target: string;
|
|
45
|
+
};
|
|
46
|
+
'update.view': {
|
|
47
|
+
actions: ActionFunction<Context, {
|
|
48
|
+
type: "update.view";
|
|
49
|
+
view: DiagramView;
|
|
50
|
+
xynodes: import("../types").Types.Node[];
|
|
51
|
+
xyedges: import("../types").Types.Edge[];
|
|
52
|
+
}, Events, undefined, Values<{
|
|
53
|
+
syncManualLayoutActorLogic: {
|
|
54
|
+
src: "syncManualLayoutActorLogic";
|
|
55
|
+
logic: SyncLayoutActorLogic;
|
|
56
|
+
id: "syncLayout";
|
|
57
|
+
};
|
|
58
|
+
hotkeyActorLogic: {
|
|
59
|
+
src: "hotkeyActorLogic";
|
|
60
|
+
logic: HotkeyActorLogic;
|
|
61
|
+
id: "hotkey";
|
|
62
|
+
};
|
|
63
|
+
overlaysActorLogic: {
|
|
64
|
+
src: "overlaysActorLogic";
|
|
65
|
+
logic: OverlaysActorLogic;
|
|
66
|
+
id: "overlays";
|
|
67
|
+
};
|
|
68
|
+
searchActorLogic: {
|
|
69
|
+
src: "searchActorLogic";
|
|
70
|
+
logic: SearchActorLogic;
|
|
71
|
+
id: "search";
|
|
72
|
+
};
|
|
73
|
+
}>, never, never, never, never>;
|
|
74
|
+
target: string;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* State that checks whether the diagram is ready to be used.
|
|
80
|
+
* Transitions to `ready` state if both `xyflow` and `xydata` are initialized,
|
|
81
|
+
* otherwise goes back to `initializing` state.`
|
|
82
|
+
*/
|
|
83
|
+
export declare const isReady: {
|
|
84
|
+
always: ({
|
|
85
|
+
guard: "isReady";
|
|
86
|
+
actions: ActionFunction<Context, Events, Events, undefined, Values<{
|
|
87
|
+
syncManualLayoutActorLogic: {
|
|
88
|
+
src: "syncManualLayoutActorLogic";
|
|
89
|
+
logic: SyncLayoutActorLogic;
|
|
90
|
+
id: "syncLayout";
|
|
91
|
+
};
|
|
92
|
+
hotkeyActorLogic: {
|
|
93
|
+
src: "hotkeyActorLogic";
|
|
94
|
+
logic: HotkeyActorLogic;
|
|
95
|
+
id: "hotkey";
|
|
96
|
+
};
|
|
97
|
+
overlaysActorLogic: {
|
|
98
|
+
src: "overlaysActorLogic";
|
|
99
|
+
logic: OverlaysActorLogic;
|
|
100
|
+
id: "overlays";
|
|
101
|
+
};
|
|
102
|
+
searchActorLogic: {
|
|
103
|
+
src: "searchActorLogic";
|
|
104
|
+
logic: SearchActorLogic;
|
|
105
|
+
id: "search";
|
|
106
|
+
};
|
|
107
|
+
}>, never, Values<{
|
|
108
|
+
isReady: {
|
|
109
|
+
type: "isReady";
|
|
110
|
+
params: unknown;
|
|
111
|
+
};
|
|
112
|
+
"enabled: FitView": {
|
|
113
|
+
type: "enabled: FitView";
|
|
114
|
+
params: unknown;
|
|
115
|
+
};
|
|
116
|
+
"enabled: FocusMode": {
|
|
117
|
+
type: "enabled: FocusMode";
|
|
118
|
+
params: unknown;
|
|
119
|
+
};
|
|
120
|
+
"enabled: Readonly": {
|
|
121
|
+
type: "enabled: Readonly";
|
|
122
|
+
params: unknown;
|
|
123
|
+
};
|
|
124
|
+
"enabled: RelationshipDetails": {
|
|
125
|
+
type: "enabled: RelationshipDetails";
|
|
126
|
+
params: unknown;
|
|
127
|
+
};
|
|
128
|
+
"enabled: Search": {
|
|
129
|
+
type: "enabled: Search";
|
|
130
|
+
params: unknown;
|
|
131
|
+
};
|
|
132
|
+
"enabled: ElementDetails": {
|
|
133
|
+
type: "enabled: ElementDetails";
|
|
134
|
+
params: unknown;
|
|
135
|
+
};
|
|
136
|
+
"enabled: DynamicViewWalkthrough": {
|
|
137
|
+
type: "enabled: DynamicViewWalkthrough";
|
|
138
|
+
params: unknown;
|
|
139
|
+
};
|
|
140
|
+
"not readonly": {
|
|
141
|
+
type: "not readonly";
|
|
142
|
+
params: unknown;
|
|
143
|
+
};
|
|
144
|
+
"is dynamic view": {
|
|
145
|
+
type: "is dynamic view";
|
|
146
|
+
params: unknown;
|
|
147
|
+
};
|
|
148
|
+
"is another view": {
|
|
149
|
+
type: "is another view";
|
|
150
|
+
params: unknown;
|
|
151
|
+
};
|
|
152
|
+
"click: node has modelFqn": {
|
|
153
|
+
type: "click: node has modelFqn";
|
|
154
|
+
params: unknown;
|
|
155
|
+
};
|
|
156
|
+
"click: selected node": {
|
|
157
|
+
type: "click: selected node";
|
|
158
|
+
params: unknown;
|
|
159
|
+
};
|
|
160
|
+
"click: same node": {
|
|
161
|
+
type: "click: same node";
|
|
162
|
+
params: unknown;
|
|
163
|
+
};
|
|
164
|
+
"click: focused node": {
|
|
165
|
+
type: "click: focused node";
|
|
166
|
+
params: unknown;
|
|
167
|
+
};
|
|
168
|
+
"click: node has connections": {
|
|
169
|
+
type: "click: node has connections";
|
|
170
|
+
params: unknown;
|
|
171
|
+
};
|
|
172
|
+
"click: selected edge": {
|
|
173
|
+
type: "click: selected edge";
|
|
174
|
+
params: unknown;
|
|
175
|
+
};
|
|
176
|
+
}>, never, EmittedEvents>[];
|
|
177
|
+
target: string;
|
|
178
|
+
} | {
|
|
179
|
+
target: string;
|
|
180
|
+
guard?: never;
|
|
181
|
+
actions?: never;
|
|
182
|
+
})[];
|
|
183
|
+
};
|