@likec4/diagram 1.43.0 → 1.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (349) hide show
  1. package/bundle/index.js +14727 -13166
  2. package/dist/LikeC4Diagram.d.ts +1 -1
  3. package/dist/LikeC4Diagram.js +14 -9
  4. package/dist/LikeC4Diagram.props.d.ts +25 -15
  5. package/dist/LikeC4ProjectsProvider.js +1 -1
  6. package/dist/LikeC4Styles.js +0 -3
  7. package/dist/LikeC4View.d.ts +8 -3
  8. package/dist/LikeC4View.js +29 -14
  9. package/dist/ReactLikeC4.d.ts +2 -2
  10. package/dist/ReactLikeC4.js +2 -2
  11. package/dist/StaticLikeC4Diagram.js +1 -1
  12. package/dist/_virtual/_commonjsHelpers.js +3 -0
  13. package/dist/_virtual/assign-dea9f7c8.cjs.js +3 -0
  14. package/dist/_virtual/log-ec8d4df4.cjs.js +3 -0
  15. package/dist/_virtual/raise-da5b247f.cjs.js +3 -0
  16. package/dist/_virtual/xstate-actions.cjs.js +5 -0
  17. package/dist/_virtual/xstate-actions.cjs2.js +3 -0
  18. package/dist/_virtual/xstate-dev.cjs.js +3 -0
  19. package/dist/_virtual/xstate-guards.cjs.js +5 -0
  20. package/dist/_virtual/xstate-guards.cjs2.js +3 -0
  21. package/dist/base/Background.d.ts +2 -1
  22. package/dist/base/Background.js +11 -2
  23. package/dist/base/Base.d.ts +28 -0
  24. package/dist/base/BaseXYFlow.d.ts +5 -5
  25. package/dist/base/BaseXYFlow.js +38 -44
  26. package/dist/base/index.d.ts +6 -2
  27. package/dist/base/types.d.ts +1 -28
  28. package/dist/base/updateEdges.js +25 -14
  29. package/dist/base/updateNodes.d.ts +14 -0
  30. package/dist/base/updateNodes.js +51 -17
  31. package/dist/base-primitives/Markdown.d.ts +30 -4
  32. package/dist/base-primitives/Markdown.js +3 -2
  33. package/dist/base-primitives/compound/CompoundActionButton.d.ts +3 -2
  34. package/dist/base-primitives/compound/CompoundActionButton.js +1 -1
  35. package/dist/base-primitives/compound/CompoundDetailsButton.d.ts +3 -2
  36. package/dist/base-primitives/compound/CompoundDetailsButton.js +1 -1
  37. package/dist/base-primitives/edge/EdgeActionButton.d.ts +3 -2
  38. package/dist/base-primitives/edge/EdgeActionButton.js +1 -1
  39. package/dist/base-primitives/edge/EdgeContainer.d.ts +1 -1
  40. package/dist/base-primitives/edge/EdgeContainer.js +8 -1
  41. package/dist/base-primitives/edge/EdgeLabel.d.ts +3 -2
  42. package/dist/base-primitives/edge/EdgeLabel.js +2 -0
  43. package/dist/base-primitives/edge/EdgeLabelContainer.d.ts +1 -1
  44. package/dist/base-primitives/edge/EdgeLabelContainer.js +4 -0
  45. package/dist/base-primitives/edge/EdgePath.d.ts +4 -0
  46. package/dist/base-primitives/edge/EdgePath.js +29 -5
  47. package/dist/base-primitives/element/ElementActionButtons.d.ts +6 -4
  48. package/dist/base-primitives/element/ElementActionButtons.js +3 -3
  49. package/dist/base-primitives/element/ElementData.d.ts +3 -3
  50. package/dist/base-primitives/element/ElementData.js +13 -7
  51. package/dist/base-primitives/element/ElementDetailsButton.d.ts +3 -2
  52. package/dist/base-primitives/element/ElementDetailsButton.js +5 -5
  53. package/dist/base-primitives/element/ElementNodeContainer.css.js +15 -27
  54. package/dist/base-primitives/element/ElementShape.js +5 -5
  55. package/dist/base-primitives/element/ElementTags.d.ts +6 -4
  56. package/dist/base-primitives/element/ElementTags.js +2 -1
  57. package/dist/base-primitives/memoEdge.js +4 -2
  58. package/dist/base-primitives/memoNode.d.ts +1 -1
  59. package/dist/base-primitives/memoNode.js +3 -3
  60. package/dist/components/ErrorFallback.js +52 -35
  61. package/dist/components/Link.js +2 -2
  62. package/dist/context/DiagramEventHandlers.js +2 -1
  63. package/dist/context/DiagramFeatures.d.ts +25 -6
  64. package/dist/context/DiagramFeatures.js +28 -56
  65. package/dist/context/IconRenderer.js +6 -6
  66. package/dist/context/LikeC4ModelContext.js +3 -10
  67. package/dist/context/TagStylesContext.js +3 -19
  68. package/dist/context/index.d.ts +1 -1
  69. package/dist/custom/customNodes.js +3 -2
  70. package/dist/custom/hooks.d.ts +3 -3
  71. package/dist/custom/index.d.ts +1 -1
  72. package/dist/custom/index.js +5 -5
  73. package/dist/editor/LikeC4EditorContext.d.ts +21 -0
  74. package/dist/editor/index.d.ts +2 -0
  75. package/dist/hooks/index.d.ts +4 -2
  76. package/dist/hooks/safeContext.d.ts +6 -3
  77. package/dist/hooks/safeContext.js +10 -3
  78. package/dist/hooks/useCallbackRef.d.ts +1 -0
  79. package/dist/hooks/useCallbackRef.js +13 -0
  80. package/dist/hooks/useCurrentView.d.ts +11 -0
  81. package/dist/hooks/{useCurrentViewId.js → useCurrentView.js} +7 -3
  82. package/dist/hooks/useCurrentViewModel.js +4 -1
  83. package/dist/hooks/useDiagram.d.ts +7 -113
  84. package/dist/hooks/useDiagram.js +7 -127
  85. package/dist/hooks/useDiagramCompareLayout.d.ts +35 -0
  86. package/dist/hooks/useDiagramCompareLayout.js +65 -0
  87. package/dist/hooks/useLikeC4Project.d.ts +6 -1
  88. package/dist/hooks/useLikeC4Project.js +14 -2
  89. package/dist/hooks/useMediaPrint.d.ts +6 -0
  90. package/dist/hooks/useUpdateEffect.js +2 -4
  91. package/dist/hooks/useXYFlow.d.ts +1 -0
  92. package/dist/hooks/useXYFlow.js +4 -7
  93. package/dist/index.d.ts +2 -2
  94. package/dist/index.js +4 -3
  95. package/dist/likec4diagram/DiagramUI.js +14 -7
  96. package/dist/likec4diagram/DiagramXYFlow.d.ts +2 -2
  97. package/dist/likec4diagram/DiagramXYFlow.js +60 -52
  98. package/dist/likec4diagram/convert-to-xyflow.d.ts +0 -1
  99. package/dist/likec4diagram/custom/edges/EdgeDrifts.d.ts +6 -0
  100. package/dist/likec4diagram/custom/edges/EdgeDrifts.js +38 -0
  101. package/dist/likec4diagram/custom/edges/RelationshipEdge.js +256 -217
  102. package/dist/likec4diagram/custom/edges/SequenceStepEdge.js +9 -2
  103. package/dist/likec4diagram/custom/edges/edges.css.js +3 -4
  104. package/dist/likec4diagram/custom/edges/useControlPoints.d.ts +8 -0
  105. package/dist/likec4diagram/custom/edges/useControlPoints.js +58 -0
  106. package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.d.ts +7 -0
  107. package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.js +60 -0
  108. package/dist/likec4diagram/custom/edges/utils.d.ts +0 -12
  109. package/dist/likec4diagram/custom/nodes/CompoundActions.js +4 -1
  110. package/dist/likec4diagram/custom/nodes/ElementActions.d.ts +2 -1
  111. package/dist/likec4diagram/custom/nodes/ElementActions.js +15 -10
  112. package/dist/likec4diagram/custom/nodes/NodeDrifts.d.ts +6 -0
  113. package/dist/likec4diagram/custom/nodes/NodeDrifts.js +50 -0
  114. package/dist/likec4diagram/custom/nodes/SequenceActorNode.js +7 -2
  115. package/dist/likec4diagram/custom/nodes/index.d.ts +1 -0
  116. package/dist/likec4diagram/custom/nodes/nodes.d.ts +9 -1
  117. package/dist/likec4diagram/custom/nodes/nodes.js +74 -29
  118. package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.d.ts +1 -1
  119. package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +1 -1
  120. package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +2 -1
  121. package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.js +4 -3
  122. package/dist/likec4diagram/custom/nodes/toolbar/_shared.d.ts +1 -11
  123. package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +7 -51
  124. package/dist/likec4diagram/custom/nodes/toolbar/types.d.ts +5 -0
  125. package/dist/likec4diagram/custom/nodes/toolbar/types.js +7 -0
  126. package/dist/likec4diagram/custom/nodes/toolbar/useHandlers.d.ts +8 -0
  127. package/dist/likec4diagram/custom/nodes/toolbar/useHandlers.js +44 -0
  128. package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +8 -10
  129. package/dist/likec4diagram/relationship-popover/actor.d.ts +1 -1
  130. package/dist/likec4diagram/state/DiagramActorProvider.d.ts +4 -3
  131. package/dist/likec4diagram/state/DiagramActorProvider.js +95 -70
  132. package/dist/likec4diagram/state/assign.d.ts +13 -7
  133. package/dist/likec4diagram/state/assign.js +43 -282
  134. package/dist/likec4diagram/state/createViewChange.d.ts +3 -0
  135. package/dist/likec4diagram/state/createViewChange.js +79 -0
  136. package/dist/likec4diagram/state/diagram-api.d.ts +109 -0
  137. package/dist/likec4diagram/state/diagram-api.js +126 -0
  138. package/dist/likec4diagram/state/machine.actions.d.ts +1783 -0
  139. package/dist/likec4diagram/state/machine.actions.js +644 -0
  140. package/dist/likec4diagram/state/machine.actions.layout.d.ts +579 -0
  141. package/dist/likec4diagram/state/machine.actions.layout.js +129 -0
  142. package/dist/likec4diagram/state/machine.d.ts +22 -0
  143. package/dist/likec4diagram/state/machine.js +127 -0
  144. package/dist/likec4diagram/state/machine.setup.d.ts +327 -0
  145. package/dist/likec4diagram/state/machine.setup.js +93 -0
  146. package/dist/likec4diagram/state/machine.state.initializing.d.ts +208 -0
  147. package/dist/likec4diagram/state/machine.state.initializing.js +55 -0
  148. package/dist/likec4diagram/state/machine.state.navigating.d.ts +14 -0
  149. package/dist/likec4diagram/state/machine.state.navigating.js +178 -0
  150. package/dist/likec4diagram/state/machine.state.ready.d.ts +3131 -0
  151. package/dist/likec4diagram/state/machine.state.ready.focused.d.ts +386 -0
  152. package/dist/likec4diagram/state/machine.state.ready.focused.js +85 -0
  153. package/dist/likec4diagram/state/machine.state.ready.idle.d.ts +474 -0
  154. package/dist/likec4diagram/state/machine.state.ready.idle.js +96 -0
  155. package/dist/likec4diagram/state/machine.state.ready.js +262 -0
  156. package/dist/likec4diagram/state/machine.state.ready.printing.d.ts +128 -0
  157. package/dist/likec4diagram/state/machine.state.ready.printing.js +40 -0
  158. package/dist/likec4diagram/state/machine.state.ready.walkthrough.d.ts +511 -0
  159. package/dist/likec4diagram/state/machine.state.ready.walkthrough.js +177 -0
  160. package/dist/likec4diagram/state/mediaPrintActor.d.ts +12 -0
  161. package/dist/likec4diagram/state/mediaPrintActor.js +18 -0
  162. package/dist/likec4diagram/state/syncManualLayoutActor.d.ts +31 -108
  163. package/dist/likec4diagram/state/syncManualLayoutActor.js +278 -142
  164. package/dist/likec4diagram/state/types.d.ts +7 -12
  165. package/dist/likec4diagram/state/utils.d.ts +19 -4
  166. package/dist/likec4diagram/state/utils.js +47 -4
  167. package/dist/likec4diagram/types.d.ts +8 -8
  168. package/dist/likec4diagram/ui/LayoutDriftFrame.d.ts +2 -0
  169. package/dist/likec4diagram/ui/LayoutDriftFrame.js +66 -0
  170. package/dist/likec4diagram/ui/index.d.ts +1 -0
  171. package/dist/likec4diagram/ui/notation/NotationPanel.css.js +5 -2
  172. package/dist/likec4diagram/ui/notation/NotationPanel.js +5 -4
  173. package/dist/likec4diagram/useLayoutConstraints.d.ts +10 -5
  174. package/dist/likec4diagram/useLayoutConstraints.js +237 -61
  175. package/dist/likec4diagram/xyflow-diagram/diagram-view.d.ts +0 -1
  176. package/dist/likec4diagram/xyflow-diagram/diagram-view.js +14 -17
  177. package/dist/likec4diagram/xyflow-sequence/sequence-layout.js +11 -8
  178. package/dist/navigationpanel/NavigationPanel.js +16 -8
  179. package/dist/navigationpanel/NavigationPanelControls.d.ts +2 -1
  180. package/dist/navigationpanel/NavigationPanelControls.js +23 -17
  181. package/dist/navigationpanel/NavigationPanelDropdown.d.ts +2 -1
  182. package/dist/navigationpanel/NavigationPanelDropdown.js +62 -42
  183. package/dist/navigationpanel/_common.d.ts +1 -1
  184. package/dist/navigationpanel/_common.js +4 -2
  185. package/dist/navigationpanel/actor.d.ts +9 -205
  186. package/dist/navigationpanel/actor.js +6 -5
  187. package/dist/navigationpanel/comparepanel/CompareActionsMenu.d.ts +3 -0
  188. package/dist/navigationpanel/comparepanel/CompareActionsMenu.js +59 -0
  189. package/dist/navigationpanel/comparepanel/ComparePanel.d.ts +2 -0
  190. package/dist/navigationpanel/comparepanel/ComparePanel.js +42 -0
  191. package/dist/navigationpanel/comparepanel/ComparePanelControls.d.ts +1 -0
  192. package/dist/navigationpanel/comparepanel/ComparePanelControls.js +60 -0
  193. package/dist/navigationpanel/comparepanel/LayoutTypeSwitcher.d.ts +5 -0
  194. package/dist/navigationpanel/comparepanel/LayoutTypeSwitcher.js +38 -0
  195. package/dist/navigationpanel/comparepanel/index.d.ts +1 -0
  196. package/dist/navigationpanel/controls/{ViewDetailsCard.d.ts → DetailsControls.d.ts} +1 -1
  197. package/dist/navigationpanel/controls/{ViewDetailsCard.js → DetailsControls.js} +18 -14
  198. package/dist/navigationpanel/controls/LayoutWarning.d.ts +2 -0
  199. package/dist/navigationpanel/controls/LayoutWarning.js +102 -0
  200. package/dist/navigationpanel/controls/NavigationButtons.js +4 -3
  201. package/dist/navigationpanel/controls/OpenSource.js +2 -2
  202. package/dist/navigationpanel/controls/SearchControl.d.ts +2 -1
  203. package/dist/navigationpanel/controls/SearchControl.js +15 -17
  204. package/dist/navigationpanel/controls/ToggleReadonly.d.ts +1 -1
  205. package/dist/navigationpanel/controls/ToggleReadonly.js +26 -18
  206. package/dist/navigationpanel/controls/index.d.ts +2 -1
  207. package/dist/navigationpanel/dropdown/ProjectsMenu.d.ts +2 -2
  208. package/dist/navigationpanel/dropdown/ProjectsMenu.js +5 -5
  209. package/dist/navigationpanel/editorpanel/CenterCamera.js +5 -2
  210. package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.d.ts +1 -1
  211. package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.js +21 -20
  212. package/dist/navigationpanel/editorpanel/EditorPanel.js +3 -3
  213. package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.d.ts +2 -2
  214. package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.js +16 -13
  215. package/dist/navigationpanel/editorpanel/ToggleReadonly.d.ts +1 -0
  216. package/dist/navigationpanel/editorpanel/ToggleReadonly.js +15 -0
  217. package/dist/navigationpanel/styles.css.d.ts +2 -2
  218. package/dist/navigationpanel/styles.css.js +4 -4
  219. package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +14 -8
  220. package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +66 -66
  221. package/dist/navigationpanel/walkthrough/DynamicViewControls.js +31 -14
  222. package/dist/navigationpanel/walkthrough/WalkthroughPanel.d.ts +2 -1
  223. package/dist/navigationpanel/walkthrough/WalkthroughPanel.js +68 -50
  224. package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/actions/dist/xstate-actions.cjs.js +37 -0
  225. package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dev/dist/xstate-dev.cjs.js +59 -0
  226. package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dist/assign-dea9f7c8.cjs.js +140 -0
  227. package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dist/log-ec8d4df4.cjs.js +401 -0
  228. package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dist/raise-da5b247f.cjs.js +2716 -0
  229. package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/guards/dist/xstate-guards.cjs.js +26 -0
  230. package/dist/overlays/element-details/ElementDetails.js +7 -7
  231. package/dist/overlays/element-details/ElementDetailsCard.css.js +3 -3
  232. package/dist/overlays/element-details/ElementDetailsCard.js +7 -5
  233. package/dist/overlays/element-details/MetadataValue.d.ts +2 -1
  234. package/dist/overlays/element-details/MetadataValue.js +2 -2
  235. package/dist/overlays/element-details/TabPanelDeployments.js +6 -4
  236. package/dist/overlays/element-details/TabPanelRelationships.js +3 -3
  237. package/dist/overlays/element-details/TabPanelStructure.js +1 -1
  238. package/dist/overlays/element-details/actor.d.ts +8 -82
  239. package/dist/overlays/element-details/actor.js +0 -8
  240. package/dist/overlays/overlay/Overlay.js +10 -10
  241. package/dist/overlays/overlaysActor.d.ts +7 -150
  242. package/dist/overlays/overlaysActor.js +183 -161
  243. package/dist/overlays/relationship-details/RelationshipDetails.js +4 -3
  244. package/dist/overlays/relationship-details/SelectEdge.js +2 -2
  245. package/dist/overlays/relationship-details/_types.d.ts +3 -4
  246. package/dist/overlays/relationship-details/actor.d.ts +6 -550
  247. package/dist/overlays/relationship-details/actor.js +18 -3
  248. package/dist/overlays/relationship-details/custom/ElementActions.js +8 -5
  249. package/dist/overlays/relationship-details/custom/edgeTypes.js +4 -1
  250. package/dist/overlays/relationship-details/custom/nodeTypes.js +4 -1
  251. package/dist/overlays/relationship-details/hooks.js +1 -1
  252. package/dist/overlays/relationship-details/layout-to-xyflow.js +3 -5
  253. package/dist/overlays/relationship-details/layout.d.ts +3 -3
  254. package/dist/overlays/relationship-details/layout.js +4 -4
  255. package/dist/overlays/relationships-browser/RelationshipsBrowser.js +6 -4
  256. package/dist/overlays/relationships-browser/SelectElement.js +2 -2
  257. package/dist/overlays/relationships-browser/_types.d.ts +2 -3
  258. package/dist/overlays/relationships-browser/actor.d.ts +7 -673
  259. package/dist/overlays/relationships-browser/actor.js +132 -110
  260. package/dist/overlays/relationships-browser/custom/ElementActions.js +44 -37
  261. package/dist/overlays/relationships-browser/custom/edgeTypes.js +4 -1
  262. package/dist/overlays/relationships-browser/custom/nodeTypes.js +4 -1
  263. package/dist/overlays/relationships-browser/hooks.js +7 -6
  264. package/dist/overlays/relationships-browser/layout.d.ts +2 -2
  265. package/dist/overlays/relationships-browser/layout.js +3 -3
  266. package/dist/overlays/relationships-browser/useViewToNodesEdges.js +0 -3
  267. package/dist/overlays/types.d.ts +12 -13
  268. package/dist/search/Search.js +2 -1
  269. package/dist/search/components/ElementsColumn.js +5 -3
  270. package/dist/search/components/PickView.js +1 -1
  271. package/dist/search/components/SearchByTags.js +21 -44
  272. package/dist/search/components/SearchInput.js +1 -1
  273. package/dist/search/components/ViewsColum.js +6 -4
  274. package/dist/search/components/_shared.css.d.ts +1 -1
  275. package/dist/search/searchActor.d.ts +3 -66
  276. package/dist/shadowroot/ShadowRoot.d.ts +5 -7
  277. package/dist/shadowroot/ShadowRoot.js +8 -6
  278. package/dist/styles.css2.js +1 -1
  279. package/dist/utils/index.d.ts +4 -4
  280. package/dist/utils/vector.d.ts +83 -21
  281. package/dist/utils/vector.js +98 -24
  282. package/dist/utils/view-bounds.d.ts +8 -0
  283. package/dist/utils/view-bounds.js +58 -0
  284. package/dist/utils/xyflow.d.ts +52 -8
  285. package/dist/utils/xyflow.js +31 -11
  286. package/package.json +26 -24
  287. package/panda.buildinfo.json +124 -71
  288. package/styles-min.css +1 -1
  289. package/styles.css +1 -1
  290. package/dist/hooks/useCurrentViewId.d.ts +0 -6
  291. package/dist/likec4diagram/custom/edges/utils.js +0 -23
  292. package/dist/likec4diagram/state/diagram-machine.d.ts +0 -2590
  293. package/dist/likec4diagram/state/diagram-machine.js +0 -1180
  294. package/dist/navigationpanel/editorpanel/LayoutDriftNotification.d.ts +0 -1
  295. package/dist/navigationpanel/editorpanel/LayoutDriftNotification.js +0 -56
  296. package/dist/utils/get-view-bounds.d.ts +0 -3
  297. package/dist/utils/get-view-bounds.js +0 -14
  298. /package/dist/base/{types.js → Base.js} +0 -0
  299. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/createReactComponent.js +0 -0
  300. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.js +0 -0
  301. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertTriangle.js +0 -0
  302. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowDownRight.js +0 -0
  303. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowLeft.js +0 -0
  304. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowRight.js +0 -0
  305. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconBolt.js +0 -0
  306. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconBrowser.js +0 -0
  307. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.js +0 -0
  308. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronDown.js +0 -0
  309. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronLeft.js +0 -0
  310. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronRight.js +0 -0
  311. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.js +0 -0
  312. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconCylinder.js +0 -0
  313. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconDeviceMobile.js +0 -0
  314. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconDirectionSignFilled.js +0 -0
  315. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconExternalLink.js +0 -0
  316. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconFileSymlink.js +0 -0
  317. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconFocusCentered.js +0 -0
  318. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconFolderFilled.js +0 -0
  319. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconHelpCircle.js +0 -0
  320. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconId.js +0 -0
  321. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconInfoCircle.js +0 -0
  322. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignBottom.js +0 -0
  323. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignCenter.js +0 -0
  324. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignLeft.js +0 -0
  325. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignMiddle.js +0 -0
  326. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignRight.js +0 -0
  327. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignTop.js +0 -0
  328. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutBoardSplit.js +0 -0
  329. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutCollage.js +0 -0
  330. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutDashboard.js +0 -0
  331. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLink.js +0 -0
  332. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLock.js +0 -0
  333. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLockOpen2.js +0 -0
  334. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerPlayFilled.js +0 -0
  335. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipBackFilled.js +0 -0
  336. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipForwardFilled.js +0 -0
  337. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerStopFilled.js +0 -0
  338. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconRectangularPrism.js +0 -0
  339. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconReorder.js +0 -0
  340. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconRouteOff.js +0 -0
  341. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconSearch.js +0 -0
  342. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconSelector.js +0 -0
  343. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconStack2.js +0 -0
  344. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconStarFilled.js +0 -0
  345. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconTarget.js +0 -0
  346. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconTransform.js +0 -0
  347. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconUser.js +0 -0
  348. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconX.js +0 -0
  349. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconZoomScan.js +0 -0
