@likec4/diagram 1.47.0 → 1.48.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 (303) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -1
  3. package/bundle/index.js +5489 -4909
  4. package/dist/LikeC4Diagram.js +18 -12
  5. package/dist/LikeC4Diagram.props.d.ts +1 -5
  6. package/dist/LikeC4ProjectsProvider.js +7 -5
  7. package/dist/LikeC4Styles.d.ts +2 -6
  8. package/dist/LikeC4Styles.js +44 -43
  9. package/dist/LikeC4View.d.ts +9 -1
  10. package/dist/LikeC4View.js +10 -8
  11. package/dist/ReactLikeC4.d.ts +12 -2
  12. package/dist/ReactLikeC4.js +5 -3
  13. package/dist/adhoc-editor/ActorProvider.d.ts +7 -0
  14. package/dist/adhoc-editor/ActorProvider.js +41 -0
  15. package/dist/adhoc-editor/EditorNavigationPanel.d.ts +1 -0
  16. package/dist/adhoc-editor/EditorNavigationPanel.js +32 -0
  17. package/dist/adhoc-editor/LikeC4AdHocViewEditor.d.ts +4 -0
  18. package/dist/adhoc-editor/LikeC4AdHocViewEditor.js +71 -0
  19. package/dist/adhoc-editor/SelectElementOverlay.d.ts +1 -0
  20. package/dist/adhoc-editor/SelectElementOverlay.js +124 -0
  21. package/dist/adhoc-editor/actor.d.ts +131 -0
  22. package/dist/adhoc-editor/actor.editor.d.ts +54 -0
  23. package/dist/adhoc-editor/actor.editor.js +96 -0
  24. package/dist/adhoc-editor/actor.js +20 -0
  25. package/dist/adhoc-editor/actor.layouter.d.ts +48 -0
  26. package/dist/adhoc-editor/actor.layouter.js +66 -0
  27. package/dist/adhoc-editor/actor.types.d.ts +57 -0
  28. package/dist/adhoc-editor/actor.types.js +22 -0
  29. package/dist/adhoc-editor/hooks.d.ts +14 -0
  30. package/dist/adhoc-editor/hooks.js +47 -0
  31. package/dist/adhoc-editor/index.d.ts +2 -0
  32. package/dist/adhoc-editor/viewrules/ViewRulesPanel.d.ts +6 -0
  33. package/dist/adhoc-editor/viewrules/ViewRulesPanel.js +104 -0
  34. package/dist/base/const.d.ts +1 -0
  35. package/dist/base/const.js +2 -1
  36. package/dist/base/updateEdges.js +26 -3
  37. package/dist/base/updateNodes.js +8 -5
  38. package/dist/base-primitives/Markdown.d.ts +1 -1
  39. package/dist/base-primitives/Markdown.js +1 -1
  40. package/dist/base-primitives/NodeHandles.d.ts +4 -2
  41. package/dist/base-primitives/NodeHandles.js +46 -19
  42. package/dist/base-primitives/compound/CompoundActionButton.js +3 -1
  43. package/dist/base-primitives/compound/CompoundDetailsButton.js +3 -1
  44. package/dist/base-primitives/compound/CompoundNodeContainer.js +6 -4
  45. package/dist/base-primitives/compound/CompoundTitle.js +1 -2
  46. package/dist/base-primitives/compound/actionbtns.css.d.ts +1 -1
  47. package/dist/base-primitives/edge/EdgeActionButton.js +1 -1
  48. package/dist/base-primitives/edge/EdgeContainer.js +5 -2
  49. package/dist/base-primitives/edge/EdgeLabelContainer.js +5 -1
  50. package/dist/base-primitives/element/ElementActionButtons.js +31 -58
  51. package/dist/base-primitives/element/ElementData.d.ts +7 -7
  52. package/dist/base-primitives/element/ElementData.js +61 -48
  53. package/dist/base-primitives/element/ElementDetailsButton.js +2 -1
  54. package/dist/base-primitives/element/ElementNodeContainer.d.ts +2 -2
  55. package/dist/base-primitives/element/ElementNodeContainer.js +1 -0
  56. package/dist/base-primitives/element/ElementTags.d.ts +6 -2
  57. package/dist/base-primitives/element/ElementTags.js +55 -32
  58. package/dist/base-primitives/index.d.ts +1 -1
  59. package/dist/base-primitives/memoEdge.js +1 -1
  60. package/dist/base-primitives/memoNode.js +1 -1
  61. package/dist/components/ErrorFallback.js +1 -1
  62. package/dist/components/Link.js +2 -2
  63. package/dist/components/Logo.js +1 -1
  64. package/dist/components/NavigationPanel.d.ts +2 -2
  65. package/dist/components/NavigationPanel.js +9 -28
  66. package/dist/components/RootContainer.js +5 -8
  67. package/dist/context/DefaultMantineProvider.d.ts +2 -0
  68. package/dist/context/DefaultMantineProvider.js +66 -0
  69. package/dist/context/DiagramFeatures.js +12 -11
  70. package/dist/context/EnsureMantine.d.ts +0 -3
  71. package/dist/context/EnsureMantine.js +3 -4
  72. package/dist/context/IconRenderer.d.ts +14 -0
  73. package/dist/context/IconRenderer.js +8 -8
  74. package/dist/context/TagStylesContext.js +12 -4
  75. package/dist/custom/hooks.d.ts +2 -2
  76. package/dist/custom/index.d.ts +1 -1
  77. package/dist/custom/index.js +2 -2
  78. package/dist/editor/LikeC4EditorCallbacks.d.ts +18 -0
  79. package/dist/editor/LikeC4EditorCallbacks.js +5 -0
  80. package/dist/editor/LikeC4EditorProvider.d.ts +30 -18
  81. package/dist/editor/LikeC4EditorProvider.js +2 -2
  82. package/dist/editor/applyChangesToManualLayout.js +1 -0
  83. package/dist/editor/editorActor.actions.d.ts +25 -25
  84. package/dist/editor/editorActor.actions.js +2 -2
  85. package/dist/editor/editorActor.setup.d.ts +84 -0
  86. package/dist/editor/editorActor.setup.js +38 -0
  87. package/dist/editor/editorActor.states.d.ts +9 -0
  88. package/dist/editor/{editorActor.js → editorActor.states.js} +22 -64
  89. package/dist/editor/index.d.ts +4 -3
  90. package/dist/editor/useEditorActorLogic.d.ts +2 -564
  91. package/dist/editor/useEditorActorLogic.js +8 -12
  92. package/dist/hooks/index.d.ts +1 -1
  93. package/dist/hooks/useCallbackRef.d.ts +6 -0
  94. package/dist/hooks/useCurrentViewModel.d.ts +10 -0
  95. package/dist/hooks/useDiagram.js +2 -2
  96. package/dist/hooks/useDiagramCompareLayout.d.ts +1 -1
  97. package/dist/hooks/useDiagramCompareLayout.js +1 -1
  98. package/dist/hooks/useLikeC4ElementsTree.js +1 -1
  99. package/dist/hooks/useLikeC4Model.js +2 -2
  100. package/dist/hooks/useSetState.d.ts +6 -1
  101. package/dist/hooks/useSetState.js +7 -4
  102. package/dist/hooks/useXYFlow.d.ts +7 -1
  103. package/dist/hooks/useXYFlow.js +4 -4
  104. package/dist/index.d.ts +7 -4
  105. package/dist/index.js +4 -2
  106. package/dist/likec4diagram/DiagramUI.js +1 -3
  107. package/dist/likec4diagram/DiagramXYFlow.js +25 -12
  108. package/dist/likec4diagram/convert-to-xyflow.d.ts +2 -1
  109. package/dist/likec4diagram/convert-to-xyflow.js +2 -6
  110. package/dist/likec4diagram/custom/edges/RelationshipEdge.js +13 -14
  111. package/dist/likec4diagram/custom/edges/useControlPoints.js +3 -3
  112. package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.d.ts +3 -0
  113. package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.js +68 -35
  114. package/dist/likec4diagram/custom/nodes/ElementActions.d.ts +1 -2
  115. package/dist/likec4diagram/custom/nodes/ElementActions.js +7 -10
  116. package/dist/likec4diagram/custom/nodes/SequenceActorNode.js +7 -5
  117. package/dist/likec4diagram/custom/nodes/nodes.js +25 -6
  118. package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +5 -4
  119. package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.d.ts +6 -1
  120. package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.js +7 -6
  121. package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +3 -3
  122. package/dist/likec4diagram/custom/nodes/toolbar/styles.css.js +2 -2
  123. package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +15 -15
  124. package/dist/likec4diagram/relationship-popover/components.d.ts +7 -0
  125. package/dist/likec4diagram/relationship-popover/components.js +39 -0
  126. package/dist/likec4diagram/state/DiagramActorProvider.d.ts +4 -3
  127. package/dist/likec4diagram/state/DiagramActorProvider.js +14 -15
  128. package/dist/likec4diagram/state/assign.d.ts +1 -1
  129. package/dist/likec4diagram/state/createViewChange.js +16 -4
  130. package/dist/likec4diagram/state/machine.actions.d.ts +65 -0
  131. package/dist/likec4diagram/state/machine.actions.js +51 -39
  132. package/dist/likec4diagram/state/machine.actions.layout.d.ts +22 -2
  133. package/dist/likec4diagram/state/machine.actions.layout.js +32 -14
  134. package/dist/likec4diagram/state/machine.d.ts +1 -1
  135. package/dist/likec4diagram/state/machine.js +31 -30
  136. package/dist/likec4diagram/state/machine.setup.d.ts +21 -5
  137. package/dist/likec4diagram/state/machine.setup.js +13 -4
  138. package/dist/likec4diagram/state/machine.state.initializing.d.ts +32 -2
  139. package/dist/likec4diagram/state/machine.state.navigating.d.ts +1 -1
  140. package/dist/likec4diagram/state/machine.state.navigating.js +81 -49
  141. package/dist/likec4diagram/state/machine.state.ready.d.ts +508 -582
  142. package/dist/likec4diagram/state/machine.state.ready.focused.d.ts +17 -148
  143. package/dist/likec4diagram/state/machine.state.ready.focused.js +6 -14
  144. package/dist/likec4diagram/state/machine.state.ready.idle.d.ts +11 -96
  145. package/dist/likec4diagram/state/machine.state.ready.idle.js +7 -12
  146. package/dist/likec4diagram/state/machine.state.ready.js +80 -69
  147. package/dist/likec4diagram/state/machine.state.ready.printing.d.ts +4 -0
  148. package/dist/likec4diagram/state/machine.state.ready.printing.js +4 -3
  149. package/dist/likec4diagram/state/machine.state.ready.walkthrough.d.ts +145 -2
  150. package/dist/likec4diagram/state/machine.state.ready.walkthrough.js +29 -21
  151. package/dist/likec4diagram/state/types.d.ts +1 -1
  152. package/dist/likec4diagram/state/utils.d.ts +13 -14
  153. package/dist/likec4diagram/state/utils.js +11 -3
  154. package/dist/likec4diagram/types.d.ts +9 -1
  155. package/dist/likec4diagram/ui/notation/NotationPanel.css.js +1 -1
  156. package/dist/likec4diagram/ui/notation/NotationPanel.js +3 -3
  157. package/dist/likec4diagram/useLayoutConstraints.js +4 -1
  158. package/dist/likec4diagram/xyflow-diagram/diagram-view.d.ts +11 -3
  159. package/dist/likec4diagram/xyflow-diagram/diagram-view.js +5 -3
  160. package/dist/likec4diagram/xyflow-sequence/sequence-layout.d.ts +7 -3
  161. package/dist/likec4diagram/xyflow-sequence/sequence-layout.js +10 -8
  162. package/dist/navigationpanel/NavigationPanel.js +2 -1
  163. package/dist/navigationpanel/NavigationPanelControls.js +4 -2
  164. package/dist/navigationpanel/NavigationPanelDropdown.js +7 -7
  165. package/dist/navigationpanel/_common.d.ts +1 -1
  166. package/dist/navigationpanel/_common.js +1 -2
  167. package/dist/navigationpanel/comparepanel/CompareActionsMenu.js +2 -2
  168. package/dist/navigationpanel/comparepanel/ComparePanelControls.js +1 -1
  169. package/dist/navigationpanel/comparepanel/LayoutTypeSwitcher.js +4 -5
  170. package/dist/navigationpanel/controls/DetailsControls.js +5 -5
  171. package/dist/navigationpanel/controls/LayoutWarning.js +2 -2
  172. package/dist/navigationpanel/controls/NavigationButtons.js +2 -2
  173. package/dist/navigationpanel/controls/OpenSource.js +1 -1
  174. package/dist/navigationpanel/controls/SearchControl.d.ts +1 -2
  175. package/dist/navigationpanel/controls/SearchControl.js +8 -12
  176. package/dist/navigationpanel/controls/ToggleReadonly.js +4 -5
  177. package/dist/navigationpanel/dropdown/ProjectsMenu.js +12 -6
  178. package/dist/navigationpanel/editorpanel/CenterCamera.js +1 -1
  179. package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.js +1 -1
  180. package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.js +9 -9
  181. package/dist/navigationpanel/editorpanel/ToggleReadonly.js +1 -1
  182. package/dist/navigationpanel/editorpanel/styles.js +4 -4
  183. package/dist/navigationpanel/styles.css.d.ts +1 -1
  184. package/dist/navigationpanel/styles.css.js +1 -1
  185. package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +3 -3
  186. package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +67 -67
  187. package/dist/navigationpanel/walkthrough/DynamicViewControls.js +1 -1
  188. package/dist/navigationpanel/walkthrough/WalkthroughPanel.js +1 -1
  189. package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconCirclePlus.js +14 -0
  190. package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconTrash.js +14 -0
  191. package/dist/overlays/element-details/ElementDetailsCard.css.js +4 -4
  192. package/dist/overlays/element-details/ElementDetailsCard.js +4 -4
  193. package/dist/overlays/element-details/MetadataValue.js +6 -7
  194. package/dist/overlays/element-details/TabPanelDeployments.js +7 -5
  195. package/dist/overlays/element-details/TabPanelRelationships.css.js +5 -25
  196. package/dist/overlays/element-details/TabPanelRelationships.js +3 -3
  197. package/dist/overlays/element-details/TabPanelStructure.js +3 -2
  198. package/dist/overlays/overlaysActor.js +18 -0
  199. package/dist/overlays/relationship-details/RelationshipDetails.d.ts +0 -5
  200. package/dist/overlays/relationship-details/RelationshipDetails.js +4 -4
  201. package/dist/overlays/relationship-details/SelectEdge.css.js +2 -2
  202. package/dist/overlays/relationship-details/SelectEdge.js +2 -2
  203. package/dist/overlays/relationship-details/compute.js +1 -1
  204. package/dist/overlays/relationship-details/custom/ElementActions.js +3 -3
  205. package/dist/overlays/relationship-details/custom/nodeTypes.js +14 -1
  206. package/dist/overlays/relationship-details/layout.js +1 -1
  207. package/dist/overlays/relationships-browser/RelationshipsBrowser.d.ts +0 -5
  208. package/dist/overlays/relationships-browser/RelationshipsBrowser.js +116 -21
  209. package/dist/overlays/relationships-browser/SelectElement.js +2 -2
  210. package/dist/overlays/relationships-browser/custom/ElementActions.js +3 -3
  211. package/dist/overlays/relationships-browser/custom/EmptyNode.js +21 -6
  212. package/dist/overlays/relationships-browser/custom/nodeTypes.js +14 -1
  213. package/dist/overlays/relationships-browser/layout.d.ts +1 -1
  214. package/dist/overlays/relationships-browser/layout.js +1 -1
  215. package/dist/projects-overview/actor.js +8 -31
  216. package/dist/projects-overview/custom/nodeTypes.js +1 -1
  217. package/dist/projects-overview/panel/ProjectsOverviewPanel.js +1 -1
  218. package/dist/search/Search.d.ts +1 -4
  219. package/dist/search/Search.js +89 -87
  220. package/dist/search/components/ElementsColumn.css.js +3 -3
  221. package/dist/search/components/ElementsColumn.js +3 -4
  222. package/dist/search/components/PickView.d.ts +3 -1
  223. package/dist/search/components/PickView.js +5 -4
  224. package/dist/search/components/SearchByTags.js +1 -1
  225. package/dist/search/components/SearchInput.js +1 -1
  226. package/dist/search/components/ViewsColum.js +2 -2
  227. package/dist/search/components/_shared.css.d.ts +1 -1
  228. package/dist/search/components/_shared.css.js +1 -1
  229. package/dist/search/components/utils.js +1 -1
  230. package/dist/search/hooks.d.ts +1 -6
  231. package/dist/search/hooks.js +12 -9
  232. package/dist/search/searchActor.d.ts +1 -1
  233. package/dist/shadowroot/ShadowRoot.js +20 -19
  234. package/dist/shadowroot/styles.css.d.ts +0 -2
  235. package/dist/shadowroot/styles.css.js +1 -34
  236. package/dist/styles-font.css2.js +1 -1
  237. package/dist/styles.css2.js +1 -1
  238. package/dist/utils/view-bounds.js +9 -5
  239. package/dist/utils/xyflow.d.ts +19 -3
  240. package/dist/utils/xyflow.js +52 -9
  241. package/package.json +21 -20
  242. package/panda.buildinfo.json +80 -104
  243. package/styles-font.css +1 -1
  244. package/styles-min.css +1 -1
  245. package/styles.css +1 -1
  246. package/dist/editor/__tests__/fixture.d.ts +0 -205
  247. package/dist/editor/editorActor.d.ts +0 -653
  248. package/dist/likec4diagram/relationship-popover/styles.css.d.ts +0 -2
  249. package/dist/likec4diagram/relationship-popover/styles.css.js +0 -28
  250. package/dist/overlays/relationships-browser/custom/styles.css.d.ts +0 -1
  251. package/dist/overlays/relationships-browser/custom/styles.css.js +0 -14
  252. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/createReactComponent.js +0 -0
  253. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.js +0 -0
  254. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertTriangle.js +0 -0
  255. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowDownRight.js +0 -0
  256. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowLeft.js +0 -0
  257. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowRight.js +0 -0
  258. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconBolt.js +0 -0
  259. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconBrowser.js +0 -0
  260. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.js +0 -0
  261. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronDown.js +0 -0
  262. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronLeft.js +0 -0
  263. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronRight.js +0 -0
  264. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.js +0 -0
  265. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconCylinder.js +0 -0
  266. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconDeviceMobile.js +0 -0
  267. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconDirectionSignFilled.js +0 -0
  268. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconExternalLink.js +0 -0
  269. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconFileSymlink.js +0 -0
  270. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconFileText.js +0 -0
  271. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconFocusCentered.js +0 -0
  272. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconFolderFilled.js +0 -0
  273. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconHelpCircle.js +0 -0
  274. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconId.js +0 -0
  275. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconInfoCircle.js +0 -0
  276. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignBottom.js +0 -0
  277. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignCenter.js +0 -0
  278. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignLeft.js +0 -0
  279. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignMiddle.js +0 -0
  280. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignRight.js +0 -0
  281. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignTop.js +0 -0
  282. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutBoardSplit.js +0 -0
  283. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutCollage.js +0 -0
  284. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutDashboard.js +0 -0
  285. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLink.js +0 -0
  286. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLock.js +0 -0
  287. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLockOpen2.js +0 -0
  288. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerPlayFilled.js +0 -0
  289. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipBackFilled.js +0 -0
  290. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipForwardFilled.js +0 -0
  291. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerStopFilled.js +0 -0
  292. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconRectangularPrism.js +0 -0
  293. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconReorder.js +0 -0
  294. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconRouteOff.js +0 -0
  295. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconSearch.js +0 -0
  296. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconSelector.js +0 -0
  297. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconStack2.js +0 -0
  298. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconStarFilled.js +0 -0
  299. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconTarget.js +0 -0
  300. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconTransform.js +0 -0
  301. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconUser.js +0 -0
  302. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconX.js +0 -0
  303. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconZoomScan.js +0 -0
