@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
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { DiagramView, DynamicViewDisplayVariant, WhereOperator } from '@likec4/core/types';
|
|
2
2
|
import { PropsWithChildren } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { ViewPaddings } from '../../LikeC4Diagram.props';
|
|
4
4
|
export declare function DiagramActorProvider({ view, zoomable, pannable, nodesDraggable, nodesSelectable, fitViewPadding, where, children, dynamicViewVariant: _defaultVariant, }: PropsWithChildren<{
|
|
5
5
|
view: DiagramView;
|
|
6
6
|
zoomable: boolean;
|
|
7
7
|
pannable: boolean;
|
|
8
8
|
nodesDraggable: boolean;
|
|
9
9
|
nodesSelectable: boolean;
|
|
10
|
-
fitViewPadding:
|
|
10
|
+
fitViewPadding: ViewPaddings;
|
|
11
11
|
where: WhereOperator | null;
|
|
12
12
|
dynamicViewVariant: DynamicViewDisplayVariant | undefined;
|
|
13
13
|
}>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { useRafEffect } from '@react-hookz/web';
|
|
3
3
|
import { useActorRef, useSelector } from '@xstate/react';
|
|
4
4
|
import { useStoreApi } from '@xyflow/react';
|
|
5
5
|
import { shallowEqual } from 'fast-equals';
|
|
6
|
-
import { useState, useEffect, memo
|
|
7
|
-
import { isNullish } from 'remeda';
|
|
6
|
+
import { useRef, useState, useEffect, memo } from 'react';
|
|
7
|
+
import { omitBy, isNullish } from 'remeda';
|
|
8
8
|
import { ErrorBoundary } from '../../components/ErrorFallback.js';
|
|
9
9
|
import { useDiagramEventHandlers } from '../../context/DiagramEventHandlers.js';
|
|
10
10
|
import { useEnabledFeatures, DiagramFeatures } from '../../context/DiagramFeatures.js';
|
|
11
11
|
import { CurrentViewModelContext } from '../../context/LikeC4ModelContext.js';
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
12
|
+
import { useEditorActorLogic } from '../../editor/useEditorActorLogic.js';
|
|
13
|
+
import { DiagramActorContextProvider, DiagramApiContextProvider, useDiagram } from '../../hooks/safeContext.js';
|
|
14
|
+
import { useOnDiagramEvent, useDiagramContext } from '../../hooks/useDiagram.js';
|
|
14
15
|
import { useLikeC4Model } from '../../hooks/useLikeC4Model.js';
|
|
15
16
|
import { useUpdateEffect } from '../../hooks/useUpdateEffect.js';
|
|
16
|
-
import { convertToXYFlow } from '../convert-to-xyflow.js';
|
|
17
17
|
import { makeDiagramApi } from './diagram-api.js';
|
|
18
18
|
import { diagramMachine } from './machine.js';
|
|
19
19
|
import { DiagramToggledFeaturesPersistence } from './persistence.js';
|
|
@@ -30,8 +30,13 @@ function DiagramActorProvider({
|
|
|
30
30
|
dynamicViewVariant: _defaultVariant
|
|
31
31
|
}) {
|
|
32
32
|
const xystore = useStoreApi();
|
|
33
|
-
const
|
|
34
|
-
|
|
33
|
+
const editorActor = useEditorActorLogic(view.id);
|
|
34
|
+
const actor = useActorRef(
|
|
35
|
+
diagramMachine.provide({
|
|
36
|
+
actors: {
|
|
37
|
+
editorActor
|
|
38
|
+
}
|
|
39
|
+
}),
|
|
35
40
|
{
|
|
36
41
|
id: `diagram`,
|
|
37
42
|
systemId: "diagram",
|
|
@@ -44,55 +49,61 @@ function DiagramActorProvider({
|
|
|
44
49
|
fitViewPadding,
|
|
45
50
|
nodesDraggable,
|
|
46
51
|
nodesSelectable,
|
|
52
|
+
where,
|
|
47
53
|
dynamicViewVariant: _defaultVariant
|
|
48
54
|
}
|
|
49
55
|
}
|
|
50
56
|
);
|
|
57
|
+
const actorRef = useRef(actor);
|
|
58
|
+
if (actorRef.current !== actor) {
|
|
59
|
+
console.warn("DiagramMachine actor instance changed", {
|
|
60
|
+
context: {
|
|
61
|
+
previous: actorRef.current.getSnapshot().context,
|
|
62
|
+
current: actor.getSnapshot().context
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
actorRef.current = actor;
|
|
66
|
+
}
|
|
51
67
|
const [api, setApi] = useState(() => makeDiagramApi(actorRef));
|
|
52
68
|
useEffect(() => {
|
|
53
69
|
setApi((api2) => {
|
|
54
|
-
if (api2.
|
|
70
|
+
if (api2.ref === actorRef) {
|
|
71
|
+
return api2;
|
|
72
|
+
}
|
|
73
|
+
console.warn(
|
|
74
|
+
"DiagramMachine actorRef changed, creating new DiagramApi instance, this should not happen during the lifetime of the actor"
|
|
75
|
+
);
|
|
55
76
|
return makeDiagramApi(actorRef);
|
|
56
77
|
});
|
|
57
78
|
}, [actorRef]);
|
|
58
|
-
if (api.actor !== actorRef) {
|
|
59
|
-
console.warn("DiagramApi instance changed, this should not happen during the lifetime of the actor");
|
|
60
|
-
}
|
|
61
79
|
const features = useEnabledFeatures();
|
|
62
80
|
useEffect(
|
|
63
|
-
() =>
|
|
64
|
-
[features,
|
|
81
|
+
() => actor.send({ type: "update.features", features }),
|
|
82
|
+
[features, actor]
|
|
65
83
|
);
|
|
66
84
|
useEffect(
|
|
67
|
-
() =>
|
|
85
|
+
() => actor.send({
|
|
68
86
|
type: "update.inputs",
|
|
69
|
-
inputs: { zoomable, pannable, fitViewPadding, nodesDraggable, nodesSelectable }
|
|
87
|
+
inputs: { zoomable, where, pannable, fitViewPadding, nodesDraggable, nodesSelectable }
|
|
70
88
|
}),
|
|
71
|
-
[zoomable, pannable, fitViewPadding,
|
|
89
|
+
[zoomable, where, pannable, fitViewPadding, actor, nodesDraggable, nodesSelectable]
|
|
72
90
|
);
|
|
73
91
|
useUpdateEffect(() => {
|
|
74
92
|
if (!_defaultVariant) return;
|
|
75
|
-
|
|
76
|
-
}, [_defaultVariant,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
view,
|
|
84
|
-
where,
|
|
85
|
-
actorRef
|
|
86
|
-
}
|
|
87
|
-
),
|
|
88
|
-
/* @__PURE__ */ jsx(CurrentViewModelProvider, { actorRef, children })
|
|
89
|
-
] }),
|
|
93
|
+
actor.send({ type: "switch.dynamicViewVariant", variant: _defaultVariant });
|
|
94
|
+
}, [_defaultVariant, actor]);
|
|
95
|
+
useRafEffect(
|
|
96
|
+
() => actor.send({ type: "update.view", view, source: "external" }),
|
|
97
|
+
[actor, view]
|
|
98
|
+
);
|
|
99
|
+
return /* @__PURE__ */ jsx(DiagramActorContextProvider, { value: actor, children: /* @__PURE__ */ jsxs(DiagramApiContextProvider, { value: api, children: [
|
|
100
|
+
/* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(CurrentViewModelProvider, { actorRef: actor, children }) }),
|
|
90
101
|
/* @__PURE__ */ jsx(DiagramActorEventListener, {})
|
|
91
|
-
] });
|
|
102
|
+
] }) });
|
|
92
103
|
}
|
|
93
104
|
const selectFromActor = ({ context }) => {
|
|
94
105
|
let toggledFeatures = context.toggledFeatures;
|
|
95
|
-
const hasDrifts = context.view.drifts != null;
|
|
106
|
+
const hasDrifts = context.view.drifts != null && context.view.drifts.length > 0;
|
|
96
107
|
const enableCompareWithLatest = context.features.enableCompareWithLatest && (toggledFeatures.enableCompareWithLatest ?? false) && isNullish(context.activeWalkthrough) && hasDrifts;
|
|
97
108
|
const enableReadOnly = context.features.enableReadOnly || toggledFeatures.enableReadOnly || !!context.activeWalkthrough || context.dynamicViewVariant === "sequence" && context.view._type === "dynamic" || enableCompareWithLatest && context.view._layout === "auto";
|
|
98
109
|
if (toggledFeatures.enableReadOnly !== enableReadOnly || toggledFeatures.enableCompareWithLatest !== enableCompareWithLatest) {
|
|
@@ -116,62 +127,42 @@ function CurrentViewModelProvider({ children, actorRef }) {
|
|
|
116
127
|
selectFromActor,
|
|
117
128
|
compareSelected
|
|
118
129
|
);
|
|
119
|
-
useUpdateEffect(() => {
|
|
120
|
-
DiagramToggledFeaturesPersistence.write(toggledFeatures);
|
|
121
|
-
}, [toggledFeatures]);
|
|
122
130
|
const likec4model = useLikeC4Model();
|
|
123
131
|
const viewmodel = likec4model.findView(viewId);
|
|
124
132
|
return /* @__PURE__ */ jsx(CurrentViewModelContext.Provider, { value: viewmodel, children: /* @__PURE__ */ jsx(DiagramFeatures, { overrides: toggledFeatures, children }) });
|
|
125
133
|
}
|
|
126
|
-
const selectFromActor2 = (state) => {
|
|
127
|
-
return state.context.dynamicViewVariant;
|
|
128
|
-
};
|
|
129
|
-
function DiagramXYFlowSyncProvider({ view, where, actorRef }) {
|
|
130
|
-
const dynamicViewVariant = useSelector(actorRef, selectFromActor2);
|
|
131
|
-
useRafEffect(() => {
|
|
132
|
-
actorRef.send({
|
|
133
|
-
type: "update.view",
|
|
134
|
-
...convertToXYFlow({ view, where, dynamicViewVariant })
|
|
135
|
-
});
|
|
136
|
-
}, [view, where, dynamicViewVariant, actorRef]);
|
|
137
|
-
return null;
|
|
138
|
-
}
|
|
139
134
|
const DiagramActorEventListener = memo(() => {
|
|
140
135
|
const diagram = useDiagram();
|
|
141
136
|
const {
|
|
142
137
|
onNavigateTo,
|
|
143
138
|
onOpenSource,
|
|
144
|
-
onChange,
|
|
139
|
+
// onChange,
|
|
145
140
|
onLayoutTypeChange,
|
|
146
141
|
handlersRef
|
|
147
142
|
} = useDiagramEventHandlers();
|
|
148
143
|
useOnDiagramEvent("openSource", ({ params }) => onOpenSource?.(params));
|
|
149
144
|
useOnDiagramEvent("navigateTo", ({ viewId }) => onNavigateTo?.(viewId));
|
|
150
|
-
useOnDiagramEvent("onChange", ({ change }) => onChange?.({ change }));
|
|
151
145
|
useOnDiagramEvent("onLayoutTypeChange", ({ layoutType }) => {
|
|
152
146
|
onLayoutTypeChange?.(layoutType);
|
|
153
147
|
});
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
handlersRef.current.onInitialized?.({ diagram, xyflow });
|
|
162
|
-
} catch (error) {
|
|
163
|
-
console.error(error);
|
|
164
|
-
} finally {
|
|
165
|
-
wasEmitted.current = true;
|
|
166
|
-
subscription?.unsubscribe();
|
|
167
|
-
subscription = null;
|
|
168
|
-
}
|
|
148
|
+
useOnDiagramEvent(
|
|
149
|
+
"initialized",
|
|
150
|
+
({ instance: xyflow }) => {
|
|
151
|
+
try {
|
|
152
|
+
handlersRef.current.onInitialized?.({ diagram, xyflow });
|
|
153
|
+
} catch (error) {
|
|
154
|
+
console.error(error);
|
|
169
155
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
156
|
+
},
|
|
157
|
+
{ once: true }
|
|
158
|
+
);
|
|
159
|
+
const toggledFeatures = useDiagramContext(
|
|
160
|
+
(ctx) => ctx.toggledFeatures,
|
|
161
|
+
shallowEqual
|
|
162
|
+
);
|
|
163
|
+
useUpdateEffect(() => {
|
|
164
|
+
DiagramToggledFeaturesPersistence.write(omitBy(toggledFeatures, isNullish));
|
|
165
|
+
}, [toggledFeatures]);
|
|
175
166
|
return null;
|
|
176
167
|
});
|
|
177
168
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { XYPoint } from '@likec4/core';
|
|
1
|
+
import { LayoutedView, XYPoint } from '@likec4/core';
|
|
2
2
|
import { NodeLookup } from '@xyflow/system';
|
|
3
3
|
import { Types } from '../types';
|
|
4
4
|
import { ActionArg, Context as DiagramContext } from './machine.setup';
|
|
@@ -8,12 +8,19 @@ export declare function lastClickedNode(params: {
|
|
|
8
8
|
node: Types.Node;
|
|
9
9
|
};
|
|
10
10
|
}): DiagramContext['lastClickedNode'];
|
|
11
|
-
export declare function mergeXYNodesEdges(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
export declare function mergeXYNodesEdges(context: Pick<DiagramContext, 'xynodes' | 'xyedges' | 'view'>, event: {
|
|
12
|
+
view: LayoutedView;
|
|
13
|
+
xynodes: Types.Node[];
|
|
14
|
+
xyedges: Types.Edge[];
|
|
15
|
+
}): {
|
|
16
|
+
xynodes: Types.Node[];
|
|
17
|
+
xyedges: Types.Edge[];
|
|
18
|
+
view: LayoutedView;
|
|
19
|
+
};
|
|
20
|
+
export declare function focusNodesEdges(context: DiagramContext): {
|
|
21
|
+
xynodes: Types.Node<"element" | "deployment" | "compound-element" | "compound-deployment" | "view-group" | "seq-actor" | "seq-parallel">[];
|
|
22
|
+
xyedges: Types.Edge<"relationship" | "seq-step">[];
|
|
23
|
+
} | null;
|
|
16
24
|
export declare function updateNodeData({ context, event }: ActionArg): Partial<DiagramContext>;
|
|
17
25
|
export declare function updateEdgeData({ context, event }: ActionArg): Partial<DiagramContext>;
|
|
18
26
|
export declare function resetEdgeControlPoints(nodeLookup: NodeLookup, edge: Types.Edge): [XYPoint] | [XYPoint, XYPoint];
|
|
19
|
-
export declare function updateActiveWalkthrough({ context }: ActionArg): Partial<DiagramContext>;
|
|
@@ -1,72 +1,38 @@
|
|
|
1
|
-
import { nonNullable
|
|
1
|
+
import { nonNullable } from '@likec4/core';
|
|
2
|
+
import { vector } from '@likec4/core/geometry';
|
|
2
3
|
import { getNodeDimensions } from '@xyflow/system';
|
|
3
4
|
import { deepEqual } from 'fast-equals';
|
|
4
|
-
import { mergeDeep
|
|
5
|
+
import { mergeDeep } from 'remeda';
|
|
5
6
|
import { assertEvent } from 'xstate';
|
|
6
|
-
import { vector } from '../../utils/vector.js';
|
|
7
7
|
import { getNodeCenter } from '../../utils/xyflow.js';
|
|
8
|
-
import {
|
|
8
|
+
import { updateNodes } from '../../base/updateNodes.js';
|
|
9
|
+
import { updateEdges } from '../../base/updateEdges.js';
|
|
9
10
|
import { Base } from '../../base/Base.js';
|
|
10
11
|
|
|
11
|
-
function mergeXYNodesEdges(
|
|
12
|
-
assertEvent(event, "update.view");
|
|
12
|
+
function mergeXYNodesEdges(context, event) {
|
|
13
13
|
const nextView = event.view;
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (deepEqual(existing.type, update.type) && deepEqual(existingWidth, update.initialWidth) && deepEqual(existingHeight, update.initialHeight) && deepEqual(existing.hidden ?? false, update.hidden ?? false) && deepEqual(existing.position, update.position) && deepEqual(existing.data, update.data) && deepEqual(existing.parentId ?? null, update.parentId ?? null)) {
|
|
24
|
-
return existing;
|
|
25
|
-
}
|
|
26
|
-
return {
|
|
27
|
-
...omit(existing, ["measured", "parentId", "hidden"]),
|
|
28
|
-
...update,
|
|
29
|
-
// Force dimensions from update
|
|
30
|
-
width: update.initialWidth,
|
|
31
|
-
height: update.initialHeight
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
return update;
|
|
35
|
-
});
|
|
36
|
-
let xyedges = event.xyedges;
|
|
37
|
-
if (isSameView && (!nextView.drifts || nextView.drifts.length === 0)) {
|
|
38
|
-
const currentEdges = context.xyedges;
|
|
39
|
-
xyedges = event.xyedges.map((update) => {
|
|
40
|
-
const existing = currentEdges.find((n) => n.id === update.id);
|
|
41
|
-
if (existing === update) {
|
|
42
|
-
return existing;
|
|
43
|
-
}
|
|
44
|
-
if (existing && existing.type === update.type) {
|
|
45
|
-
if (deepEqual(existing.hidden ?? false, update.hidden ?? false) && deepEqual(existing.data, update.data) && deepEqual(existing.source, update.source) && deepEqual(existing.target, update.target) && deepEqual(existing.sourceHandle, update.sourceHandle) && deepEqual(existing.targetHandle, update.targetHandle)) {
|
|
46
|
-
return existing;
|
|
47
|
-
}
|
|
48
|
-
return {
|
|
49
|
-
...omit(existing, ["hidden", "sourceHandle", "targetHandle"]),
|
|
50
|
-
...update,
|
|
51
|
-
data: {
|
|
52
|
-
...existing.data,
|
|
53
|
-
...update.data
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
return update;
|
|
58
|
-
});
|
|
14
|
+
const currentView = context.view;
|
|
15
|
+
const isSameView = currentView.id === nextView.id;
|
|
16
|
+
const isDynamicViewUpdate = nextView._type === "dynamic" && nextView.variant === "sequence";
|
|
17
|
+
if (isDynamicViewUpdate) {
|
|
18
|
+
return {
|
|
19
|
+
xynodes: event.xynodes,
|
|
20
|
+
xyedges: event.xyedges,
|
|
21
|
+
view: nextView
|
|
22
|
+
};
|
|
59
23
|
}
|
|
24
|
+
const xynodes = updateNodes(context.xynodes, event.xynodes);
|
|
25
|
+
const xyedges = isSameView ? updateEdges(context.xyedges, event.xyedges) : event.xyedges;
|
|
60
26
|
return {
|
|
61
27
|
xynodes,
|
|
62
28
|
xyedges,
|
|
63
29
|
view: nextView
|
|
64
30
|
};
|
|
65
31
|
}
|
|
66
|
-
function focusNodesEdges(
|
|
67
|
-
const { xynodes: _xynodes, xyedges: _xyedges, focusedNode } =
|
|
32
|
+
function focusNodesEdges(context) {
|
|
33
|
+
const { xynodes: _xynodes, xyedges: _xyedges, focusedNode } = context;
|
|
68
34
|
if (!focusedNode) {
|
|
69
|
-
return
|
|
35
|
+
return null;
|
|
70
36
|
}
|
|
71
37
|
const focused = /* @__PURE__ */ new Set([focusedNode]);
|
|
72
38
|
const xyedges = _xyedges.map((edge) => {
|
|
@@ -88,126 +54,7 @@ function focusNodesEdges(params) {
|
|
|
88
54
|
xyedges
|
|
89
55
|
};
|
|
90
56
|
}
|
|
91
|
-
function updateNavigationHistory({ context, event }) {
|
|
92
|
-
assertEvent(event, "update.view");
|
|
93
|
-
let {
|
|
94
|
-
navigationHistory: {
|
|
95
|
-
currentIndex,
|
|
96
|
-
history
|
|
97
|
-
},
|
|
98
|
-
lastOnNavigate,
|
|
99
|
-
viewport
|
|
100
|
-
} = context;
|
|
101
|
-
const stepCurrent = history[currentIndex];
|
|
102
|
-
if (!stepCurrent) {
|
|
103
|
-
return {
|
|
104
|
-
navigationHistory: {
|
|
105
|
-
currentIndex: 0,
|
|
106
|
-
history: [
|
|
107
|
-
{
|
|
108
|
-
viewId: event.view.id,
|
|
109
|
-
fromNode: null,
|
|
110
|
-
viewport: { ...viewport }
|
|
111
|
-
}
|
|
112
|
-
]
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
if (stepCurrent.viewId !== event.view.id) {
|
|
117
|
-
if (!lastOnNavigate) {
|
|
118
|
-
const stepBack = currentIndex > 0 ? nonNullable(history[currentIndex - 1]) : null;
|
|
119
|
-
if (stepBack && stepBack.viewId === event.view.id) {
|
|
120
|
-
return {
|
|
121
|
-
navigationHistory: {
|
|
122
|
-
currentIndex: currentIndex - 1,
|
|
123
|
-
history
|
|
124
|
-
},
|
|
125
|
-
lastOnNavigate: {
|
|
126
|
-
fromView: stepCurrent.viewId,
|
|
127
|
-
toView: stepBack.viewId,
|
|
128
|
-
fromNode: stepCurrent.fromNode
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
const stepForward = currentIndex < history.length - 1 ? nonNullable(history[currentIndex + 1]) : null;
|
|
133
|
-
if (stepForward && stepForward.viewId === event.view.id) {
|
|
134
|
-
return {
|
|
135
|
-
navigationHistory: {
|
|
136
|
-
currentIndex: currentIndex + 1,
|
|
137
|
-
history
|
|
138
|
-
},
|
|
139
|
-
lastOnNavigate: {
|
|
140
|
-
fromView: stepCurrent.viewId,
|
|
141
|
-
toView: stepForward.viewId,
|
|
142
|
-
fromNode: stepForward.fromNode
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
history = [
|
|
148
|
-
...history.slice(0, currentIndex + 1),
|
|
149
|
-
{
|
|
150
|
-
viewId: event.view.id,
|
|
151
|
-
fromNode: lastOnNavigate?.fromNode ?? null,
|
|
152
|
-
viewport: { ...viewport }
|
|
153
|
-
}
|
|
154
|
-
];
|
|
155
|
-
currentIndex = history.length - 1;
|
|
156
|
-
return {
|
|
157
|
-
navigationHistory: {
|
|
158
|
-
currentIndex,
|
|
159
|
-
history
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
return {};
|
|
164
|
-
}
|
|
165
|
-
function navigateBack({ context }) {
|
|
166
|
-
const {
|
|
167
|
-
navigationHistory: {
|
|
168
|
-
currentIndex,
|
|
169
|
-
history
|
|
170
|
-
}
|
|
171
|
-
} = context;
|
|
172
|
-
invariant(currentIndex > 0, "Cannot navigate back");
|
|
173
|
-
const stepCurrent = history[currentIndex];
|
|
174
|
-
const stepBack = history[currentIndex - 1];
|
|
175
|
-
return {
|
|
176
|
-
navigationHistory: {
|
|
177
|
-
currentIndex: currentIndex - 1,
|
|
178
|
-
history
|
|
179
|
-
},
|
|
180
|
-
lastOnNavigate: {
|
|
181
|
-
fromView: stepCurrent.viewId,
|
|
182
|
-
toView: stepBack.viewId,
|
|
183
|
-
fromNode: stepCurrent.fromNode
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
function navigateForward({ context }) {
|
|
188
|
-
const {
|
|
189
|
-
navigationHistory: {
|
|
190
|
-
currentIndex,
|
|
191
|
-
history
|
|
192
|
-
}
|
|
193
|
-
} = context;
|
|
194
|
-
invariant(currentIndex < history.length - 1, "Cannot navigate forward");
|
|
195
|
-
const stepCurrent = history[currentIndex];
|
|
196
|
-
const stepForward = history[currentIndex + 1];
|
|
197
|
-
return {
|
|
198
|
-
navigationHistory: {
|
|
199
|
-
currentIndex: currentIndex + 1,
|
|
200
|
-
history
|
|
201
|
-
},
|
|
202
|
-
lastOnNavigate: {
|
|
203
|
-
fromView: stepCurrent.viewId,
|
|
204
|
-
toView: stepForward.viewId,
|
|
205
|
-
fromNode: stepForward.fromNode
|
|
206
|
-
}
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
57
|
function updateNodeData({ context, event }) {
|
|
210
|
-
console.log("updateNodeData called", event);
|
|
211
58
|
assertEvent(event, "update.nodeData");
|
|
212
59
|
const xynodes = context.xynodes.map((node) => {
|
|
213
60
|
if (node.id !== event.nodeId) {
|
|
@@ -257,37 +104,18 @@ function resetEdgeControlPoints(nodeLookup, edge) {
|
|
|
257
104
|
const loopSize = 80;
|
|
258
105
|
const centerOfTopBoundary = vector(0, source.height || 0).multiply(-0.5).add(sourceCenter);
|
|
259
106
|
return [
|
|
260
|
-
centerOfTopBoundary.add(vector(-loopSize / 2.5, -loopSize)),
|
|
261
|
-
centerOfTopBoundary.add(vector(loopSize / 2.5, -loopSize))
|
|
107
|
+
centerOfTopBoundary.add(vector(-loopSize / 2.5, -loopSize)).round().toObject(),
|
|
108
|
+
centerOfTopBoundary.add(vector(loopSize / 2.5, -loopSize)).round().toObject()
|
|
262
109
|
];
|
|
263
110
|
}
|
|
264
111
|
const sourceToTargetVector = targetCenter.subtract(sourceCenter);
|
|
265
112
|
const sourceBorderPoint = getBorderPointOnVector(source, sourceCenter, sourceToTargetVector);
|
|
266
113
|
const targetBorderPoint = getBorderPointOnVector(target, targetCenter, sourceToTargetVector.multiply(-1));
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
return {
|
|
273
|
-
xyedges: context.xyedges.map((edge) => {
|
|
274
|
-
const active = stepId === edge.id || !!parallelPrefix && edge.id.startsWith(parallelPrefix);
|
|
275
|
-
return Base.setData(edge, {
|
|
276
|
-
active,
|
|
277
|
-
dimmed: stepId !== edge.id
|
|
278
|
-
});
|
|
279
|
-
}),
|
|
280
|
-
xynodes: context.xynodes.map((node) => {
|
|
281
|
-
const dimmed = step.source !== node.id && step.target !== node.id;
|
|
282
|
-
if (node.type === "seq-parallel") {
|
|
283
|
-
return Base.setData(node, {
|
|
284
|
-
color: parallelPrefix === node.data.parallelPrefix ? SeqParallelAreaColor.active : SeqParallelAreaColor.default,
|
|
285
|
-
dimmed
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
return Base.setDimmed(node, dimmed);
|
|
289
|
-
})
|
|
290
|
-
};
|
|
114
|
+
const sourceToTarget = targetBorderPoint.subtract(sourceBorderPoint);
|
|
115
|
+
return [
|
|
116
|
+
sourceBorderPoint.add(sourceToTarget.multiply(0.4)).round().toObject(),
|
|
117
|
+
sourceBorderPoint.add(sourceToTarget.multiply(0.6)).round().toObject()
|
|
118
|
+
];
|
|
291
119
|
}
|
|
292
120
|
|
|
293
|
-
export { focusNodesEdges, mergeXYNodesEdges,
|
|
121
|
+
export { focusNodesEdges, mergeXYNodesEdges, resetEdgeControlPoints, updateEdgeData, updateNodeData };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getNodeDimensions } from '@xyflow/system';
|
|
2
|
-
import {
|
|
2
|
+
import { map, omit, hasAtLeast } from 'remeda';
|
|
3
3
|
import { calcViewBounds } from '../../utils/view-bounds.js';
|
|
4
4
|
import { isSamePoint, bezierControlPoints } from '../../utils/xyflow.js';
|
|
5
5
|
|
|
@@ -13,42 +13,40 @@ function createViewChange(parentContext) {
|
|
|
13
13
|
...view
|
|
14
14
|
},
|
|
15
15
|
xynodes,
|
|
16
|
-
xyedges,
|
|
17
16
|
xystore
|
|
18
17
|
} = parentContext;
|
|
19
|
-
const { nodeLookup } = xystore.getState();
|
|
18
|
+
const { nodeLookup, edgeLookup } = xystore.getState();
|
|
20
19
|
const movedNodes = /* @__PURE__ */ new Set();
|
|
21
|
-
const xynodesLookup = indexBy(xynodes, (n) => n.data.id);
|
|
22
|
-
const xyedgesLookup = indexBy(xyedges, (e) => e.data.id);
|
|
23
20
|
const nodes = map(view.nodes, (node) => {
|
|
24
|
-
const
|
|
25
|
-
if (!
|
|
21
|
+
const internal = nodeLookup.get(node.id);
|
|
22
|
+
if (!internal) {
|
|
23
|
+
console.error(`Internal node not found for ${node.id}`);
|
|
26
24
|
return node;
|
|
27
25
|
}
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
const xynodedata = xynodes.find((n) => n.id === node.id)?.data ?? internal.data;
|
|
27
|
+
const position = internal.internals.positionAbsolute;
|
|
28
|
+
const { width, height } = getNodeDimensions(internal);
|
|
29
|
+
const isChanged = !isSamePoint(position, node) || node.width !== width || node.height !== height;
|
|
30
|
+
if (isChanged) {
|
|
31
|
+
movedNodes.add(node.id);
|
|
33
32
|
}
|
|
34
|
-
movedNodes.add(xynode.id);
|
|
35
33
|
return {
|
|
36
34
|
...node,
|
|
37
|
-
shape:
|
|
38
|
-
color:
|
|
35
|
+
shape: xynodedata.shape,
|
|
36
|
+
color: xynodedata.color,
|
|
39
37
|
style: {
|
|
40
|
-
...
|
|
41
|
-
...xynode.data.style
|
|
38
|
+
...xynodedata.style
|
|
42
39
|
},
|
|
43
|
-
x: Math.floor(
|
|
44
|
-
y: Math.floor(
|
|
45
|
-
width: Math.ceil(
|
|
46
|
-
height: Math.ceil(
|
|
40
|
+
x: Math.floor(position.x),
|
|
41
|
+
y: Math.floor(position.y),
|
|
42
|
+
width: Math.ceil(width),
|
|
43
|
+
height: Math.ceil(height)
|
|
47
44
|
};
|
|
48
45
|
});
|
|
49
46
|
const edges = map(view.edges, (edge) => {
|
|
50
|
-
const xyedge =
|
|
47
|
+
const xyedge = edgeLookup.get(edge.id);
|
|
51
48
|
if (!xyedge) {
|
|
49
|
+
console.error(`Internal edge not found for ${edge.id}`);
|
|
52
50
|
return edge;
|
|
53
51
|
}
|
|
54
52
|
const data = xyedge.data;
|
|
@@ -58,17 +56,11 @@ function createViewChange(parentContext) {
|
|
|
58
56
|
controlPoints = bezierControlPoints(data.points);
|
|
59
57
|
}
|
|
60
58
|
const _updated = {
|
|
61
|
-
...omit(edge, ["controlPoints"]),
|
|
59
|
+
...omit(edge, ["controlPoints", "labelBBox"]),
|
|
62
60
|
points: data.points
|
|
63
61
|
};
|
|
64
|
-
if (data.labelXY && data.labelBBox) {
|
|
65
|
-
_updated.labelBBox = {
|
|
66
|
-
...data.labelBBox,
|
|
67
|
-
...data.labelXY
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
62
|
if (data.labelBBox) {
|
|
71
|
-
_updated.labelBBox
|
|
63
|
+
_updated.labelBBox = data.labelBBox;
|
|
72
64
|
}
|
|
73
65
|
if (hasAtLeast(controlPoints, 1)) {
|
|
74
66
|
_updated.controlPoints = controlPoints;
|
|
@@ -77,6 +69,7 @@ function createViewChange(parentContext) {
|
|
|
77
69
|
});
|
|
78
70
|
const snapshot = {
|
|
79
71
|
...view,
|
|
72
|
+
_layout: "manual",
|
|
80
73
|
bounds: calcViewBounds({ nodes, edges }),
|
|
81
74
|
nodes,
|
|
82
75
|
edges
|