@likec4/diagram 1.43.0 → 1.44.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 +5746 -4674
- package/dist/LikeC4Diagram.d.ts +1 -1
- package/dist/LikeC4Diagram.js +13 -10
- package/dist/LikeC4Diagram.props.d.ts +16 -7
- package/dist/LikeC4ProjectsProvider.js +1 -1
- package/dist/LikeC4View.d.ts +5 -0
- package/dist/LikeC4View.js +22 -11
- 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 +4 -3
- package/dist/base/updateNodes.js +3 -2
- package/dist/base-primitives/compound/CompoundActionButton.js +1 -1
- package/dist/base-primitives/compound/CompoundDetailsButton.js +1 -1
- package/dist/base-primitives/edge/EdgeActionButton.js +1 -1
- package/dist/base-primitives/edge/EdgeContainer.d.ts +1 -1
- package/dist/base-primitives/edge/EdgeContainer.js +4 -0
- package/dist/base-primitives/edge/EdgeLabel.d.ts +1 -0
- 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 +9 -5
- package/dist/base-primitives/element/ElementActionButtons.d.ts +3 -2
- package/dist/base-primitives/element/ElementActionButtons.js +1 -1
- package/dist/base-primitives/element/ElementDetailsButton.js +2 -5
- package/dist/base-primitives/element/ElementNodeContainer.css.js +15 -27
- 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 +24 -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 +2 -18
- package/dist/context/index.d.ts +1 -1
- package/dist/custom/customNodes.js +3 -2
- package/dist/custom/hooks.d.ts +1 -1
- package/dist/custom/index.d.ts +1 -1
- package/dist/custom/index.js +4 -4
- package/dist/editor/LikeC4EditorContext.d.ts +21 -0
- package/dist/editor/index.d.ts +2 -0
- package/dist/hooks/index.d.ts +2 -1
- 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 +60 -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 +54 -51
- package/dist/likec4diagram/convert-to-xyflow.d.ts +0 -1
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +249 -220
- package/dist/likec4diagram/custom/edges/SequenceStepEdge.js +7 -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/ElementNodeDrifts.d.ts +4 -0
- package/dist/likec4diagram/custom/nodes/ElementNodeDrifts.js +46 -0
- package/dist/likec4diagram/custom/nodes/SequenceActorNode.js +4 -1
- package/dist/likec4diagram/custom/nodes/nodes.d.ts +9 -1
- package/dist/likec4diagram/custom/nodes/nodes.js +13 -9
- 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 +5 -7
- package/dist/likec4diagram/state/DiagramActorProvider.d.ts +3 -2
- package/dist/likec4diagram/state/DiagramActorProvider.js +96 -70
- package/dist/likec4diagram/state/assign.d.ts +4 -2
- package/dist/likec4diagram/state/assign.js +39 -103
- package/dist/likec4diagram/state/createViewChange.d.ts +3 -0
- package/dist/likec4diagram/state/createViewChange.js +90 -0
- package/dist/likec4diagram/state/diagram-api.d.ts +113 -0
- package/dist/likec4diagram/state/diagram-api.js +134 -0
- package/dist/likec4diagram/state/hotkeyActor.d.ts +7 -0
- package/dist/likec4diagram/state/hotkeyActor.js +17 -1
- package/dist/likec4diagram/state/machine.actions.d.ts +2099 -0
- package/dist/likec4diagram/state/machine.actions.js +735 -0
- package/dist/likec4diagram/state/machine.d.ts +3717 -0
- package/dist/likec4diagram/state/machine.js +141 -0
- package/dist/likec4diagram/state/machine.setup.d.ts +284 -0
- package/dist/likec4diagram/state/machine.setup.js +71 -0
- package/dist/likec4diagram/state/machine.state.initializing.d.ts +183 -0
- package/dist/likec4diagram/state/machine.state.initializing.js +55 -0
- package/dist/likec4diagram/state/machine.state.navigating.d.ts +117 -0
- package/dist/likec4diagram/state/machine.state.navigating.js +45 -0
- package/dist/likec4diagram/state/machine.state.ready.d.ts +3666 -0
- package/dist/likec4diagram/state/machine.state.ready.js +437 -0
- package/dist/likec4diagram/state/syncManualLayoutActor.d.ts +220 -63
- package/dist/likec4diagram/state/syncManualLayoutActor.js +218 -143
- package/dist/likec4diagram/state/types.d.ts +4 -7
- package/dist/likec4diagram/state/utils.d.ts +4 -2
- package/dist/likec4diagram/state/utils.js +4 -1
- package/dist/likec4diagram/types.d.ts +6 -1
- 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.js +5 -4
- package/dist/likec4diagram/useLayoutConstraints.d.ts +10 -5
- package/dist/likec4diagram/useLayoutConstraints.js +225 -54
- package/dist/likec4diagram/xyflow-diagram/diagram-view.d.ts +0 -1
- package/dist/likec4diagram/xyflow-diagram/diagram-view.js +15 -15
- package/dist/navigationpanel/NavigationPanel.js +11 -7
- 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 +11 -7
- package/dist/navigationpanel/actor.js +5 -4
- 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 +19 -16
- 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 +10 -10
- package/dist/navigationpanel/walkthrough/DynamicViewControls.js +31 -14
- package/dist/navigationpanel/walkthrough/WalkthroughPanel.d.ts +2 -1
- package/dist/navigationpanel/walkthrough/WalkthroughPanel.js +66 -49
- 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.js +7 -5
- 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 +3 -2
- package/dist/overlays/overlaysActor.d.ts +304 -62
- package/dist/overlays/overlaysActor.js +132 -131
- package/dist/overlays/relationship-details/RelationshipDetails.js +4 -3
- package/dist/overlays/relationship-details/SelectEdge.js +2 -2
- package/dist/overlays/relationship-details/actor.d.ts +14 -2
- package/dist/overlays/relationship-details/actor.js +17 -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/relationships-browser/RelationshipsBrowser.js +6 -4
- package/dist/overlays/relationships-browser/SelectElement.js +2 -2
- package/dist/overlays/relationships-browser/actor.d.ts +239 -173
- 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/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/shadowroot/ShadowRoot.js +1 -1
- package/dist/styles.css2.js +1 -1
- package/dist/utils/index.d.ts +4 -4
- package/dist/utils/vector.d.ts +78 -21
- package/dist/utils/vector.js +91 -24
- package/dist/utils/view-bounds.d.ts +8 -0
- package/dist/utils/view-bounds.js +57 -0
- package/dist/utils/xyflow.d.ts +49 -7
- package/dist/utils/xyflow.js +63 -11
- package/package.json +19 -18
- package/panda.buildinfo.json +107 -66
- 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
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export type {
|
|
3
|
-
export { bezierControlPoints, bezierPath,
|
|
4
|
-
export { getViewBounds } from './get-view-bounds';
|
|
1
|
+
export { Vector, vector } from './vector';
|
|
2
|
+
export type { VectorValue } from './vector';
|
|
3
|
+
export { bezierControlPoints, bezierPath, distance, distanceBetweenPoints, extractMinimalInternalNode, getNodeCenter, getNodeIntersection, getNodeIntersectionFromCenterToPoint, isEqualMinimalInternalNodes, isInside, isSamePoint, type MinimalInternalNode, nodeToRect, stopPropagation, } from './xyflow';
|
|
5
4
|
export { roundDpr } from './roundDpr';
|
|
5
|
+
export { pickViewBounds } from './view-bounds';
|
package/dist/utils/vector.d.ts
CHANGED
|
@@ -1,24 +1,81 @@
|
|
|
1
|
-
export interface
|
|
2
|
-
x: number;
|
|
3
|
-
y: number;
|
|
1
|
+
export interface VectorValue {
|
|
2
|
+
readonly x: number;
|
|
3
|
+
readonly y: number;
|
|
4
4
|
}
|
|
5
|
-
export declare class
|
|
6
|
-
x: number;
|
|
7
|
-
y: number;
|
|
5
|
+
export declare class Vector implements VectorValue {
|
|
6
|
+
readonly x: number;
|
|
7
|
+
readonly y: number;
|
|
8
8
|
constructor(x: number, y: number);
|
|
9
|
-
static create(position:
|
|
10
|
-
static
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
9
|
+
static create(position: VectorValue): Vector;
|
|
10
|
+
static create(x: number, y: number): Vector;
|
|
11
|
+
/**
|
|
12
|
+
* Adds two vectors.
|
|
13
|
+
* @param a The first vector.
|
|
14
|
+
* @param b The second vector.
|
|
15
|
+
* @returns The sum of the two vectors.
|
|
16
|
+
*/
|
|
17
|
+
static add(a: VectorValue, b: VectorValue): VectorValue;
|
|
18
|
+
/**
|
|
19
|
+
* Subtracts two vectors.
|
|
20
|
+
* @param a The first vector.
|
|
21
|
+
* @param b The second vector.
|
|
22
|
+
* @returns The difference of the two vectors.
|
|
23
|
+
*/
|
|
24
|
+
static subtract(a: VectorValue, b: VectorValue): VectorValue;
|
|
25
|
+
/**
|
|
26
|
+
* Multiplies a vector by a scalar.
|
|
27
|
+
* @param a The vector.
|
|
28
|
+
* @param b The scalar.
|
|
29
|
+
* @returns The scaled vector.
|
|
30
|
+
*/
|
|
31
|
+
static multiply(a: VectorValue, b: number): VectorValue;
|
|
32
|
+
/**
|
|
33
|
+
* Calculates the dot product of the vectors.
|
|
34
|
+
* @param a The first vector.
|
|
35
|
+
* @param b The second vector.
|
|
36
|
+
* @returns The dot product.
|
|
37
|
+
*/
|
|
38
|
+
static dot(a: VectorValue, b: VectorValue): number;
|
|
39
|
+
/**
|
|
40
|
+
* Adds the given vector to this vector.
|
|
41
|
+
* @param b The vector to add.
|
|
42
|
+
* @returns A new vector that is the sum of this vector and the given vector.
|
|
43
|
+
*/
|
|
44
|
+
add(b: VectorValue): Vector;
|
|
45
|
+
/**
|
|
46
|
+
* Subtracts the given vector from this vector.
|
|
47
|
+
* @param b The vector to subtract.
|
|
48
|
+
* @returns A new vector that is the difference of this vector and the given vector.
|
|
49
|
+
*/
|
|
50
|
+
subtract(b: VectorValue): Vector;
|
|
51
|
+
/**
|
|
52
|
+
* Multiplies this vector by a scalar.
|
|
53
|
+
* @param b The scalar to multiply by.
|
|
54
|
+
* @returns A new vector that is the product of this vector and the given scalar.
|
|
55
|
+
*/
|
|
56
|
+
multiply(b: number): Vector;
|
|
57
|
+
/**
|
|
58
|
+
* Calculates the dot product of this vector and another vector.
|
|
59
|
+
* @param b The other vector.
|
|
60
|
+
* @returns The dot product.
|
|
61
|
+
*/
|
|
62
|
+
dot(b: VectorValue): number;
|
|
63
|
+
/**
|
|
64
|
+
* Calculates the cross product of this vector and another vector.
|
|
65
|
+
* @param b The other vector.
|
|
66
|
+
* @returns The cross product as a new vector.
|
|
67
|
+
*/
|
|
68
|
+
cross(b: VectorValue): Vector;
|
|
69
|
+
/**
|
|
70
|
+
* Calculates the length (magnitude) of this vector.
|
|
71
|
+
* @returns The length of the vector.
|
|
72
|
+
*/
|
|
73
|
+
length(): number;
|
|
74
|
+
/**
|
|
75
|
+
* Normalizes the vector (makes it unit length, i.e., has a length of 1).
|
|
76
|
+
* @returns A new vector that is the normalized version of this vector.
|
|
77
|
+
*/
|
|
78
|
+
normalize(): Vector;
|
|
23
79
|
}
|
|
24
|
-
export declare function vector(source: Vector):
|
|
80
|
+
export declare function vector(source: VectorValue | Vector): Vector;
|
|
81
|
+
export declare function vector(x: number, y: number): Vector;
|
package/dist/utils/vector.js
CHANGED
|
@@ -1,53 +1,120 @@
|
|
|
1
|
-
class
|
|
1
|
+
class Vector {
|
|
2
2
|
constructor(x, y) {
|
|
3
3
|
this.x = x;
|
|
4
4
|
this.y = y;
|
|
5
5
|
}
|
|
6
|
-
static create(
|
|
7
|
-
|
|
6
|
+
static create(...args) {
|
|
7
|
+
if (args.length === 2) {
|
|
8
|
+
return new Vector(args[0], args[1]);
|
|
9
|
+
}
|
|
10
|
+
return new Vector(args[0].x, args[0].y);
|
|
8
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Adds two vectors.
|
|
14
|
+
* @param a The first vector.
|
|
15
|
+
* @param b The second vector.
|
|
16
|
+
* @returns The sum of the two vectors.
|
|
17
|
+
*/
|
|
9
18
|
static add(a, b) {
|
|
10
19
|
return { x: a.x + b.x, y: a.y + b.y };
|
|
11
20
|
}
|
|
12
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Subtracts two vectors.
|
|
23
|
+
* @param a The first vector.
|
|
24
|
+
* @param b The second vector.
|
|
25
|
+
* @returns The difference of the two vectors.
|
|
26
|
+
*/
|
|
27
|
+
static subtract(a, b) {
|
|
13
28
|
return { x: a.x - b.x, y: a.y - b.y };
|
|
14
29
|
}
|
|
15
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Multiplies a vector by a scalar.
|
|
32
|
+
* @param a The vector.
|
|
33
|
+
* @param b The scalar.
|
|
34
|
+
* @returns The scaled vector.
|
|
35
|
+
*/
|
|
36
|
+
static multiply(a, b) {
|
|
16
37
|
return { x: a.x * b, y: a.y * b };
|
|
17
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Calculates the dot product of the vectors.
|
|
41
|
+
* @param a The first vector.
|
|
42
|
+
* @param b The second vector.
|
|
43
|
+
* @returns The dot product.
|
|
44
|
+
*/
|
|
18
45
|
static dot(a, b) {
|
|
19
46
|
return a.x * b.x + a.y * b.y;
|
|
20
47
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
48
|
+
/**
|
|
49
|
+
* Adds the given vector to this vector.
|
|
50
|
+
* @param b The vector to add.
|
|
51
|
+
* @returns A new vector that is the sum of this vector and the given vector.
|
|
52
|
+
*/
|
|
27
53
|
add(b) {
|
|
28
|
-
return new
|
|
54
|
+
return new Vector(this.x + b.x, this.y + b.y);
|
|
29
55
|
}
|
|
30
|
-
|
|
31
|
-
|
|
56
|
+
/**
|
|
57
|
+
* Subtracts the given vector from this vector.
|
|
58
|
+
* @param b The vector to subtract.
|
|
59
|
+
* @returns A new vector that is the difference of this vector and the given vector.
|
|
60
|
+
*/
|
|
61
|
+
subtract(b) {
|
|
62
|
+
return new Vector(this.x - b.x, this.y - b.y);
|
|
32
63
|
}
|
|
33
|
-
|
|
34
|
-
|
|
64
|
+
/**
|
|
65
|
+
* Multiplies this vector by a scalar.
|
|
66
|
+
* @param b The scalar to multiply by.
|
|
67
|
+
* @returns A new vector that is the product of this vector and the given scalar.
|
|
68
|
+
*/
|
|
69
|
+
multiply(b) {
|
|
70
|
+
return new Vector(this.x * b, this.y * b);
|
|
35
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Calculates the dot product of this vector and another vector.
|
|
74
|
+
* @param b The other vector.
|
|
75
|
+
* @returns The dot product.
|
|
76
|
+
*/
|
|
36
77
|
dot(b) {
|
|
37
78
|
return this.x * b.x + this.y * b.y;
|
|
38
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* Calculates the cross product of this vector and another vector.
|
|
82
|
+
* @param b The other vector.
|
|
83
|
+
* @returns The cross product as a new vector.
|
|
84
|
+
*/
|
|
39
85
|
cross(b) {
|
|
40
|
-
return new
|
|
86
|
+
return new Vector(this.y * b.x - this.x * b.y, this.x * b.y - this.y * b.x);
|
|
41
87
|
}
|
|
42
|
-
|
|
43
|
-
|
|
88
|
+
/**
|
|
89
|
+
* Calculates the length (magnitude) of this vector.
|
|
90
|
+
* @returns The length of the vector.
|
|
91
|
+
*/
|
|
92
|
+
length() {
|
|
93
|
+
if (this.x === 0 && this.y === 0) {
|
|
94
|
+
return 0;
|
|
95
|
+
}
|
|
96
|
+
return Math.sqrt(this.x ** 2 + this.y ** 2);
|
|
44
97
|
}
|
|
45
|
-
|
|
46
|
-
|
|
98
|
+
/**
|
|
99
|
+
* Normalizes the vector (makes it unit length, i.e., has a length of 1).
|
|
100
|
+
* @returns A new vector that is the normalized version of this vector.
|
|
101
|
+
*/
|
|
102
|
+
normalize() {
|
|
103
|
+
const len = this.length();
|
|
104
|
+
if (len === 0) {
|
|
105
|
+
return new Vector(0, 0);
|
|
106
|
+
}
|
|
107
|
+
return new Vector(this.x / len, this.y / len);
|
|
47
108
|
}
|
|
48
109
|
}
|
|
49
|
-
function vector(
|
|
50
|
-
|
|
110
|
+
function vector(...args) {
|
|
111
|
+
if (args.length === 1 && args[0] instanceof Vector) {
|
|
112
|
+
return args[0];
|
|
113
|
+
}
|
|
114
|
+
if (args.length === 2) {
|
|
115
|
+
return new Vector(args[0], args[1]);
|
|
116
|
+
}
|
|
117
|
+
return new Vector(args[0].x, args[0].y);
|
|
51
118
|
}
|
|
52
119
|
|
|
53
|
-
export {
|
|
120
|
+
export { Vector, vector };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DiagramEdge, DynamicViewDisplayVariant, LayoutedView, BBox } from '@likec4/core/types';
|
|
2
|
+
/**
|
|
3
|
+
* Picks appropriate bounds from the view,
|
|
4
|
+
* depending on its type and dynamic variant
|
|
5
|
+
*/
|
|
6
|
+
export declare function pickViewBounds(view: LayoutedView, dynamicVariant?: DynamicViewDisplayVariant): BBox;
|
|
7
|
+
export declare function calcEdgeBounds({ points, controlPoints, labelBBox }: DiagramEdge): BBox;
|
|
8
|
+
export declare function calcViewBounds({ nodes, edges }: Pick<LayoutedView, 'nodes' | 'edges'>): BBox;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { BBox } from '@likec4/core/types';
|
|
2
|
+
|
|
3
|
+
function pickViewBounds(view, dynamicVariant) {
|
|
4
|
+
if (view._type === "dynamic") {
|
|
5
|
+
try {
|
|
6
|
+
dynamicVariant ??= view.variant;
|
|
7
|
+
if (dynamicVariant === "sequence") {
|
|
8
|
+
return view.sequenceLayout.bounds;
|
|
9
|
+
}
|
|
10
|
+
} catch {
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return view.bounds;
|
|
14
|
+
}
|
|
15
|
+
function calcEdgeBounds({ points, controlPoints, labelBBox }) {
|
|
16
|
+
let minX = Infinity;
|
|
17
|
+
let minY = Infinity;
|
|
18
|
+
let maxX = -Infinity;
|
|
19
|
+
let maxY = -Infinity;
|
|
20
|
+
for (const p of points) {
|
|
21
|
+
minX = Math.min(minX, p[0]);
|
|
22
|
+
minY = Math.min(minY, p[1]);
|
|
23
|
+
maxX = Math.max(maxX, p[0]);
|
|
24
|
+
maxY = Math.max(maxY, p[1]);
|
|
25
|
+
}
|
|
26
|
+
if (controlPoints) {
|
|
27
|
+
for (const p of controlPoints) {
|
|
28
|
+
minX = Math.min(minX, p.x);
|
|
29
|
+
minY = Math.min(minY, p.y);
|
|
30
|
+
maxX = Math.max(maxX, p.x);
|
|
31
|
+
maxY = Math.max(maxY, p.y);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (labelBBox) {
|
|
35
|
+
minX = Math.min(minX, labelBBox.x);
|
|
36
|
+
minY = Math.min(minY, labelBBox.y);
|
|
37
|
+
maxX = Math.max(maxX, labelBBox.x + labelBBox.width);
|
|
38
|
+
maxY = Math.max(maxY, labelBBox.y + labelBBox.height);
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
x: minX,
|
|
42
|
+
y: minY,
|
|
43
|
+
width: maxX - minX,
|
|
44
|
+
height: maxY - minY
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function calcViewBounds({ nodes, edges }) {
|
|
48
|
+
return BBox.expand(
|
|
49
|
+
BBox.merge(
|
|
50
|
+
...nodes,
|
|
51
|
+
...edges.map(calcEdgeBounds)
|
|
52
|
+
),
|
|
53
|
+
10
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export { calcEdgeBounds, calcViewBounds, pickViewBounds };
|
package/dist/utils/xyflow.d.ts
CHANGED
|
@@ -1,8 +1,54 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NonEmptyArray, Point, BBox } from '@likec4/core';
|
|
2
2
|
import { InternalNode, Rect, XYPosition, Position } from '@xyflow/react';
|
|
3
3
|
import { NodeHandle } from '@xyflow/system';
|
|
4
|
+
import { Vector } from './vector';
|
|
4
5
|
export declare function distance(a: XYPosition, b: XYPosition): number;
|
|
5
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Minimal type to access only needed properties of InternalNode
|
|
8
|
+
*/
|
|
9
|
+
export type MinimalInternalNode = {
|
|
10
|
+
internals: {
|
|
11
|
+
positionAbsolute: XYPosition;
|
|
12
|
+
};
|
|
13
|
+
measured?: {
|
|
14
|
+
width?: number;
|
|
15
|
+
height?: number;
|
|
16
|
+
};
|
|
17
|
+
width?: number;
|
|
18
|
+
height?: number;
|
|
19
|
+
initialWidth?: number;
|
|
20
|
+
initialHeight?: number;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Extracts only the minimal properties from an InternalNode
|
|
24
|
+
* needed for geometric calculations.
|
|
25
|
+
*
|
|
26
|
+
* @param nd - The InternalNode to extract from.
|
|
27
|
+
* @returns An object containing only the necessary properties.
|
|
28
|
+
*/
|
|
29
|
+
export declare function extractMinimalInternalNode<N extends InternalNode>(nd: N): MinimalInternalNode;
|
|
30
|
+
export declare function isEqualMinimalInternalNodes(a: MinimalInternalNode, b: MinimalInternalNode): boolean;
|
|
31
|
+
export declare const nodeToRect: (nd: MinimalInternalNode) => Rect;
|
|
32
|
+
export declare function getNodeCenter(node: MinimalInternalNode): XYPosition;
|
|
33
|
+
/**
|
|
34
|
+
* Helper function returns the intersection point
|
|
35
|
+
* of the line between the center of the intersectionNode and the target
|
|
36
|
+
*
|
|
37
|
+
* @param intersectionNode the node that is the center of the line
|
|
38
|
+
* @param target position of the target
|
|
39
|
+
* @param nodeMargin the margin of the intersectionNode. The point will be placed at nodeMargin distance from the border of the node
|
|
40
|
+
* @returns coordinates of the intersection point
|
|
41
|
+
*/
|
|
42
|
+
export declare function getNodeIntersectionFromCenterToPoint(intersectionNode: MinimalInternalNode, target: XYPosition, nodeMargin?: number): Vector;
|
|
43
|
+
/**
|
|
44
|
+
* Helper function returns the intersection point
|
|
45
|
+
* of the line between the center of the intersectionNode and the target
|
|
46
|
+
*
|
|
47
|
+
* @param intersectionNode the node that is the center of the line
|
|
48
|
+
* @param targetNode the target node
|
|
49
|
+
* @returns coordinates of the intersection point
|
|
50
|
+
*/
|
|
51
|
+
export declare function getNodeIntersection(intersectionNode: MinimalInternalNode, targetNode: MinimalInternalNode): XYPosition;
|
|
6
52
|
/**
|
|
7
53
|
* Checks if a rectangle is completely inside another rectangle.
|
|
8
54
|
*
|
|
@@ -11,14 +57,10 @@ export declare const nodeToRect: (nd: InternalNode) => Rect;
|
|
|
11
57
|
* @returns `true` if the `test` rectangle is completely inside the `target` rectangle, otherwise `false`.
|
|
12
58
|
*/
|
|
13
59
|
export declare const isInside: (test: Rect, target: Rect) => boolean;
|
|
14
|
-
export declare function bezierControlPoints(
|
|
60
|
+
export declare function bezierControlPoints(points: NonEmptyArray<Point>): XYPosition[];
|
|
15
61
|
export declare function isSamePoint(a: XYPosition | Point, b: XYPosition | Point): boolean;
|
|
16
62
|
export declare function distanceBetweenPoints(a: XYPosition, b: XYPosition): number;
|
|
17
63
|
export declare function stopPropagation(e: React.MouseEvent): void;
|
|
18
|
-
export declare function centerXYInternalNode<N extends InternalNode>(nd: N): {
|
|
19
|
-
x: number;
|
|
20
|
-
y: number;
|
|
21
|
-
};
|
|
22
64
|
export declare function bezierPath(bezierSpline: NonEmptyArray<Point>): string;
|
|
23
65
|
export declare function toXYFlowPosition(position: 'left' | 'right' | 'top' | 'bottom'): Position;
|
|
24
66
|
export declare function createXYFlowNodeNandles(bbox: BBox): NodeHandle[];
|
package/dist/utils/xyflow.js
CHANGED
|
@@ -3,10 +3,69 @@ import { invariant } from '@likec4/core/utils';
|
|
|
3
3
|
import '@xyflow/react';
|
|
4
4
|
import { getNodeDimensions } from '@xyflow/system';
|
|
5
5
|
import { Bezier } from 'bezier-js';
|
|
6
|
-
import {
|
|
6
|
+
import { hasAtLeast, isNumber, isArray } from 'remeda';
|
|
7
|
+
import { vector } from './vector.js';
|
|
7
8
|
|
|
8
|
-
function
|
|
9
|
-
|
|
9
|
+
function extractMinimalInternalNode(nd) {
|
|
10
|
+
const minimal = {
|
|
11
|
+
internals: {
|
|
12
|
+
positionAbsolute: nd.internals.positionAbsolute
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
if (nd.measured) {
|
|
16
|
+
minimal.measured = nd.measured;
|
|
17
|
+
}
|
|
18
|
+
if (isNumber(nd.width)) {
|
|
19
|
+
minimal.width = nd.width;
|
|
20
|
+
}
|
|
21
|
+
if (isNumber(nd.height)) {
|
|
22
|
+
minimal.height = nd.height;
|
|
23
|
+
}
|
|
24
|
+
if (isNumber(nd.initialWidth)) {
|
|
25
|
+
minimal.initialWidth = nd.initialWidth;
|
|
26
|
+
}
|
|
27
|
+
if (isNumber(nd.initialHeight)) {
|
|
28
|
+
minimal.initialHeight = nd.initialHeight;
|
|
29
|
+
}
|
|
30
|
+
return minimal;
|
|
31
|
+
}
|
|
32
|
+
function isEqualMinimalInternalNodes(a, b) {
|
|
33
|
+
const posA = a.internals.positionAbsolute;
|
|
34
|
+
const posB = b.internals.positionAbsolute;
|
|
35
|
+
if (posA.x !== posB.x || posA.y !== posB.y) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
const widthA = a.measured?.width ?? a.width ?? a.initialWidth ?? 0;
|
|
39
|
+
const widthB = b.measured?.width ?? b.width ?? b.initialWidth ?? 0;
|
|
40
|
+
if (widthA !== widthB) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
const heightA = a.measured?.height ?? a.height ?? a.initialHeight ?? 0;
|
|
44
|
+
const heightB = b.measured?.height ?? b.height ?? b.initialHeight ?? 0;
|
|
45
|
+
return heightA === heightB;
|
|
46
|
+
}
|
|
47
|
+
function getNodeCenter(node) {
|
|
48
|
+
const { width, height } = getNodeDimensions(node);
|
|
49
|
+
const { x, y } = node.internals.positionAbsolute;
|
|
50
|
+
return {
|
|
51
|
+
x: x + width / 2,
|
|
52
|
+
y: y + height / 2
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function getNodeIntersectionFromCenterToPoint(intersectionNode, target, nodeMargin = 0) {
|
|
56
|
+
const nodeCenter = getNodeCenter(intersectionNode);
|
|
57
|
+
const { width, height } = getNodeDimensions(intersectionNode);
|
|
58
|
+
const v = vector(target.x, target.y).subtract(nodeCenter);
|
|
59
|
+
const xScale = (nodeMargin + (width || 0) / 2) / v.x;
|
|
60
|
+
const yScale = (nodeMargin + (height || 0) / 2) / v.y;
|
|
61
|
+
const scale = Math.min(Math.abs(xScale), Math.abs(yScale));
|
|
62
|
+
return vector(v).multiply(scale).add(nodeCenter);
|
|
63
|
+
}
|
|
64
|
+
function getNodeIntersection(intersectionNode, targetNode) {
|
|
65
|
+
return getNodeIntersectionFromCenterToPoint(intersectionNode, getNodeCenter(targetNode));
|
|
66
|
+
}
|
|
67
|
+
function bezierControlPoints(points) {
|
|
68
|
+
let [start, ...bezierPoints] = points;
|
|
10
69
|
invariant(start, "start should be defined");
|
|
11
70
|
const handles = [
|
|
12
71
|
// start
|
|
@@ -42,13 +101,6 @@ function isSamePoint(a, b) {
|
|
|
42
101
|
function stopPropagation(e) {
|
|
43
102
|
return e.stopPropagation();
|
|
44
103
|
}
|
|
45
|
-
function centerXYInternalNode(nd) {
|
|
46
|
-
const { width, height } = getNodeDimensions(nd);
|
|
47
|
-
return {
|
|
48
|
-
x: nd.internals.positionAbsolute.x + width / 2,
|
|
49
|
-
y: nd.internals.positionAbsolute.y + height / 2
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
104
|
function bezierPath(bezierSpline) {
|
|
53
105
|
let [start, ...points] = bezierSpline;
|
|
54
106
|
invariant(start, "start should be defined");
|
|
@@ -62,4 +114,4 @@ function bezierPath(bezierSpline) {
|
|
|
62
114
|
return path;
|
|
63
115
|
}
|
|
64
116
|
|
|
65
|
-
export { bezierControlPoints, bezierPath,
|
|
117
|
+
export { bezierControlPoints, bezierPath, extractMinimalInternalNode, getNodeCenter, getNodeIntersection, getNodeIntersectionFromCenterToPoint, isEqualMinimalInternalNodes, isSamePoint, stopPropagation };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@likec4/diagram",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.44.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"bugs": "https://github.com/likec4/likec4/issues",
|
|
6
6
|
"homepage": "https://likec4.dev",
|
|
@@ -65,13 +65,14 @@
|
|
|
65
65
|
"@dagrejs/dagre": "1.1.5",
|
|
66
66
|
"@floating-ui/dom": "^1.7.4",
|
|
67
67
|
"@lume/kiwi": "^0.4.4",
|
|
68
|
-
"@mantine/core": "8.3.
|
|
69
|
-
"@mantine/hooks": "8.3.
|
|
68
|
+
"@mantine/core": "8.3.7",
|
|
69
|
+
"@mantine/hooks": "8.3.7",
|
|
70
70
|
"@nanostores/react": "1.0.0",
|
|
71
|
-
"@react-hookz/web": "^25.
|
|
72
|
-
"@xstate/react": "
|
|
71
|
+
"@react-hookz/web": "^25.2.0",
|
|
72
|
+
"@xstate/react": "6.0.0",
|
|
73
73
|
"@xyflow/react": "12.9.0",
|
|
74
74
|
"@xyflow/system": "0.0.71",
|
|
75
|
+
"immer": "^10.2.0",
|
|
75
76
|
"bezier-js": "^6.1.4",
|
|
76
77
|
"d3-shape": "^3.2.0",
|
|
77
78
|
"fast-equals": "^5.3.2",
|
|
@@ -82,9 +83,9 @@
|
|
|
82
83
|
"react-shadow": "^20.6.0",
|
|
83
84
|
"remeda": "^2.32.0",
|
|
84
85
|
"type-fest": "^4.41.0",
|
|
85
|
-
"xstate": "
|
|
86
|
-
"@likec4/core": "1.
|
|
87
|
-
"@likec4/styles": "1.
|
|
86
|
+
"xstate": "5.24.0",
|
|
87
|
+
"@likec4/core": "1.44.0",
|
|
88
|
+
"@likec4/styles": "1.44.0"
|
|
88
89
|
},
|
|
89
90
|
"peerDependencies": {
|
|
90
91
|
"@pandacss/dev": "^1.4.3",
|
|
@@ -111,21 +112,21 @@
|
|
|
111
112
|
"@types/bezier-js": "^4.1.3",
|
|
112
113
|
"@types/d3-shape": "^3.1.7",
|
|
113
114
|
"@types/node": "~20.19.22",
|
|
114
|
-
"@types/react": "19.
|
|
115
|
-
"@types/react-dom": "19.
|
|
116
|
-
"@vitejs/plugin-react": "^5.0
|
|
117
|
-
"oxlint": "1.
|
|
115
|
+
"@types/react": "19.2.2",
|
|
116
|
+
"@types/react-dom": "19.2.2",
|
|
117
|
+
"@vitejs/plugin-react": "^5.1.0",
|
|
118
|
+
"oxlint": "1.28.0",
|
|
118
119
|
"postcss": "8.5.6",
|
|
119
|
-
"react": "19.
|
|
120
|
-
"react-dom": "19.
|
|
120
|
+
"react": "19.2.0",
|
|
121
|
+
"react-dom": "19.2.0",
|
|
121
122
|
"typescript": "5.9.3",
|
|
122
|
-
"vite": "^7.
|
|
123
|
+
"vite": "^7.2.2",
|
|
123
124
|
"vite-plugin-dts": "^4.5.4",
|
|
124
|
-
"vitest": "
|
|
125
|
+
"vitest": "4.0.8",
|
|
125
126
|
"wireit": "0.14.12",
|
|
126
127
|
"zx": "8.8.5",
|
|
127
|
-
"@likec4/
|
|
128
|
-
"@likec4/
|
|
128
|
+
"@likec4/devops": "1.42.0",
|
|
129
|
+
"@likec4/tsconfig": "1.44.0"
|
|
129
130
|
},
|
|
130
131
|
"scripts": {
|
|
131
132
|
"typecheck": "tsc --build --verbose",
|