@likec4/diagram 1.43.0 → 1.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (301) hide show
  1. package/bundle/index.js +5746 -4674
  2. package/dist/LikeC4Diagram.d.ts +1 -1
  3. package/dist/LikeC4Diagram.js +13 -10
  4. package/dist/LikeC4Diagram.props.d.ts +16 -7
  5. package/dist/LikeC4ProjectsProvider.js +1 -1
  6. package/dist/LikeC4View.d.ts +5 -0
  7. package/dist/LikeC4View.js +22 -11
  8. package/dist/ReactLikeC4.js +2 -2
  9. package/dist/StaticLikeC4Diagram.js +1 -1
  10. package/dist/_virtual/_commonjsHelpers.js +3 -0
  11. package/dist/_virtual/assign-dea9f7c8.cjs.js +3 -0
  12. package/dist/_virtual/log-ec8d4df4.cjs.js +3 -0
  13. package/dist/_virtual/raise-da5b247f.cjs.js +3 -0
  14. package/dist/_virtual/xstate-actions.cjs.js +5 -0
  15. package/dist/_virtual/xstate-actions.cjs2.js +3 -0
  16. package/dist/_virtual/xstate-dev.cjs.js +3 -0
  17. package/dist/_virtual/xstate-guards.cjs.js +5 -0
  18. package/dist/_virtual/xstate-guards.cjs2.js +3 -0
  19. package/dist/base/Background.d.ts +2 -1
  20. package/dist/base/Background.js +11 -2
  21. package/dist/base/Base.d.ts +28 -0
  22. package/dist/base/BaseXYFlow.d.ts +5 -5
  23. package/dist/base/BaseXYFlow.js +38 -44
  24. package/dist/base/index.d.ts +6 -2
  25. package/dist/base/types.d.ts +1 -28
  26. package/dist/base/updateEdges.js +4 -3
  27. package/dist/base/updateNodes.js +3 -2
  28. package/dist/base-primitives/compound/CompoundActionButton.js +1 -1
  29. package/dist/base-primitives/compound/CompoundDetailsButton.js +1 -1
  30. package/dist/base-primitives/edge/EdgeActionButton.js +1 -1
  31. package/dist/base-primitives/edge/EdgeContainer.d.ts +1 -1
  32. package/dist/base-primitives/edge/EdgeContainer.js +4 -0
  33. package/dist/base-primitives/edge/EdgeLabel.d.ts +1 -0
  34. package/dist/base-primitives/edge/EdgeLabel.js +2 -0
  35. package/dist/base-primitives/edge/EdgeLabelContainer.d.ts +1 -1
  36. package/dist/base-primitives/edge/EdgeLabelContainer.js +4 -0
  37. package/dist/base-primitives/edge/EdgePath.d.ts +4 -0
  38. package/dist/base-primitives/edge/EdgePath.js +9 -5
  39. package/dist/base-primitives/element/ElementActionButtons.d.ts +3 -2
  40. package/dist/base-primitives/element/ElementActionButtons.js +1 -1
  41. package/dist/base-primitives/element/ElementDetailsButton.js +2 -5
  42. package/dist/base-primitives/element/ElementNodeContainer.css.js +15 -27
  43. package/dist/base-primitives/element/ElementTags.js +2 -1
  44. package/dist/base-primitives/memoEdge.js +4 -2
  45. package/dist/base-primitives/memoNode.d.ts +1 -1
  46. package/dist/base-primitives/memoNode.js +3 -3
  47. package/dist/components/ErrorFallback.js +52 -35
  48. package/dist/components/Link.js +2 -2
  49. package/dist/context/DiagramEventHandlers.js +2 -1
  50. package/dist/context/DiagramFeatures.d.ts +24 -6
  51. package/dist/context/DiagramFeatures.js +28 -56
  52. package/dist/context/IconRenderer.js +6 -6
  53. package/dist/context/LikeC4ModelContext.js +3 -10
  54. package/dist/context/TagStylesContext.js +2 -18
  55. package/dist/context/index.d.ts +1 -1
  56. package/dist/custom/customNodes.js +3 -2
  57. package/dist/custom/hooks.d.ts +1 -1
  58. package/dist/custom/index.d.ts +1 -1
  59. package/dist/custom/index.js +4 -4
  60. package/dist/editor/LikeC4EditorContext.d.ts +21 -0
  61. package/dist/editor/index.d.ts +2 -0
  62. package/dist/hooks/index.d.ts +2 -1
  63. package/dist/hooks/safeContext.d.ts +6 -3
  64. package/dist/hooks/safeContext.js +10 -3
  65. package/dist/hooks/useCallbackRef.d.ts +1 -0
  66. package/dist/hooks/useCallbackRef.js +13 -0
  67. package/dist/hooks/useCurrentView.d.ts +11 -0
  68. package/dist/hooks/{useCurrentViewId.js → useCurrentView.js} +7 -3
  69. package/dist/hooks/useCurrentViewModel.js +4 -1
  70. package/dist/hooks/useDiagram.d.ts +7 -113
  71. package/dist/hooks/useDiagram.js +7 -127
  72. package/dist/hooks/useDiagramCompareLayout.d.ts +35 -0
  73. package/dist/hooks/useDiagramCompareLayout.js +60 -0
  74. package/dist/hooks/useUpdateEffect.js +2 -4
  75. package/dist/hooks/useXYFlow.d.ts +1 -0
  76. package/dist/hooks/useXYFlow.js +4 -7
  77. package/dist/index.d.ts +2 -2
  78. package/dist/index.js +4 -3
  79. package/dist/likec4diagram/DiagramUI.js +14 -7
  80. package/dist/likec4diagram/DiagramXYFlow.d.ts +2 -2
  81. package/dist/likec4diagram/DiagramXYFlow.js +54 -51
  82. package/dist/likec4diagram/convert-to-xyflow.d.ts +0 -1
  83. package/dist/likec4diagram/custom/edges/RelationshipEdge.js +249 -220
  84. package/dist/likec4diagram/custom/edges/SequenceStepEdge.js +7 -2
  85. package/dist/likec4diagram/custom/edges/edges.css.js +3 -4
  86. package/dist/likec4diagram/custom/edges/useControlPoints.d.ts +8 -0
  87. package/dist/likec4diagram/custom/edges/useControlPoints.js +58 -0
  88. package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.d.ts +7 -0
  89. package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.js +60 -0
  90. package/dist/likec4diagram/custom/edges/utils.d.ts +0 -12
  91. package/dist/likec4diagram/custom/nodes/CompoundActions.js +4 -1
  92. package/dist/likec4diagram/custom/nodes/ElementActions.d.ts +2 -1
  93. package/dist/likec4diagram/custom/nodes/ElementActions.js +15 -10
  94. package/dist/likec4diagram/custom/nodes/ElementNodeDrifts.d.ts +4 -0
  95. package/dist/likec4diagram/custom/nodes/ElementNodeDrifts.js +46 -0
  96. package/dist/likec4diagram/custom/nodes/SequenceActorNode.js +4 -1
  97. package/dist/likec4diagram/custom/nodes/nodes.d.ts +9 -1
  98. package/dist/likec4diagram/custom/nodes/nodes.js +13 -9
  99. package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.d.ts +1 -1
  100. package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +1 -1
  101. package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +2 -1
  102. package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.js +4 -3
  103. package/dist/likec4diagram/custom/nodes/toolbar/_shared.d.ts +1 -11
  104. package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +7 -51
  105. package/dist/likec4diagram/custom/nodes/toolbar/types.d.ts +5 -0
  106. package/dist/likec4diagram/custom/nodes/toolbar/types.js +7 -0
  107. package/dist/likec4diagram/custom/nodes/toolbar/useHandlers.d.ts +8 -0
  108. package/dist/likec4diagram/custom/nodes/toolbar/useHandlers.js +44 -0
  109. package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +5 -7
  110. package/dist/likec4diagram/state/DiagramActorProvider.d.ts +3 -2
  111. package/dist/likec4diagram/state/DiagramActorProvider.js +96 -70
  112. package/dist/likec4diagram/state/assign.d.ts +4 -2
  113. package/dist/likec4diagram/state/assign.js +39 -103
  114. package/dist/likec4diagram/state/createViewChange.d.ts +3 -0
  115. package/dist/likec4diagram/state/createViewChange.js +90 -0
  116. package/dist/likec4diagram/state/diagram-api.d.ts +113 -0
  117. package/dist/likec4diagram/state/diagram-api.js +134 -0
  118. package/dist/likec4diagram/state/hotkeyActor.d.ts +7 -0
  119. package/dist/likec4diagram/state/hotkeyActor.js +17 -1
  120. package/dist/likec4diagram/state/machine.actions.d.ts +2099 -0
  121. package/dist/likec4diagram/state/machine.actions.js +735 -0
  122. package/dist/likec4diagram/state/machine.d.ts +3717 -0
  123. package/dist/likec4diagram/state/machine.js +141 -0
  124. package/dist/likec4diagram/state/machine.setup.d.ts +284 -0
  125. package/dist/likec4diagram/state/machine.setup.js +71 -0
  126. package/dist/likec4diagram/state/machine.state.initializing.d.ts +183 -0
  127. package/dist/likec4diagram/state/machine.state.initializing.js +55 -0
  128. package/dist/likec4diagram/state/machine.state.navigating.d.ts +117 -0
  129. package/dist/likec4diagram/state/machine.state.navigating.js +45 -0
  130. package/dist/likec4diagram/state/machine.state.ready.d.ts +3666 -0
  131. package/dist/likec4diagram/state/machine.state.ready.js +437 -0
  132. package/dist/likec4diagram/state/syncManualLayoutActor.d.ts +220 -63
  133. package/dist/likec4diagram/state/syncManualLayoutActor.js +218 -143
  134. package/dist/likec4diagram/state/types.d.ts +4 -7
  135. package/dist/likec4diagram/state/utils.d.ts +4 -2
  136. package/dist/likec4diagram/state/utils.js +4 -1
  137. package/dist/likec4diagram/types.d.ts +6 -1
  138. package/dist/likec4diagram/ui/LayoutDriftFrame.d.ts +2 -0
  139. package/dist/likec4diagram/ui/LayoutDriftFrame.js +66 -0
  140. package/dist/likec4diagram/ui/index.d.ts +1 -0
  141. package/dist/likec4diagram/ui/notation/NotationPanel.js +5 -4
  142. package/dist/likec4diagram/useLayoutConstraints.d.ts +10 -5
  143. package/dist/likec4diagram/useLayoutConstraints.js +225 -54
  144. package/dist/likec4diagram/xyflow-diagram/diagram-view.d.ts +0 -1
  145. package/dist/likec4diagram/xyflow-diagram/diagram-view.js +15 -15
  146. package/dist/navigationpanel/NavigationPanel.js +11 -7
  147. package/dist/navigationpanel/NavigationPanelControls.d.ts +2 -1
  148. package/dist/navigationpanel/NavigationPanelControls.js +23 -17
  149. package/dist/navigationpanel/NavigationPanelDropdown.d.ts +2 -1
  150. package/dist/navigationpanel/NavigationPanelDropdown.js +62 -42
  151. package/dist/navigationpanel/_common.d.ts +1 -1
  152. package/dist/navigationpanel/_common.js +4 -2
  153. package/dist/navigationpanel/actor.d.ts +11 -7
  154. package/dist/navigationpanel/actor.js +5 -4
  155. package/dist/navigationpanel/comparepanel/CompareActionsMenu.d.ts +3 -0
  156. package/dist/navigationpanel/comparepanel/CompareActionsMenu.js +59 -0
  157. package/dist/navigationpanel/comparepanel/ComparePanel.d.ts +2 -0
  158. package/dist/navigationpanel/comparepanel/ComparePanel.js +42 -0
  159. package/dist/navigationpanel/comparepanel/ComparePanelControls.d.ts +1 -0
  160. package/dist/navigationpanel/comparepanel/ComparePanelControls.js +60 -0
  161. package/dist/navigationpanel/comparepanel/LayoutTypeSwitcher.d.ts +5 -0
  162. package/dist/navigationpanel/comparepanel/LayoutTypeSwitcher.js +38 -0
  163. package/dist/navigationpanel/comparepanel/index.d.ts +1 -0
  164. package/dist/navigationpanel/controls/{ViewDetailsCard.d.ts → DetailsControls.d.ts} +1 -1
  165. package/dist/navigationpanel/controls/{ViewDetailsCard.js → DetailsControls.js} +18 -14
  166. package/dist/navigationpanel/controls/LayoutWarning.d.ts +2 -0
  167. package/dist/navigationpanel/controls/LayoutWarning.js +102 -0
  168. package/dist/navigationpanel/controls/NavigationButtons.js +4 -3
  169. package/dist/navigationpanel/controls/OpenSource.js +2 -2
  170. package/dist/navigationpanel/controls/SearchControl.d.ts +2 -1
  171. package/dist/navigationpanel/controls/SearchControl.js +15 -17
  172. package/dist/navigationpanel/controls/ToggleReadonly.d.ts +1 -1
  173. package/dist/navigationpanel/controls/ToggleReadonly.js +19 -16
  174. package/dist/navigationpanel/controls/index.d.ts +2 -1
  175. package/dist/navigationpanel/dropdown/ProjectsMenu.d.ts +2 -2
  176. package/dist/navigationpanel/dropdown/ProjectsMenu.js +5 -5
  177. package/dist/navigationpanel/editorpanel/CenterCamera.js +5 -2
  178. package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.d.ts +1 -1
  179. package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.js +21 -20
  180. package/dist/navigationpanel/editorpanel/EditorPanel.js +3 -3
  181. package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.d.ts +2 -2
  182. package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.js +16 -13
  183. package/dist/navigationpanel/editorpanel/ToggleReadonly.d.ts +1 -0
  184. package/dist/navigationpanel/editorpanel/ToggleReadonly.js +15 -0
  185. package/dist/navigationpanel/styles.css.d.ts +2 -2
  186. package/dist/navigationpanel/styles.css.js +4 -4
  187. package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +14 -8
  188. package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +10 -10
  189. package/dist/navigationpanel/walkthrough/DynamicViewControls.js +31 -14
  190. package/dist/navigationpanel/walkthrough/WalkthroughPanel.d.ts +2 -1
  191. package/dist/navigationpanel/walkthrough/WalkthroughPanel.js +66 -49
  192. package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/actions/dist/xstate-actions.cjs.js +37 -0
  193. package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dev/dist/xstate-dev.cjs.js +59 -0
  194. package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dist/assign-dea9f7c8.cjs.js +140 -0
  195. package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dist/log-ec8d4df4.cjs.js +401 -0
  196. package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/dist/raise-da5b247f.cjs.js +2716 -0
  197. package/dist/node_modules/.pnpm/xstate@5.24.0_patch_hash_3a1bd6d012ec67bf6e38a00c3226d1be77089442f83aeb6e424b00ca2a11d21c/node_modules/xstate/guards/dist/xstate-guards.cjs.js +26 -0
  198. package/dist/overlays/element-details/ElementDetails.js +7 -7
  199. package/dist/overlays/element-details/ElementDetailsCard.js +7 -5
  200. package/dist/overlays/element-details/MetadataValue.js +2 -2
  201. package/dist/overlays/element-details/TabPanelDeployments.js +6 -4
  202. package/dist/overlays/element-details/TabPanelRelationships.js +3 -3
  203. package/dist/overlays/element-details/TabPanelStructure.js +1 -1
  204. package/dist/overlays/element-details/actor.d.ts +3 -2
  205. package/dist/overlays/overlaysActor.d.ts +304 -62
  206. package/dist/overlays/overlaysActor.js +132 -131
  207. package/dist/overlays/relationship-details/RelationshipDetails.js +4 -3
  208. package/dist/overlays/relationship-details/SelectEdge.js +2 -2
  209. package/dist/overlays/relationship-details/actor.d.ts +14 -2
  210. package/dist/overlays/relationship-details/actor.js +17 -3
  211. package/dist/overlays/relationship-details/custom/ElementActions.js +8 -5
  212. package/dist/overlays/relationship-details/custom/edgeTypes.js +4 -1
  213. package/dist/overlays/relationship-details/custom/nodeTypes.js +4 -1
  214. package/dist/overlays/relationship-details/hooks.js +1 -1
  215. package/dist/overlays/relationships-browser/RelationshipsBrowser.js +6 -4
  216. package/dist/overlays/relationships-browser/SelectElement.js +2 -2
  217. package/dist/overlays/relationships-browser/actor.d.ts +239 -173
  218. package/dist/overlays/relationships-browser/actor.js +132 -110
  219. package/dist/overlays/relationships-browser/custom/ElementActions.js +44 -37
  220. package/dist/overlays/relationships-browser/custom/edgeTypes.js +4 -1
  221. package/dist/overlays/relationships-browser/custom/nodeTypes.js +4 -1
  222. package/dist/overlays/relationships-browser/hooks.js +7 -6
  223. package/dist/search/Search.js +2 -1
  224. package/dist/search/components/ElementsColumn.js +5 -3
  225. package/dist/search/components/PickView.js +1 -1
  226. package/dist/search/components/SearchByTags.js +21 -44
  227. package/dist/search/components/SearchInput.js +1 -1
  228. package/dist/search/components/ViewsColum.js +6 -4
  229. package/dist/shadowroot/ShadowRoot.js +1 -1
  230. package/dist/styles.css2.js +1 -1
  231. package/dist/utils/index.d.ts +4 -4
  232. package/dist/utils/vector.d.ts +78 -21
  233. package/dist/utils/vector.js +91 -24
  234. package/dist/utils/view-bounds.d.ts +8 -0
  235. package/dist/utils/view-bounds.js +57 -0
  236. package/dist/utils/xyflow.d.ts +49 -7
  237. package/dist/utils/xyflow.js +63 -11
  238. package/package.json +19 -18
  239. package/panda.buildinfo.json +107 -66
  240. package/styles-min.css +1 -1
  241. package/styles.css +1 -1
  242. package/dist/hooks/useCurrentViewId.d.ts +0 -6
  243. package/dist/likec4diagram/custom/edges/utils.js +0 -23
  244. package/dist/likec4diagram/state/diagram-machine.d.ts +0 -2590
  245. package/dist/likec4diagram/state/diagram-machine.js +0 -1180
  246. package/dist/navigationpanel/editorpanel/LayoutDriftNotification.d.ts +0 -1
  247. package/dist/navigationpanel/editorpanel/LayoutDriftNotification.js +0 -56
  248. package/dist/utils/get-view-bounds.d.ts +0 -3
  249. package/dist/utils/get-view-bounds.js +0 -14
  250. /package/dist/base/{types.js → Base.js} +0 -0
  251. /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
  252. /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
  253. /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
  254. /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
  255. /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
  256. /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
  257. /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
  258. /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
  259. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.js +0 -0
  260. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronDown.js +0 -0
  261. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronLeft.js +0 -0
  262. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronRight.js +0 -0
  263. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.js +0 -0
  264. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconCylinder.js +0 -0
  265. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconDeviceMobile.js +0 -0
  266. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconDirectionSignFilled.js +0 -0
  267. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconExternalLink.js +0 -0
  268. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconFileSymlink.js +0 -0
  269. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconFocusCentered.js +0 -0
  270. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconFolderFilled.js +0 -0
  271. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconHelpCircle.js +0 -0
  272. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconId.js +0 -0
  273. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconInfoCircle.js +0 -0
  274. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignBottom.js +0 -0
  275. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignCenter.js +0 -0
  276. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignLeft.js +0 -0
  277. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignMiddle.js +0 -0
  278. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignRight.js +0 -0
  279. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignTop.js +0 -0
  280. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutBoardSplit.js +0 -0
  281. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutCollage.js +0 -0
  282. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutDashboard.js +0 -0
  283. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLink.js +0 -0
  284. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLock.js +0 -0
  285. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconLockOpen2.js +0 -0
  286. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerPlayFilled.js +0 -0
  287. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipBackFilled.js +0 -0
  288. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipForwardFilled.js +0 -0
  289. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerStopFilled.js +0 -0
  290. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconRectangularPrism.js +0 -0
  291. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconReorder.js +0 -0
  292. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconRouteOff.js +0 -0
  293. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconSearch.js +0 -0
  294. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconSelector.js +0 -0
  295. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconStack2.js +0 -0
  296. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconStarFilled.js +0 -0
  297. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconTarget.js +0 -0
  298. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconTransform.js +0 -0
  299. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconUser.js +0 -0
  300. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.1.1 → @tabler_icons-react@3.35.0_react@19.2.0}/node_modules/@tabler/icons-react/dist/esm/icons/IconX.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/IconZoomScan.js +0 -0
