@likec4/diagram 1.46.4 → 1.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (337) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -1
  3. package/bundle/index.js +7332 -5799
  4. package/dist/LikeC4Diagram.d.ts +1 -1
  5. package/dist/LikeC4Diagram.js +20 -14
  6. package/dist/LikeC4Diagram.props.d.ts +2 -6
  7. package/dist/LikeC4ProjectsOverview.d.ts +7 -0
  8. package/dist/LikeC4ProjectsOverview.js +32 -0
  9. package/dist/LikeC4ProjectsProvider.js +7 -5
  10. package/dist/LikeC4Styles.d.ts +2 -6
  11. package/dist/LikeC4Styles.js +44 -43
  12. package/dist/LikeC4View.d.ts +9 -1
  13. package/dist/LikeC4View.js +10 -8
  14. package/dist/ReactLikeC4.d.ts +12 -2
  15. package/dist/ReactLikeC4.js +5 -3
  16. package/dist/adhoc-editor/ActorProvider.d.ts +7 -0
  17. package/dist/adhoc-editor/ActorProvider.js +41 -0
  18. package/dist/adhoc-editor/EditorNavigationPanel.d.ts +1 -0
  19. package/dist/adhoc-editor/EditorNavigationPanel.js +32 -0
  20. package/dist/adhoc-editor/LikeC4AdHocViewEditor.d.ts +4 -0
  21. package/dist/adhoc-editor/LikeC4AdHocViewEditor.js +71 -0
  22. package/dist/adhoc-editor/SelectElementOverlay.d.ts +1 -0
  23. package/dist/adhoc-editor/SelectElementOverlay.js +124 -0
  24. package/dist/adhoc-editor/actor.d.ts +131 -0
  25. package/dist/adhoc-editor/actor.editor.d.ts +54 -0
  26. package/dist/adhoc-editor/actor.editor.js +96 -0
  27. package/dist/adhoc-editor/actor.js +20 -0
  28. package/dist/adhoc-editor/actor.layouter.d.ts +48 -0
  29. package/dist/adhoc-editor/actor.layouter.js +66 -0
  30. package/dist/adhoc-editor/actor.types.d.ts +57 -0
  31. package/dist/adhoc-editor/actor.types.js +22 -0
  32. package/dist/adhoc-editor/hooks.d.ts +14 -0
  33. package/dist/adhoc-editor/hooks.js +47 -0
  34. package/dist/adhoc-editor/index.d.ts +2 -0
  35. package/dist/adhoc-editor/viewrules/ViewRulesPanel.d.ts +6 -0
  36. package/dist/adhoc-editor/viewrules/ViewRulesPanel.js +104 -0
  37. package/dist/base/const.d.ts +1 -0
  38. package/dist/base/const.js +2 -1
  39. package/dist/base/updateEdges.js +26 -3
  40. package/dist/base/updateNodes.js +8 -5
  41. package/dist/base-primitives/Markdown.js +1 -1
  42. package/dist/base-primitives/NodeHandles.d.ts +4 -2
  43. package/dist/base-primitives/NodeHandles.js +46 -19
  44. package/dist/base-primitives/compound/CompoundActionButton.js +3 -1
  45. package/dist/base-primitives/compound/CompoundDetailsButton.js +3 -1
  46. package/dist/base-primitives/compound/CompoundNodeContainer.d.ts +4 -3
  47. package/dist/base-primitives/compound/CompoundNodeContainer.js +6 -4
  48. package/dist/base-primitives/compound/CompoundTitle.js +1 -2
  49. package/dist/base-primitives/edge/EdgeActionButton.js +1 -1
  50. package/dist/base-primitives/edge/EdgeContainer.js +5 -2
  51. package/dist/base-primitives/edge/EdgeLabelContainer.js +5 -1
  52. package/dist/base-primitives/element/ElementActionButtons.js +31 -58
  53. package/dist/base-primitives/element/ElementData.d.ts +7 -7
  54. package/dist/base-primitives/element/ElementData.js +61 -48
  55. package/dist/base-primitives/element/ElementDetailsButton.js +2 -1
  56. package/dist/base-primitives/element/ElementNodeContainer.d.ts +2 -2
  57. package/dist/base-primitives/element/ElementNodeContainer.js +3 -3
  58. package/dist/base-primitives/element/ElementShape.js +109 -20
  59. package/dist/base-primitives/element/ElementTags.d.ts +6 -2
  60. package/dist/base-primitives/element/ElementTags.js +55 -32
  61. package/dist/base-primitives/index.d.ts +1 -1
  62. package/dist/base-primitives/memoEdge.js +1 -1
  63. package/dist/base-primitives/memoNode.js +1 -1
  64. package/dist/components/ErrorFallback.js +1 -1
  65. package/dist/components/Link.js +2 -2
  66. package/dist/components/Logo.js +1 -1
  67. package/dist/components/NavigationPanel.d.ts +11 -0
  68. package/dist/components/NavigationPanel.js +50 -0
  69. package/dist/components/RootContainer.js +5 -8
  70. package/dist/context/DefaultMantineProvider.d.ts +2 -0
  71. package/dist/context/DefaultMantineProvider.js +66 -0
  72. package/dist/context/DiagramEventHandlers.js +1 -1
  73. package/dist/context/DiagramFeatures.js +12 -11
  74. package/dist/context/EnsureMantine.d.ts +0 -3
  75. package/dist/context/EnsureMantine.js +3 -4
  76. package/dist/context/IconRenderer.d.ts +14 -0
  77. package/dist/context/IconRenderer.js +11 -8
  78. package/dist/context/TagStylesContext.js +12 -4
  79. package/dist/custom/hooks.d.ts +2 -2
  80. package/dist/custom/index.d.ts +1 -1
  81. package/dist/custom/index.js +2 -2
  82. package/dist/editor/LikeC4EditorCallbacks.d.ts +18 -0
  83. package/dist/editor/LikeC4EditorCallbacks.js +5 -0
  84. package/dist/editor/LikeC4EditorProvider.d.ts +30 -18
  85. package/dist/editor/LikeC4EditorProvider.js +2 -2
  86. package/dist/editor/applyChangesToManualLayout.js +1 -0
  87. package/dist/editor/editorActor.actions.d.ts +25 -25
  88. package/dist/editor/editorActor.actions.js +2 -2
  89. package/dist/editor/editorActor.setup.d.ts +84 -0
  90. package/dist/editor/editorActor.setup.js +38 -0
  91. package/dist/editor/editorActor.states.d.ts +9 -0
  92. package/dist/editor/{editorActor.js → editorActor.states.js} +22 -64
  93. package/dist/editor/index.d.ts +4 -3
  94. package/dist/editor/useEditorActorLogic.d.ts +2 -564
  95. package/dist/editor/useEditorActorLogic.js +8 -12
  96. package/dist/hooks/index.d.ts +1 -1
  97. package/dist/hooks/useCallbackRef.d.ts +6 -0
  98. package/dist/hooks/useCurrentViewModel.d.ts +10 -0
  99. package/dist/hooks/useDiagram.js +2 -2
  100. package/dist/hooks/useDiagramCompareLayout.d.ts +1 -1
  101. package/dist/hooks/useDiagramCompareLayout.js +1 -1
  102. package/dist/hooks/useLikeC4ElementsTree.js +1 -1
  103. package/dist/hooks/useLikeC4Model.js +2 -2
  104. package/dist/hooks/useLikeC4Project.js +10 -2
  105. package/dist/hooks/useLikeC4Styles.js +0 -3
  106. package/dist/hooks/useSetState.d.ts +6 -1
  107. package/dist/hooks/useSetState.js +7 -4
  108. package/dist/hooks/useXYFlow.d.ts +7 -1
  109. package/dist/hooks/useXYFlow.js +4 -4
  110. package/dist/index.d.ts +9 -5
  111. package/dist/index.js +6 -3
  112. package/dist/likec4diagram/DiagramUI.js +1 -3
  113. package/dist/likec4diagram/DiagramXYFlow.js +26 -12
  114. package/dist/likec4diagram/convert-to-xyflow.d.ts +2 -1
  115. package/dist/likec4diagram/convert-to-xyflow.js +2 -6
  116. package/dist/likec4diagram/custom/edges/RelationshipEdge.js +13 -14
  117. package/dist/likec4diagram/custom/edges/useControlPoints.js +3 -3
  118. package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.d.ts +3 -0
  119. package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.js +68 -35
  120. package/dist/likec4diagram/custom/nodes/ElementActions.d.ts +1 -2
  121. package/dist/likec4diagram/custom/nodes/ElementActions.js +7 -10
  122. package/dist/likec4diagram/custom/nodes/SequenceActorNode.js +7 -5
  123. package/dist/likec4diagram/custom/nodes/nodes.js +25 -6
  124. package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +8 -7
  125. package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +1 -38
  126. package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.d.ts +6 -1
  127. package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.js +35 -19
  128. package/dist/likec4diagram/custom/nodes/toolbar/Toolbar.js +9 -5
  129. package/dist/likec4diagram/custom/nodes/toolbar/_shared.d.ts +6 -1
  130. package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +46 -10
  131. package/dist/likec4diagram/custom/nodes/toolbar/styles.css.js +2 -2
  132. package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +15 -15
  133. package/dist/likec4diagram/relationship-popover/components.d.ts +7 -0
  134. package/dist/likec4diagram/relationship-popover/components.js +39 -0
  135. package/dist/likec4diagram/state/DiagramActorProvider.d.ts +4 -3
  136. package/dist/likec4diagram/state/DiagramActorProvider.js +14 -15
  137. package/dist/likec4diagram/state/assign.d.ts +1 -1
  138. package/dist/likec4diagram/state/createViewChange.js +16 -4
  139. package/dist/likec4diagram/state/machine.actions.d.ts +65 -0
  140. package/dist/likec4diagram/state/machine.actions.js +51 -39
  141. package/dist/likec4diagram/state/machine.actions.layout.d.ts +22 -2
  142. package/dist/likec4diagram/state/machine.actions.layout.js +32 -14
  143. package/dist/likec4diagram/state/machine.d.ts +1 -1
  144. package/dist/likec4diagram/state/machine.js +31 -30
  145. package/dist/likec4diagram/state/machine.setup.d.ts +21 -5
  146. package/dist/likec4diagram/state/machine.setup.js +13 -4
  147. package/dist/likec4diagram/state/machine.state.initializing.d.ts +32 -2
  148. package/dist/likec4diagram/state/machine.state.navigating.d.ts +1 -1
  149. package/dist/likec4diagram/state/machine.state.navigating.js +81 -49
  150. package/dist/likec4diagram/state/machine.state.ready.d.ts +508 -582
  151. package/dist/likec4diagram/state/machine.state.ready.focused.d.ts +17 -148
  152. package/dist/likec4diagram/state/machine.state.ready.focused.js +6 -14
  153. package/dist/likec4diagram/state/machine.state.ready.idle.d.ts +11 -96
  154. package/dist/likec4diagram/state/machine.state.ready.idle.js +7 -12
  155. package/dist/likec4diagram/state/machine.state.ready.js +80 -69
  156. package/dist/likec4diagram/state/machine.state.ready.printing.d.ts +4 -0
  157. package/dist/likec4diagram/state/machine.state.ready.printing.js +4 -3
  158. package/dist/likec4diagram/state/machine.state.ready.walkthrough.d.ts +145 -2
  159. package/dist/likec4diagram/state/machine.state.ready.walkthrough.js +29 -21
  160. package/dist/likec4diagram/state/types.d.ts +1 -1
  161. package/dist/likec4diagram/state/utils.d.ts +13 -14
  162. package/dist/likec4diagram/state/utils.js +11 -3
  163. package/dist/likec4diagram/types.d.ts +9 -1
  164. package/dist/likec4diagram/ui/notation/NotationPanel.css.js +1 -1
  165. package/dist/likec4diagram/ui/notation/NotationPanel.js +3 -3
  166. package/dist/likec4diagram/useLayoutConstraints.js +4 -1
  167. package/dist/likec4diagram/xyflow-diagram/diagram-view.d.ts +11 -3
  168. package/dist/likec4diagram/xyflow-diagram/diagram-view.js +5 -3
  169. package/dist/likec4diagram/xyflow-sequence/sequence-layout.d.ts +7 -3
  170. package/dist/likec4diagram/xyflow-sequence/sequence-layout.js +10 -8
  171. package/dist/likec4diagram/xyflow-sequence/utils.d.ts +1 -1
  172. package/dist/navigationpanel/NavigationPanel.js +2 -1
  173. package/dist/navigationpanel/NavigationPanelControls.js +6 -4
  174. package/dist/navigationpanel/NavigationPanelDropdown.js +7 -7
  175. package/dist/navigationpanel/_common.js +1 -2
  176. package/dist/navigationpanel/comparepanel/CompareActionsMenu.js +2 -2
  177. package/dist/navigationpanel/comparepanel/ComparePanelControls.js +1 -1
  178. package/dist/navigationpanel/comparepanel/LayoutTypeSwitcher.js +4 -5
  179. package/dist/navigationpanel/controls/DetailsControls.js +5 -5
  180. package/dist/navigationpanel/controls/LayoutWarning.js +2 -2
  181. package/dist/navigationpanel/controls/LogoButton.d.ts +1 -0
  182. package/dist/navigationpanel/controls/{BurgerButton.js → LogoButton.js} +5 -5
  183. package/dist/navigationpanel/controls/NavigationButtons.js +2 -2
  184. package/dist/navigationpanel/controls/OpenSource.js +1 -1
  185. package/dist/navigationpanel/controls/SearchControl.d.ts +1 -2
  186. package/dist/navigationpanel/controls/SearchControl.js +8 -12
  187. package/dist/navigationpanel/controls/ToggleReadonly.js +4 -5
  188. package/dist/navigationpanel/controls/index.d.ts +1 -1
  189. package/dist/navigationpanel/dropdown/ProjectsMenu.js +12 -6
  190. package/dist/navigationpanel/editorpanel/CenterCamera.js +1 -1
  191. package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.js +1 -1
  192. package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.js +9 -9
  193. package/dist/navigationpanel/editorpanel/ToggleReadonly.js +1 -1
  194. package/dist/navigationpanel/editorpanel/styles.js +4 -4
  195. package/dist/navigationpanel/styles.css.js +1 -1
  196. package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +3 -3
  197. package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +67 -67
  198. package/dist/navigationpanel/walkthrough/DynamicViewControls.js +1 -1
  199. package/dist/navigationpanel/walkthrough/WalkthroughPanel.js +1 -1
  200. package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconCirclePlus.js +14 -0
  201. package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconFileText.js +14 -0
  202. package/dist/node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconTrash.js +14 -0
  203. package/dist/overlays/element-details/ElementDetailsCard.css.js +4 -4
  204. package/dist/overlays/element-details/ElementDetailsCard.js +4 -4
  205. package/dist/overlays/element-details/MetadataValue.js +6 -7
  206. package/dist/overlays/element-details/TabPanelDeployments.js +7 -5
  207. package/dist/overlays/element-details/TabPanelRelationships.css.js +5 -25
  208. package/dist/overlays/element-details/TabPanelRelationships.js +3 -3
  209. package/dist/overlays/element-details/TabPanelStructure.js +3 -2
  210. package/dist/overlays/overlaysActor.js +18 -0
  211. package/dist/overlays/relationship-details/RelationshipDetails.d.ts +0 -5
  212. package/dist/overlays/relationship-details/RelationshipDetails.js +4 -4
  213. package/dist/overlays/relationship-details/SelectEdge.css.js +2 -2
  214. package/dist/overlays/relationship-details/SelectEdge.js +2 -2
  215. package/dist/overlays/relationship-details/compute.js +1 -1
  216. package/dist/overlays/relationship-details/custom/ElementActions.js +3 -3
  217. package/dist/overlays/relationship-details/custom/nodeTypes.js +14 -1
  218. package/dist/overlays/relationship-details/layout.js +1 -1
  219. package/dist/overlays/relationships-browser/RelationshipsBrowser.d.ts +0 -5
  220. package/dist/overlays/relationships-browser/RelationshipsBrowser.js +116 -21
  221. package/dist/overlays/relationships-browser/SelectElement.js +2 -2
  222. package/dist/overlays/relationships-browser/custom/ElementActions.js +3 -3
  223. package/dist/overlays/relationships-browser/custom/EmptyNode.js +21 -6
  224. package/dist/overlays/relationships-browser/custom/edgeTypes.js +0 -1
  225. package/dist/overlays/relationships-browser/custom/nodeTypes.js +14 -1
  226. package/dist/overlays/relationships-browser/layout.d.ts +1 -1
  227. package/dist/overlays/relationships-browser/layout.js +1 -1
  228. package/dist/projects-overview/ProjectsOverview.d.ts +13 -0
  229. package/dist/projects-overview/ProjectsOverview.js +57 -0
  230. package/dist/projects-overview/ProjectsOverviewXY.d.ts +17 -0
  231. package/dist/projects-overview/ProjectsOverviewXY.js +98 -0
  232. package/dist/projects-overview/_types.d.ts +34 -0
  233. package/dist/projects-overview/actor.d.ts +121 -0
  234. package/dist/projects-overview/actor.js +359 -0
  235. package/dist/projects-overview/context.d.ts +4 -0
  236. package/dist/projects-overview/context.js +9 -0
  237. package/dist/projects-overview/custom/edgeTypes.d.ts +3 -0
  238. package/dist/projects-overview/custom/edgeTypes.js +23 -0
  239. package/dist/projects-overview/custom/index.d.ts +2 -0
  240. package/dist/projects-overview/custom/nodeTypes.d.ts +2 -0
  241. package/dist/projects-overview/custom/nodeTypes.js +45 -0
  242. package/dist/projects-overview/hooks.d.ts +5 -0
  243. package/dist/projects-overview/hooks.js +14 -0
  244. package/dist/projects-overview/index.d.ts +1 -0
  245. package/dist/projects-overview/layouted-to-xyflow.d.ts +6 -0
  246. package/dist/projects-overview/layouted-to-xyflow.js +49 -0
  247. package/dist/projects-overview/panel/ProjectsOverviewPanel.d.ts +1 -0
  248. package/dist/projects-overview/panel/ProjectsOverviewPanel.js +11 -0
  249. package/dist/projects-overview/persistence.d.ts +5 -0
  250. package/dist/projects-overview/persistence.js +24 -0
  251. package/dist/search/Search.d.ts +1 -4
  252. package/dist/search/Search.js +89 -87
  253. package/dist/search/components/ElementsColumn.css.js +3 -3
  254. package/dist/search/components/ElementsColumn.js +3 -4
  255. package/dist/search/components/PickView.d.ts +3 -1
  256. package/dist/search/components/PickView.js +5 -4
  257. package/dist/search/components/SearchByTags.js +1 -1
  258. package/dist/search/components/SearchInput.js +1 -1
  259. package/dist/search/components/ViewsColum.js +2 -2
  260. package/dist/search/components/_shared.css.js +1 -1
  261. package/dist/search/components/utils.js +1 -1
  262. package/dist/search/hooks.d.ts +1 -6
  263. package/dist/search/hooks.js +12 -9
  264. package/dist/search/searchActor.d.ts +1 -1
  265. package/dist/shadowroot/ShadowRoot.js +20 -19
  266. package/dist/shadowroot/styles.css.d.ts +0 -2
  267. package/dist/shadowroot/styles.css.js +1 -34
  268. package/dist/styles-font.css2.js +1 -1
  269. package/dist/styles.css2.js +1 -1
  270. package/dist/utils/view-bounds.js +9 -5
  271. package/dist/utils/xyflow.d.ts +19 -3
  272. package/dist/utils/xyflow.js +52 -9
  273. package/package.json +23 -22
  274. package/panda.buildinfo.json +93 -84
  275. package/styles-font.css +1 -1
  276. package/styles-min.css +1 -1
  277. package/styles.css +1 -1
  278. package/dist/base-primitives/element/ElementNodeContainer.css.d.ts +0 -1
  279. package/dist/base-primitives/element/ElementNodeContainer.css.js +0 -39
  280. package/dist/editor/__tests__/fixture.d.ts +0 -205
  281. package/dist/editor/editorActor.d.ts +0 -653
  282. package/dist/likec4diagram/relationship-popover/styles.css.d.ts +0 -2
  283. package/dist/likec4diagram/relationship-popover/styles.css.js +0 -28
  284. package/dist/navigationpanel/controls/BurgerButton.d.ts +0 -1
  285. package/dist/overlays/relationships-browser/custom/styles.css.js +0 -14
  286. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/createReactComponent.js +0 -0
  287. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.js +0 -0
  288. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertTriangle.js +0 -0
  289. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowDownRight.js +0 -0
  290. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowLeft.js +0 -0
  291. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowRight.js +0 -0
  292. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconBolt.js +0 -0
  293. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconBrowser.js +0 -0
  294. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.js +0 -0
  295. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronDown.js +0 -0
  296. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronLeft.js +0 -0
  297. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronRight.js +0 -0
  298. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.js +0 -0
  299. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconCylinder.js +0 -0
  300. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconDeviceMobile.js +0 -0
  301. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconDirectionSignFilled.js +0 -0
  302. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconExternalLink.js +0 -0
  303. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconFileSymlink.js +0 -0
  304. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconFocusCentered.js +0 -0
  305. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconFolderFilled.js +0 -0
  306. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconHelpCircle.js +0 -0
  307. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconId.js +0 -0
  308. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconInfoCircle.js +0 -0
  309. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignBottom.js +0 -0
  310. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignCenter.js +0 -0
  311. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignLeft.js +0 -0
  312. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignMiddle.js +0 -0
  313. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignRight.js +0 -0
  314. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignTop.js +0 -0
  315. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutBoardSplit.js +0 -0
  316. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutCollage.js +0 -0
  317. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutDashboard.js +0 -0
  318. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLink.js +0 -0
  319. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLock.js +0 -0
  320. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconLockOpen2.js +0 -0
  321. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerPlayFilled.js +0 -0
  322. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipBackFilled.js +0 -0
  323. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipForwardFilled.js +0 -0
  324. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerStopFilled.js +0 -0
  325. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconRectangularPrism.js +0 -0
  326. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconReorder.js +0 -0
  327. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconRouteOff.js +0 -0
  328. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconSearch.js +0 -0
  329. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconSelector.js +0 -0
  330. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconStack2.js +0 -0
  331. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconStarFilled.js +0 -0
  332. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconTarget.js +0 -0
  333. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconTransform.js +0 -0
  334. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconUser.js +0 -0
  335. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconX.js +0 -0
  336. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.36.0_react@19.2.3 → @tabler_icons-react@3.36.0_react@19.2.4}/node_modules/@tabler/icons-react/dist/esm/icons/IconZoomScan.js +0 -0
  337. /package/dist/{overlays/relationships-browser → projects-overview}/custom/styles.css.d.ts +0 -0
