@likec4/diagram 1.43.0 → 1.45.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 +14727 -13166
- package/dist/LikeC4Diagram.d.ts +1 -1
- package/dist/LikeC4Diagram.js +14 -9
- package/dist/LikeC4Diagram.props.d.ts +25 -15
- package/dist/LikeC4ProjectsProvider.js +1 -1
- package/dist/LikeC4Styles.js +0 -3
- package/dist/LikeC4View.d.ts +8 -3
- package/dist/LikeC4View.js +29 -14
- package/dist/ReactLikeC4.d.ts +2 -2
- package/dist/ReactLikeC4.js +2 -2
- package/dist/StaticLikeC4Diagram.js +1 -1
- package/dist/_virtual/_commonjsHelpers.js +3 -0
- package/dist/_virtual/assign-dea9f7c8.cjs.js +3 -0
- package/dist/_virtual/log-ec8d4df4.cjs.js +3 -0
- package/dist/_virtual/raise-da5b247f.cjs.js +3 -0
- package/dist/_virtual/xstate-actions.cjs.js +5 -0
- package/dist/_virtual/xstate-actions.cjs2.js +3 -0
- package/dist/_virtual/xstate-dev.cjs.js +3 -0
- package/dist/_virtual/xstate-guards.cjs.js +5 -0
- package/dist/_virtual/xstate-guards.cjs2.js +3 -0
- package/dist/base/Background.d.ts +2 -1
- package/dist/base/Background.js +11 -2
- package/dist/base/Base.d.ts +28 -0
- package/dist/base/BaseXYFlow.d.ts +5 -5
- package/dist/base/BaseXYFlow.js +38 -44
- package/dist/base/index.d.ts +6 -2
- package/dist/base/types.d.ts +1 -28
- package/dist/base/updateEdges.js +25 -14
- package/dist/base/updateNodes.d.ts +14 -0
- package/dist/base/updateNodes.js +51 -17
- package/dist/base-primitives/Markdown.d.ts +30 -4
- package/dist/base-primitives/Markdown.js +3 -2
- 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 +8 -1
- package/dist/base-primitives/edge/EdgeLabel.d.ts +3 -2
- package/dist/base-primitives/edge/EdgeLabel.js +2 -0
- package/dist/base-primitives/edge/EdgeLabelContainer.d.ts +1 -1
- package/dist/base-primitives/edge/EdgeLabelContainer.js +4 -0
- package/dist/base-primitives/edge/EdgePath.d.ts +4 -0
- package/dist/base-primitives/edge/EdgePath.js +29 -5
- package/dist/base-primitives/element/ElementActionButtons.d.ts +6 -4
- 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 +5 -5
- package/dist/base-primitives/element/ElementNodeContainer.css.js +15 -27
- package/dist/base-primitives/element/ElementShape.js +5 -5
- package/dist/base-primitives/element/ElementTags.d.ts +6 -4
- package/dist/base-primitives/element/ElementTags.js +2 -1
- package/dist/base-primitives/memoEdge.js +4 -2
- package/dist/base-primitives/memoNode.d.ts +1 -1
- package/dist/base-primitives/memoNode.js +3 -3
- package/dist/components/ErrorFallback.js +52 -35
- package/dist/components/Link.js +2 -2
- package/dist/context/DiagramEventHandlers.js +2 -1
- package/dist/context/DiagramFeatures.d.ts +25 -6
- package/dist/context/DiagramFeatures.js +28 -56
- package/dist/context/IconRenderer.js +6 -6
- package/dist/context/LikeC4ModelContext.js +3 -10
- package/dist/context/TagStylesContext.js +3 -19
- package/dist/context/index.d.ts +1 -1
- package/dist/custom/customNodes.js +3 -2
- package/dist/custom/hooks.d.ts +3 -3
- package/dist/custom/index.d.ts +1 -1
- package/dist/custom/index.js +5 -5
- package/dist/editor/LikeC4EditorContext.d.ts +21 -0
- package/dist/editor/index.d.ts +2 -0
- package/dist/hooks/index.d.ts +4 -2
- package/dist/hooks/safeContext.d.ts +6 -3
- package/dist/hooks/safeContext.js +10 -3
- package/dist/hooks/useCallbackRef.d.ts +1 -0
- package/dist/hooks/useCallbackRef.js +13 -0
- package/dist/hooks/useCurrentView.d.ts +11 -0
- package/dist/hooks/{useCurrentViewId.js → useCurrentView.js} +7 -3
- package/dist/hooks/useCurrentViewModel.js +4 -1
- package/dist/hooks/useDiagram.d.ts +7 -113
- package/dist/hooks/useDiagram.js +7 -127
- package/dist/hooks/useDiagramCompareLayout.d.ts +35 -0
- package/dist/hooks/useDiagramCompareLayout.js +65 -0
- 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/hooks/useUpdateEffect.js +2 -4
- package/dist/hooks/useXYFlow.d.ts +1 -0
- package/dist/hooks/useXYFlow.js +4 -7
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -3
- package/dist/likec4diagram/DiagramUI.js +14 -7
- package/dist/likec4diagram/DiagramXYFlow.d.ts +2 -2
- package/dist/likec4diagram/DiagramXYFlow.js +60 -52
- package/dist/likec4diagram/convert-to-xyflow.d.ts +0 -1
- package/dist/likec4diagram/custom/edges/EdgeDrifts.d.ts +6 -0
- package/dist/likec4diagram/custom/edges/EdgeDrifts.js +38 -0
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +256 -217
- package/dist/likec4diagram/custom/edges/SequenceStepEdge.js +9 -2
- package/dist/likec4diagram/custom/edges/edges.css.js +3 -4
- package/dist/likec4diagram/custom/edges/useControlPoints.d.ts +8 -0
- package/dist/likec4diagram/custom/edges/useControlPoints.js +58 -0
- package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.d.ts +7 -0
- package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.js +60 -0
- package/dist/likec4diagram/custom/edges/utils.d.ts +0 -12
- package/dist/likec4diagram/custom/nodes/CompoundActions.js +4 -1
- package/dist/likec4diagram/custom/nodes/ElementActions.d.ts +2 -1
- package/dist/likec4diagram/custom/nodes/ElementActions.js +15 -10
- package/dist/likec4diagram/custom/nodes/NodeDrifts.d.ts +6 -0
- package/dist/likec4diagram/custom/nodes/NodeDrifts.js +50 -0
- package/dist/likec4diagram/custom/nodes/SequenceActorNode.js +7 -2
- package/dist/likec4diagram/custom/nodes/index.d.ts +1 -0
- package/dist/likec4diagram/custom/nodes/nodes.d.ts +9 -1
- package/dist/likec4diagram/custom/nodes/nodes.js +74 -29
- package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.d.ts +1 -1
- package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +1 -1
- package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +2 -1
- package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.js +4 -3
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.d.ts +1 -11
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +7 -51
- package/dist/likec4diagram/custom/nodes/toolbar/types.d.ts +5 -0
- package/dist/likec4diagram/custom/nodes/toolbar/types.js +7 -0
- package/dist/likec4diagram/custom/nodes/toolbar/useHandlers.d.ts +8 -0
- package/dist/likec4diagram/custom/nodes/toolbar/useHandlers.js +44 -0
- package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +8 -10
- package/dist/likec4diagram/relationship-popover/actor.d.ts +1 -1
- package/dist/likec4diagram/state/DiagramActorProvider.d.ts +4 -3
- package/dist/likec4diagram/state/DiagramActorProvider.js +95 -70
- package/dist/likec4diagram/state/assign.d.ts +13 -7
- package/dist/likec4diagram/state/assign.js +43 -282
- package/dist/likec4diagram/state/createViewChange.d.ts +3 -0
- package/dist/likec4diagram/state/createViewChange.js +79 -0
- package/dist/likec4diagram/state/diagram-api.d.ts +109 -0
- package/dist/likec4diagram/state/diagram-api.js +126 -0
- package/dist/likec4diagram/state/machine.actions.d.ts +1783 -0
- package/dist/likec4diagram/state/machine.actions.js +644 -0
- package/dist/likec4diagram/state/machine.actions.layout.d.ts +579 -0
- package/dist/likec4diagram/state/machine.actions.layout.js +129 -0
- package/dist/likec4diagram/state/machine.d.ts +22 -0
- package/dist/likec4diagram/state/machine.js +127 -0
- package/dist/likec4diagram/state/machine.setup.d.ts +327 -0
- package/dist/likec4diagram/state/machine.setup.js +93 -0
- package/dist/likec4diagram/state/machine.state.initializing.d.ts +208 -0
- package/dist/likec4diagram/state/machine.state.initializing.js +55 -0
- package/dist/likec4diagram/state/machine.state.navigating.d.ts +14 -0
- package/dist/likec4diagram/state/machine.state.navigating.js +178 -0
- package/dist/likec4diagram/state/machine.state.ready.d.ts +3131 -0
- package/dist/likec4diagram/state/machine.state.ready.focused.d.ts +386 -0
- package/dist/likec4diagram/state/machine.state.ready.focused.js +85 -0
- package/dist/likec4diagram/state/machine.state.ready.idle.d.ts +474 -0
- package/dist/likec4diagram/state/machine.state.ready.idle.js +96 -0
- package/dist/likec4diagram/state/machine.state.ready.js +262 -0
- package/dist/likec4diagram/state/machine.state.ready.printing.d.ts +128 -0
- package/dist/likec4diagram/state/machine.state.ready.printing.js +40 -0
- package/dist/likec4diagram/state/machine.state.ready.walkthrough.d.ts +511 -0
- package/dist/likec4diagram/state/machine.state.ready.walkthrough.js +177 -0
- package/dist/likec4diagram/state/mediaPrintActor.d.ts +12 -0
- package/dist/likec4diagram/state/mediaPrintActor.js +18 -0
- package/dist/likec4diagram/state/syncManualLayoutActor.d.ts +31 -108
- package/dist/likec4diagram/state/syncManualLayoutActor.js +278 -142
- package/dist/likec4diagram/state/types.d.ts +7 -12
- package/dist/likec4diagram/state/utils.d.ts +19 -4
- package/dist/likec4diagram/state/utils.js +47 -4
- package/dist/likec4diagram/types.d.ts +8 -8
- package/dist/likec4diagram/ui/LayoutDriftFrame.d.ts +2 -0
- package/dist/likec4diagram/ui/LayoutDriftFrame.js +66 -0
- package/dist/likec4diagram/ui/index.d.ts +1 -0
- package/dist/likec4diagram/ui/notation/NotationPanel.css.js +5 -2
- package/dist/likec4diagram/ui/notation/NotationPanel.js +5 -4
- package/dist/likec4diagram/useLayoutConstraints.d.ts +10 -5
- package/dist/likec4diagram/useLayoutConstraints.js +237 -61
- package/dist/likec4diagram/xyflow-diagram/diagram-view.d.ts +0 -1
- package/dist/likec4diagram/xyflow-diagram/diagram-view.js +14 -17
- package/dist/likec4diagram/xyflow-sequence/sequence-layout.js +11 -8
- package/dist/navigationpanel/NavigationPanel.js +16 -8
- package/dist/navigationpanel/NavigationPanelControls.d.ts +2 -1
- package/dist/navigationpanel/NavigationPanelControls.js +23 -17
- package/dist/navigationpanel/NavigationPanelDropdown.d.ts +2 -1
- package/dist/navigationpanel/NavigationPanelDropdown.js +62 -42
- package/dist/navigationpanel/_common.d.ts +1 -1
- package/dist/navigationpanel/_common.js +4 -2
- package/dist/navigationpanel/actor.d.ts +9 -205
- package/dist/navigationpanel/actor.js +6 -5
- package/dist/navigationpanel/comparepanel/CompareActionsMenu.d.ts +3 -0
- package/dist/navigationpanel/comparepanel/CompareActionsMenu.js +59 -0
- package/dist/navigationpanel/comparepanel/ComparePanel.d.ts +2 -0
- package/dist/navigationpanel/comparepanel/ComparePanel.js +42 -0
- package/dist/navigationpanel/comparepanel/ComparePanelControls.d.ts +1 -0
- package/dist/navigationpanel/comparepanel/ComparePanelControls.js +60 -0
- package/dist/navigationpanel/comparepanel/LayoutTypeSwitcher.d.ts +5 -0
- package/dist/navigationpanel/comparepanel/LayoutTypeSwitcher.js +38 -0
- package/dist/navigationpanel/comparepanel/index.d.ts +1 -0
- package/dist/navigationpanel/controls/{ViewDetailsCard.d.ts → DetailsControls.d.ts} +1 -1
- package/dist/navigationpanel/controls/{ViewDetailsCard.js → DetailsControls.js} +18 -14
- package/dist/navigationpanel/controls/LayoutWarning.d.ts +2 -0
- package/dist/navigationpanel/controls/LayoutWarning.js +102 -0
- package/dist/navigationpanel/controls/NavigationButtons.js +4 -3
- package/dist/navigationpanel/controls/OpenSource.js +2 -2
- package/dist/navigationpanel/controls/SearchControl.d.ts +2 -1
- package/dist/navigationpanel/controls/SearchControl.js +15 -17
- package/dist/navigationpanel/controls/ToggleReadonly.d.ts +1 -1
- package/dist/navigationpanel/controls/ToggleReadonly.js +26 -18
- package/dist/navigationpanel/controls/index.d.ts +2 -1
- package/dist/navigationpanel/dropdown/ProjectsMenu.d.ts +2 -2
- package/dist/navigationpanel/dropdown/ProjectsMenu.js +5 -5
- package/dist/navigationpanel/editorpanel/CenterCamera.js +5 -2
- package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.d.ts +1 -1
- package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.js +21 -20
- package/dist/navigationpanel/editorpanel/EditorPanel.js +3 -3
- package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.d.ts +2 -2
- package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.js +16 -13
- package/dist/navigationpanel/editorpanel/ToggleReadonly.d.ts +1 -0
- package/dist/navigationpanel/editorpanel/ToggleReadonly.js +15 -0
- package/dist/navigationpanel/styles.css.d.ts +2 -2
- package/dist/navigationpanel/styles.css.js +4 -4
- package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +14 -8
- package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +66 -66
- package/dist/navigationpanel/walkthrough/DynamicViewControls.js +31 -14
- package/dist/navigationpanel/walkthrough/WalkthroughPanel.d.ts +2 -1
- package/dist/navigationpanel/walkthrough/WalkthroughPanel.js +68 -50
- package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/actions/dist/xstate-actions.cjs.js +37 -0
- package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dev/dist/xstate-dev.cjs.js +59 -0
- package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dist/assign-dea9f7c8.cjs.js +140 -0
- package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dist/log-ec8d4df4.cjs.js +401 -0
- package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dist/raise-da5b247f.cjs.js +2716 -0
- package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/guards/dist/xstate-guards.cjs.js +26 -0
- package/dist/overlays/element-details/ElementDetails.js +7 -7
- package/dist/overlays/element-details/ElementDetailsCard.css.js +3 -3
- package/dist/overlays/element-details/ElementDetailsCard.js +7 -5
- package/dist/overlays/element-details/MetadataValue.d.ts +2 -1
- package/dist/overlays/element-details/MetadataValue.js +2 -2
- package/dist/overlays/element-details/TabPanelDeployments.js +6 -4
- package/dist/overlays/element-details/TabPanelRelationships.js +3 -3
- package/dist/overlays/element-details/TabPanelStructure.js +1 -1
- package/dist/overlays/element-details/actor.d.ts +8 -82
- package/dist/overlays/element-details/actor.js +0 -8
- package/dist/overlays/overlay/Overlay.js +10 -10
- package/dist/overlays/overlaysActor.d.ts +7 -150
- package/dist/overlays/overlaysActor.js +183 -161
- package/dist/overlays/relationship-details/RelationshipDetails.js +4 -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 -550
- package/dist/overlays/relationship-details/actor.js +18 -3
- package/dist/overlays/relationship-details/custom/ElementActions.js +8 -5
- package/dist/overlays/relationship-details/custom/edgeTypes.js +4 -1
- package/dist/overlays/relationship-details/custom/nodeTypes.js +4 -1
- package/dist/overlays/relationship-details/hooks.js +1 -1
- 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 +6 -4
- 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 -673
- package/dist/overlays/relationships-browser/actor.js +132 -110
- package/dist/overlays/relationships-browser/custom/ElementActions.js +44 -37
- package/dist/overlays/relationships-browser/custom/edgeTypes.js +4 -1
- package/dist/overlays/relationships-browser/custom/nodeTypes.js +4 -1
- package/dist/overlays/relationships-browser/hooks.js +7 -6
- 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/Search.js +2 -1
- package/dist/search/components/ElementsColumn.js +5 -3
- package/dist/search/components/PickView.js +1 -1
- package/dist/search/components/SearchByTags.js +21 -44
- package/dist/search/components/SearchInput.js +1 -1
- package/dist/search/components/ViewsColum.js +6 -4
- 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 +8 -6
- package/dist/styles.css2.js +1 -1
- package/dist/utils/index.d.ts +4 -4
- package/dist/utils/vector.d.ts +83 -21
- package/dist/utils/vector.js +98 -24
- package/dist/utils/view-bounds.d.ts +8 -0
- package/dist/utils/view-bounds.js +58 -0
- package/dist/utils/xyflow.d.ts +52 -8
- package/dist/utils/xyflow.js +31 -11
- package/package.json +26 -24
- package/panda.buildinfo.json +124 -71
- package/styles-min.css +1 -1
- package/styles.css +1 -1
- package/dist/hooks/useCurrentViewId.d.ts +0 -6
- package/dist/likec4diagram/custom/edges/utils.js +0 -23
- package/dist/likec4diagram/state/diagram-machine.d.ts +0 -2590
- package/dist/likec4diagram/state/diagram-machine.js +0 -1180
- package/dist/navigationpanel/editorpanel/LayoutDriftNotification.d.ts +0 -1
- package/dist/navigationpanel/editorpanel/LayoutDriftNotification.js +0 -56
- package/dist/utils/get-view-bounds.d.ts +0 -3
- package/dist/utils/get-view-bounds.js +0 -14
- /package/dist/base/{types.js → Base.js} +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/createReactComponent.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.js +0 -0
- /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/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.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconZoomScan.js +0 -0
|
@@ -1,91 +1,28 @@
|
|
|
1
|
-
import { nonNullable
|
|
1
|
+
import { nonNullable } from '@likec4/core';
|
|
2
2
|
import { getNodeDimensions } from '@xyflow/system';
|
|
3
3
|
import { deepEqual } from 'fast-equals';
|
|
4
|
-
import {
|
|
4
|
+
import { mergeDeep } from 'remeda';
|
|
5
5
|
import { assertEvent } from 'xstate';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
6
|
+
import { vector } from '../../utils/vector.js';
|
|
7
|
+
import { getNodeCenter } from '../../utils/xyflow.js';
|
|
8
|
+
import { updateNodes } from '../../base/updateNodes.js';
|
|
9
|
+
import { updateEdges } from '../../base/updateEdges.js';
|
|
10
|
+
import { Base } from '../../base/Base.js';
|
|
9
11
|
|
|
10
|
-
function
|
|
11
|
-
const
|
|
12
|
-
|
|
12
|
+
function mergeXYNodesEdges(context, event) {
|
|
13
|
+
const nextView = event.view;
|
|
14
|
+
const currentView = context.view;
|
|
15
|
+
const isSameView = currentView.id === nextView.id;
|
|
16
|
+
const isDynamicViewUpdate = nextView._type === "dynamic" && nextView.variant === "sequence";
|
|
17
|
+
if (isDynamicViewUpdate) {
|
|
13
18
|
return {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
19
|
+
xynodes: event.xynodes,
|
|
20
|
+
xyedges: event.xyedges,
|
|
21
|
+
view: nextView
|
|
17
22
|
};
|
|
18
23
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
clicks: lastClickedNode2.clicks + 1,
|
|
22
|
-
timestamp: Date.now()
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
function mergeXYNodesEdges({ context, event }) {
|
|
26
|
-
assertEvent(event, "update.view");
|
|
27
|
-
const nextView = event.view;
|
|
28
|
-
const isSameView = context.view.id === nextView.id;
|
|
29
|
-
const currentNodes = context.xynodes;
|
|
30
|
-
const xynodes = event.xynodes.map((update) => {
|
|
31
|
-
const existing = currentNodes.find((n) => n.id === update.id);
|
|
32
|
-
if (existing) {
|
|
33
|
-
const { width: existingWidth, height: existingHeight } = getNodeDimensions(existing);
|
|
34
|
-
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)) {
|
|
35
|
-
return existing;
|
|
36
|
-
}
|
|
37
|
-
return {
|
|
38
|
-
...omit(existing, ["measured", "parentId"]),
|
|
39
|
-
...update,
|
|
40
|
-
// Force dimensions from update
|
|
41
|
-
width: update.initialWidth,
|
|
42
|
-
height: update.initialHeight,
|
|
43
|
-
data: {
|
|
44
|
-
...existing.data,
|
|
45
|
-
...update.data
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
return update;
|
|
50
|
-
});
|
|
51
|
-
let xyedges = event.xyedges;
|
|
52
|
-
if (isSameView && !nextView.hasLayoutDrift) {
|
|
53
|
-
const currentEdges = context.xyedges;
|
|
54
|
-
xyedges = event.xyedges.map((update) => {
|
|
55
|
-
const existing = currentEdges.find((n) => n.id === update.id);
|
|
56
|
-
if (existing && existing.type === update.type) {
|
|
57
|
-
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)) {
|
|
58
|
-
return existing;
|
|
59
|
-
}
|
|
60
|
-
return {
|
|
61
|
-
...omit(existing, ["sourceHandle", "targetHandle"]),
|
|
62
|
-
...update,
|
|
63
|
-
data: {
|
|
64
|
-
...existing.data,
|
|
65
|
-
...update.data
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
return update;
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
if (!isSameView) {
|
|
73
|
-
for (const node of xynodes) {
|
|
74
|
-
node.data = {
|
|
75
|
-
...node.data,
|
|
76
|
-
dimmed: false,
|
|
77
|
-
hovered: false
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
for (const edge of xyedges) {
|
|
81
|
-
edge.data = {
|
|
82
|
-
...edge.data,
|
|
83
|
-
dimmed: false,
|
|
84
|
-
hovered: false,
|
|
85
|
-
active: false
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
}
|
|
24
|
+
const xynodes = updateNodes(context.xynodes, event.xynodes);
|
|
25
|
+
const xyedges = isSameView ? updateEdges(context.xyedges, event.xyedges) : event.xyedges;
|
|
89
26
|
return {
|
|
90
27
|
xynodes,
|
|
91
28
|
xyedges,
|
|
@@ -117,125 +54,8 @@ function focusNodesEdges(params) {
|
|
|
117
54
|
xyedges
|
|
118
55
|
};
|
|
119
56
|
}
|
|
120
|
-
function updateNavigationHistory({ context, event }) {
|
|
121
|
-
assertEvent(event, "update.view");
|
|
122
|
-
let {
|
|
123
|
-
navigationHistory: {
|
|
124
|
-
currentIndex,
|
|
125
|
-
history
|
|
126
|
-
},
|
|
127
|
-
lastOnNavigate,
|
|
128
|
-
viewport
|
|
129
|
-
} = context;
|
|
130
|
-
const stepCurrent = history[currentIndex];
|
|
131
|
-
if (!stepCurrent) {
|
|
132
|
-
return {
|
|
133
|
-
navigationHistory: {
|
|
134
|
-
currentIndex: 0,
|
|
135
|
-
history: [
|
|
136
|
-
{
|
|
137
|
-
viewId: event.view.id,
|
|
138
|
-
fromNode: null,
|
|
139
|
-
viewport: { ...viewport }
|
|
140
|
-
}
|
|
141
|
-
]
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
if (stepCurrent.viewId !== event.view.id) {
|
|
146
|
-
if (!lastOnNavigate) {
|
|
147
|
-
const stepBack = currentIndex > 0 ? nonNullable(history[currentIndex - 1]) : null;
|
|
148
|
-
if (stepBack && stepBack.viewId === event.view.id) {
|
|
149
|
-
return {
|
|
150
|
-
navigationHistory: {
|
|
151
|
-
currentIndex: currentIndex - 1,
|
|
152
|
-
history
|
|
153
|
-
},
|
|
154
|
-
lastOnNavigate: {
|
|
155
|
-
fromView: stepCurrent.viewId,
|
|
156
|
-
toView: stepBack.viewId,
|
|
157
|
-
fromNode: stepCurrent.fromNode
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
const stepForward = currentIndex < history.length - 1 ? nonNullable(history[currentIndex + 1]) : null;
|
|
162
|
-
if (stepForward && stepForward.viewId === event.view.id) {
|
|
163
|
-
return {
|
|
164
|
-
navigationHistory: {
|
|
165
|
-
currentIndex: currentIndex + 1,
|
|
166
|
-
history
|
|
167
|
-
},
|
|
168
|
-
lastOnNavigate: {
|
|
169
|
-
fromView: stepCurrent.viewId,
|
|
170
|
-
toView: stepForward.viewId,
|
|
171
|
-
fromNode: stepForward.fromNode
|
|
172
|
-
}
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
history = [
|
|
177
|
-
...history.slice(0, currentIndex + 1),
|
|
178
|
-
{
|
|
179
|
-
viewId: event.view.id,
|
|
180
|
-
fromNode: lastOnNavigate?.fromNode ?? null,
|
|
181
|
-
viewport: { ...viewport }
|
|
182
|
-
}
|
|
183
|
-
];
|
|
184
|
-
currentIndex = history.length - 1;
|
|
185
|
-
return {
|
|
186
|
-
navigationHistory: {
|
|
187
|
-
currentIndex,
|
|
188
|
-
history
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
return {};
|
|
193
|
-
}
|
|
194
|
-
function navigateBack({ context }) {
|
|
195
|
-
const {
|
|
196
|
-
navigationHistory: {
|
|
197
|
-
currentIndex,
|
|
198
|
-
history
|
|
199
|
-
}
|
|
200
|
-
} = context;
|
|
201
|
-
invariant(currentIndex > 0, "Cannot navigate back");
|
|
202
|
-
const stepCurrent = history[currentIndex];
|
|
203
|
-
const stepBack = history[currentIndex - 1];
|
|
204
|
-
return {
|
|
205
|
-
navigationHistory: {
|
|
206
|
-
currentIndex: currentIndex - 1,
|
|
207
|
-
history
|
|
208
|
-
},
|
|
209
|
-
lastOnNavigate: {
|
|
210
|
-
fromView: stepCurrent.viewId,
|
|
211
|
-
toView: stepBack.viewId,
|
|
212
|
-
fromNode: stepCurrent.fromNode
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
function navigateForward({ context }) {
|
|
217
|
-
const {
|
|
218
|
-
navigationHistory: {
|
|
219
|
-
currentIndex,
|
|
220
|
-
history
|
|
221
|
-
}
|
|
222
|
-
} = context;
|
|
223
|
-
invariant(currentIndex < history.length - 1, "Cannot navigate forward");
|
|
224
|
-
const stepCurrent = history[currentIndex];
|
|
225
|
-
const stepForward = history[currentIndex + 1];
|
|
226
|
-
return {
|
|
227
|
-
navigationHistory: {
|
|
228
|
-
currentIndex: currentIndex + 1,
|
|
229
|
-
history
|
|
230
|
-
},
|
|
231
|
-
lastOnNavigate: {
|
|
232
|
-
fromView: stepCurrent.viewId,
|
|
233
|
-
toView: stepForward.viewId,
|
|
234
|
-
fromNode: stepForward.fromNode
|
|
235
|
-
}
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
57
|
function updateNodeData({ context, event }) {
|
|
58
|
+
console.log("updateNodeData called", event);
|
|
239
59
|
assertEvent(event, "update.nodeData");
|
|
240
60
|
const xynodes = context.xynodes.map((node) => {
|
|
241
61
|
if (node.id !== event.nodeId) {
|
|
@@ -269,89 +89,30 @@ function updateEdgeData({ context, event }) {
|
|
|
269
89
|
});
|
|
270
90
|
return { xyedges };
|
|
271
91
|
}
|
|
272
|
-
function
|
|
273
|
-
const
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
do {
|
|
279
|
-
const parent = currentNode.parentId && nodes.find((x) => x.id == currentNode.parentId);
|
|
280
|
-
if (!parent) {
|
|
281
|
-
break;
|
|
282
|
-
}
|
|
283
|
-
currentNode = parent;
|
|
284
|
-
position = position.add(parent.position);
|
|
285
|
-
} while (true);
|
|
286
|
-
return position;
|
|
287
|
-
}
|
|
288
|
-
function getControlPointForEdge(edge) {
|
|
289
|
-
const source = xynodes.find((x) => x.id == edge.source);
|
|
290
|
-
const target = xynodes.find((x) => x.id == edge.target);
|
|
291
|
-
if (!source || !target) {
|
|
292
|
-
return [];
|
|
293
|
-
}
|
|
294
|
-
const sourceCenter = getNodeCenter(source, xynodes);
|
|
295
|
-
const targetCenter = getNodeCenter(target, xynodes);
|
|
296
|
-
if (!sourceCenter || !targetCenter) {
|
|
297
|
-
return [];
|
|
298
|
-
}
|
|
299
|
-
if (source === target) {
|
|
300
|
-
const loopSize = 80;
|
|
301
|
-
const centerOfTopBoundary = new VectorImpl(0, source.height || 0).mul(-0.5).add(sourceCenter);
|
|
302
|
-
return [
|
|
303
|
-
centerOfTopBoundary.add(new VectorImpl(-loopSize / 2.5, -loopSize)),
|
|
304
|
-
centerOfTopBoundary.add(new VectorImpl(loopSize / 2.5, -loopSize))
|
|
305
|
-
];
|
|
306
|
-
}
|
|
307
|
-
const sourceToTargetVector = targetCenter.sub(sourceCenter);
|
|
308
|
-
const sourceBorderPoint = getBorderPointOnVector(source, sourceCenter, sourceToTargetVector);
|
|
309
|
-
const targetBorderPoint = getBorderPointOnVector(target, targetCenter, sourceToTargetVector.mul(-1));
|
|
310
|
-
return [sourceBorderPoint.add(targetBorderPoint.sub(sourceBorderPoint).mul(0.3))];
|
|
311
|
-
}
|
|
312
|
-
function getBorderPointOnVector(node, nodeCenter, v) {
|
|
313
|
-
const xScale = (node.width || 0) / 2 / v.x;
|
|
314
|
-
const yScale = (node.height || 0) / 2 / v.y;
|
|
315
|
-
const scale = Math.min(Math.abs(xScale), Math.abs(yScale));
|
|
316
|
-
return vector(v).mul(scale).add(nodeCenter);
|
|
317
|
-
}
|
|
318
|
-
return {
|
|
319
|
-
xyedges: context.xyedges.map((edge) => {
|
|
320
|
-
if (!edge.data.controlPoints || isEmpty(edge.data.controlPoints)) {
|
|
321
|
-
return edge;
|
|
322
|
-
}
|
|
323
|
-
return {
|
|
324
|
-
...edge,
|
|
325
|
-
data: {
|
|
326
|
-
...edge.data,
|
|
327
|
-
controlPoints: getControlPointForEdge(edge)
|
|
328
|
-
}
|
|
329
|
-
};
|
|
330
|
-
})
|
|
331
|
-
};
|
|
92
|
+
function getBorderPointOnVector(node, nodeCenter, v) {
|
|
93
|
+
const dimensions = getNodeDimensions(node);
|
|
94
|
+
const xScale = dimensions.width / 2 / v.x;
|
|
95
|
+
const yScale = dimensions.height / 2 / v.y;
|
|
96
|
+
const scale = Math.min(Math.abs(xScale), Math.abs(yScale));
|
|
97
|
+
return vector(v).multiply(scale).add(nodeCenter);
|
|
332
98
|
}
|
|
333
|
-
function
|
|
334
|
-
const
|
|
335
|
-
const
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
});
|
|
351
|
-
}
|
|
352
|
-
return Base.setDimmed(node, dimmed);
|
|
353
|
-
})
|
|
354
|
-
};
|
|
99
|
+
function resetEdgeControlPoints(nodeLookup, edge) {
|
|
100
|
+
const source = nonNullable(nodeLookup.get(edge.source), `Source node ${edge.source} not found`);
|
|
101
|
+
const target = nonNullable(nodeLookup.get(edge.target), `Target node ${edge.target} not found`);
|
|
102
|
+
const sourceCenter = vector(getNodeCenter(source));
|
|
103
|
+
const targetCenter = vector(getNodeCenter(target));
|
|
104
|
+
if (source === target) {
|
|
105
|
+
const loopSize = 80;
|
|
106
|
+
const centerOfTopBoundary = vector(0, source.height || 0).multiply(-0.5).add(sourceCenter);
|
|
107
|
+
return [
|
|
108
|
+
centerOfTopBoundary.add(vector(-loopSize / 2.5, -loopSize)),
|
|
109
|
+
centerOfTopBoundary.add(vector(loopSize / 2.5, -loopSize))
|
|
110
|
+
];
|
|
111
|
+
}
|
|
112
|
+
const sourceToTargetVector = targetCenter.subtract(sourceCenter);
|
|
113
|
+
const sourceBorderPoint = getBorderPointOnVector(source, sourceCenter, sourceToTargetVector);
|
|
114
|
+
const targetBorderPoint = getBorderPointOnVector(target, targetCenter, sourceToTargetVector.multiply(-1));
|
|
115
|
+
return [sourceBorderPoint.add(targetBorderPoint.subtract(sourceBorderPoint).multiply(0.4))];
|
|
355
116
|
}
|
|
356
117
|
|
|
357
|
-
export { focusNodesEdges,
|
|
118
|
+
export { focusNodesEdges, mergeXYNodesEdges, resetEdgeControlPoints, updateEdgeData, updateNodeData };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { getNodeDimensions } from '@xyflow/system';
|
|
2
|
+
import { map, omit, hasAtLeast } from 'remeda';
|
|
3
|
+
import { calcViewBounds } from '../../utils/view-bounds.js';
|
|
4
|
+
import { isSamePoint, bezierControlPoints } from '../../utils/xyflow.js';
|
|
5
|
+
|
|
6
|
+
function createViewChange(parentContext) {
|
|
7
|
+
const {
|
|
8
|
+
view: {
|
|
9
|
+
drifts: _1,
|
|
10
|
+
// Ignore drifts from view
|
|
11
|
+
_layout: _2,
|
|
12
|
+
// Ignore layout type from view
|
|
13
|
+
...view
|
|
14
|
+
},
|
|
15
|
+
xystore
|
|
16
|
+
} = parentContext;
|
|
17
|
+
const { nodeLookup, edgeLookup } = xystore.getState();
|
|
18
|
+
const movedNodes = /* @__PURE__ */ new Set();
|
|
19
|
+
const nodes = map(view.nodes, (node) => {
|
|
20
|
+
const internal = nodeLookup.get(node.id);
|
|
21
|
+
if (!internal) {
|
|
22
|
+
console.error(`Internal node not found for ${node.id}`);
|
|
23
|
+
return node;
|
|
24
|
+
}
|
|
25
|
+
const dimensions = getNodeDimensions(internal);
|
|
26
|
+
const isChanged = !isSamePoint(internal.internals.positionAbsolute, node) || node.width !== dimensions.width || node.height !== dimensions.height;
|
|
27
|
+
if (isChanged) {
|
|
28
|
+
movedNodes.add(node.id);
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
...node,
|
|
32
|
+
shape: internal.data.shape,
|
|
33
|
+
color: internal.data.color,
|
|
34
|
+
style: {
|
|
35
|
+
...internal.data.style
|
|
36
|
+
},
|
|
37
|
+
x: Math.floor(internal.internals.positionAbsolute.x),
|
|
38
|
+
y: Math.floor(internal.internals.positionAbsolute.y),
|
|
39
|
+
width: Math.ceil(dimensions.width),
|
|
40
|
+
height: Math.ceil(dimensions.height)
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
const edges = map(view.edges, (edge) => {
|
|
44
|
+
const xyedge = edgeLookup.get(edge.id);
|
|
45
|
+
if (!xyedge) {
|
|
46
|
+
console.error(`Internal edge not found for ${edge.id}`);
|
|
47
|
+
return edge;
|
|
48
|
+
}
|
|
49
|
+
const data = xyedge.data;
|
|
50
|
+
let controlPoints = data.controlPoints ?? [];
|
|
51
|
+
const sourceOrTargetMoved = movedNodes.has(xyedge.source) || movedNodes.has(xyedge.target);
|
|
52
|
+
if (controlPoints.length === 0 && sourceOrTargetMoved) {
|
|
53
|
+
controlPoints = bezierControlPoints(data.points);
|
|
54
|
+
}
|
|
55
|
+
const _updated = {
|
|
56
|
+
...omit(edge, ["controlPoints", "labelBBox"]),
|
|
57
|
+
points: data.points
|
|
58
|
+
};
|
|
59
|
+
if (data.labelBBox) {
|
|
60
|
+
_updated.labelBBox = data.labelBBox;
|
|
61
|
+
}
|
|
62
|
+
if (hasAtLeast(controlPoints, 1)) {
|
|
63
|
+
_updated.controlPoints = controlPoints;
|
|
64
|
+
}
|
|
65
|
+
return _updated;
|
|
66
|
+
});
|
|
67
|
+
const snapshot = {
|
|
68
|
+
...view,
|
|
69
|
+
bounds: calcViewBounds({ nodes, edges }),
|
|
70
|
+
nodes,
|
|
71
|
+
edges
|
|
72
|
+
};
|
|
73
|
+
return {
|
|
74
|
+
op: "save-view-snapshot",
|
|
75
|
+
layout: snapshot
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export { createViewChange };
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { DynamicViewDisplayVariant, NodeNotation as ElementNotation, ViewChange } from '@likec4/core/types';
|
|
2
|
+
import { PartialDeep } from 'type-fest';
|
|
3
|
+
import { FeatureName } from '../../context/DiagramFeatures';
|
|
4
|
+
import { OpenSourceParams } from '../../LikeC4Diagram.props';
|
|
5
|
+
import { Types } from '../types';
|
|
6
|
+
import { AlignmentMode } from './aligners';
|
|
7
|
+
import { DiagramActorRef, DiagramContext, DiagramEvents } from './types';
|
|
8
|
+
import type * as t from '@likec4/core/types';
|
|
9
|
+
type Any = t.aux.Any;
|
|
10
|
+
type Unknown = t.aux.UnknownLayouted;
|
|
11
|
+
type ViewId<A> = t.aux.ViewId<A>;
|
|
12
|
+
type Fqn<A> = t.aux.Fqn<A>;
|
|
13
|
+
type NodeId = t.aux.NodeId;
|
|
14
|
+
type EdgeId = t.aux.EdgeId;
|
|
15
|
+
export interface DiagramApi<A extends Any = Unknown> {
|
|
16
|
+
readonly actor: DiagramActorRef;
|
|
17
|
+
/**
|
|
18
|
+
* @warning Do not use in render phase
|
|
19
|
+
*/
|
|
20
|
+
readonly currentView: t.DiagramView<A>;
|
|
21
|
+
/**
|
|
22
|
+
* Send event to diagram actor
|
|
23
|
+
*/
|
|
24
|
+
send(event: DiagramEvents): void;
|
|
25
|
+
/**
|
|
26
|
+
* Navigate to view
|
|
27
|
+
*/
|
|
28
|
+
navigateTo(viewId: ViewId<A>, fromNode?: NodeId): void;
|
|
29
|
+
/**
|
|
30
|
+
* Navigate back or forward in history
|
|
31
|
+
*/
|
|
32
|
+
navigate(direction: 'back' | 'forward'): void;
|
|
33
|
+
/**
|
|
34
|
+
* Fit diagram to view
|
|
35
|
+
*/
|
|
36
|
+
fitDiagram(duration?: number): void;
|
|
37
|
+
/**
|
|
38
|
+
* Open relationships browser
|
|
39
|
+
*/
|
|
40
|
+
openRelationshipsBrowser(fqn: Fqn<A>): void;
|
|
41
|
+
/**
|
|
42
|
+
* If running in editor, trigger opening source file
|
|
43
|
+
*/
|
|
44
|
+
openSource(params: OpenSourceParams<A>): void;
|
|
45
|
+
/**
|
|
46
|
+
* Open element details card
|
|
47
|
+
*/
|
|
48
|
+
openElementDetails(fqn: Fqn<A>, fromNode?: NodeId): void;
|
|
49
|
+
openRelationshipDetails(...params: [edgeId: EdgeId] | [source: Fqn<A>, target: Fqn<A>]): void;
|
|
50
|
+
updateNodeData(nodeId: NodeId, data: PartialDeep<Types.NodeData>): void;
|
|
51
|
+
updateEdgeData(edgeId: EdgeId, data: PartialDeep<Types.EdgeData>): void;
|
|
52
|
+
/**
|
|
53
|
+
* Start editing, either node or edge
|
|
54
|
+
*/
|
|
55
|
+
startEditing(subject: 'node' | 'edge'): void;
|
|
56
|
+
/**
|
|
57
|
+
* Stop editing
|
|
58
|
+
* @param wasChanged - whether there were changes made during editing
|
|
59
|
+
* @default false
|
|
60
|
+
*/
|
|
61
|
+
stopEditing(wasChanged?: boolean): void;
|
|
62
|
+
/**
|
|
63
|
+
* Undo last editing operation
|
|
64
|
+
* @returns true if there was something to undo
|
|
65
|
+
*/
|
|
66
|
+
undoEditing(): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Align nodes
|
|
69
|
+
*/
|
|
70
|
+
align(mode: AlignmentMode): void;
|
|
71
|
+
/**
|
|
72
|
+
* Reset edge control points
|
|
73
|
+
*/
|
|
74
|
+
resetEdgeControlPoints(): void;
|
|
75
|
+
/**
|
|
76
|
+
* Focus node
|
|
77
|
+
*/
|
|
78
|
+
focusNode(nodeId: NodeId): void;
|
|
79
|
+
/**
|
|
80
|
+
* @warning Do not use in render phase
|
|
81
|
+
*/
|
|
82
|
+
getContext(): DiagramContext;
|
|
83
|
+
/**
|
|
84
|
+
* @warning Do not use in render phase
|
|
85
|
+
*/
|
|
86
|
+
findDiagramNode(xynodeId: string): t.DiagramNode<A> | null;
|
|
87
|
+
/**
|
|
88
|
+
* @warning Do not use in render phase
|
|
89
|
+
*/
|
|
90
|
+
findEdge(xyedgeId: string): Types.Edge | null;
|
|
91
|
+
/**
|
|
92
|
+
* @warning Do not use in render phase
|
|
93
|
+
*/
|
|
94
|
+
findDiagramEdge(xyedgeId: string): t.DiagramEdge<A> | null;
|
|
95
|
+
startWalkthrough(): void;
|
|
96
|
+
walkthroughStep(direction?: 'next' | 'previous'): void;
|
|
97
|
+
stopWalkthrough(): void;
|
|
98
|
+
toggleFeature(feature: FeatureName, forceValue?: boolean): void;
|
|
99
|
+
highlightNotation(notation: ElementNotation, kind?: string): void;
|
|
100
|
+
unhighlightNotation(): void;
|
|
101
|
+
openSearch(searchValue?: string): void;
|
|
102
|
+
triggerChange(viewChange: ViewChange): void;
|
|
103
|
+
/**
|
|
104
|
+
* Switch dynamic view display variant
|
|
105
|
+
*/
|
|
106
|
+
switchDynamicViewVariant(variant: DynamicViewDisplayVariant): void;
|
|
107
|
+
}
|
|
108
|
+
export declare function makeDiagramApi<A extends Any = Unknown>(actor: DiagramActorRef): DiagramApi<A>;
|
|
109
|
+
export {};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { invariant } from '@likec4/core/utils';
|
|
2
|
+
import { findDiagramEdge, findDiagramNode, typedSystem } from './utils.js';
|
|
3
|
+
|
|
4
|
+
function makeDiagramApi(actor) {
|
|
5
|
+
return {
|
|
6
|
+
actor,
|
|
7
|
+
send: (event) => actor.send(event),
|
|
8
|
+
navigateTo: (viewId, fromNode) => {
|
|
9
|
+
actor.send({
|
|
10
|
+
type: "navigate.to",
|
|
11
|
+
viewId,
|
|
12
|
+
...fromNode && { fromNode }
|
|
13
|
+
});
|
|
14
|
+
},
|
|
15
|
+
navigate: (direction) => {
|
|
16
|
+
actor.send({ type: `navigate.${direction}` });
|
|
17
|
+
},
|
|
18
|
+
fitDiagram: (duration = 350) => {
|
|
19
|
+
actor.send({ type: "xyflow.fitDiagram", duration });
|
|
20
|
+
},
|
|
21
|
+
openRelationshipsBrowser: (fqn) => {
|
|
22
|
+
actor.send({ type: "open.relationshipsBrowser", fqn });
|
|
23
|
+
},
|
|
24
|
+
openSource: (params) => {
|
|
25
|
+
actor.send({ type: "open.source", ...params });
|
|
26
|
+
},
|
|
27
|
+
openElementDetails: (fqn, fromNode) => {
|
|
28
|
+
actor.send({ type: "open.elementDetails", fqn, fromNode });
|
|
29
|
+
},
|
|
30
|
+
openRelationshipDetails: (...params) => {
|
|
31
|
+
if (params.length === 1) {
|
|
32
|
+
actor.send({ type: "open.relationshipDetails", params: { edgeId: params[0] } });
|
|
33
|
+
} else {
|
|
34
|
+
actor.send({ type: "open.relationshipDetails", params: { source: params[0], target: params[1] } });
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
updateNodeData: (nodeId, data) => {
|
|
38
|
+
actor.send({ type: "update.nodeData", nodeId, data });
|
|
39
|
+
},
|
|
40
|
+
updateEdgeData: (edgeId, data) => {
|
|
41
|
+
actor.send({ type: "update.edgeData", edgeId, data });
|
|
42
|
+
},
|
|
43
|
+
startEditing: (subject) => {
|
|
44
|
+
const syncActor = typedSystem(actor.system).syncLayoutActorRef;
|
|
45
|
+
invariant(syncActor, "No sync layout actor found in diagram actor system");
|
|
46
|
+
syncActor.send({ type: "editing.start", subject });
|
|
47
|
+
},
|
|
48
|
+
stopEditing: (wasChanged = false) => {
|
|
49
|
+
const syncActor = typedSystem(actor.system).syncLayoutActorRef;
|
|
50
|
+
invariant(syncActor, "No sync layout actor found in diagram actor system");
|
|
51
|
+
syncActor.send({ type: "editing.stop", wasChanged });
|
|
52
|
+
},
|
|
53
|
+
undoEditing: () => {
|
|
54
|
+
const syncActor = typedSystem(actor.system).syncLayoutActorRef;
|
|
55
|
+
invariant(syncActor, "No sync layout actor found in diagram actor system");
|
|
56
|
+
const hasUndo = syncActor.getSnapshot().context.history.length > 0;
|
|
57
|
+
if (hasUndo) {
|
|
58
|
+
syncActor.send({ type: "undo" });
|
|
59
|
+
}
|
|
60
|
+
return hasUndo;
|
|
61
|
+
},
|
|
62
|
+
align: (mode) => {
|
|
63
|
+
actor.send({ type: "layout.align", mode });
|
|
64
|
+
},
|
|
65
|
+
resetEdgeControlPoints: () => {
|
|
66
|
+
actor.send({ type: "layout.resetEdgeControlPoints" });
|
|
67
|
+
},
|
|
68
|
+
focusNode: (nodeId) => {
|
|
69
|
+
actor.send({ type: "focus.node", nodeId });
|
|
70
|
+
},
|
|
71
|
+
/**
|
|
72
|
+
* @warning Do not use in render phase
|
|
73
|
+
*/
|
|
74
|
+
get currentView() {
|
|
75
|
+
return actor.getSnapshot().context.view;
|
|
76
|
+
},
|
|
77
|
+
/**
|
|
78
|
+
* @warning Do not use in render phase
|
|
79
|
+
*/
|
|
80
|
+
getContext: () => actor.getSnapshot().context,
|
|
81
|
+
/**
|
|
82
|
+
* @warning Do not use in render phase
|
|
83
|
+
*/
|
|
84
|
+
findDiagramNode: (xynodeId) => {
|
|
85
|
+
return findDiagramNode(actor.getSnapshot().context, xynodeId);
|
|
86
|
+
},
|
|
87
|
+
findEdge: (xyedgeId) => {
|
|
88
|
+
return actor.getSnapshot().context.xyedges.find((e) => e.data.id === xyedgeId) ?? null;
|
|
89
|
+
},
|
|
90
|
+
/**
|
|
91
|
+
* @warning Do not use in render phase
|
|
92
|
+
*/
|
|
93
|
+
findDiagramEdge: (xyedgeId) => {
|
|
94
|
+
return findDiagramEdge(actor.getSnapshot().context, xyedgeId);
|
|
95
|
+
},
|
|
96
|
+
startWalkthrough: () => {
|
|
97
|
+
actor.send({ type: "walkthrough.start" });
|
|
98
|
+
},
|
|
99
|
+
walkthroughStep: (direction = "next") => {
|
|
100
|
+
actor.send({ type: "walkthrough.step", direction });
|
|
101
|
+
},
|
|
102
|
+
stopWalkthrough: () => {
|
|
103
|
+
actor.send({ type: "walkthrough.end" });
|
|
104
|
+
},
|
|
105
|
+
toggleFeature: (feature, forceValue) => {
|
|
106
|
+
actor.send({ type: "toggle.feature", feature, ...forceValue !== void 0 && { forceValue } });
|
|
107
|
+
},
|
|
108
|
+
highlightNotation: (notation, kind) => {
|
|
109
|
+
actor.send({ type: "notations.highlight", notation, ...kind && { kind } });
|
|
110
|
+
},
|
|
111
|
+
unhighlightNotation: () => {
|
|
112
|
+
actor.send({ type: "notations.unhighlight" });
|
|
113
|
+
},
|
|
114
|
+
openSearch: (searchValue) => {
|
|
115
|
+
actor.send({ type: "open.search", ...searchValue && { search: searchValue } });
|
|
116
|
+
},
|
|
117
|
+
triggerChange: (change) => {
|
|
118
|
+
actor.send({ type: "emit.onChange", change });
|
|
119
|
+
},
|
|
120
|
+
switchDynamicViewVariant: (variant) => {
|
|
121
|
+
actor.send({ type: "switch.dynamicViewVariant", variant });
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export { makeDiagramApi };
|