@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.
Files changed (301) hide show
  1. package/bundle/index.js +5746 -4674
  2. package/dist/LikeC4Diagram.d.ts +1 -1
  3. package/dist/LikeC4Diagram.js +13 -10
  4. package/dist/LikeC4Diagram.props.d.ts +16 -7
  5. package/dist/LikeC4ProjectsProvider.js +1 -1
  6. package/dist/LikeC4View.d.ts +5 -0
  7. package/dist/LikeC4View.js +22 -11
  8. package/dist/ReactLikeC4.js +2 -2
  9. package/dist/StaticLikeC4Diagram.js +1 -1
  10. package/dist/_virtual/_commonjsHelpers.js +3 -0
  11. package/dist/_virtual/assign-dea9f7c8.cjs.js +3 -0
  12. package/dist/_virtual/log-ec8d4df4.cjs.js +3 -0
  13. package/dist/_virtual/raise-da5b247f.cjs.js +3 -0
  14. package/dist/_virtual/xstate-actions.cjs.js +5 -0
  15. package/dist/_virtual/xstate-actions.cjs2.js +3 -0
  16. package/dist/_virtual/xstate-dev.cjs.js +3 -0
  17. package/dist/_virtual/xstate-guards.cjs.js +5 -0
  18. package/dist/_virtual/xstate-guards.cjs2.js +3 -0
  19. package/dist/base/Background.d.ts +2 -1
  20. package/dist/base/Background.js +11 -2
  21. package/dist/base/Base.d.ts +28 -0
  22. package/dist/base/BaseXYFlow.d.ts +5 -5
  23. package/dist/base/BaseXYFlow.js +38 -44
  24. package/dist/base/index.d.ts +6 -2
  25. package/dist/base/types.d.ts +1 -28
  26. package/dist/base/updateEdges.js +4 -3
  27. package/dist/base/updateNodes.js +3 -2
  28. package/dist/base-primitives/compound/CompoundActionButton.js +1 -1
  29. package/dist/base-primitives/compound/CompoundDetailsButton.js +1 -1
  30. package/dist/base-primitives/edge/EdgeActionButton.js +1 -1
  31. package/dist/base-primitives/edge/EdgeContainer.d.ts +1 -1
  32. package/dist/base-primitives/edge/EdgeContainer.js +4 -0
  33. package/dist/base-primitives/edge/EdgeLabel.d.ts +1 -0
  34. package/dist/base-primitives/edge/EdgeLabel.js +2 -0
  35. package/dist/base-primitives/edge/EdgeLabelContainer.d.ts +1 -1
  36. package/dist/base-primitives/edge/EdgeLabelContainer.js +4 -0
  37. package/dist/base-primitives/edge/EdgePath.d.ts +4 -0
  38. package/dist/base-primitives/edge/EdgePath.js +9 -5
  39. package/dist/base-primitives/element/ElementActionButtons.d.ts +3 -2
  40. package/dist/base-primitives/element/ElementActionButtons.js +1 -1
  41. package/dist/base-primitives/element/ElementDetailsButton.js +2 -5
  42. package/dist/base-primitives/element/ElementNodeContainer.css.js +15 -27
  43. package/dist/base-primitives/element/ElementTags.js +2 -1
  44. package/dist/base-primitives/memoEdge.js +4 -2
  45. package/dist/base-primitives/memoNode.d.ts +1 -1
  46. package/dist/base-primitives/memoNode.js +3 -3
  47. package/dist/components/ErrorFallback.js +52 -35
  48. package/dist/components/Link.js +2 -2
  49. package/dist/context/DiagramEventHandlers.js +2 -1
  50. package/dist/context/DiagramFeatures.d.ts +24 -6
  51. package/dist/context/DiagramFeatures.js +28 -56
  52. package/dist/context/IconRenderer.js +6 -6
  53. package/dist/context/LikeC4ModelContext.js +3 -10
  54. package/dist/context/TagStylesContext.js +2 -18
  55. package/dist/context/index.d.ts +1 -1
  56. package/dist/custom/customNodes.js +3 -2
  57. package/dist/custom/hooks.d.ts +1 -1
  58. package/dist/custom/index.d.ts +1 -1
  59. package/dist/custom/index.js +4 -4
  60. package/dist/editor/LikeC4EditorContext.d.ts +21 -0
  61. package/dist/editor/index.d.ts +2 -0
  62. package/dist/hooks/index.d.ts +2 -1
  63. package/dist/hooks/safeContext.d.ts +6 -3
  64. package/dist/hooks/safeContext.js +10 -3
  65. package/dist/hooks/useCallbackRef.d.ts +1 -0
  66. package/dist/hooks/useCallbackRef.js +13 -0
  67. package/dist/hooks/useCurrentView.d.ts +11 -0
  68. package/dist/hooks/{useCurrentViewId.js → useCurrentView.js} +7 -3
  69. package/dist/hooks/useCurrentViewModel.js +4 -1
  70. package/dist/hooks/useDiagram.d.ts +7 -113
  71. package/dist/hooks/useDiagram.js +7 -127
  72. package/dist/hooks/useDiagramCompareLayout.d.ts +35 -0
  73. package/dist/hooks/useDiagramCompareLayout.js +60 -0
  74. package/dist/hooks/useUpdateEffect.js +2 -4
  75. package/dist/hooks/useXYFlow.d.ts +1 -0
  76. package/dist/hooks/useXYFlow.js +4 -7
  77. package/dist/index.d.ts +2 -2
  78. package/dist/index.js +4 -3
  79. package/dist/likec4diagram/DiagramUI.js +14 -7
  80. package/dist/likec4diagram/DiagramXYFlow.d.ts +2 -2
  81. package/dist/likec4diagram/DiagramXYFlow.js +54 -51
  82. package/dist/likec4diagram/convert-to-xyflow.d.ts +0 -1
  83. package/dist/likec4diagram/custom/edges/RelationshipEdge.js +249 -220
  84. package/dist/likec4diagram/custom/edges/SequenceStepEdge.js +7 -2
  85. package/dist/likec4diagram/custom/edges/edges.css.js +3 -4
  86. package/dist/likec4diagram/custom/edges/useControlPoints.d.ts +8 -0
  87. package/dist/likec4diagram/custom/edges/useControlPoints.js +58 -0
  88. package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.d.ts +7 -0
  89. package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.js +60 -0
  90. package/dist/likec4diagram/custom/edges/utils.d.ts +0 -12
  91. package/dist/likec4diagram/custom/nodes/CompoundActions.js +4 -1
  92. package/dist/likec4diagram/custom/nodes/ElementActions.d.ts +2 -1
  93. package/dist/likec4diagram/custom/nodes/ElementActions.js +15 -10
  94. package/dist/likec4diagram/custom/nodes/ElementNodeDrifts.d.ts +4 -0
  95. package/dist/likec4diagram/custom/nodes/ElementNodeDrifts.js +46 -0
  96. package/dist/likec4diagram/custom/nodes/SequenceActorNode.js +4 -1
  97. package/dist/likec4diagram/custom/nodes/nodes.d.ts +9 -1
  98. package/dist/likec4diagram/custom/nodes/nodes.js +13 -9
  99. package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.d.ts +1 -1
  100. package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +1 -1
  101. package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +2 -1
  102. package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.js +4 -3
  103. package/dist/likec4diagram/custom/nodes/toolbar/_shared.d.ts +1 -11
  104. package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +7 -51
  105. package/dist/likec4diagram/custom/nodes/toolbar/types.d.ts +5 -0
  106. package/dist/likec4diagram/custom/nodes/toolbar/types.js +7 -0
  107. package/dist/likec4diagram/custom/nodes/toolbar/useHandlers.d.ts +8 -0
  108. package/dist/likec4diagram/custom/nodes/toolbar/useHandlers.js +44 -0
  109. package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +5 -7
  110. package/dist/likec4diagram/state/DiagramActorProvider.d.ts +3 -2
  111. package/dist/likec4diagram/state/DiagramActorProvider.js +96 -70
  112. package/dist/likec4diagram/state/assign.d.ts +4 -2
  113. package/dist/likec4diagram/state/assign.js +39 -103
  114. package/dist/likec4diagram/state/createViewChange.d.ts +3 -0
  115. package/dist/likec4diagram/state/createViewChange.js +90 -0
  116. package/dist/likec4diagram/state/diagram-api.d.ts +113 -0
  117. package/dist/likec4diagram/state/diagram-api.js +134 -0
  118. package/dist/likec4diagram/state/hotkeyActor.d.ts +7 -0
  119. package/dist/likec4diagram/state/hotkeyActor.js +17 -1
  120. package/dist/likec4diagram/state/machine.actions.d.ts +2099 -0
  121. package/dist/likec4diagram/state/machine.actions.js +735 -0
  122. package/dist/likec4diagram/state/machine.d.ts +3717 -0
  123. package/dist/likec4diagram/state/machine.js +141 -0
  124. package/dist/likec4diagram/state/machine.setup.d.ts +284 -0
  125. package/dist/likec4diagram/state/machine.setup.js +71 -0
  126. package/dist/likec4diagram/state/machine.state.initializing.d.ts +183 -0
  127. package/dist/likec4diagram/state/machine.state.initializing.js +55 -0
  128. package/dist/likec4diagram/state/machine.state.navigating.d.ts +117 -0
  129. package/dist/likec4diagram/state/machine.state.navigating.js +45 -0
  130. package/dist/likec4diagram/state/machine.state.ready.d.ts +3666 -0
  131. package/dist/likec4diagram/state/machine.state.ready.js +437 -0
  132. package/dist/likec4diagram/state/syncManualLayoutActor.d.ts +220 -63
  133. package/dist/likec4diagram/state/syncManualLayoutActor.js +218 -143
  134. package/dist/likec4diagram/state/types.d.ts +4 -7
  135. package/dist/likec4diagram/state/utils.d.ts +4 -2
  136. package/dist/likec4diagram/state/utils.js +4 -1
  137. package/dist/likec4diagram/types.d.ts +6 -1
  138. package/dist/likec4diagram/ui/LayoutDriftFrame.d.ts +2 -0
  139. package/dist/likec4diagram/ui/LayoutDriftFrame.js +66 -0
  140. package/dist/likec4diagram/ui/index.d.ts +1 -0
  141. package/dist/likec4diagram/ui/notation/NotationPanel.js +5 -4
  142. package/dist/likec4diagram/useLayoutConstraints.d.ts +10 -5
  143. package/dist/likec4diagram/useLayoutConstraints.js +225 -54
  144. package/dist/likec4diagram/xyflow-diagram/diagram-view.d.ts +0 -1
  145. package/dist/likec4diagram/xyflow-diagram/diagram-view.js +15 -15
  146. package/dist/navigationpanel/NavigationPanel.js +11 -7
  147. package/dist/navigationpanel/NavigationPanelControls.d.ts +2 -1
  148. package/dist/navigationpanel/NavigationPanelControls.js +23 -17
  149. package/dist/navigationpanel/NavigationPanelDropdown.d.ts +2 -1
  150. package/dist/navigationpanel/NavigationPanelDropdown.js +62 -42
  151. package/dist/navigationpanel/_common.d.ts +1 -1
  152. package/dist/navigationpanel/_common.js +4 -2
  153. package/dist/navigationpanel/actor.d.ts +11 -7
  154. package/dist/navigationpanel/actor.js +5 -4
  155. package/dist/navigationpanel/comparepanel/CompareActionsMenu.d.ts +3 -0
  156. package/dist/navigationpanel/comparepanel/CompareActionsMenu.js +59 -0
  157. package/dist/navigationpanel/comparepanel/ComparePanel.d.ts +2 -0
  158. package/dist/navigationpanel/comparepanel/ComparePanel.js +42 -0
  159. package/dist/navigationpanel/comparepanel/ComparePanelControls.d.ts +1 -0
  160. package/dist/navigationpanel/comparepanel/ComparePanelControls.js +60 -0
  161. package/dist/navigationpanel/comparepanel/LayoutTypeSwitcher.d.ts +5 -0
  162. package/dist/navigationpanel/comparepanel/LayoutTypeSwitcher.js +38 -0
  163. package/dist/navigationpanel/comparepanel/index.d.ts +1 -0
  164. package/dist/navigationpanel/controls/{ViewDetailsCard.d.ts → DetailsControls.d.ts} +1 -1
  165. package/dist/navigationpanel/controls/{ViewDetailsCard.js → DetailsControls.js} +18 -14
  166. package/dist/navigationpanel/controls/LayoutWarning.d.ts +2 -0
  167. package/dist/navigationpanel/controls/LayoutWarning.js +102 -0
  168. package/dist/navigationpanel/controls/NavigationButtons.js +4 -3
  169. package/dist/navigationpanel/controls/OpenSource.js +2 -2
  170. package/dist/navigationpanel/controls/SearchControl.d.ts +2 -1
  171. package/dist/navigationpanel/controls/SearchControl.js +15 -17
  172. package/dist/navigationpanel/controls/ToggleReadonly.d.ts +1 -1
  173. package/dist/navigationpanel/controls/ToggleReadonly.js +19 -16
  174. package/dist/navigationpanel/controls/index.d.ts +2 -1
  175. package/dist/navigationpanel/dropdown/ProjectsMenu.d.ts +2 -2
  176. package/dist/navigationpanel/dropdown/ProjectsMenu.js +5 -5
  177. package/dist/navigationpanel/editorpanel/CenterCamera.js +5 -2
  178. package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.d.ts +1 -1
  179. package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.js +21 -20
  180. package/dist/navigationpanel/editorpanel/EditorPanel.js +3 -3
  181. package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.d.ts +2 -2
  182. package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.js +16 -13
  183. package/dist/navigationpanel/editorpanel/ToggleReadonly.d.ts +1 -0
  184. package/dist/navigationpanel/editorpanel/ToggleReadonly.js +15 -0
  185. package/dist/navigationpanel/styles.css.d.ts +2 -2
  186. package/dist/navigationpanel/styles.css.js +4 -4
  187. package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +14 -8
  188. package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +10 -10
  189. package/dist/navigationpanel/walkthrough/DynamicViewControls.js +31 -14
  190. package/dist/navigationpanel/walkthrough/WalkthroughPanel.d.ts +2 -1
  191. package/dist/navigationpanel/walkthrough/WalkthroughPanel.js +66 -49
  192. package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/actions/dist/xstate-actions.cjs.js +37 -0
  193. package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dev/dist/xstate-dev.cjs.js +59 -0
  194. package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dist/assign-dea9f7c8.cjs.js +140 -0
  195. package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dist/log-ec8d4df4.cjs.js +401 -0
  196. package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dist/raise-da5b247f.cjs.js +2716 -0
  197. package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/guards/dist/xstate-guards.cjs.js +26 -0
  198. package/dist/overlays/element-details/ElementDetails.js +7 -7
  199. package/dist/overlays/element-details/ElementDetailsCard.js +7 -5
  200. package/dist/overlays/element-details/MetadataValue.js +2 -2
  201. package/dist/overlays/element-details/TabPanelDeployments.js +6 -4
  202. package/dist/overlays/element-details/TabPanelRelationships.js +3 -3
  203. package/dist/overlays/element-details/TabPanelStructure.js +1 -1
  204. package/dist/overlays/element-details/actor.d.ts +3 -2
  205. package/dist/overlays/overlaysActor.d.ts +304 -62
  206. package/dist/overlays/overlaysActor.js +132 -131
  207. package/dist/overlays/relationship-details/RelationshipDetails.js +4 -3
  208. package/dist/overlays/relationship-details/SelectEdge.js +2 -2
  209. package/dist/overlays/relationship-details/actor.d.ts +14 -2
  210. package/dist/overlays/relationship-details/actor.js +17 -3
  211. package/dist/overlays/relationship-details/custom/ElementActions.js +8 -5
  212. package/dist/overlays/relationship-details/custom/edgeTypes.js +4 -1
  213. package/dist/overlays/relationship-details/custom/nodeTypes.js +4 -1
  214. package/dist/overlays/relationship-details/hooks.js +1 -1
  215. package/dist/overlays/relationships-browser/RelationshipsBrowser.js +6 -4
  216. package/dist/overlays/relationships-browser/SelectElement.js +2 -2
  217. package/dist/overlays/relationships-browser/actor.d.ts +239 -173
  218. package/dist/overlays/relationships-browser/actor.js +132 -110
  219. package/dist/overlays/relationships-browser/custom/ElementActions.js +44 -37
  220. package/dist/overlays/relationships-browser/custom/edgeTypes.js +4 -1
  221. package/dist/overlays/relationships-browser/custom/nodeTypes.js +4 -1
  222. package/dist/overlays/relationships-browser/hooks.js +7 -6
  223. package/dist/search/Search.js +2 -1
  224. package/dist/search/components/ElementsColumn.js +5 -3
  225. package/dist/search/components/PickView.js +1 -1
  226. package/dist/search/components/SearchByTags.js +21 -44
  227. package/dist/search/components/SearchInput.js +1 -1
  228. package/dist/search/components/ViewsColum.js +6 -4
  229. package/dist/shadowroot/ShadowRoot.js +1 -1
  230. package/dist/styles.css2.js +1 -1
  231. package/dist/utils/index.d.ts +4 -4
  232. package/dist/utils/vector.d.ts +78 -21
  233. package/dist/utils/vector.js +91 -24
  234. package/dist/utils/view-bounds.d.ts +8 -0
  235. package/dist/utils/view-bounds.js +57 -0
  236. package/dist/utils/xyflow.d.ts +49 -7
  237. package/dist/utils/xyflow.js +63 -11
  238. package/package.json +19 -18
  239. package/panda.buildinfo.json +107 -66
  240. package/styles-min.css +1 -1
  241. package/styles.css +1 -1
  242. package/dist/hooks/useCurrentViewId.d.ts +0 -6
  243. package/dist/likec4diagram/custom/edges/utils.js +0 -23
  244. package/dist/likec4diagram/state/diagram-machine.d.ts +0 -2590
  245. package/dist/likec4diagram/state/diagram-machine.js +0 -1180
  246. package/dist/navigationpanel/editorpanel/LayoutDriftNotification.d.ts +0 -1
  247. package/dist/navigationpanel/editorpanel/LayoutDriftNotification.js +0 -56
  248. package/dist/utils/get-view-bounds.d.ts +0 -3
  249. package/dist/utils/get-view-bounds.js +0 -14
  250. /package/dist/base/{types.js → Base.js} +0 -0
  251. /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
  252. /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
  253. /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
  254. /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
  255. /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
  256. /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
  257. /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
  258. /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
  259. /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
  260. /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
  261. /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
  262. /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
  263. /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
  264. /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
  265. /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
  266. /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
  267. /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
  268. /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
  269. /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
  270. /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
  271. /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
  272. /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
  273. /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
  274. /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
  275. /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
  276. /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
  277. /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
  278. /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
  279. /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
  280. /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
  281. /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
  282. /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
  283. /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
  284. /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
  285. /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
  286. /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
  287. /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
  288. /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
  289. /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
  290. /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
  291. /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
  292. /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
  293. /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
  294. /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
  295. /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
  296. /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
  297. /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
  298. /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
  299. /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
  300. /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
  301. /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,5 +1,5 @@