@@ -8,4 +8,4 @@ export type LikeC4DiagramProps<A extends Any = Any> = PropsWithChildren<LikeC4Di
8
8
  *
9
9
  * Use {@link ReactLikeC4} or {@link LikeC4View} for ready-to-use component
10
10
  */
11
- export declare function LikeC4Diagram<A extends Any = Any>({ onCanvasClick, onCanvasContextMenu, onCanvasDblClick, onEdgeClick, onEdgeContextMenu, onNavigateTo, onNodeClick, onNodeContextMenu, onOpenSource, onBurgerMenuClick, onLayoutTypeChange, onInitialized, view, className, controls, fitView, fitViewPadding: _fitViewPadding, pannable, zoomable, background, enableElementTags, enableFocusMode, enableElementDetails, enableRelationshipDetails, enableRelationshipBrowser, enableCompareWithLatest, nodesSelectable, enableNotations, showNavigationButtons, enableDynamicViewWalkthrough, dynamicViewVariant, enableSearch, initialWidth, initialHeight, reduceGraphics, renderIcon, where, reactFlowProps, renderNodes, children, }: LikeC4DiagramProps<A>): import("react/jsx-runtime").JSX.Element;
11
+ export declare function LikeC4Diagram<A extends Any = Any>({ onCanvasClick, onCanvasContextMenu, onCanvasDblClick, onEdgeClick, onEdgeContextMenu, onNavigateTo, onNodeClick, onNodeContextMenu, onOpenSource, onLogoClick, onLayoutTypeChange, onInitialized, view, className, controls, fitView, fitViewPadding: _fitViewPadding, pannable, zoomable, background, enableElementTags, enableFocusMode, enableElementDetails, enableRelationshipDetails, enableRelationshipBrowser, enableCompareWithLatest, nodesSelectable, enableNotations, showNavigationButtons, enableDynamicViewWalkthrough, dynamicViewVariant, enableSearch, initialWidth, initialHeight, reduceGraphics, renderIcon, where, reactFlowProps, renderNodes, children, }: LikeC4DiagramProps<A>): import("react/jsx-runtime").JSX.Element;
@@ -2,17 +2,18 @@ import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { useCustomCompareMemo } from '@react-hookz/web';
3
3
  import { ReactFlowProvider } from '@xyflow/react';
