@likec4/diagram 1.42.1 → 1.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (309) hide show
  1. package/bundle/index.js +6198 -4860
  2. package/dist/LikeC4Diagram.d.ts +1 -1
  3. package/dist/LikeC4Diagram.js +15 -12
  4. package/dist/LikeC4Diagram.props.d.ts +28 -14
  5. package/dist/LikeC4ProjectsProvider.js +1 -1
  6. package/dist/LikeC4View.d.ts +28 -4
  7. package/dist/LikeC4View.js +28 -17
  8. package/dist/ReactLikeC4.d.ts +1 -1
  9. package/dist/ReactLikeC4.js +5 -7
  10. package/dist/StaticLikeC4Diagram.js +2 -2
  11. package/dist/_virtual/_commonjsHelpers.js +3 -0
  12. package/dist/_virtual/assign-dea9f7c8.cjs.js +3 -0
  13. package/dist/_virtual/log-ec8d4df4.cjs.js +3 -0
  14. package/dist/_virtual/raise-da5b247f.cjs.js +3 -0
  15. package/dist/_virtual/xstate-actions.cjs.js +5 -0
  16. package/dist/_virtual/xstate-actions.cjs2.js +3 -0
  17. package/dist/_virtual/xstate-dev.cjs.js +3 -0
  18. package/dist/_virtual/xstate-guards.cjs.js +5 -0
  19. package/dist/_virtual/xstate-guards.cjs2.js +3 -0
  20. package/dist/base/Background.d.ts +2 -1
  21. package/dist/base/Background.js +11 -2
  22. package/dist/base/Base.d.ts +28 -0
  23. package/dist/base/BaseXYFlow.d.ts +5 -5
  24. package/dist/base/BaseXYFlow.js +38 -44
  25. package/dist/base/const.d.ts +1 -1
  26. package/dist/base/const.js +1 -1
  27. package/dist/base/index.d.ts +6 -2
  28. package/dist/base/types.d.ts +1 -28
  29. package/dist/base/updateEdges.js +4 -3
  30. package/dist/base/updateNodes.js +3 -2
  31. package/dist/base-primitives/compound/CompoundActionButton.js +1 -1
  32. package/dist/base-primitives/compound/CompoundDetailsButton.js +1 -1
  33. package/dist/base-primitives/edge/EdgeActionButton.js +1 -1
  34. package/dist/base-primitives/edge/EdgeContainer.d.ts +1 -1
  35. package/dist/base-primitives/edge/EdgeContainer.js +4 -0
  36. package/dist/base-primitives/edge/EdgeLabel.d.ts +1 -0
  37. package/dist/base-primitives/edge/EdgeLabel.js +2 -0
  38. package/dist/base-primitives/edge/EdgeLabelContainer.d.ts +1 -1
  39. package/dist/base-primitives/edge/EdgeLabelContainer.js +4 -0
  40. package/dist/base-primitives/edge/EdgePath.d.ts +4 -0
  41. package/dist/base-primitives/edge/EdgePath.js +9 -5
  42. package/dist/base-primitives/element/ElementActionButtons.d.ts +3 -2
  43. package/dist/base-primitives/element/ElementActionButtons.js +1 -1
  44. package/dist/base-primitives/element/ElementDetailsButton.js +2 -5
  45. package/dist/base-primitives/element/ElementNodeContainer.css.js +15 -27
  46. package/dist/base-primitives/element/ElementTags.js +2 -1
  47. package/dist/base-primitives/memoEdge.js +4 -2
  48. package/dist/base-primitives/memoNode.d.ts +1 -1
  49. package/dist/base-primitives/memoNode.js +3 -3
  50. package/dist/components/ErrorFallback.js +52 -35
  51. package/dist/components/Link.js +2 -2
  52. package/dist/context/DiagramEventHandlers.js +2 -1
  53. package/dist/context/DiagramFeatures.d.ts +24 -6
  54. package/dist/context/DiagramFeatures.js +28 -56
  55. package/dist/context/IconRenderer.js +6 -6
  56. package/dist/context/LikeC4ModelContext.js +3 -10
  57. package/dist/context/TagStylesContext.js +2 -18
  58. package/dist/context/index.d.ts +1 -1
  59. package/dist/custom/customNodes.js +3 -2
  60. package/dist/custom/hooks.d.ts +1 -1
  61. package/dist/custom/index.d.ts +1 -1
  62. package/dist/custom/index.js +4 -4
  63. package/dist/editor/LikeC4EditorContext.d.ts +21 -0
  64. package/dist/editor/index.d.ts +2 -0
  65. package/dist/hooks/index.d.ts +2 -1
  66. package/dist/hooks/safeContext.d.ts +6 -3
  67. package/dist/hooks/safeContext.js +10 -3
  68. package/dist/hooks/useCallbackRef.d.ts +1 -0
  69. package/dist/hooks/useCallbackRef.js +13 -0
  70. package/dist/hooks/useCurrentView.d.ts +11 -0
  71. package/dist/hooks/{useCurrentViewId.js → useCurrentView.js} +7 -3
  72. package/dist/hooks/useCurrentViewModel.js +4 -1
  73. package/dist/hooks/useDiagram.d.ts +7 -113
  74. package/dist/hooks/useDiagram.js +7 -127
  75. package/dist/hooks/useDiagramCompareLayout.d.ts +35 -0
  76. package/dist/hooks/useDiagramCompareLayout.js +60 -0
  77. package/dist/hooks/useUpdateEffect.js +2 -4
  78. package/dist/hooks/useXYFlow.d.ts +1 -0
  79. package/dist/hooks/useXYFlow.js +4 -7
  80. package/dist/index.d.ts +2 -2
  81. package/dist/index.js +4 -3
  82. package/dist/likec4diagram/DiagramUI.js +14 -7
  83. package/dist/likec4diagram/DiagramXYFlow.d.ts +2 -2
  84. package/dist/likec4diagram/DiagramXYFlow.js +54 -51
  85. package/dist/likec4diagram/convert-to-xyflow.d.ts +0 -1
  86. package/dist/likec4diagram/custom/edges/RelationshipEdge.js +249 -220
  87. package/dist/likec4diagram/custom/edges/SequenceStepEdge.js +7 -2
  88. package/dist/likec4diagram/custom/edges/edges.css.js +3 -4
  89. package/dist/likec4diagram/custom/edges/useControlPoints.d.ts +8 -0
  90. package/dist/likec4diagram/custom/edges/useControlPoints.js +58 -0
  91. package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.d.ts +7 -0
  92. package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.js +60 -0
  93. package/dist/likec4diagram/custom/edges/utils.d.ts +0 -12
  94. package/dist/likec4diagram/custom/nodes/CompoundActions.js +4 -1
  95. package/dist/likec4diagram/custom/nodes/ElementActions.d.ts +2 -1
  96. package/dist/likec4diagram/custom/nodes/ElementActions.js +15 -10
  97. package/dist/likec4diagram/custom/nodes/ElementNodeDrifts.d.ts +4 -0
  98. package/dist/likec4diagram/custom/nodes/ElementNodeDrifts.js +46 -0
  99. package/dist/likec4diagram/custom/nodes/SequenceActorNode.js +4 -1
  100. package/dist/likec4diagram/custom/nodes/nodes.d.ts +9 -1
  101. package/dist/likec4diagram/custom/nodes/nodes.js +13 -9
  102. package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.d.ts +1 -1
  103. package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +1 -1
  104. package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +2 -1
  105. package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.js +4 -3
  106. package/dist/likec4diagram/custom/nodes/toolbar/_shared.d.ts +1 -11
  107. package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +7 -51
  108. package/dist/likec4diagram/custom/nodes/toolbar/types.d.ts +5 -0
  109. package/dist/likec4diagram/custom/nodes/toolbar/types.js +7 -0
  110. package/dist/likec4diagram/custom/nodes/toolbar/useHandlers.d.ts +8 -0
  111. package/dist/likec4diagram/custom/nodes/toolbar/useHandlers.js +44 -0
  112. package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +5 -7
  113. package/dist/likec4diagram/state/DiagramActorProvider.d.ts +3 -2
  114. package/dist/likec4diagram/state/DiagramActorProvider.js +96 -70
  115. package/dist/likec4diagram/state/assign.d.ts +4 -2
  116. package/dist/likec4diagram/state/assign.js +39 -103
  117. package/dist/likec4diagram/state/createViewChange.d.ts +3 -0
  118. package/dist/likec4diagram/state/createViewChange.js +90 -0
  119. package/dist/likec4diagram/state/diagram-api.d.ts +113 -0
  120. package/dist/likec4diagram/state/diagram-api.js +134 -0
  121. package/dist/likec4diagram/state/hotkeyActor.d.ts +7 -0
  122. package/dist/likec4diagram/state/hotkeyActor.js +17 -1
  123. package/dist/likec4diagram/state/machine.actions.d.ts +2099 -0
  124. package/dist/likec4diagram/state/machine.actions.js +735 -0
  125. package/dist/likec4diagram/state/machine.d.ts +3717 -0
  126. package/dist/likec4diagram/state/machine.js +141 -0
  127. package/dist/likec4diagram/state/machine.setup.d.ts +284 -0
  128. package/dist/likec4diagram/state/machine.setup.js +71 -0
  129. package/dist/likec4diagram/state/machine.state.initializing.d.ts +183 -0
  130. package/dist/likec4diagram/state/machine.state.initializing.js +55 -0
  131. package/dist/likec4diagram/state/machine.state.navigating.d.ts +117 -0
  132. package/dist/likec4diagram/state/machine.state.navigating.js +45 -0
  133. package/dist/likec4diagram/state/machine.state.ready.d.ts +3666 -0
  134. package/dist/likec4diagram/state/machine.state.ready.js +437 -0
  135. package/dist/likec4diagram/state/syncManualLayoutActor.d.ts +220 -63
  136. package/dist/likec4diagram/state/syncManualLayoutActor.js +218 -143
  137. package/dist/likec4diagram/state/types.d.ts +4 -7
  138. package/dist/likec4diagram/state/utils.d.ts +4 -2
  139. package/dist/likec4diagram/state/utils.js +4 -1
  140. package/dist/likec4diagram/types.d.ts +6 -1
  141. package/dist/likec4diagram/ui/LayoutDriftFrame.d.ts +2 -0
  142. package/dist/likec4diagram/ui/LayoutDriftFrame.js +66 -0
  143. package/dist/likec4diagram/ui/index.d.ts +1 -0
  144. package/dist/likec4diagram/ui/notation/NotationPanel.js +10 -12
  145. package/dist/likec4diagram/useLayoutConstraints.d.ts +10 -5
  146. package/dist/likec4diagram/useLayoutConstraints.js +225 -54
  147. package/dist/likec4diagram/xyflow-diagram/diagram-view.d.ts +0 -1
  148. package/dist/likec4diagram/xyflow-diagram/diagram-view.js +15 -15
  149. package/dist/navigationpanel/NavigationPanel.js +11 -7
  150. package/dist/navigationpanel/NavigationPanelControls.d.ts +2 -1
  151. package/dist/navigationpanel/NavigationPanelControls.js +23 -17
  152. package/dist/navigationpanel/NavigationPanelDropdown.d.ts +2 -1
  153. package/dist/navigationpanel/NavigationPanelDropdown.js +62 -42
  154. package/dist/navigationpanel/_common.d.ts +1 -1
  155. package/dist/navigationpanel/_common.js +4 -2
  156. package/dist/navigationpanel/actor.d.ts +11 -7
  157. package/dist/navigationpanel/actor.js +5 -4
  158. package/dist/navigationpanel/comparepanel/CompareActionsMenu.d.ts +3 -0
  159. package/dist/navigationpanel/comparepanel/CompareActionsMenu.js +59 -0
  160. package/dist/navigationpanel/comparepanel/ComparePanel.d.ts +2 -0
  161. package/dist/navigationpanel/comparepanel/ComparePanel.js +42 -0
  162. package/dist/navigationpanel/comparepanel/ComparePanelControls.d.ts +1 -0
  163. package/dist/navigationpanel/comparepanel/ComparePanelControls.js +60 -0
  164. package/dist/navigationpanel/comparepanel/LayoutTypeSwitcher.d.ts +5 -0
  165. package/dist/navigationpanel/comparepanel/LayoutTypeSwitcher.js +38 -0
  166. package/dist/navigationpanel/comparepanel/index.d.ts +1 -0
  167. package/dist/navigationpanel/controls/{ViewDetailsCard.d.ts → DetailsControls.d.ts} +1 -1
  168. package/dist/navigationpanel/controls/{ViewDetailsCard.js → DetailsControls.js} +18 -14
  169. package/dist/navigationpanel/controls/LayoutWarning.d.ts +2 -0
  170. package/dist/navigationpanel/controls/LayoutWarning.js +102 -0
  171. package/dist/navigationpanel/controls/NavigationButtons.js +4 -3
  172. package/dist/navigationpanel/controls/OpenSource.js +2 -2
  173. package/dist/navigationpanel/controls/SearchControl.d.ts +2 -1
  174. package/dist/navigationpanel/controls/SearchControl.js +15 -17
  175. package/dist/navigationpanel/controls/ToggleReadonly.d.ts +1 -1
  176. package/dist/navigationpanel/controls/ToggleReadonly.js +19 -16
  177. package/dist/navigationpanel/controls/index.d.ts +2 -1
  178. package/dist/navigationpanel/dropdown/ProjectsMenu.d.ts +2 -2
  179. package/dist/navigationpanel/dropdown/ProjectsMenu.js +5 -5
  180. package/dist/navigationpanel/editorpanel/CenterCamera.js +5 -2
  181. package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.d.ts +1 -1
  182. package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.js +21 -20
  183. package/dist/navigationpanel/editorpanel/EditorPanel.js +3 -3
  184. package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.d.ts +2 -2
  185. package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.js +16 -13
  186. package/dist/navigationpanel/editorpanel/ToggleReadonly.d.ts +1 -0
  187. package/dist/navigationpanel/editorpanel/ToggleReadonly.js +15 -0
  188. package/dist/navigationpanel/styles.css.d.ts +2 -2
  189. package/dist/navigationpanel/styles.css.js +4 -4
  190. package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +14 -8
  191. package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +10 -10
  192. package/dist/navigationpanel/walkthrough/DynamicViewControls.js +31 -14
  193. package/dist/navigationpanel/walkthrough/WalkthroughPanel.d.ts +2 -1
  194. package/dist/navigationpanel/walkthrough/WalkthroughPanel.js +66 -49
  195. package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/actions/dist/xstate-actions.cjs.js +37 -0
  196. package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dev/dist/xstate-dev.cjs.js +59 -0
  197. package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dist/assign-dea9f7c8.cjs.js +140 -0
  198. package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dist/log-ec8d4df4.cjs.js +401 -0
  199. package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dist/raise-da5b247f.cjs.js +2716 -0
  200. package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/guards/dist/xstate-guards.cjs.js +26 -0
  201. package/dist/overlays/element-details/ElementDetails.js +7 -7
  202. package/dist/overlays/element-details/ElementDetailsCard.js +18 -88
  203. package/dist/overlays/element-details/MetadataValue.d.ts +9 -0
  204. package/dist/overlays/element-details/MetadataValue.js +261 -0
  205. package/dist/overlays/element-details/TabPanelDeployments.js +6 -4
  206. package/dist/overlays/element-details/TabPanelRelationships.js +3 -3
  207. package/dist/overlays/element-details/TabPanelStructure.js +1 -1
  208. package/dist/overlays/element-details/actor.d.ts +3 -2
  209. package/dist/overlays/overlaysActor.d.ts +304 -62
  210. package/dist/overlays/overlaysActor.js +132 -131
  211. package/dist/overlays/relationship-details/RelationshipDetails.js +4 -3
  212. package/dist/overlays/relationship-details/SelectEdge.js +2 -2
  213. package/dist/overlays/relationship-details/actor.d.ts +14 -2
  214. package/dist/overlays/relationship-details/actor.js +23 -5
  215. package/dist/overlays/relationship-details/custom/ElementActions.js +8 -5
  216. package/dist/overlays/relationship-details/custom/edgeTypes.js +4 -1
  217. package/dist/overlays/relationship-details/custom/nodeTypes.js +4 -1
  218. package/dist/overlays/relationship-details/hooks.js +1 -1
  219. package/dist/overlays/relationships-browser/RelationshipsBrowser.js +6 -4
  220. package/dist/overlays/relationships-browser/SelectElement.js +2 -2
  221. package/dist/overlays/relationships-browser/actor.d.ts +239 -173
  222. package/dist/overlays/relationships-browser/actor.js +132 -110
  223. package/dist/overlays/relationships-browser/const.d.ts +3 -3
  224. package/dist/overlays/relationships-browser/const.js +3 -3
  225. package/dist/overlays/relationships-browser/custom/ElementActions.js +44 -37
  226. package/dist/overlays/relationships-browser/custom/edgeTypes.js +4 -1
  227. package/dist/overlays/relationships-browser/custom/nodeTypes.js +4 -1
  228. package/dist/overlays/relationships-browser/hooks.js +7 -6
  229. package/dist/search/Search.js +2 -1
  230. package/dist/search/components/ElementsColumn.js +5 -3
  231. package/dist/search/components/PickView.js +1 -1
  232. package/dist/search/components/SearchByTags.js +21 -44
  233. package/dist/search/components/SearchInput.js +1 -1
  234. package/dist/search/components/ViewsColum.js +6 -4
  235. package/dist/shadowroot/ShadowRoot.js +53 -12
  236. package/dist/shadowroot/styles.css.d.ts +0 -4
  237. package/dist/shadowroot/styles.css.js +1 -41
  238. package/dist/styles.css2.js +1 -1
  239. package/dist/utils/index.d.ts +4 -4
  240. package/dist/utils/vector.d.ts +78 -21
  241. package/dist/utils/vector.js +91 -24
  242. package/dist/utils/view-bounds.d.ts +8 -0
  243. package/dist/utils/view-bounds.js +57 -0
  244. package/dist/utils/xyflow.d.ts +49 -7
  245. package/dist/utils/xyflow.js +63 -11
  246. package/package.json +28 -27
  247. package/panda.buildinfo.json +140 -83
  248. package/styles-min.css +1 -1
  249. package/styles.css +1 -1
  250. package/dist/hooks/useCurrentViewId.d.ts +0 -6
  251. package/dist/likec4diagram/custom/edges/utils.js +0 -23
  252. package/dist/likec4diagram/state/diagram-machine.d.ts +0 -2590
  253. package/dist/likec4diagram/state/diagram-machine.js +0 -1180
  254. package/dist/navigationpanel/editorpanel/LayoutDriftNotification.d.ts +0 -1
  255. package/dist/navigationpanel/editorpanel/LayoutDriftNotification.js +0 -56
  256. package/dist/utils/get-view-bounds.d.ts +0 -3
  257. package/dist/utils/get-view-bounds.js +0 -14
  258. /package/dist/base/{types.js → Base.js} +0 -0
  259. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/createReactComponent.js +0 -0
  260. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.js +0 -0
  261. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertTriangle.js +0 -0
  262. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowDownRight.js +0 -0
  263. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowLeft.js +0 -0
  264. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowRight.js +0 -0
  265. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconBolt.js +0 -0
  266. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconBrowser.js +0 -0
  267. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.js +0 -0
  268. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronDown.js +0 -0
  269. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronLeft.js +0 -0
  270. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronRight.js +0 -0
  271. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.js +0 -0
  272. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconCylinder.js +0 -0
  273. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconDeviceMobile.js +0 -0
  274. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconDirectionSignFilled.js +0 -0
  275. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconExternalLink.js +0 -0
  276. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconFileSymlink.js +0 -0
  277. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconFocusCentered.js +0 -0
  278. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconFolderFilled.js +0 -0
  279. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconHelpCircle.js +0 -0
  280. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconId.js +0 -0
  281. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconInfoCircle.js +0 -0
  282. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignBottom.js +0 -0
  283. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignCenter.js +0 -0
  284. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignLeft.js +0 -0
  285. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignMiddle.js +0 -0
  286. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignRight.js +0 -0
  287. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignTop.js +0 -0
  288. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutBoardSplit.js +0 -0
  289. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutCollage.js +0 -0
  290. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutDashboard.js +0 -0
  291. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLink.js +0 -0
  292. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLock.js +0 -0
  293. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLockOpen2.js +0 -0
  294. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerPlayFilled.js +0 -0
  295. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipBackFilled.js +0 -0
  296. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipForwardFilled.js +0 -0
  297. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerStopFilled.js +0 -0
  298. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconRectangularPrism.js +0 -0
  299. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconReorder.js +0 -0
  300. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconRouteOff.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/IconSearch.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/IconSelector.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/IconStack2.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/IconStarFilled.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/IconTarget.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/IconTransform.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/IconUser.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/IconX.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/IconZoomScan.js +0 -0