@@ -1,14 +1,7 @@
1
- import { jsx, Fragment } from 'react/jsx-runtime';
2
- import { createContext, useContext } from 'react';
1
+ import 'react/jsx-runtime';
2
+ import { createContext } from 'react';
3
3
 
4
4
  const LikeC4ModelContext = createContext(null);
5
5
  const CurrentViewModelContext = createContext(null);
6
- function EnsureCurrentViewModel({ children }) {
7
- const viewmodel = useContext(CurrentViewModelContext);
8
- if (!viewmodel) {
9
- return null;
10
- }
11
- return /* @__PURE__ */ jsx(Fragment, { children });
12
- }
13
6
 
14
- export { CurrentViewModelContext, EnsureCurrentViewModel, LikeC4ModelContext };
7
+ export { CurrentViewModelContext, LikeC4ModelContext };
@@ -1,35 +1,19 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import { isTagColorSpecified } from '@likec4/core';
3
+ import { DefaultTagColors } from '@likec4/core/styles';
3
4
  import { useMantineStyleNonce } from '@mantine/core';
4
5
  import { createContext, memo, useContext } from 'react';
5
6
  import { isEmpty, pipe, entries, flatMap, join } from 'remeda';
6
7
  import { useLikeC4Specification } from '../hooks/useLikeC4Model.js';
