@likec4/diagram 1.43.0 → 1.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (349) hide show
  1. package/bundle/index.js +14727 -13166
  2. package/dist/LikeC4Diagram.d.ts +1 -1
  3. package/dist/LikeC4Diagram.js +14 -9
  4. package/dist/LikeC4Diagram.props.d.ts +25 -15
  5. package/dist/LikeC4ProjectsProvider.js +1 -1
  6. package/dist/LikeC4Styles.js +0 -3
  7. package/dist/LikeC4View.d.ts +8 -3
  8. package/dist/LikeC4View.js +29 -14
  9. package/dist/ReactLikeC4.d.ts +2 -2
  10. package/dist/ReactLikeC4.js +2 -2
  11. package/dist/StaticLikeC4Diagram.js +1 -1
  12. package/dist/_virtual/_commonjsHelpers.js +3 -0
  13. package/dist/_virtual/assign-dea9f7c8.cjs.js +3 -0
  14. package/dist/_virtual/log-ec8d4df4.cjs.js +3 -0
  15. package/dist/_virtual/raise-da5b247f.cjs.js +3 -0
  16. package/dist/_virtual/xstate-actions.cjs.js +5 -0
  17. package/dist/_virtual/xstate-actions.cjs2.js +3 -0
  18. package/dist/_virtual/xstate-dev.cjs.js +3 -0
  19. package/dist/_virtual/xstate-guards.cjs.js +5 -0
  20. package/dist/_virtual/xstate-guards.cjs2.js +3 -0
  21. package/dist/base/Background.d.ts +2 -1
  22. package/dist/base/Background.js +11 -2
  23. package/dist/base/Base.d.ts +28 -0
  24. package/dist/base/BaseXYFlow.d.ts +5 -5
  25. package/dist/base/BaseXYFlow.js +38 -44
  26. package/dist/base/index.d.ts +6 -2
  27. package/dist/base/types.d.ts +1 -28
  28. package/dist/base/updateEdges.js +25 -14
  29. package/dist/base/updateNodes.d.ts +14 -0
  30. package/dist/base/updateNodes.js +51 -17
  31. package/dist/base-primitives/Markdown.d.ts +30 -4
  32. package/dist/base-primitives/Markdown.js +3 -2
  33. package/dist/base-primitives/compound/CompoundActionButton.d.ts +3 -2
  34. package/dist/base-primitives/compound/CompoundActionButton.js +1 -1
  35. package/dist/base-primitives/compound/CompoundDetailsButton.d.ts +3 -2
  36. package/dist/base-primitives/compound/CompoundDetailsButton.js +1 -1
  37. package/dist/base-primitives/edge/EdgeActionButton.d.ts +3 -2
  38. package/dist/base-primitives/edge/EdgeActionButton.js +1 -1
  39. package/dist/base-primitives/edge/EdgeContainer.d.ts +1 -1
  40. package/dist/base-primitives/edge/EdgeContainer.js +8 -1
  41. package/dist/base-primitives/edge/EdgeLabel.d.ts +3 -2
  42. package/dist/base-primitives/edge/EdgeLabel.js +2 -0
  43. package/dist/base-primitives/edge/EdgeLabelContainer.d.ts +1 -1
  44. package/dist/base-primitives/edge/EdgeLabelContainer.js +4 -0
  45. package/dist/base-primitives/edge/EdgePath.d.ts +4 -0
  46. package/dist/base-primitives/edge/EdgePath.js +29 -5
  47. package/dist/base-primitives/element/ElementActionButtons.d.ts +6 -4
  48. package/dist/base-primitives/element/ElementActionButtons.js +3 -3
  49. package/dist/base-primitives/element/ElementData.d.ts +3 -3
  50. package/dist/base-primitives/element/ElementData.js +13 -7
  51. package/dist/base-primitives/element/ElementDetailsButton.d.ts +3 -2
  52. package/dist/base-primitives/element/ElementDetailsButton.js +5 -5
  53. package/dist/base-primitives/element/ElementNodeContainer.css.js +15 -27
  54. package/dist/base-primitives/element/ElementShape.js +5 -5
  55. package/dist/base-primitives/element/ElementTags.d.ts +6 -4
  56. package/dist/base-primitives/element/ElementTags.js +2 -1
  57. package/dist/base-primitives/memoEdge.js +4 -2
  58. package/dist/base-primitives/memoNode.d.ts +1 -1
  59. package/dist/base-primitives/memoNode.js +3 -3
  60. package/dist/components/ErrorFallback.js +52 -35
  61. package/dist/components/Link.js +2 -2
  62. package/dist/context/DiagramEventHandlers.js +2 -1
  63. package/dist/context/DiagramFeatures.d.ts +25 -6
  64. package/dist/context/DiagramFeatures.js +28 -56
  65. package/dist/context/IconRenderer.js +6 -6
  66. package/dist/context/LikeC4ModelContext.js +3 -10
  67. package/dist/context/TagStylesContext.js +3 -19
  68. package/dist/context/index.d.ts +1 -1
  69. package/dist/custom/customNodes.js +3 -2
  70. package/dist/custom/hooks.d.ts +3 -3
  71. package/dist/custom/index.d.ts +1 -1
  72. package/dist/custom/index.js +5 -5
  73. package/dist/editor/LikeC4EditorContext.d.ts +21 -0
  74. package/dist/editor/index.d.ts +2 -0
  75. package/dist/hooks/index.d.ts +4 -2
  76. package/dist/hooks/safeContext.d.ts +6 -3
  77. package/dist/hooks/safeContext.js +10 -3
  78. package/dist/hooks/useCallbackRef.d.ts +1 -0
  79. package/dist/hooks/useCallbackRef.js +13 -0
  80. package/dist/hooks/useCurrentView.d.ts +11 -0
  81. package/dist/hooks/{useCurrentViewId.js → useCurrentView.js} +7 -3
  82. package/dist/hooks/useCurrentViewModel.js +4 -1
  83. package/dist/hooks/useDiagram.d.ts +7 -113
  84. package/dist/hooks/useDiagram.js +7 -127
  85. package/dist/hooks/useDiagramCompareLayout.d.ts +35 -0
  86. package/dist/hooks/useDiagramCompareLayout.js +65 -0
  87. package/dist/hooks/useLikeC4Project.d.ts +6 -1
  88. package/dist/hooks/useLikeC4Project.js +14 -2
  89. package/dist/hooks/useMediaPrint.d.ts +6 -0
  90. package/dist/hooks/useUpdateEffect.js +2 -4
  91. package/dist/hooks/useXYFlow.d.ts +1 -0
  92. package/dist/hooks/useXYFlow.js +4 -7
  93. package/dist/index.d.ts +2 -2
  94. package/dist/index.js +4 -3
  95. package/dist/likec4diagram/DiagramUI.js +14 -7
  96. package/dist/likec4diagram/DiagramXYFlow.d.ts +2 -2
  97. package/dist/likec4diagram/DiagramXYFlow.js +60 -52
  98. package/dist/likec4diagram/convert-to-xyflow.d.ts +0 -1
  99. package/dist/likec4diagram/custom/edges/EdgeDrifts.d.ts +6 -0
  100. package/dist/likec4diagram/custom/edges/EdgeDrifts.js +38 -0
  101. package/dist/likec4diagram/custom/edges/RelationshipEdge.js +256 -217
  102. package/dist/likec4diagram/custom/edges/SequenceStepEdge.js +9 -2
  103. package/dist/likec4diagram/custom/edges/edges.css.js +3 -4
  104. package/dist/likec4diagram/custom/edges/useControlPoints.d.ts +8 -0
  105. package/dist/likec4diagram/custom/edges/useControlPoints.js +58 -0
  106. package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.d.ts +7 -0
  107. package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.js +60 -0
  108. package/dist/likec4diagram/custom/edges/utils.d.ts +0 -12
  109. package/dist/likec4diagram/custom/nodes/CompoundActions.js +4 -1
  110. package/dist/likec4diagram/custom/nodes/ElementActions.d.ts +2 -1
  111. package/dist/likec4diagram/custom/nodes/ElementActions.js +15 -10
  112. package/dist/likec4diagram/custom/nodes/NodeDrifts.d.ts +6 -0
  113. package/dist/likec4diagram/custom/nodes/NodeDrifts.js +50 -0
  114. package/dist/likec4diagram/custom/nodes/SequenceActorNode.js +7 -2
  115. package/dist/likec4diagram/custom/nodes/index.d.ts +1 -0
  116. package/dist/likec4diagram/custom/nodes/nodes.d.ts +9 -1
  117. package/dist/likec4diagram/custom/nodes/nodes.js +74 -29
  118. package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.d.ts +1 -1
  119. package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +1 -1
  120. package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +2 -1
  121. package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.js +4 -3
  122. package/dist/likec4diagram/custom/nodes/toolbar/_shared.d.ts +1 -11
  123. package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +7 -51
  124. package/dist/likec4diagram/custom/nodes/toolbar/types.d.ts +5 -0
  125. package/dist/likec4diagram/custom/nodes/toolbar/types.js +7 -0
  126. package/dist/likec4diagram/custom/nodes/toolbar/useHandlers.d.ts +8 -0
  127. package/dist/likec4diagram/custom/nodes/toolbar/useHandlers.js +44 -0
  128. package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +8 -10
  129. package/dist/likec4diagram/relationship-popover/actor.d.ts +1 -1
  130. package/dist/likec4diagram/state/DiagramActorProvider.d.ts +4 -3
  131. package/dist/likec4diagram/state/DiagramActorProvider.js +95 -70
  132. package/dist/likec4diagram/state/assign.d.ts +13 -7
  133. package/dist/likec4diagram/state/assign.js +43 -282
  134. package/dist/likec4diagram/state/createViewChange.d.ts +3 -0
  135. package/dist/likec4diagram/state/createViewChange.js +79 -0
  136. package/dist/likec4diagram/state/diagram-api.d.ts +109 -0
  137. package/dist/likec4diagram/state/diagram-api.js +126 -0
  138. package/dist/likec4diagram/state/machine.actions.d.ts +1783 -0
  139. package/dist/likec4diagram/state/machine.actions.js +644 -0
  140. package/dist/likec4diagram/state/machine.actions.layout.d.ts +579 -0
  141. package/dist/likec4diagram/state/machine.actions.layout.js +129 -0
  142. package/dist/likec4diagram/state/machine.d.ts +22 -0
  143. package/dist/likec4diagram/state/machine.js +127 -0
  144. package/dist/likec4diagram/state/machine.setup.d.ts +327 -0
  145. package/dist/likec4diagram/state/machine.setup.js +93 -0
  146. package/dist/likec4diagram/state/machine.state.initializing.d.ts +208 -0
  147. package/dist/likec4diagram/state/machine.state.initializing.js +55 -0
  148. package/dist/likec4diagram/state/machine.state.navigating.d.ts +14 -0
  149. package/dist/likec4diagram/state/machine.state.navigating.js +178 -0
  150. package/dist/likec4diagram/state/machine.state.ready.d.ts +3131 -0
  151. package/dist/likec4diagram/state/machine.state.ready.focused.d.ts +386 -0
  152. package/dist/likec4diagram/state/machine.state.ready.focused.js +85 -0
  153. package/dist/likec4diagram/state/machine.state.ready.idle.d.ts +474 -0
  154. package/dist/likec4diagram/state/machine.state.ready.idle.js +96 -0
  155. package/dist/likec4diagram/state/machine.state.ready.js +262 -0
  156. package/dist/likec4diagram/state/machine.state.ready.printing.d.ts +128 -0
  157. package/dist/likec4diagram/state/machine.state.ready.printing.js +40 -0
  158. package/dist/likec4diagram/state/machine.state.ready.walkthrough.d.ts +511 -0
  159. package/dist/likec4diagram/state/machine.state.ready.walkthrough.js +177 -0
  160. package/dist/likec4diagram/state/mediaPrintActor.d.ts +12 -0
  161. package/dist/likec4diagram/state/mediaPrintActor.js +18 -0
  162. package/dist/likec4diagram/state/syncManualLayoutActor.d.ts +31 -108
  163. package/dist/likec4diagram/state/syncManualLayoutActor.js +278 -142
  164. package/dist/likec4diagram/state/types.d.ts +7 -12
  165. package/dist/likec4diagram/state/utils.d.ts +19 -4
  166. package/dist/likec4diagram/state/utils.js +47 -4
  167. package/dist/likec4diagram/types.d.ts +8 -8
  168. package/dist/likec4diagram/ui/LayoutDriftFrame.d.ts +2 -0
  169. package/dist/likec4diagram/ui/LayoutDriftFrame.js +66 -0
  170. package/dist/likec4diagram/ui/index.d.ts +1 -0
  171. package/dist/likec4diagram/ui/notation/NotationPanel.css.js +5 -2
  172. package/dist/likec4diagram/ui/notation/NotationPanel.js +5 -4
  173. package/dist/likec4diagram/useLayoutConstraints.d.ts +10 -5
  174. package/dist/likec4diagram/useLayoutConstraints.js +237 -61
  175. package/dist/likec4diagram/xyflow-diagram/diagram-view.d.ts +0 -1
  176. package/dist/likec4diagram/xyflow-diagram/diagram-view.js +14 -17
  177. package/dist/likec4diagram/xyflow-sequence/sequence-layout.js +11 -8
  178. package/dist/navigationpanel/NavigationPanel.js +16 -8
  179. package/dist/navigationpanel/NavigationPanelControls.d.ts +2 -1
  180. package/dist/navigationpanel/NavigationPanelControls.js +23 -17
  181. package/dist/navigationpanel/NavigationPanelDropdown.d.ts +2 -1
  182. package/dist/navigationpanel/NavigationPanelDropdown.js +62 -42
  183. package/dist/navigationpanel/_common.d.ts +1 -1
  184. package/dist/navigationpanel/_common.js +4 -2
  185. package/dist/navigationpanel/actor.d.ts +9 -205
  186. package/dist/navigationpanel/actor.js +6 -5
  187. package/dist/navigationpanel/comparepanel/CompareActionsMenu.d.ts +3 -0
  188. package/dist/navigationpanel/comparepanel/CompareActionsMenu.js +59 -0
  189. package/dist/navigationpanel/comparepanel/ComparePanel.d.ts +2 -0
  190. package/dist/navigationpanel/comparepanel/ComparePanel.js +42 -0
  191. package/dist/navigationpanel/comparepanel/ComparePanelControls.d.ts +1 -0
  192. package/dist/navigationpanel/comparepanel/ComparePanelControls.js +60 -0
  193. package/dist/navigationpanel/comparepanel/LayoutTypeSwitcher.d.ts +5 -0
  194. package/dist/navigationpanel/comparepanel/LayoutTypeSwitcher.js +38 -0
  195. package/dist/navigationpanel/comparepanel/index.d.ts +1 -0
  196. package/dist/navigationpanel/controls/{ViewDetailsCard.d.ts → DetailsControls.d.ts} +1 -1
  197. package/dist/navigationpanel/controls/{ViewDetailsCard.js → DetailsControls.js} +18 -14
  198. package/dist/navigationpanel/controls/LayoutWarning.d.ts +2 -0
  199. package/dist/navigationpanel/controls/LayoutWarning.js +102 -0
  200. package/dist/navigationpanel/controls/NavigationButtons.js +4 -3
  201. package/dist/navigationpanel/controls/OpenSource.js +2 -2
  202. package/dist/navigationpanel/controls/SearchControl.d.ts +2 -1
  203. package/dist/navigationpanel/controls/SearchControl.js +15 -17
  204. package/dist/navigationpanel/controls/ToggleReadonly.d.ts +1 -1
  205. package/dist/navigationpanel/controls/ToggleReadonly.js +26 -18
  206. package/dist/navigationpanel/controls/index.d.ts +2 -1
  207. package/dist/navigationpanel/dropdown/ProjectsMenu.d.ts +2 -2
  208. package/dist/navigationpanel/dropdown/ProjectsMenu.js +5 -5
  209. package/dist/navigationpanel/editorpanel/CenterCamera.js +5 -2
  210. package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.d.ts +1 -1
  211. package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.js +21 -20
  212. package/dist/navigationpanel/editorpanel/EditorPanel.js +3 -3
  213. package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.d.ts +2 -2
  214. package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.js +16 -13
  215. package/dist/navigationpanel/editorpanel/ToggleReadonly.d.ts +1 -0
  216. package/dist/navigationpanel/editorpanel/ToggleReadonly.js +15 -0
  217. package/dist/navigationpanel/styles.css.d.ts +2 -2
  218. package/dist/navigationpanel/styles.css.js +4 -4
  219. package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +14 -8
  220. package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +66 -66
  221. package/dist/navigationpanel/walkthrough/DynamicViewControls.js +31 -14
  222. package/dist/navigationpanel/walkthrough/WalkthroughPanel.d.ts +2 -1
  223. package/dist/navigationpanel/walkthrough/WalkthroughPanel.js +68 -50
  224. package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/actions/dist/xstate-actions.cjs.js +37 -0
  225. package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dev/dist/xstate-dev.cjs.js +59 -0
  226. package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dist/assign-dea9f7c8.cjs.js +140 -0
  227. package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dist/log-ec8d4df4.cjs.js +401 -0
  228. package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dist/raise-da5b247f.cjs.js +2716 -0
  229. package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/guards/dist/xstate-guards.cjs.js +26 -0
  230. package/dist/overlays/element-details/ElementDetails.js +7 -7
  231. package/dist/overlays/element-details/ElementDetailsCard.css.js +3 -3
  232. package/dist/overlays/element-details/ElementDetailsCard.js +7 -5
  233. package/dist/overlays/element-details/MetadataValue.d.ts +2 -1
  234. package/dist/overlays/element-details/MetadataValue.js +2 -2
  235. package/dist/overlays/element-details/TabPanelDeployments.js +6 -4
  236. package/dist/overlays/element-details/TabPanelRelationships.js +3 -3
  237. package/dist/overlays/element-details/TabPanelStructure.js +1 -1
  238. package/dist/overlays/element-details/actor.d.ts +8 -82
  239. package/dist/overlays/element-details/actor.js +0 -8
  240. package/dist/overlays/overlay/Overlay.js +10 -10
  241. package/dist/overlays/overlaysActor.d.ts +7 -150
  242. package/dist/overlays/overlaysActor.js +183 -161
  243. package/dist/overlays/relationship-details/RelationshipDetails.js +4 -3
  244. package/dist/overlays/relationship-details/SelectEdge.js +2 -2
  245. package/dist/overlays/relationship-details/_types.d.ts +3 -4
  246. package/dist/overlays/relationship-details/actor.d.ts +6 -550
  247. package/dist/overlays/relationship-details/actor.js +18 -3
  248. package/dist/overlays/relationship-details/custom/ElementActions.js +8 -5
  249. package/dist/overlays/relationship-details/custom/edgeTypes.js +4 -1
  250. package/dist/overlays/relationship-details/custom/nodeTypes.js +4 -1
  251. package/dist/overlays/relationship-details/hooks.js +1 -1
  252. package/dist/overlays/relationship-details/layout-to-xyflow.js +3 -5
  253. package/dist/overlays/relationship-details/layout.d.ts +3 -3
  254. package/dist/overlays/relationship-details/layout.js +4 -4
  255. package/dist/overlays/relationships-browser/RelationshipsBrowser.js +6 -4
  256. package/dist/overlays/relationships-browser/SelectElement.js +2 -2
  257. package/dist/overlays/relationships-browser/_types.d.ts +2 -3
  258. package/dist/overlays/relationships-browser/actor.d.ts +7 -673
  259. package/dist/overlays/relationships-browser/actor.js +132 -110
  260. package/dist/overlays/relationships-browser/custom/ElementActions.js +44 -37
  261. package/dist/overlays/relationships-browser/custom/edgeTypes.js +4 -1
  262. package/dist/overlays/relationships-browser/custom/nodeTypes.js +4 -1
  263. package/dist/overlays/relationships-browser/hooks.js +7 -6
  264. package/dist/overlays/relationships-browser/layout.d.ts +2 -2
  265. package/dist/overlays/relationships-browser/layout.js +3 -3
  266. package/dist/overlays/relationships-browser/useViewToNodesEdges.js +0 -3
  267. package/dist/overlays/types.d.ts +12 -13
  268. package/dist/search/Search.js +2 -1
  269. package/dist/search/components/ElementsColumn.js +5 -3
  270. package/dist/search/components/PickView.js +1 -1
  271. package/dist/search/components/SearchByTags.js +21 -44
  272. package/dist/search/components/SearchInput.js +1 -1
  273. package/dist/search/components/ViewsColum.js +6 -4
  274. package/dist/search/components/_shared.css.d.ts +1 -1
  275. package/dist/search/searchActor.d.ts +3 -66
  276. package/dist/shadowroot/ShadowRoot.d.ts +5 -7
  277. package/dist/shadowroot/ShadowRoot.js +8 -6
  278. package/dist/styles.css2.js +1 -1
  279. package/dist/utils/index.d.ts +4 -4
  280. package/dist/utils/vector.d.ts +83 -21
  281. package/dist/utils/vector.js +98 -24
  282. package/dist/utils/view-bounds.d.ts +8 -0
  283. package/dist/utils/view-bounds.js +58 -0
  284. package/dist/utils/xyflow.d.ts +52 -8
  285. package/dist/utils/xyflow.js +31 -11
  286. package/package.json +26 -24
  287. package/panda.buildinfo.json +124 -71
  288. package/styles-min.css +1 -1
  289. package/styles.css +1 -1
  290. package/dist/hooks/useCurrentViewId.d.ts +0 -6
  291. package/dist/likec4diagram/custom/edges/utils.js +0 -23
  292. package/dist/likec4diagram/state/diagram-machine.d.ts +0 -2590
  293. package/dist/likec4diagram/state/diagram-machine.js +0 -1180
  294. package/dist/navigationpanel/editorpanel/LayoutDriftNotification.d.ts +0 -1
  295. package/dist/navigationpanel/editorpanel/LayoutDriftNotification.js +0 -56
  296. package/dist/utils/get-view-bounds.d.ts +0 -3
  297. package/dist/utils/get-view-bounds.js +0 -14
  298. /package/dist/base/{types.js → Base.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/createReactComponent.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/defaultAttributes.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/IconAlertTriangle.js +0 -0
  302. /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
  303. /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
  304. /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
  305. /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
  306. /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
  307. /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
  308. /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
  309. /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
  310. /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
  311. /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
  312. /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
  313. /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
  314. /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
  315. /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
  316. /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
  317. /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
  318. /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
  319. /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
  320. /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
  321. /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
  322. /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
  323. /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
  324. /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
  325. /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
  326. /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
  327. /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
  328. /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
  329. /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
  330. /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
  331. /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
  332. /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
  333. /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
  334. /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
  335. /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
  336. /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
  337. /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
  338. /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
  339. /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
  340. /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
  341. /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
  342. /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
  343. /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
  344. /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
  345. /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
  346. /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
  347. /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
  348. /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
  349. /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,86 @@
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;
79
+ /**
80
+ * Rounds the components of the vector to the nearest integers.
81
+ * @returns A new vector with rounded components.
82
+ */
83
+ round(): Vector;
23
84
  }
