@likec4/diagram 1.46.4 → 1.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (337) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -1
  3. package/bundle/index.js +7332 -5799
  4. package/dist/LikeC4Diagram.d.ts +1 -1
  5. package/dist/LikeC4Diagram.js +20 -14
  6. package/dist/LikeC4Diagram.props.d.ts +2 -6
  7. package/dist/LikeC4ProjectsOverview.d.ts +7 -0
  8. package/dist/LikeC4ProjectsOverview.js +32 -0
  9. package/dist/LikeC4ProjectsProvider.js +7 -5
  10. package/dist/LikeC4Styles.d.ts +2 -6
  11. package/dist/LikeC4Styles.js +44 -43
  12. package/dist/LikeC4View.d.ts +9 -1
  13. package/dist/LikeC4View.js +10 -8
  14. package/dist/ReactLikeC4.d.ts +12 -2
  15. package/dist/ReactLikeC4.js +5 -3
  16. package/dist/adhoc-editor/ActorProvider.d.ts +7 -0
  17. package/dist/adhoc-editor/ActorProvider.js +41 -0
  18. package/dist/adhoc-editor/EditorNavigationPanel.d.ts +1 -0
  19. package/dist/adhoc-editor/EditorNavigationPanel.js +32 -0
  20. package/dist/adhoc-editor/LikeC4AdHocViewEditor.d.ts +4 -0
  21. package/dist/adhoc-editor/LikeC4AdHocViewEditor.js +71 -0
  22. package/dist/adhoc-editor/SelectElementOverlay.d.ts +1 -0
  23. package/dist/adhoc-editor/SelectElementOverlay.js +124 -0
  24. package/dist/adhoc-editor/actor.d.ts +131 -0
  25. package/dist/adhoc-editor/actor.editor.d.ts +54 -0
  26. package/dist/adhoc-editor/actor.editor.js +96 -0
  27. package/dist/adhoc-editor/actor.js +20 -0
  28. package/dist/adhoc-editor/actor.layouter.d.ts +48 -0
  29. package/dist/adhoc-editor/actor.layouter.js +66 -0
  30. package/dist/adhoc-editor/actor.types.d.ts +57 -0
  31. package/dist/adhoc-editor/actor.types.js +22 -0
  32. package/dist/adhoc-editor/hooks.d.ts +14 -0
  33. package/dist/adhoc-editor/hooks.js +47 -0
  34. package/dist/adhoc-editor/index.d.ts +2 -0
  35. package/dist/adhoc-editor/viewrules/ViewRulesPanel.d.ts +6 -0
  36. package/dist/adhoc-editor/viewrules/ViewRulesPanel.js +104 -0
  37. package/dist/base/const.d.ts +1 -0
  38. package/dist/base/const.js +2 -1
  39. package/dist/base/updateEdges.js +26 -3
  40. package/dist/base/updateNodes.js +8 -5
  41. package/dist/base-primitives/Markdown.js +1 -1
  42. package/dist/base-primitives/NodeHandles.d.ts +4 -2
  43. package/dist/base-primitives/NodeHandles.js +46 -19
  44. package/dist/base-primitives/compound/CompoundActionButton.js +3 -1
  45. package/dist/base-primitives/compound/CompoundDetailsButton.js +3 -1
  46. package/dist/base-primitives/compound/CompoundNodeContainer.d.ts +4 -3
  47. package/dist/base-primitives/compound/CompoundNodeContainer.js +6 -4
  48. package/dist/base-primitives/compound/CompoundTitle.js +1 -2
  49. package/dist/base-primitives/edge/EdgeActionButton.js +1 -1
  50. package/dist/base-primitives/edge/EdgeContainer.js +5 -2
  51. package/dist/base-primitives/edge/EdgeLabelContainer.js +5 -1
  52. package/dist/base-primitives/element/ElementActionButtons.js +31 -58
  53. package/dist/base-primitives/element/ElementData.d.ts +7 -7
  54. package/dist/base-primitives/element/ElementData.js +61 -48
  55. package/dist/base-primitives/element/ElementDetailsButton.js +2 -1
  56. package/dist/base-primitives/element/ElementNodeContainer.d.ts +2 -2
  57. package/dist/base-primitives/element/ElementNodeContainer.js +3 -3
  58. package/dist/base-primitives/element/ElementShape.js +109 -20
  59. package/dist/base-primitives/element/ElementTags.d.ts +6 -2
  60. package/dist/base-primitives/element/ElementTags.js +55 -32
  61. package/dist/base-primitives/index.d.ts +1 -1
  62. package/dist/base-primitives/memoEdge.js +1 -1
  63. package/dist/base-primitives/memoNode.js +1 -1
  64. package/dist/components/ErrorFallback.js +1 -1
  65. package/dist/components/Link.js +2 -2
  66. package/dist/components/Logo.js +1 -1
  67. package/dist/components/NavigationPanel.d.ts +11 -0
  68. package/dist/components/NavigationPanel.js +50 -0
  69. package/dist/components/RootContainer.js +5 -8
  70. package/dist/context/DefaultMantineProvider.d.ts +2 -0
  71. package/dist/context/DefaultMantineProvider.js +66 -0
  72. package/dist/context/DiagramEventHandlers.js +1 -1
  73. package/dist/context/DiagramFeatures.js +12 -11
  74. package/dist/context/EnsureMantine.d.ts +0 -3
  75. package/dist/context/EnsureMantine.js +3 -4
  76. package/dist/context/IconRenderer.d.ts +14 -0
  77. package/dist/context/IconRenderer.js +11 -8
  78. package/dist/context/TagStylesContext.js +12 -4
  79. package/dist/custom/hooks.d.ts +2 -2
  80. package/dist/custom/index.d.ts +1 -1
  81. package/dist/custom/index.js +2 -2
  82. package/dist/editor/LikeC4EditorCallbacks.d.ts +18 -0
  83. package/dist/editor/LikeC4EditorCallbacks.js +5 -0
  84. package/dist/editor/LikeC4EditorProvider.d.ts +30 -18
  85. package/dist/editor/LikeC4EditorProvider.js +2 -2
  86. package/dist/editor/applyChangesToManualLayout.js +1 -0
  87. package/dist/editor/editorActor.actions.d.ts +25 -25
  88. package/dist/editor/editorActor.actions.js +2 -2
  89. package/dist/editor/editorActor.setup.d.ts +84 -0
  90. package/dist/editor/editorActor.setup.js +38 -0
  91. package/dist/editor/editorActor.states.d.ts +9 -0
  92. package/dist/editor/{editorActor.js → editorActor.states.js} +22 -64
  93. package/dist/editor/index.d.ts +4 -3
  94. package/dist/editor/useEditorActorLogic.d.ts +2 -564
  95. package/dist/editor/useEditorActorLogic.js +8 -12
  96. package/dist/hooks/index.d.ts +1 -1
  97. package/dist/hooks/useCallbackRef.d.ts +6 -0
  98. package/dist/hooks/useCurrentViewModel.d.ts +10 -0
  99. package/dist/hooks/useDiagram.js +2 -2
  100. package/dist/hooks/useDiagramCompareLayout.d.ts +1 -1
  101. package/dist/hooks/useDiagramCompareLayout.js +1 -1
  102. package/dist/hooks/useLikeC4ElementsTree.js +1 -1
  103. package/dist/hooks/useLikeC4Model.js +2 -2
  104. package/dist/hooks/useLikeC4Project.js +10 -2
  105. package/dist/hooks/useLikeC4Styles.js +0 -3
  106. package/dist/hooks/useSetState.d.ts +6 -1
  107. package/dist/hooks/useSetState.js +7 -4
  108. package/dist/hooks/useXYFlow.d.ts +7 -1
  109. package/dist/hooks/useXYFlow.js +4 -4
  110. package/dist/index.d.ts +9 -5
  111. package/dist/index.js +6 -3
  112. package/dist/likec4diagram/DiagramUI.js +1 -3
  113. package/dist/likec4diagram/DiagramXYFlow.js +26 -12
  114. package/dist/likec4diagram/convert-to-xyflow.d.ts +2 -1
  115. package/dist/likec4diagram/convert-to-xyflow.js +2 -6
  116. package/dist/likec4diagram/custom/edges/RelationshipEdge.js +13 -14
  117. package/dist/likec4diagram/custom/edges/useControlPoints.js +3 -3
  118. package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.d.ts +3 -0
  119. package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.js +68 -35
  120. package/dist/likec4diagram/custom/nodes/ElementActions.d.ts +1 -2
  121. package/dist/likec4diagram/custom/nodes/ElementActions.js +7 -10
  122. package/dist/likec4diagram/custom/nodes/SequenceActorNode.js +7 -5
  123. package/dist/likec4diagram/custom/nodes/nodes.js +25 -6
  124. package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +8 -7
  125. package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +1 -38
  126. package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.d.ts +6 -1
  127. package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.js +35 -19
  128. package/dist/likec4diagram/custom/nodes/toolbar/Toolbar.js +9 -5
  129. package/dist/likec4diagram/custom/nodes/toolbar/_shared.d.ts +6 -1
  130. package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +46 -10
  131. package/dist/likec4diagram/custom/nodes/toolbar/styles.css.js +2 -2
  132. package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +15 -15
  133. package/dist/likec4diagram/relationship-popover/components.d.ts +7 -0
  134. package/dist/likec4diagram/relationship-popover/components.js +39 -0
  135. package/dist/likec4diagram/state/DiagramActorProvider.d.ts +4 -3
  136. package/dist/likec4diagram/state/DiagramActorProvider.js +14 -15
  137. package/dist/likec4diagram/state/assign.d.ts +1 -1
  138. package/dist/likec4diagram/state/createViewChange.js +16 -4
  139. package/dist/likec4diagram/state/machine.actions.d.ts +65 -0
  140. package/dist/likec4diagram/state/machine.actions.js +51 -39
  141. package/dist/likec4diagram/state/machine.actions.layout.d.ts +22 -2
  142. package/dist/likec4diagram/state/machine.actions.layout.js +32 -14
  143. package/dist/likec4diagram/state/machine.d.ts +1 -1
  144. package/dist/likec4diagram/state/machine.js +31 -30
  145. package/dist/likec4diagram/state/machine.setup.d.ts +21 -5
  146. package/dist/likec4diagram/state/machine.setup.js +13 -4
  147. package/dist/likec4diagram/state/machine.state.initializing.d.ts +32 -2
  148. package/dist/likec4diagram/state/machine.state.navigating.d.ts +1 -1
  149. package/dist/likec4diagram/state/machine.state.navigating.js +81 -49
  150. package/dist/likec4diagram/state/machine.state.ready.d.ts +508 -582
  151. package/dist/likec4diagram/state/machine.state.ready.focused.d.ts +17 -148
  152. package/dist/likec4diagram/state/machine.state.ready.focused.js +6 -14
  153. package/dist/likec4diagram/state/machine.state.ready.idle.d.ts +11 -96
  154. package/dist/likec4diagram/state/machine.state.ready.idle.js +7 -12
  155. package/dist/likec4diagram/state/machine.state.ready.js +80 -69
  156. package/dist/likec4diagram/state/machine.state.ready.printing.d.ts +4 -0
  157. package/dist/likec4diagram/state/machine.state.ready.printing.js +4 -3
  158. package/dist/likec4diagram/state/machine.state.ready.walkthrough.d.ts +145 -2
  159. package/dist/likec4diagram/state/machine.state.ready.walkthrough.js +29 -21
  160. package/dist/likec4diagram/state/types.d.ts +1 -1
  161. package/dist/likec4diagram/state/utils.d.ts +13 -14
  162. package/dist/likec4diagram/state/utils.js +11 -3
  163. package/dist/likec4diagram/types.d.ts +9 -1
  164. package/dist/likec4diagram/ui/notation/NotationPanel.css.js +1 -1
  165. package/dist/likec4diagram/ui/notation/NotationPanel.js +3 -3
  166. package/dist/likec4diagram/useLayoutConstraints.js +4 -1
  167. package/dist/likec4diagram/xyflow-diagram/diagram-view.d.ts +11 -3
  168. package/dist/likec4diagram/xyflow-diagram/diagram-view.js +5 -3
  169. package/dist/likec4diagram/xyflow-sequence/sequence-layout.d.ts +7 -3
  170. package/dist/likec4diagram/xyflow-sequence/sequence-layout.js +10 -8
  171. package/dist/likec4diagram/xyflow-sequence/utils.d.ts +1 -1
  172. package/dist/navigationpanel/NavigationPanel.js +2 -1
  173. package/dist/navigationpanel/NavigationPanelControls.js +6 -4
  174. package/dist/navigationpanel/NavigationPanelDropdown.js +7 -7
  175. package/dist/navigationpanel/_common.js +1 -2
  176. package/dist/navigationpanel/comparepanel/CompareActionsMenu.js +2 -2
  177. package/dist/navigationpanel/comparepanel/ComparePanelControls.js +1 -1
  178. package/dist/navigationpanel/comparepanel/LayoutTypeSwitcher.js +4 -5
  179. package/dist/navigationpanel/controls/DetailsControls.js +5 -5
  180. package/dist/navigationpanel/controls/LayoutWarning.js +2 -2
  181. package/dist/navigationpanel/controls/LogoButton.d.ts +1 -0
  182. package/dist/navigationpanel/controls/{BurgerButton.js → LogoButton.js} +5 -5
  183. package/dist/navigationpanel/controls/NavigationButtons.js +2 -2
  184. package/dist/navigationpanel/controls/OpenSource.js +1 -1
  185. package/dist/navigationpanel/controls/SearchControl.d.ts +1 -2
  186. package/dist/navigationpanel/controls/SearchControl.js +8 -12
  187. package/dist/navigationpanel/controls/ToggleReadonly.js +4 -5
  188. package/dist/navigationpanel/controls/index.d.ts +1 -1
  189. package/dist/navigationpanel/dropdown/ProjectsMenu.js +12 -6
  190. package/dist/navigationpanel/editorpanel/CenterCamera.js +1 -1
  191. package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.js +1 -1
  192. package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.js +9 -9
  193. package/dist/navigationpanel/editorpanel/ToggleReadonly.js +1 -1
  194. package/dist/navigationpanel/editorpanel/styles.js +4 -4
  195. package/dist/navigationpanel/styles.css.js +1 -1
  196. package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +3 -3
  197. package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +67 -67
  198. package/dist/navigationpanel/walkthrough/DynamicViewControls.js +1 -1
  199. package/dist/navigationpanel/walkthrough/WalkthroughPanel.js +1 -1
  200. package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconCirclePlus.js +14 -0
  201. package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconFileText.js +14 -0
  202. package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconTrash.js +14 -0
  203. package/dist/overlays/element-details/ElementDetailsCard.css.js +4 -4
  204. package/dist/overlays/element-details/ElementDetailsCard.js +4 -4
  205. package/dist/overlays/element-details/MetadataValue.js +6 -7
  206. package/dist/overlays/element-details/TabPanelDeployments.js +7 -5
  207. package/dist/overlays/element-details/TabPanelRelationships.css.js +5 -25
  208. package/dist/overlays/element-details/TabPanelRelationships.js +3 -3
  209. package/dist/overlays/element-details/TabPanelStructure.js +3 -2
  210. package/dist/overlays/overlaysActor.js +18 -0
  211. package/dist/overlays/relationship-details/RelationshipDetails.d.ts +0 -5
  212. package/dist/overlays/relationship-details/RelationshipDetails.js +4 -4
  213. package/dist/overlays/relationship-details/SelectEdge.css.js +2 -2
  214. package/dist/overlays/relationship-details/SelectEdge.js +2 -2
  215. package/dist/overlays/relationship-details/compute.js +1 -1
  216. package/dist/overlays/relationship-details/custom/ElementActions.js +3 -3
  217. package/dist/overlays/relationship-details/custom/nodeTypes.js +14 -1
  218. package/dist/overlays/relationship-details/layout.js +1 -1
  219. package/dist/overlays/relationships-browser/RelationshipsBrowser.d.ts +0 -5
  220. package/dist/overlays/relationships-browser/RelationshipsBrowser.js +116 -21
  221. package/dist/overlays/relationships-browser/SelectElement.js +2 -2
  222. package/dist/overlays/relationships-browser/custom/ElementActions.js +3 -3
  223. package/dist/overlays/relationships-browser/custom/EmptyNode.js +21 -6
  224. package/dist/overlays/relationships-browser/custom/edgeTypes.js +0 -1
  225. package/dist/overlays/relationships-browser/custom/nodeTypes.js +14 -1
  226. package/dist/overlays/relationships-browser/layout.d.ts +1 -1
  227. package/dist/overlays/relationships-browser/layout.js +1 -1
  228. package/dist/projects-overview/ProjectsOverview.d.ts +13 -0
  229. package/dist/projects-overview/ProjectsOverview.js +57 -0
  230. package/dist/projects-overview/ProjectsOverviewXY.d.ts +17 -0
  231. package/dist/projects-overview/ProjectsOverviewXY.js +98 -0
  232. package/dist/projects-overview/_types.d.ts +34 -0
  233. package/dist/projects-overview/actor.d.ts +121 -0
  234. package/dist/projects-overview/actor.js +359 -0
  235. package/dist/projects-overview/context.d.ts +4 -0
  236. package/dist/projects-overview/context.js +9 -0
  237. package/dist/projects-overview/custom/edgeTypes.d.ts +3 -0
  238. package/dist/projects-overview/custom/edgeTypes.js +23 -0
  239. package/dist/projects-overview/custom/index.d.ts +2 -0
  240. package/dist/projects-overview/custom/nodeTypes.d.ts +2 -0
  241. package/dist/projects-overview/custom/nodeTypes.js +45 -0
  242. package/dist/projects-overview/hooks.d.ts +5 -0
  243. package/dist/projects-overview/hooks.js +14 -0
  244. package/dist/projects-overview/index.d.ts +1 -0
  245. package/dist/projects-overview/layouted-to-xyflow.d.ts +6 -0
  246. package/dist/projects-overview/layouted-to-xyflow.js +49 -0
  247. package/dist/projects-overview/panel/ProjectsOverviewPanel.d.ts +1 -0
  248. package/dist/projects-overview/panel/ProjectsOverviewPanel.js +11 -0
  249. package/dist/projects-overview/persistence.d.ts +5 -0
  250. package/dist/projects-overview/persistence.js +24 -0
  251. package/dist/search/Search.d.ts +1 -4
  252. package/dist/search/Search.js +89 -87
  253. package/dist/search/components/ElementsColumn.css.js +3 -3
  254. package/dist/search/components/ElementsColumn.js +3 -4
  255. package/dist/search/components/PickView.d.ts +3 -1
  256. package/dist/search/components/PickView.js +5 -4
  257. package/dist/search/components/SearchByTags.js +1 -1
  258. package/dist/search/components/SearchInput.js +1 -1
  259. package/dist/search/components/ViewsColum.js +2 -2
  260. package/dist/search/components/_shared.css.js +1 -1
  261. package/dist/search/components/utils.js +1 -1
  262. package/dist/search/hooks.d.ts +1 -6
  263. package/dist/search/hooks.js +12 -9
  264. package/dist/search/searchActor.d.ts +1 -1
  265. package/dist/shadowroot/ShadowRoot.js +20 -19
  266. package/dist/shadowroot/styles.css.d.ts +0 -2
  267. package/dist/shadowroot/styles.css.js +1 -34
  268. package/dist/styles-font.css2.js +1 -1
  269. package/dist/styles.css2.js +1 -1
  270. package/dist/utils/view-bounds.js +9 -5
  271. package/dist/utils/xyflow.d.ts +19 -3
  272. package/dist/utils/xyflow.js +52 -9
  273. package/package.json +23 -22
  274. package/panda.buildinfo.json +93 -84
  275. package/styles-font.css +1 -1
  276. package/styles-min.css +1 -1
  277. package/styles.css +1 -1
  278. package/dist/base-primitives/element/ElementNodeContainer.css.d.ts +0 -1
  279. package/dist/base-primitives/element/ElementNodeContainer.css.js +0 -39
  280. package/dist/editor/__tests__/fixture.d.ts +0 -205
  281. package/dist/editor/editorActor.d.ts +0 -653
  282. package/dist/likec4diagram/relationship-popover/styles.css.d.ts +0 -2
  283. package/dist/likec4diagram/relationship-popover/styles.css.js +0 -28
  284. package/dist/navigationpanel/controls/BurgerButton.d.ts +0 -1
  285. package/dist/overlays/relationships-browser/custom/styles.css.js +0 -14
  286. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/createReactComponent.js +0 -0
  287. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.js +0 -0
  288. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertTriangle.js +0 -0
  289. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowDownRight.js +0 -0
  290. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowLeft.js +0 -0
  291. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowRight.js +0 -0
  292. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconBolt.js +0 -0
  293. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconBrowser.js +0 -0
  294. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.js +0 -0
  295. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronDown.js +0 -0
  296. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronLeft.js +0 -0
  297. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronRight.js +0 -0
  298. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.js +0 -0
  299. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconCylinder.js +0 -0
  300. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconDeviceMobile.js +0 -0
  301. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconDirectionSignFilled.js +0 -0
  302. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconExternalLink.js +0 -0
  303. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconFileSymlink.js +0 -0
  304. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconFocusCentered.js +0 -0
  305. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconFolderFilled.js +0 -0
  306. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconHelpCircle.js +0 -0
  307. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconId.js +0 -0
  308. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconInfoCircle.js +0 -0
  309. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignBottom.js +0 -0
  310. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignCenter.js +0 -0
  311. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignLeft.js +0 -0
  312. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignMiddle.js +0 -0
  313. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignRight.js +0 -0
  314. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignTop.js +0 -0
  315. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutBoardSplit.js +0 -0
  316. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutCollage.js +0 -0
  317. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutDashboard.js +0 -0
  318. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLink.js +0 -0
  319. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLock.js +0 -0
  320. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLockOpen2.js +0 -0
  321. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerPlayFilled.js +0 -0
  322. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipBackFilled.js +0 -0
  323. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipForwardFilled.js +0 -0
  324. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerStopFilled.js +0 -0
  325. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconRectangularPrism.js +0 -0
  326. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconReorder.js +0 -0
  327. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconRouteOff.js +0 -0
  328. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconSearch.js +0 -0
  329. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconSelector.js +0 -0
  330. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconStack2.js +0 -0
  331. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconStarFilled.js +0 -0
  332. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconTarget.js +0 -0
  333. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconTransform.js +0 -0
  334. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconUser.js +0 -0
  335. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconX.js +0 -0
  336. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconZoomScan.js +0 -0
  337. /package/dist/{overlays/relationships-browser → projects-overview}/custom/styles.css.d.ts +0 -0
