@likec4/diagram 1.45.0 → 1.46.2
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 +2488 -1959
- 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/base-primitives/memoNode.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/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/createReactComponent.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertTriangle.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowDownRight.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowLeft.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowRight.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconBolt.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconBrowser.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronDown.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronLeft.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronRight.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconCylinder.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconDeviceMobile.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconDirectionSignFilled.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconExternalLink.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconFileSymlink.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconFocusCentered.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconFolderFilled.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconHelpCircle.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconId.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconInfoCircle.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignBottom.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignCenter.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignLeft.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignMiddle.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignRight.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignTop.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutBoardSplit.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutCollage.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutDashboard.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconLink.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconLock.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconLockOpen2.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerPlayFilled.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipBackFilled.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipForwardFilled.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerStopFilled.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconRectangularPrism.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconReorder.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconRouteOff.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconSearch.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconSelector.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconStack2.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconStarFilled.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconTarget.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconTransform.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconUser.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconX.js +1 -1
- package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconZoomScan.js +1 -1
- package/dist/overlays/Overlays.js +23 -11
- package/dist/overlays/element-details/ElementDetailsCard.css.js +8 -11
- 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 -5
- 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 +16 -11
- 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 +14 -9
- package/dist/search/components/utils.d.ts +6 -0
- package/dist/search/components/utils.js +4 -1
- 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 +22 -22
- package/panda.buildinfo.json +61 -80
- 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
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { nonNullable, nonexhaustive, invariant } from '@likec4/core';
|
|
2
2
|
import { nodeToRect } from '@xyflow/system';
|
|
3
3
|
import { produce } from 'immer';
|
|
4
|
-
import {
|
|
4
|
+
import { hasAtLeast, isTruthy } from 'remeda';
|
|
5
5
|
import { assertEvent } from 'xstate';
|
|
6
|
+
import { convertToXYFlow } from '../convert-to-xyflow.js';
|
|
6
7
|
import { createLayoutConstraints } from '../useLayoutConstraints.js';
|
|
7
8
|
import { getAligner, toNodeRect } from './aligners.js';
|
|
8
9
|
import { resetEdgeControlPoints, mergeXYNodesEdges, focusNodesEdges } from './assign.js';
|
|
9
|
-
import {
|
|
10
|
+
import { setViewport, cancelFitDiagram, raiseFitDiagram } from './machine.actions.layout.js';
|
|
11
|
+
export { assignViewportBefore, fitDiagram, fitFocusedBounds, raiseSetViewport, raiseUpdateView, returnViewportBefore } from './machine.actions.layout.js';
|
|
10
12
|
import { machine } from './machine.setup.js';
|
|
11
13
|
import { typedSystem, findDiagramEdge, findDiagramNode } from './utils.js';
|
|
12
14
|
import { Base } from '../../base/Base.js';
|
|
@@ -68,18 +70,21 @@ const assignLastClickedNode = () => machine.assign(({ context, event }) => {
|
|
|
68
70
|
});
|
|
69
71
|
const assignFocusedNode = () => machine.assign(({ event }) => {
|
|
70
72
|
let focusedNode;
|
|
73
|
+
let autoUnfocusTimer = false;
|
|
71
74
|
switch (event.type) {
|
|
72
75
|
case "xyflow.nodeClick":
|
|
73
76
|
focusedNode = event.node.data.id;
|
|
74
77
|
break;
|
|
75
78
|
case "focus.node":
|
|
76
79
|
focusedNode = event.nodeId;
|
|
80
|
+
autoUnfocusTimer = event.autoUnfocus === true;
|
|
77
81
|
break;
|
|
78
82
|
default:
|
|
79
83
|
throw new Error(`Unexpected event type: ${event.type} in action 'assign: focusedNode'`);
|
|
80
84
|
}
|
|
81
85
|
return {
|
|
82
|
-
focusedNode
|
|
86
|
+
focusedNode,
|
|
87
|
+
autoUnfocusTimer
|
|
83
88
|
};
|
|
84
89
|
});
|
|
85
90
|
const resetLastClickedNode = () => machine.assign(() => ({
|
|
@@ -95,11 +100,19 @@ const updateInputs = () => machine.assign(({ event }) => {
|
|
|
95
100
|
assertEvent(event, "update.inputs");
|
|
96
101
|
return { ...event.inputs };
|
|
97
102
|
});
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
+
const assignXYDataFromView = (view) => machine.assign(({ context, event }) => {
|
|
104
|
+
let xydata;
|
|
105
|
+
{
|
|
106
|
+
assertEvent(event, "update.view");
|
|
107
|
+
xydata = "xynodes" in event ? event : convertToXYFlow({
|
|
108
|
+
dynamicViewVariant: context.dynamicViewVariant,
|
|
109
|
+
view: event.view,
|
|
110
|
+
where: context.where
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
const update = mergeXYNodesEdges(context, xydata);
|
|
114
|
+
let { lastClickedNode, focusedNode, activeWalkthrough } = context;
|
|
115
|
+
if (lastClickedNode || focusedNode || activeWalkthrough) {
|
|
103
116
|
const nodeIds = new Set(update.xynodes.map((n) => n.id));
|
|
104
117
|
if (lastClickedNode && !nodeIds.has(lastClickedNode.id)) {
|
|
105
118
|
lastClickedNode = null;
|
|
@@ -107,15 +120,27 @@ const updateXYNodesEdges = () => machine.assign(({ context, event }) => {
|
|
|
107
120
|
if (focusedNode && !nodeIds.has(focusedNode)) {
|
|
108
121
|
focusedNode = null;
|
|
109
122
|
}
|
|
123
|
+
const stepId = activeWalkthrough?.stepId;
|
|
124
|
+
if (stepId && !update.xyedges.some((e) => e.id === stepId)) {
|
|
125
|
+
activeWalkthrough = null;
|
|
126
|
+
}
|
|
110
127
|
return {
|
|
111
128
|
...update,
|
|
112
129
|
lastClickedNode,
|
|
113
|
-
focusedNode
|
|
130
|
+
focusedNode,
|
|
131
|
+
activeWalkthrough
|
|
114
132
|
};
|
|
115
133
|
}
|
|
116
134
|
return update;
|
|
117
135
|
});
|
|
118
|
-
const focusOnNodesAndEdges = () => machine.
|
|
136
|
+
const focusOnNodesAndEdges = () => machine.enqueueActions(({ context, enqueue }) => {
|
|
137
|
+
const next = focusNodesEdges(context);
|
|
138
|
+
if (next) {
|
|
139
|
+
enqueue.assign(next);
|
|
140
|
+
} else {
|
|
141
|
+
enqueue.raise({ type: "key.esc" });
|
|
142
|
+
}
|
|
143
|
+
});
|
|
119
144
|
const undimEverything = () => machine.assign(({ context }) => ({
|
|
120
145
|
xynodes: context.xynodes.map(Base.setDimmed(false)),
|
|
121
146
|
xyedges: context.xyedges.map(Base.setData({
|
|
@@ -204,15 +229,22 @@ const emitEdgeClick = () => machine.emit(({ context, event }) => {
|
|
|
204
229
|
xyedge: event.edge
|
|
205
230
|
};
|
|
206
231
|
});
|
|
207
|
-
const
|
|
208
|
-
|
|
232
|
+
const triggerChange = (viewChange) => machine.enqueueActions(({ event, enqueue }) => {
|
|
233
|
+
let change = viewChange;
|
|
234
|
+
if (!change) {
|
|
235
|
+
assertEvent(event, "trigger.change");
|
|
236
|
+
change = event.change;
|
|
237
|
+
}
|
|
209
238
|
enqueue.assign({
|
|
210
239
|
viewportChangedManually: true
|
|
211
240
|
});
|
|
212
|
-
enqueue.
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
241
|
+
enqueue.sendTo(
|
|
242
|
+
typedSystem.editorActor,
|
|
243
|
+
{
|
|
244
|
+
type: "change",
|
|
245
|
+
change
|
|
246
|
+
}
|
|
247
|
+
);
|
|
216
248
|
});
|
|
217
249
|
const emitOnLayoutTypeChange = () => machine.enqueueActions(({ event, system, context, enqueue }) => {
|
|
218
250
|
if (!context.features.enableCompareWithLatest) {
|
|
@@ -230,16 +262,9 @@ const emitOnLayoutTypeChange = () => machine.enqueueActions(({ event, system, co
|
|
|
230
262
|
}
|
|
231
263
|
if (context.toggledFeatures.enableCompareWithLatest === true) {
|
|
232
264
|
if (currentLayoutType === "manual" && nextLayoutType === "auto") {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
if (isPending) {
|
|
237
|
-
enqueue.sendTo(syncLayoutActor, { type: "cancel" });
|
|
238
|
-
enqueue.emit({
|
|
239
|
-
type: "onChange",
|
|
240
|
-
change: createViewChange(context)
|
|
241
|
-
});
|
|
242
|
-
}
|
|
265
|
+
typedSystem(system).editorActorRef?.send({
|
|
266
|
+
type: "cancel"
|
|
267
|
+
});
|
|
243
268
|
}
|
|
244
269
|
const currentViewport = context.viewport;
|
|
245
270
|
if (currentLayoutType === "auto") {
|
|
@@ -308,26 +333,20 @@ const resetEdgesControlPoints = () => machine.assign(({ context }) => {
|
|
|
308
333
|
})
|
|
309
334
|
};
|
|
310
335
|
});
|
|
311
|
-
const notationsHighlight = (
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
};
|
|
317
|
-
}
|
|
318
|
-
const notation = params.notation;
|
|
319
|
-
const kinds = params.kind ? [params.kind] : notation.kinds;
|
|
336
|
+
const notationsHighlight = () => machine.assign(({ context, event }) => {
|
|
337
|
+
assertEvent(event, "notations.highlight");
|
|
338
|
+
const { notation, kind } = event;
|
|
339
|
+
const targetKinds = kind ? [kind] : notation.kinds;
|
|
340
|
+
const shouldHighlight = (node) => node.notation === notation.title && node.shape === notation.shape && node.color === notation.color && targetKinds.includes(node.kind);
|
|
320
341
|
const xynodes = context.xynodes.map((n) => {
|
|
321
342
|
const node = findDiagramNode(context, n.id);
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
}
|
|
325
|
-
return Base.setDimmed(n, "immediate");
|
|
343
|
+
const highlighted = node && shouldHighlight(node);
|
|
344
|
+
return Base.setDimmed(n, highlighted ? false : "immediate");
|
|
326
345
|
});
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
};
|
|
346
|
+
const xyedges = context.xyedges.map((edge) => {
|
|
347
|
+
return Base.setDimmed(edge, true);
|
|
348
|
+
});
|
|
349
|
+
return { xynodes, xyedges };
|
|
331
350
|
});
|
|
332
351
|
const tagHighlight = () => machine.assign(({ context, event }) => {
|
|
333
352
|
assertEvent(event, "tag.highlight");
|
|
@@ -352,33 +371,33 @@ const assignToggledFeatures = () => machine.assign(({ context, event }) => {
|
|
|
352
371
|
};
|
|
353
372
|
});
|
|
354
373
|
const closeSearch = () => machine.sendTo(
|
|
355
|
-
|
|
374
|
+
typedSystem.searchActor,
|
|
356
375
|
{
|
|
357
376
|
type: "close"
|
|
358
377
|
}
|
|
359
378
|
);
|
|
360
379
|
const closeAllOverlays = () => machine.sendTo(
|
|
361
|
-
|
|
380
|
+
typedSystem.overlaysActor,
|
|
362
381
|
{
|
|
363
382
|
type: "close.all"
|
|
364
383
|
}
|
|
365
384
|
);
|
|
366
|
-
const
|
|
367
|
-
const
|
|
368
|
-
if (!
|
|
369
|
-
enqueue.stopChild(
|
|
370
|
-
});
|
|
371
|
-
const
|
|
372
|
-
const
|
|
373
|
-
const
|
|
374
|
-
if (
|
|
375
|
-
enqueue.stopChild(
|
|
385
|
+
const stopEditorActor = () => machine.enqueueActions(({ enqueue, system }) => {
|
|
386
|
+
const actor = typedSystem(system).editorActorRef;
|
|
387
|
+
if (!actor) return;
|
|
388
|
+
enqueue.stopChild(actor);
|
|
389
|
+
});
|
|
390
|
+
const ensureEditorActor = () => machine.enqueueActions(({ enqueue, context, system, check }) => {
|
|
391
|
+
const hasEditor = check("enabled: Editor");
|
|
392
|
+
const editor = typedSystem(system).editorActorRef;
|
|
393
|
+
if (!hasEditor && editor) {
|
|
394
|
+
enqueue.stopChild(editor);
|
|
376
395
|
return;
|
|
377
396
|
}
|
|
378
|
-
if (
|
|
379
|
-
enqueue.spawnChild("
|
|
380
|
-
id: "
|
|
381
|
-
systemId: "
|
|
397
|
+
if (hasEditor && !editor) {
|
|
398
|
+
enqueue.spawnChild("editorActor", {
|
|
399
|
+
id: "editor",
|
|
400
|
+
systemId: "editor",
|
|
382
401
|
input: {
|
|
383
402
|
viewId: context.view.id
|
|
384
403
|
},
|
|
@@ -387,33 +406,33 @@ const ensureSyncLayoutActor = () => machine.enqueueActions(({ context, enqueue,
|
|
|
387
406
|
}
|
|
388
407
|
});
|
|
389
408
|
const startEditing = (subject = "node") => machine.sendTo(
|
|
390
|
-
|
|
409
|
+
typedSystem.editorActor,
|
|
391
410
|
{
|
|
392
|
-
type: "
|
|
411
|
+
type: "edit.start",
|
|
393
412
|
subject
|
|
394
413
|
}
|
|
395
414
|
);
|
|
396
415
|
const sendSynced = () => machine.sendTo(
|
|
397
|
-
|
|
416
|
+
typedSystem.editorActor,
|
|
398
417
|
{
|
|
399
418
|
type: "synced"
|
|
400
419
|
}
|
|
401
420
|
);
|
|
402
421
|
const stopEditing = (wasChanged = true) => machine.sendTo(
|
|
403
|
-
|
|
422
|
+
typedSystem.editorActor,
|
|
404
423
|
{
|
|
405
|
-
type: "
|
|
424
|
+
type: "edit.finish",
|
|
406
425
|
wasChanged
|
|
407
426
|
}
|
|
408
427
|
);
|
|
409
428
|
const cancelEditing = () => machine.sendTo(
|
|
410
|
-
|
|
429
|
+
typedSystem.editorActor,
|
|
411
430
|
{
|
|
412
431
|
type: "cancel"
|
|
413
432
|
}
|
|
414
433
|
);
|
|
415
434
|
const hasModelFqn = (node) => "modelFqn" in node.data && isTruthy(node.data.modelFqn);
|
|
416
|
-
const openElementDetails = (params) => machine.enqueueActions(({ context, event, enqueue
|
|
435
|
+
const openElementDetails = (params) => machine.enqueueActions(({ context, event, enqueue }) => {
|
|
417
436
|
let initiatedFrom = null;
|
|
418
437
|
let fromNodeId, subject;
|
|
419
438
|
switch (true) {
|
|
@@ -467,7 +486,7 @@ const openElementDetails = (params) => machine.enqueueActions(({ context, event,
|
|
|
467
486
|
};
|
|
468
487
|
}
|
|
469
488
|
enqueue.sendTo(
|
|
470
|
-
typedSystem
|
|
489
|
+
typedSystem.overlaysActor,
|
|
471
490
|
{
|
|
472
491
|
type: "open.elementDetails",
|
|
473
492
|
subject,
|
|
@@ -476,6 +495,47 @@ const openElementDetails = (params) => machine.enqueueActions(({ context, event,
|
|
|
476
495
|
}
|
|
477
496
|
);
|
|
478
497
|
});
|
|
498
|
+
const openOverlay = () => machine.enqueueActions(({ context, event, enqueue, check }) => {
|
|
499
|
+
assertEvent(event, ["open.relationshipsBrowser", "open.relationshipDetails", "open.elementDetails"]);
|
|
500
|
+
if (!check("enabled: Overlays")) {
|
|
501
|
+
console.warn("Overlays feature is disabled");
|
|
502
|
+
return;
|
|
503
|
+
}
|
|
504
|
+
switch (event.type) {
|
|
505
|
+
case "open.elementDetails": {
|
|
506
|
+
check("enabled: ElementDetails") ? enqueue(openElementDetails()) : console.warn("ElementDetails feature is disabled");
|
|
507
|
+
break;
|
|
508
|
+
}
|
|
509
|
+
case "open.relationshipsBrowser": {
|
|
510
|
+
enqueue.sendTo(
|
|
511
|
+
typedSystem.overlaysActor,
|
|
512
|
+
{
|
|
513
|
+
type: "open.relationshipsBrowser",
|
|
514
|
+
subject: event.fqn,
|
|
515
|
+
viewId: context.view.id,
|
|
516
|
+
scope: "view",
|
|
517
|
+
closeable: true,
|
|
518
|
+
enableChangeScope: true,
|
|
519
|
+
enableSelectSubject: true
|
|
520
|
+
}
|
|
521
|
+
);
|
|
522
|
+
break;
|
|
523
|
+
}
|
|
524
|
+
case "open.relationshipDetails": {
|
|
525
|
+
enqueue.sendTo(
|
|
526
|
+
typedSystem.overlaysActor,
|
|
527
|
+
{
|
|
528
|
+
type: "open.relationshipDetails",
|
|
529
|
+
viewId: context.view.id,
|
|
530
|
+
...event.params
|
|
531
|
+
}
|
|
532
|
+
);
|
|
533
|
+
break;
|
|
534
|
+
}
|
|
535
|
+
default:
|
|
536
|
+
nonexhaustive(event);
|
|
537
|
+
}
|
|
538
|
+
});
|
|
479
539
|
const openSourceOfFocusedOrLastClickedNode = () => machine.enqueueActions(({ context, enqueue }) => {
|
|
480
540
|
const nodeId = context.focusedNode ?? context.lastClickedNode?.id;
|
|
481
541
|
if (!nodeId || !context.features.enableVscode) return;
|
|
@@ -552,9 +612,15 @@ const onEdgeMouseLeave = () => machine.enqueueActions(({ enqueue, context, event
|
|
|
552
612
|
});
|
|
553
613
|
const startHotKeyActor = () => machine.spawnChild("hotkeyActorLogic", { id: "hotkey" });
|
|
554
614
|
const stopHotKeyActor = () => machine.stopChild("hotkey");
|
|
615
|
+
const AUTO_UNFOCUS_DELAY = 3e3;
|
|
616
|
+
const startAutoUnfocusTimer = () => machine.enqueueActions(({ context, enqueue }) => {
|
|
617
|
+
if (context.autoUnfocusTimer && AUTO_UNFOCUS_DELAY > 0) {
|
|
618
|
+
enqueue.raise({ type: "focus.autoUnfocus" }, { delay: AUTO_UNFOCUS_DELAY, id: "autoUnfocusTimer" });
|
|
619
|
+
}
|
|
620
|
+
});
|
|
621
|
+
const cancelAutoUnfocusTimer = () => machine.cancel("autoUnfocusTimer");
|
|
555
622
|
const handleNavigate = () => machine.enqueueActions(({ enqueue, context, event }) => {
|
|
556
623
|
assertEvent(event, ["navigate.to", "navigate.back", "navigate.forward"]);
|
|
557
|
-
console.log(`Handle ${event.type}`);
|
|
558
624
|
const {
|
|
559
625
|
view,
|
|
560
626
|
focusedNode,
|
|
@@ -589,10 +655,6 @@ const handleNavigate = () => machine.enqueueActions(({ enqueue, context, event }
|
|
|
589
655
|
});
|
|
590
656
|
history = [..._history];
|
|
591
657
|
history[currentIndex] = updatedEntry;
|
|
592
|
-
console.log("Update current history entry", {
|
|
593
|
-
before: _history[currentIndex],
|
|
594
|
-
after: updatedEntry
|
|
595
|
-
});
|
|
596
658
|
}
|
|
597
659
|
switch (event.type) {
|
|
598
660
|
case "navigate.to": {
|
|
@@ -604,7 +666,8 @@ const handleNavigate = () => machine.enqueueActions(({ enqueue, context, event }
|
|
|
604
666
|
lastOnNavigate: {
|
|
605
667
|
fromView: context.view.id,
|
|
606
668
|
toView: event.viewId,
|
|
607
|
-
fromNode: event.fromNode ?? null
|
|
669
|
+
fromNode: event.fromNode ?? null,
|
|
670
|
+
focusOnElement: event.focusOnElement ?? null
|
|
608
671
|
}
|
|
609
672
|
});
|
|
610
673
|
enqueue(emitNavigateTo());
|
|
@@ -640,5 +703,53 @@ const handleNavigate = () => machine.enqueueActions(({ enqueue, context, event }
|
|
|
640
703
|
nonexhaustive(event);
|
|
641
704
|
}
|
|
642
705
|
});
|
|
706
|
+
const updateView = () => machine.enqueueActions(
|
|
707
|
+
({ enqueue, event, context }) => {
|
|
708
|
+
if (event.type !== "update.view") {
|
|
709
|
+
console.warn(`Ignoring unexpected event type: ${event.type} in action 'update.view'`);
|
|
710
|
+
return;
|
|
711
|
+
}
|
|
712
|
+
const nextView = event.view;
|
|
713
|
+
const isAnotherView = nextView.id !== context.view.id;
|
|
714
|
+
if (isAnotherView) {
|
|
715
|
+
console.warn("updateView called for another view - ignoring", { event });
|
|
716
|
+
return;
|
|
717
|
+
}
|
|
718
|
+
enqueue(assignXYDataFromView());
|
|
719
|
+
if (event.source === "editor") {
|
|
720
|
+
return;
|
|
721
|
+
}
|
|
722
|
+
enqueue(sendSynced());
|
|
723
|
+
let recenter = !context.viewportChangedManually && !context.focusedNode && !context.activeWalkthrough;
|
|
724
|
+
if (context.toggledFeatures.enableCompareWithLatest === true && context.view._layout !== nextView._layout) {
|
|
725
|
+
if (nextView._layout === "auto" && context.viewportOnAutoLayout) {
|
|
726
|
+
enqueue(
|
|
727
|
+
setViewport({
|
|
728
|
+
viewport: context.viewportOnAutoLayout,
|
|
729
|
+
duration: 0
|
|
730
|
+
})
|
|
731
|
+
);
|
|
732
|
+
return;
|
|
733
|
+
}
|
|
734
|
+
if (nextView._layout === "manual" && context.viewportOnManualLayout) {
|
|
735
|
+
enqueue(
|
|
736
|
+
setViewport({
|
|
737
|
+
viewport: context.viewportOnManualLayout,
|
|
738
|
+
duration: 0
|
|
739
|
+
})
|
|
740
|
+
);
|
|
741
|
+
return;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
recenter = recenter || nextView._type === "dynamic" && context.view._type === "dynamic" && nextView.variant !== context.view.variant;
|
|
745
|
+
recenter = recenter || context.toggledFeatures.enableCompareWithLatest === true && !!nextView._layout && context.view._layout !== nextView._layout;
|
|
746
|
+
if (recenter) {
|
|
747
|
+
enqueue(cancelFitDiagram());
|
|
748
|
+
enqueue(raiseFitDiagram({
|
|
749
|
+
bounds: event.view.bounds
|
|
750
|
+
}));
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
);
|
|
643
754
|
|
|
644
|
-
export { assignDynamicViewVariant, assignFocusedNode, assignLastClickedNode, assignToggledFeatures, cancelEditing, closeAllOverlays, closeSearch, disableCompareWithLatest, emitEdgeClick, emitInitialized, emitNavigateTo, emitNodeClick,
|
|
755
|
+
export { assignDynamicViewVariant, assignFocusedNode, assignLastClickedNode, assignToggledFeatures, assignXYDataFromView, cancelAutoUnfocusTimer, cancelEditing, cancelFitDiagram, closeAllOverlays, closeSearch, disableCompareWithLatest, emitEdgeClick, emitInitialized, emitNavigateTo, emitNodeClick, emitOnLayoutTypeChange, emitOpenSource, emitPaneClick, ensureEditorActor, ensureOverlaysActor, ensureSearchActor, focusOnNodesAndEdges, handleNavigate, layoutAlign, notationsHighlight, onEdgeDoubleClick, onEdgeMouseEnter, onEdgeMouseLeave, onNodeMouseEnter, onNodeMouseLeave, openElementDetails, openOverlay, openSourceOfFocusedOrLastClickedNode, raiseFitDiagram, resetEdgesControlPoints, resetLastClickedNode, sendSynced, setViewport, startAutoUnfocusTimer, startEditing, startHotKeyActor, stopEditing, stopEditorActor, stopHotKeyActor, tagHighlight, triggerChange, undimEverything, updateFeatures, updateInputs, updateView };
|