24
- export declare function vector(source: Vector): VectorImpl;
85
+ export declare function vector(source: VectorValue | Vector): Vector;
86
+ export declare function vector(x: number, y: number): Vector;
@@ -1,53 +1,127 @@
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);
87
+ }
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);
41
97
  }
42
- abs() {
43
- return Math.sqrt(this.x * this.x + this.y * this.y);
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);
44
108
  }
45
- setLength(length) {
46
- return this.mul(length / this.abs());
109
+ /**
110
+ * Rounds the components of the vector to the nearest integers.
111
+ * @returns A new vector with rounded components.
112
+ */
113
+ round() {
114
+ return new Vector(Math.round(this.x), Math.round(this.y));
47
115
  }
48
116
  }
49
- function vector(source) {
50
- return VectorImpl.create(source);
117
+ function vector(...args) {
118
+ if (args.length === 1 && args[0] instanceof Vector) {
119
+ return args[0];
120
+ }
121
+ if (args.length === 2) {
122
+ return new Vector(args[0], args[1]);
123
+ }
124
+ return new Vector(args[0].x, args[0].y);
51
125
  }
52
126
 
53
- export { VectorImpl, vector };
127
+ 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,58 @@
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
+ if (controlPoints) {
21
+ for (const p of controlPoints) {
22
+ minX = Math.min(minX, p.x);
23
+ minY = Math.min(minY, p.y);
24
+ maxX = Math.max(maxX, p.x);
25
+ maxY = Math.max(maxY, p.y);
26
+ }
27
+ } else {
28
+ for (const [x, y] of points) {
29
+ minX = Math.min(minX, x);
30
+ minY = Math.min(minY, y);
31
+ maxX = Math.max(maxX, x);
32
+ maxY = Math.max(maxY, y);
33
+ }
34
+ }
35
+ if (labelBBox) {
36
+ minX = Math.min(minX, labelBBox.x);
37
+ minY = Math.min(minY, labelBBox.y);
38
+ maxX = Math.max(maxX, labelBBox.x + labelBBox.width);
39
+ maxY = Math.max(maxY, labelBBox.y + labelBBox.height);
40
+ }
41
+ return {
42
+ x: minX,
43
+ y: minY,
44
+ width: maxX - minX,
45
+ height: maxY - minY
46
+ };
47
+ }
48
+ function calcViewBounds({ nodes, edges }) {
49
+ return BBox.expand(
50
+ BBox.merge(
51
+ ...nodes,
52
+ ...edges.map(calcEdgeBounds)
53
+ ),
54
+ 10
55
+ );
56
+ }
57
+
58
+ export { calcEdgeBounds, calcViewBounds, pickViewBounds };
@@ -1,8 +1,56 @@
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 { MouseEvent as ReactMouseEvent } from 'react';
5
+ import { Vector } from './vector';
4
6
  export declare function distance(a: XYPosition, b: XYPosition): number;
