@likec4/diagram 1.44.0 → 1.46.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 (270) hide show
  1. package/bundle/index.js +18847 -17876
  2. package/dist/LikeC4Diagram.d.ts +1 -1
  3. package/dist/LikeC4Diagram.js +15 -12
  4. package/dist/LikeC4Diagram.props.d.ts +13 -20
  5. package/dist/LikeC4ProjectsProvider.js +8 -4
  6. package/dist/LikeC4Styles.js +0 -3
  7. package/dist/LikeC4View.d.ts +3 -3
  8. package/dist/LikeC4View.js +8 -8
  9. package/dist/ReactLikeC4.d.ts +3 -6
  10. package/dist/StaticLikeC4Diagram.js +0 -2
  11. package/dist/base/Base.d.ts +1 -1
  12. package/dist/base/updateEdges.js +25 -15
  13. package/dist/base/updateNodes.d.ts +14 -0
  14. package/dist/base/updateNodes.js +51 -18
  15. package/dist/base-primitives/Markdown.d.ts +30 -4
  16. package/dist/base-primitives/Markdown.js +3 -2
  17. package/dist/base-primitives/NodeHandles.d.ts +2 -1
  18. package/dist/base-primitives/NodeHandles.js +22 -18
  19. package/dist/base-primitives/compound/CompoundActionButton.d.ts +3 -2
  20. package/dist/base-primitives/compound/CompoundActionButton.js +1 -1
  21. package/dist/base-primitives/compound/CompoundDetailsButton.d.ts +3 -2
  22. package/dist/base-primitives/compound/CompoundDetailsButton.js +1 -1
  23. package/dist/base-primitives/edge/EdgeActionButton.d.ts +3 -2
  24. package/dist/base-primitives/edge/EdgeActionButton.js +1 -1
  25. package/dist/base-primitives/edge/EdgeContainer.d.ts +1 -1
  26. package/dist/base-primitives/edge/EdgeContainer.js +6 -4
  27. package/dist/base-primitives/edge/EdgeLabel.d.ts +2 -2
  28. package/dist/base-primitives/edge/EdgeLabel.js +16 -16
  29. package/dist/base-primitives/edge/EdgeLabelContainer.d.ts +1 -1
  30. package/dist/base-primitives/edge/EdgeLabelContainer.js +5 -4
  31. package/dist/base-primitives/edge/EdgePath.js +27 -12
  32. package/dist/base-primitives/element/ElementActionButtons.d.ts +3 -2
  33. package/dist/base-primitives/element/ElementActionButtons.js +3 -3
  34. package/dist/base-primitives/element/ElementData.d.ts +3 -3
  35. package/dist/base-primitives/element/ElementData.js +13 -7
  36. package/dist/base-primitives/element/ElementDetailsButton.d.ts +3 -2
  37. package/dist/base-primitives/element/ElementDetailsButton.js +4 -1
  38. package/dist/base-primitives/element/ElementShape.js +5 -5
  39. package/dist/base-primitives/element/ElementTags.d.ts +6 -4
  40. package/dist/components/ErrorFallback.js +1 -1
  41. package/dist/components/Link.js +2 -2
  42. package/dist/context/DiagramEventHandlers.js +0 -1
  43. package/dist/context/DiagramFeatures.d.ts +2 -1
  44. package/dist/context/DiagramFeatures.js +1 -0
  45. package/dist/context/EnsureMantine.js +2 -1
  46. package/dist/context/IconRenderer.js +6 -6
  47. package/dist/context/TagStylesContext.js +1 -1
  48. package/dist/custom/hooks.d.ts +2 -2
  49. package/dist/custom/index.js +1 -1
  50. package/dist/editor/LikeC4EditorProvider.d.ts +22 -0
  51. package/dist/editor/LikeC4EditorProvider.js +12 -0
  52. package/dist/editor/__tests__/fixture.d.ts +205 -0
  53. package/dist/editor/applyChangesToManualLayout.d.ts +8 -0
  54. package/dist/editor/applyChangesToManualLayout.js +182 -0
  55. package/dist/editor/editorActor.actions.d.ts +201 -0
  56. package/dist/editor/editorActor.actions.js +149 -0
  57. package/dist/editor/editorActor.d.ts +653 -0
  58. package/dist/editor/editorActor.js +324 -0
  59. package/dist/editor/hotkeyActor.d.ts +7 -0
  60. package/dist/editor/hotkeyActor.js +19 -0
  61. package/dist/editor/index.d.ts +3 -2
  62. package/dist/editor/useEditorActorLogic.d.ts +565 -0
  63. package/dist/editor/useEditorActorLogic.js +54 -0
  64. package/dist/hooks/index.d.ts +2 -1
  65. package/dist/hooks/safeContext.d.ts +3 -2
  66. package/dist/hooks/safeContext.js +7 -4
  67. package/dist/hooks/useDiagram.d.ts +4 -2
  68. package/dist/hooks/useDiagram.js +19 -8
  69. package/dist/hooks/useDiagramCompareLayout.d.ts +8 -0
  70. package/dist/hooks/useDiagramCompareLayout.js +29 -4
  71. package/dist/hooks/useLikeC4Project.d.ts +6 -1
  72. package/dist/hooks/useLikeC4Project.js +14 -2
  73. package/dist/hooks/useMediaPrint.d.ts +6 -0
  74. package/dist/index.d.ts +1 -0
  75. package/dist/index.js +1 -0
  76. package/dist/likec4diagram/DiagramXYFlow.js +11 -7
  77. package/dist/likec4diagram/custom/edges/EdgeDrifts.d.ts +6 -0
  78. package/dist/likec4diagram/custom/edges/EdgeDrifts.js +34 -0
  79. package/dist/likec4diagram/custom/edges/RelationshipEdge.js +90 -54
  80. package/dist/likec4diagram/custom/edges/SequenceStepEdge.js +3 -1
  81. package/dist/likec4diagram/custom/edges/edges.css.d.ts +0 -1
  82. package/dist/likec4diagram/custom/edges/edges.css.js +30 -24
  83. package/dist/likec4diagram/custom/edges/useControlPoints.js +5 -5
  84. package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.js +5 -5
  85. package/dist/likec4diagram/custom/nodes/ElementActions.js +2 -2
  86. package/dist/likec4diagram/custom/nodes/NodeDrifts.d.ts +6 -0
  87. package/dist/likec4diagram/custom/nodes/{ElementNodeDrifts.js → NodeDrifts.js} +12 -13
  88. package/dist/likec4diagram/custom/nodes/SequenceActorNode.js +4 -2
  89. package/dist/likec4diagram/custom/nodes/index.d.ts +1 -0
  90. package/dist/likec4diagram/custom/nodes/nodes.js +61 -23
  91. package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.js +2 -2
  92. package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +2 -2
  93. package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +128 -15
  94. package/dist/likec4diagram/relationship-popover/actor.d.ts +1 -1
  95. package/dist/likec4diagram/state/DiagramActorProvider.d.ts +2 -2
  96. package/dist/likec4diagram/state/DiagramActorProvider.js +63 -72
  97. package/dist/likec4diagram/state/assign.d.ts +14 -7
  98. package/dist/likec4diagram/state/assign.js +28 -200
  99. package/dist/likec4diagram/state/createViewChange.js +23 -30
  100. package/dist/likec4diagram/state/diagram-api.d.ts +20 -6
  101. package/dist/likec4diagram/state/diagram-api.js +58 -52
  102. package/dist/likec4diagram/state/hotkeyActor.d.ts +1 -8
  103. package/dist/likec4diagram/state/hotkeyActor.js +13 -17
  104. package/dist/likec4diagram/state/machine.actions.d.ts +1127 -864
  105. package/dist/likec4diagram/state/machine.actions.js +316 -296
  106. package/dist/likec4diagram/state/machine.actions.layout.d.ts +641 -0
  107. package/dist/likec4diagram/state/machine.actions.layout.js +141 -0
  108. package/dist/likec4diagram/state/machine.d.ts +18 -3712
  109. package/dist/likec4diagram/state/machine.js +64 -73
  110. package/dist/likec4diagram/state/machine.setup.d.ts +80 -26
  111. package/dist/likec4diagram/state/machine.setup.js +44 -7
  112. package/dist/likec4diagram/state/machine.state.initializing.d.ts +58 -17
  113. package/dist/likec4diagram/state/machine.state.initializing.js +14 -14
  114. package/dist/likec4diagram/state/machine.state.navigating.d.ts +5 -108
  115. package/dist/likec4diagram/state/machine.state.navigating.js +187 -35
  116. package/dist/likec4diagram/state/machine.state.ready.d.ts +2997 -2598
  117. package/dist/likec4diagram/state/machine.state.ready.focused.d.ts +710 -0
  118. package/dist/likec4diagram/state/machine.state.ready.focused.js +98 -0
  119. package/dist/likec4diagram/state/machine.state.ready.idle.d.ts +540 -0
  120. package/dist/likec4diagram/state/machine.state.ready.idle.js +105 -0
  121. package/dist/likec4diagram/state/machine.state.ready.js +95 -347
  122. package/dist/likec4diagram/state/machine.state.ready.printing.d.ts +140 -0
  123. package/dist/likec4diagram/state/machine.state.ready.printing.js +40 -0
  124. package/dist/likec4diagram/state/machine.state.ready.walkthrough.d.ts +684 -0
  125. package/dist/likec4diagram/state/machine.state.ready.walkthrough.js +190 -0
  126. package/dist/likec4diagram/state/mediaPrintActor.d.ts +12 -0
  127. package/dist/likec4diagram/state/mediaPrintActor.js +18 -0
  128. package/dist/likec4diagram/state/types.d.ts +11 -9
  129. package/dist/likec4diagram/state/utils.d.ts +44 -5
  130. package/dist/likec4diagram/state/utils.js +62 -6
  131. package/dist/likec4diagram/types.d.ts +8 -13
  132. package/dist/likec4diagram/ui/notation/NotationPanel.css.js +5 -2
  133. package/dist/likec4diagram/ui/notation/NotationPanel.js +3 -3
  134. package/dist/likec4diagram/useLayoutConstraints.js +104 -103
  135. package/dist/likec4diagram/xyflow-diagram/diagram-view.js +12 -15
  136. package/dist/likec4diagram/xyflow-sequence/sequence-layout.js +11 -8
  137. package/dist/navigationpanel/NavigationPanel.js +11 -10
  138. package/dist/navigationpanel/NavigationPanelDropdown.js +7 -7
  139. package/dist/navigationpanel/_common.js +1 -1
  140. package/dist/navigationpanel/actor.d.ts +4 -204
  141. package/dist/navigationpanel/actor.js +1 -1
  142. package/dist/navigationpanel/comparepanel/CompareActionsMenu.d.ts +3 -1
  143. package/dist/navigationpanel/comparepanel/CompareActionsMenu.js +40 -14
  144. package/dist/navigationpanel/comparepanel/ComparePanelControls.js +6 -4
  145. package/dist/navigationpanel/comparepanel/LayoutTypeSwitcher.js +2 -2
  146. package/dist/navigationpanel/controls/DetailsControls.js +2 -2
  147. package/dist/navigationpanel/controls/LayoutWarning.js +2 -1
  148. package/dist/navigationpanel/controls/NavigationButtons.js +2 -2
  149. package/dist/navigationpanel/controls/OpenSource.js +1 -1
  150. package/dist/navigationpanel/controls/SearchControl.js +2 -2
  151. package/dist/navigationpanel/controls/ToggleReadonly.js +32 -19
  152. package/dist/navigationpanel/dropdown/ProjectsMenu.js +1 -1
  153. package/dist/navigationpanel/editorpanel/CenterCamera.js +1 -1
  154. package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.js +1 -1
  155. package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.js +9 -9
  156. package/dist/navigationpanel/editorpanel/ToggleReadonly.js +1 -1
  157. package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +3 -3
  158. package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +9 -9
  159. package/dist/navigationpanel/walkthrough/DynamicViewControls.js +1 -1
  160. package/dist/navigationpanel/walkthrough/WalkthroughPanel.js +4 -3
  161. package/dist/overlays/Overlays.js +24 -12
  162. package/dist/overlays/element-details/ElementDetailsCard.css.js +3 -3
  163. package/dist/overlays/element-details/ElementDetailsCard.js +4 -4
  164. package/dist/overlays/element-details/MetadataValue.d.ts +2 -1
  165. package/dist/overlays/element-details/MetadataValue.js +4 -6
  166. package/dist/overlays/element-details/TabPanelDeployments.js +3 -3
  167. package/dist/overlays/element-details/TabPanelRelationships.js +12 -7
  168. package/dist/overlays/element-details/TabPanelStructure.js +1 -1
  169. package/dist/overlays/element-details/actor.d.ts +8 -83
  170. package/dist/overlays/element-details/actor.js +0 -8
  171. package/dist/overlays/overlay/Overlay.js +10 -10
  172. package/dist/overlays/overlaysActor.d.ts +7 -392
  173. package/dist/overlays/overlaysActor.js +73 -49
  174. package/dist/overlays/relationship-details/RelationshipDetails.js +3 -3
  175. package/dist/overlays/relationship-details/SelectEdge.js +2 -2
  176. package/dist/overlays/relationship-details/_types.d.ts +3 -4
  177. package/dist/overlays/relationship-details/actor.d.ts +6 -562
  178. package/dist/overlays/relationship-details/actor.js +1 -0
  179. package/dist/overlays/relationship-details/custom/ElementActions.js +3 -3
  180. package/dist/overlays/relationship-details/layout-to-xyflow.js +3 -5
  181. package/dist/overlays/relationship-details/layout.d.ts +3 -3
  182. package/dist/overlays/relationship-details/layout.js +4 -4
  183. package/dist/overlays/relationships-browser/RelationshipsBrowser.js +3 -3
  184. package/dist/overlays/relationships-browser/SelectElement.js +2 -2
  185. package/dist/overlays/relationships-browser/_types.d.ts +2 -3
  186. package/dist/overlays/relationships-browser/actor.d.ts +7 -739
  187. package/dist/overlays/relationships-browser/custom/ElementActions.js +3 -3
  188. package/dist/overlays/relationships-browser/layout.d.ts +2 -2
  189. package/dist/overlays/relationships-browser/layout.js +3 -3
  190. package/dist/overlays/relationships-browser/useViewToNodesEdges.js +0 -3
  191. package/dist/overlays/types.d.ts +12 -13
  192. package/dist/search/components/ElementsColumn.js +7 -3
  193. package/dist/search/components/PickView.js +3 -1
  194. package/dist/search/components/SearchByTags.js +1 -1
  195. package/dist/search/components/SearchInput.js +1 -1
  196. package/dist/search/components/ViewsColum.d.ts +3 -1
  197. package/dist/search/components/ViewsColum.js +13 -7
  198. package/dist/search/components/_shared.css.d.ts +1 -1
  199. package/dist/search/searchActor.d.ts +3 -66
  200. package/dist/shadowroot/ShadowRoot.d.ts +5 -7
  201. package/dist/shadowroot/ShadowRoot.js +7 -5
  202. package/dist/shadowroot/styles.css.js +6 -1
  203. package/dist/styles.css2.js +1 -1
  204. package/dist/utils/index.d.ts +2 -2
  205. package/dist/utils/view-bounds.js +7 -6
  206. package/dist/utils/xyflow.d.ts +6 -5
  207. package/dist/utils/xyflow.js +26 -57
  208. package/package.json +24 -23
  209. package/panda.buildinfo.json +65 -71
  210. package/styles-min.css +1 -1
  211. package/styles.css +1 -1
  212. package/dist/base-primitives/edge/edge.css.d.ts +0 -4
  213. package/dist/base-primitives/edge/edge.css.js +0 -71
  214. package/dist/editor/LikeC4EditorContext.d.ts +0 -21
  215. package/dist/likec4diagram/custom/nodes/ElementNodeDrifts.d.ts +0 -4
  216. package/dist/likec4diagram/state/syncManualLayoutActor.d.ts +0 -280
  217. package/dist/likec4diagram/state/syncManualLayoutActor.js +0 -248
  218. package/dist/utils/vector.d.ts +0 -81
  219. package/dist/utils/vector.js +0 -120
  220. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/createReactComponent.js +0 -0
  221. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.js +0 -0
  222. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertTriangle.js +0 -0
  223. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowDownRight.js +0 -0
  224. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowLeft.js +0 -0
  225. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowRight.js +0 -0
  226. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconBolt.js +0 -0
  227. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconBrowser.js +0 -0
  228. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.js +0 -0
  229. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronDown.js +0 -0
  230. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronLeft.js +0 -0
  231. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronRight.js +0 -0
  232. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.js +0 -0
  233. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconCylinder.js +0 -0
  234. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconDeviceMobile.js +0 -0
  235. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconDirectionSignFilled.js +0 -0
  236. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconExternalLink.js +0 -0
  237. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconFileSymlink.js +0 -0
  238. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconFocusCentered.js +0 -0
  239. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconFolderFilled.js +0 -0
  240. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconHelpCircle.js +0 -0
  241. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconId.js +0 -0
  242. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconInfoCircle.js +0 -0
  243. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignBottom.js +0 -0
  244. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignCenter.js +0 -0
  245. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignLeft.js +0 -0
  246. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignMiddle.js +0 -0
  247. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignRight.js +0 -0
  248. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignTop.js +0 -0
  249. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutBoardSplit.js +0 -0
  250. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutCollage.js +0 -0
  251. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutDashboard.js +0 -0
  252. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconLink.js +0 -0
  253. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconLock.js +0 -0
  254. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconLockOpen2.js +0 -0
  255. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerPlayFilled.js +0 -0
  256. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipBackFilled.js +0 -0
  257. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipForwardFilled.js +0 -0
  258. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerStopFilled.js +0 -0
  259. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconRectangularPrism.js +0 -0
  260. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconReorder.js +0 -0
  261. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconRouteOff.js +0 -0
  262. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconSearch.js +0 -0
  263. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconSelector.js +0 -0
  264. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconStack2.js +0 -0
  265. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconStarFilled.js +0 -0
  266. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconTarget.js +0 -0
  267. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconTransform.js +0 -0
  268. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconUser.js +0 -0
  269. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconX.js +0 -0
  270. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconZoomScan.js +0 -0