4
4
  import { deepEqual } from 'fast-equals';
5
- import { useRef } from 'react';
6
- import { isPlainObject, mapValues } from 'remeda';
5
+ import { useRef, Profiler } from 'react';
6
+ import { isEmptyish, isPlainObject, mapValues } from 'remeda';
7
7
  import { RootContainer } from './components/RootContainer.js';
8
8
  import { TagStylesProvider } from './context/TagStylesContext.js';
9
9
  import { useId } from './hooks/useId.js';
10
+ import { useOptionalLikeC4Model } from './hooks/useLikeC4Model.js';
10
11
  import { LikeC4DiagramUI } from './likec4diagram/DiagramUI.js';
11
12
  import { LikeC4DiagramXYFlow } from './likec4diagram/DiagramXYFlow.js';
12
13
  import { DiagramActorProvider } from './likec4diagram/state/DiagramActorProvider.js';
13
14
  import { LikeC4Styles } from './LikeC4Styles.js';
14
15
  import { pickViewBounds } from './utils/view-bounds.js';
15
- import { useOptionalLikeC4EditorPort } from './editor/LikeC4EditorProvider.js';
16
+ import { useOptionalLikeC4Editor } from './editor/LikeC4EditorProvider.js';
16
17
  import { MinZoom, MaxZoom, FitViewPaddings } from './base/const.js';