5
- export declare const nodeToRect: (nd: InternalNode) => Rect;
7
+ /**
8
+ * Minimal type to access only needed properties of InternalNode
9
+ */
10
+ export type MinimalInternalNode = {
11
+ internals: {
12
+ positionAbsolute: XYPosition;
13
+ };
14
+ measured?: {
15
+ width?: number;
16
+ height?: number;
17
+ };
18
+ width?: number;
19
+ height?: number;
20
+ initialWidth?: number;
21
+ initialHeight?: number;
22
+ };
23
+ /**
24
+ * Extracts only the minimal properties from an InternalNode
25
+ * needed for geometric calculations.
26
+ *
27
+ * @param nd - The InternalNode to extract from.
28
+ * @returns An object containing only the necessary properties.
29
+ */
30
+ export declare function extractMinimalInternalNode<N extends InternalNode>(nd: N): MinimalInternalNode;
31
+ export declare function isEqualMinimalInternalNodes(a: MinimalInternalNode, b: MinimalInternalNode): boolean;
32
+ export declare function isEqualRects(a: Rect, b: Rect): boolean;
33
+ export declare const nodeToRect: (nd: MinimalInternalNode) => Rect;
34
+ export declare function getNodeCenter(node: MinimalInternalNode): XYPosition;
35
+ /**
36
+ * Helper function returns the intersection point
37
+ * of the line between the center of the intersectionNode and the target
38
+ *
39
+ * @param intersectionNode the node that is the center of the line
40
+ * @param target position of the target
41
+ * @param nodeMargin the margin of the intersectionNode. The point will be placed at nodeMargin distance from the border of the node
42
+ * @returns coordinates of the intersection point
43
+ */
44
+ export declare function getNodeIntersectionFromCenterToPoint(intersectionNode: BBox, target: XYPosition, nodeMargin?: number): Vector;
45
+ /**
46
+ * Helper function returns the intersection point
47
+ * of the line between the center of the intersectionNode and the target
48
+ *
49
+ * @param intersectionNode the node that is the center of the line
50
+ * @param targetNode the target node
51
+ * @returns coordinates of the intersection point
52
+ */
53
+ export declare function getNodeIntersection(intersectionNode: MinimalInternalNode, targetNode: MinimalInternalNode): XYPosition;
6
54
  /**
7
55
  * Checks if a rectangle is completely inside another rectangle.
8
56
  *
@@ -11,14 +59,10 @@ export declare const nodeToRect: (nd: InternalNode) => Rect;
11
59
  * @returns `true` if the `test` rectangle is completely inside the `target` rectangle, otherwise `false`.
12
60
  */
