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