@@ -1,48 +1,25 @@
1
1
  import { jsx, Fragment } from 'react/jsx-runtime';
2
2
  import { shallowEqual } from 'fast-equals';
3
3
  import { useContext, createContext, useState, useEffect } from 'react';
4
- import { mapToObj } from 'remeda';
5
4
 
6
- const FeatureNames = [
7
- "Controls",
8
- "ReadOnly",
9
- "FocusMode",
10
- "NavigateTo",
11
- "ElementDetails",
12
- "RelationshipDetails",
13
- "RelationshipBrowser",
14
- "Search",
15
- "NavigationButtons",
16
- "Notations",
17
- "DynamicViewWalkthrough",
18
- "EdgeEditing",
19
- "FitView",
20
- /**
21
- * Running in VSCode
22
- */
23
- "Vscode",
24
- "ElementTags"
25
- ];
26
- const AllDisabled = mapToObj(
27
- FeatureNames,
28
- (name) => [`enable${name}`, false]
29
- );
30
- const DiagramFeaturesContext = createContext(AllDisabled);
31
- const validate = (features) => {
32
- let {
33
- enableReadOnly,
34
- enableEdgeEditing,
35
- ...rest
36
- } = features;
37
- if (enableReadOnly) {
38
- enableEdgeEditing = false;
39
- }
40
- return {
41
- enableReadOnly,
42
- enableEdgeEditing,
43
- ...rest
44
- };
5
+ const DefaultFeatures = {
6
+ enableReadOnly: true,
7
+ enableCompareWithLatest: false,
8
+ enableControls: false,
9
+ enableDynamicViewWalkthrough: false,
10
+ enableElementDetails: false,
11
+ enableFocusMode: false,
12
+ enableNavigateTo: false,
13
+ enableNotations: false,
14
+ enableRelationshipBrowser: false,
15
+ enableRelationshipDetails: false,
16
+ enableSearch: false,
17
+ enableNavigationButtons: false,
18
+ enableFitView: false,
19
+ enableVscode: false,
20
+ enableElementTags: false
45
21
  };
22
+ const DiagramFeaturesContext = createContext(DefaultFeatures);
46
23
  function DiagramFeatures({
47
24
  children,
48
25
  features,
@@ -53,11 +30,11 @@ function DiagramFeatures({
53
30
  useEffect(
54
31
  () => {
55
32
  setScope((current) => {
56
- const next = validate({
33
+ const next = {
57
34
  ...outerScope,
58
35
  ...features,
59
36
  ...overrides
60
- });
37
+ };
61
38
  return shallowEqual(current, next) ? current : next;
62
39
  });
63
40
  },
@@ -65,18 +42,13 @@ function DiagramFeatures({
65
42
  );
66
43
  return /* @__PURE__ */ jsx(DiagramFeaturesContext.Provider, { value: scope, children });
67
44
  }
45
+ const overridesForOverlays = {
46
+ enableControls: false,
47
+ enableReadOnly: true,
48
+ enableCompareWithLatest: false
49
+ };
68
50
  DiagramFeatures.Overlays = ({ children }) => {
69
- return /* @__PURE__ */ jsx(
70
- DiagramFeatures,
71
- {
72
- overrides: {
73
- enableControls: false,
74
- enableReadOnly: true,
75
- enableEdgeEditing: false
76
- },
77
- children
78
- }
79
- );
51
+ return /* @__PURE__ */ jsx(DiagramFeatures, { overrides: overridesForOverlays, children });
80
52
  };
81
53
  function useEnabledFeatures() {
82
54
  return useContext(DiagramFeaturesContext);
@@ -94,15 +66,15 @@ function IfNotEnabled({ feature, children }) {
94
66
  return notEnabled ? /* @__PURE__ */ jsx(Fragment, { children }) : null;
95
67
  }
96
68
  function IfReadOnly({ children }) {
97
- const isReadOnly = useEnabledFeatures()[`enableReadOnly`] === true;
69
+ const isReadOnly = useEnabledFeatures().enableReadOnly === true;
98
70
  return isReadOnly ? /* @__PURE__ */ jsx(Fragment, { children }) : null;
99
71
  }
100
72
  function IfNotReadOnly({ children }) {
101
- const isReadOnly = useEnabledFeatures()[`enableReadOnly`] === true;
73
+ const isReadOnly = useEnabledFeatures().enableReadOnly === true;
102
74
  if (isReadOnly) {
103
75
  return null;
104
76
  }
105
77
  return /* @__PURE__ */ jsx(Fragment, { children });
106
78
  }
107
79
 
108
- export { AllDisabled, DiagramFeatures, IfEnabled, IfNotEnabled, IfNotReadOnly, IfReadOnly, useEnabledFeatures };
80
+ export { DefaultFeatures, DiagramFeatures, IfEnabled, IfNotEnabled, IfNotReadOnly, IfReadOnly, useEnabledFeatures };
@@ -1,12 +1,12 @@
1
1
  import { jsx, Fragment } from 'react/jsx-runtime';
2
2
  import { cx } from '@likec4/styles/css';
3
3
  import { createContext, useContext } from 'react';
4
- import IconCylinder from '../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconCylinder.js';
5
- import IconRectangularPrism from '../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconRectangularPrism.js';
6
- import IconReorder from '../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconReorder.js';
7
- import IconUser from '../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconUser.js';
8
- import IconDeviceMobile from '../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconDeviceMobile.js';
9
- import IconBrowser from '../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconBrowser.js';
4
+ import IconCylinder from '../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.2.0/node_modules/@tabler/icons-react/dist/esm/icons/IconCylinder.js';
5
+ import IconRectangularPrism from '../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.2.0/node_modules/@tabler/icons-react/dist/esm/icons/IconRectangularPrism.js';
6
+ import IconReorder from '../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.2.0/node_modules/@tabler/icons-react/dist/esm/icons/IconReorder.js';
7
+ import IconUser from '../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.2.0/node_modules/@tabler/icons-react/dist/esm/icons/IconUser.js';
8
+ import IconDeviceMobile from '../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.2.0/node_modules/@tabler/icons-react/dist/esm/icons/IconDeviceMobile.js';
9
+ import IconBrowser from '../node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.2.0/node_modules/@tabler/icons-react/dist/esm/icons/IconBrowser.js';
10
10
 
11
11
  const IconRendererContext = createContext(null);
12
12
  function IconRendererProvider({
@@ -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,29 +1,13 @@
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)) {
@@ -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,7 +1,7 @@
1
1
  export type { DiagramActorEvent, DiagramActorRef, DiagramContext, } 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';
@@ -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,9 +13,9 @@ 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
21
  export { useHasProjects, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext } from '../hooks/useLikeC4Project.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,10 +1,11 @@
1
+ export { useCallbackRef } from './useCallbackRef';
1
2
  export { useId } from './useId';
2
3
  export { useMantinePortalProps } from './useMantinePortalProps';
3
4
  export { useSetState } from './useSetState';
4
5
  export { useUpdateEffect } from './useUpdateEffect';
5
6
  export { useCurrentZoom, useIsZoomTooSmall, useXYFlow, useXYInternalNode, useXYStore, useXYStoreApi } from './useXYFlow';
6
7
  export type { XYFlowInstance, XYStoreApi, XYStoreState } from './useXYFlow';
7
- export { useCurrentViewId } from './useCurrentViewId';
8
+ export { useCurrentView, useCurrentViewId } from './useCurrentView';
8
9
  export { useCurrentViewModel } from './useCurrentViewModel';
9
10
  export { useLikeC4Model, useLikeC4Specification, useLikeC4ViewModel } from './useLikeC4Model';
10
11
  export { useHasProjects, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext, } from './useLikeC4Project';
@@ -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