17
18
  import { EnsureMantine } from './context/EnsureMantine.js';
18
19
  import { FramerMotionConfig } from './context/FramerMotionConfig.js';
@@ -30,7 +31,7 @@ function LikeC4Diagram({
30
31
  onNodeClick,
31
32
  onNodeContextMenu,
32
33
  onOpenSource,
33
- onBurgerMenuClick,
34
+ onLogoClick,
34
35
  onLayoutTypeChange,
35
36
  onInitialized,
36
37
  view,
@@ -64,7 +65,10 @@ function LikeC4Diagram({
64
65
  }) {
65
66
  const id = useId();
66
67
  const initialRef = useRef(null);
67
- const hasEditor = !!useOptionalLikeC4EditorPort();
68
+ const optionalLikeC4Model = useOptionalLikeC4Model();
69
+ enableCompareWithLatest = enableCompareWithLatest && !!onLayoutTypeChange && !!optionalLikeC4Model && !isEmptyish(optionalLikeC4Model.$data.manualLayouts);
70
+ const hasLikeC4Model = !!optionalLikeC4Model;
71
+ const hasEditor = !!useOptionalLikeC4Editor();
68
72
  const readonly = !hasEditor;
69
73
  nodesSelectable ??= hasEditor || enableFocusMode || !!onNavigateTo || !!onNodeClick;
70
74
  const bounds = pickViewBounds(view, dynamicViewVariant);
@@ -84,8 +88,9 @@ function LikeC4Diagram({
84
88
  initialMinZoom: MinZoom
85
89
  };
86
90
  }
87
- const isReducedGraphicsMode = reduceGraphics === "auto" ? pannable && (bounds.width ?? 1) * (bounds.height ?? 1) > 6e6 && view.nodes.some((n) => n.children?.length > 0) : reduceGraphics;
88
- return /* @__PURE__ */ jsx(EnsureMantine, { children: /* @__PURE__ */ jsx(
91
+ const isReducedGraphicsMode = reduceGraphics === "auto" ? pannable && view.bounds.width * view.bounds.height > 16e6 && view.nodes.some((n) => n.children?.length > 0) : reduceGraphics;
92
+ return /* @__PURE__ */ jsx(Profiler, { id: "LikeC4Diagram", onRender: () => {
93
+ }, children: /* @__PURE__ */ jsx(EnsureMantine, { children: /* @__PURE__ */ jsx(
89
94
  FramerMotionConfig,
90
95
  {
91
96
  ...isReducedGraphicsMode && { reducedMotion: "always" },
@@ -98,17 +103,17 @@ function LikeC4Diagram({
98
103
  enableReadOnly: readonly,
99
104
  enableFocusMode,
100
105
  enableNavigateTo: !!onNavigateTo,
101
- enableElementDetails,
102
- enableRelationshipDetails,
103
- enableRelationshipBrowser,
104
- enableSearch,
106
+ enableElementDetails: enableElementDetails && hasLikeC4Model,
107
+ enableRelationshipDetails: enableRelationshipDetails && hasLikeC4Model,
108
+ enableRelationshipBrowser: enableRelationshipBrowser && hasLikeC4Model,
109
+ enableSearch: enableSearch && hasLikeC4Model,
105
110
  enableNavigationButtons: showNavigationButtons && !!onNavigateTo,
106
111
  enableDynamicViewWalkthrough: view._type === "dynamic" && enableDynamicViewWalkthrough,
107
112
  enableNotations,
108
113
  enableVscode: !!onOpenSource,
109
114
  enableControls: controls,
110
115
  enableElementTags,
111
- enableCompareWithLatest: enableCompareWithLatest && !!onLayoutTypeChange
116
+ enableCompareWithLatest
112
117
  },
113
118
  children: /* @__PURE__ */ jsxs(
114
119
  DiagramEventHandlers,
@@ -123,7 +128,7 @@ function LikeC4Diagram({
123
128
  onNodeClick,
124
129
  onNodeContextMenu,
125
130
  onOpenSource,
126
- onBurgerMenuClick,
131
+ onLogoClick,
127
132
  onInitialized,
128
133
  onLayoutTypeChange
129
134
  },
@@ -137,6 +142,7 @@ function LikeC4Diagram({
137
142
  children: /* @__PURE__ */ jsxs(
138
143
  DiagramActorProvider,
139
144
  {
145
+ id,
140
146
  view,
141
147
  zoomable,
142
148
  pannable,
@@ -167,7 +173,7 @@ function LikeC4Diagram({
167
173
  }
168
174
  ) })
169
175
  }
170
- ) });
176
+ ) }) });
171
177
  }
172
178
  const toLiteralPaddingWithUnit = (value) => {
173
179
  if (typeof value === "number") {
@@ -1,4 +1,4 @@
1
- import { DiagramEdge, DiagramNode, DynamicViewDisplayVariant, LayoutedView, LayoutType, ViewChange, WhereOperator } from '@likec4/core/types';
1
+ import { DiagramEdge, DiagramNode, DynamicViewDisplayVariant, LayoutedView, LayoutType, WhereOperator } from '@likec4/core/types';
2
2
  import { ReactFlowProps } from '@xyflow/react';
3
3
  import { MouseEvent as ReactMouseEvent, ReactNode } from 'react';
4
4
  import { CamelCasedProperties, SetRequired } from 'type-fest';
@@ -235,10 +235,6 @@ export type OnEdgeClick<A extends Any = Unknown> = (edge: DiagramEdge<A>, event:
235
235
  */
236
236
  export type OnCanvasClick = (event: ReactMouseEvent) => void;
237
237
  export type OnCanvasContextMenu = (event: ReactMouseEvent | MouseEvent) => void;
238
- export type ChangeEvent = {
239
- change: ViewChange;
240
- };
241
- export type OnChange = (event: ChangeEvent) => void;
242
238
  export type OnInitialized = (params: {
243
239
  diagram: DiagramApi;
244
240
  xyflow: XYFlowInstance;
@@ -253,7 +249,7 @@ export interface LikeC4DiagramEventHandlers<A extends Any = Unknown> {
253
249
  onEdgeContextMenu?: OnEdgeClick<A> | null | undefined;
254
250
  onCanvasClick?: OnCanvasClick | null | undefined;
255
251
  onCanvasDblClick?: OnCanvasClick | null | undefined;
256
- onBurgerMenuClick?: null | undefined | (() => void);
252
+ onLogoClick?: null | undefined | (() => void);
257
253
  onOpenSource?: OnOpenSource<A> | null | undefined;
258
254
  onInitialized?: OnInitialized | null | undefined;
259
255
  /**
@@ -0,0 +1,7 @@
1
+ import { Simplify } from 'type-fest';
2
+ import { ProjectsOverviewProps } from './projects-overview';
3
+ export type LikeC4ProjectsOverviewProps = Simplify<Omit<ProjectsOverviewProps, 'id'> & {
4
+ className?: string;
5
+ onSelectProject?: ProjectsOverviewProps['onNavigateToProject'];
6
+ }>;
7
+ export declare function LikeC4ProjectsOverview({ view, className, onNavigateToProject, ...props }: LikeC4ProjectsOverviewProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,32 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { RootContainer } from './components/RootContainer.js';
3
+ import { useId } from './hooks/useId.js';
4
+ import { useChangeLikeC4Project } from './hooks/useLikeC4Project.js';
5
+ import { LikeC4Styles } from './LikeC4Styles.js';
6
+ import { EnsureMantine } from './context/EnsureMantine.js';
7
+ import { FramerMotionConfig } from './context/FramerMotionConfig.js';
8
+ import { ProjectsOverview } from './projects-overview/ProjectsOverview.js';
9
+
10
+ function LikeC4ProjectsOverview({
11
+ view,
12
+ className,
13
+ onNavigateToProject,
14
+ ...props
15
+ }) {
16
+ const onChangeLikeC4Project = useChangeLikeC4Project();
17
+ const id = useId();
18
+ onNavigateToProject ??= onChangeLikeC4Project;
19
+ return /* @__PURE__ */ jsx(EnsureMantine, { children: /* @__PURE__ */ jsxs(FramerMotionConfig, { children: [
20
+ /* @__PURE__ */ jsx(LikeC4Styles, { id }),
21
+ /* @__PURE__ */ jsx(RootContainer, { id, className, children: /* @__PURE__ */ jsx(
22
+ ProjectsOverview,
23
+ {
24
+ view,
25
+ onNavigateToProject,
26
+ ...props
27
+ }
28
+ ) })
29
+ ] }) });
30
+ }
31
+
32
+ export { LikeC4ProjectsOverview };
@@ -1,6 +1,6 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { deepEqual } from 'fast-equals';
3
- import { useContext, useState, useEffect } from 'react';
3
+ import { useContext, useEffect, useState } from 'react';
4
4
  import { LikeC4ProjectsContext } from './context/LikeC4ProjectsContext.js';
5
5
  import { useCallbackRef } from './hooks/useCallbackRef.js';
6
6
 
@@ -10,14 +10,16 @@ function LikeC4ProjectsProvider({
10
10
  onProjectChange: _onProjectChange
11
11
  }) {
12
12
  const outerScope = useContext(LikeC4ProjectsContext);
13
- if (outerScope) {
14
- console.warn("LikeC4ProjectsProvider should not be nested inside another one");
15
- }
13
+ useEffect(() => {
14
+ if (outerScope) {
15
+ console.warn("LikeC4ProjectsProvider should not be nested inside another one");
16
+ }
17
+ }, []);
16
18
  const onProjectChange = useCallbackRef(_onProjectChange);
17
19
  const [value, setValue] = useState(() => ({ projects, onProjectChange }));
18
20
  useEffect(() => {
19
21
  setValue((current) => {
20
- return deepEqual(current.projects, projects) ? current : { projects, onProjectChange };
22
+ return deepEqual(current.projects, projects) ? current : { ...current, projects };
21
23
  });
22
24
  }, [projects]);
23
25
  return /* @__PURE__ */ jsx(LikeC4ProjectsContext.Provider, { value, children });
@@ -1,7 +1,3 @@
1
- import { NamedExoticComponent } from 'react';
2
- export declare const LikeC4Styles: NamedExoticComponent<{
1
+ export declare function LikeC4Styles({ id }: {
3
2
  id: string;
4
- }>;
5
- /**
6
- * @internal Memoized styles gives a performance boost during development
7
- */
3
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,41 +1,25 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { useMantineStyleNonce } from '@mantine/core';
3
- import { toRgba, mix, toHex, scale } from 'khroma';
4
- import { memo } from 'react';
5
- import { pipe, entries, map, join, range } from 'remeda';
3
+ import { useMemo, memo } from 'react';
4
+ import { pipe, entries, map, join } from 'remeda';
5
+ import { MAX_COMPOUND_DEPTH } from './base/const.js';
6
6
  import { useLikeC4Styles } from './hooks/useLikeC4Styles.js';
7
7
 
8
8
  const scheme = (scheme2) => `[data-mantine-color-scheme="${scheme2}"]`;
9
9
  const whenDark = scheme("dark");
10
- const MAX_DEPTH = 5;
11
10
  const generateCompoundColors = (rootSelector, name, colors, depth) => {
12
- const compoundDarkColor = (color) => toHex(
13
- scale(color, {
14
- l: -22 - 5 * depth,
15
- s: -10 - 6 * depth
16
- })
17
- );
18
- const compoundLightColor = (color) => toHex(
19
- scale(color, {
20
- l: -20 - 3 * depth,
21
- s: -3 - 6 * depth
22
- })
23
- );
24
- const selector = `:where(${rootSelector} [data-likec4-color="${name}"][data-compound-depth="${depth}"])`;
11
+ const selector = `${rootSelector} :is([data-likec4-color="${name}"][data-compound-depth="${depth}"])`;
25
12
  return `
26
13
  ${selector} {
27
- --likec4-palette-fill: ${compoundLightColor(colors.elements.fill)};
28
- --likec4-palette-stroke: ${compoundLightColor(colors.elements.stroke)};
14
+ --likec4-palette-fill: ${colors.fill};
15
+ --likec4-palette-stroke: ${colors.stroke};
29
16
  }
30
- ${whenDark} ${selector} {
31
- --likec4-palette-fill: ${compoundDarkColor(colors.elements.fill)};
32
- --likec4-palette-stroke: ${compoundDarkColor(colors.elements.stroke)};
33
- }
34
- `.trim();
17
+ `;
35
18
  };
36
- function toStyle(rootSelector, name, colors) {
19
+ function toStyle(styles, params) {
20
+ const { rootSelector, name, colors } = params;
37
21
  const { elements, relationships } = colors;
38
- const selector = `:where(${rootSelector} [data-likec4-color=${name}])`;
22
+ const selector = `${rootSelector} :is([data-likec4-color=${name}])`;
39
23
  return [
40
24
  `
41
25
  ${selector} {
@@ -46,38 +30,55 @@ ${selector} {
46
30
  --likec4-palette-relation-stroke: ${relationships.line};
47
31
  --likec4-palette-relation-label: ${relationships.label};
48
32
  --likec4-palette-relation-label-bg: ${relationships.labelBg};
49
- --likec4-palette-relation-stroke-selected: ${toRgba(mix(relationships.line, "black", 85))};
33
+ --likec4-palette-relation-stroke-selected: oklch(from ${relationships.line} calc(l - 0.15) c h);
50
34
  }
51
35
  ${whenDark} ${selector} {
52
- --likec4-palette-relation-stroke-selected: ${toRgba(mix(relationships.line, "white", 70))};
36
+ --likec4-palette-relation-stroke-selected: oklch(from ${relationships.line} calc(l + 0.15) c h);
53
37
  }
54
38
 
55
- `.trim(),
56
- ...range(1, MAX_DEPTH + 1).map((depth) => generateCompoundColors(rootSelector, name, colors, depth))
57
- ].join("\n");
39
+ `,
40
+ ...styles.colorsForCompounds(elements, MAX_COMPOUND_DEPTH).map(
41
+ (colors2, depth) => generateCompoundColors(rootSelector, name, colors2, depth + 1)
42
+ )
43
+ ].map((s) => s.trim()).join("\n");
58
44
  }
59
- function generateBuiltInColorStyles(rootSelector, theme) {
45
+ function generateBuiltInColorStyles(styles, rootSelector) {
60
46
  return pipe(
61
- theme.colors,
47
+ styles.theme.colors,
62
48
  entries(),
63
- map(([color, values]) => toStyle(rootSelector, color, values)),
49
+ map(
50
+ ([name, colors]) => toStyle(styles, {
51
+ rootSelector,
52
+ name,
53
+ colors
54
+ })
55
+ ),
64
56
  join("\n")
65
57
  );
66
58
  }
67
- const LikeC4Styles = memo(({ id }) => {
59
+ function LikeC4Styles({ id }) {
68
60
  const rootSelector = `#${id}`;
69
61
  const nonce = useMantineStyleNonce()?.();
70
- const { theme } = useLikeC4Styles();
71
- const colorsStyles = generateBuiltInColorStyles(rootSelector, theme);
62
+ const $styles = useLikeC4Styles();
63
+ const colorsStyles = useMemo(() => generateBuiltInColorStyles($styles, rootSelector), [rootSelector, $styles]);
72
64
  return /* @__PURE__ */ jsx(
73
- "style",
65
+ MemoizedStyle,
74
66
  {
75
- type: "text/css",
76
- "data-likec4-colors": id,
77
- dangerouslySetInnerHTML: { __html: colorsStyles },
78
- nonce
67
+ id,
68
+ nonce,
69
+ colorsStyles
79
70
  }
80
71
  );
81
- });
72
+ }
73
+ const MemoizedStyle = memo(({ id, nonce, colorsStyles }) => /* @__PURE__ */ jsx(
74
+ "style",
75
+ {
76
+ type: "text/css",
77
+ "data-likec4-colors": id,
78
+ dangerouslySetInnerHTML: { __html: colorsStyles },
79
+ nonce
80
+ }
81
+ ));
82
+ MemoizedStyle.displayName = "MemoizedStyle";
82
83
 
83
84
  export { LikeC4Styles };
@@ -6,6 +6,14 @@ export interface LikeC4ViewProps<A extends t.aux.Any = t.aux.UnknownLayouted> {
6
6
  * View to display.
7
7
  */
8
8
  viewId: t.aux.ViewId<A>;
9
+ /**
10
+ * Layout to display
11
+ * - `auto`: auto-layouted from the current sources
12
+ * - `manual`: manually layouted (if available, falls back to `auto`)
13
+ *
14
+ * @default 'manual'
15
+ */
16
+ layoutType?: t.LayoutType | undefined;
9
17
  /**
10
18
  * Enable/disable panning
11
19
  * @default false
@@ -260,4 +268,4 @@ export interface LikeC4BrowserProps {
260
268
  *
261
269
  * Component is wrapped in ShadowRoot to isolate styles.
262
270
  */
263
- export declare function LikeC4View<A extends t.aux.Any = t.aux.UnknownLayouted>({ viewId, className, pannable, zoomable, keepAspectRatio, colorScheme, injectFontCss, controls, background, browser, showNavigationButtons, enableNotations, enableFocusMode, enableDynamicViewWalkthrough, enableElementDetails, enableRelationshipDetails, enableRelationshipBrowser, reduceGraphics, mantineTheme, styleNonce, style, reactFlowProps, renderNodes, children, ...props }: LikeC4ViewProps<A>): import("react/jsx-runtime").JSX.Element;
271
+ export declare function LikeC4View<A extends t.aux.Any = t.aux.UnknownLayouted>({ viewId, className, pannable, zoomable, keepAspectRatio, colorScheme, injectFontCss, controls, layoutType: initialLayoutType, background, browser, showNavigationButtons, enableNotations, enableFocusMode, enableDynamicViewWalkthrough, enableElementDetails, enableRelationshipDetails, enableRelationshipBrowser, reduceGraphics, mantineTheme, styleNonce, style, reactFlowProps, renderNodes, children, ...props }: LikeC4ViewProps<A>): import("react/jsx-runtime").JSX.Element;
@@ -14,7 +14,7 @@ import { LikeC4Diagram } from './LikeC4Diagram.js';
14
14
  import { Overlay } from './overlays/overlay/Overlay.js';
15
15
  import { ShadowRoot } from './shadowroot/ShadowRoot.js';
16
16
  import { pickViewBounds } from './utils/view-bounds.js';
17
- import IconX from './node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.3/node_modules/@tabler/icons-react/dist/esm/icons/IconX.js';
17
+ import IconX from './node_modules/.pnpm/@tabler_icons-react@3.36.0_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconX.js';
18
18
 
19
19
  const cssInteractive = css({
20
20
  cursor: "pointer",
@@ -32,6 +32,7 @@ function LikeC4View({
32
32
  colorScheme,
33
33
  injectFontCss = true,
34
34
  controls = false,
35
+ layoutType: initialLayoutType = "manual",
35
36
  background = "transparent",
36
37
  browser = true,
37
38
  showNavigationButtons = false,
@@ -52,11 +53,11 @@ function LikeC4View({
52
53
  }) {
53
54
  const rootRef = useRef(null);
54
55
  const likec4model = useOptionalLikeC4Model();
55
- const [layoutType, setLayoutType] = useState("manual");
56
+ const [layoutType, setLayoutType] = useState(initialLayoutType);
56
57
  const [browserViewId, _onNavigateTo] = useState(null);
57
58
  const onNavigateTo = useCallbackRef((viewId2) => {
58
59
  if (viewId2 && viewId2 !== browserViewId) {
59
- setLayoutType("manual");
60
+ setLayoutType(initialLayoutType);
60
61
  }
61
62
  _onNavigateTo(viewId2);
62
63
  });
@@ -66,17 +67,18 @@ function LikeC4View({
66
67
  if (!likec4model) {
67
68
  return /* @__PURE__ */ jsx(ErrorMessage, { children: "LikeC4Model not found. Make sure you provided LikeC4ModelProvider." });
68
69
  }
69
- const view = likec4model.findView(viewId)?.$layouted;
70
- if (!view) {
70
+ const viewModel = likec4model.findView(viewId);
71
+ if (!viewModel) {
71
72
  return /* @__PURE__ */ jsx(ViewNotFound, { viewId });
72
73
  }
73
- if (view._stage !== "layouted") {
74
+ if (!viewModel.isLayouted()) {
74
75
  return /* @__PURE__ */ jsxs(ErrorMessage, { children: [
75
76
  'LikeC4 View "$',
76
77
  viewId,
77
78
  '" is not layouted. Make sure you have LikeC4ModelProvider with layouted model.'
78
79
  ] });
79
80
  }
81
+ const view = initialLayoutType === "manual" ? viewModel.$layouted : viewModel.$view;
80
82
  const browserViewModel = browserViewId ? likec4model.findView(browserViewId) : null;
81
83
  const browserView = layoutType === "manual" ? browserViewModel?.$layouted : browserViewModel?.$view;
82
84
  const hasNotations = !!enableNotations && (view.notation?.nodes?.length ?? 0) > 0;
@@ -131,8 +133,8 @@ function LikeC4View({
131
133
  },
132
134
  reactFlowProps,
133
135
  renderNodes,
134
- children,
135
- ...props
136
+ ...props,
137
+ children
136
138
  }
137
139
  ),
138
140
  /* @__PURE__ */ jsx(AnimatePresence, { ...root, children: browserView && /* @__PURE__ */ jsxs(Overlay, { openDelay: 0, onClose: () => onNavigateTo(null), children: [
@@ -3,6 +3,16 @@ import { LikeC4DiagramEventHandlers, LikeC4DiagramProperties } from './LikeC4Dia
3
3
  import type * as t from '@likec4/core/types';
4
4
  export type ReactLikeC4Props<A extends t.aux.Any = t.aux.UnknownLayouted> = {
5
5
  viewId: t.aux.ViewId<A>;
6
+ /**
7
+ * Layout to display
8
+ * - `auto`: auto-layouted from the current sources
9
+ * - `manual`: manually layouted (if available, falls back to `auto`)
10
+ *
11
+ * Uncontrolled initial value, use `onLayoutTypeChange` to control it.
12
+ *
13
+ * @default 'manual'
14
+ */
15
+ layoutType?: t.LayoutType | undefined;
6
16
  /**
7
17
  * Keep aspect ratio of the diagram
8
18
  *
@@ -14,7 +24,7 @@ export type ReactLikeC4Props<A extends t.aux.Any = t.aux.UnknownLayouted> = {
14
24
  */
15
25
  colorScheme?: 'light' | 'dark' | undefined;
16
26
  /**
17
- * LikeC4 views are using 'IBM Plex Sans' font.
27
+ * LikeC4 views are using 'IBM Plex Sans Variable' font.
18
28
  * By default, component injects the CSS to document head.
19
29
  * Set to false if you want to handle the font yourself.
20
30
  *
@@ -33,4 +43,4 @@ export type ReactLikeC4Props<A extends t.aux.Any = t.aux.UnknownLayouted> = {
33
43
  *
34
44
  * Component is wrapped in ShadowRoot to isolate styles.
35
45
  */
36
- export declare function ReactLikeC4<A extends t.aux.Any = t.aux.UnknownLayouted>({ viewId, className, colorScheme, injectFontCss, enableNotations, keepAspectRatio, style, mantineTheme, styleNonce, ...props }: ReactLikeC4Props<A>): import("react/jsx-runtime").JSX.Element;
46
+ export declare function ReactLikeC4<A extends t.aux.Any = t.aux.UnknownLayouted>({ viewId, layoutType: initialLayoutType, className, colorScheme, injectFontCss, enableNotations, keepAspectRatio, style, mantineTheme, styleNonce, ...props }: ReactLikeC4Props<A>): import("react/jsx-runtime").JSX.Element;
@@ -8,6 +8,7 @@ import { pickViewBounds } from './utils/view-bounds.js';
8
8
 
9
9
  function ReactLikeC4({
10
10
  viewId,
11
+ layoutType: initialLayoutType = "manual",
11
12
  className,
12
13
  colorScheme,
13
14
  injectFontCss = true,
@@ -22,17 +23,18 @@ function ReactLikeC4({
22
23
  if (!likec4model) {
23
24
  return /* @__PURE__ */ jsx(ErrorMessage, { children: "LikeC4Model not found. Make sure you provided LikeC4ModelProvider." });
24
25
  }
25
- const view = likec4model.findView(viewId)?.$view;
26
- if (!view) {
26
+ const viewModel = likec4model.findView(viewId);
27
+ if (!viewModel) {
27
28
  return /* @__PURE__ */ jsx(ViewNotFound, { viewId });
28
29
  }
29
- if (view._stage !== "layouted") {
30
+ if (!viewModel.isLayouted()) {
30
31
  return /* @__PURE__ */ jsxs(ErrorMessage, { children: [
31
32
  'LikeC4 View "$',
32
33
  viewId,
33
34
  '" is not layouted. Make sure you have LikeC4ModelProvider with layouted model.'
34
35
  ] });
35
36
  }
37
+ const view = initialLayoutType === "manual" ? viewModel.$layouted : viewModel.$view;
36
38
  const bounds = pickViewBounds(view, props.dynamicViewVariant);
37
39
  const hasNotations = !!enableNotations && (view.notation?.nodes?.length ?? 0) > 0;
38
40
  return /* @__PURE__ */ jsx(
@@ -0,0 +1,7 @@
1
+ import { PropsWithChildren, Context } from 'react';
2
+ import { AdhocEditorActorRef } from './actor';
3
+ import { AdhocViewService } from './actor.types';
4
+ export declare const AdhocEditorActorContext: Context<AdhocEditorActorRef | null>;
5
+ export declare function AdhocEditorActorProvider({ children, service }: PropsWithChildren<{
6
+ service: AdhocViewService;
7
+ }>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,41 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { useLogger } from '@mantine/hooks';
3
+ import { useActorRef } from '@xstate/react';
4
+ import { useRef, useEffect, createContext } from 'react';
5
+ import { fromPromise } from 'xstate';
6
+ import { adhocEditorLogic } from './actor.js';
7
+
8
+ const AdhocEditorActorContext = createContext(null);
9
+ const State = {
10
+ read: () => JSON.parse(sessionStorage.getItem("adhoc-editor-state") || "null") ?? void 0,
11
+ write: (state) => sessionStorage.setItem("adhoc-editor-state", JSON.stringify(state))
12
+ };
13
+ function AdhocEditorActorProvider({ children, service }) {
14
+ const serviceRef = useRef(service);
15
+ serviceRef.current = service;
16
+ const actorRef = useActorRef(
17
+ adhocEditorLogic.provide({
18
+ actors: {
19
+ service: fromPromise(({ input }) => serviceRef.current.process(input))
20
+ }
21
+ }),
22
+ {
23
+ id: "adhoc-editor",
24
+ snapshot: State.read(),
25
+ systemId: "adhoc-editor",
26
+ inspect: (event) => {
27
+ console.log("[AdhocEditorActor]", event);
28
+ }
29
+ }
30
+ );
31
+ useLogger("AdhocEditorActor", [actorRef]);
32
+ useEffect(() => {
33
+ const subscription = actorRef.subscribe((state) => {
34
+ State.write(state);
35
+ });
36
+ return () => subscription.unsubscribe();
37
+ }, [actorRef]);
38
+ return /* @__PURE__ */ jsx(AdhocEditorActorContext.Provider, { value: actorRef, children });
39
+ }
40
+
41
+ export { AdhocEditorActorContext, AdhocEditorActorProvider };
@@ -0,0 +1 @@
1
+ export declare const EditorNavigationPanel: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,32 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { useSelector } from '@xstate/react';
3
+ import { prop } from 'remeda';
4
+ import { NavigationPanel } from '../components/NavigationPanel.js';
5
+ import { useAdhocEditorActor, selectFromContext } from './hooks.js';
6
+ import { ViewRulesPanel } from './viewrules/ViewRulesPanel.js';
7
+
8
+ const selectRules = selectFromContext(prop("rules"));
9
+ const EditorNavigationPanel = () => {
10
+ const actorRef = useAdhocEditorActor();
11
+ const rules = useSelector(actorRef, selectRules);
12
+ return /* @__PURE__ */ jsxs(NavigationPanel.Root, { children: [
13
+ /* @__PURE__ */ jsxs(NavigationPanel.Body, { children: [
14
+ /* @__PURE__ */ jsx(NavigationPanel.Logo, {}),
15
+ /* @__PURE__ */ jsx(NavigationPanel.Label, { children: "View Editor" })
16
+ ] }),
17
+ rules.length > 0 && /* @__PURE__ */ jsx(NavigationPanel.Dropdown, { css: { maxW: "250px" }, children: /* @__PURE__ */ jsx(
18
+ ViewRulesPanel,
19
+ {
20
+ rules,
21
+ onToggle: (rule) => {
22
+ actorRef.send({ type: "toggle.rule", ruleId: rule.id });
23
+ },
24
+ onDelete: (rule) => {
25
+ actorRef.send({ type: "delete.rule", ruleId: rule.id });
26
+ }
27
+ }
28
+ ) })
29
+ ] });
30
+ };
31
+
32
+ export { EditorNavigationPanel };
@@ -0,0 +1,4 @@
1
+ import { AdhocViewService } from './actor.types';
2
+ export declare function LikeC4AdHocViewEditor({ service }: {
3
+ service: AdhocViewService;
4
+ }): import("react/jsx-runtime").JSX.Element;