@@ -1,121 +1,18 @@
1
- import { BBox, invariant, nonNullable, nonexhaustive } from '@likec4/core';
2
- import { getViewportForBounds } from '@xyflow/react';
1
+ import { nonNullable, nonexhaustive, invariant } from '@likec4/core';
3
2
  import { nodeToRect } from '@xyflow/system';
4
- import { isNumber, isTruthy, hasAtLeast } from 'remeda';
3
+ import { produce } from 'immer';
4
+ import { hasAtLeast, isTruthy } from 'remeda';
5
5
  import { assertEvent } from 'xstate';
6
+ import { convertToXYFlow } from '../convert-to-xyflow.js';
6
7
  import { createLayoutConstraints } from '../useLayoutConstraints.js';
7
8
  import { getAligner, toNodeRect } from './aligners.js';
8
- import { mergeXYNodesEdges, resetEdgeControlPoints, updateActiveWalkthrough, focusNodesEdges } from './assign.js';
9
- import { createViewChange } from './createViewChange.js';
9
+ import { resetEdgeControlPoints, mergeXYNodesEdges, focusNodesEdges } from './assign.js';
10
+ import { setViewport, cancelFitDiagram, raiseFitDiagram } from './machine.actions.layout.js';
11
+ export { assignViewportBefore, fitDiagram, fitFocusedBounds, raiseSetViewport, raiseUpdateView, returnViewportBefore } from './machine.actions.layout.js';
10
12
  import { machine } from './machine.setup.js';
