@likec4/diagram 1.45.0 → 1.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/index.js +2134 -1652
- package/dist/LikeC4Diagram.d.ts +1 -1
- package/dist/LikeC4Diagram.js +8 -7
- package/dist/LikeC4Diagram.props.d.ts +4 -12
- package/dist/LikeC4ProjectsProvider.js +8 -4
- package/dist/LikeC4View.js +1 -5
- package/dist/ReactLikeC4.d.ts +1 -4
- package/dist/StaticLikeC4Diagram.js +0 -2
- package/dist/base-primitives/NodeHandles.d.ts +2 -1
- package/dist/base-primitives/NodeHandles.js +22 -18
- package/dist/base-primitives/compound/CompoundActionButton.js +1 -1
- package/dist/base-primitives/compound/CompoundDetailsButton.js +1 -1
- package/dist/base-primitives/edge/EdgeActionButton.js +1 -1
- package/dist/base-primitives/edge/EdgeContainer.d.ts +1 -1
- package/dist/base-primitives/edge/EdgeContainer.js +2 -3
- package/dist/base-primitives/edge/EdgeLabel.js +16 -16
- package/dist/base-primitives/edge/EdgeLabelContainer.d.ts +1 -1
- package/dist/base-primitives/edge/EdgeLabelContainer.js +5 -4
- package/dist/base-primitives/edge/EdgePath.js +13 -18
- package/dist/base-primitives/element/ElementActionButtons.js +1 -1
- package/dist/base-primitives/element/ElementDetailsButton.js +1 -1
- package/dist/components/ErrorFallback.js +1 -1
- package/dist/components/Link.js +2 -2
- package/dist/context/DiagramEventHandlers.js +0 -1
- package/dist/context/DiagramFeatures.d.ts +1 -1
- package/dist/context/DiagramFeatures.js +1 -0
- package/dist/context/EnsureMantine.js +2 -1
- package/dist/context/IconRenderer.js +6 -6
- package/dist/editor/LikeC4EditorProvider.d.ts +22 -0
- package/dist/editor/LikeC4EditorProvider.js +12 -0
- package/dist/editor/__tests__/fixture.d.ts +205 -0
- package/dist/editor/applyChangesToManualLayout.d.ts +8 -0
- package/dist/editor/applyChangesToManualLayout.js +182 -0
- package/dist/editor/editorActor.actions.d.ts +201 -0
- package/dist/editor/editorActor.actions.js +149 -0
- package/dist/editor/editorActor.d.ts +653 -0
- package/dist/editor/editorActor.js +324 -0
- package/dist/editor/hotkeyActor.d.ts +7 -0
- package/dist/editor/hotkeyActor.js +19 -0
- package/dist/editor/index.d.ts +3 -2
- package/dist/editor/useEditorActorLogic.d.ts +565 -0
- package/dist/editor/useEditorActorLogic.js +54 -0
- package/dist/hooks/safeContext.d.ts +3 -2
- package/dist/hooks/safeContext.js +7 -4
- package/dist/hooks/useDiagram.d.ts +4 -2
- package/dist/hooks/useDiagram.js +19 -8
- package/dist/hooks/useDiagramCompareLayout.d.ts +8 -0
- package/dist/hooks/useDiagramCompareLayout.js +22 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/likec4diagram/DiagramXYFlow.js +1 -2
- package/dist/likec4diagram/custom/edges/EdgeDrifts.js +1 -5
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +74 -48
- package/dist/likec4diagram/custom/edges/edges.css.d.ts +0 -1
- package/dist/likec4diagram/custom/edges/edges.css.js +30 -24
- package/dist/likec4diagram/custom/edges/useControlPoints.js +2 -2
- package/dist/likec4diagram/custom/nodes/ElementActions.js +2 -2
- package/dist/likec4diagram/custom/nodes/NodeDrifts.js +4 -9
- package/dist/likec4diagram/custom/nodes/nodes.js +3 -6
- package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.js +2 -2
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +2 -2
- package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +127 -14
- package/dist/likec4diagram/state/DiagramActorProvider.js +63 -71
- package/dist/likec4diagram/state/assign.d.ts +4 -1
- package/dist/likec4diagram/state/assign.js +11 -8
- package/dist/likec4diagram/state/createViewChange.js +13 -9
- package/dist/likec4diagram/state/diagram-api.d.ts +20 -2
- package/dist/likec4diagram/state/diagram-api.js +58 -44
- package/dist/likec4diagram/state/hotkeyActor.d.ts +1 -1
- package/dist/likec4diagram/state/hotkeyActor.js +12 -0
- package/dist/likec4diagram/state/machine.actions.d.ts +774 -195
- package/dist/likec4diagram/state/machine.actions.js +185 -74
- package/dist/likec4diagram/state/machine.actions.layout.d.ts +93 -31
- package/dist/likec4diagram/state/machine.actions.layout.js +16 -4
- package/dist/likec4diagram/state/machine.d.ts +5 -4
- package/dist/likec4diagram/state/machine.js +11 -6
- package/dist/likec4diagram/state/machine.setup.d.ts +20 -9
- package/dist/likec4diagram/state/machine.setup.js +18 -3
- package/dist/likec4diagram/state/machine.state.initializing.d.ts +34 -18
- package/dist/likec4diagram/state/machine.state.initializing.js +10 -10
- package/dist/likec4diagram/state/machine.state.navigating.js +28 -9
- package/dist/likec4diagram/state/machine.state.ready.d.ts +1368 -434
- package/dist/likec4diagram/state/machine.state.ready.focused.d.ts +363 -39
- package/dist/likec4diagram/state/machine.state.ready.focused.js +17 -4
- package/dist/likec4diagram/state/machine.state.ready.idle.d.ts +104 -38
- package/dist/likec4diagram/state/machine.state.ready.idle.js +14 -5
- package/dist/likec4diagram/state/machine.state.ready.js +13 -90
- package/dist/likec4diagram/state/machine.state.ready.printing.d.ts +18 -6
- package/dist/likec4diagram/state/machine.state.ready.walkthrough.d.ts +204 -31
- package/dist/likec4diagram/state/machine.state.ready.walkthrough.js +14 -1
- package/dist/likec4diagram/state/types.d.ts +6 -2
- package/dist/likec4diagram/state/utils.d.ts +33 -7
- package/dist/likec4diagram/state/utils.js +23 -7
- package/dist/likec4diagram/ui/notation/NotationPanel.js +3 -3
- package/dist/likec4diagram/useLayoutConstraints.js +5 -9
- package/dist/navigationpanel/NavigationPanel.js +6 -9
- package/dist/navigationpanel/NavigationPanelDropdown.js +7 -7
- package/dist/navigationpanel/_common.js +1 -1
- package/dist/navigationpanel/comparepanel/CompareActionsMenu.d.ts +3 -1
- package/dist/navigationpanel/comparepanel/CompareActionsMenu.js +40 -14
- package/dist/navigationpanel/comparepanel/ComparePanelControls.js +6 -4
- package/dist/navigationpanel/comparepanel/LayoutTypeSwitcher.js +2 -2
- package/dist/navigationpanel/controls/DetailsControls.js +2 -2
- package/dist/navigationpanel/controls/LayoutWarning.js +2 -1
- package/dist/navigationpanel/controls/NavigationButtons.js +2 -2
- package/dist/navigationpanel/controls/OpenSource.js +1 -1
- package/dist/navigationpanel/controls/SearchControl.js +2 -2
- package/dist/navigationpanel/controls/ToggleReadonly.js +25 -17
- package/dist/navigationpanel/dropdown/ProjectsMenu.js +1 -1
- 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/walkthrough/ActiveWalkthroughControls.js +3 -3
- package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +66 -66
- package/dist/navigationpanel/walkthrough/DynamicViewControls.js +1 -1
- package/dist/overlays/Overlays.js +24 -12
- package/dist/overlays/element-details/ElementDetailsCard.js +4 -4
- package/dist/overlays/element-details/MetadataValue.js +4 -6
- package/dist/overlays/element-details/TabPanelDeployments.js +3 -3
- package/dist/overlays/element-details/TabPanelRelationships.js +12 -7
- package/dist/overlays/element-details/TabPanelStructure.js +1 -1
- package/dist/overlays/overlaysActor.js +6 -3
- package/dist/overlays/relationship-details/RelationshipDetails.js +3 -3
- package/dist/overlays/relationship-details/SelectEdge.js +2 -2
- package/dist/overlays/relationship-details/custom/ElementActions.js +3 -3
- package/dist/overlays/relationships-browser/RelationshipsBrowser.js +3 -3
- package/dist/overlays/relationships-browser/SelectElement.js +2 -2
- package/dist/overlays/relationships-browser/custom/ElementActions.js +3 -3
- package/dist/search/components/ElementsColumn.js +7 -3
- package/dist/search/components/PickView.js +3 -1
- package/dist/search/components/SearchByTags.js +1 -1
- package/dist/search/components/SearchInput.js +1 -1
- package/dist/search/components/ViewsColum.d.ts +3 -1
- package/dist/search/components/ViewsColum.js +13 -7
- package/dist/shadowroot/styles.css.js +6 -1
- package/dist/styles.css2.js +1 -1
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/xyflow.d.ts +2 -3
- package/dist/utils/xyflow.js +9 -8
- package/package.json +17 -17
- package/panda.buildinfo.json +59 -77
- package/styles-min.css +1 -1
- package/styles.css +1 -1
- package/dist/base-primitives/edge/edge.css.d.ts +0 -4
- package/dist/base-primitives/edge/edge.css.js +0 -71
- package/dist/editor/LikeC4EditorContext.d.ts +0 -21
- package/dist/likec4diagram/state/syncManualLayoutActor.d.ts +0 -46
- package/dist/likec4diagram/state/syncManualLayoutActor.js +0 -309
- package/dist/utils/vector.d.ts +0 -86
- package/dist/utils/vector.js +0 -127
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/createReactComponent.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertTriangle.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowDownRight.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowLeft.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowRight.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconBolt.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconBrowser.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronDown.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronLeft.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronRight.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconCylinder.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconDeviceMobile.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconDirectionSignFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconExternalLink.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconFileSymlink.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconFocusCentered.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconFolderFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconHelpCircle.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconId.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconInfoCircle.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignBottom.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignCenter.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignLeft.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignMiddle.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignRight.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignTop.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutBoardSplit.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutCollage.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutDashboard.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconLink.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconLock.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconLockOpen2.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerPlayFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipBackFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipForwardFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerStopFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconRectangularPrism.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconReorder.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconRouteOff.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconSearch.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconSelector.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconStack2.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconStarFilled.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconTarget.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconTransform.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconUser.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconX.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconZoomScan.js +0 -0
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
import { BBox } from '@likec4/core';
|
|
2
|
+
import { DiagramView } from '@likec4/core/types';
|
|
2
3
|
import { Viewport } from '@xyflow/react';
|
|
3
4
|
import { ActionFunction, Values, CancelAction } from 'xstate';
|
|
4
5
|
import { Context, Events, EmittedEvents } from './machine.setup';
|
|
5
|
-
import { SyncLayoutActorLogic } from './syncManualLayoutActor';
|
|
6
6
|
import { HotkeyActorLogic } from './hotkeyActor';
|
|
7
7
|
import { OverlaysActorLogic } from '../../overlays/overlaysActor';
|
|
8
8
|
import { SearchActorLogic } from '../../search/searchActor';
|
|
9
9
|
import { MediaPrintActorLogic } from './mediaPrintActor';
|
|
10
|
+
import { EditorActorLogic } from '../../editor';
|
|
10
11
|
export declare const setViewport: (params?: {
|
|
11
12
|
viewport: Viewport;
|
|
12
13
|
duration?: number;
|
|
13
14
|
}) => ActionFunction<Context, Events, Events, unknown, Values<{
|
|
14
|
-
syncManualLayoutActorLogic: {
|
|
15
|
-
src: "syncManualLayoutActorLogic";
|
|
16
|
-
logic: SyncLayoutActorLogic;
|
|
17
|
-
id: "syncLayout";
|
|
18
|
-
};
|
|
19
15
|
hotkeyActorLogic: {
|
|
20
16
|
src: "hotkeyActorLogic";
|
|
21
17
|
logic: HotkeyActorLogic;
|
|
@@ -36,11 +32,20 @@ export declare const setViewport: (params?: {
|
|
|
36
32
|
logic: MediaPrintActorLogic;
|
|
37
33
|
id: "mediaPrint";
|
|
38
34
|
};
|
|
35
|
+
editorActor: {
|
|
36
|
+
src: "editorActor";
|
|
37
|
+
logic: EditorActorLogic;
|
|
38
|
+
id: "editor";
|
|
39
|
+
};
|
|
39
40
|
}>, never, Values<{
|
|
40
41
|
isReady: {
|
|
41
42
|
type: "isReady";
|
|
42
43
|
params: unknown;
|
|
43
44
|
};
|
|
45
|
+
"enabled: Editor": {
|
|
46
|
+
type: "enabled: Editor";
|
|
47
|
+
params: unknown;
|
|
48
|
+
};
|
|
44
49
|
"enabled: FitView": {
|
|
45
50
|
type: "enabled: FitView";
|
|
46
51
|
params: unknown;
|
|
@@ -73,6 +78,10 @@ export declare const setViewport: (params?: {
|
|
|
73
78
|
type: "enabled: DynamicViewWalkthrough";
|
|
74
79
|
params: unknown;
|
|
75
80
|
};
|
|
81
|
+
"focus.node: autoUnfocus": {
|
|
82
|
+
type: "focus.node: autoUnfocus";
|
|
83
|
+
params: unknown;
|
|
84
|
+
};
|
|
76
85
|
"enabled: Overlays": {
|
|
77
86
|
type: "enabled: Overlays";
|
|
78
87
|
params: unknown;
|
|
@@ -85,6 +94,10 @@ export declare const setViewport: (params?: {
|
|
|
85
94
|
type: "is dynamic view";
|
|
86
95
|
params: unknown;
|
|
87
96
|
};
|
|
97
|
+
"is same view": {
|
|
98
|
+
type: "is same view";
|
|
99
|
+
params: unknown;
|
|
100
|
+
};
|
|
88
101
|
"is another view": {
|
|
89
102
|
type: "is another view";
|
|
90
103
|
params: unknown;
|
|
@@ -118,11 +131,6 @@ export declare const setViewportCenter: (params?: {
|
|
|
118
131
|
x: number;
|
|
119
132
|
y: number;
|
|
120
133
|
}) => ActionFunction<Context, Events, Events, unknown, Values<{
|
|
121
|
-
syncManualLayoutActorLogic: {
|
|
122
|
-
src: "syncManualLayoutActorLogic";
|
|
123
|
-
logic: SyncLayoutActorLogic;
|
|
124
|
-
id: "syncLayout";
|
|
125
|
-
};
|
|
126
134
|
hotkeyActorLogic: {
|
|
127
135
|
src: "hotkeyActorLogic";
|
|
128
136
|
logic: HotkeyActorLogic;
|
|
@@ -143,11 +151,20 @@ export declare const setViewportCenter: (params?: {
|
|
|
143
151
|
logic: MediaPrintActorLogic;
|
|
144
152
|
id: "mediaPrint";
|
|
145
153
|
};
|
|
154
|
+
editorActor: {
|
|
155
|
+
src: "editorActor";
|
|
156
|
+
logic: EditorActorLogic;
|
|
157
|
+
id: "editor";
|
|
158
|
+
};
|
|
146
159
|
}>, never, Values<{
|
|
147
160
|
isReady: {
|
|
148
161
|
type: "isReady";
|
|
149
162
|
params: unknown;
|
|
150
163
|
};
|
|
164
|
+
"enabled: Editor": {
|
|
165
|
+
type: "enabled: Editor";
|
|
166
|
+
params: unknown;
|
|
167
|
+
};
|
|
151
168
|
"enabled: FitView": {
|
|
152
169
|
type: "enabled: FitView";
|
|
153
170
|
params: unknown;
|
|
@@ -180,6 +197,10 @@ export declare const setViewportCenter: (params?: {
|
|
|
180
197
|
type: "enabled: DynamicViewWalkthrough";
|
|
181
198
|
params: unknown;
|
|
182
199
|
};
|
|
200
|
+
"focus.node: autoUnfocus": {
|
|
201
|
+
type: "focus.node: autoUnfocus";
|
|
202
|
+
params: unknown;
|
|
203
|
+
};
|
|
183
204
|
"enabled: Overlays": {
|
|
184
205
|
type: "enabled: Overlays";
|
|
185
206
|
params: unknown;
|
|
@@ -192,6 +213,10 @@ export declare const setViewportCenter: (params?: {
|
|
|
192
213
|
type: "is dynamic view";
|
|
193
214
|
params: unknown;
|
|
194
215
|
};
|
|
216
|
+
"is same view": {
|
|
217
|
+
type: "is same view";
|
|
218
|
+
params: unknown;
|
|
219
|
+
};
|
|
195
220
|
"is another view": {
|
|
196
221
|
type: "is another view";
|
|
197
222
|
params: unknown;
|
|
@@ -225,11 +250,6 @@ export declare const fitDiagram: (params?: {
|
|
|
225
250
|
duration?: number;
|
|
226
251
|
bounds?: BBox;
|
|
227
252
|
}) => ActionFunction<Context, Events, Events, undefined, Values<{
|
|
228
|
-
syncManualLayoutActorLogic: {
|
|
229
|
-
src: "syncManualLayoutActorLogic";
|
|
230
|
-
logic: SyncLayoutActorLogic;
|
|
231
|
-
id: "syncLayout";
|
|
232
|
-
};
|
|
233
253
|
hotkeyActorLogic: {
|
|
234
254
|
src: "hotkeyActorLogic";
|
|
235
255
|
logic: HotkeyActorLogic;
|
|
@@ -250,11 +270,20 @@ export declare const fitDiagram: (params?: {
|
|
|
250
270
|
logic: MediaPrintActorLogic;
|
|
251
271
|
id: "mediaPrint";
|
|
252
272
|
};
|
|
273
|
+
editorActor: {
|
|
274
|
+
src: "editorActor";
|
|
275
|
+
logic: EditorActorLogic;
|
|
276
|
+
id: "editor";
|
|
277
|
+
};
|
|
253
278
|
}>, never, Values<{
|
|
254
279
|
isReady: {
|
|
255
280
|
type: "isReady";
|
|
256
281
|
params: unknown;
|
|
257
282
|
};
|
|
283
|
+
"enabled: Editor": {
|
|
284
|
+
type: "enabled: Editor";
|
|
285
|
+
params: unknown;
|
|
286
|
+
};
|
|
258
287
|
"enabled: FitView": {
|
|
259
288
|
type: "enabled: FitView";
|
|
260
289
|
params: unknown;
|
|
@@ -287,6 +316,10 @@ export declare const fitDiagram: (params?: {
|
|
|
287
316
|
type: "enabled: DynamicViewWalkthrough";
|
|
288
317
|
params: unknown;
|
|
289
318
|
};
|
|
319
|
+
"focus.node: autoUnfocus": {
|
|
320
|
+
type: "focus.node: autoUnfocus";
|
|
321
|
+
params: unknown;
|
|
322
|
+
};
|
|
290
323
|
"enabled: Overlays": {
|
|
291
324
|
type: "enabled: Overlays";
|
|
292
325
|
params: unknown;
|
|
@@ -299,6 +332,10 @@ export declare const fitDiagram: (params?: {
|
|
|
299
332
|
type: "is dynamic view";
|
|
300
333
|
params: unknown;
|
|
301
334
|
};
|
|
335
|
+
"is same view": {
|
|
336
|
+
type: "is same view";
|
|
337
|
+
params: unknown;
|
|
338
|
+
};
|
|
302
339
|
"is another view": {
|
|
303
340
|
type: "is another view";
|
|
304
341
|
params: unknown;
|
|
@@ -329,11 +366,6 @@ export declare const fitDiagram: (params?: {
|
|
|
329
366
|
};
|
|
330
367
|
}>, never, EmittedEvents>;
|
|
331
368
|
export declare const fitFocusedBounds: () => ActionFunction<Context, Events, Events, unknown, Values<{
|
|
332
|
-
syncManualLayoutActorLogic: {
|
|
333
|
-
src: "syncManualLayoutActorLogic";
|
|
334
|
-
logic: SyncLayoutActorLogic;
|
|
335
|
-
id: "syncLayout";
|
|
336
|
-
};
|
|
337
369
|
hotkeyActorLogic: {
|
|
338
370
|
src: "hotkeyActorLogic";
|
|
339
371
|
logic: HotkeyActorLogic;
|
|
@@ -354,11 +386,20 @@ export declare const fitFocusedBounds: () => ActionFunction<Context, Events, Eve
|
|
|
354
386
|
logic: MediaPrintActorLogic;
|
|
355
387
|
id: "mediaPrint";
|
|
356
388
|
};
|
|
389
|
+
editorActor: {
|
|
390
|
+
src: "editorActor";
|
|
391
|
+
logic: EditorActorLogic;
|
|
392
|
+
id: "editor";
|
|
393
|
+
};
|
|
357
394
|
}>, never, Values<{
|
|
358
395
|
isReady: {
|
|
359
396
|
type: "isReady";
|
|
360
397
|
params: unknown;
|
|
361
398
|
};
|
|
399
|
+
"enabled: Editor": {
|
|
400
|
+
type: "enabled: Editor";
|
|
401
|
+
params: unknown;
|
|
402
|
+
};
|
|
362
403
|
"enabled: FitView": {
|
|
363
404
|
type: "enabled: FitView";
|
|
364
405
|
params: unknown;
|
|
@@ -391,6 +432,10 @@ export declare const fitFocusedBounds: () => ActionFunction<Context, Events, Eve
|
|
|
391
432
|
type: "enabled: DynamicViewWalkthrough";
|
|
392
433
|
params: unknown;
|
|
393
434
|
};
|
|
435
|
+
"focus.node: autoUnfocus": {
|
|
436
|
+
type: "focus.node: autoUnfocus";
|
|
437
|
+
params: unknown;
|
|
438
|
+
};
|
|
394
439
|
"enabled: Overlays": {
|
|
395
440
|
type: "enabled: Overlays";
|
|
396
441
|
params: unknown;
|
|
@@ -403,6 +448,10 @@ export declare const fitFocusedBounds: () => ActionFunction<Context, Events, Eve
|
|
|
403
448
|
type: "is dynamic view";
|
|
404
449
|
params: unknown;
|
|
405
450
|
};
|
|
451
|
+
"is same view": {
|
|
452
|
+
type: "is same view";
|
|
453
|
+
params: unknown;
|
|
454
|
+
};
|
|
406
455
|
"is another view": {
|
|
407
456
|
type: "is another view";
|
|
408
457
|
params: unknown;
|
|
@@ -443,12 +492,8 @@ export declare const raiseFitDiagram: (params?: {
|
|
|
443
492
|
duration?: number;
|
|
444
493
|
bounds?: BBox;
|
|
445
494
|
}) => ActionFunction<Context, Events, Events, undefined, never, never, never, never, never>;
|
|
495
|
+
export declare const raiseUpdateView: (view?: DiagramView) => ActionFunction<Context, Events, Events, undefined, never, never, never, never, never>;
|
|
446
496
|
export declare const assignViewportBefore: (viewport?: Viewport | null) => ActionFunction<Context, Events, Events, undefined, Values<{
|
|
447
|
-
syncManualLayoutActorLogic: {
|
|
448
|
-
src: "syncManualLayoutActorLogic";
|
|
449
|
-
logic: SyncLayoutActorLogic;
|
|
450
|
-
id: "syncLayout";
|
|
451
|
-
};
|
|
452
497
|
hotkeyActorLogic: {
|
|
453
498
|
src: "hotkeyActorLogic";
|
|
454
499
|
logic: HotkeyActorLogic;
|
|
@@ -469,16 +514,16 @@ export declare const assignViewportBefore: (viewport?: Viewport | null) => Actio
|
|
|
469
514
|
logic: MediaPrintActorLogic;
|
|
470
515
|
id: "mediaPrint";
|
|
471
516
|
};
|
|
517
|
+
editorActor: {
|
|
518
|
+
src: "editorActor";
|
|
519
|
+
logic: EditorActorLogic;
|
|
520
|
+
id: "editor";
|
|
521
|
+
};
|
|
472
522
|
}>, never, never, never, never>;
|
|
473
523
|
export declare const returnViewportBefore: (params?: {
|
|
474
524
|
delay?: number;
|
|
475
525
|
duration?: number;
|
|
476
526
|
}) => ActionFunction<Context, Events, Events, undefined, Values<{
|
|
477
|
-
syncManualLayoutActorLogic: {
|
|
478
|
-
src: "syncManualLayoutActorLogic";
|
|
479
|
-
logic: SyncLayoutActorLogic;
|
|
480
|
-
id: "syncLayout";
|
|
481
|
-
};
|
|
482
527
|
hotkeyActorLogic: {
|
|
483
528
|
src: "hotkeyActorLogic";
|
|
484
529
|
logic: HotkeyActorLogic;
|
|
@@ -499,11 +544,20 @@ export declare const returnViewportBefore: (params?: {
|
|
|
499
544
|
logic: MediaPrintActorLogic;
|
|
500
545
|
id: "mediaPrint";
|
|
501
546
|
};
|
|
547
|
+
editorActor: {
|
|
548
|
+
src: "editorActor";
|
|
549
|
+
logic: EditorActorLogic;
|
|
550
|
+
id: "editor";
|
|
551
|
+
};
|
|
502
552
|
}>, never, Values<{
|
|
503
553
|
isReady: {
|
|
504
554
|
type: "isReady";
|
|
505
555
|
params: unknown;
|
|
506
556
|
};
|
|
557
|
+
"enabled: Editor": {
|
|
558
|
+
type: "enabled: Editor";
|
|
559
|
+
params: unknown;
|
|
560
|
+
};
|
|
507
561
|
"enabled: FitView": {
|
|
508
562
|
type: "enabled: FitView";
|
|
509
563
|
params: unknown;
|
|
@@ -536,6 +590,10 @@ export declare const returnViewportBefore: (params?: {
|
|
|
536
590
|
type: "enabled: DynamicViewWalkthrough";
|
|
537
591
|
params: unknown;
|
|
538
592
|
};
|
|
593
|
+
"focus.node: autoUnfocus": {
|
|
594
|
+
type: "focus.node: autoUnfocus";
|
|
595
|
+
params: unknown;
|
|
596
|
+
};
|
|
539
597
|
"enabled: Overlays": {
|
|
540
598
|
type: "enabled: Overlays";
|
|
541
599
|
params: unknown;
|
|
@@ -548,6 +606,10 @@ export declare const returnViewportBefore: (params?: {
|
|
|
548
606
|
type: "is dynamic view";
|
|
549
607
|
params: unknown;
|
|
550
608
|
};
|
|
609
|
+
"is same view": {
|
|
610
|
+
type: "is same view";
|
|
611
|
+
params: unknown;
|
|
612
|
+
};
|
|
551
613
|
"is another view": {
|
|
552
614
|
type: "is another view";
|
|
553
615
|
params: unknown;
|
|
@@ -18,7 +18,11 @@ const setViewport = (params) => machine.createAction(({ context, event }) => {
|
|
|
18
18
|
duration = duration ?? 400;
|
|
19
19
|
const { panZoom } = nonNullable(context.xystore).getState();
|
|
20
20
|
const animationProps = duration > 0 ? { duration, interpolate: "smooth" } : void 0;
|
|
21
|
-
panZoom?.setViewport(
|
|
21
|
+
panZoom?.setViewport({
|
|
22
|
+
x: Math.round(viewport.x),
|
|
23
|
+
y: Math.round(viewport.y),
|
|
24
|
+
zoom: viewport.zoom
|
|
25
|
+
}, animationProps).catch((err) => {
|
|
22
26
|
console.error("Error during fitDiagram panZoom setViewport", { err });
|
|
23
27
|
});
|
|
24
28
|
});
|
|
@@ -47,7 +51,8 @@ const fitDiagram = (params) => machine.enqueueActions(({ context, event, enqueue
|
|
|
47
51
|
);
|
|
48
52
|
viewport.x = Math.round(viewport.x);
|
|
49
53
|
viewport.y = Math.round(viewport.y);
|
|
50
|
-
|
|
54
|
+
const animationProps = duration > 0 ? { duration, interpolate: "smooth" } : void 0;
|
|
55
|
+
panZoom?.setViewport(viewport, animationProps).catch((err) => {
|
|
51
56
|
console.error("Error during fitDiagram panZoom setViewport", { err });
|
|
52
57
|
});
|
|
53
58
|
});
|
|
@@ -66,7 +71,10 @@ const fitFocusedBounds = () => machine.createAction(({ context }) => {
|
|
|
66
71
|
);
|
|
67
72
|
viewport.x = Math.round(viewport.x);
|
|
68
73
|
viewport.y = Math.round(viewport.y);
|
|
69
|
-
|
|
74
|
+
const animationProps = duration > 0 ? { duration, interpolate: "smooth" } : void 0;
|
|
75
|
+
panZoom?.setViewport(viewport, animationProps).catch((err) => {
|
|
76
|
+
console.error("Error during fitFocusedBounds panZoom setViewport", { err });
|
|
77
|
+
});
|
|
70
78
|
});
|
|
71
79
|
const DEFAULT_DELAY = 30;
|
|
72
80
|
const raiseSetViewport = (params) => {
|
|
@@ -96,6 +104,10 @@ const raiseFitDiagram = (params) => {
|
|
|
96
104
|
}
|
|
97
105
|
);
|
|
98
106
|
};
|
|
107
|
+
const raiseUpdateView = (view) => machine.raise(({ context }) => ({
|
|
108
|
+
type: "update.view",
|
|
109
|
+
view: context.view
|
|
110
|
+
}), { delay: DEFAULT_DELAY });
|
|
99
111
|
const assignViewportBefore = (viewport) => machine.assign(({ context }) => {
|
|
100
112
|
return {
|
|
101
113
|
// We can assign
|
|
@@ -126,4 +138,4 @@ const returnViewportBefore = (params) => machine.enqueueActions(({ enqueue, cont
|
|
|
126
138
|
}
|
|
127
139
|
});
|
|
128
140
|
|
|
129
|
-
export { assignViewportBefore, cancelFitDiagram, fitDiagram, fitFocusedBounds, raiseFitDiagram, raiseSetViewport, returnViewportBefore, setViewport };
|
|
141
|
+
export { assignViewportBefore, cancelFitDiagram, fitDiagram, fitFocusedBounds, raiseFitDiagram, raiseSetViewport, raiseUpdateView, returnViewportBefore, setViewport };
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { ActorRef, MachineSnapshot, StateMachine } from 'xstate';
|
|
2
|
+
import { EditorActorRef } from '../../editor/editorActor';
|
|
2
3
|
import { OverlaysActorRef } from '../../overlays/overlaysActor';
|
|
3
4
|
import { SearchActorRef } from '../../search/searchActor';
|
|
4
5
|
import { Context as DiagramContext, EmittedEvents as DiagramEmittedEvents, Events as DiagramEvents, Input } from './machine.setup';
|
|
5
|
-
import { SyncLayoutActorRef } from './syncManualLayoutActor';
|
|
6
6
|
/**
|
|
7
7
|
* Here is a trick to reduce inference types
|
|
8
8
|
*/
|
|
9
9
|
export interface DiagramMachineLogic extends StateMachine<DiagramContext, DiagramEvents, {
|
|
10
10
|
overlays: OverlaysActorRef | undefined;
|
|
11
11
|
search: SearchActorRef | undefined;
|
|
12
|
-
|
|
12
|
+
editor: EditorActorRef | undefined;
|
|
13
13
|
}, any, any, any, any, any, any, Input, any, any, any, any> {
|
|
14
14
|
}
|
|
15
15
|
export declare const diagramMachine: DiagramMachineLogic;
|
|
16
16
|
export type DiagramMachineSnapshot = MachineSnapshot<DiagramContext, DiagramEvents, {
|
|
17
17
|
overlays: OverlaysActorRef | undefined;
|
|
18
18
|
search: SearchActorRef | undefined;
|
|
19
|
-
|
|
19
|
+
editor: EditorActorRef | undefined;
|
|
20
20
|
}, any, any, any, {}, {}>;
|
|
21
|
-
export
|
|
21
|
+
export interface DiagramMachineRef extends ActorRef<DiagramMachineSnapshot, DiagramEvents, DiagramEmittedEvents> {
|
|
22
|
+
}
|
|
22
23
|
export type { DiagramContext, DiagramEmittedEvents, DiagramEvents, };
|
|
@@ -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,
|
|
4
|
+
import { emitOnLayoutTypeChange, triggerChange, updateFeatures, updateInputs, assignDynamicViewVariant, stopEditorActor } 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 { cancelFitDiagram } from './machine.actions.layout.js';
|
|
11
|
+
import { raiseUpdateView, cancelFitDiagram } from './machine.actions.layout.js';
|
|
12
12
|
|
|
13
13
|
const _diagramMachine = machine.createMachine({
|
|
14
14
|
initial: "initializing",
|
|
@@ -29,6 +29,7 @@ const _diagramMachine = machine.createMachine({
|
|
|
29
29
|
lastOnNavigate: null,
|
|
30
30
|
lastClickedNode: null,
|
|
31
31
|
focusedNode: null,
|
|
32
|
+
autoUnfocusTimer: false,
|
|
32
33
|
activeElementDetails: null,
|
|
33
34
|
viewportBefore: null,
|
|
34
35
|
viewportOnManualLayout: null,
|
|
@@ -50,7 +51,7 @@ const _diagramMachine = machine.createMachine({
|
|
|
50
51
|
final: {
|
|
51
52
|
type: "final",
|
|
52
53
|
entry: [
|
|
53
|
-
|
|
54
|
+
stopEditorActor(),
|
|
54
55
|
cancelFitDiagram(),
|
|
55
56
|
xstateActions_cjsExports.stopChild("hotkey"),
|
|
56
57
|
xstateActions_cjsExports.stopChild("overlays"),
|
|
@@ -77,7 +78,11 @@ const _diagramMachine = machine.createMachine({
|
|
|
77
78
|
actions: xstateActions_cjsExports.assign(updateEdgeData)
|
|
78
79
|
},
|
|
79
80
|
"switch.dynamicViewVariant": {
|
|
80
|
-
|
|
81
|
+
guard: ({ context, event }) => context.dynamicViewVariant !== event.variant,
|
|
82
|
+
actions: [
|
|
83
|
+
assignDynamicViewVariant(),
|
|
84
|
+
raiseUpdateView()
|
|
85
|
+
]
|
|
81
86
|
},
|
|
82
87
|
"update.inputs": {
|
|
83
88
|
actions: updateInputs()
|
|
@@ -95,8 +100,8 @@ const _diagramMachine = machine.createMachine({
|
|
|
95
100
|
"update.features": {
|
|
96
101
|
actions: updateFeatures()
|
|
97
102
|
},
|
|
98
|
-
"
|
|
99
|
-
actions:
|
|
103
|
+
"trigger.change": {
|
|
104
|
+
actions: triggerChange()
|
|
100
105
|
},
|
|
101
106
|
"emit.onLayoutTypeChange": {
|
|
102
107
|
actions: emitOnLayoutTypeChange()
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BBox } from '@likec4/core';
|
|
2
|
-
import { DiagramEdge, DiagramNode, DiagramView, DynamicViewDisplayVariant, EdgeId, Fqn, LayoutType, NodeId, NodeNotation as ElementNotation, StepEdgeId, ViewChange, ViewId } from '@likec4/core/types';
|
|
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';
|
|
5
5
|
import { PartialDeep } from 'type-fest';
|
|
@@ -11,9 +11,9 @@ import { AlignmentMode } from './aligners';
|
|
|
11
11
|
import { HotKeyEvent, HotkeyActorLogic } from './hotkeyActor';
|
|
12
12
|
import { MediaPrintEvent, MediaPrintActorLogic } from './mediaPrintActor';
|
|
13
13
|
import { SetupReturn, NonReducibleUnknown, MetaObject } from 'xstate';
|
|
14
|
-
import { SyncLayoutActorLogic } from './syncManualLayoutActor';
|
|
15
14
|
import { OverlaysActorLogic } from '../../overlays/overlaysActor';
|
|
16
15
|
import { SearchActorLogic } from '../../search/searchActor';
|
|
16
|
+
import { EditorActorLogic } from '../../editor';
|
|
17
17
|
/**
|
|
18
18
|
* Navigation history entry represents a current view state,
|
|
19
19
|
* including viewport, focused node, dynamic view variant, etc.
|
|
@@ -42,6 +42,7 @@ export interface Input {
|
|
|
42
42
|
nodesDraggable: boolean;
|
|
43
43
|
nodesSelectable: boolean;
|
|
44
44
|
fitViewPadding: ViewPaddings;
|
|
45
|
+
where: WhereOperator | null;
|
|
45
46
|
dynamicViewVariant?: DynamicViewDisplayVariant | undefined;
|
|
46
47
|
}
|
|
47
48
|
export type ToggledFeatures = {
|
|
@@ -71,6 +72,7 @@ export interface Context extends Input {
|
|
|
71
72
|
fromView: ViewId;
|
|
72
73
|
toView: ViewId;
|
|
73
74
|
fromNode: NodeId | null;
|
|
75
|
+
focusOnElement?: Fqn | null;
|
|
74
76
|
};
|
|
75
77
|
navigationHistory: NavigationHistory;
|
|
76
78
|
lastClickedNode: null | {
|
|
@@ -79,6 +81,7 @@ export interface Context extends Input {
|
|
|
79
81
|
timestamp: number;
|
|
80
82
|
};
|
|
81
83
|
focusedNode: NodeId | null;
|
|
84
|
+
autoUnfocusTimer: boolean;
|
|
82
85
|
activeElementDetails: null | {
|
|
83
86
|
fqn: Fqn;
|
|
84
87
|
fromNode: NodeId | null;
|
|
@@ -153,9 +156,13 @@ export type Events = HotKeyEvent | MediaPrintEvent | {
|
|
|
153
156
|
} | {
|
|
154
157
|
type: 'update.view';
|
|
155
158
|
view: DiagramView;
|
|
159
|
+
source?: 'editor' | 'external';
|
|
160
|
+
} | {
|
|
161
|
+
type: 'update.view';
|
|
162
|
+
view: DiagramView;
|
|
163
|
+
source?: 'editor' | 'external';
|
|
156
164
|
xynodes: Types.Node[];
|
|
157
165
|
xyedges: Types.Edge[];
|
|
158
|
-
source?: 'internal' | 'external';
|
|
159
166
|
} | {
|
|
160
167
|
type: 'update.view-bounds';
|
|
161
168
|
bounds: BBox;
|
|
@@ -189,6 +196,7 @@ export type Events = HotKeyEvent | MediaPrintEvent | {
|
|
|
189
196
|
type: 'navigate.to';
|
|
190
197
|
viewId: ViewId;
|
|
191
198
|
fromNode?: NodeId | undefined;
|
|
199
|
+
focusOnElement?: Fqn | undefined;
|
|
192
200
|
} | {
|
|
193
201
|
type: 'navigate.back';
|
|
194
202
|
} | {
|
|
@@ -203,6 +211,9 @@ export type Events = HotKeyEvent | MediaPrintEvent | {
|
|
|
203
211
|
} | {
|
|
204
212
|
type: 'focus.node';
|
|
205
213
|
nodeId: NodeId;
|
|
214
|
+
autoUnfocus?: boolean;
|
|
215
|
+
} | {
|
|
216
|
+
type: 'focus.autoUnfocus';
|
|
206
217
|
} | {
|
|
207
218
|
type: 'switch.dynamicViewVariant';
|
|
208
219
|
variant: DynamicViewDisplayVariant;
|
|
@@ -230,7 +241,7 @@ export type Events = HotKeyEvent | MediaPrintEvent | {
|
|
|
230
241
|
feature: TogglableFeature;
|
|
231
242
|
forceValue?: boolean;
|
|
232
243
|
} | {
|
|
233
|
-
type: '
|
|
244
|
+
type: 'trigger.change';
|
|
234
245
|
change: ViewChange;
|
|
235
246
|
} | {
|
|
236
247
|
type: 'emit.onLayoutTypeChange';
|
|
@@ -273,9 +284,6 @@ export type EmittedEvents = {
|
|
|
273
284
|
edge: Types.Edge;
|
|
274
285
|
} | {
|
|
275
286
|
type: 'walkthroughStopped';
|
|
276
|
-
} | {
|
|
277
|
-
type: 'onChange';
|
|
278
|
-
change: ViewChange;
|
|
279
287
|
} | {
|
|
280
288
|
type: 'onLayoutTypeChange';
|
|
281
289
|
layoutType: LayoutType;
|
|
@@ -286,19 +294,20 @@ export type ActionArg = {
|
|
|
286
294
|
};
|
|
287
295
|
export declare const deriveToggledFeatures: (context: Context) => Required<ToggledFeatures>;
|
|
288
296
|
export declare const machine: SetupReturn<Context, Events, {
|
|
289
|
-
syncManualLayoutActorLogic: SyncLayoutActorLogic;
|
|
290
297
|
hotkeyActorLogic: HotkeyActorLogic;
|
|
291
298
|
overlaysActorLogic: OverlaysActorLogic;
|
|
292
299
|
searchActorLogic: SearchActorLogic;
|
|
293
300
|
mediaPrintActorLogic: MediaPrintActorLogic;
|
|
301
|
+
editorActor: EditorActorLogic;
|
|
294
302
|
}, {
|
|
295
|
-
syncLayout: "syncManualLayoutActorLogic";
|
|
296
303
|
hotkey: "hotkeyActorLogic";
|
|
297
304
|
overlays: "overlaysActorLogic";
|
|
298
305
|
search: "searchActorLogic";
|
|
299
306
|
mediaPrint: "mediaPrintActorLogic";
|
|
307
|
+
editor: "editorActor";
|
|
300
308
|
}, {}, {
|
|
301
309
|
isReady: unknown;
|
|
310
|
+
'enabled: Editor': unknown;
|
|
302
311
|
'enabled: FitView': unknown;
|
|
303
312
|
'enabled: FocusMode': unknown;
|
|
304
313
|
'enabled: Readonly': unknown;
|
|
@@ -307,9 +316,11 @@ export declare const machine: SetupReturn<Context, Events, {
|
|
|
307
316
|
'enabled: ElementDetails': unknown;
|
|
308
317
|
'enabled: OpenSource': unknown;
|
|
309
318
|
'enabled: DynamicViewWalkthrough': unknown;
|
|
319
|
+
'focus.node: autoUnfocus': unknown;
|
|
310
320
|
'enabled: Overlays': unknown;
|
|
311
321
|
'not readonly': unknown;
|
|
312
322
|
'is dynamic view': unknown;
|
|
323
|
+
'is same view': unknown;
|
|
313
324
|
'is another view': unknown;
|
|
314
325
|
'click: node has modelFqn': unknown;
|
|
315
326
|
'click: selected node': unknown;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { nonexhaustive } from '@likec4/core';
|
|
2
2
|
import { isTruthy } from 'remeda';
|
|
3
3
|
import { setup, assertEvent } from 'xstate';
|
|
4
|
+
import { editorActorLogic } from '../../editor/editorActor.js';
|
|
4
5
|
import { overlaysActorLogic } from '../../overlays/overlaysActor.js';
|
|
5
6
|
import { searchActorLogic } from '../../search/searchActor.js';
|
|
6
7
|
import { hotkeyActorLogic } from './hotkeyActor.js';
|
|
7
8
|
import { mediaPrintActorLogic } from './mediaPrintActor.js';
|
|
8
|
-
import { syncManualLayoutActorLogic } from './syncManualLayoutActor.js';
|
|
9
9
|
|
|
10
10
|
const deriveToggledFeatures = (context) => {
|
|
11
11
|
let toggledFeatures = context.toggledFeatures;
|
|
@@ -27,14 +27,15 @@ const machine = setup({
|
|
|
27
27
|
emitted: {}
|
|
28
28
|
},
|
|
29
29
|
actors: {
|
|
30
|
-
syncManualLayoutActorLogic,
|
|
31
30
|
hotkeyActorLogic,
|
|
32
31
|
overlaysActorLogic,
|
|
33
32
|
searchActorLogic,
|
|
34
|
-
mediaPrintActorLogic
|
|
33
|
+
mediaPrintActorLogic,
|
|
34
|
+
editorActor: editorActorLogic
|
|
35
35
|
},
|
|
36
36
|
guards: {
|
|
37
37
|
"isReady": ({ context }) => context.initialized.xydata && context.initialized.xyflow,
|
|
38
|
+
"enabled: Editor": ({ context }) => context.features.enableEditor,
|
|
38
39
|
"enabled: FitView": ({ context }) => context.features.enableFitView,
|
|
39
40
|
"enabled: FocusMode": ({ context }) => context.features.enableFocusMode && isReadOnly(context),
|
|
40
41
|
"enabled: Readonly": ({ context }) => isReadOnly(context),
|
|
@@ -43,9 +44,23 @@ const machine = setup({
|
|
|
43
44
|
"enabled: ElementDetails": ({ context }) => context.features.enableElementDetails,
|
|
44
45
|
"enabled: OpenSource": ({ context }) => context.features.enableVscode,
|
|
45
46
|
"enabled: DynamicViewWalkthrough": ({ context }) => context.features.enableDynamicViewWalkthrough,
|
|
47
|
+
"focus.node: autoUnfocus": ({ event }) => {
|
|
48
|
+
assertEvent(event, "focus.node");
|
|
49
|
+
return event.autoUnfocus === true;
|
|
50
|
+
},
|
|
46
51
|
"enabled: Overlays": ({ context }) => context.features.enableElementDetails || context.features.enableRelationshipBrowser || context.features.enableRelationshipDetails,
|
|
47
52
|
"not readonly": ({ context }) => !isReadOnly(context),
|
|
48
53
|
"is dynamic view": ({ context }) => context.view._type === "dynamic",
|
|
54
|
+
"is same view": ({ context, event }) => {
|
|
55
|
+
assertEvent(event, ["update.view", "navigate.to"]);
|
|
56
|
+
if (event.type === "update.view") {
|
|
57
|
+
return context.view.id === event.view.id;
|
|
58
|
+
}
|
|
59
|
+
if (event.type === "navigate.to") {
|
|
60
|
+
return context.view.id === event.viewId;
|
|
61
|
+
}
|
|
62
|
+
nonexhaustive(event.type);
|
|
63
|
+
},
|
|
49
64
|
"is another view": ({ context, event }) => {
|
|
50
65
|
assertEvent(event, ["update.view", "navigate.to"]);
|
|
51
66
|
if (event.type === "update.view") {
|