@likec4/diagram 1.47.0 → 1.49.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/LICENSE +1 -1
- package/README.md +8 -10
- package/adhoc-editor/package.json +4 -0
- package/dist/LikeC4Diagram.d.ts +2 -1
- package/dist/LikeC4Diagram.js +85 -81
- package/dist/LikeC4Diagram.props.d.ts +10 -6
- package/dist/LikeC4ModelProvider.d.ts +4 -4
- package/dist/LikeC4ModelProvider.js +2 -2
- package/dist/LikeC4ProjectsOverview.d.ts +3 -2
- package/dist/LikeC4ProjectsProvider.d.ts +2 -1
- package/dist/LikeC4ProjectsProvider.js +10 -8
- package/dist/LikeC4Styles.d.ts +3 -6
- package/dist/LikeC4Styles.js +44 -43
- package/dist/LikeC4View.d.ts +22 -1
- package/dist/LikeC4View.js +40 -25
- package/dist/ReactLikeC4.d.ts +13 -2
- package/dist/ReactLikeC4.js +8 -4
- package/dist/StaticLikeC4Diagram.d.ts +2 -1
- package/dist/StaticLikeC4Diagram.js +1 -0
- package/dist/_virtual/store-1b2fbb72.cjs.js +3 -0
- package/dist/_virtual/xstate-store-react.cjs.js +5 -0
- package/dist/_virtual/xstate-store-react.cjs2.js +3 -0
- package/dist/adhoc-editor/EditorPanel.d.ts +1 -0
- package/dist/adhoc-editor/EditorPanel.js +105 -0
- package/dist/adhoc-editor/ElementsTree.d.ts +2 -0
- package/dist/adhoc-editor/ElementsTree.js +142 -0
- package/dist/adhoc-editor/LikeC4AdHocViewEditor.d.ts +4 -0
- package/dist/adhoc-editor/LikeC4AdHocViewEditor.js +74 -0
- package/dist/adhoc-editor/components/Tree.d.ts +48 -0
- package/dist/adhoc-editor/components/Tree.js +296 -0
- package/dist/adhoc-editor/hooks.d.ts +14 -0
- package/dist/adhoc-editor/hooks.js +29 -0
- package/dist/adhoc-editor/index.d.ts +2 -0
- package/dist/adhoc-editor/index.js +1 -0
- package/dist/adhoc-editor/state/ActorProvider.d.ts +5 -0
- package/dist/adhoc-editor/state/ActorProvider.js +40 -0
- package/dist/adhoc-editor/state/actor.d.ts +13 -0
- package/dist/adhoc-editor/state/actor.editor.d.ts +56 -0
- package/dist/adhoc-editor/state/actor.editor.js +205 -0
- package/dist/adhoc-editor/state/actor.js +16 -0
- package/dist/adhoc-editor/state/actor.layouter.d.ts +51 -0
- package/dist/adhoc-editor/state/actor.layouter.js +70 -0
- package/dist/adhoc-editor/state/actor.types.d.ts +63 -0
- package/dist/adhoc-editor/state/actor.types.js +29 -0
- package/dist/adhoc-editor/state/panel.d.ts +95 -0
- package/dist/adhoc-editor/state/panel.js +139 -0
- package/dist/adhoc-editor/state/utils.d.ts +17 -0
- package/dist/adhoc-editor/state/utils.js +32 -0
- package/dist/adhoc-editor/useElementsTree.d.ts +18 -0
- package/dist/adhoc-editor/useElementsTree.js +130 -0
- package/dist/adhoc-editor/viewrules/ViewRulesPanel.d.ts +6 -0
- package/dist/base/const.d.ts +2 -0
- package/dist/base/const.js +2 -1
- package/dist/base/updateEdges.js +26 -3
- package/dist/base/updateNodes.js +8 -5
- package/dist/base-primitives/Markdown.d.ts +1 -1
- package/dist/base-primitives/Markdown.js +1 -1
- package/dist/base-primitives/NodeHandles.d.ts +4 -2
- package/dist/base-primitives/NodeHandles.js +46 -19
- package/dist/base-primitives/compound/CompoundActionButton.js +28 -12
- package/dist/base-primitives/compound/CompoundDetailsButton.js +24 -9
- package/dist/base-primitives/compound/CompoundNodeContainer.js +11 -8
- package/dist/base-primitives/compound/CompoundTitle.js +1 -2
- package/dist/base-primitives/compound/actionbtns.css.d.ts +1 -1
- package/dist/base-primitives/edge/EdgeActionButton.js +1 -1
- package/dist/base-primitives/edge/EdgeContainer.js +5 -2
- package/dist/base-primitives/edge/EdgeLabel.js +3 -4
- package/dist/base-primitives/edge/EdgeLabelContainer.d.ts +2 -1
- package/dist/base-primitives/edge/EdgeLabelContainer.js +17 -20
- package/dist/base-primitives/element/ElementActionButtons.js +57 -59
- package/dist/base-primitives/element/ElementData.d.ts +7 -7
- package/dist/base-primitives/element/ElementData.js +61 -48
- package/dist/base-primitives/element/ElementDetailsButton.js +48 -18
- package/dist/base-primitives/element/ElementNodeContainer.d.ts +5 -5
- package/dist/base-primitives/element/ElementNodeContainer.js +24 -10
- package/dist/base-primitives/element/ElementShape.d.ts +2 -2
- package/dist/base-primitives/element/ElementShape.js +70 -7
- package/dist/base-primitives/element/ElementTags.d.ts +6 -2
- package/dist/base-primitives/element/ElementTags.js +55 -32
- package/dist/base-primitives/index.d.ts +1 -1
- package/dist/base-primitives/memoEdge.js +1 -1
- package/dist/base-primitives/memoNode.js +1 -1
- package/dist/components/ErrorFallback.js +1 -1
- package/dist/components/Link.js +3 -3
- package/dist/components/NavigationPanel.d.ts +2 -2
- package/dist/components/NavigationPanel.js +5 -26
- package/dist/components/PortalToContainer.js +3 -4
- package/dist/components/RootContainer.js +9 -19
- package/dist/components/ViewNotFound.d.ts +3 -3
- package/dist/components/ViewNotFound.js +30 -26
- package/dist/context/CurrentViewModelProvider.d.ts +2 -0
- package/dist/context/CurrentViewModelProvider.js +12 -0
- package/dist/context/DefaultMantineProvider.d.ts +2 -0
- package/dist/context/DefaultMantineProvider.js +75 -0
- package/dist/context/DiagramEventHandlers.d.ts +5 -5
- package/dist/context/DiagramEventHandlers.js +10 -4
- package/dist/context/DiagramFeatures.d.ts +8 -7
- package/dist/context/DiagramFeatures.js +16 -13
- package/dist/context/EnsureMantine.d.ts +0 -3
- package/dist/context/EnsureMantine.js +3 -4
- package/dist/context/FramerMotionConfig.d.ts +1 -3
- package/dist/context/IconRenderer.d.ts +19 -4
- package/dist/context/IconRenderer.js +52 -25
- package/dist/context/LikeC4ModelContext.d.ts +10 -5
- package/dist/context/LikeC4ModelContext.js +11 -3
- package/dist/context/LikeC4ProjectsContext.d.ts +3 -2
- package/dist/context/LikeC4ProjectsContext.js +6 -2
- package/dist/context/RootContainerContext.d.ts +10 -3
- package/dist/context/RootContainerContext.js +8 -3
- package/dist/context/TagStylesContext.js +13 -5
- package/dist/custom/hooks.d.ts +2 -2
- package/dist/custom/index.d.ts +1 -1
- package/dist/custom/index.js +16 -15
- package/dist/editor/LikeC4EditorCallbacks.d.ts +18 -0
- package/dist/editor/LikeC4EditorCallbacks.js +5 -0
- package/dist/editor/LikeC4EditorProvider.d.ts +30 -18
- package/dist/editor/LikeC4EditorProvider.js +3 -3
- package/dist/editor/applyChangesToManualLayout.js +7 -6
- package/dist/editor/editorActor.actions.d.ts +25 -25
- package/dist/editor/editorActor.actions.js +22 -22
- package/dist/editor/editorActor.setup.d.ts +84 -0
- package/dist/editor/editorActor.setup.js +38 -0
- package/dist/editor/editorActor.states.d.ts +9 -0
- package/dist/editor/{editorActor.js → editorActor.states.js} +21 -72
- package/dist/editor/index.d.ts +4 -3
- package/dist/editor/useEditorActorLogic.d.ts +2 -565
- package/dist/editor/useEditorActorLogic.js +14 -21
- package/dist/hooks/index.d.ts +3 -3
- package/dist/hooks/safeContext.d.ts +4 -5
- package/dist/hooks/useCallbackRef.d.ts +6 -0
- package/dist/hooks/useCallbackRef.js +7 -6
- package/dist/hooks/useCurrentView.js +5 -10
- package/dist/hooks/useCurrentViewModel.d.ts +8 -2
- package/dist/hooks/useCurrentViewModel.js +3 -7
- package/dist/hooks/useDiagram.d.ts +9 -1
- package/dist/hooks/useDiagram.js +10 -4
- package/dist/hooks/useDiagramCompareLayout.d.ts +6 -6
- package/dist/hooks/useDiagramCompareLayout.js +1 -1
- package/dist/hooks/useLikeC4ElementsTree.d.ts +1 -1
- package/dist/hooks/useLikeC4ElementsTree.js +2 -2
- package/dist/hooks/useLikeC4Model.d.ts +6 -2
- package/dist/hooks/useLikeC4Model.js +7 -9
- package/dist/hooks/useLikeC4Project.d.ts +4 -6
- package/dist/hooks/useLikeC4Project.js +19 -31
- package/dist/hooks/useLikeC4Styles.js +3 -9
- package/dist/hooks/useMantinePortalProps.d.ts +1 -1
- package/dist/hooks/useMediaPrint.d.ts +0 -2
- package/dist/hooks/useOverlaysActor.js +4 -4
- package/dist/hooks/useSearchActor.js +4 -4
- package/dist/hooks/useSetState.d.ts +6 -1
- package/dist/hooks/useSetState.js +7 -4
- package/dist/hooks/useXYFlow.d.ts +7 -1
- package/dist/hooks/useXYFlow.js +4 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +3 -1
- package/dist/likec4diagram/DiagramUI.js +1 -3
- package/dist/likec4diagram/DiagramXYFlow.d.ts +2 -1
- package/dist/likec4diagram/DiagramXYFlow.js +29 -18
- package/dist/likec4diagram/convert-to-xyflow.d.ts +2 -1
- package/dist/likec4diagram/convert-to-xyflow.js +2 -6
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +34 -37
- package/dist/likec4diagram/custom/edges/edges.css.js +2 -1
- package/dist/likec4diagram/custom/edges/useControlPoints.js +3 -3
- package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.d.ts +3 -0
- package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.js +52 -34
- package/dist/likec4diagram/custom/nodes/ElementActions.d.ts +1 -2
- package/dist/likec4diagram/custom/nodes/ElementActions.js +7 -10
- package/dist/likec4diagram/custom/nodes/NodeDrifts.d.ts +1 -2
- package/dist/likec4diagram/custom/nodes/NodeDrifts.js +3 -20
- package/dist/likec4diagram/custom/nodes/NodeNotes.d.ts +6 -0
- package/dist/likec4diagram/custom/nodes/NodeNotes.js +286 -0
- package/dist/likec4diagram/custom/nodes/SequenceActorNode.js +10 -6
- package/dist/likec4diagram/custom/nodes/nodes.js +30 -8
- package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +5 -4
- package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.d.ts +6 -1
- package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.js +14 -9
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +4 -4
- package/dist/likec4diagram/custom/nodes/toolbar/styles.css.js +3 -3
- package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +16 -36
- package/dist/likec4diagram/relationship-popover/components.d.ts +7 -0
- package/dist/likec4diagram/relationship-popover/components.js +39 -0
- package/dist/likec4diagram/state/DiagramActorProvider.d.ts +4 -3
- package/dist/likec4diagram/state/DiagramActorProvider.js +39 -66
- package/dist/likec4diagram/state/assign.d.ts +1 -1
- package/dist/likec4diagram/state/createViewChange.js +16 -4
- package/dist/likec4diagram/state/diagram-api.d.ts +11 -0
- package/dist/likec4diagram/state/diagram-api.js +15 -0
- package/dist/likec4diagram/state/machine.actions.d.ts +92 -0
- package/dist/likec4diagram/state/machine.actions.js +127 -58
- package/dist/likec4diagram/state/machine.actions.layout.d.ts +23 -2
- package/dist/likec4diagram/state/machine.actions.layout.js +68 -15
- package/dist/likec4diagram/state/machine.d.ts +1 -1
- package/dist/likec4diagram/state/machine.js +35 -31
- package/dist/likec4diagram/state/machine.setup.d.ts +40 -7
- package/dist/likec4diagram/state/machine.setup.js +13 -4
- package/dist/likec4diagram/state/machine.state.initializing.d.ts +32 -2
- package/dist/likec4diagram/state/machine.state.navigating.d.ts +1 -1
- package/dist/likec4diagram/state/machine.state.navigating.js +82 -50
- package/dist/likec4diagram/state/machine.state.ready.d.ts +565 -579
- package/dist/likec4diagram/state/machine.state.ready.focused.d.ts +17 -148
- package/dist/likec4diagram/state/machine.state.ready.focused.js +6 -14
- package/dist/likec4diagram/state/machine.state.ready.idle.d.ts +11 -96
- package/dist/likec4diagram/state/machine.state.ready.idle.js +7 -12
- package/dist/likec4diagram/state/machine.state.ready.js +89 -70
- package/dist/likec4diagram/state/machine.state.ready.printing.d.ts +4 -0
- package/dist/likec4diagram/state/machine.state.ready.printing.js +4 -3
- package/dist/likec4diagram/state/machine.state.ready.walkthrough.d.ts +145 -2
- package/dist/likec4diagram/state/machine.state.ready.walkthrough.js +29 -21
- package/dist/likec4diagram/state/types.d.ts +1 -1
- package/dist/likec4diagram/state/utils.d.ts +14 -14
- package/dist/likec4diagram/state/utils.js +12 -4
- package/dist/likec4diagram/types.d.ts +11 -3
- package/dist/likec4diagram/ui/notation/NotationPanel.css.js +2 -2
- package/dist/likec4diagram/ui/notation/NotationPanel.js +3 -3
- package/dist/likec4diagram/useLayoutConstraints.d.ts +12 -12
- package/dist/likec4diagram/useLayoutConstraints.js +126 -84
- package/dist/likec4diagram/xyflow-diagram/diagram-view.d.ts +11 -3
- package/dist/likec4diagram/xyflow-diagram/diagram-view.js +7 -3
- package/dist/likec4diagram/xyflow-sequence/sequence-layout.d.ts +7 -3
- package/dist/likec4diagram/xyflow-sequence/sequence-layout.js +15 -8
- package/dist/navigationpanel/NavigationPanel.js +4 -3
- package/dist/navigationpanel/NavigationPanelControls.js +4 -2
- package/dist/navigationpanel/NavigationPanelDropdown.js +13 -13
- package/dist/navigationpanel/_common.d.ts +1 -1
- package/dist/navigationpanel/_common.js +2 -3
- package/dist/navigationpanel/actor.js +1 -1
- package/dist/navigationpanel/comparepanel/CompareActionsMenu.js +2 -2
- package/dist/navigationpanel/comparepanel/ComparePanel.js +155 -29
- package/dist/navigationpanel/comparepanel/ComparePanelControls.js +1 -1
- package/dist/navigationpanel/comparepanel/DriftsSummary.d.ts +1 -0
- package/dist/navigationpanel/comparepanel/DriftsSummary.js +264 -0
- package/dist/navigationpanel/comparepanel/LayoutTypeSwitcher.js +4 -5
- package/dist/navigationpanel/controls/DetailsControls.js +7 -7
- package/dist/navigationpanel/controls/LayoutWarning.js +2 -2
- package/dist/navigationpanel/controls/LogoButton.js +1 -1
- package/dist/navigationpanel/controls/NavigationButtons.js +2 -2
- package/dist/navigationpanel/controls/OpenSource.js +1 -1
- package/dist/navigationpanel/controls/SearchControl.d.ts +1 -2
- package/dist/navigationpanel/controls/SearchControl.js +8 -12
- package/dist/navigationpanel/controls/ToggleReadonly.js +5 -6
- package/dist/navigationpanel/dropdown/ProjectsMenu.js +12 -6
- package/dist/navigationpanel/editorpanel/CenterCamera.js +1 -1
- package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.js +1 -1
- package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.js +9 -9
- package/dist/navigationpanel/editorpanel/ToggleReadonly.js +1 -1
- package/dist/navigationpanel/editorpanel/styles.js +4 -4
- package/dist/navigationpanel/styles.css.d.ts +1 -1
- package/dist/navigationpanel/styles.css.js +1 -1
- package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +6 -6
- package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +77 -77
- package/dist/navigationpanel/walkthrough/DynamicViewControls.js +1 -1
- package/dist/navigationpanel/walkthrough/WalkthroughPanel.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/createReactComponent.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertTriangle.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowDownRight.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowLeft.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowRight.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconBolt.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconBrowser.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronDown.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronLeft.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronRight.js +1 -1
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.1_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.js +14 -0
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconCylinder.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconDeviceMobile.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconDirectionSignFilled.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconExternalLink.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconFileSymlink.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconFileText.js +2 -2
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.1_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconFocusCentered.js +14 -0
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconFolderFilled.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconHelpCircle.js +1 -1
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.1_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconId.js +14 -0
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconInfoCircle.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignBottom.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignCenter.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignLeft.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignMiddle.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignRight.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignTop.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutBoardSplit.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutCollage.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutDashboard.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLink.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLock.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLockOpen2.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerPlayFilled.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipBackFilled.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipForwardFilled.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerStopFilled.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconRectangularPrism.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconReorder.js +2 -2
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.1_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconRouteOff.js +14 -0
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconSearch.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconSelector.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconStack2.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconStarFilled.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconTarget.js +2 -2
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconTransform.js +1 -1
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.1_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconTrash.js +14 -0
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconUser.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconX.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.1_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconZoomScan.js +1 -1
- package/dist/node_modules/.pnpm/@xstate_store@3.14.0_react@19.2.4/node_modules/@xstate/store/dist/store-1b2fbb72.cjs.js +742 -0
- package/dist/node_modules/.pnpm/@xstate_store@3.14.0_react@19.2.4/node_modules/@xstate/store/react/dist/xstate-store-react.cjs.js +175 -0
- package/dist/overlays/element-details/ElementDetailsCard.css.js +15 -15
- package/dist/overlays/element-details/ElementDetailsCard.js +39 -40
- package/dist/overlays/element-details/MetadataValue.js +11 -12
- package/dist/overlays/element-details/TabPanelDeployments.js +8 -6
- package/dist/overlays/element-details/TabPanelRelationships.css.js +10 -30
- package/dist/overlays/element-details/TabPanelRelationships.js +4 -5
- package/dist/overlays/element-details/TabPanelStructure.css.js +3 -3
- package/dist/overlays/element-details/TabPanelStructure.js +3 -2
- package/dist/overlays/overlaysActor.js +19 -1
- package/dist/overlays/relationship-details/RelationshipDetails.d.ts +0 -5
- package/dist/overlays/relationship-details/RelationshipDetails.js +4 -4
- package/dist/overlays/relationship-details/SelectEdge.css.js +6 -6
- package/dist/overlays/relationship-details/SelectEdge.js +2 -2
- package/dist/overlays/relationship-details/compute.js +1 -1
- package/dist/overlays/relationship-details/custom/ElementActions.js +3 -3
- package/dist/overlays/relationship-details/custom/nodeTypes.js +14 -1
- package/dist/overlays/relationship-details/layout.js +1 -1
- package/dist/overlays/relationships-browser/RelationshipsBrowser.d.ts +0 -5
- package/dist/overlays/relationships-browser/RelationshipsBrowser.js +116 -21
- package/dist/overlays/relationships-browser/SelectElement.css.js +2 -2
- package/dist/overlays/relationships-browser/SelectElement.js +2 -2
- package/dist/overlays/relationships-browser/actor.js +1 -1
- package/dist/overlays/relationships-browser/custom/ElementActions.js +3 -3
- package/dist/overlays/relationships-browser/custom/EmptyNode.js +21 -6
- package/dist/overlays/relationships-browser/custom/nodeTypes.js +14 -1
- package/dist/overlays/relationships-browser/layout.d.ts +1 -1
- package/dist/overlays/relationships-browser/layout.js +1 -1
- package/dist/overlays/relationships-browser/useViewToNodesEdges.js +1 -1
- package/dist/projects-overview/ProjectsOverview.js +2 -2
- package/dist/projects-overview/ProjectsOverviewXY.d.ts +1 -5
- package/dist/projects-overview/ProjectsOverviewXY.js +1 -1
- package/dist/projects-overview/actor.d.ts +1 -1
- package/dist/projects-overview/actor.js +8 -31
- package/dist/projects-overview/context.d.ts +2 -2
- package/dist/projects-overview/context.js +2 -1
- package/dist/projects-overview/custom/nodeTypes.js +1 -1
- package/dist/projects-overview/panel/ProjectsOverviewPanel.js +1 -1
- package/dist/search/Search.d.ts +2 -4
- package/dist/search/Search.js +67 -44
- package/dist/search/components/ElementsColumn.css.js +6 -6
- package/dist/search/components/ElementsColumn.js +93 -60
- package/dist/search/components/PickView.d.ts +3 -1
- package/dist/search/components/PickView.js +12 -7
- package/dist/search/components/SearchByTags.js +1 -1
- package/dist/search/components/SearchInput.js +2 -2
- package/dist/search/components/ViewsColum.d.ts +2 -1
- package/dist/search/components/ViewsColum.js +39 -35
- package/dist/search/components/ViewsColumn.css.js +1 -1
- package/dist/search/components/_shared.css.d.ts +1 -1
- package/dist/search/components/_shared.css.js +12 -12
- package/dist/search/components/utils.js +1 -4
- package/dist/search/hooks.d.ts +1 -6
- package/dist/search/hooks.js +15 -9
- package/dist/search/searchActor.d.ts +12 -2
- package/dist/search/searchActor.js +60 -4
- package/dist/shadowroot/ShadowRoot.d.ts +5 -2
- package/dist/shadowroot/ShadowRoot.js +25 -22
- package/dist/shadowroot/styles.css.d.ts +0 -2
- package/dist/shadowroot/styles.css.js +4 -36
- package/dist/styles-font.css2.js +1 -1
- package/dist/styles.css2.js +1 -1
- package/dist/utils/view-bounds.d.ts +3 -2
- package/dist/utils/view-bounds.js +10 -6
- package/dist/utils/xyflow.d.ts +27 -6
- package/dist/utils/xyflow.js +68 -23
- package/package.json +39 -37
- package/panda.buildinfo.json +226 -161
- package/styles-font.css +1 -1
- package/styles-min.css +1 -1
- package/styles.css +1 -1
- package/bundle/index.js +0 -51974
- package/bundle/package.json +0 -4
- package/dist/editor/__tests__/fixture.d.ts +0 -205
- package/dist/editor/editorActor.d.ts +0 -653
- package/dist/likec4diagram/relationship-popover/styles.css.d.ts +0 -2
- package/dist/likec4diagram/relationship-popover/styles.css.js +0 -28
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.3/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.js +0 -14
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.3/node_modules/@tabler/icons-react/dist/esm/icons/IconFocusCentered.js +0 -14
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.3/node_modules/@tabler/icons-react/dist/esm/icons/IconId.js +0 -14
- package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.3/node_modules/@tabler/icons-react/dist/esm/icons/IconRouteOff.js +0 -14
- package/dist/overlays/relationships-browser/custom/styles.css.d.ts +0 -1
- package/dist/overlays/relationships-browser/custom/styles.css.js +0 -14
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { nonNullable } from '@likec4/core';
|
|
2
|
-
import { getViewportForBounds } from '@xyflow/react';
|
|
1
|
+
import { nonNullable, isNonEmptyArray, BBox, invariant } from '@likec4/core';
|
|
2
|
+
import { getViewportForBounds, getNodesBounds } from '@xyflow/react';
|
|
3
3
|
import { assertEvent } from 'xstate';
|
|
4
|
+
import { calcEdgeBounds } from '../../utils/view-bounds.js';
|
|
4
5
|
import { machine } from './machine.setup.js';
|
|
5
|
-
import { activeSequenceBounds, focusedBounds } from './utils.js';
|
|
6
|
+
import { viewBounds, activeSequenceBounds, focusedBounds } from './utils.js';
|
|
6
7
|
import { MinZoom } from '../../base/const.js';
|
|
7
8
|
|
|
8
9
|
const setViewport = (params) => machine.createAction(({ context, event }) => {
|
|
@@ -15,7 +16,7 @@ const setViewport = (params) => machine.createAction(({ context, event }) => {
|
|
|
15
16
|
viewport = event.viewport;
|
|
16
17
|
duration = event.duration;
|
|
17
18
|
}
|
|
18
|
-
duration = duration ??
|
|
19
|
+
duration = duration ?? 450;
|
|
19
20
|
const { panZoom } = nonNullable(context.xystore).getState();
|
|
20
21
|
const animationProps = duration > 0 ? { duration, interpolate: "smooth" } : void 0;
|
|
21
22
|
panZoom?.setViewport({
|
|
@@ -23,21 +24,72 @@ const setViewport = (params) => machine.createAction(({ context, event }) => {
|
|
|
23
24
|
y: Math.round(viewport.y),
|
|
24
25
|
zoom: viewport.zoom
|
|
25
26
|
}, animationProps).catch((err) => {
|
|
26
|
-
console.error("Error during
|
|
27
|
+
console.error("Error during setViewport", { err });
|
|
27
28
|
});
|
|
28
29
|
});
|
|
29
|
-
const
|
|
30
|
-
let
|
|
30
|
+
const setViewportCenter = (params) => machine.createAction(({ context, event }) => {
|
|
31
|
+
let center;
|
|
31
32
|
if (params) {
|
|
32
|
-
|
|
33
|
+
center = params;
|
|
34
|
+
} else if (event.type === "update.view") {
|
|
35
|
+
center = BBox.center(viewBounds(context, event.view));
|
|
36
|
+
} else {
|
|
37
|
+
center = BBox.center(viewBounds(context));
|
|
38
|
+
}
|
|
39
|
+
invariant(context.xyflow, "xyflow is not initialized");
|
|
40
|
+
const zoom = context.xyflow.getZoom();
|
|
41
|
+
context.xyflow.setCenter(
|
|
42
|
+
Math.round(center.x),
|
|
43
|
+
Math.round(center.y),
|
|
44
|
+
{ zoom }
|
|
45
|
+
).catch((err) => {
|
|
46
|
+
console.error("Error during setViewportCenter", { err });
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
const centerOnNodeOrEdge = () => machine.raise(({ context, event }) => {
|
|
50
|
+
assertEvent(event, "xyflow.centerViewport");
|
|
51
|
+
const xystate = context.xystore.getState();
|
|
52
|
+
if ("edgeId" in event) {
|
|
53
|
+
const edge = xystate.edgeLookup.get(event.edgeId);
|
|
54
|
+
if (!edge) {
|
|
55
|
+
return { type: "noop" };
|
|
56
|
+
}
|
|
57
|
+
const sourceNode = xystate.nodeLookup.get(edge.source);
|
|
58
|
+
const targetNode = xystate.nodeLookup.get(edge.target);
|
|
59
|
+
if (!sourceNode || !targetNode) {
|
|
60
|
+
return { type: "noop" };
|
|
61
|
+
}
|
|
62
|
+
const bounds2 = getNodesBounds([sourceNode, targetNode], xystate);
|
|
63
|
+
const edgeBounds = calcEdgeBounds({
|
|
64
|
+
points: edge.data.points,
|
|
65
|
+
controlPoints: edge.data.controlPoints && isNonEmptyArray(edge.data.controlPoints) ? edge.data.controlPoints : null,
|
|
66
|
+
labelBBox: edge.data.labelBBox ?? null
|
|
67
|
+
});
|
|
68
|
+
return {
|
|
69
|
+
type: "xyflow.fitDiagram",
|
|
70
|
+
bounds: BBox.merge(bounds2, edgeBounds)
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
const node = xystate.nodeLookup.get(event.nodeId);
|
|
74
|
+
if (!node) {
|
|
75
|
+
return { type: "noop" };
|
|
76
|
+
}
|
|
77
|
+
const bounds = getNodesBounds([node], xystate);
|
|
78
|
+
return {
|
|
79
|
+
type: "xyflow.fitDiagram",
|
|
80
|
+
bounds
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
const fitDiagram = (params) => machine.createAction(({ context, event }) => {
|
|
84
|
+
let bounds, duration;
|
|
85
|
+
if (params) {
|
|
86
|
+
bounds = params.bounds;
|
|
33
87
|
duration = params.duration;
|
|
34
88
|
} else if (event.type === "xyflow.fitDiagram") {
|
|
35
|
-
bounds = event.bounds
|
|
89
|
+
bounds = event.bounds;
|
|
36
90
|
duration = event.duration;
|
|
37
|
-
enqueue.assign({
|
|
38
|
-
viewportChangedManually: false
|
|
39
|
-
});
|
|
40
91
|
}
|
|
92
|
+
bounds ??= viewBounds(context);
|
|
41
93
|
duration ??= 450;
|
|
42
94
|
const { width, height, panZoom, transform } = nonNullable(context.xystore).getState();
|
|
43
95
|
const maxZoom = Math.max(1, transform[2]);
|
|
@@ -119,18 +171,19 @@ const assignViewportBefore = (viewport) => machine.assign(({ context }) => {
|
|
|
119
171
|
});
|
|
120
172
|
const returnViewportBefore = (params) => machine.enqueueActions(({ enqueue, context: { viewportBefore } }) => {
|
|
121
173
|
enqueue(cancelFitDiagram());
|
|
174
|
+
const noDelay = params?.delay === 0;
|
|
122
175
|
if (viewportBefore) {
|
|
123
176
|
enqueue.assign({
|
|
124
177
|
viewportChangedManually: viewportBefore.wasChangedManually,
|
|
125
178
|
viewportBefore: null
|
|
126
179
|
});
|
|
127
|
-
if (
|
|
180
|
+
if (noDelay) {
|
|
128
181
|
enqueue(setViewport({ viewport: viewportBefore.value, ...params }));
|
|
129
182
|
} else {
|
|
130
183
|
enqueue(raiseSetViewport({ viewport: viewportBefore.value, ...params }));
|
|
131
184
|
}
|
|
132
185
|
} else {
|
|
133
|
-
if (
|
|
186
|
+
if (noDelay) {
|
|
134
187
|
enqueue(fitDiagram({ ...params }));
|
|
135
188
|
} else {
|
|
136
189
|
enqueue(raiseFitDiagram({ ...params }));
|
|
@@ -138,4 +191,4 @@ const returnViewportBefore = (params) => machine.enqueueActions(({ enqueue, cont
|
|
|
138
191
|
}
|
|
139
192
|
});
|
|
140
193
|
|
|
141
|
-
export { assignViewportBefore, cancelFitDiagram, fitDiagram, fitFocusedBounds, raiseFitDiagram, raiseSetViewport, raiseUpdateView, returnViewportBefore, setViewport };
|
|
194
|
+
export { assignViewportBefore, cancelFitDiagram, centerOnNodeOrEdge, fitDiagram, fitFocusedBounds, raiseFitDiagram, raiseSetViewport, raiseUpdateView, returnViewportBefore, setViewport, setViewportCenter };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ActorRef, MachineSnapshot, StateMachine } from 'xstate';
|
|
2
|
-
import { EditorActorRef } from '../../editor/editorActor';
|
|
2
|
+
import { EditorActorRef } from '../../editor/editorActor.states';
|
|
3
3
|
import { OverlaysActorRef } from '../../overlays/overlaysActor';
|
|
4
4
|
import { SearchActorRef } from '../../search/searchActor';
|
|
5
5
|
import { Context as DiagramContext, EmittedEvents as DiagramEmittedEvents, Events as DiagramEvents, Input } from './machine.setup';
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { applyEdgeChanges, applyNodeChanges } from '@xyflow/react';
|
|
2
2
|
import { DefaultFeatures } from '../../context/DiagramFeatures.js';
|
|
3
3
|
import { updateEdgeData, updateNodeData } from './assign.js';
|
|
4
|
-
import { emitOnLayoutTypeChange, triggerChange, updateFeatures, updateInputs, assignDynamicViewVariant
|
|
4
|
+
import { stopEditorActor, emitOnLayoutTypeChange, triggerChange, updateFeatures, updateInputs, assignDynamicViewVariant } from './machine.actions.js';
|
|
5
5
|
import { machine } from './machine.setup.js';
|
|
6
6
|
import { isReady, initializing } from './machine.state.initializing.js';
|
|
7
7
|
import { navigating } from './machine.state.navigating.js';
|
|
8
8
|
import { ready } from './machine.state.ready.js';
|
|
9
9
|
import { DiagramToggledFeaturesPersistence } from './persistence.js';
|
|
10
10
|
import { x as xstateActions_cjsExports } from '../../_virtual/xstate-actions.cjs.js';
|
|
11
|
-
import {
|
|
11
|
+
import { cancelFitDiagram, raiseUpdateView } from './machine.actions.layout.js';
|
|
12
12
|
|
|
13
13
|
const _diagramMachine = machine.createMachine({
|
|
14
14
|
initial: "initializing",
|
|
@@ -16,7 +16,10 @@ const _diagramMachine = machine.createMachine({
|
|
|
16
16
|
...input,
|
|
17
17
|
xyedges: [],
|
|
18
18
|
xynodes: [],
|
|
19
|
-
features: {
|
|
19
|
+
features: {
|
|
20
|
+
...DefaultFeatures,
|
|
21
|
+
...input.features
|
|
22
|
+
},
|
|
20
23
|
toggledFeatures: DiagramToggledFeaturesPersistence.read() ?? {
|
|
21
24
|
enableReadOnly: true,
|
|
22
25
|
enableCompareWithLatest: false
|
|
@@ -49,25 +52,7 @@ const _diagramMachine = machine.createMachine({
|
|
|
49
52
|
ready,
|
|
50
53
|
navigating,
|
|
51
54
|
final: {
|
|
52
|
-
type: "final"
|
|
53
|
-
entry: [
|
|
54
|
-
stopEditorActor(),
|
|
55
|
-
cancelFitDiagram(),
|
|
56
|
-
xstateActions_cjsExports.stopChild("hotkey"),
|
|
57
|
-
xstateActions_cjsExports.stopChild("overlays"),
|
|
58
|
-
xstateActions_cjsExports.stopChild("search"),
|
|
59
|
-
xstateActions_cjsExports.stopChild("mediaPrint"),
|
|
60
|
-
xstateActions_cjsExports.assign({
|
|
61
|
-
xyflow: null,
|
|
62
|
-
xystore: null,
|
|
63
|
-
xyedges: [],
|
|
64
|
-
xynodes: [],
|
|
65
|
-
initialized: {
|
|
66
|
-
xydata: false,
|
|
67
|
-
xyflow: false
|
|
68
|
-
}
|
|
69
|
-
})
|
|
70
|
-
]
|
|
55
|
+
type: "final"
|
|
71
56
|
}
|
|
72
57
|
},
|
|
73
58
|
on: {
|
|
@@ -81,6 +66,9 @@ const _diagramMachine = machine.createMachine({
|
|
|
81
66
|
guard: ({ context, event }) => context.dynamicViewVariant !== event.variant,
|
|
82
67
|
actions: [
|
|
83
68
|
assignDynamicViewVariant(),
|
|
69
|
+
xstateActions_cjsExports.assign({
|
|
70
|
+
viewportChangedManually: false
|
|
71
|
+
}),
|
|
84
72
|
raiseUpdateView()
|
|
85
73
|
]
|
|
86
74
|
},
|
|
@@ -106,14 +94,12 @@ const _diagramMachine = machine.createMachine({
|
|
|
106
94
|
"emit.onLayoutTypeChange": {
|
|
107
95
|
actions: emitOnLayoutTypeChange()
|
|
108
96
|
},
|
|
109
|
-
"xyflow.
|
|
110
|
-
actions: xstateActions_cjsExports.assign({
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
actions: xstateActions_cjsExports.assign({
|
|
116
|
-
xyedges: ({ context, event }) => applyEdgeChanges(event.changes, context.xyedges)
|
|
97
|
+
"xyflow.applyChanges": {
|
|
98
|
+
actions: xstateActions_cjsExports.assign(({ context, event }) => {
|
|
99
|
+
return {
|
|
100
|
+
xynodes: event.nodes ? applyNodeChanges(event.nodes, context.xynodes) : context.xynodes,
|
|
101
|
+
xyedges: event.edges ? applyEdgeChanges(event.edges, context.xyedges) : context.xyedges
|
|
102
|
+
};
|
|
117
103
|
})
|
|
118
104
|
},
|
|
119
105
|
"xyflow.viewportMoved": {
|
|
@@ -123,7 +109,25 @@ const _diagramMachine = machine.createMachine({
|
|
|
123
109
|
}))
|
|
124
110
|
},
|
|
125
111
|
"destroy": {
|
|
126
|
-
target: ".final"
|
|
112
|
+
target: ".final",
|
|
113
|
+
actions: [
|
|
114
|
+
stopEditorActor(),
|
|
115
|
+
cancelFitDiagram(),
|
|
116
|
+
xstateActions_cjsExports.stopChild("hotkey"),
|
|
117
|
+
xstateActions_cjsExports.stopChild("overlays"),
|
|
118
|
+
xstateActions_cjsExports.stopChild("search"),
|
|
119
|
+
xstateActions_cjsExports.stopChild("mediaPrint"),
|
|
120
|
+
xstateActions_cjsExports.assign({
|
|
121
|
+
xyflow: null,
|
|
122
|
+
xystore: null,
|
|
123
|
+
xyedges: [],
|
|
124
|
+
xynodes: [],
|
|
125
|
+
initialized: {
|
|
126
|
+
xydata: false,
|
|
127
|
+
xyflow: false
|
|
128
|
+
}
|
|
129
|
+
})
|
|
130
|
+
]
|
|
127
131
|
}
|
|
128
132
|
}
|
|
129
133
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BBox } from '@likec4/core';
|
|
1
|
+
import { BBox } from '@likec4/core/geometry';
|
|
2
2
|
import { DiagramEdge, DiagramNode, DiagramView, DynamicViewDisplayVariant, EdgeId, Fqn, LayoutType, NodeId, NodeNotation as ElementNotation, StepEdgeId, ViewChange, ViewId, WhereOperator } from '@likec4/core/types';
|
|
3
3
|
import { EdgeChange, NodeChange, Rect, Viewport } from '@xyflow/system';
|
|
4
4
|
import { MouseEvent } from 'react';
|
|
@@ -44,6 +44,7 @@ export interface Input {
|
|
|
44
44
|
fitViewPadding: ViewPaddings;
|
|
45
45
|
where: WhereOperator | null;
|
|
46
46
|
dynamicViewVariant?: DynamicViewDisplayVariant | undefined;
|
|
47
|
+
features?: EnabledFeatures;
|
|
47
48
|
}
|
|
48
49
|
export type ToggledFeatures = {
|
|
49
50
|
[P in `enable${TogglableFeature}`]?: boolean;
|
|
@@ -99,11 +100,9 @@ export type Events = HotKeyEvent | MediaPrintEvent | {
|
|
|
99
100
|
type: 'xyflow.init';
|
|
100
101
|
instance: XYFlowInstance;
|
|
101
102
|
} | {
|
|
102
|
-
type: 'xyflow.
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
type: 'xyflow.applyEdgeChanges';
|
|
106
|
-
changes: EdgeChange<Types.Edge>[];
|
|
103
|
+
type: 'xyflow.applyChanges';
|
|
104
|
+
edges?: EdgeChange<Types.Edge>[];
|
|
105
|
+
nodes?: NodeChange<Types.Node>[];
|
|
107
106
|
} | {
|
|
108
107
|
type: 'xyflow.viewportMoved';
|
|
109
108
|
viewport: Viewport;
|
|
@@ -145,6 +144,14 @@ export type Events = HotKeyEvent | MediaPrintEvent | {
|
|
|
145
144
|
type: 'xyflow.setViewport';
|
|
146
145
|
duration?: number;
|
|
147
146
|
viewport: Viewport;
|
|
147
|
+
} | {
|
|
148
|
+
type: 'xyflow.centerViewport';
|
|
149
|
+
nodeId: NodeId;
|
|
150
|
+
duration?: number;
|
|
151
|
+
} | {
|
|
152
|
+
type: 'xyflow.centerViewport';
|
|
153
|
+
edgeId: EdgeId;
|
|
154
|
+
duration?: number;
|
|
148
155
|
} | {
|
|
149
156
|
type: 'update.nodeData';
|
|
150
157
|
nodeId: NodeId;
|
|
@@ -168,7 +175,7 @@ export type Events = HotKeyEvent | MediaPrintEvent | {
|
|
|
168
175
|
bounds: BBox;
|
|
169
176
|
} | {
|
|
170
177
|
type: 'update.inputs';
|
|
171
|
-
inputs: Partial<Omit<Input, 'view' | 'xystore' | 'dynamicViewVariant'>>;
|
|
178
|
+
inputs: Partial<Omit<Input, 'view' | 'xystore' | 'dynamicViewVariant' | 'features'>>;
|
|
172
179
|
} | {
|
|
173
180
|
type: 'update.features';
|
|
174
181
|
features: EnabledFeatures;
|
|
@@ -225,6 +232,14 @@ export type Events = HotKeyEvent | MediaPrintEvent | {
|
|
|
225
232
|
direction: 'next' | 'previous';
|
|
226
233
|
} | {
|
|
227
234
|
type: 'walkthrough.end';
|
|
235
|
+
} | {
|
|
236
|
+
type: 'highlight.node';
|
|
237
|
+
nodeId: NodeId;
|
|
238
|
+
} | {
|
|
239
|
+
type: 'highlight.edge';
|
|
240
|
+
edgeId: EdgeId;
|
|
241
|
+
} | {
|
|
242
|
+
type: 'unhighlight.all';
|
|
228
243
|
} | {
|
|
229
244
|
type: 'notations.highlight';
|
|
230
245
|
notation: ElementNotation;
|
|
@@ -328,6 +343,7 @@ export declare const machine: SetupReturn<Context, Events, {
|
|
|
328
343
|
'click: focused node': unknown;
|
|
329
344
|
'click: node has connections': unknown;
|
|
330
345
|
'click: selected edge': unknown;
|
|
346
|
+
'click: active walkthrough step': unknown;
|
|
331
347
|
}, never, string, Input, NonReducibleUnknown, EmittedEvents, MetaObject>;
|
|
332
348
|
export declare const targetState: {
|
|
333
349
|
idle: string;
|
|
@@ -336,3 +352,20 @@ export declare const targetState: {
|
|
|
336
352
|
printing: string;
|
|
337
353
|
navigating: string;
|
|
338
354
|
};
|
|
355
|
+
export declare const to: {
|
|
356
|
+
idle: {
|
|
357
|
+
target: string;
|
|
358
|
+
};
|
|
359
|
+
focused: {
|
|
360
|
+
target: string;
|
|
361
|
+
};
|
|
362
|
+
walkthrough: {
|
|
363
|
+
target: string;
|
|
364
|
+
};
|
|
365
|
+
printing: {
|
|
366
|
+
target: string;
|
|
367
|
+
};
|
|
368
|
+
navigating: {
|
|
369
|
+
target: string;
|
|
370
|
+
};
|
|
371
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { nonexhaustive } from '@likec4/core';
|
|
2
|
-
import { isTruthy } from 'remeda';
|
|
2
|
+
import { mapValues, isTruthy } from 'remeda';
|
|
3
3
|
import { setup, assertEvent } from 'xstate';
|
|
4
|
-
import { editorActorLogic } from '../../editor/editorActor.js';
|
|
4
|
+
import { editorActorLogic } from '../../editor/editorActor.states.js';
|
|
5
5
|
import { overlaysActorLogic } from '../../overlays/overlaysActor.js';
|
|
6
6
|
import { searchActorLogic } from '../../search/searchActor.js';
|
|
7
7
|
import { hotkeyActorLogic } from './hotkeyActor.js';
|
|
@@ -11,7 +11,7 @@ const deriveToggledFeatures = (context) => {
|
|
|
11
11
|
let toggledFeatures = context.toggledFeatures;
|
|
12
12
|
const hasActiveWalkthrough = isTruthy(context.activeWalkthrough);
|
|
13
13
|
const enableCompareWithLatest = context.features.enableCompareWithLatest && (toggledFeatures.enableCompareWithLatest ?? false) && isTruthy(context.view._layout) && !hasActiveWalkthrough;
|
|
14
|
-
const enableReadOnly = context.features.enableReadOnly || (toggledFeatures.enableReadOnly ?? false) || hasActiveWalkthrough ||
|
|
14
|
+
const enableReadOnly = context.features.enableReadOnly || (toggledFeatures.enableReadOnly ?? false) || hasActiveWalkthrough || enableCompareWithLatest && context.view._layout === "auto";
|
|
15
15
|
return {
|
|
16
16
|
enableCompareWithLatest,
|
|
17
17
|
enableReadOnly
|
|
@@ -94,6 +94,14 @@ const machine = setup({
|
|
|
94
94
|
"click: selected edge": ({ event }) => {
|
|
95
95
|
assertEvent(event, ["xyflow.edgeClick", "xyflow.edgeDoubleClick"]);
|
|
96
96
|
return event.edge.selected === true || event.edge.data.active === true;
|
|
97
|
+
},
|
|
98
|
+
"click: active walkthrough step": ({ context, event }) => {
|
|
99
|
+
assertEvent(event, ["xyflow.edgeClick", "xyflow.edgeDoubleClick"]);
|
|
100
|
+
if (!context.activeWalkthrough) {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
const { stepId } = context.activeWalkthrough;
|
|
104
|
+
return event.edge.id === stepId;
|
|
97
105
|
}
|
|
98
106
|
}
|
|
99
107
|
});
|
|
@@ -104,5 +112,6 @@ const targetState = {
|
|
|
104
112
|
printing: "#printing",
|
|
105
113
|
navigating: "#navigating"
|
|
106
114
|
};
|
|
115
|
+
const to = mapValues(targetState, (id) => ({ target: id }));
|
|
107
116
|
|
|
108
|
-
export { deriveToggledFeatures, machine, targetState };
|
|
117
|
+
export { deriveToggledFeatures, machine, targetState, to };
|
|
@@ -99,7 +99,7 @@ export declare const initializing: {
|
|
|
99
99
|
export declare const isReady: {
|
|
100
100
|
always: ({
|
|
101
101
|
guard: "isReady";
|
|
102
|
-
actions: ActionFunction<Context, Events, Events,
|
|
102
|
+
actions: ( ActionFunction<Context, Events, Events, unknown, Values<{
|
|
103
103
|
hotkeyActorLogic: {
|
|
104
104
|
src: "hotkeyActorLogic";
|
|
105
105
|
logic: HotkeyActorLogic;
|
|
@@ -214,7 +214,37 @@ export declare const isReady: {
|
|
|
214
214
|
type: "click: selected edge";
|
|
215
215
|
params: unknown;
|
|
216
216
|
};
|
|
217
|
-
|
|
217
|
+
"click: active walkthrough step": {
|
|
218
|
+
type: "click: active walkthrough step";
|
|
219
|
+
params: unknown;
|
|
220
|
+
};
|
|
221
|
+
}>, never, EmittedEvents> | ActionFunction<Context, Events, Events, undefined, Values<{
|
|
222
|
+
hotkeyActorLogic: {
|
|
223
|
+
src: "hotkeyActorLogic";
|
|
224
|
+
logic: HotkeyActorLogic;
|
|
225
|
+
id: "hotkey";
|
|
226
|
+
};
|
|
227
|
+
overlaysActorLogic: {
|
|
228
|
+
src: "overlaysActorLogic";
|
|
229
|
+
logic: OverlaysActorLogic;
|
|
230
|
+
id: "overlays";
|
|
231
|
+
};
|
|
232
|
+
searchActorLogic: {
|
|
233
|
+
src: "searchActorLogic";
|
|
234
|
+
logic: SearchActorLogic;
|
|
235
|
+
id: "search";
|
|
236
|
+
};
|
|
237
|
+
mediaPrintActorLogic: {
|
|
238
|
+
src: "mediaPrintActorLogic";
|
|
239
|
+
logic: MediaPrintActorLogic;
|
|
240
|
+
id: "mediaPrint";
|
|
241
|
+
};
|
|
242
|
+
editorActor: {
|
|
243
|
+
src: "editorActor";
|
|
244
|
+
logic: EditorActorLogic;
|
|
245
|
+
id: "editor";
|
|
246
|
+
};
|
|
247
|
+
}>, never, never, never, never> | ActionFunction<Context, Events, Events, undefined, never, never, never, never, EmittedEvents>)[];
|
|
218
248
|
target: string;
|
|
219
249
|
} | {
|
|
220
250
|
target: string;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { BBox } from '@likec4/core/
|
|
2
|
-
import { invariant
|
|
1
|
+
import { BBox } from '@likec4/core/geometry';
|
|
2
|
+
import { invariant } from '@likec4/core/utils';
|
|
3
3
|
import { isTruthy } from 'remeda';
|
|
4
4
|
import { enqueueActions, assertEvent } from 'xstate';
|
|
5
|
+
import { roundDpr } from '../../utils/roundDpr.js';
|
|
6
|
+
import { parsePaddings } from '../../utils/xyflow.js';
|
|
5
7
|
import { convertToXYFlow } from '../convert-to-xyflow.js';
|
|
6
8
|
import { mergeXYNodesEdges } from './assign.js';
|
|
7
9
|
import { disableCompareWithLatest } from './machine.actions.js';
|
|
8
|
-
import { machine, targetState } from './machine.setup.js';
|
|
9
|
-
import { calcViewportForBounds, findCorrespondingNode, findNodeByModelFqn, nodeRef } from './utils.js';
|
|
10
|
-
import { cancelFitDiagram, raiseSetViewport
|
|
10
|
+
import { machine, to, targetState } from './machine.setup.js';
|
|
11
|
+
import { viewBounds, calcViewportForBounds, findCorrespondingNode, findNodeByModelFqn, nodeRef } from './utils.js';
|
|
12
|
+
import { cancelFitDiagram, raiseSetViewport } from './machine.actions.layout.js';
|
|
11
13
|
|
|
12
14
|
const handleBrowserForwardBackward = () => machine.assign(({ context, event }) => {
|
|
13
15
|
assertEvent(event, "update.view");
|
|
@@ -22,7 +24,7 @@ const handleBrowserForwardBackward = () => machine.assign(({ context, event }) =
|
|
|
22
24
|
if (!stepCurrent || stepCurrent.viewId === event.view.id || !!lastOnNavigate) {
|
|
23
25
|
return {};
|
|
24
26
|
}
|
|
25
|
-
const stepBack = currentIndex > 0 ?
|
|
27
|
+
const stepBack = currentIndex > 0 ? history.at(currentIndex - 1) : null;
|
|
26
28
|
if (stepBack && stepBack.viewId === event.view.id) {
|
|
27
29
|
return {
|
|
28
30
|
navigationHistory: {
|
|
@@ -32,7 +34,7 @@ const handleBrowserForwardBackward = () => machine.assign(({ context, event }) =
|
|
|
32
34
|
lastOnNavigate: null
|
|
33
35
|
};
|
|
34
36
|
}
|
|
35
|
-
const stepForward = currentIndex < history.length - 1 ?
|
|
37
|
+
const stepForward = currentIndex < history.length - 1 ? history.at(currentIndex + 1) : null;
|
|
36
38
|
if (stepForward && stepForward.viewId === event.view.id) {
|
|
37
39
|
return {
|
|
38
40
|
navigationHistory: {
|
|
@@ -60,7 +62,7 @@ const handleBrowserForwardBackward = () => machine.assign(({ context, event }) =
|
|
|
60
62
|
const navigating = machine.createStateConfig({
|
|
61
63
|
id: targetState.navigating.slice(1),
|
|
62
64
|
always: {
|
|
63
|
-
|
|
65
|
+
...to.idle,
|
|
64
66
|
actions: [
|
|
65
67
|
cancelFitDiagram(),
|
|
66
68
|
handleBrowserForwardBackward(),
|
|
@@ -78,64 +80,75 @@ const navigating = machine.createStateConfig({
|
|
|
78
80
|
const eventWithXYData = "xynodes" in event ? event : {
|
|
79
81
|
...event,
|
|
80
82
|
...convertToXYFlow({
|
|
83
|
+
currentViewId: context.view.id,
|
|
81
84
|
dynamicViewVariant: context.dynamicViewVariant,
|
|
82
85
|
view: event.view,
|
|
83
86
|
where: context.where
|
|
84
87
|
})
|
|
85
88
|
};
|
|
86
89
|
invariant(xyflow, "xyflow is not initialized");
|
|
90
|
+
const currentViewport = xyflow.getViewport();
|
|
87
91
|
const calcZoomTowardsNextViewport = (nextViewport2) => {
|
|
88
|
-
const zoom =
|
|
89
|
-
const
|
|
90
|
-
|
|
92
|
+
const zoom = currentViewport.zoom;
|
|
93
|
+
const diff = nextViewport2.zoom - zoom;
|
|
94
|
+
if (Math.abs(diff) < 0.01) {
|
|
95
|
+
return nextViewport2.zoom;
|
|
96
|
+
}
|
|
97
|
+
const coef = diff < 0 ? 0.6 : 0.3;
|
|
98
|
+
return Math.trunc(1e4 * (zoom + diff * coef)) / 1e4;
|
|
99
|
+
};
|
|
100
|
+
const moveTowardsNextViewport = (nextViewport2) => {
|
|
101
|
+
const zoom = calcZoomTowardsNextViewport(nextViewport2);
|
|
102
|
+
if (zoom !== nextViewport2.zoom) {
|
|
103
|
+
xyflow.setViewport({
|
|
104
|
+
x: roundDpr(nextViewport2.x * (1 + currentViewport.zoom - zoom)),
|
|
105
|
+
y: roundDpr(nextViewport2.y * (1 + currentViewport.zoom - zoom)),
|
|
106
|
+
zoom
|
|
107
|
+
});
|
|
108
|
+
enqueue(raiseSetViewport({
|
|
109
|
+
delay: 100,
|
|
110
|
+
viewport: nextViewport2
|
|
111
|
+
}));
|
|
112
|
+
} else {
|
|
113
|
+
xyflow.setViewport(nextViewport2, { duration: 0 });
|
|
114
|
+
}
|
|
91
115
|
};
|
|
92
116
|
const fromHistory = history[currentIndex];
|
|
93
|
-
if (fromHistory && fromHistory.viewId ===
|
|
94
|
-
|
|
117
|
+
if (fromHistory && fromHistory.viewId === eventWithXYData.view.id) {
|
|
118
|
+
const {
|
|
119
|
+
focusedNode: wasFocused,
|
|
120
|
+
activeWalkthrough: wasActiveWalkthrough,
|
|
121
|
+
viewportBefore
|
|
122
|
+
} = fromHistory;
|
|
123
|
+
const nextCtx = {
|
|
95
124
|
...mergeXYNodesEdges(context, eventWithXYData),
|
|
96
125
|
dynamicViewVariant: fromHistory.dynamicViewVariant ?? context.dynamicViewVariant,
|
|
97
|
-
viewportChangedManually: fromHistory.viewportChangedManually
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
enqueue.assign({
|
|
104
|
-
viewport: viewportBefore.value,
|
|
105
|
-
viewportChangedManually: viewportBefore.wasChangedManually,
|
|
106
|
-
viewportBefore: null
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
const center = BBox.center(event.view.bounds);
|
|
110
|
-
const zoom = calcZoomTowardsNextViewport(fromHistory.viewport);
|
|
111
|
-
xyflow.setCenter(
|
|
112
|
-
center.x,
|
|
113
|
-
center.y,
|
|
114
|
-
{ zoom, duration: 0 }
|
|
115
|
-
);
|
|
126
|
+
viewportChangedManually: viewportBefore?.wasChangedManually ?? fromHistory.viewportChangedManually,
|
|
127
|
+
viewport: viewportBefore?.value ?? fromHistory.viewport,
|
|
128
|
+
viewportBefore: null
|
|
129
|
+
};
|
|
130
|
+
enqueue.assign(nextCtx);
|
|
131
|
+
moveTowardsNextViewport(nextCtx.viewport);
|
|
116
132
|
if (wasFocused) {
|
|
117
133
|
enqueue.raise({
|
|
118
134
|
type: "focus.node",
|
|
119
135
|
nodeId: wasFocused
|
|
120
|
-
}, { delay:
|
|
136
|
+
}, { delay: 150 });
|
|
121
137
|
return;
|
|
122
138
|
}
|
|
123
139
|
if (wasActiveWalkthrough) {
|
|
124
140
|
enqueue.raise({
|
|
125
141
|
type: "walkthrough.start",
|
|
126
142
|
stepId: wasActiveWalkthrough
|
|
127
|
-
}, { delay:
|
|
143
|
+
}, { delay: 150 });
|
|
128
144
|
return;
|
|
129
145
|
}
|
|
130
|
-
enqueue(raiseSetViewport({
|
|
131
|
-
delay: 80,
|
|
132
|
-
viewport: fromHistory.viewport
|
|
133
|
-
}));
|
|
134
146
|
return;
|
|
135
147
|
}
|
|
148
|
+
const nextBounds = viewBounds(context, eventWithXYData.view);
|
|
136
149
|
const nextViewport = calcViewportForBounds(
|
|
137
150
|
context,
|
|
138
|
-
|
|
151
|
+
nextBounds
|
|
139
152
|
);
|
|
140
153
|
const { fromNode, toNode } = findCorrespondingNode(context, eventWithXYData);
|
|
141
154
|
if (fromNode && toNode) {
|
|
@@ -151,17 +164,40 @@ const navigating = machine.createStateConfig({
|
|
|
151
164
|
xystore.getState().panBy({
|
|
152
165
|
x: Math.round(fromPoint.x - toPoint.x),
|
|
153
166
|
y: Math.round(fromPoint.y - toPoint.y)
|
|
167
|
+
}).catch((err) => {
|
|
168
|
+
console.error("Error during xyflow.panBy", { err });
|
|
154
169
|
});
|
|
170
|
+
enqueue(raiseSetViewport({
|
|
171
|
+
delay: 100,
|
|
172
|
+
viewport: nextViewport
|
|
173
|
+
}));
|
|
155
174
|
} else {
|
|
156
175
|
const zoom = calcZoomTowardsNextViewport(nextViewport);
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
center
|
|
160
|
-
|
|
161
|
-
{
|
|
162
|
-
|
|
176
|
+
if (zoom !== nextViewport.zoom) {
|
|
177
|
+
const { width, height } = context.xystore.getState();
|
|
178
|
+
const nextCenter = BBox.center(nextBounds);
|
|
179
|
+
const paddings = parsePaddings(context.fitViewPadding, width, height);
|
|
180
|
+
xyflow.setViewport({
|
|
181
|
+
x: roundDpr(
|
|
182
|
+
(width - paddings.x) / 2 - nextCenter.x * zoom + paddings.left
|
|
183
|
+
),
|
|
184
|
+
y: roundDpr(
|
|
185
|
+
(height - paddings.y) / 2 - nextCenter.y * zoom + paddings.top
|
|
186
|
+
),
|
|
187
|
+
zoom
|
|
188
|
+
});
|
|
189
|
+
enqueue(raiseSetViewport({
|
|
190
|
+
delay: 100,
|
|
191
|
+
viewport: nextViewport
|
|
192
|
+
}));
|
|
193
|
+
} else {
|
|
194
|
+
xyflow.setViewport(nextViewport, { duration: 0 });
|
|
195
|
+
}
|
|
163
196
|
}
|
|
164
197
|
const updatedHistory = currentIndex < history.length - 1 ? history.slice(0, currentIndex + 1) : [...history];
|
|
198
|
+
if (updatedHistory.length > 20) {
|
|
199
|
+
updatedHistory.shift();
|
|
200
|
+
}
|
|
165
201
|
updatedHistory.push({
|
|
166
202
|
viewId: event.view.id,
|
|
167
203
|
viewport: { ...nextViewport },
|
|
@@ -183,11 +219,7 @@ const navigating = machine.createStateConfig({
|
|
|
183
219
|
type: "focus.node",
|
|
184
220
|
nodeId: nodeToFocus.id,
|
|
185
221
|
autoUnfocus: true
|
|
186
|
-
}, { delay:
|
|
187
|
-
} else {
|
|
188
|
-
enqueue(raiseFitDiagram({
|
|
189
|
-
delay: 100
|
|
190
|
-
}));
|
|
222
|
+
}, { delay: 250 });
|
|
191
223
|
}
|
|
192
224
|
})
|
|
193
225
|
]
|