13
61
  export declare const isInside: (test: Rect, target: Rect) => boolean;
14
- export declare function bezierControlPoints(diagramEdge: Pick<DiagramEdge, 'points'>): XYPosition[];
62
+ export declare function bezierControlPoints(points: NonEmptyArray<Point>): XYPosition[];
15
63
  export declare function isSamePoint(a: XYPosition | Point, b: XYPosition | Point): boolean;
16
64
  export declare function distanceBetweenPoints(a: XYPosition, b: XYPosition): number;
17
- 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
- };
65
+ export declare function stopPropagation(e: ReactMouseEvent): void;
22
66
  export declare function bezierPath(bezierSpline: NonEmptyArray<Point>): string;
23
67
  export declare function toXYFlowPosition(position: 'left' | 'right' | 'top' | 'bottom'): Position;
24
68
  export declare function createXYFlowNodeNandles(bbox: BBox): NodeHandle[];
@@ -1,12 +1,39 @@
1
- import '@likec4/core';
1
+ import { BBox } from '@likec4/core';
2
2
  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
6
  import { isArray, hasAtLeast } from 'remeda';
7
+ import { vector } from './vector.js';
7
8
 
8
- function bezierControlPoints(diagramEdge) {
9
- let [start, ...bezierPoints] = diagramEdge.points;
9
+ function isEqualRects(a, b) {
10
+ return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
11
+ }
12
+ const nodeToRect = (nd) => ({
13
+ x: Math.round(nd.internals.positionAbsolute.x),
14
+ y: Math.round(nd.internals.positionAbsolute.y),
15
+ width: nd.measured?.width ?? nd.width ?? nd.initialWidth ?? 0,
16
+ height: nd.measured?.height ?? nd.height ?? nd.initialHeight ?? 0
17
+ });
18
+ function getNodeCenter(node) {
19
+ const { width, height } = getNodeDimensions(node);
20
+ const { x, y } = node.internals.positionAbsolute;
21
+ return {
22
+ x: Math.round(x + width / 2),
23
+ y: Math.round(y + height / 2)
24
+ };
25
+ }
26
+ function getNodeIntersectionFromCenterToPoint(intersectionNode, target, nodeMargin = 0) {
27
+ const { width, height } = intersectionNode;
28
+ const nodeCenter = BBox.center(intersectionNode);
29
+ const v = vector(target.x, target.y).subtract(nodeCenter);
30
+ const xScale = (nodeMargin + width / 2) / v.x;
31
+ const yScale = (nodeMargin + height / 2) / v.y;
32
+ const scale = Math.min(Math.abs(xScale), Math.abs(yScale));
33
+ return vector(v).multiply(scale).add(nodeCenter).round();
34
+ }
35
+ function bezierControlPoints(points) {
36
+ let [start, ...bezierPoints] = points;
10
37
  invariant(start, "start should be defined");
11
38
  const handles = [
12
39
  // start
@@ -42,13 +69,6 @@ function isSamePoint(a, b) {
42
69
  function stopPropagation(e) {
43
70
  return e.stopPropagation();
44
71
  }
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
72
  function bezierPath(bezierSpline) {
53
73
  let [start, ...points] = bezierSpline;
54
74
  invariant(start, "start should be defined");
@@ -62,4 +82,4 @@ function bezierPath(bezierSpline) {
62
82
  return path;
63
83
  }
64
84
 
65
- export { bezierControlPoints, bezierPath, centerXYInternalNode, isSamePoint, stopPropagation };
85
+ export { bezierControlPoints, bezierPath, getNodeCenter, getNodeIntersectionFromCenterToPoint, isEqualRects, isSamePoint, nodeToRect, stopPropagation };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@likec4/diagram",
3
- "version": "1.43.0",
3
+ "version": "1.45.0",
4
4
  "license": "MIT",
5
5
  "bugs": "https://github.com/likec4/likec4/issues",
6
6
  "homepage": "https://likec4.dev",
@@ -65,29 +65,31 @@
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.9",
69
+ "@mantine/hooks": "8.3.9",
70
70
  "@nanostores/react": "1.0.0",
71
- "@react-hookz/web": "^25.1.1",
72
- "@xstate/react": "^6.0.0",
73
- "@xyflow/react": "12.9.0",
74
- "@xyflow/system": "0.0.71",
71
+ "@nanostores/media-query": "0.1.2",
72
+ "@react-hookz/web": "^25.2.0",
73
+ "@xstate/react": "6.0.0",
74
+ "@xyflow/react": "12.9.3",
75
+ "@xyflow/system": "0.0.73",
76
+ "immer": "^10.2.0",
75
77
  "bezier-js": "^6.1.4",
76
78
  "d3-shape": "^3.2.0",
77
- "fast-equals": "^5.3.2",
79
+ "fast-equals": "^5.3.3",
78
80
  "khroma": "2.1.0",
79
81
  "motion": "^12.23.24",
80
- "nanostores": "1.0.1",
82
+ "nanostores": "1.1.0",
81
83
  "react-error-boundary": "^6.0.0",
82
84
  "react-shadow": "^20.6.0",
83
85
  "remeda": "^2.32.0",
84
86
  "type-fest": "^4.41.0",
85
- "xstate": "^5.23.0",
86
- "@likec4/core": "1.43.0",
87
- "@likec4/styles": "1.43.0"
87
+ "xstate": "5.24.0",
88
+ "@likec4/core": "1.45.0",
89
+ "@likec4/styles": "1.45.0"
88
90
  },
89
91
  "peerDependencies": {
90
- "@pandacss/dev": "^1.4.3",
92
+ "@pandacss/dev": "^1.5.1",
91
93
  "@types/react": "^18.x || ^19.x",
92
94
  "@types/react-dom": "^18.x || ^19.x",
93
95
  "react": "^18.x || ^19.x",
@@ -105,27 +107,27 @@
105
107
  }
106
108
  },
107
109
  "devDependencies": {
108
- "@pandacss/dev": "^1.4.3",
110
+ "@pandacss/dev": "^1.5.1",
109
111
  "@statelyai/inspect": "^0.4.0",
110
112
  "@tabler/icons-react": "3.35.0",
111
113
  "@types/bezier-js": "^4.1.3",
112
114
  "@types/d3-shape": "^3.1.7",
113
115
  "@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",
116
+ "@types/react": "19.2.6",
117
+ "@types/react-dom": "19.2.3",
118
+ "@vitejs/plugin-react": "^5.1.1",
119
+ "oxlint": "1.29.0",
118
120
  "postcss": "8.5.6",
119
- "react": "19.1.1",
120
- "react-dom": "19.1.1",
121
+ "react": "19.2.0",
122
+ "react-dom": "19.2.0",
121
123
  "typescript": "5.9.3",
122
- "vite": "^7.1.11",
124
+ "vite": "^7.2.4",
123
125
  "vite-plugin-dts": "^4.5.4",
124
- "vitest": "3.2.4",
126
+ "vitest": "4.0.13",
125
127
  "wireit": "0.14.12",
126
128
  "zx": "8.8.5",
127
- "@likec4/tsconfig": "1.43.0",
128
- "@likec4/devops": "1.42.0"
129
+ "@likec4/devops": "1.42.0",
130
+ "@likec4/tsconfig": "1.45.0"
129
131
  },
130
132
  "scripts": {
131
133
  "typecheck": "tsc --build --verbose",