11
- import { typedSystem, activeSequenceBounds, focusedBounds, findDiagramEdge, findDiagramNode } from './utils.js';
12
- import { MinZoom } from '../../base/const.js';
13
+ import { typedSystem, findDiagramEdge, findDiagramNode } from './utils.js';
13
14
  import { Base } from '../../base/Base.js';
14
15
 
15
- function nodeRef(node) {
16
- switch (node.type) {
17
- case "element":
18
- case "compound-element":
19
- case "seq-actor":
20
- return node.data.modelFqn;
21
- case "deployment":
22
- case "compound-deployment":
23
- return node.data.modelFqn ?? node.data.deploymentFqn;
24
- case "seq-parallel":
25
- case "view-group":
26
- return null;
27
- default:
28
- nonexhaustive(node);
29
- }
30
- }
31
- function findCorrespondingNode(context, event) {
32
- const fromNodeId = context.lastOnNavigate?.fromNode;
33
- const fromNode = fromNodeId && context.xynodes.find((n) => n.id === fromNodeId);
34
- const fromRef = fromNode && nodeRef(fromNode);
35
- const toNode = fromRef && event.xynodes.find((n) => nodeRef(n) === fromRef);
36
- return { fromNode, toNode };
37
- }
38
- const trigger = {
39
- navigateTo: () => machine.emit(({ context }) => ({
40
- type: "navigateTo",
41
- viewId: nonNullable(context.lastOnNavigate, "Invalid state, lastOnNavigate is null").toView
42
- }))
43
- };
44
- const xyflow = {
45
- fitDiagram: (params) => machine.createAction(({ context, event }) => {
46
- params ??= event.type === "fitDiagram" ? event : {};
47
- const {
48
- bounds = context.view.bounds,
49
- duration = 450
50
- } = params;
51
- const { width, height, panZoom, transform } = nonNullable(context.xystore).getState();
52
- const maxZoom = Math.max(1, transform[2]);
53
- const viewport = getViewportForBounds(
54
- bounds,
55
- width,
56
- height,
57
- MinZoom,
58
- maxZoom,
59
- context.fitViewPadding
60
- );
61
- viewport.x = Math.round(viewport.x);
62
- viewport.y = Math.round(viewport.y);
63
- panZoom?.setViewport(viewport, duration > 0 ? { duration, interpolate: "smooth" } : void 0).catch(
64
- console.error
65
- );
66
- }),
67
- fitFocusedBounds: () => machine.createAction(({ context }) => {
68
- const isActiveSequenceWalkthrough = !!context.activeWalkthrough && context.dynamicViewVariant === "sequence";
69
- const { bounds, duration = 450 } = isActiveSequenceWalkthrough ? activeSequenceBounds({ context }) : focusedBounds({ context });
70
- const { width, height, panZoom, transform } = nonNullable(context.xystore).getState();
71
- const maxZoom = Math.max(1, transform[2]);
72
- const viewport = getViewportForBounds(
73
- bounds,
74
- width,
75
- height,
76
- MinZoom,
77
- maxZoom,
78
- context.fitViewPadding
79
- );
80
- viewport.x = Math.round(viewport.x);
81
- viewport.y = Math.round(viewport.y);
82
- panZoom?.setViewport(viewport, duration > 0 ? { duration, interpolate: "smooth" } : void 0);
83
- }),
84
- alignNodeFromToAfterNavigate: (params) => machine.createAction(({ context }) => {
85
- const xyflow2 = nonNullable(context.xyflow, "xyflow is not initialized");
86
- const elFrom = xyflow2.getInternalNode(params.fromNode);
87
- if (!elFrom) return;
88
- const fromPos = xyflow2.flowToScreenPosition({
89
- x: elFrom.internals.positionAbsolute.x,
90
- y: elFrom.internals.positionAbsolute.y
91
- }), toPos = xyflow2.flowToScreenPosition(params.toPosition), diff = {
92
- x: Math.round(fromPos.x - toPos.x),
93
- y: Math.round(fromPos.y - toPos.y)
94
- };
95
- context.xystore.getState().panBy(diff);
96
- }),
97
- setViewportCenter: (params) => machine.createAction(({ context, event }) => {
98
- let center;
99
- if (params) {
100
- center = params;
101
- } else if (event.type === "update.view") {
102
- center = BBox.center(event.view.bounds);
103
- } else {
104
- center = BBox.center(context.view.bounds);
105
- }
106
- invariant(context.xyflow, "xyflow is not initialized");
107
- const zoom = context.xyflow.getZoom();
108
- context.xyflow.setCenter(Math.round(center.x), Math.round(center.y), { zoom });
109
- }),
110
- setViewport: (params) => machine.createAction(({ context }) => {
111
- const {
112
- viewport,
113
- duration = 350
114
- } = params;
115
- const panZoom = context.xystore?.getState().panZoom;
116
- panZoom?.setViewport(viewport, duration > 0 ? { duration, interpolate: "smooth" } : void 0);
117
- })
118
- };
119
16
  const disableCompareWithLatest = () => machine.assign(({ context }) => {
120
17
  return {
121
18
  toggledFeatures: {
@@ -143,7 +40,7 @@ const onEdgeDoubleClick = () => machine.assign(({ context, event }) => {
143
40
  ...e.data,
144
41
  controlPoints,
145
42
  labelBBox: e.data.labelBBox ? { ...e.data.labelBBox, ...pt } : null,
146
- labelXY: e.data.labelXY ? pt : null
43
+ labelXY: null
147
44
  }
148
45
  };
149
46
  }
@@ -151,60 +48,6 @@ const onEdgeDoubleClick = () => machine.assign(({ context, event }) => {
151
48
  })
152
49
  };
153
50
  });
