@likec4/diagram 1.44.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 +18847 -17876
- package/dist/LikeC4Diagram.d.ts +1 -1
- package/dist/LikeC4Diagram.js +15 -12
- package/dist/LikeC4Diagram.props.d.ts +13 -20
- package/dist/LikeC4ProjectsProvider.js +8 -4
- package/dist/LikeC4Styles.js +0 -3
- package/dist/LikeC4View.d.ts +3 -3
- package/dist/LikeC4View.js +8 -8
- package/dist/ReactLikeC4.d.ts +3 -6
- package/dist/StaticLikeC4Diagram.js +0 -2
- package/dist/base/Base.d.ts +1 -1
- package/dist/base/updateEdges.js +25 -15
- package/dist/base/updateNodes.d.ts +14 -0
- package/dist/base/updateNodes.js +51 -18
- package/dist/base-primitives/Markdown.d.ts +30 -4
- package/dist/base-primitives/Markdown.js +3 -2
- package/dist/base-primitives/NodeHandles.d.ts +2 -1
- package/dist/base-primitives/NodeHandles.js +22 -18
- package/dist/base-primitives/compound/CompoundActionButton.d.ts +3 -2
- package/dist/base-primitives/compound/CompoundActionButton.js +1 -1
- package/dist/base-primitives/compound/CompoundDetailsButton.d.ts +3 -2
- package/dist/base-primitives/compound/CompoundDetailsButton.js +1 -1
- package/dist/base-primitives/edge/EdgeActionButton.d.ts +3 -2
- 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 +6 -4
- package/dist/base-primitives/edge/EdgeLabel.d.ts +2 -2
- 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 +27 -12
- package/dist/base-primitives/element/ElementActionButtons.d.ts +3 -2
- package/dist/base-primitives/element/ElementActionButtons.js +3 -3
- package/dist/base-primitives/element/ElementData.d.ts +3 -3
- package/dist/base-primitives/element/ElementData.js +13 -7
- package/dist/base-primitives/element/ElementDetailsButton.d.ts +3 -2
- package/dist/base-primitives/element/ElementDetailsButton.js +4 -1
- package/dist/base-primitives/element/ElementShape.js +5 -5
- package/dist/base-primitives/element/ElementTags.d.ts +6 -4
- 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 +2 -1
- package/dist/context/DiagramFeatures.js +1 -0
- package/dist/context/EnsureMantine.js +2 -1
- package/dist/context/IconRenderer.js +6 -6
- package/dist/context/TagStylesContext.js +1 -1
- package/dist/custom/hooks.d.ts +2 -2
- package/dist/custom/index.js +1 -1
- 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/index.d.ts +2 -1
- 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 +29 -4
- package/dist/hooks/useLikeC4Project.d.ts +6 -1
- package/dist/hooks/useLikeC4Project.js +14 -2
- package/dist/hooks/useMediaPrint.d.ts +6 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/likec4diagram/DiagramXYFlow.js +11 -7
- package/dist/likec4diagram/custom/edges/EdgeDrifts.d.ts +6 -0
- package/dist/likec4diagram/custom/edges/EdgeDrifts.js +34 -0
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +90 -54
- package/dist/likec4diagram/custom/edges/SequenceStepEdge.js +3 -1
- 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 +5 -5
- package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.js +5 -5
- package/dist/likec4diagram/custom/nodes/ElementActions.js +2 -2
- package/dist/likec4diagram/custom/nodes/NodeDrifts.d.ts +6 -0
- package/dist/likec4diagram/custom/nodes/{ElementNodeDrifts.js → NodeDrifts.js} +12 -13
- package/dist/likec4diagram/custom/nodes/SequenceActorNode.js +4 -2
- package/dist/likec4diagram/custom/nodes/index.d.ts +1 -0
- package/dist/likec4diagram/custom/nodes/nodes.js +61 -23
- 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 +128 -15
- package/dist/likec4diagram/relationship-popover/actor.d.ts +1 -1
- package/dist/likec4diagram/state/DiagramActorProvider.d.ts +2 -2
- package/dist/likec4diagram/state/DiagramActorProvider.js +63 -72
- package/dist/likec4diagram/state/assign.d.ts +14 -7
- package/dist/likec4diagram/state/assign.js +28 -200
- package/dist/likec4diagram/state/createViewChange.js +23 -30
- package/dist/likec4diagram/state/diagram-api.d.ts +20 -6
- package/dist/likec4diagram/state/diagram-api.js +58 -52
- package/dist/likec4diagram/state/hotkeyActor.d.ts +1 -8
- package/dist/likec4diagram/state/hotkeyActor.js +13 -17
- package/dist/likec4diagram/state/machine.actions.d.ts +1127 -864
- package/dist/likec4diagram/state/machine.actions.js +316 -296
- package/dist/likec4diagram/state/machine.actions.layout.d.ts +641 -0
- package/dist/likec4diagram/state/machine.actions.layout.js +141 -0
- package/dist/likec4diagram/state/machine.d.ts +18 -3712
- package/dist/likec4diagram/state/machine.js +64 -73
- package/dist/likec4diagram/state/machine.setup.d.ts +80 -26
- package/dist/likec4diagram/state/machine.setup.js +44 -7
- package/dist/likec4diagram/state/machine.state.initializing.d.ts +58 -17
- package/dist/likec4diagram/state/machine.state.initializing.js +14 -14
- package/dist/likec4diagram/state/machine.state.navigating.d.ts +5 -108
- package/dist/likec4diagram/state/machine.state.navigating.js +187 -35
- package/dist/likec4diagram/state/machine.state.ready.d.ts +2997 -2598
- package/dist/likec4diagram/state/machine.state.ready.focused.d.ts +710 -0
- package/dist/likec4diagram/state/machine.state.ready.focused.js +98 -0
- package/dist/likec4diagram/state/machine.state.ready.idle.d.ts +540 -0
- package/dist/likec4diagram/state/machine.state.ready.idle.js +105 -0
- package/dist/likec4diagram/state/machine.state.ready.js +95 -347
- package/dist/likec4diagram/state/machine.state.ready.printing.d.ts +140 -0
- package/dist/likec4diagram/state/machine.state.ready.printing.js +40 -0
- package/dist/likec4diagram/state/machine.state.ready.walkthrough.d.ts +684 -0
- package/dist/likec4diagram/state/machine.state.ready.walkthrough.js +190 -0
- package/dist/likec4diagram/state/mediaPrintActor.d.ts +12 -0
- package/dist/likec4diagram/state/mediaPrintActor.js +18 -0
- package/dist/likec4diagram/state/types.d.ts +11 -9
- package/dist/likec4diagram/state/utils.d.ts +44 -5
- package/dist/likec4diagram/state/utils.js +62 -6
- package/dist/likec4diagram/types.d.ts +8 -13
- package/dist/likec4diagram/ui/notation/NotationPanel.css.js +5 -2
- package/dist/likec4diagram/ui/notation/NotationPanel.js +3 -3
- package/dist/likec4diagram/useLayoutConstraints.js +104 -103
- package/dist/likec4diagram/xyflow-diagram/diagram-view.js +12 -15
- package/dist/likec4diagram/xyflow-sequence/sequence-layout.js +11 -8
- package/dist/navigationpanel/NavigationPanel.js +11 -10
- package/dist/navigationpanel/NavigationPanelDropdown.js +7 -7
- package/dist/navigationpanel/_common.js +1 -1
- package/dist/navigationpanel/actor.d.ts +4 -204
- package/dist/navigationpanel/actor.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 +32 -19
- 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 +9 -9
- package/dist/navigationpanel/walkthrough/DynamicViewControls.js +1 -1
- package/dist/navigationpanel/walkthrough/WalkthroughPanel.js +4 -3
- package/dist/overlays/Overlays.js +24 -12
- package/dist/overlays/element-details/ElementDetailsCard.css.js +3 -3
- package/dist/overlays/element-details/ElementDetailsCard.js +4 -4
- package/dist/overlays/element-details/MetadataValue.d.ts +2 -1
- 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/element-details/actor.d.ts +8 -83
- package/dist/overlays/element-details/actor.js +0 -8
- package/dist/overlays/overlay/Overlay.js +10 -10
- package/dist/overlays/overlaysActor.d.ts +7 -392
- package/dist/overlays/overlaysActor.js +73 -49
- package/dist/overlays/relationship-details/RelationshipDetails.js +3 -3
- package/dist/overlays/relationship-details/SelectEdge.js +2 -2
- package/dist/overlays/relationship-details/_types.d.ts +3 -4
- package/dist/overlays/relationship-details/actor.d.ts +6 -562
- package/dist/overlays/relationship-details/actor.js +1 -0
- package/dist/overlays/relationship-details/custom/ElementActions.js +3 -3
- package/dist/overlays/relationship-details/layout-to-xyflow.js +3 -5
- package/dist/overlays/relationship-details/layout.d.ts +3 -3
- package/dist/overlays/relationship-details/layout.js +4 -4
- package/dist/overlays/relationships-browser/RelationshipsBrowser.js +3 -3
- package/dist/overlays/relationships-browser/SelectElement.js +2 -2
- package/dist/overlays/relationships-browser/_types.d.ts +2 -3
- package/dist/overlays/relationships-browser/actor.d.ts +7 -739
- package/dist/overlays/relationships-browser/custom/ElementActions.js +3 -3
- package/dist/overlays/relationships-browser/layout.d.ts +2 -2
- package/dist/overlays/relationships-browser/layout.js +3 -3
- package/dist/overlays/relationships-browser/useViewToNodesEdges.js +0 -3
- package/dist/overlays/types.d.ts +12 -13
- 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/search/components/_shared.css.d.ts +1 -1
- package/dist/search/searchActor.d.ts +3 -66
- package/dist/shadowroot/ShadowRoot.d.ts +5 -7
- package/dist/shadowroot/ShadowRoot.js +7 -5
- 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/view-bounds.js +7 -6
- package/dist/utils/xyflow.d.ts +6 -5
- package/dist/utils/xyflow.js +26 -57
- package/package.json +24 -23
- package/panda.buildinfo.json +65 -71
- 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/custom/nodes/ElementNodeDrifts.d.ts +0 -4
- package/dist/likec4diagram/state/syncManualLayoutActor.d.ts +0 -280
- package/dist/likec4diagram/state/syncManualLayoutActor.js +0 -248
- package/dist/utils/vector.d.ts +0 -81
- package/dist/utils/vector.js +0 -120
- /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
|
@@ -11,7 +11,7 @@ export declare function useDiagramActorSnapshot<T = unknown>(selector: (state: D
|
|
|
11
11
|
export declare function useDiagramContext<T = unknown>(selector: (context: DiagramContext) => T, compare?: (a: NoInfer<T>, b: NoInfer<T>) => boolean, deps?: DependencyList): T;
|
|
12
12
|
type PickEmittedEvent<T> = T extends DiagramEmittedEvents['type'] ? DiagramEmittedEvents & {
|
|
13
13
|
type: T;
|
|
14
|
-
} :
|
|
14
|
+
} : unknown;
|
|
15
15
|
/**
|
|
16
16
|
* Subscribe to diagram emitted events
|
|
17
17
|
* @example
|
|
@@ -21,4 +21,6 @@ type PickEmittedEvent<T> = T extends DiagramEmittedEvents['type'] ? DiagramEmitt
|
|
|
21
21
|
* })
|
|
22
22
|
* ```
|
|
23
23
|
*/
|
|
24
|
-
export declare function useOnDiagramEvent<T extends DiagramEmittedEvents['type']>(event: T, callback: (event: PickEmittedEvent<T>) => void
|
|
24
|
+
export declare function useOnDiagramEvent<T extends DiagramEmittedEvents['type'] | '*'>(event: T, callback: (event: PickEmittedEvent<T>) => void, options?: {
|
|
25
|
+
once?: boolean;
|
|
26
|
+
}): void;
|
package/dist/hooks/useDiagram.js
CHANGED
|
@@ -3,6 +3,7 @@ import { shallowEqual } from 'fast-equals';
|
|
|
3
3
|
import { useCallback, useRef, useEffect } from 'react';
|
|
4
4
|
import { useDiagramActorRef } from './safeContext.js';
|
|
5
5
|
export { useDiagram } from './safeContext.js';
|
|
6
|
+
import { useCallbackRef } from './useCallbackRef.js';
|
|
6
7
|
|
|
7
8
|
function useDiagramActorSnapshot(selector, compare = shallowEqual) {
|
|
8
9
|
const actorRef = useDiagramActorRef();
|
|
@@ -10,21 +11,31 @@ function useDiagramActorSnapshot(selector, compare = shallowEqual) {
|
|
|
10
11
|
}
|
|
11
12
|
function useDiagramContext(selector, compare = shallowEqual, deps) {
|
|
12
13
|
const actorRef = useDiagramActorRef();
|
|
13
|
-
const
|
|
14
|
+
const selectorRef = useCallbackRef(selector);
|
|
15
|
+
const select = useCallback((s) => selectorRef(s.context), deps ?? []);
|
|
14
16
|
return useSelector(actorRef, select, compare);
|
|
15
17
|
}
|
|
16
|
-
function useOnDiagramEvent(event, callback) {
|
|
18
|
+
function useOnDiagramEvent(event, callback, options) {
|
|
17
19
|
const actorRef = useDiagramActorRef();
|
|
18
|
-
const callbackRef =
|
|
19
|
-
|
|
20
|
+
const callbackRef = useCallbackRef(callback);
|
|
21
|
+
const wasCalled = useRef(false);
|
|
22
|
+
const once = options?.once ?? false;
|
|
20
23
|
useEffect(() => {
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
if (once && wasCalled.current) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
let subscription = actorRef.on(event, (payload) => {
|
|
28
|
+
callbackRef(payload);
|
|
29
|
+
wasCalled.current = true;
|
|
30
|
+
if (once) {
|
|
31
|
+
subscription?.unsubscribe();
|
|
32
|
+
subscription = null;
|
|
33
|
+
}
|
|
23
34
|
});
|
|
24
35
|
return () => {
|
|
25
|
-
subscription
|
|
36
|
+
subscription?.unsubscribe();
|
|
26
37
|
};
|
|
27
|
-
}, [actorRef, event]);
|
|
38
|
+
}, [actorRef, event, once]);
|
|
28
39
|
}
|
|
29
40
|
|
|
30
41
|
export { useDiagramActorRef, useDiagramActorSnapshot, useDiagramContext, useOnDiagramEvent };
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import { DiagramActorSnapshot } from '../likec4diagram/state/types';
|
|
2
2
|
import type * as t from '@likec4/core/types';
|
|
3
3
|
declare const selectCompareLayoutState: ({ context }: DiagramActorSnapshot) => {
|
|
4
|
+
hasEditor: false;
|
|
4
5
|
isEnabled: false;
|
|
5
6
|
isEditable: false;
|
|
6
7
|
isActive: false;
|
|
7
8
|
drifts: never[];
|
|
9
|
+
canApplyLatest: boolean;
|
|
8
10
|
layout: t.LayoutType;
|
|
9
11
|
} | {
|
|
12
|
+
hasEditor: boolean;
|
|
10
13
|
isEnabled: true;
|
|
11
14
|
isEditable: boolean;
|
|
12
15
|
isActive: boolean;
|
|
13
16
|
drifts: t.NonEmptyReadonlyArray<t.LayoutedViewDriftReason>;
|
|
17
|
+
canApplyLatest: boolean;
|
|
14
18
|
layout: t.LayoutType;
|
|
15
19
|
};
|
|
16
20
|
type DiagramCompareLayoutState = ReturnType<typeof selectCompareLayoutState>;
|
|
@@ -23,6 +27,10 @@ type DiagramCompareLayoutOps = {
|
|
|
23
27
|
* Switches the layout type between 'auto' and 'manual'.
|
|
24
28
|
*/
|
|
25
29
|
switchLayout: (layoutType: t.LayoutType) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Merges the latest layout into the manual layout.
|
|
32
|
+
*/
|
|
33
|
+
applyLatestToManual: () => void;
|
|
26
34
|
/**
|
|
27
35
|
* Resets the manual layout to its default state.
|
|
28
36
|
*/
|
|
@@ -1,24 +1,34 @@
|
|
|
1
|
+
import { nonNullable } from '@likec4/core';
|
|
1
2
|
import { useSelector } from '@xstate/react';
|
|
2
3
|
import { shallowEqual } from 'fast-equals';
|
|
4
|
+
import { deriveToggledFeatures } from '../likec4diagram/state/machine.setup.js';
|
|
3
5
|
import { useDiagramActorRef } from './safeContext.js';
|
|
4
6
|
import { useCallbackRef } from './useCallbackRef.js';
|
|
5
7
|
|
|
6
8
|
const selectCompareLayoutState = ({ context }) => {
|
|
7
9
|
const drifts = context.view.drifts ?? null;
|
|
8
|
-
if (!context.features.enableCompareWithLatest || !drifts) {
|
|
10
|
+
if (!context.features.enableCompareWithLatest || !drifts || drifts.length === 0) {
|
|
9
11
|
return {
|
|
12
|
+
hasEditor: false,
|
|
10
13
|
isEnabled: false,
|
|
11
14
|
isEditable: false,
|
|
12
15
|
isActive: false,
|
|
13
16
|
drifts: [],
|
|
17
|
+
canApplyLatest: false,
|
|
14
18
|
layout: context.view._layout ?? "auto"
|
|
15
19
|
};
|
|
16
20
|
}
|
|
21
|
+
const {
|
|
22
|
+
enableCompareWithLatest,
|
|
23
|
+
enableReadOnly
|
|
24
|
+
} = deriveToggledFeatures(context);
|
|
17
25
|
return {
|
|
26
|
+
hasEditor: context.features.enableEditor,
|
|
18
27
|
isEnabled: true,
|
|
19
|
-
isEditable: !
|
|
20
|
-
isActive:
|
|
28
|
+
isEditable: !enableReadOnly,
|
|
29
|
+
isActive: enableCompareWithLatest === true,
|
|
21
30
|
drifts,
|
|
31
|
+
canApplyLatest: !drifts.includes("type-changed"),
|
|
22
32
|
layout: context.view._layout ?? "auto"
|
|
23
33
|
};
|
|
24
34
|
};
|
|
@@ -54,7 +64,22 @@ function useDiagramCompareLayout() {
|
|
|
54
64
|
}
|
|
55
65
|
actorRef.send({ type: "layout.resetManualLayout" });
|
|
56
66
|
});
|
|
57
|
-
|
|
67
|
+
const applyLatestToManual = useCallbackRef(() => {
|
|
68
|
+
if (!state.isEnabled) {
|
|
69
|
+
console.warn("Compare with latest feature is not enabled");
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const editor = nonNullable(actorRef.system?.get("editor"), "editor actor not found");
|
|
73
|
+
editor.send({ type: "applyLatestToManual" });
|
|
74
|
+
if (state.isActive) {
|
|
75
|
+
actorRef.send({
|
|
76
|
+
type: "toggle.feature",
|
|
77
|
+
feature: "CompareWithLatest",
|
|
78
|
+
forceValue: false
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
return [state, { toggleCompare, switchLayout, resetManualLayout, applyLatestToManual }];
|
|
58
83
|
}
|
|
59
84
|
|
|
60
85
|
export { useDiagramCompareLayout };
|
|
@@ -17,6 +17,11 @@ export declare function useLikeC4ProjectsContext(): LikeC4ProjectsContext;
|
|
|
17
17
|
*/
|
|
18
18
|
export declare function useHasProjects(): boolean;
|
|
19
19
|
/**
|
|
20
|
-
* @returns
|
|
20
|
+
* @returns Current project id, as provided by LikeC4Model
|
|
21
21
|
*/
|
|
22
22
|
export declare function useLikeC4ProjectId(): ProjectId;
|
|
23
|
+
/**
|
|
24
|
+
* Returns current LikeC4 project.
|
|
25
|
+
* Requires both LikeC4ModelProvider and LikeC4ProjectsProvider in the tree.*
|
|
26
|
+
*/
|
|
27
|
+
export declare function useLikeC4Project(): LikeC4Project;
|
|
@@ -29,9 +29,21 @@ function useHasProjects() {
|
|
|
29
29
|
function useLikeC4ProjectId() {
|
|
30
30
|
const ctx = useContext(LikeC4ModelContext);
|
|
31
31
|
if (!ctx) {
|
|
32
|
-
throw new Error("No
|
|
32
|
+
throw new Error("No LikeC4ModelProvider found");
|
|
33
33
|
}
|
|
34
34
|
return ctx.projectId;
|
|
35
35
|
}
|
|
36
|
+
function useLikeC4Project() {
|
|
37
|
+
const projectId = useLikeC4ProjectId();
|
|
38
|
+
const projectsCtx = useContext(LikeC4ProjectsContext);
|
|
39
|
+
if (!projectsCtx) {
|
|
40
|
+
throw new Error("No LikeC4ProjectsProvider found");
|
|
41
|
+
}
|
|
42
|
+
const project = projectsCtx.projects.find((p) => p.id === projectId);
|
|
43
|
+
if (!project) {
|
|
44
|
+
throw new Error(`Project with id '${projectId}' not found in LikeC4ProjectsProvider`);
|
|
45
|
+
}
|
|
46
|
+
return project;
|
|
47
|
+
}
|
|
36
48
|
|
|
37
|
-
export { useHasProjects, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext };
|
|
49
|
+
export { useHasProjects, useLikeC4Project, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export { IconRendererProvider } from './context/IconRenderer';
|
|
|
2
2
|
export { LikeC4Diagram, type LikeC4DiagramProps, } from './LikeC4Diagram';
|
|
3
3
|
export type { ElementIconRenderer, ElementIconRendererProps, LikeC4ColorScheme, NodeRenderers, OnCanvasClick, OnChange, OnEdgeClick, OnInitialized, OnNavigateTo, OnNodeClick, OnOpenSource, PaddingWithUnit, ViewPadding, WhereOperator, } from './LikeC4Diagram.props';
|
|
4
4
|
export { LikeC4ModelProvider, type LikeC4ModelProviderProps, } from './LikeC4ModelProvider';
|
|
5
|
+
export { type LikeC4EditorPort, LikeC4EditorProvider, type LikeC4EditorProviderProps, } from './editor/LikeC4EditorProvider';
|
|
5
6
|
export { LikeC4ProjectsProvider, type LikeC4ProjectsProviderProps, } from './LikeC4ProjectsProvider';
|
|
6
7
|
export { type DiagramApi, type DiagramContext, useDiagram, useDiagramContext, useOnDiagramEvent, } from './hooks/useDiagram';
|
|
7
8
|
export { useLikeC4Model, useLikeC4Specification, useLikeC4ViewModel, } from './hooks/useLikeC4Model';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { IconRendererProvider } from './context/IconRenderer.js';
|
|
2
2
|
export { LikeC4Diagram } from './LikeC4Diagram.js';
|
|
3
3
|
export { LikeC4ModelProvider } from './LikeC4ModelProvider.js';
|
|
4
|
+
export { LikeC4EditorProvider } from './editor/LikeC4EditorProvider.js';
|
|
4
5
|
export { LikeC4ProjectsProvider } from './LikeC4ProjectsProvider.js';
|
|
5
6
|
export { useDiagramContext, useOnDiagramEvent } from './hooks/useDiagram.js';
|
|
6
7
|
export { useLikeC4Model, useLikeC4Specification, useLikeC4ViewModel } from './hooks/useLikeC4Model.js';
|
|
@@ -11,6 +11,7 @@ import { useIsReducedGraphics, usePanningAtom } from '../context/RootContainerCo
|
|
|
11
11
|
import { useDiagramActorSnapshot } from '../hooks/useDiagram.js';
|
|
12
12
|
import { depsShallowEqual, useUpdateEffect } from '../hooks/useUpdateEffect.js';
|
|
13
13
|
import { BuiltinEdges, BuiltinNodes } from './custom/index.js';
|
|
14
|
+
import { deriveToggledFeatures } from './state/machine.setup.js';
|
|
14
15
|
import { useLayoutConstraints } from './useLayoutConstraints.js';
|
|
15
16
|
import { useDiagram } from '../hooks/safeContext.js';
|
|
16
17
|
import { useDiagramEventHandlers } from '../context/DiagramEventHandlers.js';
|
|
@@ -44,9 +45,8 @@ function prepareNodeTypes(nodeTypes) {
|
|
|
44
45
|
};
|
|
45
46
|
}
|
|
46
47
|
const selectXYProps = ({ context: ctx, children }) => {
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
const isNotEditingEdge = enableReadOnly || children.syncLayout?.getSnapshot().context.editing !== "edge";
|
|
48
|
+
const { enableReadOnly } = deriveToggledFeatures(ctx);
|
|
49
|
+
const isNotEditingEdge = enableReadOnly || children.editor?.getSnapshot().context.editing !== "edge";
|
|
50
50
|
return {
|
|
51
51
|
enableReadOnly,
|
|
52
52
|
initialized: ctx.initialized.xydata && ctx.initialized.xyflow,
|
|
@@ -57,11 +57,11 @@ const selectXYProps = ({ context: ctx, children }) => {
|
|
|
57
57
|
nodesDraggable: !enableReadOnly && ctx.nodesDraggable,
|
|
58
58
|
nodesSelectable: ctx.nodesSelectable && isNotEditingEdge,
|
|
59
59
|
fitViewPadding: ctx.fitViewPadding,
|
|
60
|
-
enableFitView: ctx.
|
|
60
|
+
enableFitView: ctx.features.enableFitView,
|
|
61
61
|
...!ctx.features.enableFitView && {
|
|
62
62
|
viewport: {
|
|
63
|
-
x: -
|
|
64
|
-
y: -
|
|
63
|
+
x: -ctx.view.bounds.x,
|
|
64
|
+
y: -ctx.view.bounds.y,
|
|
65
65
|
zoom: 1
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -109,7 +109,11 @@ function LikeC4DiagramXYFlow({
|
|
|
109
109
|
notPanning();
|
|
110
110
|
}), onMoveEnd = useCallbackRef((event, viewport) => {
|
|
111
111
|
isPanning.clear();
|
|
112
|
-
diagram.send({
|
|
112
|
+
diagram.send({
|
|
113
|
+
type: "xyflow.viewportMoved",
|
|
114
|
+
viewport,
|
|
115
|
+
manually: !!event
|
|
116
|
+
});
|
|
113
117
|
}), onViewportResize = useCallbackRef(() => {
|
|
114
118
|
diagram.send({ type: "xyflow.resized" });
|
|
115
119
|
}), nodeTypes = useCustomCompareMemo(
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { cx, css } from '@likec4/styles/css';
|
|
3
|
+
|
|
4
|
+
function EdgeDrifts({
|
|
5
|
+
edgeProps: { data },
|
|
6
|
+
svgPath
|
|
7
|
+
}) {
|
|
8
|
+
const drifts = data.drifts;
|
|
9
|
+
if (!drifts || drifts.length === 0) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
return /* @__PURE__ */ jsx(
|
|
13
|
+
"path",
|
|
14
|
+
{
|
|
15
|
+
className: cx(
|
|
16
|
+
"react-flow__edge-path",
|
|
17
|
+
css({
|
|
18
|
+
pointerEvents: "none",
|
|
19
|
+
stroke: "likec4.compare.manual.outline",
|
|
20
|
+
fill: "none",
|
|
21
|
+
strokeWidth: {
|
|
22
|
+
base: "8px",
|
|
23
|
+
_whenHovered: "12px"
|
|
24
|
+
},
|
|
25
|
+
strokeOpacity: 0.5
|
|
26
|
+
})
|
|
27
|
+
),
|
|
28
|
+
d: svgPath,
|
|
29
|
+
strokeLinecap: "round"
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { EdgeDrifts };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { cx } from '@likec4/styles/css';
|
|
3
|
-
import { useRafEffect } from '@react-hookz/web';
|
|
2
|
+
import { css, cx } from '@likec4/styles/css';
|
|
4
3
|
import { EdgeLabelRenderer } from '@xyflow/react';
|
|
5
|
-
import { useState, useRef } from 'react';
|
|
6
|
-
import { ZIndexes } from '../../../base/const.js';
|
|
4
|
+
import { useState, useRef, useEffect } from 'react';
|
|
7
5
|
import { useEnabledFeatures } from '../../../context/DiagramFeatures.js';
|
|
8
6
|
import { useCallbackRef } from '../../../hooks/useCallbackRef.js';
|
|
9
7
|
import '@xstate/react';
|
|
@@ -12,7 +10,8 @@ import { useDiagram } from '../../../hooks/safeContext.js';
|
|
|
12
10
|
import { useUpdateEffect } from '../../../hooks/useUpdateEffect.js';
|
|
13
11
|
import { useXYFlow, useXYStoreApi } from '../../../hooks/useXYFlow.js';
|
|
14
12
|
import { isSamePoint } from '../../../utils/xyflow.js';
|
|
15
|
-
import {
|
|
13
|
+
import { EdgeDrifts } from './EdgeDrifts.js';
|
|
14
|
+
import { controlPointsContainer, controlPoint } from './edges.css.js';
|
|
16
15
|
import { useControlPoints } from './useControlPoints.js';
|
|
17
16
|
import { useRelationshipEdgePath } from './useRelationshipEdgePath.js';
|
|
18
17
|
import { memoEdge } from '../../../base-primitives/memoEdge.js';
|
|
@@ -31,25 +30,26 @@ const getEdgeCenter = (path) => {
|
|
|
31
30
|
};
|
|
32
31
|
const RelationshipEdge = memoEdge((props) => {
|
|
33
32
|
const [isControlPointDragging, setIsControlPointDragging] = useState(false);
|
|
33
|
+
const isControlPointDraggingRef = useRef(isControlPointDragging);
|
|
34
|
+
isControlPointDraggingRef.current = isControlPointDragging;
|
|
34
35
|
const xyflow = useXYFlow();
|
|
35
36
|
const diagram = useDiagram();
|
|
36
37
|
const {
|
|
37
38
|
enableNavigateTo,
|
|
38
|
-
enableReadOnly
|
|
39
|
+
enableReadOnly,
|
|
40
|
+
enableCompareWithLatest
|
|
39
41
|
} = useEnabledFeatures();
|
|
40
42
|
const enabledEditing = !enableReadOnly;
|
|
41
43
|
const {
|
|
42
44
|
id,
|
|
43
45
|
selected = false,
|
|
44
46
|
data: {
|
|
45
|
-
hovered = false,
|
|
46
|
-
active = false,
|
|
47
47
|
labelBBox,
|
|
48
48
|
labelXY,
|
|
49
49
|
...data
|
|
50
50
|
}
|
|
51
51
|
} = props;
|
|
52
|
-
const navigateTo = enableNavigateTo ? data.navigateTo : void 0;
|
|
52
|
+
const navigateTo = enableNavigateTo && !isControlPointDragging ? data.navigateTo : void 0;
|
|
53
53
|
const {
|
|
54
54
|
controlPoints,
|
|
55
55
|
setControlPoints,
|
|
@@ -66,21 +66,22 @@ const RelationshipEdge = memoEdge((props) => {
|
|
|
66
66
|
y: labelXY?.y ?? labelY
|
|
67
67
|
});
|
|
68
68
|
useUpdateEffect(() => {
|
|
69
|
-
|
|
69
|
+
if (isControlPointDraggingRef.current) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const next = {
|
|
70
73
|
x: labelX,
|
|
71
74
|
y: labelY
|
|
72
|
-
}
|
|
75
|
+
};
|
|
76
|
+
setLabelPos((current) => isSamePoint(current, next) ? current : next);
|
|
73
77
|
}, [labelX, labelY]);
|
|
74
78
|
const svgPathRef = useRef(null);
|
|
75
|
-
|
|
79
|
+
useEffect(() => {
|
|
76
80
|
const path = svgPathRef.current;
|
|
77
81
|
if (!path || !isControlPointDragging) return;
|
|
78
|
-
|
|
82
|
+
const next = getEdgeCenter(path);
|
|
83
|
+
setLabelPos((current) => isSamePoint(current, next) ? current : next);
|
|
79
84
|
}, [edgePath, isControlPointDragging]);
|
|
80
|
-
if (isControlPointDragging) {
|
|
81
|
-
labelX = labelPos.x;
|
|
82
|
-
labelY = labelPos.y;
|
|
83
|
-
}
|
|
84
85
|
const updateEdgeData = useCallbackRef((controlPoints2) => {
|
|
85
86
|
const point = svgPathRef.current ? getEdgeCenter(svgPathRef.current) : null;
|
|
86
87
|
if (labelBBox && point) {
|
|
@@ -89,8 +90,7 @@ const RelationshipEdge = memoEdge((props) => {
|
|
|
89
90
|
labelBBox: {
|
|
90
91
|
...labelBBox,
|
|
91
92
|
...point
|
|
92
|
-
}
|
|
93
|
-
labelXY: point
|
|
93
|
+
}
|
|
94
94
|
});
|
|
95
95
|
} else {
|
|
96
96
|
diagram.updateEdgeData(id, { controlPoints: controlPoints2 });
|
|
@@ -124,7 +124,7 @@ const RelationshipEdge = memoEdge((props) => {
|
|
|
124
124
|
if (e.pointerType !== "mouse") {
|
|
125
125
|
return;
|
|
126
126
|
}
|
|
127
|
-
if (e.button !== 2) {
|
|
127
|
+
if (e.button !== 2 && !selected) {
|
|
128
128
|
return;
|
|
129
129
|
}
|
|
130
130
|
e.stopPropagation();
|
|
@@ -152,46 +152,65 @@ const RelationshipEdge = memoEdge((props) => {
|
|
|
152
152
|
};
|
|
153
153
|
}
|
|
154
154
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
155
|
-
/* @__PURE__ */ jsxs(
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
isDragging: isControlPointDragging,
|
|
163
|
-
...enabledEditing && {
|
|
164
|
-
onEdgePointerDown
|
|
155
|
+
/* @__PURE__ */ jsxs(
|
|
156
|
+
EdgeContainer,
|
|
157
|
+
{
|
|
158
|
+
...props,
|
|
159
|
+
className: css({
|
|
160
|
+
"& .react-flow__edge-interaction": {
|
|
161
|
+
cursor: enabledEditing && selected ? "copy" : void 0
|
|
165
162
|
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
{
|
|
171
|
-
edgeProps: props,
|
|
172
|
-
labelPosition: { x: labelX, y: labelY },
|
|
173
|
-
children: /* @__PURE__ */ jsx(
|
|
174
|
-
EdgeLabel,
|
|
163
|
+
}),
|
|
164
|
+
children: [
|
|
165
|
+
/* @__PURE__ */ jsx(
|
|
166
|
+
EdgePath,
|
|
175
167
|
{
|
|
176
|
-
pointerEvents: enabledEditing ? "none" : "all",
|
|
177
168
|
edgeProps: props,
|
|
178
|
-
|
|
179
|
-
|
|
169
|
+
svgPath: edgePath,
|
|
170
|
+
ref: svgPathRef,
|
|
171
|
+
isDragging: isControlPointDragging,
|
|
172
|
+
...enabledEditing && {
|
|
173
|
+
onEdgePointerDown
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
),
|
|
177
|
+
enableCompareWithLatest && /* @__PURE__ */ jsx(
|
|
178
|
+
EdgeDrifts,
|
|
179
|
+
{
|
|
180
|
+
edgeProps: props,
|
|
181
|
+
svgPath: edgePath
|
|
182
|
+
}
|
|
183
|
+
),
|
|
184
|
+
labelBBox && /* @__PURE__ */ jsx(
|
|
185
|
+
EdgeLabelContainer,
|
|
186
|
+
{
|
|
187
|
+
edgeProps: props,
|
|
188
|
+
labelPosition: isControlPointDragging ? labelPos : { x: labelX, y: labelY },
|
|
189
|
+
children: /* @__PURE__ */ jsx(
|
|
190
|
+
EdgeLabel,
|
|
180
191
|
{
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
192
|
+
pointerEvents: enabledEditing ? "none" : "all",
|
|
193
|
+
edgeProps: props,
|
|
194
|
+
children: navigateTo && /* @__PURE__ */ jsx(
|
|
195
|
+
EdgeActionButton,
|
|
196
|
+
{
|
|
197
|
+
onClick: (e) => {
|
|
198
|
+
e.stopPropagation();
|
|
199
|
+
diagram.navigateTo(navigateTo);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
)
|
|
185
203
|
}
|
|
186
204
|
)
|
|
187
205
|
}
|
|
188
206
|
)
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
enabledEditing && controlPoints.length > 0 &&
|
|
207
|
+
]
|
|
208
|
+
}
|
|
209
|
+
),
|
|
210
|
+
enabledEditing && controlPoints.length > 0 && /* @__PURE__ */ jsx(
|
|
193
211
|
ControlPoints,
|
|
194
212
|
{
|
|
213
|
+
isControlPointDragging,
|
|
195
214
|
edgeProps: props,
|
|
196
215
|
controlPoints,
|
|
197
216
|
onMove: setControlPoints,
|
|
@@ -199,13 +218,14 @@ const RelationshipEdge = memoEdge((props) => {
|
|
|
199
218
|
onCancelMove: onControlPointerCancelMove,
|
|
200
219
|
onFinishMove: onControlPointerFinishMove,
|
|
201
220
|
onDelete: onControlPointerDelete,
|
|
202
|
-
zIndex:
|
|
221
|
+
zIndex: 9999
|
|
203
222
|
}
|
|
204
223
|
)
|
|
205
224
|
] });
|
|
206
225
|
});
|
|
207
226
|
RelationshipEdge.displayName = "RelationshipEdge";
|
|
208
227
|
function ControlPoints({
|
|
228
|
+
isControlPointDragging,
|
|
209
229
|
edgeProps,
|
|
210
230
|
controlPoints,
|
|
211
231
|
onMove,
|
|
@@ -286,7 +306,7 @@ function ControlPoints({
|
|
|
286
306
|
}, 10);
|
|
287
307
|
};
|
|
288
308
|
const onControlPointerDown = useCallbackRef((e) => {
|
|
289
|
-
const { domNode, addSelectedEdges } = xyflowStore.getState();
|
|
309
|
+
const { domNode, addSelectedEdges, edges, unselectNodesAndEdges } = xyflowStore.getState();
|
|
290
310
|
if (!domNode || e.pointerType !== "mouse") {
|
|
291
311
|
return;
|
|
292
312
|
}
|
|
@@ -297,6 +317,9 @@ function ControlPoints({
|
|
|
297
317
|
switch (e.button) {
|
|
298
318
|
case 0: {
|
|
299
319
|
e.stopPropagation();
|
|
320
|
+
unselectNodesAndEdges({
|
|
321
|
+
edges: edges.filter((ed) => ed.selected && ed.id !== edgeId)
|
|
322
|
+
});
|
|
300
323
|
addSelectedEdges([edgeId]);
|
|
301
324
|
onLmbControlPointerDown(index, e, domNode);
|
|
302
325
|
break;
|
|
@@ -306,6 +329,17 @@ function ControlPoints({
|
|
|
306
329
|
break;
|
|
307
330
|
}
|
|
308
331
|
});
|
|
332
|
+
const onControlPointerDblClick = useCallbackRef((e) => {
|
|
333
|
+
const { domNode } = xyflowStore.getState();
|
|
334
|
+
if (!domNode || e.pointerType !== "mouse") {
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
const index = parseFloat(e.currentTarget.getAttribute("data-control-point-index") || "");
|
|
338
|
+
if (isNaN(index)) {
|
|
339
|
+
throw new Error("data-control-point-index is not a number");
|
|
340
|
+
}
|
|
341
|
+
onRmbControlPointerDown(index, e);
|
|
342
|
+
});
|
|
309
343
|
return /* @__PURE__ */ jsx(EdgeLabelRenderer, { children: /* @__PURE__ */ jsx(
|
|
310
344
|
EdgeContainer,
|
|
311
345
|
{
|
|
@@ -319,16 +353,18 @@ function ControlPoints({
|
|
|
319
353
|
children: /* @__PURE__ */ jsx(
|
|
320
354
|
"g",
|
|
321
355
|
{
|
|
356
|
+
"data-active": isControlPointDragging ? true : void 0,
|
|
357
|
+
className: "group",
|
|
322
358
|
onContextMenu: stopAndPrevent,
|
|
323
359
|
children: controlPoints.map((p, i) => /* @__PURE__ */ jsx(
|
|
324
360
|
"circle",
|
|
325
361
|
{
|
|
326
362
|
"data-control-point-index": i,
|
|
327
363
|
onPointerDownCapture: onControlPointerDown,
|
|
364
|
+
onDoubleClick: onControlPointerDblClick,
|
|
328
365
|
className: cx("nodrag nopan", controlPoint),
|
|
329
366
|
cx: p.x,
|
|
330
|
-
cy: p.y
|
|
331
|
-
r: 3
|
|
367
|
+
cy: p.y
|
|
332
368
|
},
|
|
333
369
|
"controlPoints" + edgeId + "#" + i
|
|
334
370
|
))
|
|
@@ -5,6 +5,7 @@ import '@xstate/react';
|
|
|
5
5
|
import 'fast-equals';
|
|
6
6
|
import 'react';
|
|
7
7
|
import { useDiagram } from '../../../hooks/safeContext.js';
|
|
8
|
+
import { EdgeDrifts } from './EdgeDrifts.js';
|
|
8
9
|
import { EdgeContainer } from '../../../base-primitives/edge/EdgeContainer.js';
|
|
9
10
|
import { EdgePath } from '../../../base-primitives/edge/EdgePath.js';
|
|
10
11
|
import { EdgeLabelContainer } from '../../../base-primitives/edge/EdgeLabelContainer.js';
|
|
@@ -13,7 +14,7 @@ import { EdgeActionButton } from '../../../base-primitives/edge/EdgeActionButton
|
|
|
13
14
|
|
|
14
15
|
const LABEL_OFFSET = 16;
|
|
15
16
|
function SequenceStepEdge(props) {
|
|
16
|
-
const { enableNavigateTo } = useEnabledFeatures();
|
|
17
|
+
const { enableNavigateTo, enableCompareWithLatest } = useEnabledFeatures();
|
|
17
18
|
const diagram = useDiagram();
|
|
18
19
|
const { navigateTo } = props.data;
|
|
19
20
|
const isSelfLoop = props.source === props.target;
|
|
@@ -50,6 +51,7 @@ function SequenceStepEdge(props) {
|
|
|
50
51
|
svgPath: path
|
|
51
52
|
}
|
|
52
53
|
),
|
|
54
|
+
enableCompareWithLatest && /* @__PURE__ */ jsx(EdgeDrifts, { edgeProps: props, svgPath: path }),
|
|
53
55
|
/* @__PURE__ */ jsx(
|
|
54
56
|
EdgeLabelContainer,
|
|
55
57
|
{
|