1
- export { vector, VectorImpl } from './vector';
2
- export type { Vector } from './vector';
3
- export { bezierControlPoints, bezierPath, centerXYInternalNode, distance, distanceBetweenPoints, isInside, isSamePoint, nodeToRect, stopPropagation, } from './xyflow';
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';
@@ -1,24 +1,81 @@
1
- export interface Vector {
2
- x: number;
3
- y: number;
1
+ export interface VectorValue {
2
+ readonly x: number;
3
+ readonly y: number;
4
4
  }
5
- export declare class VectorImpl implements Vector {
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: Vector): VectorImpl;
10
- static add(a: Vector, b: Vector): Vector;
11
- static sub(a: Vector, b: Vector): Vector;
12
- static mul(a: Vector, b: number): Vector;
13
- static dot(a: Vector, b: Vector): number;
14
- static cross(a: Vector, b: Vector): VectorImpl;
15
- static setLength(a: Vector, length: number): Vector;
16
- add(b: Vector): VectorImpl;
17
- sub(b: Vector): VectorImpl;
18
- mul(b: number): VectorImpl;
19
- dot(b: Vector): number;
20
- cross(b: Vector): VectorImpl;
21
- abs(): number;
22
- setLength(length: number): VectorImpl;
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): VectorImpl;
80
+ export declare function vector(source: VectorValue | Vector): Vector;
81
+ export declare function vector(x: number, y: number): Vector;
@@ -1,53 +1,120 @@
1
- class VectorImpl {
1
+ class Vector {
2
2
  constructor(x, y) {
3
3
  this.x = x;
4
4
  this.y = y;
5
5
  }
6
- static create(position) {
7
- return new VectorImpl(position.x, position.y);
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
- static sub(a, b) {
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
- static mul(a, b) {
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
- static cross(a, b) {
22
- return new VectorImpl(a.y * b.x - a.x * b.y, a.x * b.y - a.y * b.x);
23
- }
24
- static setLength(a, length) {
25
- return vector(a).setLength(length);
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 VectorImpl(this.x + b.x, this.y + b.y);
54
+ return new Vector(this.x + b.x, this.y + b.y);
29
55
  }
30
- sub(b) {
31
- return new VectorImpl(this.x - b.x, this.y - b.y);
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
- mul(b) {
34
- return new VectorImpl(this.x * b, this.y * b);
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 VectorImpl(this.y * b.x - this.x * b.y, this.x * b.y - this.y * b.x);
86
+ return new Vector(this.y * b.x - this.x * b.y, this.x * b.y - this.y * b.x);
41
87
  }
42
- abs() {
43
- return Math.sqrt(this.x * this.x + this.y * this.y);
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
- setLength(length) {
46
- return this.mul(length / this.abs());
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(source) {
50
- return VectorImpl.create(source);
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 { VectorImpl, vector };
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 };
@@ -1,8 +1,54 @@
1
- import { DiagramEdge, NonEmptyArray, Point, BBox } from '@likec4/core';
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
- export declare const nodeToRect: (nd: InternalNode) => Rect;
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(diagramEdge: Pick<DiagramEdge, 'points'>): XYPosition[];
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[];
@@ -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 { isArray, hasAtLeast } from 'remeda';
6
+ import { hasAtLeast, isNumber, isArray } from 'remeda';
7
+ import { vector } from './vector.js';
7
8
 
8
- function bezierControlPoints(diagramEdge) {
9
- let [start, ...bezierPoints] = diagramEdge.points;
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, centerXYInternalNode, isSamePoint, stopPropagation };
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.43.0",
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.5",
69
- "@mantine/hooks": "8.3.5",
68
+ "@mantine/core": "8.3.7",
69
+ "@mantine/hooks": "8.3.7",
70
70
  "@nanostores/react": "1.0.0",
71
- "@react-hookz/web": "^25.1.1",
72
- "@xstate/react": "^6.0.0",
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": "^5.23.0",
86
- "@likec4/core": "1.43.0",
87
- "@likec4/styles": "1.43.0"
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.1.16",
115
- "@types/react-dom": "19.1.9",
116
- "@vitejs/plugin-react": "^5.0.4",
117
- "oxlint": "1.24.0",
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.1.1",
120
- "react-dom": "19.1.1",
120
+ "react": "19.2.0",
121
+ "react-dom": "19.2.0",
121
122
  "typescript": "5.9.3",
122
- "vite": "^7.1.11",
123
+ "vite": "^7.2.2",
123
124
  "vite-plugin-dts": "^4.5.4",
124
- "vitest": "3.2.4",
125
+ "vitest": "4.0.8",
125
126
  "wireit": "0.14.12",
126
127
  "zx": "8.8.5",
127
- "@likec4/tsconfig": "1.43.0",
128
- "@likec4/devops": "1.42.0"
128
+ "@likec4/devops": "1.42.0",
129
+ "@likec4/tsconfig": "1.44.0"
129
130
  },
130
131
  "scripts": {
131
132
  "typecheck": "tsc --build --verbose",