154
- const emitOnChange = () => machine.enqueueActions(({ event, enqueue }) => {
155
- assertEvent(event, "emit.onChange");
156
- enqueue.assign({
157
- viewportChangedManually: true
158
- });
159
- enqueue.emit({
160
- type: "onChange",
161
- change: event.change
162
- });
163
- });
164
- const emitOnLayoutTypeChange = () => machine.enqueueActions(({ event, system, context, enqueue }) => {
165
- if (!context.features.enableCompareWithLatest) {
166
- console.warn("Layout type cannot be changed while CompareWithLatest feature is disabled");
167
- return;
168
- }
169
- const currentLayoutType = context.view._layout;
170
- let nextLayoutType = currentLayoutType === "auto" ? "manual" : "auto";
171
- if (event.type === "emit.onLayoutTypeChange") {
172
- nextLayoutType = event.layoutType;
173
- }
174
- if (currentLayoutType === nextLayoutType) {
175
- console.warn("Ignoring layout type change event, layout type is already", currentLayoutType);
176
- return;
177
- }
178
- if (context.toggledFeatures.enableCompareWithLatest === true) {
179
- if (currentLayoutType === "manual" && nextLayoutType === "auto") {
180
- const syncLayoutActor = typedSystem(system).syncLayoutActorRef;
181
- const syncState = syncLayoutActor?.getSnapshot().value;
182
- const isPending = syncLayoutActor && (syncState === "pending" || syncState === "paused");
183
- if (isPending) {
184
- enqueue.sendTo(syncLayoutActor, { type: "cancel" });
185
- enqueue.emit({
186
- type: "onChange",
187
- change: createViewChange(context)
188
- });
189
- }
190
- }
191
- const currentViewport = context.viewport;
192
- if (currentLayoutType === "auto") {
193
- enqueue.assign({
194
- viewportOnAutoLayout: currentViewport
195
- });
196
- }
197
- if (currentLayoutType === "manual") {
198
- enqueue.assign({
199
- viewportOnManualLayout: currentViewport
200
- });
201
- }
202
- }
203
- enqueue.emit({
204
- type: "onLayoutTypeChange",
205
- layoutType: nextLayoutType
206
- });
207
- });
208
51
  const assignLastClickedNode = () => machine.assign(({ context, event }) => {
209
52
  assertEvent(event, "xyflow.nodeClick");
210
53
  const { lastClickedNode } = context;
@@ -227,18 +70,21 @@ const assignLastClickedNode = () => machine.assign(({ context, event }) => {
227
70
  });
228
71
  const assignFocusedNode = () => machine.assign(({ event }) => {
229
72
  let focusedNode;
73
+ let autoUnfocusTimer = false;
230
74
  switch (event.type) {
231
75
  case "xyflow.nodeClick":
232
76
  focusedNode = event.node.data.id;
233
77
  break;
234
78
  case "focus.node":
235
79
  focusedNode = event.nodeId;
80
+ autoUnfocusTimer = event.autoUnfocus === true;
236
81
  break;
237
82
  default:
238
83
  throw new Error(`Unexpected event type: ${event.type} in action 'assign: focusedNode'`);
239
84
  }
240
85
  return {
241
- focusedNode
86
+ focusedNode,
87
+ autoUnfocusTimer
242
88
  };
243
89
  });
244
90
  const resetLastClickedNode = () => machine.assign(() => ({
@@ -254,14 +100,47 @@ const updateInputs = () => machine.assign(({ event }) => {
254
100
  assertEvent(event, "update.inputs");
255
101
  return { ...event.inputs };
256
102
  });
257
- const updateXYNodesEdges = () => machine.assign(({ context, event }) => {
258
- assertEvent(event, "update.view");
259
- return {
260
- ...mergeXYNodesEdges({ context, event }),
261
- lastClickedNode: null
262
- };
103
+ const assignXYDataFromView = (view) => machine.assign(({ context, event }) => {
104
+ let xydata;
105
+ {
106
+ assertEvent(event, "update.view");
107
+ xydata = "xynodes" in event ? event : convertToXYFlow({
108
+ dynamicViewVariant: context.dynamicViewVariant,
109
+ view: event.view,
110
+ where: context.where
111
+ });
112
+ }
113
+ const update = mergeXYNodesEdges(context, xydata);
114
+ let { lastClickedNode, focusedNode, activeWalkthrough } = context;
115
+ if (lastClickedNode || focusedNode || activeWalkthrough) {
116
+ const nodeIds = new Set(update.xynodes.map((n) => n.id));
117
+ if (lastClickedNode && !nodeIds.has(lastClickedNode.id)) {
118
+ lastClickedNode = null;
119
+ }
120
+ if (focusedNode && !nodeIds.has(focusedNode)) {
121
+ focusedNode = null;
122
+ }
123
+ const stepId = activeWalkthrough?.stepId;
124
+ if (stepId && !update.xyedges.some((e) => e.id === stepId)) {
125
+ activeWalkthrough = null;
126
+ }
127
+ return {
128
+ ...update,
129
+ lastClickedNode,
130
+ focusedNode,
131
+ activeWalkthrough
132
+ };
133
+ }
134
+ return update;
135
+ });
136
+ const focusOnNodesAndEdges = () => machine.enqueueActions(({ context, enqueue }) => {
137
+ const next = focusNodesEdges(context);
138
+ if (next) {
139
+ enqueue.assign(next);
140
+ } else {
141
+ enqueue.raise({ type: "key.esc" });
142
+ }
263
143
  });
264
- const focusOnNodesAndEdges = () => machine.assign(focusNodesEdges);
265
144
  const undimEverything = () => machine.assign(({ context }) => ({
266
145
  xynodes: context.xynodes.map(Base.setDimmed(false)),
267
146
  xyedges: context.xyedges.map(Base.setData({
@@ -269,7 +148,6 @@ const undimEverything = () => machine.assign(({ context }) => ({
269
148
  active: false
270
149
  }))
271
150
  }));
272
- const updateActiveWalkthroughState = () => machine.assign(updateActiveWalkthrough);
273
151
  const assignDynamicViewVariant = () => machine.assign(({ event }) => {
274
152
  assertEvent(event, "switch.dynamicViewVariant");
275
153
  return {
@@ -306,9 +184,6 @@ const onNodeMouseLeave = (params) => machine.assign(({ context, event }) => {
306
184
  })
307
185
  };
308
186
  });
309
- const emitWalkthroughStopped = () => machine.emit(() => ({
310
- type: "walkthroughStopped"
311
- }));
312
187
  const emitPaneClick = () => machine.emit(() => ({
313
188
  type: "paneClick"
314
189
  }));
@@ -341,6 +216,10 @@ const emitNodeClick = () => machine.emit(({ context, event }) => {
341
216
  xynode: event.node
342
217
  };
343
218
  });
219
+ const emitNavigateTo = (params) => machine.emit(({ context }) => ({
220
+ type: "navigateTo",
221
+ viewId: params?.viewId ?? nonNullable(context.lastOnNavigate, "Invalid state, lastOnNavigate is null").toView
222
+ }));
344
223
  const emitEdgeClick = () => machine.emit(({ context, event }) => {
345
224
  assertEvent(event, "xyflow.edgeClick");
346
225
  const edge = nonNullable(findDiagramEdge(context, event.edge.id), `Edge ${event.edge.id} not found in diagram`);
@@ -350,21 +229,59 @@ const emitEdgeClick = () => machine.emit(({ context, event }) => {
350
229
  xyedge: event.edge
351
230
  };
352
231
  });
353
- const emitWalkthroughStarted = () => machine.emit(({ context }) => {
354
- const edge = context.xyedges.find((x) => x.id === context.activeWalkthrough?.stepId);
355
- invariant(edge, "Invalid walkthrough state");
356
- return {
357
- type: "walkthroughStarted",
358
- edge
359
- };
232
+ const triggerChange = (viewChange) => machine.enqueueActions(({ event, enqueue }) => {
233
+ let change = viewChange;
234
+ if (!change) {
235
+ assertEvent(event, "trigger.change");
236
+ change = event.change;
237
+ }
238
+ enqueue.assign({
239
+ viewportChangedManually: true
240
+ });
241
+ enqueue.sendTo(
242
+ typedSystem.editorActor,
243
+ {
244
+ type: "change",
245
+ change
246
+ }
247
+ );
360
248
  });
361
- const emitWalkthroughStep = () => machine.emit(({ context }) => {
362
- const edge = context.xyedges.find((x) => x.id === context.activeWalkthrough?.stepId);
363
- invariant(edge, "Invalid walkthrough state");
364
- return {
365
- type: "walkthroughStep",
366
- edge
367
- };
249
+ const emitOnLayoutTypeChange = () => machine.enqueueActions(({ event, system, context, enqueue }) => {
250
+ if (!context.features.enableCompareWithLatest) {
251
+ console.warn("Layout type cannot be changed while CompareWithLatest feature is disabled");
252
+ return;
253
+ }
254
+ const currentLayoutType = context.view._layout;
255
+ let nextLayoutType = currentLayoutType === "auto" ? "manual" : "auto";
256
+ if (event.type === "emit.onLayoutTypeChange") {
257
+ nextLayoutType = event.layoutType;
258
+ }
259
+ if (currentLayoutType === nextLayoutType) {
260
+ console.warn("Ignoring layout type change event, layout type is already", currentLayoutType);
261
+ return;
262
+ }
263
+ if (context.toggledFeatures.enableCompareWithLatest === true) {
264
+ if (currentLayoutType === "manual" && nextLayoutType === "auto") {
265
+ typedSystem(system).editorActorRef?.send({
266
+ type: "cancel"
267
+ });
268
+ }
269
+ const currentViewport = context.viewport;
270
+ if (currentLayoutType === "auto") {
271
+ enqueue.assign({
272
+ viewportOnAutoLayout: currentViewport
273
+ });
274
+ }
275
+ if (currentLayoutType === "manual") {
276
+ enqueue.assign({
277
+ viewportOnManualLayout: currentViewport
278
+ });
279
+ }
280
+ }
281
+ enqueue.emit({
282
+ type: "onLayoutTypeChange",
283
+ layoutType: nextLayoutType
284
+ });
368
285
  });
369
286
  const layoutAlign = (params) => machine.createAction(({ context, event }) => {
370
287
  let mode;
@@ -416,26 +333,20 @@ const resetEdgesControlPoints = () => machine.assign(({ context }) => {
416
333
  })
417
334
  };
418
335
  });
419
- const notationsHighlight = (params) => machine.assign(({ context, event }) => {
420
- if (!params) {
421
- assertEvent(event, "notations.highlight");
422
- params = {
423
- ...event
424
- };
425
- }
426
- const notation = params.notation;
427
- const kinds = params.kind ? [params.kind] : notation.kinds;
336
+ const notationsHighlight = () => machine.assign(({ context, event }) => {
337
+ assertEvent(event, "notations.highlight");
338
+ const { notation, kind } = event;
339
+ const targetKinds = kind ? [kind] : notation.kinds;
340
+ const shouldHighlight = (node) => node.notation === notation.title && node.shape === notation.shape && node.color === notation.color && targetKinds.includes(node.kind);
428
341
  const xynodes = context.xynodes.map((n) => {
429
342
  const node = findDiagramNode(context, n.id);
430
- if (node && node.notation === notation.title && node.shape === notation.shape && node.color === notation.color && kinds.includes(node.kind)) {
431
- return Base.setDimmed(n, false);
432
- }
433
- return Base.setDimmed(n, "immediate");
343
+ const highlighted = node && shouldHighlight(node);
344
+ return Base.setDimmed(n, highlighted ? false : "immediate");
434
345
  });
435
- return {
436
- xynodes,
437
- xyedges: context.xyedges.map(Base.setDimmed("immediate"))
438
- };
346
+ const xyedges = context.xyedges.map((edge) => {
347
+ return Base.setDimmed(edge, true);
348
+ });
349
+ return { xynodes, xyedges };
439
350
  });
440
351
  const tagHighlight = () => machine.assign(({ context, event }) => {
441
352
  assertEvent(event, "tag.highlight");
@@ -448,7 +359,7 @@ const tagHighlight = () => machine.assign(({ context, event }) => {
448
359
  })
449
360
  };
450
361
  });
451
- const toggleFeature = () => machine.assign(({ context, event }) => {
362
+ const assignToggledFeatures = () => machine.assign(({ context, event }) => {
452
363
  assertEvent(event, "toggle.feature");
453
364
  const currentValue = context.toggledFeatures[`enable${event.feature}`] ?? context.features[`enable${event.feature}`];
454
365
  const nextValue = event.forceValue ?? !currentValue;
@@ -460,57 +371,68 @@ const toggleFeature = () => machine.assign(({ context, event }) => {
460
371
  };
461
372
  });
462
373
  const closeSearch = () => machine.sendTo(
463
- ({ system }) => typedSystem(system).searchActorRef,
374
+ typedSystem.searchActor,
464
375
  {
465
376
  type: "close"
466
377
  }
467
378
  );
468
379
  const closeAllOverlays = () => machine.sendTo(
469
- ({ system }) => typedSystem(system).overlaysActorRef,
380
+ typedSystem.overlaysActor,
470
381
  {
471
382
  type: "close.all"
472
383
  }
473
384
  );
474
- const isReadOnly = (context) => context.features.enableReadOnly || context.toggledFeatures.enableReadOnly === true;
475
- const stopSyncLayout = () => machine.enqueueActions(({ enqueue, system }) => {
476
- const syncLayoutActor = typedSystem(system).syncLayoutActorRef;
477
- if (!syncLayoutActor) return;
478
- enqueue.stopChild(syncLayoutActor);
479
- });
480
- const ensureSyncLayout = () => machine.enqueueActions(({ context, enqueue, system }) => {
481
- const syncLayoutActor = typedSystem(system).syncLayoutActorRef;
482
- if (isReadOnly(context)) {
483
- if (syncLayoutActor) {
484
- enqueue.stopChild(syncLayoutActor);
485
- }
385
+ const stopEditorActor = () => machine.enqueueActions(({ enqueue, system }) => {
386
+ const actor = typedSystem(system).editorActorRef;
387
+ if (!actor) return;
388
+ enqueue.stopChild(actor);
389
+ });
390
+ const ensureEditorActor = () => machine.enqueueActions(({ enqueue, context, system, check }) => {
391
+ const hasEditor = check("enabled: Editor");
392
+ const editor = typedSystem(system).editorActorRef;
393
+ if (!hasEditor && editor) {
394
+ enqueue.stopChild(editor);
486
395
  return;
487
396
  }
488
- if (syncLayoutActor) return;
489
- enqueue.spawnChild("syncManualLayoutActorLogic", {
490
- id: "syncLayout",
491
- systemId: "syncLayout",
492
- input: {
493
- viewId: context.view.id
494
- },
495
- syncSnapshot: true
496
- });
397
+ if (hasEditor && !editor) {
398
+ enqueue.spawnChild("editorActor", {
399
+ id: "editor",
400
+ systemId: "editor",
401
+ input: {
402
+ viewId: context.view.id
403
+ },
404
+ syncSnapshot: true
405
+ });
406
+ }
497
407
  });
498
408
  const startEditing = (subject = "node") => machine.sendTo(
499
- ({ system }) => typedSystem(system).syncLayoutActorRef,
409
+ typedSystem.editorActor,
500
410
  {
501
- type: "editing.start",
411
+ type: "edit.start",
502
412
  subject
503
413
  }
504
414
  );
415
+ const sendSynced = () => machine.sendTo(
416
+ typedSystem.editorActor,
417
+ {
418
+ type: "synced"
419
+ }
420
+ );
505
421
  const stopEditing = (wasChanged = true) => machine.sendTo(
506
- ({ system }) => typedSystem(system).syncLayoutActorRef,
422
+ typedSystem.editorActor,
507
423
  {
508
- type: "editing.stop",
424
+ type: "edit.finish",
509
425
  wasChanged
510
426
  }
511
427
  );
428
+ const cancelEditing = () => machine.sendTo(
429
+ typedSystem.editorActor,
430
+ {
431
+ type: "cancel"
432
+ }
433
+ );
512
434
  const hasModelFqn = (node) => "modelFqn" in node.data && isTruthy(node.data.modelFqn);
513
- const openElementDetails = (params) => machine.enqueueActions(({ context, event, enqueue, system }) => {
435
+ const openElementDetails = (params) => machine.enqueueActions(({ context, event, enqueue }) => {
514
436
  let initiatedFrom = null;
515
437
  let fromNodeId, subject;
516
438
  switch (true) {
@@ -564,7 +486,7 @@ const openElementDetails = (params) => machine.enqueueActions(({ context, event,
564
486
  };
565
487
  }
566
488
  enqueue.sendTo(
567
- typedSystem(system).overlaysActorRef,
489
+ typedSystem.overlaysActor,
568
490
  {
569
491
  type: "open.elementDetails",
570
492
  subject,
@@ -573,6 +495,47 @@ const openElementDetails = (params) => machine.enqueueActions(({ context, event,
573
495
  }
574
496
  );
575
497
  });
498
+ const openOverlay = () => machine.enqueueActions(({ context, event, enqueue, check }) => {
499
+ assertEvent(event, ["open.relationshipsBrowser", "open.relationshipDetails", "open.elementDetails"]);
500
+ if (!check("enabled: Overlays")) {
501
+ console.warn("Overlays feature is disabled");
502
+ return;
503
+ }
504
+ switch (event.type) {
505
+ case "open.elementDetails": {
506
+ check("enabled: ElementDetails") ? enqueue(openElementDetails()) : console.warn("ElementDetails feature is disabled");
507
+ break;
508
+ }
509
+ case "open.relationshipsBrowser": {
510
+ enqueue.sendTo(
511
+ typedSystem.overlaysActor,
512
+ {
513
+ type: "open.relationshipsBrowser",
514
+ subject: event.fqn,
515
+ viewId: context.view.id,
516
+ scope: "view",
517
+ closeable: true,
518
+ enableChangeScope: true,
519
+ enableSelectSubject: true
520
+ }
521
+ );
522
+ break;
523
+ }
524
+ case "open.relationshipDetails": {
525
+ enqueue.sendTo(
526
+ typedSystem.overlaysActor,
527
+ {
528
+ type: "open.relationshipDetails",
529
+ viewId: context.view.id,
530
+ ...event.params
531
+ }
532
+ );
533
+ break;
534
+ }
535
+ default:
536
+ nonexhaustive(event);
537
+ }
538
+ });
576
539
  const openSourceOfFocusedOrLastClickedNode = () => machine.enqueueActions(({ context, enqueue }) => {
577
540
  const nodeId = context.focusedNode ?? context.lastClickedNode?.id;
578
541
  if (!nodeId || !context.features.enableVscode) return;
@@ -584,8 +547,8 @@ const openSourceOfFocusedOrLastClickedNode = () => machine.enqueueActions(({ con
584
547
  enqueue.raise({ type: "open.source", element: diagramNode.modelRef });
585
548
  }
586
549
  });
587
- const ensureOverlaysActorState = () => machine.enqueueActions(({ enqueue, context: { features }, system }) => {
588
- const enableOverlays = features.enableElementDetails || features.enableRelationshipDetails || features.enableRelationshipBrowser;
550
+ const ensureOverlaysActor = () => machine.enqueueActions(({ enqueue, check, system }) => {
551
+ const enableOverlays = check("enabled: Overlays");
589
552
  const hasRunning = typedSystem(system).overlaysActorRef;
590
553
  if (enableOverlays && !hasRunning) {
591
554
  enqueue.spawnChild("overlaysActorLogic", { id: "overlays", systemId: "overlays" });
@@ -598,7 +561,7 @@ const ensureOverlaysActorState = () => machine.enqueueActions(({ enqueue, contex
598
561
  enqueue.stopChild("overlays");
599
562
  }
600
563
  });
601
- const ensureSearchActorState = () => machine.enqueueActions(({ enqueue, context: { features: { enableSearch } }, system }) => {
564
+ const ensureSearchActor = () => machine.enqueueActions(({ enqueue, context: { features: { enableSearch } }, system }) => {
602
565
  const hasRunning = typedSystem(system).searchActorRef;
603
566
  if (enableSearch && !hasRunning) {
604
567
  enqueue.spawnChild("searchActorLogic", { id: "search", systemId: "search" });
@@ -647,63 +610,121 @@ const onEdgeMouseLeave = () => machine.enqueueActions(({ enqueue, context, event
647
610
  event: event.event
648
611
  });
649
612
  });
650
- const cancelFitDiagram = () => machine.cancel("fitDiagram");
651
- const raiseFitDiagram = (params) => machine.enqueueActions(({ enqueue }) => {
652
- enqueue.cancel("fitDiagram");
653
- enqueue.raise(
654
- {
655
- type: "fitDiagram",
656
- ...isNumber(params?.duration) ? { duration: params.duration } : {}
657
- },
658
- {
659
- id: "fitDiagram",
660
- ...isNumber(params?.delay) ? { delay: params.delay } : {}
613
+ const startHotKeyActor = () => machine.spawnChild("hotkeyActorLogic", { id: "hotkey" });
614
+ const stopHotKeyActor = () => machine.stopChild("hotkey");
615
+ const AUTO_UNFOCUS_DELAY = 3e3;
616
+ const startAutoUnfocusTimer = () => machine.enqueueActions(({ context, enqueue }) => {
617
+ if (context.autoUnfocusTimer && AUTO_UNFOCUS_DELAY > 0) {
618
+ enqueue.raise({ type: "focus.autoUnfocus" }, { delay: AUTO_UNFOCUS_DELAY, id: "autoUnfocusTimer" });
619
+ }
620
+ });
621
+ const cancelAutoUnfocusTimer = () => machine.cancel("autoUnfocusTimer");
622
+ const handleNavigate = () => machine.enqueueActions(({ enqueue, context, event }) => {
623
+ assertEvent(event, ["navigate.to", "navigate.back", "navigate.forward"]);
624
+ const {
625
+ view,
626
+ focusedNode,
627
+ activeWalkthrough,
628
+ dynamicViewVariant,
629
+ viewport,
630
+ viewportChangedManually,
631
+ viewportBefore,
632
+ navigationHistory: {
633
+ currentIndex,
634
+ history: _history
661
635
  }
662
- );
636
+ } = context;
637
+ let history = [..._history];
638
+ if (currentIndex < _history.length) {
639
+ const updatedEntry = produce(_history[currentIndex], (draft) => {
640
+ draft.viewport = { ...viewport };
641
+ draft.viewportChangedManually = viewportChangedManually;
642
+ draft.focusedNode = focusedNode;
643
+ if (view._type === "dynamic") {
644
+ draft.activeWalkthrough = activeWalkthrough?.stepId ?? null;
645
+ draft.dynamicViewVariant = dynamicViewVariant;
646
+ } else {
647
+ draft.activeWalkthrough = null;
648
+ draft.dynamicViewVariant = null;
649
+ }
650
+ if (viewportBefore) {
651
+ draft.viewportBefore = viewportBefore;
652
+ } else {
653
+ delete draft.viewportBefore;
654
+ }
655
+ });
656
+ history = [..._history];
657
+ history[currentIndex] = updatedEntry;
658
+ }
659
+ switch (event.type) {
660
+ case "navigate.to": {
661
+ enqueue.assign({
662
+ navigationHistory: {
663
+ currentIndex,
664
+ history
665
+ },
666
+ lastOnNavigate: {
667
+ fromView: context.view.id,
668
+ toView: event.viewId,
669
+ fromNode: event.fromNode ?? null,
670
+ focusOnElement: event.focusOnElement ?? null
671
+ }
672
+ });
673
+ enqueue(emitNavigateTo());
674
+ break;
675
+ }
676
+ case "navigate.back": {
677
+ invariant(currentIndex > 0, "Cannot navigate back");
678
+ const stepBack = history[currentIndex - 1];
679
+ enqueue.assign({
680
+ navigationHistory: {
681
+ currentIndex: currentIndex - 1,
682
+ history
683
+ },
684
+ lastOnNavigate: null
685
+ });
686
+ enqueue(emitNavigateTo({ viewId: stepBack.viewId }));
687
+ break;
688
+ }
689
+ case "navigate.forward": {
690
+ invariant(currentIndex < history.length - 1, "Cannot navigate forward");
691
+ const stepForward = history[currentIndex + 1];
692
+ enqueue.assign({
693
+ navigationHistory: {
694
+ currentIndex: currentIndex + 1,
695
+ history
696
+ },
697
+ lastOnNavigate: null
698
+ });
699
+ enqueue(emitNavigateTo({ viewId: stepForward.viewId }));
700
+ break;
701
+ }
702
+ default:
703
+ nonexhaustive(event);
704
+ }
663
705
  });
664
706
  const updateView = () => machine.enqueueActions(
665
- ({ enqueue, event, check, context, system }) => {
666
- assertEvent(event, "update.view");
667
- const isAnotherView = check("is another view");
668
- enqueue(cancelFitDiagram());
707
+ ({ enqueue, event, context }) => {
708
+ if (event.type !== "update.view") {
709
+ console.warn(`Ignoring unexpected event type: ${event.type} in action 'update.view'`);
710
+ return;
711
+ }
712
+ const nextView = event.view;
713
+ const isAnotherView = nextView.id !== context.view.id;
669
714
  if (isAnotherView) {
670
- enqueue(stopSyncLayout());
671
- enqueue(closeAllOverlays());
672
- enqueue(closeSearch());
673
- enqueue.assign({
674
- focusedNode: null
675
- });
676
- enqueue(disableCompareWithLatest());
677
- const { fromNode, toNode } = findCorrespondingNode(context, event);
678
- if (fromNode && toNode) {
679
- enqueue(xyflow.alignNodeFromToAfterNavigate({
680
- fromNode: fromNode.id,
681
- toPosition: {
682
- x: toNode.data.x,
683
- y: toNode.data.y
684
- }
685
- }));
686
- enqueue(raiseFitDiagram({ delay: 80 }));
687
- } else {
688
- enqueue(
689
- xyflow.setViewportCenter()
690
- );
691
- enqueue(raiseFitDiagram({ duration: 200, delay: 25 }));
692
- }
693
- enqueue(updateXYNodesEdges());
694
- enqueue(ensureSyncLayout());
715
+ console.warn("updateView called for another view - ignoring", { event });
695
716
  return;
696
717
  }
697
- enqueue(updateXYNodesEdges());
698
- const syncLayoutActor = typedSystem(system).syncLayoutActorRef;
699
- if (syncLayoutActor) {
700
- enqueue.sendTo(syncLayoutActor, { type: "synced" });
718
+ enqueue(assignXYDataFromView());
719
+ if (event.source === "editor") {
720
+ return;
701
721
  }
702
- const nextView = event.view;
722
+ enqueue(sendSynced());
723
+ let recenter = !context.viewportChangedManually && !context.focusedNode && !context.activeWalkthrough;
703
724
  if (context.toggledFeatures.enableCompareWithLatest === true && context.view._layout !== nextView._layout) {
704
725
  if (nextView._layout === "auto" && context.viewportOnAutoLayout) {
705
726
  enqueue(
706
- xyflow.setViewport({
727
+ setViewport({
707
728
  viewport: context.viewportOnAutoLayout,
708
729
  duration: 0
709
730
  })
@@ -712,7 +733,7 @@ const updateView = () => machine.enqueueActions(
712
733
  }
713
734
  if (nextView._layout === "manual" && context.viewportOnManualLayout) {
714
735
  enqueue(
715
- xyflow.setViewport({
736
+ setViewport({
716
737
  viewport: context.viewportOnManualLayout,
717
738
  duration: 0
718
739
  })
@@ -720,16 +741,15 @@ const updateView = () => machine.enqueueActions(
720
741
  return;
721
742
  }
722
743
  }
723
- let recenter = !context.viewportChangedManually;
724
744
  recenter = recenter || nextView._type === "dynamic" && context.view._type === "dynamic" && nextView.variant !== context.view.variant;
725
745
  recenter = recenter || context.toggledFeatures.enableCompareWithLatest === true && !!nextView._layout && context.view._layout !== nextView._layout;
726
746
  if (recenter) {
727
- enqueue(
728
- xyflow.setViewportCenter(BBox.center(nextView.bounds))
729
- );
730
- enqueue(raiseFitDiagram({ delay: 50 }));
747
+ enqueue(cancelFitDiagram());
748
+ enqueue(raiseFitDiagram({
749
+ bounds: event.view.bounds
750
+ }));
731
751
  }
732
752
  }
733
753
  );
734
754
 
735
- export { assignDynamicViewVariant, assignFocusedNode, assignLastClickedNode, cancelFitDiagram, closeAllOverlays, closeSearch, disableCompareWithLatest, emitEdgeClick, emitInitialized, emitNodeClick, emitOnChange, emitOnLayoutTypeChange, emitOpenSource, emitPaneClick, emitWalkthroughStarted, emitWalkthroughStep, emitWalkthroughStopped, ensureOverlaysActorState, ensureSearchActorState, ensureSyncLayout, findCorrespondingNode, focusOnNodesAndEdges, layoutAlign, nodeRef, notationsHighlight, onEdgeDoubleClick, onEdgeMouseEnter, onEdgeMouseLeave, onNodeMouseEnter, onNodeMouseLeave, openElementDetails, openSourceOfFocusedOrLastClickedNode, raiseFitDiagram, resetEdgesControlPoints, resetLastClickedNode, startEditing, stopEditing, stopSyncLayout, tagHighlight, toggleFeature, trigger, undimEverything, updateActiveWalkthroughState, updateFeatures, updateInputs, updateView, updateXYNodesEdges, xyflow };
755
+ export { assignDynamicViewVariant, assignFocusedNode, assignLastClickedNode, assignToggledFeatures, assignXYDataFromView, cancelAutoUnfocusTimer, cancelEditing, cancelFitDiagram, closeAllOverlays, closeSearch, disableCompareWithLatest, emitEdgeClick, emitInitialized, emitNavigateTo, emitNodeClick, emitOnLayoutTypeChange, emitOpenSource, emitPaneClick, ensureEditorActor, ensureOverlaysActor, ensureSearchActor, focusOnNodesAndEdges, handleNavigate, layoutAlign, notationsHighlight, onEdgeDoubleClick, onEdgeMouseEnter, onEdgeMouseLeave, onNodeMouseEnter, onNodeMouseLeave, openElementDetails, openOverlay, openSourceOfFocusedOrLastClickedNode, raiseFitDiagram, resetEdgesControlPoints, resetLastClickedNode, sendSynced, setViewport, startAutoUnfocusTimer, startEditing, startHotKeyActor, stopEditing, stopEditorActor, stopHotKeyActor, tagHighlight, triggerChange, undimEverything, updateFeatures, updateInputs, updateView };