@@ -13,7 +13,7 @@ const selectCompareLayoutState = ({ context }) => {
13
13
  isEnabled: false,
14
14
  isEditable: false,
15
15
  isActive: false,
16
- drifts: [],
16
+ drifts: null,
17
17
  canApplyLatest: false,
18
18
  layout: context.view._layout ?? "auto"
19
19
  };
@@ -19,7 +19,7 @@ function useLikeC4ElementsTree(viewId) {
19
19
  } else {
20
20
  return [...model.roots()].map(buildNode).sort(sortByLabel);
21
21
  }
22
- }, [model, viewId ?? null]);
22
+ }, [model, viewId]);
23
23
  }
24
24
 
25
25
  export { sortByLabel, useLikeC4ElementsTree };
@@ -18,9 +18,9 @@ function useLikeC4ViewModel(viewId) {
18
18
  }
19
19
  function useLikeC4Specification() {
20
20
  const model = useLikeC4Model();
21
- const [specification, setSpecification] = useState(model.$data.specification);
21
+ const [specification, setSpecification] = useState(model.specification);
22
22
  useEffect(() => {
23
- setSpecification((current) => deepEqual(current, model.$data.specification) ? current : model.$data.specification);
23
+ setSpecification((current) => deepEqual(current, model.specification) ? current : model.specification);
24
24
  }, [model]);
25
25
  return specification;
26
26
  }