@@ -1,92 +1,242 @@
1
- import { getNodeDimensions, getBoundsOfRects, boxToRect } from '@xyflow/system';
2
- import { reduce, hasAtLeast } from 'remeda';
3
- import { setup, assign } from 'xstate';
4
- import { isSamePoint, bezierControlPoints } from '../../utils/xyflow.js';
1
+ import { deepEqual } from 'fast-equals';
2
+ import { last, map } from 'remeda';
3
+ import { setup, assign, assertEvent } from 'xstate';
4
+ import { createViewChange } from './createViewChange.js';
5
+ import { undoHotKeyActorLogic } from './hotkeyActor.js';
5
6
 
6
- const _syncManualLayoutActorLogic = setup({
7
+ const diagramActorRef = function(system) {
8
+ return system.get("diagram");
9
+ };
10
+ const syncManualLayout = setup({
7
11
  types: {
8
12
  context: {},
9
13
  input: {},
10
14
  events: {},
11
- tags: ""
15
+ tags: "",
16
+ children: {}
12
17
  },
13
18
  delays: {
14
19
  "timeout": 2e3
15
20
  },
16
- actions: {
17
- "trigger:OnChange": (_, _params) => {
21
+ guards: {
22
+ "can undo": ({ context }) => context.history.length > 0
23
+ },
24
+ actors: {
25
+ undoHotKeyActorLogic
26
+ }
27
+ });
28
+ const pushHistory = syncManualLayout.assign(({ context }) => {
29
+ const snapshot = context.beforeEditing;
30
+ if (!snapshot) {
31
+ return {};
32
+ }
33
+ const prevHistoryItem = last(context.history);
34
+ if (deepEqual(prevHistoryItem?.xyedges, snapshot.xyedges) && deepEqual(prevHistoryItem?.xynodes, snapshot.xynodes)) {
35
+ return {
36
+ beforeEditing: null
37
+ };
38
+ }
39
+ return {
40
+ beforeEditing: null,
41
+ history: [
42
+ ...context.history,
43
+ snapshot
44
+ ]
45
+ };
46
+ });
47
+ const popHistory = syncManualLayout.assign(({ context }) => {
48
+ if (context.history.length === 0) {
49
+ return {};
50
+ }
51
+ return {
52
+ history: context.history.slice(0, -1)
53
+ };
54
+ });
55
+ const startEditing = syncManualLayout.assign(({ system, event }) => {
56
+ assertEvent(event, "editing.start");
57
+ const parentContext = diagramActorRef(system).getSnapshot().context;
58
+ return {
59
+ editing: event.subject,
60
+ beforeEditing: {
61
+ xynodes: map(parentContext.xynodes, (n) => ({ ...n })),
62
+ xyedges: map(parentContext.xyedges, (e) => ({ ...e })),
63
+ change: createViewChange(parentContext),
64
+ view: parentContext.view,
65
+ synched: false
66
+ }
67
+ };
68
+ });
69
+ const ensureHotKey = syncManualLayout.enqueueActions(({ check, enqueue, self }) => {
70
+ const hasUndo = check("can undo");
71
+ const undoHotKey = self.getSnapshot().children["undoHotKey"];
72
+ if (undoHotKey && !hasUndo) {
73
+ enqueue.stopChild(undoHotKey);
74
+ return;
75
+ }
76
+ if (!undoHotKey && hasUndo) {
77
+ enqueue.spawnChild("undoHotKeyActorLogic", {
78
+ id: "undoHotKey"
79
+ });
80
+ }
81
+ });
82
+ const stopEditing = syncManualLayout.enqueueActions(({ event, enqueue }) => {
83
+ assertEvent(event, "editing.stop");
84
+ if (event.wasChanged) {
85
+ enqueue.cancel("sync");
86
+ enqueue(pushHistory);
87
+ enqueue.raise({ type: "sync" }, { id: "sync", delay: 50 });
88
+ }
89
+ enqueue.assign({
90
+ beforeEditing: null,
91
+ editing: null
92
+ });
93
+ });
94
+ const emitOnChange = syncManualLayout.sendTo(
95
+ ({ system }) => diagramActorRef(system),
96
+ ({ system }) => {
97
+ const parentContext = diagramActorRef(system).getSnapshot().context;
98
+ return {
99
+ type: "emit.onChange",
100
+ change: createViewChange(parentContext)
101
+ };
102
+ }
103
+ );
104
+ const markHistoryAsSynched = syncManualLayout.assign(({ context, event }) => {
105
+ assertEvent(event, "synced");
106
+ return {
107
+ history: context.history.map((i) => ({
108
+ ...i,
109
+ synched: true
110
+ })),
111
+ beforeEditing: context.beforeEditing ? {
112
+ ...context.beforeEditing,
113
+ synched: true
114
+ } : null
115
+ };
116
+ });
117
+ const undo = syncManualLayout.enqueueActions(({ context, enqueue, system }) => {
118
+ const lastHistoryItem = last(context.history);
119
+ if (!lastHistoryItem) {
120
+ return;
121
+ }
122
+ enqueue(popHistory);
123
+ enqueue(ensureHotKey);
124
+ const diagramActor = diagramActorRef(system);
125
+ enqueue.sendTo(diagramActor, {
126
+ type: "update.view",
127
+ view: lastHistoryItem.view,
128
+ xyedges: lastHistoryItem.xyedges,
129
+ xynodes: lastHistoryItem.xynodes
130
+ });
131
+ if (lastHistoryItem.synched) {
132
+ enqueue.sendTo(diagramActor, {
133
+ type: "emit.onChange",
134
+ change: lastHistoryItem.change
135
+ });
136
+ }
137
+ });
138
+ const idle = syncManualLayout.createStateConfig({
139
+ tags: "ready",
140
+ entry: [
141
+ assign({
142
+ beforeEditing: null,
143
+ editing: null
144
+ })
145
+ ],
146
+ on: {
147
+ sync: {
148
+ target: "pending"
149
+ },
150
+ "editing.start": {
151
+ actions: startEditing,
152
+ target: "editing"
153
+ },
154
+ undo: {
155
+ guard: "can undo",
156
+ actions: undo
157
+ }
158
+ }
159
+ });
160
+ const editing = syncManualLayout.createStateConfig({
161
+ on: {
162
+ "editing.stop": {
163
+ actions: [
164
+ stopEditing,
165
+ ensureHotKey
166
+ ],
167
+ target: "idle"
168
+ },
169
+ undo: {}
170
+ }
171
+ });
172
+ const pending = syncManualLayout.createStateConfig({
173
+ tags: "pending",
174
+ on: {
175
+ sync: {
176
+ target: "pending",
177
+ reenter: true
178
+ },
179
+ "editing.start": {
180
+ target: "paused",
181
+ actions: startEditing
182
+ },
183
+ undo: {
184
+ guard: "can undo",
185
+ actions: undo,
186
+ target: "idle"
18
187
  }
19
188
  },
20
- guards: {
21
- "same view": ({ context }) => context.parent.getSnapshot().context.view.id === context.viewId
189
+ after: {
190
+ "timeout": {
191
+ target: "idle",
192
+ actions: emitOnChange
193
+ }
22
194
  }
23
- }).createMachine({
195
+ });
196
+ const paused = syncManualLayout.createStateConfig({
197
+ tags: "pending",
198
+ on: {
199
+ "editing.stop": {
200
+ actions: [
201
+ stopEditing,
202
+ ensureHotKey
203
+ ],
204
+ target: "pending"
205
+ },
206
+ undo: {}
207
+ }
208
+ });
209
+ const _syncManualLayoutActorLogic = syncManualLayout.createMachine({
24
210
  initial: "idle",
25
211
  context: ({ input }) => ({
26
- ...input
212
+ ...input,
213
+ history: [],
214
+ beforeEditing: null,
215
+ editing: null
27
216
  }),
28
217
  states: {
29
- idle: {
30
- tags: "ready",
31
- on: {
32
- sync: {
33
- target: "pending"
34
- }
35
- }
36
- },
37
- paused: {
38
- tags: "pending",
39
- on: {
40
- sync: {
41
- target: "pending"
42
- }
43
- }
44
- },
45
- pending: {
46
- tags: "pending",
47
- on: {
48
- sync: {
49
- target: "pending",
50
- reenter: true
51
- },
52
- cancel: {
53
- target: "paused"
54
- }
55
- },
56
- after: {
57
- "timeout": [{
58
- guard: "same view",
59
- actions: {
60
- type: "trigger:OnChange",
61
- params: ({ context }) => {
62
- const change = createViewChange(context.parent.getSnapshot().context);
63
- return { change };
64
- }
65
- },
66
- target: "synced"
67
- }, {
68
- target: "stopped"
69
- }]
70
- }
71
- },
72
- synced: {
73
- tags: "ready",
74
- on: {
75
- sync: {
76
- target: "pending"
77
- }
78
- }
79
- },
80
- "stopped": {
81
- entry: assign({
82
- parent: null
83
- }),
218
+ idle,
219
+ editing,
220
+ pending,
221
+ paused,
222
+ stopped: {
223
+ entry: [
224
+ assign({
225
+ beforeEditing: null,
226
+ history: []
227
+ }),
228
+ ensureHotKey
229
+ ],
84
230
  type: "final"
85
231
  }
86
232
  },
87
233
  on: {
234
+ cancel: {
235
+ target: ".idle"
236
+ },
88
237
  synced: {
89
- target: ".synced"
238
+ actions: markHistoryAsSynched,
239
+ target: ".idle"
90
240
  },
91
241
  stop: {
92
242
  target: ".stopped"
@@ -94,80 +244,5 @@ const _syncManualLayoutActorLogic = setup({
94
244
  }
95
245
  });
96
246
  const syncManualLayoutActorLogic = _syncManualLayoutActorLogic;
97
- function createViewChange(parentContext) {
98
- const { view, xystore, xyflow } = parentContext;
99
- const { nodeLookup } = xystore.getState();
100
- const movedNodes = /* @__PURE__ */ new Set();
101
- let bounds;
102
- const nodes = reduce([...nodeLookup.values()], (acc, node) => {
103
- const dimensions = getNodeDimensions(node);
104
- if (!isSamePoint(node.internals.positionAbsolute, node.data) || node.initialWidth !== dimensions.width || node.initialHeight !== dimensions.height) {
105
- movedNodes.add(node.id);
106
- }
107
- const rect = acc[node.id] = {
108
- isCompound: node.type !== "element" && node.type !== "deployment",
109
- x: Math.floor(node.internals.positionAbsolute.x),
110
- y: Math.floor(node.internals.positionAbsolute.y),
111
- width: Math.ceil(dimensions.width),
112
- height: Math.ceil(dimensions.height)
113
- };
114
- bounds = bounds ? getBoundsOfRects(bounds, rect) : rect;
115
- return acc;
116
- }, {});
117
- const edges = reduce(xyflow?.getEdges() ?? [], (acc, { source, target, data }) => {
118
- let controlPoints = data.controlPoints ?? [];
119
- const sourceOrTargetMoved = movedNodes.has(source) || movedNodes.has(target);
120
- if (controlPoints.length === 0 && sourceOrTargetMoved) {
121
- controlPoints = bezierControlPoints(data);
122
- }
123
- if (data.points.length === 0 && controlPoints.length === 0) {
124
- return acc;
125
- }
126
- const _updated = acc[data.id] = {
127
- points: data.points
128
- };
129
- if (data.labelXY && data.labelBBox) {
130
- _updated.labelBBox = {
131
- ...data.labelBBox,
132
- ...data.labelXY
133
- };
134
- }
135
- if (data.labelBBox) {
136
- _updated.labelBBox ??= data.labelBBox;
137
- }
138
- if (hasAtLeast(controlPoints, 1)) {
139
- _updated.controlPoints = controlPoints;
140
- }
141
- const allX = [
142
- ...data.points.map((p) => p[0]),
143
- ...controlPoints.map((p) => p.x),
144
- ..._updated.labelBBox ? [_updated.labelBBox.x, _updated.labelBBox.x + _updated.labelBBox.width] : []
145
- ];
146
- const allY = [
147
- ...data.points.map((p) => p[1]),
148
- ...controlPoints.map((p) => p.y),
149
- ..._updated.labelBBox ? [_updated.labelBBox.y, _updated.labelBBox.y + _updated.labelBBox.height] : []
150
- ];
151
- const rect = boxToRect({
152
- x: Math.floor(Math.min(...allX)),
153
- y: Math.floor(Math.min(...allY)),
154
- x2: Math.ceil(Math.max(...allX)),
155
- y2: Math.ceil(Math.max(...allY))
156
- });
157
- bounds = bounds ? getBoundsOfRects(bounds, rect) : rect;
158
- return acc;
159
- }, {});
160
- bounds ??= view.bounds;
161
- return {
162
- op: "save-manual-layout",
163
- layout: {
164
- hash: view.hash,
165
- autoLayout: view.autoLayout,
166
- nodes,
167
- edges,
168
- ...bounds
169
- }
170
- };
171
- }
172
247
 
173
248
  export { syncManualLayoutActorLogic };
@@ -1,13 +1,14 @@
1
1
  import { ActorRefFromLogic, ActorSystem, EventFromLogic, SnapshotFrom } from 'xstate';
2
2
  import { OverlaysActorRef } from '../../overlays/overlaysActor';
3
3
  import { SearchActorRef } from '../../search/searchActor';
4
- import { DiagramMachineLogic } from './diagram-machine';
5
- import { SyncLayoutActorLogic } from './syncManualLayoutActor';
4
+ import { DiagramMachineLogic } from './machine';
5
+ import { SyncLayoutActorRef } from './syncManualLayoutActor';
6
6
  export type System = ActorSystem<{
7
7
  actors: {
8
8
  diagram: ActorRefFromLogic<DiagramMachineLogic>;
9
9
  overlays: OverlaysActorRef;
10
10
  search: SearchActorRef;
11
+ syncLayout: SyncLayoutActorRef;
11
12
  };
12
13
  }>;
13
14
  export interface DiagramActorRef extends ActorRefFromLogic<DiagramMachineLogic> {
@@ -15,8 +16,4 @@ export interface DiagramActorRef extends ActorRefFromLogic<DiagramMachineLogic>
15
16
  }
16
17
  export type DiagramActorSnapshot = SnapshotFrom<DiagramMachineLogic>;
17
18
  export type DiagramActorEvent = EventFromLogic<DiagramMachineLogic>;
18
- export type { Context as DiagramContext, EmittedEvents as DiagramEmittedEvents, } from './diagram-machine';
19
- export type SyncLayoutActorRef = Omit<ActorRefFromLogic<SyncLayoutActorLogic>, 'system'> & {
20
- system: System;
21
- };
22
- export type SyncLayoutActorSnapshot = SnapshotFrom<SyncLayoutActorLogic>;
19
+ export type { Context as DiagramContext, EmittedEvents as DiagramEmittedEvents, } from './machine.setup';
@@ -2,11 +2,13 @@ import { DiagramEdge, DiagramNode, BBox } from '@likec4/core/types';
2
2
  import { ActorSystem } from 'xstate';
3
3
  import { OverlaysActorRef } from '../../overlays/overlaysActor';
4
4
  import { SearchActorRef } from '../../search/searchActor';
5
- import { Context } from './diagram-machine';
5
+ import { Context } from './machine.setup';
6
+ import { SyncLayoutActorRef } from './syncManualLayoutActor';
6
7
  import { DiagramActorRef } from './types';
7
8
  export declare function typedSystem(system: ActorSystem<any>): {
9
+ readonly syncLayoutActorRef: SyncLayoutActorRef | null;
8
10
  readonly overlaysActorRef: OverlaysActorRef | null;
9
- readonly diagramActorRef: DiagramActorRef | null;
11
+ readonly diagramActorRef: DiagramActorRef;
10
12
  readonly searchActorRef: SearchActorRef | null;
11
13
  };
12
14
  export declare function findDiagramNode(ctx: Context, xynodeId: string): DiagramNode | null;
@@ -4,11 +4,14 @@ import { getNodesBounds, getNodeDimensions, getEdgePosition } from '@xyflow/syst
4
4
 
5
5
  function typedSystem(system) {
6
6
  return {
7
+ get syncLayoutActorRef() {
8
+ return system.get("syncLayout") ?? null;
9
+ },
7
10
  get overlaysActorRef() {
8
11
  return system.get("overlays") ?? null;
9
12
  },
10
13
  get diagramActorRef() {
11
- return system.get("diagram") ?? null;
14
+ return nonNullable(system.get("diagram"), "Diagram actor not found");
12
15
  },
13
16
  get searchActorRef() {
14
17
  return system.get("search") ?? null;
@@ -1,4 +1,4 @@
1
- import { BBox, DeploymentFqn, DiagramEdge, DiagramNode, ExclusiveUnion, Fqn, IconUrl, RichTextOrEmpty, ViewId } from '@likec4/core/types';
1
+ import { BBox, DeploymentFqn, DiagramEdge, DiagramEdgeDriftReason, DiagramNode, DiagramNodeDriftReason, ExclusiveUnion, Fqn, IconUrl, NonEmptyReadonlyArray, RichTextOrEmpty, ViewId } from '@likec4/core/types';
2
2
  import { XYPosition } from '@xyflow/system';
3
3
  import { FunctionComponent } from 'react';
4
4
  import { Simplify } from 'type-fest';
@@ -24,6 +24,7 @@ export declare namespace Types {
24
24
  * If set - this node has navigation to another view and diagram has handler for this
25
25
  */
26
26
  navigateTo: ViewId | null;
27
+ drifts: NonEmptyReadonlyArray<DiagramNodeDriftReason> | null;
27
28
  }>;
28
29
  /**
29
30
  * Represents element from deployment model
@@ -32,6 +33,7 @@ export declare namespace Types {
32
33
  navigateTo: ViewId | null;
33
34
  deploymentFqn: DeploymentFqn;
34
35
  modelFqn: Fqn | null;
36
+ drifts: NonEmptyReadonlyArray<DiagramNodeDriftReason> | null;
35
37
  }>;
36
38
  type SequenceActorNodePort = {
37
39
  id: string;
@@ -65,6 +67,7 @@ export declare namespace Types {
65
67
  * If set - this node has navigation to another view and diagram has handler for this
66
68
  */
67
69
  navigateTo: ViewId | null;
70
+ drifts: NonEmptyReadonlyArray<DiagramNodeDriftReason> | null;
68
71
  }>;
69
72
  type CompoundDeploymentNodeData = Simplify<CompoundNodeData & {
70
73
  deploymentFqn: DeploymentFqn;
@@ -76,6 +79,7 @@ export declare namespace Types {
76
79
  * If set - this node has navigation to another view and diagram has handler for this
77
80
  */
78
81
  navigateTo: ViewId | null;
82
+ drifts: NonEmptyReadonlyArray<DiagramNodeDriftReason> | null;
79
83
  }>;
80
84
  type ViewGroupNodeData = Simplify<CompoundNodeData & {
81
85
  isViewGroup: true;
@@ -106,6 +110,7 @@ export declare namespace Types {
106
110
  notes: RichTextOrEmpty;
107
111
  labelXY: XYPosition | null;
108
112
  controlPoints: XYPosition[] | undefined | null;
113
+ drifts: NonEmptyReadonlyArray<DiagramEdgeDriftReason> | null;
109
114
  }>;
110
115
  type SequenceStepEdgeData = Simplify<BaseEdgeData & NonOptional<Pick<DiagramEdge, 'id' | 'label' | 'technology' | 'points' | 'dir' | 'color' | 'line' | 'head' | 'tail' | 'navigateTo' | 'astPath'>> & {
111
116
  notes: RichTextOrEmpty;
@@ -0,0 +1,2 @@
1
+ import { MemoExoticComponent } from 'react';
2
+ export declare const LayoutDriftFrame: MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
@@ -0,0 +1,66 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { css } from '@likec4/styles/css';
3
+ import { Box } from '@likec4/styles/jsx';
4
+ import { hstack } from '@likec4/styles/patterns';
5
+ import { UnstyledButton } from '@mantine/core';
6
+ import { memo } from 'react';
7
+ import { useDiagramCompareLayout } from '../../hooks/useDiagramCompareLayout.js';
8
+
9
+ const LayoutDriftFrame = memo(() => {
10
+ const [{ layout, isActive }, { toggleCompare }] = useDiagramCompareLayout();
11
+ const bgColor = layout === "manual" ? "var(--mantine-color-orange-6)" : "var(--mantine-color-green-6)";
12
+ return /* @__PURE__ */ jsx(
13
+ Box,
14
+ {
15
+ className: hstack({
16
+ position: "absolute",
17
+ top: "0",
18
+ left: "0",
19
+ width: "full",
20
+ height: "full",
21
+ border: `default`,
22
+ borderWidth: 4,
23
+ pointerEvents: "none",
24
+ alignItems: "flex-start",
25
+ justifyContent: "center"
26
+ }),
27
+ style: {
28
+ zIndex: "9999",
29
+ display: !isActive ? "none" : void 0,
30
+ borderColor: bgColor
31
+ },
32
+ children: /* @__PURE__ */ jsx(
33
+ Btn,
34
+ {
35
+ style: {
36
+ backgroundColor: bgColor
37
+ },
38
+ onClick: (e) => {
39
+ e.stopPropagation();
40
+ toggleCompare();
41
+ },
42
+ children: "Close compare"
43
+ }
44
+ )
45
+ }
46
+ );
47
+ });
48
+ const Btn = UnstyledButton.withProps({
49
+ className: css({
50
+ fontSize: "xs",
51
+ fontWeight: "medium",
52
+ py: "1.5",
53
+ lineHeight: "1",
54
+ borderBottomLeftRadius: "sm",
55
+ borderBottomRightRadius: "sm",
56
+ transform: "translateY(-4px)",
57
+ px: "4",
58
+ color: "mantine.colors.gray[9]",
59
+ pointerEvents: "all",
60
+ _active: {
61
+ transform: "translateY(-3px)"
62
+ }
63
+ })
64
+ });
65
+
66
+ export { LayoutDriftFrame };
@@ -1 +1,2 @@
1
+ export { LayoutDriftFrame } from './LayoutDriftFrame';
1
2
  export { NotationPanel } from './notation/NotationPanel';
@@ -5,13 +5,14 @@ import { useLocalStorage } from '@mantine/hooks';
5
5
  import { AnimatePresence, m } from 'motion/react';
6
6
  import { memo, useState } from 'react';
7
7
  import { ceil, isNonNullish } from 'remeda';
8
- import { useDiagramContext, useDiagram } from '../../../hooks/useDiagram.js';
8
+ import { useDiagramContext } from '../../../hooks/useDiagram.js';
9
9
  import { useXYStore } from '../../../hooks/useXYFlow.js';
10
10
  import { container, icon, card, tabPanel, shapeBadge, elementNotation } from './NotationPanel.css.js';
11
11
  import { useMantinePortalProps } from '../../../hooks/useMantinePortalProps.js';
12
- import IconAlertTriangle from '../../../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertTriangle.js';
13
- import IconHelpCircle from '../../../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconHelpCircle.js';
14
- import IconArrowDownRight from '../../../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowDownRight.js';
12
+ import IconAlertTriangle from '../../../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.2.0/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertTriangle.js';
13
+ import IconHelpCircle from '../../../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.2.0/node_modules/@tabler/icons-react/dist/esm/icons/IconHelpCircle.js';
14
+ import IconArrowDownRight from '../../../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.2.0/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowDownRight.js';
15
+ import { useDiagram } from '../../../hooks/safeContext.js';
15
16
  import { ElementShape } from '../../../base-primitives/element/ElementShape.js';
16
17
 
17
18
  const ElementNotation = ({ value }) => {
@@ -112,16 +113,13 @@ const ElementNotation = ({ value }) => {
112
113
  };
113
114
  const selector = (s) => ({
114
115
  id: s.view.id,
115
- notations: s.view.notation?.nodes ?? [],
116
- isVisible: true
117
- // isVisible: isNullish(s.focusedNodeId ?? s.activeWalkthrough),
116
+ notations: s.view.notation?.nodes ?? []
118
117
  });
119
118
  const NotationPanel = memo(() => {
120
119
  const height = useXYStore((s) => s.height);
121
120
  const {
122
121
  id,
123
- notations,
124
- isVisible
122
+ notations
125
123
  } = useDiagramContext(selector);
126
124
  const [isCollapsed, setCollapsed] = useLocalStorage({
127
125
  key: "notation-webview-collapsed",
@@ -130,7 +128,7 @@ const NotationPanel = memo(() => {
130
128
  const hasNotations = notations.length > 0;
131
129
  const portalProps = useMantinePortalProps();
132
130
  return /* @__PURE__ */ jsxs(AnimatePresence, { children: [
133
- !hasNotations && isVisible && /* @__PURE__ */ jsx(
131
+ !hasNotations && /* @__PURE__ */ jsx(
134
132
  m.div,
135
133
  {
136
134
  initial: { opacity: 0.75, translateX: "50%" },
@@ -153,7 +151,7 @@ const NotationPanel = memo(() => {
153
151
  },
154
152
  "empty"
155
153
  ),
156
- hasNotations && isVisible && isCollapsed && /* @__PURE__ */ jsx(
154
+ hasNotations && isCollapsed && /* @__PURE__ */ jsx(
157
155
  m.div,
158
156
  {
159
157
  initial: { opacity: 0.75, translateX: "50%" },
@@ -177,7 +175,7 @@ const NotationPanel = memo(() => {
177
175
  },
178
176
  "collapsed"
179
177
  ),
180
- hasNotations && isVisible && !isCollapsed && /* @__PURE__ */ jsx(
178
+ hasNotations && !isCollapsed && /* @__PURE__ */ jsx(
181
179
  m.div,
182
180
  {
183
181
  initial: {
@@ -4,21 +4,26 @@ import { XYStoreApi } from '../hooks';
4
4
  import { Types } from './types';
5
5
  type InternalNode = RFInternalNode<Types.AnyNode>;
6
6
  declare abstract class Rect {
7
- static readonly LeftPadding = 40;
8
- static readonly RightPadding = 40;
9
- static readonly TopPadding = 55;
10
- static readonly BottomPadding = 40;
7
+ static readonly LeftPadding = 42;
8
+ static readonly RightPadding = 42;
9
+ static readonly TopPadding = 60;
10
+ static readonly BottomPadding = 42;
11
11
  id: string;
12
12
  minX: number;
13
13
  minY: number;
14
14
  maxX: number;
15
15
  maxY: number;
16
+ readonly initialX: number;
17
+ readonly initialY: number;
16
18
  get positionAbsolute(): XYPosition;
19
+ get initialPositionAbsolute(): XYPosition;
17
20
  set positionAbsolute(pos: XYPosition);
18
21
  get dimensions(): {
19
22
  width: number;
20
23
  height: number;
21
24
  };
25
+ get diff(): XYPosition;
26
+ get isMoved(): boolean;
22
27
  get position(): XYPosition;
23
28
  protected abstract parent: CompoundRect | null;
24
29
  constructor(xynode: InternalNode, parent?: CompoundRect | null);
@@ -34,8 +39,8 @@ declare class Leaf extends Rect {
34
39
  }
35
40
  export declare function createLayoutConstraints(xyflowApi: XYStoreApi, editingNodeIds: NonEmptyArray<string>): {
36
41
  rects: ReadonlyMap<string, Leaf | CompoundRect>;
37
- updateXYFlowNodes: () => void;
38
42
  onMove: () => void;
43
+ updateXYFlow: () => void;
39
44
  };
40
45
  type LayoutConstraints = {
41
46
  onNodeDragStart: OnNodeDrag<Types.Node>;