@@ -1,8 +1,8 @@
1
- import { nonNullable } from '@likec4/core';
1
+ import { nonNullable, BBox, invariant } from '@likec4/core';
2
2
  import { getViewportForBounds } from '@xyflow/react';
3
3
  import { assertEvent } from 'xstate';
4
4
  import { machine } from './machine.setup.js';
5
- import { activeSequenceBounds, focusedBounds } from './utils.js';
5
+ import { viewBounds, activeSequenceBounds, focusedBounds } from './utils.js';
6
6
  import { MinZoom } from '../../base/const.js';
7
7
 
8
8
  const setViewport = (params) => machine.createAction(({ context, event }) => {
@@ -15,7 +15,7 @@ const setViewport = (params) => machine.createAction(({ context, event }) => {
15
15
  viewport = event.viewport;
16
16
  duration = event.duration;
17
17
  }
18
- duration = duration ?? 400;
18
+ duration = duration ?? 450;
19
19
  const { panZoom } = nonNullable(context.xystore).getState();
20
20
  const animationProps = duration > 0 ? { duration, interpolate: "smooth" } : void 0;
21
21
  panZoom?.setViewport({
@@ -23,21 +23,38 @@ const setViewport = (params) => machine.createAction(({ context, event }) => {
23
23
  y: Math.round(viewport.y),
24
24
  zoom: viewport.zoom
25
25
  }, animationProps).catch((err) => {
26
- console.error("Error during fitDiagram panZoom setViewport", { err });
26
+ console.error("Error during setViewport", { err });
27
+ });
28
+ });
29
+ const setViewportCenter = (params) => machine.createAction(({ context, event }) => {
30
+ let center;
31
+ if (params) {
32
+ center = params;
33
+ } else if (event.type === "update.view") {
34
+ center = BBox.center(viewBounds(context, event.view));
35
+ } else {
36
+ center = BBox.center(viewBounds(context));
37
+ }
38
+ invariant(context.xyflow, "xyflow is not initialized");
39
+ const zoom = context.xyflow.getZoom();
40
+ context.xyflow.setCenter(
41
+ Math.round(center.x),
42
+ Math.round(center.y),
43
+ { zoom }
44
+ ).catch((err) => {
45
+ console.error("Error during setViewportCenter", { err });
27
46
  });
28
47
  });
29
- const fitDiagram = (params) => machine.enqueueActions(({ context, event, enqueue }) => {
30
- let bounds = context.view.bounds, duration;
48
+ const fitDiagram = (params) => machine.createAction(({ context, event }) => {
49
+ let bounds, duration;
31
50
  if (params) {
32
- bounds = params.bounds ?? context.view.bounds;
51
+ bounds = params.bounds;
33
52
  duration = params.duration;
34
53
  } else if (event.type === "xyflow.fitDiagram") {
35
- bounds = event.bounds ?? context.view.bounds;
54
+ bounds = event.bounds;
36
55
  duration = event.duration;
37
- enqueue.assign({
38
- viewportChangedManually: false
39
- });
40
56
  }
57
+ bounds ??= viewBounds(context);
41
58
  duration ??= 450;
42
59
  const { width, height, panZoom, transform } = nonNullable(context.xystore).getState();
43
60
  const maxZoom = Math.max(1, transform[2]);
@@ -119,18 +136,19 @@ const assignViewportBefore = (viewport) => machine.assign(({ context }) => {
119
136
  });
120
137
  const returnViewportBefore = (params) => machine.enqueueActions(({ enqueue, context: { viewportBefore } }) => {
121
138
  enqueue(cancelFitDiagram());
139
+ const noDelay = params?.delay === 0;
122
140
  if (viewportBefore) {
123
141
  enqueue.assign({
124
142
  viewportChangedManually: viewportBefore.wasChangedManually,
125
143
  viewportBefore: null
126
144
  });
127
- if (params && params.delay === 0) {
145
+ if (noDelay) {
128
146
  enqueue(setViewport({ viewport: viewportBefore.value, ...params }));
129
147
  } else {
130
148
  enqueue(raiseSetViewport({ viewport: viewportBefore.value, ...params }));
131
149
  }
132
150
  } else {
133
- if (params && params.delay === 0) {
151
+ if (noDelay) {
134
152
  enqueue(fitDiagram({ ...params }));
135
153
  } else {
136
154
  enqueue(raiseFitDiagram({ ...params }));
@@ -138,4 +156,4 @@ const returnViewportBefore = (params) => machine.enqueueActions(({ enqueue, cont
138
156
  }
139
157
  });
140
158
 
141
- export { assignViewportBefore, cancelFitDiagram, fitDiagram, fitFocusedBounds, raiseFitDiagram, raiseSetViewport, raiseUpdateView, returnViewportBefore, setViewport };
159
+ export { assignViewportBefore, cancelFitDiagram, fitDiagram, fitFocusedBounds, raiseFitDiagram, raiseSetViewport, raiseUpdateView, returnViewportBefore, setViewport, setViewportCenter };
@@ -1,5 +1,5 @@
1
1
  import { ActorRef, MachineSnapshot, StateMachine } from 'xstate';
2
- import { EditorActorRef } from '../../editor/editorActor';
2
+ import { EditorActorRef } from '../../editor/editorActor.states';
3
3
  import { OverlaysActorRef } from '../../overlays/overlaysActor';
4
4
  import { SearchActorRef } from '../../search/searchActor';
5
5
  import { Context as DiagramContext, EmittedEvents as DiagramEmittedEvents, Events as DiagramEvents, Input } from './machine.setup';
@@ -1,14 +1,14 @@
1
1
  import { applyEdgeChanges, applyNodeChanges } from '@xyflow/react';
2
2
  import { DefaultFeatures } from '../../context/DiagramFeatures.js';
3
3
  import { updateEdgeData, updateNodeData } from './assign.js';
4
- import { emitOnLayoutTypeChange, triggerChange, updateFeatures, updateInputs, assignDynamicViewVariant, stopEditorActor } from './machine.actions.js';
4
+ import { stopEditorActor, emitOnLayoutTypeChange, triggerChange, updateFeatures, updateInputs, assignDynamicViewVariant } from './machine.actions.js';
5
5
  import { machine } from './machine.setup.js';
6
6
  import { isReady, initializing } from './machine.state.initializing.js';
7
7
  import { navigating } from './machine.state.navigating.js';
8
8
  import { ready } from './machine.state.ready.js';
9
9
  import { DiagramToggledFeaturesPersistence } from './persistence.js';
10
10
  import { x as xstateActions_cjsExports } from '../../_virtual/xstate-actions.cjs.js';
11
- import { raiseUpdateView, cancelFitDiagram } from './machine.actions.layout.js';
11
+ import { cancelFitDiagram, raiseUpdateView } from './machine.actions.layout.js';
12
12
 
13
13
  const _diagramMachine = machine.createMachine({
14
14
  initial: "initializing",
@@ -49,25 +49,7 @@ const _diagramMachine = machine.createMachine({
49
49
  ready,
50
50
  navigating,
51
51
  final: {
52
- type: "final",
53
- entry: [
54
- stopEditorActor(),
55
- cancelFitDiagram(),
56
- xstateActions_cjsExports.stopChild("hotkey"),
57
- xstateActions_cjsExports.stopChild("overlays"),
58
- xstateActions_cjsExports.stopChild("search"),
59
- xstateActions_cjsExports.stopChild("mediaPrint"),
60
- xstateActions_cjsExports.assign({
61
- xyflow: null,
62
- xystore: null,
63
- xyedges: [],
64
- xynodes: [],
65
- initialized: {
66
- xydata: false,
67
- xyflow: false
68
- }
69
- })
70
- ]
52
+ type: "final"
71
53
  }
72
54
  },
73
55
  on: {
@@ -81,6 +63,9 @@ const _diagramMachine = machine.createMachine({
81
63
  guard: ({ context, event }) => context.dynamicViewVariant !== event.variant,
82
64
  actions: [
83
65
  assignDynamicViewVariant(),
66
+ xstateActions_cjsExports.assign({
67
+ viewportChangedManually: false
68
+ }),
84
69
  raiseUpdateView()
85
70
  ]
86
71
  },
@@ -106,14 +91,12 @@ const _diagramMachine = machine.createMachine({
106
91
  "emit.onLayoutTypeChange": {
107
92
  actions: emitOnLayoutTypeChange()
108
93
  },
109
- "xyflow.applyNodeChanges": {
110
- actions: xstateActions_cjsExports.assign({
111
- xynodes: ({ context, event }) => applyNodeChanges(event.changes, context.xynodes)
112
- })
113
- },
114
- "xyflow.applyEdgeChanges": {
115
- actions: xstateActions_cjsExports.assign({
116
- xyedges: ({ context, event }) => applyEdgeChanges(event.changes, context.xyedges)
94
+ "xyflow.applyChanges": {
95
+ actions: xstateActions_cjsExports.assign(({ context, event }) => {
96
+ return {
97
+ xynodes: event.nodes ? applyNodeChanges(event.nodes, context.xynodes) : context.xynodes,
98
+ xyedges: event.edges ? applyEdgeChanges(event.edges, context.xyedges) : context.xyedges
99
+ };
117
100
  })
118
101
  },
119
102
  "xyflow.viewportMoved": {
@@ -123,7 +106,25 @@ const _diagramMachine = machine.createMachine({
123
106
  }))
124
107
  },
125
108
  "destroy": {
126
- target: ".final"
109
+ target: ".final",
110
+ actions: [
111
+ stopEditorActor(),
112
+ cancelFitDiagram(),
113
+ xstateActions_cjsExports.stopChild("hotkey"),
114
+ xstateActions_cjsExports.stopChild("overlays"),
115
+ xstateActions_cjsExports.stopChild("search"),
116
+ xstateActions_cjsExports.stopChild("mediaPrint"),
117
+ xstateActions_cjsExports.assign({
118
+ xyflow: null,
119
+ xystore: null,
120
+ xyedges: [],
121
+ xynodes: [],
122
+ initialized: {
123
+ xydata: false,
124
+ xyflow: false
125
+ }
126
+ })
127
+ ]
127
128
  }
128
129
  }
129
130
  });
@@ -99,11 +99,9 @@ export type Events = HotKeyEvent | MediaPrintEvent | {
99
99
  type: 'xyflow.init';
100
100
  instance: XYFlowInstance;
101
101
  } | {
102
- type: 'xyflow.applyNodeChanges';
103
- changes: NodeChange<Types.Node>[];
104
- } | {
105
- type: 'xyflow.applyEdgeChanges';
106
- changes: EdgeChange<Types.Edge>[];
102
+ type: 'xyflow.applyChanges';
103
+ edges?: EdgeChange<Types.Edge>[];
104
+ nodes?: NodeChange<Types.Node>[];
107
105
  } | {
108
106
  type: 'xyflow.viewportMoved';
109
107
  viewport: Viewport;
@@ -328,6 +326,7 @@ export declare const machine: SetupReturn<Context, Events, {
328
326
  'click: focused node': unknown;
329
327
  'click: node has connections': unknown;
330
328
  'click: selected edge': unknown;
329
+ 'click: active walkthrough step': unknown;
331
330
  }, never, string, Input, NonReducibleUnknown, EmittedEvents, MetaObject>;
332
331
  export declare const targetState: {
333
332
  idle: string;
@@ -336,3 +335,20 @@ export declare const targetState: {
336
335
  printing: string;
337
336
  navigating: string;
338
337
  };
338
+ export declare const to: {
339
+ idle: {
340
+ target: string;
341
+ };
342
+ focused: {
343
+ target: string;
344
+ };
345
+ walkthrough: {
346
+ target: string;
347
+ };
348
+ printing: {
349
+ target: string;
350
+ };
351
+ navigating: {
352
+ target: string;
353
+ };
354
+ };
@@ -1,7 +1,7 @@
1
1
  import { nonexhaustive } from '@likec4/core';
2
- import { isTruthy } from 'remeda';
2
+ import { mapValues, isTruthy } from 'remeda';
3
3
  import { setup, assertEvent } from 'xstate';
4
- import { editorActorLogic } from '../../editor/editorActor.js';
4
+ import { editorActorLogic } from '../../editor/editorActor.states.js';
5
5
  import { overlaysActorLogic } from '../../overlays/overlaysActor.js';
6
6
  import { searchActorLogic } from '../../search/searchActor.js';
7
7
  import { hotkeyActorLogic } from './hotkeyActor.js';
@@ -11,7 +11,7 @@ const deriveToggledFeatures = (context) => {
11
11
  let toggledFeatures = context.toggledFeatures;
12
12
  const hasActiveWalkthrough = isTruthy(context.activeWalkthrough);
13
13
  const enableCompareWithLatest = context.features.enableCompareWithLatest && (toggledFeatures.enableCompareWithLatest ?? false) && isTruthy(context.view._layout) && !hasActiveWalkthrough;
14
- const enableReadOnly = context.features.enableReadOnly || (toggledFeatures.enableReadOnly ?? false) || hasActiveWalkthrough || context.dynamicViewVariant === "sequence" && context.view._type === "dynamic" || enableCompareWithLatest && context.view._layout === "auto";
14
+ const enableReadOnly = context.features.enableReadOnly || (toggledFeatures.enableReadOnly ?? false) || hasActiveWalkthrough || enableCompareWithLatest && context.view._layout === "auto";
15
15
  return {
16
16
  enableCompareWithLatest,
17
17
  enableReadOnly
@@ -94,6 +94,14 @@ const machine = setup({
94
94
  "click: selected edge": ({ event }) => {
95
95
  assertEvent(event, ["xyflow.edgeClick", "xyflow.edgeDoubleClick"]);
96
96
  return event.edge.selected === true || event.edge.data.active === true;
97
+ },
98
+ "click: active walkthrough step": ({ context, event }) => {
99
+ assertEvent(event, ["xyflow.edgeClick", "xyflow.edgeDoubleClick"]);
100
+ if (!context.activeWalkthrough) {
101
+ return false;
102
+ }
103
+ const { stepId } = context.activeWalkthrough;
104
+ return event.edge.id === stepId;
97
105
  }
98
106
  }
99
107
  });
@@ -104,5 +112,6 @@ const targetState = {
104
112
  printing: "#printing",
105
113
  navigating: "#navigating"
106
114
  };
115
+ const to = mapValues(targetState, (id) => ({ target: id }));
107
116
 
108
- export { deriveToggledFeatures, machine, targetState };
117
+ export { deriveToggledFeatures, machine, targetState, to };
@@ -99,7 +99,7 @@ export declare const initializing: {
99
99
  export declare const isReady: {
100
100
  always: ({
101
101
  guard: "isReady";
102
- actions: ActionFunction<Context, Events, Events, undefined, Values<{
102
+ actions: ( ActionFunction<Context, Events, Events, unknown, Values<{
103
103
  hotkeyActorLogic: {
104
104
  src: "hotkeyActorLogic";
105
105
  logic: HotkeyActorLogic;
@@ -214,7 +214,37 @@ export declare const isReady: {
214
214
  type: "click: selected edge";
215
215
  params: unknown;
216
216
  };
217
- }>, never, EmittedEvents>[];
217
+ "click: active walkthrough step": {
218
+ type: "click: active walkthrough step";
219
+ params: unknown;
220
+ };
221
+ }>, never, EmittedEvents> | ActionFunction<Context, Events, Events, undefined, Values<{
222
+ hotkeyActorLogic: {
223
+ src: "hotkeyActorLogic";
224
+ logic: HotkeyActorLogic;
225
+ id: "hotkey";
226
+ };
227
+ overlaysActorLogic: {
228
+ src: "overlaysActorLogic";
229
+ logic: OverlaysActorLogic;
230
+ id: "overlays";
231
+ };
232
+ searchActorLogic: {
233
+ src: "searchActorLogic";
234
+ logic: SearchActorLogic;
235
+ id: "search";
236
+ };
237
+ mediaPrintActorLogic: {
238
+ src: "mediaPrintActorLogic";
239
+ logic: MediaPrintActorLogic;
240
+ id: "mediaPrint";
241
+ };
242
+ editorActor: {
243
+ src: "editorActor";
244
+ logic: EditorActorLogic;
245
+ id: "editor";
246
+ };
247
+ }>, never, never, never, never> | ActionFunction<Context, Events, Events, undefined, never, never, never, never, EmittedEvents>)[];
218
248
  target: string;
219
249
  } | {
220
250
  target: string;
@@ -8,7 +8,7 @@ import { Context, Events } from './machine.setup';
8
8
  export declare const navigating: {
9
9
  id: string;
10
10
  always: {
11
- target: string;
12
11
  actions: CancelAction<Context, Events, undefined, Events>[];
12
+ target: string;
13
13
  };
14
14
  };
@@ -1,13 +1,15 @@
1
1
  import { BBox } from '@likec4/core/types';
2
- import { invariant, nonNullable } from '@likec4/core/utils';
2
+ import { invariant } from '@likec4/core/utils';
3
3
  import { isTruthy } from 'remeda';
4
4
  import { enqueueActions, assertEvent } from 'xstate';
5
+ import { roundDpr } from '../../utils/roundDpr.js';
6
+ import { parsePaddings } from '../../utils/xyflow.js';
5
7
  import { convertToXYFlow } from '../convert-to-xyflow.js';
6
8
  import { mergeXYNodesEdges } from './assign.js';
7
9
  import { disableCompareWithLatest } from './machine.actions.js';
8
- import { machine, targetState } from './machine.setup.js';
9
- import { calcViewportForBounds, findCorrespondingNode, findNodeByModelFqn, nodeRef } from './utils.js';
10
- import { cancelFitDiagram, raiseSetViewport, raiseFitDiagram } from './machine.actions.layout.js';
10
+ import { machine, to, targetState } from './machine.setup.js';
11
+ import { viewBounds, calcViewportForBounds, findCorrespondingNode, findNodeByModelFqn, nodeRef } from './utils.js';
12
+ import { cancelFitDiagram, raiseSetViewport } from './machine.actions.layout.js';
11
13
 
12
14
  const handleBrowserForwardBackward = () => machine.assign(({ context, event }) => {
13
15
  assertEvent(event, "update.view");
@@ -22,7 +24,7 @@ const handleBrowserForwardBackward = () => machine.assign(({ context, event }) =
22
24
  if (!stepCurrent || stepCurrent.viewId === event.view.id || !!lastOnNavigate) {
23
25
  return {};
24
26
  }
25
- const stepBack = currentIndex > 0 ? nonNullable(history[currentIndex - 1]) : null;
27
+ const stepBack = currentIndex > 0 ? history.at(currentIndex - 1) : null;
26
28
  if (stepBack && stepBack.viewId === event.view.id) {
27
29
  return {
28
30
  navigationHistory: {
@@ -32,7 +34,7 @@ const handleBrowserForwardBackward = () => machine.assign(({ context, event }) =
32
34
  lastOnNavigate: null
33
35
  };
34
36
  }
35
- const stepForward = currentIndex < history.length - 1 ? nonNullable(history[currentIndex + 1]) : null;
37
+ const stepForward = currentIndex < history.length - 1 ? history.at(currentIndex + 1) : null;
36
38
  if (stepForward && stepForward.viewId === event.view.id) {
37
39
  return {
38
40
  navigationHistory: {
@@ -60,7 +62,7 @@ const handleBrowserForwardBackward = () => machine.assign(({ context, event }) =
60
62
  const navigating = machine.createStateConfig({
61
63
  id: targetState.navigating.slice(1),
62
64
  always: {
63
- target: targetState.idle,
65
+ ...to.idle,
64
66
  actions: [
65
67
  cancelFitDiagram(),
66
68
  handleBrowserForwardBackward(),
@@ -78,64 +80,75 @@ const navigating = machine.createStateConfig({
78
80
  const eventWithXYData = "xynodes" in event ? event : {
79
81
  ...event,
80
82
  ...convertToXYFlow({
83
+ currentViewId: context.view.id,
81
84
  dynamicViewVariant: context.dynamicViewVariant,
82
85
  view: event.view,
83
86
  where: context.where
84
87
  })
85
88
  };
86
89
  invariant(xyflow, "xyflow is not initialized");
90
+ const currentViewport = xyflow.getViewport();
87
91
  const calcZoomTowardsNextViewport = (nextViewport2) => {
88
- const zoom = xyflow.getZoom();
89
- const coef = nextViewport2.zoom < zoom ? 0.8 : 0.4;
90
- return zoom + (nextViewport2.zoom - zoom) * coef;
92
+ const zoom = currentViewport.zoom;
93
+ const diff = nextViewport2.zoom - zoom;
94
+ if (Math.abs(diff) < 0.01) {
95
+ return nextViewport2.zoom;
96
+ }
97
+ const coef = diff < 0 ? 0.6 : 0.3;
98
+ return Math.trunc(1e4 * (zoom + diff * coef)) / 1e4;
99
+ };
100
+ const moveTowardsNextViewport = (nextViewport2) => {
101
+ const zoom = calcZoomTowardsNextViewport(nextViewport2);
102
+ if (zoom !== nextViewport2.zoom) {
103
+ xyflow.setViewport({
104
+ x: roundDpr(nextViewport2.x * (1 + currentViewport.zoom - zoom)),
105
+ y: roundDpr(nextViewport2.y * (1 + currentViewport.zoom - zoom)),
106
+ zoom
107
+ });
108
+ enqueue(raiseSetViewport({
109
+ delay: 100,
110
+ viewport: nextViewport2
111
+ }));
112
+ } else {
113
+ xyflow.setViewport(nextViewport2, { duration: 0 });
114
+ }
91
115
  };
92
116
  const fromHistory = history[currentIndex];
93
- if (fromHistory && fromHistory.viewId === event.view.id) {
94
- enqueue.assign({
117
+ if (fromHistory && fromHistory.viewId === eventWithXYData.view.id) {
118
+ const {
119
+ focusedNode: wasFocused,
120
+ activeWalkthrough: wasActiveWalkthrough,
121
+ viewportBefore
122
+ } = fromHistory;
123
+ const nextCtx = {
95
124
  ...mergeXYNodesEdges(context, eventWithXYData),
96
125
  dynamicViewVariant: fromHistory.dynamicViewVariant ?? context.dynamicViewVariant,
97
- viewportChangedManually: fromHistory.viewportChangedManually
98
- });
99
- const wasFocused = fromHistory.focusedNode;
100
- const wasActiveWalkthrough = fromHistory.activeWalkthrough;
101
- const viewportBefore = fromHistory.viewportBefore;
102
- if (viewportBefore && (wasFocused || wasActiveWalkthrough)) {
103
- enqueue.assign({
104
- viewport: viewportBefore.value,
105
- viewportChangedManually: viewportBefore.wasChangedManually,
106
- viewportBefore: null
107
- });
108
- }
109
- const center = BBox.center(event.view.bounds);
110
- const zoom = calcZoomTowardsNextViewport(fromHistory.viewport);
111
- xyflow.setCenter(
112
- center.x,
113
- center.y,
114
- { zoom, duration: 0 }
115
- );
126
+ viewportChangedManually: viewportBefore?.wasChangedManually ?? fromHistory.viewportChangedManually,
127
+ viewport: viewportBefore?.value ?? fromHistory.viewport,
128
+ viewportBefore: null
129
+ };
130
+ enqueue.assign(nextCtx);
131
+ moveTowardsNextViewport(nextCtx.viewport);
116
132
  if (wasFocused) {
117
133
  enqueue.raise({
118
134
  type: "focus.node",
119
135
  nodeId: wasFocused
120
- }, { delay: 50 });
136
+ }, { delay: 150 });
121
137
  return;
122
138
  }
123
139
  if (wasActiveWalkthrough) {
124
140
  enqueue.raise({
125
141
  type: "walkthrough.start",
126
142
  stepId: wasActiveWalkthrough
127
- }, { delay: 50 });
143
+ }, { delay: 150 });
128
144
  return;
129
145
  }
130
- enqueue(raiseSetViewport({
131
- delay: 80,
132
- viewport: fromHistory.viewport
133
- }));
134
146
  return;
135
147
  }
148
+ const nextBounds = viewBounds(context, eventWithXYData.view);
136
149
  const nextViewport = calcViewportForBounds(
137
150
  context,
138
- event.view.bounds
151
+ nextBounds
139
152
  );
140
153
  const { fromNode, toNode } = findCorrespondingNode(context, eventWithXYData);
141
154
  if (fromNode && toNode) {
@@ -151,17 +164,40 @@ const navigating = machine.createStateConfig({
151
164
  xystore.getState().panBy({
152
165
  x: Math.round(fromPoint.x - toPoint.x),
153
166
  y: Math.round(fromPoint.y - toPoint.y)
167
+ }).catch((err) => {
168
+ console.error("Error during xyflow.panBy", { err });
154
169
  });
170
+ enqueue(raiseSetViewport({
171
+ delay: 100,
172
+ viewport: nextViewport
173
+ }));
155
174
  } else {
156
175
  const zoom = calcZoomTowardsNextViewport(nextViewport);
157
- const center = BBox.center(event.view.bounds);
158
- xyflow.setCenter(
159
- center.x,
160
- center.y,
161
- { zoom, duration: 0 }
162
- );
176
+ if (zoom !== nextViewport.zoom) {
177
+ const { width, height } = context.xystore.getState();
178
+ const nextCenter = BBox.center(nextBounds);
179
+ const paddings = parsePaddings(context.fitViewPadding, width, height);
180
+ xyflow.setViewport({
181
+ x: roundDpr(
182
+ (width - paddings.x) / 2 - nextCenter.x * zoom + paddings.left
183
+ ),
184
+ y: roundDpr(
185
+ (height - paddings.y) / 2 - nextCenter.y * zoom + paddings.top
186
+ ),
187
+ zoom
188
+ });
189
+ enqueue(raiseSetViewport({
190
+ delay: 100,
191
+ viewport: nextViewport
192
+ }));
193
+ } else {
194
+ xyflow.setViewport(nextViewport, { duration: 0 });
195
+ }
163
196
  }
164
197
  const updatedHistory = currentIndex < history.length - 1 ? history.slice(0, currentIndex + 1) : [...history];
198
+ if (updatedHistory.length > 20) {
199
+ updatedHistory.shift();
200
+ }
165
201
  updatedHistory.push({
166
202
  viewId: event.view.id,
167
203
  viewport: { ...nextViewport },
@@ -183,11 +219,7 @@ const navigating = machine.createStateConfig({
183
219
  type: "focus.node",
184
220
  nodeId: nodeToFocus.id,
185
221
  autoUnfocus: true
186
- }, { delay: 150 });
187
- } else {
188
- enqueue(raiseFitDiagram({
189
- delay: 100
190
- }));
222
+ }, { delay: 250 });
191
223
  }
192
224
  })
193
225
  ]