@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,124 +1,138 @@
|
|
|
1
|
-
import { invariant } from '@likec4/core/utils';
|
|
2
|
-
import { findDiagramEdge, findDiagramNode, typedSystem } from './utils.js';
|
|
1
|
+
import { invariant, nonNullable } from '@likec4/core/utils';
|
|
2
|
+
import { findDiagramEdge, findDiagramNode, findNodeByModelFqn, typedSystem } from './utils.js';
|
|
3
3
|
|
|
4
|
-
function makeDiagramApi(
|
|
4
|
+
function makeDiagramApi(actorRef) {
|
|
5
5
|
return {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
ref: actorRef,
|
|
7
|
+
get actor() {
|
|
8
|
+
return actorRef.current;
|
|
9
|
+
},
|
|
10
|
+
overlays() {
|
|
11
|
+
return nonNullable(actorRef.current.getSnapshot().children.overlays, "Overlays actor not found");
|
|
12
|
+
},
|
|
13
|
+
send: (event) => actorRef.current.send(event),
|
|
14
|
+
navigateTo: (viewId, fromNode, focusOnElement) => {
|
|
15
|
+
actorRef.current.send({
|
|
10
16
|
type: "navigate.to",
|
|
11
17
|
viewId,
|
|
12
|
-
...fromNode && { fromNode }
|
|
18
|
+
...fromNode && { fromNode },
|
|
19
|
+
...focusOnElement && { focusOnElement }
|
|
13
20
|
});
|
|
14
21
|
},
|
|
15
22
|
navigate: (direction) => {
|
|
16
|
-
|
|
23
|
+
actorRef.current.send({ type: `navigate.${direction}` });
|
|
17
24
|
},
|
|
18
25
|
fitDiagram: (duration = 350) => {
|
|
19
|
-
|
|
26
|
+
actorRef.current.send({ type: "xyflow.fitDiagram", duration });
|
|
20
27
|
},
|
|
21
28
|
openRelationshipsBrowser: (fqn) => {
|
|
22
|
-
|
|
29
|
+
actorRef.current.send({ type: "open.relationshipsBrowser", fqn });
|
|
23
30
|
},
|
|
24
31
|
openSource: (params) => {
|
|
25
|
-
|
|
32
|
+
actorRef.current.send({ type: "open.source", ...params });
|
|
26
33
|
},
|
|
27
34
|
openElementDetails: (fqn, fromNode) => {
|
|
28
|
-
|
|
35
|
+
actorRef.current.send({ type: "open.elementDetails", fqn, fromNode });
|
|
29
36
|
},
|
|
30
37
|
openRelationshipDetails: (...params) => {
|
|
31
38
|
if (params.length === 1) {
|
|
32
|
-
|
|
39
|
+
actorRef.current.send({ type: "open.relationshipDetails", params: { edgeId: params[0] } });
|
|
33
40
|
} else {
|
|
34
|
-
|
|
41
|
+
actorRef.current.send({ type: "open.relationshipDetails", params: { source: params[0], target: params[1] } });
|
|
35
42
|
}
|
|
36
43
|
},
|
|
37
44
|
updateNodeData: (nodeId, data) => {
|
|
38
|
-
|
|
45
|
+
actorRef.current.send({ type: "update.nodeData", nodeId, data });
|
|
39
46
|
},
|
|
40
47
|
updateEdgeData: (edgeId, data) => {
|
|
41
|
-
|
|
48
|
+
actorRef.current.send({ type: "update.edgeData", edgeId, data });
|
|
42
49
|
},
|
|
43
50
|
startEditing: (subject) => {
|
|
44
|
-
const
|
|
45
|
-
invariant(
|
|
46
|
-
|
|
51
|
+
const editorActor = typedSystem(actorRef.current.system).editorActorRef;
|
|
52
|
+
invariant(editorActor, "No editor actor found in diagram actor system");
|
|
53
|
+
editorActor.send({ type: "edit.start", subject });
|
|
47
54
|
},
|
|
48
55
|
stopEditing: (wasChanged = false) => {
|
|
49
|
-
const
|
|
50
|
-
invariant(
|
|
51
|
-
|
|
56
|
+
const editorActor = typedSystem(actorRef.current.system).editorActorRef;
|
|
57
|
+
invariant(editorActor, "No editor actor found in diagram actor system");
|
|
58
|
+
editorActor.send({ type: "edit.finish", wasChanged });
|
|
52
59
|
},
|
|
53
60
|
undoEditing: () => {
|
|
54
|
-
const
|
|
55
|
-
invariant(
|
|
56
|
-
const hasUndo =
|
|
61
|
+
const editorActor = typedSystem(actorRef.current.system).editorActorRef;
|
|
62
|
+
invariant(editorActor, "No editor actor found in diagram actor system");
|
|
63
|
+
const hasUndo = editorActor.getSnapshot().context.history.length > 0;
|
|
57
64
|
if (hasUndo) {
|
|
58
|
-
|
|
65
|
+
editorActor.send({ type: "undo" });
|
|
59
66
|
}
|
|
60
67
|
return hasUndo;
|
|
61
68
|
},
|
|
62
69
|
align: (mode) => {
|
|
63
|
-
|
|
70
|
+
actorRef.current.send({ type: "layout.align", mode });
|
|
64
71
|
},
|
|
65
72
|
resetEdgeControlPoints: () => {
|
|
66
|
-
|
|
73
|
+
actorRef.current.send({ type: "layout.resetEdgeControlPoints" });
|
|
67
74
|
},
|
|
68
75
|
focusNode: (nodeId) => {
|
|
69
|
-
|
|
76
|
+
actorRef.current.send({ type: "focus.node", nodeId });
|
|
77
|
+
},
|
|
78
|
+
focusOnElement: (elementFqn) => {
|
|
79
|
+
const context = actorRef.current.getSnapshot().context;
|
|
80
|
+
const node = findNodeByModelFqn(context.xynodes, elementFqn);
|
|
81
|
+
if (node) {
|
|
82
|
+
actorRef.current.send({ type: "focus.node", nodeId: node.id, autoUnfocus: true });
|
|
83
|
+
}
|
|
70
84
|
},
|
|
71
85
|
/**
|
|
72
86
|
* @warning Do not use in render phase
|
|
73
87
|
*/
|
|
74
88
|
get currentView() {
|
|
75
|
-
return
|
|
89
|
+
return actorRef.current.getSnapshot().context.view;
|
|
76
90
|
},
|
|
77
91
|
/**
|
|
78
92
|
* @warning Do not use in render phase
|
|
79
93
|
*/
|
|
80
|
-
getContext: () =>
|
|
94
|
+
getContext: () => actorRef.current.getSnapshot().context,
|
|
81
95
|
/**
|
|
82
96
|
* @warning Do not use in render phase
|
|
83
97
|
*/
|
|
84
98
|
findDiagramNode: (xynodeId) => {
|
|
85
|
-
return findDiagramNode(
|
|
99
|
+
return findDiagramNode(actorRef.current.getSnapshot().context, xynodeId);
|
|
86
100
|
},
|
|
87
101
|
findEdge: (xyedgeId) => {
|
|
88
|
-
return
|
|
102
|
+
return actorRef.current.getSnapshot().context.xyedges.find((e) => e.data.id === xyedgeId) ?? null;
|
|
89
103
|
},
|
|
90
104
|
/**
|
|
91
105
|
* @warning Do not use in render phase
|
|
92
106
|
*/
|
|
93
107
|
findDiagramEdge: (xyedgeId) => {
|
|
94
|
-
return findDiagramEdge(
|
|
108
|
+
return findDiagramEdge(actorRef.current.getSnapshot().context, xyedgeId);
|
|
95
109
|
},
|
|
96
110
|
startWalkthrough: () => {
|
|
97
|
-
|
|
111
|
+
actorRef.current.send({ type: "walkthrough.start" });
|
|
98
112
|
},
|
|
99
113
|
walkthroughStep: (direction = "next") => {
|
|
100
|
-
|
|
114
|
+
actorRef.current.send({ type: "walkthrough.step", direction });
|
|
101
115
|
},
|
|
102
116
|
stopWalkthrough: () => {
|
|
103
|
-
|
|
117
|
+
actorRef.current.send({ type: "walkthrough.end" });
|
|
104
118
|
},
|
|
105
119
|
toggleFeature: (feature, forceValue) => {
|
|
106
|
-
|
|
120
|
+
actorRef.current.send({ type: "toggle.feature", feature, ...forceValue !== void 0 && { forceValue } });
|
|
107
121
|
},
|
|
108
122
|
highlightNotation: (notation, kind) => {
|
|
109
|
-
|
|
123
|
+
actorRef.current.send({ type: "notations.highlight", notation, ...kind && { kind } });
|
|
110
124
|
},
|
|
111
125
|
unhighlightNotation: () => {
|
|
112
|
-
|
|
126
|
+
actorRef.current.send({ type: "notations.unhighlight" });
|
|
113
127
|
},
|
|
114
128
|
openSearch: (searchValue) => {
|
|
115
|
-
|
|
129
|
+
actorRef.current.send({ type: "open.search", ...searchValue && { search: searchValue } });
|
|
116
130
|
},
|
|
117
131
|
triggerChange: (change) => {
|
|
118
|
-
|
|
132
|
+
actorRef.current.send({ type: "trigger.change", change });
|
|
119
133
|
},
|
|
120
134
|
switchDynamicViewVariant: (variant) => {
|
|
121
|
-
|
|
135
|
+
actorRef.current.send({ type: "switch.dynamicViewVariant", variant });
|
|
122
136
|
}
|
|
123
137
|
};
|
|
124
138
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AnyEventObject, CallbackActorLogic, NonReducibleUnknown } from 'xstate';
|
|
2
2
|
export type HotKeyEvent = {
|
|
3
|
-
type: 'key.esc' | `key.arrow.${'left' | 'right'}`;
|
|
3
|
+
type: 'key.esc' | `key.arrow.${'left' | 'right' | 'up' | 'down'}`;
|
|
4
4
|
};
|
|
5
5
|
export interface HotkeyActorLogic extends CallbackActorLogic<AnyEventObject, NonReducibleUnknown, HotKeyEvent> {
|
|
6
6
|
}
|
|
@@ -17,11 +17,23 @@ const hotkeyActorLogic = fromCallback(({ sendBack }) => {
|
|
|
17
17
|
}, {
|
|
18
18
|
preventDefault: true
|
|
19
19
|
}],
|
|
20
|
+
["ArrowUp", (event) => {
|
|
21
|
+
event.stopPropagation();
|
|
22
|
+
sendBack({ type: "key.arrow.up" });
|
|
23
|
+
}, {
|
|
24
|
+
preventDefault: true
|
|
25
|
+
}],
|
|
20
26
|
["ArrowRight", (event) => {
|
|
21
27
|
event.stopPropagation();
|
|
22
28
|
sendBack({ type: "key.arrow.right" });
|
|
23
29
|
}, {
|
|
24
30
|
preventDefault: true
|
|
31
|
+
}],
|
|
32
|
+
["ArrowDown", (event) => {
|
|
33
|
+
event.stopPropagation();
|
|
34
|
+
sendBack({ type: "key.arrow.down" });
|
|
35
|
+
}, {
|
|
36
|
+
preventDefault: true
|
|
25
37
|
}]
|
|
26
38
|
]);
|
|
27
39
|
document.body.addEventListener("keydown", escHandler);
|