7
8
 
8
9
  const TagStylesContext = createContext({});
9
- const radixColors = [
10
- "yellow",
11
- "orange",
12
- "amber",
13
- "tomato",
14
- "red",
15
- "ruby",
16
- "crimson",
17
- "pink",
18
- "pink",
19
- "purple",
20
- "violet",
21
- "indigo",
22
- "blue",
23
- "teal",
24
- "grass",
25
- "lime"
26
- ];
10
+ const radixColors = DefaultTagColors;
27
11
  const generateColorVars = (spec) => {
28
12
  const color = spec.color;
29
13
  if (isTagColorSpecified(spec)) {
30
14
  return `
31
15
  --colors-likec4-tag-bg: ${color};
32
- --colors-likec4-tag-bg-hover: color-mix(in srgb, ${color}, var(--colors-likec4-mix-color) 20%);
16
+ --colors-likec4-tag-bg-hover: color-mix(in oklab, ${color}, var(--colors-likec4-mix-color) 20%);
33
17
  `;
34
18
  }
35
19
  if (!radixColors.includes(color)) {
@@ -1,5 +1,5 @@
1
1
  export { DiagramEventHandlers, useDiagramEventHandlers } from './DiagramEventHandlers';
2
- export { AllDisabled, DiagramFeatures, IfEnabled, IfNotEnabled, useEnabledFeatures, } from './DiagramFeatures';
2
+ export { DefaultFeatures, DiagramFeatures, IfEnabled, IfNotEnabled, useEnabledFeatures, } from './DiagramFeatures';
3
3
  export type { EnabledFeatures } from './DiagramFeatures';
4
4
  export { EnsureMantine } from './EnsureMantine';
5
5
  export { FramerMotionConfig } from './FramerMotionConfig';
@@ -1,10 +1,11 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import { useLikeC4ViewModel } from '../hooks/useLikeC4Model.js';
2
+ import { useLikeC4Model } from '../hooks/useLikeC4Model.js';
3
3
 
4
4
  function customDiagramNode(Node) {
5
5
  return ((props) => {
6
6
  const viewId = props.data.viewId;
7
- const viewModel = useLikeC4ViewModel(viewId);
7
+ const likec4 = useLikeC4Model();
8
+ const viewModel = likec4.findView(viewId);
8
9
  if (!viewModel) {
9
10
  console.error(`View "${viewId}" not found, requested by customNode "${props.data.id}"`, { props });
10
11
  return null;
@@ -1,11 +1,11 @@
1
- export type { DiagramActorEvent, DiagramActorRef, DiagramContext, } from '../likec4diagram/state/types';
1
+ export type { DiagramActorRef, DiagramActorSnapshot, DiagramContext, DiagramEmittedEvents, DiagramEvents, } from '../likec4diagram/state/types';
2
2
  export { useDiagramEventHandlers, } from '../context/DiagramEventHandlers';
3
3
  export { type EnabledFeatures, type FeatureName, useEnabledFeatures, } from '../context/DiagramFeatures';
4
- export { useCurrentViewId, } from '../hooks/useCurrentViewId';
4
+ export { useCurrentView, useCurrentViewId, } from '../hooks/useCurrentView';
5
5
  export { type DiagramApi, useDiagram, useDiagramActorRef, useDiagramContext, useOnDiagramEvent, } from '../hooks/useDiagram';
6
6
  export { useCurrentViewModel, } from '../hooks/useCurrentViewModel';
7
7
  export { useLikeC4Model, useLikeC4Specification, useLikeC4ViewModel, } from '../hooks/useLikeC4Model';
8
- export { useHasProjects, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext, } from '../hooks/useLikeC4Project';
8
+ export { useHasProjects, useLikeC4Project, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext, } from '../hooks/useLikeC4Project';
9
9
  export { useLikeC4Styles, } from '../hooks/useLikeC4Styles';
10
10
  export { useSetState } from '../hooks/useSetState';
11
11
  export { useUpdateEffect } from '../hooks/useUpdateEffect';
@@ -4,7 +4,7 @@ export * from './hooks';
4
4
  export * from './primitives';
5
5
  export type { BaseEdge, BaseEdgeData, BaseEdgeProps, BaseEdgePropsWithData, BaseNode, BaseNodeData, BaseNodeProps, BaseNodePropsWithData, } from '../base/types';
6
6
  export type { ChangeEvent, DiagramNodeWithNavigate, ElementIconRenderer, ElementIconRendererProps, LikeC4ColorScheme, LikeC4DiagramEventHandlers, LikeC4DiagramProperties, NodeRenderers, OnCanvasClick, OnChange, OnEdgeClick, OnNavigateTo, OnNodeClick, OpenSourceParams, PaddingUnit, PaddingWithUnit, ViewPadding, WhereOperator, } from '../LikeC4Diagram.props';
7
- export { Base } from '../base/types';
7
+ export { Base } from '../base/Base';
8
8
  export type { Types } from '../likec4diagram/types';
9
9
  export { type EnabledFeatures, IfEnabled, IfNotEnabled, IfNotReadOnly, IfReadOnly, useEnabledFeatures, } from '../context/DiagramFeatures';
10
10
  export { Overlay } from '../overlays/overlay/Overlay';
@@ -1,5 +1,5 @@
1
1
  export { compoundDeploymentNode, compoundElementNode, deploymentNode, elementNode, sequenceActorNode, viewGroupNode } from './customNodes.js';
2
- export { Base } from '../base/types.js';
2
+ export { Base } from '../base/Base.js';
3
3
  export { IfEnabled, IfNotEnabled, IfNotReadOnly, IfReadOnly, useEnabledFeatures } from '../context/DiagramFeatures.js';
4
4
  export { Overlay } from '../overlays/overlay/Overlay.js';
5
5
  export { PortalToContainer } from '../components/PortalToContainer.js';
@@ -13,12 +13,12 @@ export { DeploymentElementToolbar, ElementToolbar } from '../likec4diagram/custo
13
13
  export { SequenceActorNode, SequenceParallelArea } from '../likec4diagram/custom/nodes/SequenceActorNode.js';
14
14
  export { Toolbar } from '../likec4diagram/custom/nodes/toolbar/Toolbar.js';
15
15
  export { useDiagramEventHandlers } from '../context/DiagramEventHandlers.js';
16
- export { useCurrentViewId } from '../hooks/useCurrentViewId.js';
17
- export { useDiagram, useDiagramContext, useOnDiagramEvent } from '../hooks/useDiagram.js';
18
- export { useDiagramActorRef } from '../hooks/safeContext.js';
16
+ export { useCurrentView, useCurrentViewId } from '../hooks/useCurrentView.js';
17
+ export { useDiagram, useDiagramActorRef } from '../hooks/safeContext.js';
18
+ export { useDiagramContext, useOnDiagramEvent } from '../hooks/useDiagram.js';
19
19
  export { useCurrentViewModel } from '../hooks/useCurrentViewModel.js';
20
20
  export { useLikeC4Model, useLikeC4Specification, useLikeC4ViewModel } from '../hooks/useLikeC4Model.js';
21
- export { useHasProjects, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext } from '../hooks/useLikeC4Project.js';
21
+ export { useHasProjects, useLikeC4Project, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext } from '../hooks/useLikeC4Project.js';
22
22
  export { useLikeC4Styles } from '../hooks/useLikeC4Styles.js';
23
23
  export { useSetState } from '../hooks/useSetState.js';
24
24
  export { useUpdateEffect } from '../hooks/useUpdateEffect.js';
@@ -0,0 +1,21 @@
1
+ import { PropsWithChildren } from 'react';
2
+ import { OnChange } from '../LikeC4Diagram.props';
3
+ import type * as t from '@likec4/core/types';
4
+ export type LikeC4EditorContextType = {
5
+ /**
6
+ * Fetch a view by its ID and layout type.
7
+ *
8
+ * @param viewId - The ID of the view to fetch.
9
+ * @param layout - The layout type to use when fetching the view.
10
+ */
11
+ fetchView(viewId: t.ViewId, layout?: t.LayoutType): Promise<t.LayoutedView>;
12
+ syncManualLayout(viewId: t.ViewId): Promise<void>;
13
+ /**
14
+ * Callback invoked when the view changes.
15
+ */
16
+ onChange: OnChange;
17
+ };
18
+ export declare function LikeC4EditorContext({ children }: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
19
+ export declare function EnsureEditorContext({ children }: PropsWithChildren): import("react/jsx-runtime").JSX.Element | null;
20
+ export declare function useOptionalLikeC4Editor(): LikeC4EditorContextType | null;
21
+ export declare function useLikeC4Editor(): LikeC4EditorContextType;
@@ -0,0 +1,2 @@
1
+ export { EnsureEditorContext, LikeC4EditorContext, useLikeC4Editor, useOptionalLikeC4Editor, } from './LikeC4EditorContext';
2
+ export type { LikeC4EditorContextType } from './LikeC4EditorContext';
@@ -1,12 +1,14 @@
1
+ export { useCallbackRef } from './useCallbackRef';
1
2
  export { useId } from './useId';
2
3
  export { useMantinePortalProps } from './useMantinePortalProps';
4
+ export { useMediaPrint } from './useMediaPrint';
3
5
  export { useSetState } from './useSetState';
4
6
  export { useUpdateEffect } from './useUpdateEffect';
5
7
  export { useCurrentZoom, useIsZoomTooSmall, useXYFlow, useXYInternalNode, useXYStore, useXYStoreApi } from './useXYFlow';
6
8
  export type { XYFlowInstance, XYStoreApi, XYStoreState } from './useXYFlow';
7
- export { useCurrentViewId } from './useCurrentViewId';
9
+ export { useCurrentView, useCurrentViewId } from './useCurrentView';
8
10
  export { useCurrentViewModel } from './useCurrentViewModel';
9
11
  export { useLikeC4Model, useLikeC4Specification, useLikeC4ViewModel } from './useLikeC4Model';
10
- export { useHasProjects, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext, } from './useLikeC4Project';
12
+ export { useHasProjects, useLikeC4Project, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext, } from './useLikeC4Project';
11
13
  export { useLikeC4Styles } from './useLikeC4Styles';
12
14
  export * from './useDiagram';
@@ -1,4 +1,7 @@
1
- import { DiagramActorRef } from '../likec4diagram/state/types';
1
+ import { DiagramApi } from '../likec4diagram/state/diagram-api';
2
2
  import { Provider } from 'react';
3
- export declare const DiagramActorContextProvider: Provider<DiagramActorRef>;
4
- export declare const useDiagramActorRef: () => DiagramActorRef;
3
+ import { UnknownLayouted } from '@likec4/core';
4
+ import { DiagramActorRef } from '../custom';
5
+ export declare const DiagramActorContextProvider: Provider<DiagramApi< UnknownLayouted>>;
6
+ export declare function useDiagramActorRef(): DiagramActorRef;
7
+ export declare function useDiagram(): DiagramApi< UnknownLayouted>;
@@ -3,12 +3,19 @@ import { useContext, createContext } from 'react';
3
3
  const DiagramActorSafeContext = createContext(null);
4
4
  DiagramActorSafeContext.displayName = "DiagramActorSafeContext";
5
5
  const DiagramActorContextProvider = DiagramActorSafeContext.Provider;
6
- const useDiagramActorRef = () => {
6
+ function useDiagramActorRef() {
7
+ const ctx = useContext(DiagramActorSafeContext);
8
+ if (ctx === null) {
9
+ throw new Error("DiagramActorRef is not provided");
10
+ }
11
+ return ctx.actor;
12
+ }
13
+ function useDiagram() {
7
14
  const ctx = useContext(DiagramActorSafeContext);
8
15
  if (ctx === null) {
9
16
  throw new Error("DiagramActorRef is not provided");
10
17
  }
11
18
  return ctx;
12
- };
19
+ }
13
20
 
14
- export { DiagramActorContextProvider, useDiagramActorRef };
21
+ export { DiagramActorContextProvider, useDiagram, useDiagramActorRef };
@@ -0,0 +1 @@
1
+ export declare function useCallbackRef<T extends (...args: any[]) => any>(callback: T | null | undefined): T;
@@ -0,0 +1,13 @@
1
+ import { useRef } from 'react';
2
+
3
+ function useCallbackRef(callback) {
4
+ const ref = useRef(callback);
5
+ ref.current = callback;
6
+ const callbackRef = useRef(null);
7
+ if (callbackRef.current == null) {
8
+ callbackRef.current = ((...args) => ref.current?.(...args));
9
+ }
10
+ return callbackRef.current;
11
+ }
12
+
13
+ export { useCallbackRef };
@@ -0,0 +1,11 @@
1
+ import { LayoutedView, ViewId } from '@likec4/core/types';
2
+ /**
3
+ * Returns current view id
4
+ * Should be used only inside LikeC4Diagram
5
+ */
6
+ export declare function useCurrentViewId(): ViewId;
7
+ /**
8
+ * Returns current view
9
+ * Should be used only inside LikeC4Diagram
10
+ */
11
+ export declare function useCurrentView(): LayoutedView;
@@ -1,6 +1,5 @@
1
1
  import { useSelector } from '@xstate/react';
2
- import '@mantine/hooks';
3
- import 'fast-equals';
2
+ import { shallowEqual } from 'fast-equals';
4
3
  import 'react';
5
4
  import { useDiagramActorRef } from './safeContext.js';
6
5
 
@@ -9,5 +8,10 @@ function useCurrentViewId() {
9
8
  const actorRef = useDiagramActorRef();
10
9
  return useSelector(actorRef, selectViewId);
11
10
  }
11
+ const selectView = (s) => s.context.view;
12
+ function useCurrentView() {
13
+ const actorRef = useDiagramActorRef();
14
+ return useSelector(actorRef, selectView, shallowEqual);
15
+ }
12
16
 
13
- export { useCurrentViewId };
17
+ export { useCurrentView, useCurrentViewId };
@@ -1,6 +1,9 @@
1
1
  import { useContext } from 'react';
2
2
  import { CurrentViewModelContext } from '../context/LikeC4ModelContext.js';
3
3
 
4
+ function useOptionalCurrentViewModel() {
5
+ return useContext(CurrentViewModelContext);
6
+ }
4
7
  function useCurrentViewModel() {
5
8
  const vm = useContext(CurrentViewModelContext);
6
9
  if (!vm) {
@@ -9,4 +12,4 @@ function useCurrentViewModel() {
9
12
  return vm;
10
13
  }
11
14
 
12
- export { useCurrentViewModel };
15
+ export { useCurrentViewModel, useOptionalCurrentViewModel };
@@ -1,123 +1,17 @@
1
- import { DynamicViewDisplayVariant, NodeNotation as ElementNotation } from '@likec4/core/types';
2
1
  import { DependencyList } from 'react';
3
- import { PartialDeep } from 'type-fest';
4
- import { FeatureName } from '../context/DiagramFeatures';
5
- import { OpenSourceParams } from '../LikeC4Diagram.props';
6
- import { AlignmentMode } from '../likec4diagram/state/aligners';
7
- import { DiagramActorEvent, DiagramActorRef, DiagramActorSnapshot, DiagramContext, DiagramEmittedEvents } from '../likec4diagram/state/types';
8
- import { Types } from '../likec4diagram/types';
9
- import { useDiagramActorRef } from './safeContext';
10
- import type * as t from '@likec4/core/types';
11
- type Any = t.aux.Any;
12
- type Unknown = t.aux.UnknownLayouted;
13
- type ViewId<A> = t.aux.ViewId<A>;
14
- type Fqn<A> = t.aux.Fqn<A>;
15
- type NodeId = t.aux.NodeId;
16
- type EdgeId = t.aux.EdgeId;
17
- export { useDiagramActorRef };
18
- export type { DiagramContext };
19
- export interface DiagramApi<A extends Any = Unknown> {
20
- readonly actor: DiagramActorRef;
21
- /**
22
- * @warning Do not use in render phase
23
- */
24
- readonly currentView: t.DiagramView<A>;
25
- /**
26
- * Send event to diagram actor
27
- */
28
- send(event: DiagramActorEvent): void;
29
- /**
30
- * Navigate to view
31
- */
32
- navigateTo(viewId: ViewId<A>, fromNode?: NodeId): void;
33
- /**
34
- * Navigate back or forward in history
35
- */
36
- navigate(direction: 'back' | 'forward'): void;
37
- /**
38
- * Fit diagram to view
39
- */
40
- fitDiagram(duration?: number): void;
41
- /**
42
- * Open relationships browser
43
- */
44
- openRelationshipsBrowser(fqn: Fqn<A>): void;
45
- /**
46
- * If running in editor, trigger opening source file
47
- */
48
- openSource(params: OpenSourceParams<A>): void;
49
- /**
50
- * Open element details card
51
- */
52
- openElementDetails(fqn: Fqn<A>, fromNode?: NodeId): void;
53
- openRelationshipDetails(...params: [edgeId: EdgeId] | [source: Fqn<A>, target: Fqn<A>]): void;
54
- updateNodeData(nodeId: NodeId, data: PartialDeep<Types.NodeData>): void;
55
- updateEdgeData(edgeId: EdgeId, data: PartialDeep<Types.EdgeData>): void;
56
- /**
57
- * Schedule save manual layout
58
- */
59
- scheduleSaveManualLayout(): void;
60
- /**
61
- * @returns true if there was pending request to save layout
62
- */
63
- cancelSaveManualLayout(): boolean;
64
- /**
65
- * Align nodes
66
- */
67
- align(mode: AlignmentMode): void;
68
- /**
69
- * Reset edge control points
70
- */
71
- resetEdgeControlPoints(): void;
72
- /**
73
- * Focus node
74
- */
75
- focusNode(nodeId: NodeId): void;
76
- /**
77
- * @warning Do not use in render phase
78
- */
79
- getSnapshot(): DiagramActorSnapshot;
80
- /**
81
- * @warning Do not use in render phase
82
- */
83
- getContext(): DiagramContext;
84
- /**
85
- * @warning Do not use in render phase
86
- */
87
- findDiagramNode(xynodeId: string): t.DiagramNode<A> | null;
88
- /**
89
- * @warning Do not use in render phase
90
- */
91
- findEdge(xyedgeId: string): Types.Edge | null;
92
- /**
93
- * @warning Do not use in render phase
94
- */
95
- findDiagramEdge(xyedgeId: string): t.DiagramEdge<A> | null;
96
- startWalkthrough(): void;
97
- walkthroughStep(direction?: 'next' | 'previous'): void;
98
- stopWalkthrough(): void;
99
- toggleFeature(feature: FeatureName, forceValue?: boolean): void;
100
- highlightNotation(notation: ElementNotation, kind?: string): void;
101
- unhighlightNotation(): void;
102
- openSearch(searchValue?: string): void;
103
- /**
104
- * Switch dynamic view display variant
105
- */
106
- switchDynamicViewVariant(variant: DynamicViewDisplayVariant): void;
107
- }
108
- /**
109
- * Diagram API
110
- * Mostly for internal use
111
- */
112
- export declare function useDiagram<A extends Any = Unknown>(): DiagramApi<A>;
2
+ import { DiagramApi } from '../likec4diagram/state/diagram-api';
3
+ import { DiagramActorSnapshot, DiagramContext, DiagramEmittedEvents } from '../likec4diagram/state/types';
4
+ import { useDiagram, useDiagramActorRef } from './safeContext';
5
+ export { useDiagram, useDiagramActorRef };
6
+ export type { DiagramApi, DiagramContext };
113
7
  export declare function useDiagramActorSnapshot<T = unknown>(selector: (state: DiagramActorSnapshot) => T, compare?: (a: NoInfer<T>, b: NoInfer<T>) => boolean): T;
114
8
  /**
115
9
  * Read diagram context
116
10
  */
117
11
  export declare function useDiagramContext<T = unknown>(selector: (context: DiagramContext) => T, compare?: (a: NoInfer<T>, b: NoInfer<T>) => boolean, deps?: DependencyList): T;
118
- type PickEmittedEvent<T extends DiagramEmittedEvents['type']> = DiagramEmittedEvents & {
12
+ type PickEmittedEvent<T> = T extends DiagramEmittedEvents['type'] ? DiagramEmittedEvents & {
119
13
  type: T;
120
- };
14
+ } : never;
121
15
  /**
122
16
  * Subscribe to diagram emitted events
123
17
  * @example
@@ -1,132 +1,12 @@
1
- import { useCallbackRef } from '@mantine/hooks';
2
1
  import { useSelector } from '@xstate/react';
3
2
  import { shallowEqual } from 'fast-equals';
4
- import { useMemo, useCallback, useRef, useEffect } from 'react';
5
- import { findDiagramEdge, findDiagramNode } from '../likec4diagram/state/utils.js';
3
+ import { useCallback, useRef, useEffect } from 'react';
6
4
  import { useDiagramActorRef } from './safeContext.js';
5
+ export { useDiagram } from './safeContext.js';
7
6
 
8
- function useDiagram() {
9
- const actor = useDiagramActorRef();
10
- return useMemo(() => ({
11
- actor,
12
- send: (event) => actor.send(event),
13
- navigateTo: (viewId, fromNode) => {
14
- actor.send({
15
- type: "navigate.to",
16
- viewId,
17
- ...fromNode && { fromNode }
18
- });
19
- },
20
- navigate: (direction) => {
21
- actor.send({ type: `navigate.${direction}` });
22
- },
23
- fitDiagram: (duration = 350) => {
24
- actor.send({ type: "fitDiagram", duration });
25
- },
26
- openRelationshipsBrowser: (fqn) => {
27
- actor.send({ type: "open.relationshipsBrowser", fqn });
28
- },
29
- openSource: (params) => {
30
- actor.send({ type: "open.source", ...params });
31
- },
32
- openElementDetails: (fqn, fromNode) => {
33
- actor.send({ type: "open.elementDetails", fqn, fromNode });
34
- },
35
- openRelationshipDetails: (...params) => {
36
- if (params.length === 1) {
37
- actor.send({ type: "open.relationshipDetails", params: { edgeId: params[0] } });
38
- } else {
39
- actor.send({ type: "open.relationshipDetails", params: { source: params[0], target: params[1] } });
40
- }
41
- },
42
- updateNodeData: (nodeId, data) => {
43
- actor.send({ type: "update.nodeData", nodeId, data });
44
- },
45
- updateEdgeData: (edgeId, data) => {
46
- actor.send({
47
- type: "update.edgeData",
48
- edgeId,
49
- data
50
- });
51
- },
52
- scheduleSaveManualLayout: () => {
53
- actor.send({ type: "saveManualLayout.schedule" });
54
- },
55
- /**
56
- * @returns true if there was pending request to save layout
57
- */
58
- cancelSaveManualLayout: () => {
59
- const syncState = actor.getSnapshot().children.syncLayout?.getSnapshot().value;
60
- actor.send({ type: "saveManualLayout.cancel" });
61
- return syncState === "pending" || syncState === "paused";
62
- },
63
- align: (mode) => {
64
- actor.send({ type: "layout.align", mode });
65
- },
66
- resetEdgeControlPoints: () => {
67
- actor.send({ type: "layout.resetEdgeControlPoints" });
68
- },
69
- focusNode: (nodeId) => {
70
- actor.send({ type: "focus.node", nodeId });
71
- },
72
- /**
73
- * @warning Do not use in render phase
74
- */
75
- get currentView() {
76
- return actor.getSnapshot().context.view;
77
- },
78
- /**
79
- * @warning Do not use in render phase
80
- */
81
- getSnapshot: () => actor.getSnapshot(),
82
- /**
83
- * @warning Do not use in render phase
84
- */
85
- getContext: () => actor.getSnapshot().context,
86
- /**
87
- * @warning Do not use in render phase
88
- */
89
- findDiagramNode: (xynodeId) => {
90
- return findDiagramNode(actor.getSnapshot().context, xynodeId);
91
- },
92
- findEdge: (xyedgeId) => {
93
- return actor.getSnapshot().context.xyedges.find((e) => e.data.id === xyedgeId) ?? null;
94
- },
95
- /**
96
- * @warning Do not use in render phase
97
- */
98
- findDiagramEdge: (xyedgeId) => {
99
- return findDiagramEdge(actor.getSnapshot().context, xyedgeId);
100
- },
101
- startWalkthrough: () => {
102
- actor.send({ type: "walkthrough.start" });
103
- },
104
- walkthroughStep: (direction = "next") => {
105
- actor.send({ type: "walkthrough.step", direction });
106
- },
107
- stopWalkthrough: () => {
108
- actor.send({ type: "walkthrough.end" });
109
- },
110
- toggleFeature: (feature, forceValue) => {
111
- actor.send({ type: "toggle.feature", feature, ...forceValue !== void 0 && { forceValue } });
112
- },
113
- highlightNotation: (notation, kind) => {
114
- actor.send({ type: "notations.highlight", notation, ...kind && { kind } });
115
- },
116
- unhighlightNotation: () => {
117
- actor.send({ type: "notations.unhighlight" });
118
- },
119
- openSearch: (searchValue) => {
120
- actor.send({ type: "open.search", ...searchValue && { search: searchValue } });
121
- },
122
- switchDynamicViewVariant: (variant) => {
123
- actor.send({ type: "switch.dynamicViewVariant", variant });
124
- }
125
- }), [actor]);
126
- }
127
7
  function useDiagramActorSnapshot(selector, compare = shallowEqual) {
128
8
  const actorRef = useDiagramActorRef();
129
- return useSelector(actorRef, useCallbackRef(selector), compare);
9
+ return useSelector(actorRef, selector, compare);
130
10
  }
131
11
  function useDiagramContext(selector, compare = shallowEqual, deps) {
132
12
  const actorRef = useDiagramActorRef();
@@ -138,13 +18,13 @@ function useOnDiagramEvent(event, callback) {
138
18
  const callbackRef = useRef(callback);
139
19
  callbackRef.current = callback;
140
20
  useEffect(() => {
141
- const subscription = actorRef.on(event, (event2) => {
142
- callbackRef.current(event2);
21
+ const subscription = actorRef.on(event, (payload) => {
22
+ callbackRef.current(payload);
143
23
  });
144
24
  return () => {
145
25
  subscription.unsubscribe();
146
26
  };
147
- }, [actorRef]);
27
+ }, [actorRef, event]);
148
28
  }
149
29
 
150
- export { useDiagram, useDiagramActorRef, useDiagramActorSnapshot, useDiagramContext, useOnDiagramEvent };
30
+ export { useDiagramActorRef, useDiagramActorSnapshot, useDiagramContext, useOnDiagramEvent };
@@ -0,0 +1,35 @@
1
+ import { DiagramActorSnapshot } from '../likec4diagram/state/types';
2
+ import type * as t from '@likec4/core/types';
3
+ declare const selectCompareLayoutState: ({ context }: DiagramActorSnapshot) => {
4
+ isEnabled: false;
5
+ isEditable: false;
6
+ isActive: false;
7
+ drifts: never[];
8
+ layout: t.LayoutType;
9
+ } | {
10
+ isEnabled: true;
11
+ isEditable: boolean;
12
+ isActive: boolean;
13
+ drifts: t.NonEmptyReadonlyArray<t.LayoutedViewDriftReason>;
14
+ layout: t.LayoutType;
15
+ };
16
+ type DiagramCompareLayoutState = ReturnType<typeof selectCompareLayoutState>;
17
+ type DiagramCompareLayoutOps = {
18
+ /**
19
+ * Toggles the compare mode on or off.
20
+ */
21
+ toggleCompare: (force?: 'on' | 'off') => void;
22
+ /**
23
+ * Switches the layout type between 'auto' and 'manual'.
24
+ */
25
+ switchLayout: (layoutType: t.LayoutType) => void;
26
+ /**
27
+ * Resets the manual layout to its default state.
28
+ */
29
+ resetManualLayout: () => void;
30
+ };
31
+ export declare function useDiagramCompareLayout(): [
32
+ DiagramCompareLayoutState,
33
+ DiagramCompareLayoutOps
34
+ ];
35
+ export {};