@@ -1,2 +1,7 @@
1
1
  import { NonEmptyObject } from 'type-fest';
2
- export declare function useSetState<T extends object>(initialState: T | (() => T)): readonly [T, (statePartial: NonEmptyObject<Partial<T>> | ((current: T) => NonEmptyObject<Partial<T>>)) => void];
2
+ /**
3
+ * Differs from useState in that:
4
+ * - it uses custom equal function (shallowEqual by default) to determine whether the state has changed.
5
+ * - allows partial updates to the state
6
+ */
7
+ export declare function useSetState<T extends object>(initialState: T | (() => T), equal?: (a: T, b: T) => boolean): readonly [T, (statePartial: NonEmptyObject<Partial<T>> | ((current: T) => NonEmptyObject<Partial<T>>)) => void];
@@ -1,17 +1,20 @@
1
1
  import { shallowEqual } from 'fast-equals';
2
- import { useState, useCallback } from 'react';
2
+ import { useState, useRef, useCallback } from 'react';
3
3
 
4
- function useSetState(initialState) {
4
+ function useSetState(initialState, equal) {
5
5
  const [state, _setState] = useState(initialState);
6
+ const equalFn = equal ?? shallowEqual;
7
+ const equalFnRef = useRef(equalFn);
8
+ equalFnRef.current = equalFn;
6
9
  const setState = useCallback(
7
10
  (statePartial) => _setState((current) => {
8
11
  const next = {
9
12
  ...current,
10
13
  ...typeof statePartial === "function" ? statePartial(current) : statePartial
11
14
  };
12
- return shallowEqual(current, next) ? current : next;
15
+ return equalFnRef.current(current, next) ? current : next;
13
16
  }),
14
- []
17
+ [_setState]
15
18
  );
16
19
  return [state, setState];
17
20
  }
@@ -12,5 +12,11 @@ export type XYStoreApi = {
12
12
  };
13
13
  export type XYInternalNode = InternalNode<Types.AnyNode>;
14
14
  export declare function useXYInternalNode(id: string): XYInternalNode | undefined;
15
- export declare function useCurrentZoom(): number;
15
+ /**
16
+ * Returns the current zoom level of the flow.
17
+ * @param precision The number of decimal places to round to, defaults to 2 (i.e. 1.23)
18
+ * @returns The current zoom level of the flow.
19
+ */
20
+ export declare function useCurrentZoom(precision?: number): number;
21
+ export declare function useCurrentZoomAtLeast(minZoom: number): boolean;
16
22
  export declare function useIsZoomTooSmall(): boolean;
@@ -1,5 +1,6 @@
1
1
  import { useStore, useStoreApi, useReactFlow } from '@xyflow/react';
2
2
  import { shallowEqual } from 'fast-equals';
3
+ import { useCallback } from 'react';
3
4
  import { useCallbackRef } from './useCallbackRef.js';
4
5
 
5
6
  function useXYFlow() {
@@ -14,13 +15,12 @@ function useXYStore(selector, equalityFn) {
14
15
  function useXYStoreApi() {
15
16
  return useStoreApi();
16
17
  }
17
- const selectCurrentZoom = (state) => Math.round(state.transform[2] * 100) / 100;
18
- function useCurrentZoom() {
19
- return useStore(selectCurrentZoom);
18
+ function useCurrentZoomAtLeast(minZoom) {
19
+ return useStore(useCallback((state) => state.transform[2] >= minZoom, [minZoom]));
20
20
  }
21
21
  const selectZoom = (state) => state.transform[2] < 0.2;
22
22
  function useIsZoomTooSmall() {
23
23
  return useStore(selectZoom);
24
24
  }
25
25
 
26
- export { useCurrentZoom, useIsZoomTooSmall, useXYFlow, useXYStore, useXYStoreApi };
26
+ export { useCurrentZoomAtLeast, useIsZoomTooSmall, useXYFlow, useXYStore, useXYStoreApi };
package/dist/index.d.ts CHANGED
@@ -1,12 +1,13 @@
1
1
  export { IconRendererProvider } from './context/IconRenderer';
2
2
  export { LikeC4Diagram, type LikeC4DiagramProps, } from './LikeC4Diagram';
3
- export type { ElementIconRenderer, ElementIconRendererProps, LikeC4ColorScheme, NodeRenderers, OnCanvasClick, OnChange, OnEdgeClick, OnInitialized, OnNavigateTo, OnNodeClick, OnOpenSource, PaddingWithUnit, ViewPadding, WhereOperator, } from './LikeC4Diagram.props';
3
+ export type { ElementIconRenderer, ElementIconRendererProps, LikeC4ColorScheme, NodeRenderers, OnCanvasClick, OnEdgeClick, OnInitialized, OnNavigateTo, OnNodeClick, OnOpenSource, PaddingWithUnit, ViewPadding, WhereOperator, } from './LikeC4Diagram.props';
4
4
  export { LikeC4ModelProvider, type LikeC4ModelProviderProps, } from './LikeC4ModelProvider';
5
- export { type LikeC4EditorPort, LikeC4EditorProvider, type LikeC4EditorProviderProps, } from './editor/LikeC4EditorProvider';
5
+ export { LikeC4EditorProvider, type LikeC4EditorProviderProps, } from './editor/LikeC4EditorProvider';
6
+ export { createLikeC4Editor, type LikeC4EditorCallbacks, } from './editor/LikeC4EditorCallbacks';
6
7
  export { LikeC4ProjectsProvider, type LikeC4ProjectsProviderProps, } from './LikeC4ProjectsProvider';
7
8
  export { type DiagramApi, type DiagramContext, useDiagram, useDiagramContext, useOnDiagramEvent, } from './hooks/useDiagram';
8
9
  export { useLikeC4Model, useLikeC4Specification, useLikeC4ViewModel, } from './hooks/useLikeC4Model';
9
- export { useCurrentViewModel } from './hooks/useCurrentViewModel';
10
+ export { type CurrentViewModel, useCurrentViewModel, useOptionalCurrentViewModel, } from './hooks/useCurrentViewModel';
10
11
  export { useChangeLikeC4Project, useHasProjects, useLikeC4Project, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext, } from './hooks/useLikeC4Project';
11
12
  export { useLikeC4Styles } from './hooks/useLikeC4Styles';
12
13
  export { useUpdateEffect } from './hooks/useUpdateEffect';
@@ -15,6 +16,8 @@ export { StaticLikeC4Diagram } from './StaticLikeC4Diagram';
15
16
  export { LikeC4View } from './LikeC4View';
16
17
  export type { LikeC4BrowserProps, LikeC4ViewProps } from './LikeC4View';
17
18
  export { ReactLikeC4, type ReactLikeC4Props } from './ReactLikeC4';
18
- export { useCurrentViewId } from './hooks/useCurrentView';
19
+ export { useCurrentView, useCurrentViewId, } from './hooks/useCurrentView';
19
20
  export { pickViewBounds } from './utils/view-bounds';
20
21
  export { LikeC4ProjectsOverview, type LikeC4ProjectsOverviewProps, } from './LikeC4ProjectsOverview';
22
+ export type { AdhocViewService, } from './adhoc-editor/actor.types';
23
+ export { LikeC4AdHocViewEditor, } from './adhoc-editor/LikeC4AdHocViewEditor';
package/dist/index.js CHANGED
@@ -2,17 +2,19 @@ export { IconRendererProvider } from './context/IconRenderer.js';
2
2
  export { LikeC4Diagram } from './LikeC4Diagram.js';
3
3
  export { LikeC4ModelProvider } from './LikeC4ModelProvider.js';
4
4
  export { LikeC4EditorProvider } from './editor/LikeC4EditorProvider.js';
5
+ export { createLikeC4Editor } from './editor/LikeC4EditorCallbacks.js';
5
6
  export { LikeC4ProjectsProvider } from './LikeC4ProjectsProvider.js';
6
7
  export { useDiagramContext, useOnDiagramEvent } from './hooks/useDiagram.js';
7
8
  export { useLikeC4Model, useLikeC4Specification, useLikeC4ViewModel } from './hooks/useLikeC4Model.js';
8
- export { useCurrentViewModel } from './hooks/useCurrentViewModel.js';
9
+ export { useCurrentViewModel, useOptionalCurrentViewModel } from './hooks/useCurrentViewModel.js';
9
10
  export { useChangeLikeC4Project, useHasProjects, useLikeC4Project, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext } from './hooks/useLikeC4Project.js';
10
11
  export { useLikeC4Styles } from './hooks/useLikeC4Styles.js';
11
12
  export { useUpdateEffect } from './hooks/useUpdateEffect.js';
12
13
  export { StaticLikeC4Diagram } from './StaticLikeC4Diagram.js';
13
14
  export { LikeC4View } from './LikeC4View.js';
14
15
  export { ReactLikeC4 } from './ReactLikeC4.js';
15
- export { useCurrentViewId } from './hooks/useCurrentView.js';
16
+ export { useCurrentView, useCurrentViewId } from './hooks/useCurrentView.js';
16
17
  export { pickViewBounds } from './utils/view-bounds.js';
17
18
  export { LikeC4ProjectsOverview } from './LikeC4ProjectsOverview.js';
19
+ export { LikeC4AdHocViewEditor } from './adhoc-editor/LikeC4AdHocViewEditor.js';
18
20
  export { useDiagram } from './hooks/safeContext.js';
@@ -4,7 +4,6 @@ import { memo, useCallback } from 'react';
4
4
  import { ErrorBoundary } from '../components/ErrorFallback.js';
5
5
  import { useEnabledFeatures } from '../context/DiagramFeatures.js';
6
6
  import { useOverlaysActorRef } from '../hooks/useOverlaysActor.js';
7
- import { useSearchActorRef } from '../hooks/useSearchActor.js';
8
7
  import { Overlays } from '../overlays/Overlays.js';
9
8
  import { Search } from '../search/Search.js';
10
9
  import { RelationshipPopover } from './relationship-popover/RelationshipPopover.js';
@@ -23,7 +22,6 @@ const LikeC4DiagramUI = memo(() => {
23
22
  } = useEnabledFeatures();
24
23
  const rerender = useRerender();
25
24
  const overlaysActorRef = useOverlaysActorRef();
26
- const searchActorRef = useSearchActorRef();
27
25
  const handleReset = useCallback(() => {
28
26
  console.warn("DiagramUI: resetting error boundary and rerendering...");
29
27
  rerender();
@@ -32,7 +30,7 @@ const LikeC4DiagramUI = memo(() => {
32
30
  enableControls && /* @__PURE__ */ jsx(NavigationPanel, {}),
33
31
  overlaysActorRef && /* @__PURE__ */ jsx(Overlays, { overlaysActorRef }),
34
32
  enableNotations && /* @__PURE__ */ jsx(NotationPanel, {}),
35
- enableSearch && searchActorRef && /* @__PURE__ */ jsx(Search, { searchActorRef }),
33
+ enableSearch && /* @__PURE__ */ jsx(Search, {}),
36
34
  enableRelationshipDetails && enableReadOnly && /* @__PURE__ */ jsx(RelationshipPopover, {}),
37
35
  enableCompareWithLatest && /* @__PURE__ */ jsx(LayoutDriftFrame, {})
38
36
  ] });
@@ -12,6 +12,7 @@ import { useDiagramActorSnapshot } from '../hooks/useDiagram.js';
12
12
  import { depsShallowEqual, useUpdateEffect } from '../hooks/useUpdateEffect.js';
13
13
  import { BuiltinEdges, BuiltinNodes } from './custom/index.js';
14
14
  import { deriveToggledFeatures } from './state/machine.setup.js';
15
+ import { viewBounds } from './state/utils.js';
15
16
  import { useLayoutConstraints } from './useLayoutConstraints.js';
16
17
  import { useDiagram } from '../hooks/safeContext.js';
17
18
  import { useDiagramEventHandlers } from '../context/DiagramEventHandlers.js';
@@ -44,9 +45,21 @@ function prepareNodeTypes(nodeTypes) {
44
45
  "seq-parallel": nodeTypes.seqParallel ?? builtinNodes["seq-parallel"]
45
46
  };
46
47
  }
48
+ const viewportToTopLeft = (ctx) => {
49
+ const bounds = viewBounds(ctx);
50
+ return {
51
+ x: -bounds.x,
52
+ y: -bounds.y,
53
+ zoom: 1
54
+ };
55
+ };
47
56
  const selectXYProps = ({ context: ctx, children }) => {
48
57
  const { enableReadOnly } = deriveToggledFeatures(ctx);
49
58
  const isNotEditingEdge = enableReadOnly || children.editor?.getSnapshot().context.editing !== "edge";
59
+ let nodesDraggable = !enableReadOnly && ctx.nodesDraggable;
60
+ if (ctx.dynamicViewVariant === "sequence" && ctx.view._type === "dynamic") {
61
+ nodesDraggable = false;
62
+ }
50
63
  return {
51
64
  enableReadOnly,
52
65
  initialized: ctx.initialized.xydata && ctx.initialized.xyflow,
@@ -54,16 +67,12 @@ const selectXYProps = ({ context: ctx, children }) => {
54
67
  edges: ctx.xyedges,
55
68
  pannable: ctx.pannable,
56
69
  zoomable: ctx.zoomable,
57
- nodesDraggable: !enableReadOnly && ctx.nodesDraggable,
70
+ nodesDraggable,
58
71
  nodesSelectable: ctx.nodesSelectable && isNotEditingEdge,
59
72
  fitViewPadding: ctx.fitViewPadding,
60
73
  enableFitView: ctx.features.enableFitView,
61
74
  ...!ctx.features.enableFitView && {
62
- viewport: {
63
- x: -ctx.view.bounds.x,
64
- y: -ctx.view.bounds.y,
65
- zoom: 1
66
- }
75
+ viewport: viewportToTopLeft(ctx)
67
76
  }
68
77
  };
69
78
  };
@@ -96,19 +105,23 @@ function LikeC4DiagramXYFlow({
96
105
  } = useDiagramEventHandlers();
97
106
  const isReducedGraphics = useIsReducedGraphics(), layoutConstraints = useLayoutConstraints(), $isPanning = usePanningAtom(), isPanning = useTimeout(() => {
98
107
  $isPanning.set(true);
99
- }, isReducedGraphics ? 120 : 400), notPanning = useDebouncedCallback(() => {
108
+ }, isReducedGraphics ? 200 : 800), notPanning = useDebouncedCallback(() => {
100
109
  isPanning.clear();
101
110
  $isPanning.set(false);
102
- }, isReducedGraphics ? 350 : 200), onMove = useCallbackRef((event) => {
111
+ }, { delay: 200 }), onMove = useCallbackRef((event) => {
103
112
  if (!event) {
113
+ isPanning.clear();
104
114
  return;
105
115
  }
106
116
  if (!$isPanning.get()) {
107
117
  isPanning.start();
118
+ } else {
119
+ notPanning();
108
120
  }
109
- notPanning();
110
121
  }), onMoveEnd = useCallbackRef((event, viewport) => {
111
- isPanning.clear();
122
+ if (event) {
123
+ notPanning();
124
+ }
112
125
  diagram.send({
113
126
  type: "xyflow.viewportMoved",
114
127
  viewport,
@@ -133,10 +146,10 @@ function LikeC4DiagramXYFlow({
133
146
  nodeTypes,
134
147
  edgeTypes,
135
148
  onNodesChange: useCallbackRef((changes) => {
136
- diagram.send({ type: "xyflow.applyNodeChanges", changes });
149
+ diagram.send({ type: "xyflow.applyChanges", nodes: changes });
137
150
  }),
138
151
  onEdgesChange: useCallbackRef((changes) => {
139
- diagram.send({ type: "xyflow.applyEdgeChanges", changes });
152
+ diagram.send({ type: "xyflow.applyChanges", edges: changes });
140
153
  }),
141
154
  background: initialized ? background : "transparent",
142
155
  fitView: false,
@@ -1,6 +1,7 @@
1
- import { DynamicViewDisplayVariant, LayoutedView, WhereOperator } from '@likec4/core/types';
1
+ import { DynamicViewDisplayVariant, LayoutedView, ViewId, WhereOperator } from '@likec4/core/types';
2
2
  import { Types } from './types';
3
3
  type ConvertToXYFlowInput = {
4
+ currentViewId: ViewId | undefined;
4
5
  view: LayoutedView;
5
6
  where: WhereOperator | null;
6
7
  dynamicViewVariant: DynamicViewDisplayVariant;
@@ -4,12 +4,11 @@ import { sequenceLayoutToXY } from './xyflow-sequence/sequence-layout.js';
4
4
  function convertToXYFlow({ dynamicViewVariant, ...params }) {
5
5
  const view = params.view;
6
6
  const isDynamic = view._type === "dynamic";
7
- const { bounds, xynodes, xyedges } = isDynamic && dynamicViewVariant === "sequence" ? sequenceLayoutToXY(view) : diagramToXY(params);
7
+ const { xynodes, xyedges } = isDynamic && dynamicViewVariant === "sequence" ? sequenceLayoutToXY(view, params.currentViewId) : diagramToXY({ ...params });
8
8
  if (isDynamic && view.variant !== dynamicViewVariant) {
9
9
  return {
10
10
  view: {
11
11
  ...view,
12
- bounds,
13
12
  variant: dynamicViewVariant
14
13
  },
15
14
  xynodes,
@@ -17,10 +16,7 @@ function convertToXYFlow({ dynamicViewVariant, ...params }) {
17
16
  };
18
17
  }
19
18
  return {
20
- view: bounds === view.bounds ? view : {
21
- ...view,
22
- bounds
23
- },
19
+ view,
24
20
  xynodes,
25
21
  xyedges
26
22
  };
@@ -1,12 +1,14 @@
1
1
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
2
  import { css, cx } from '@likec4/styles/css';
3
+ import { useRafEffect } from '@react-hookz/web';
3
4
  import { EdgeLabelRenderer } from '@xyflow/react';
4
- import { useState, useRef, useEffect } from 'react';
5
+ import { useState, useRef } from 'react';
5
6
  import { useEnabledFeatures } from '../../../context/DiagramFeatures.js';
6
7
  import { useCallbackRef } from '../../../hooks/useCallbackRef.js';
7
8
  import '@xstate/react';
8
9
  import 'fast-equals';
9
10
  import { useDiagram } from '../../../hooks/safeContext.js';
11
+ import { useSetState } from '../../../hooks/useSetState.js';
10
12
  import { useUpdateEffect } from '../../../hooks/useUpdateEffect.js';
11
13
  import { useXYFlow, useXYStoreApi } from '../../../hooks/useXYFlow.js';
12
14
  import { isSamePoint } from '../../../utils/xyflow.js';
@@ -61,30 +63,28 @@ const RelationshipEdge = memoEdge((props) => {
61
63
  isControlPointDragging
62
64
  });
63
65
  let labelX = labelBBox?.x ?? 0, labelY = labelBBox?.y ?? 0;
64
- const [labelPos, setLabelPos] = useState({
66
+ const [labelPos, setLabelPos] = useSetState({
65
67
  x: labelXY?.x ?? labelX,
66
68
  y: labelXY?.y ?? labelY
67
- });
69
+ }, isSamePoint);
68
70
  useUpdateEffect(() => {
69
71
  if (isControlPointDraggingRef.current) {
70
72
  return;
71
73
  }
72
- const next = {
74
+ setLabelPos({
73
75
  x: labelX,
74
76
  y: labelY
75
- };
76
- setLabelPos((current) => isSamePoint(current, next) ? current : next);
77
+ });
77
78
  }, [labelX, labelY]);
78
79
  const svgPathRef = useRef(null);
79
- useEffect(() => {
80
+ useRafEffect(() => {
80
81
  const path = svgPathRef.current;
81
82
  if (!path || !isControlPointDragging) return;
82
- const next = getEdgeCenter(path);
83
- setLabelPos((current) => isSamePoint(current, next) ? current : next);
83
+ setLabelPos(getEdgeCenter(path));
84
84
  }, [edgePath, isControlPointDragging]);
85
85
  const updateEdgeData = useCallbackRef((controlPoints2) => {
86
- const point = svgPathRef.current ? getEdgeCenter(svgPathRef.current) : null;
87
- if (labelBBox && point) {
86
+ const point = labelBBox && svgPathRef.current ? getEdgeCenter(svgPathRef.current) : null;
87
+ if (point) {
88
88
  diagram.updateEdgeData(id, {
89
89
  controlPoints: controlPoints2,
90
90
  labelBBox: {
@@ -294,11 +294,10 @@ function ControlPoints({
294
294
  });
295
295
  };
296
296
  const onRmbControlPointerDown = (index, e) => {
297
- if (controlPoints.length <= 1) {
297
+ if (controlPoints.length <= 1 || index >= controlPoints.length) {
298
298
  return;
299
299
  }
300
- e.stopPropagation();
301
- e.preventDefault();
300
+ stopAndPrevent(e);
302
301
  const newControlPoints = controlPoints.slice();
303
302
  newControlPoints.splice(index, 1);
304
303
  setTimeout(() => {
@@ -1,8 +1,8 @@
1
+ import { vector } from '@likec4/core/geometry';
1
2
  import { deepEqual } from 'fast-equals';
2
3
  import { useState } from 'react';
3
4
  import { useCallbackRef } from '../../../hooks/useCallbackRef.js';
4
5
  import { useUpdateEffect } from '../../../hooks/useUpdateEffect.js';
5
- import { vector } from '@likec4/core/geometry';
6
6
  import { bezierControlPoints } from '../../../utils/xyflow.js';
7
7
 
8
8
  function useControlPoints({
@@ -19,8 +19,8 @@ function useControlPoints({
19
19
  const next = data.controlPoints ?? bezierControlPoints(data.points);
20
20
  setControlPoints((prev) => deepEqual(prev, next) ? prev : next);
21
21
  }, [
22
- data.controlPoints?.map((p) => `${Math.round(p.x)},${Math.round(p.y)}`).join("|") ?? "",
23
- data.points.map((p) => `${Math.round(p[0])},${Math.round(p[1])}`).join("|")
22
+ data.points,
23
+ data.controlPoints ?? []
24
24
  ]);
25
25
  const insertControlPoint = useCallbackRef(({ x, y }) => {
26
26
  const sourceV = vector(sourceX, sourceY);
@@ -1,5 +1,8 @@
1
1
  import { XYPosition } from '@xyflow/react';
2
2
  import { Types } from '../../types';
3
+ /**
4
+ * @returns SVG path data string for relationship edge
5
+ */
3
6
  export declare function useRelationshipEdgePath({ props: { sourceX, sourceY, source, target, targetX, targetY, data, }, controlPoints, isControlPointDragging, }: {
4
7
  props: Types.EdgeProps<'relationship'>;
5
8
  controlPoints: XYPosition[];
@@ -1,12 +1,13 @@
1
- import { nonNullable } from '@likec4/core';
1
+ import { nonNullable, vector } from '@likec4/core';
2
+ import { getNodeDimensions } from '@xyflow/system';
2
3
  import { line, curveCatmullRomOpen } from 'd3-shape';
3
- import { useCallback } from 'react';
4
+ import { shallowEqual } from 'fast-equals';
5
+ import { useCallback, useMemo } from 'react';
4
6
  import { isTruthy, first, last } from 'remeda';
5
7
  import { useXYStore } from '../../../hooks/useXYFlow.js';
6
- import { nodeToRect, getNodeIntersectionFromCenterToPoint, bezierPath, isEqualRects } from '../../../utils/xyflow.js';
8
+ import { bezierPath, getNodeIntersectionFromCenterToPoint } from '../../../utils/xyflow.js';
7
9
 
8
10
  const curve = line().curve(curveCatmullRomOpen.alpha(0.7)).x((d) => Math.round(d.x)).y((d) => Math.round(d.y));
9
- const isSameRects = (a, b) => isEqualRects(a.sourceNode, b.sourceNode) && isEqualRects(a.targetNode, b.targetNode);
10
11
  function useRelationshipEdgePath({
11
12
  props: {
12
13
  sourceX,
@@ -20,41 +21,73 @@ function useRelationshipEdgePath({
20
21
  controlPoints,
21
22
  isControlPointDragging
22
23
  }) {
23
- const {
24
- sourceNode,
25
- targetNode
26
- } = useXYStore(
24
+ const [
25
+ sourceNodeWidth,
26
+ sourceNodeHeight,
27
+ targetNodeWidth,
28
+ targetNodeHeight
29
+ ] = useXYStore(
27
30
  useCallback(({ nodeLookup }) => {
28
- const sourceNode2 = nonNullable(nodeLookup.get(source), `source node ${source} not found`);
29
- const targetNode2 = nonNullable(nodeLookup.get(target), `target node ${target} not found`);
30
- return {
31
- sourceNode: nodeToRect(sourceNode2),
32
- targetNode: nodeToRect(targetNode2)
33
- };
31
+ const sourceNode = getNodeDimensions(nonNullable(nodeLookup.get(source), `source node ${source} not found`));
32
+ const targetNode = getNodeDimensions(nonNullable(nodeLookup.get(target), `target node ${target} not found`));
33
+ return [
34
+ Math.round(sourceNode.width),
35
+ Math.round(sourceNode.height),
36
+ Math.round(targetNode.width),
37
+ Math.round(targetNode.height)
38
+ ];
34
39
  }, [source, target]),
35
- isSameRects
40
+ shallowEqual
36
41
  );
37
42
  const isModified = isTruthy(data.controlPoints) || isControlPointDragging;
38
- if (isModified) {
39
- const sourceCenterPos = { x: sourceX, y: sourceY };
40
- const targetCenterPos = { x: targetX, y: targetY };
41
- const nodeMargin = 6;
42
- const points = data.dir === "back" ? [
43
- targetCenterPos,
44
- getNodeIntersectionFromCenterToPoint(targetNode, first(controlPoints) ?? sourceCenterPos, nodeMargin),
45
- ...controlPoints,
46
- getNodeIntersectionFromCenterToPoint(sourceNode, last(controlPoints) ?? targetCenterPos, nodeMargin),
47
- sourceCenterPos
48
- ] : [
49
- sourceCenterPos,
50
- getNodeIntersectionFromCenterToPoint(sourceNode, first(controlPoints) ?? targetCenterPos, nodeMargin),
51
- ...controlPoints,
52
- getNodeIntersectionFromCenterToPoint(targetNode, last(controlPoints) ?? sourceCenterPos, nodeMargin),
53
- targetCenterPos
54
- ];
55
- return nonNullable(curve(points));
56
- }
57
- return bezierPath(data.points);
43
+ return useMemo(
44
+ () => {
45
+ if (!isModified) {
46
+ return bezierPath(data.points);
47
+ }
48
+ const sourceCenterPos = { x: sourceX, y: sourceY };
49
+ const targetCenterPos = { x: targetX, y: targetY };
50
+ const sourceNd = {
51
+ ...vector(sourceX, sourceY).subtract(vector(sourceNodeWidth, sourceNodeHeight).divide(2)).round().toObject(),
52
+ width: sourceNodeWidth,
53
+ height: sourceNodeHeight
54
+ };
55
+ const targetNd = {
56
+ ...vector(targetX, targetY).subtract(vector(targetNodeWidth, targetNodeHeight).divide(2)).round().toObject(),
57
+ width: targetNodeWidth,
58
+ height: targetNodeHeight
59
+ };
60
+ const nodeMargin = 6;
61
+ const points = data.dir === "back" ? [
62
+ targetCenterPos,
63
+ getNodeIntersectionFromCenterToPoint(targetNd, first(controlPoints) ?? sourceCenterPos, nodeMargin),
64
+ ...controlPoints,
65
+ getNodeIntersectionFromCenterToPoint(sourceNd, last(controlPoints) ?? targetCenterPos, nodeMargin),
66
+ sourceCenterPos
67
+ ] : [
68
+ sourceCenterPos,
69
+ getNodeIntersectionFromCenterToPoint(sourceNd, first(controlPoints) ?? targetCenterPos, nodeMargin),
70
+ ...controlPoints,
71
+ getNodeIntersectionFromCenterToPoint(targetNd, last(controlPoints) ?? sourceCenterPos, nodeMargin),
72
+ targetCenterPos
73
+ ];
74
+ return nonNullable(curve(points));
75
+ },
76
+ [
77
+ data.points,
78
+ isModified,
79
+ isModified ? sourceX : void 0,
80
+ isModified ? sourceY : void 0,
81
+ isModified ? targetX : void 0,
82
+ isModified ? targetY : void 0,
83
+ isModified ? sourceNodeWidth : void 0,
84
+ isModified ? sourceNodeHeight : void 0,
85
+ isModified ? targetNodeWidth : void 0,
86
+ isModified ? targetNodeHeight : void 0,
87
+ isModified ? data.dir : void 0,
88
+ isModified ? controlPoints : void 0
89
+ ]
90
+ );
58
91
  }
59
92
 
60
93
  export { useRelationshipEdgePath };
@@ -2,7 +2,6 @@ import { SimplifyDeep } from 'type-fest';
2
2
  import { ElementActionButtons } from '../../../base-primitives';
3
3
  import { BaseNodeData } from '../../../base/types';
4
4
  import { Types } from '../../types';
5
- import { NamedExoticComponent } from 'react';
6
5
  type WithExtraButtons = {
7
6
  /**
8
7
  * Add extra action buttons
@@ -54,7 +53,7 @@ export type ElementActionsProps = SimplifyDeep<{
54
53
  * />
55
54
  * ```
56
55
  */
57
- export declare const ElementActions: NamedExoticComponent<ElementActionsProps>;
56
+ export declare function ElementActions({ extraButtons, ...props }: ElementActionsProps): import("react/jsx-runtime").JSX.Element;
58
57
  export type DeploymentElementActionsProps = SimplifyDeep<{
59
58
  selected?: boolean;
60
59
  data: Pick<Types.DeploymentElementNodeData, 'id' | 'modelFqn' | 'navigateTo'> & BaseNodeData;
@@ -1,21 +1,18 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import { deepEqual, shallowEqual } from 'fast-equals';
3
- import { memo, useMemo } from 'react';
2
+ import { useMemo } from 'react';
4
3
  import { hasAtLeast } from 'remeda';
5
4
  import { useEnabledFeatures } from '../../../context/DiagramFeatures.js';
6
5
  import '@xstate/react';
6
+ import 'fast-equals';
7
7
  import { useDiagram } from '../../../hooks/safeContext.js';
8
- import IconZoomScan from '../../../node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.3/node_modules/@tabler/icons-react/dist/esm/icons/IconZoomScan.js';
9
- import IconTransform from '../../../node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.3/node_modules/@tabler/icons-react/dist/esm/icons/IconTransform.js';
8
+ import IconZoomScan from '../../../node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconZoomScan.js';
9
+ import IconTransform from '../../../node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconTransform.js';
10
10
  import { ElementActionButtons } from '../../../base-primitives/element/ElementActionButtons.js';
11
11
 
12
- const compareElementActionsProps = (a, b) => {
13
- return deepEqual(a.data.id, b.data.id) && deepEqual(a.selected ?? false, b.selected ?? false) && deepEqual(a.data.modelFqn ?? null, b.data.modelFqn ?? null) && deepEqual(a.data.navigateTo ?? null, b.data.navigateTo ?? null) && deepEqual(a.data.hovered ?? false, b.data.hovered ?? false) && (!a.extraButtons && !b.extraButtons || shallowEqual(a.extraButtons, b.extraButtons));
14
- };
15
- const ElementActions = memo(({
12
+ function ElementActions({
16
13
  extraButtons,
17
14
  ...props
18
- }) => {
15
+ }) {
19
16
  const { enableNavigateTo, enableRelationshipBrowser } = useEnabledFeatures();
20
17
  const diagram = useDiagram();
21
18
  const { id, navigateTo, modelFqn } = props.data;
@@ -47,7 +44,7 @@ const ElementActions = memo(({
47
44
  buttons = [...buttons, ...extraButtons];
48
45
  }
49
46
  return /* @__PURE__ */ jsx(ElementActionButtons, { ...props, buttons });
50
- }, compareElementActionsProps);
47
+ }
51
48
  const DeploymentElementActions = ({
52
49
  extraButtons,
53
50
  ...props
@@ -7,6 +7,7 @@ import { useEnabledFeatures } from '../../../context/DiagramFeatures.js';
7
7
  import { ElementActions } from './ElementActions.js';
8
8
  import { NodeDrifts } from './NodeDrifts.js';
9
9
  import { ElementDetailsButtonWithHandler } from './nodes.js';
10
+ import { ElementToolbar } from './toolbar/ElementToolbar.js';
10
11
  import { ElementNodeContainer } from '../../../base-primitives/element/ElementNodeContainer.js';
11
12
  import { ElementShape } from '../../../base-primitives/element/ElementShape.js';
12
13
  import { ElementData } from '../../../base-primitives/element/ElementData.js';
@@ -67,9 +68,9 @@ const ActorStepPort = ({
67
68
  )
68
69
  ] });
69
70
  };
70
- const hasModelFqn = (data) => isTruthy(data.modelFqn);
71
+ const hasModelFqn = (node) => "modelFqn" in node.data && isTruthy(node.data.modelFqn);
71
72
  function SequenceActorNode(props) {
72
- const { enableElementDetails, enableCompareWithLatest } = useEnabledFeatures();
73
+ const { enableElementDetails, enableReadOnly, enableCompareWithLatest } = useEnabledFeatures();
73
74
  const data = props.data;
74
75
  const {
75
76
  id,
@@ -109,9 +110,10 @@ function SequenceActorNode(props) {
109
110
  enableCompareWithLatest && /* @__PURE__ */ jsx(NodeDrifts, { nodeProps: props }),
110
111
  /* @__PURE__ */ jsx(ElementShape, { ...props }),
111
112
  /* @__PURE__ */ jsx(ElementData, { ...props }),
112
- hasModelFqn(data) && /* @__PURE__ */ jsxs(Fragment, { children: [
113
- /* @__PURE__ */ jsx(ElementActions, { ...props, data }),
114
- enableElementDetails && /* @__PURE__ */ jsx(ElementDetailsButtonWithHandler, { id, data })
113
+ hasModelFqn(props) && /* @__PURE__ */ jsxs(Fragment, { children: [
114
+ /* @__PURE__ */ jsx(ElementActions, { ...props }),
115
+ enableElementDetails && /* @__PURE__ */ jsx(ElementDetailsButtonWithHandler, { id, data }),
116
+ !enableReadOnly && /* @__PURE__ */ jsx(ElementToolbar, { ...props })
115
117
  ] })
116
118
  ] }),
117
119
  ports.map((p) => /* @__PURE__ */ jsx(ActorStepPort, { port: p, data: props.data }, p.id))