@likec4/diagram 1.44.0 → 1.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (270) hide show
  1. package/bundle/index.js +18847 -17876
  2. package/dist/LikeC4Diagram.d.ts +1 -1
  3. package/dist/LikeC4Diagram.js +15 -12
  4. package/dist/LikeC4Diagram.props.d.ts +13 -20
  5. package/dist/LikeC4ProjectsProvider.js +8 -4
  6. package/dist/LikeC4Styles.js +0 -3
  7. package/dist/LikeC4View.d.ts +3 -3
  8. package/dist/LikeC4View.js +8 -8
  9. package/dist/ReactLikeC4.d.ts +3 -6
  10. package/dist/StaticLikeC4Diagram.js +0 -2
  11. package/dist/base/Base.d.ts +1 -1
  12. package/dist/base/updateEdges.js +25 -15
  13. package/dist/base/updateNodes.d.ts +14 -0
  14. package/dist/base/updateNodes.js +51 -18
  15. package/dist/base-primitives/Markdown.d.ts +30 -4
  16. package/dist/base-primitives/Markdown.js +3 -2
  17. package/dist/base-primitives/NodeHandles.d.ts +2 -1
  18. package/dist/base-primitives/NodeHandles.js +22 -18
  19. package/dist/base-primitives/compound/CompoundActionButton.d.ts +3 -2
  20. package/dist/base-primitives/compound/CompoundActionButton.js +1 -1
  21. package/dist/base-primitives/compound/CompoundDetailsButton.d.ts +3 -2
  22. package/dist/base-primitives/compound/CompoundDetailsButton.js +1 -1
  23. package/dist/base-primitives/edge/EdgeActionButton.d.ts +3 -2
  24. package/dist/base-primitives/edge/EdgeActionButton.js +1 -1
  25. package/dist/base-primitives/edge/EdgeContainer.d.ts +1 -1
  26. package/dist/base-primitives/edge/EdgeContainer.js +6 -4
  27. package/dist/base-primitives/edge/EdgeLabel.d.ts +2 -2
  28. package/dist/base-primitives/edge/EdgeLabel.js +16 -16
  29. package/dist/base-primitives/edge/EdgeLabelContainer.d.ts +1 -1
  30. package/dist/base-primitives/edge/EdgeLabelContainer.js +5 -4
  31. package/dist/base-primitives/edge/EdgePath.js +27 -12
  32. package/dist/base-primitives/element/ElementActionButtons.d.ts +3 -2
  33. package/dist/base-primitives/element/ElementActionButtons.js +3 -3
  34. package/dist/base-primitives/element/ElementData.d.ts +3 -3
  35. package/dist/base-primitives/element/ElementData.js +13 -7
  36. package/dist/base-primitives/element/ElementDetailsButton.d.ts +3 -2
  37. package/dist/base-primitives/element/ElementDetailsButton.js +4 -1
  38. package/dist/base-primitives/element/ElementShape.js +5 -5
  39. package/dist/base-primitives/element/ElementTags.d.ts +6 -4
  40. package/dist/components/ErrorFallback.js +1 -1
  41. package/dist/components/Link.js +2 -2
  42. package/dist/context/DiagramEventHandlers.js +0 -1
  43. package/dist/context/DiagramFeatures.d.ts +2 -1
  44. package/dist/context/DiagramFeatures.js +1 -0
  45. package/dist/context/EnsureMantine.js +2 -1
  46. package/dist/context/IconRenderer.js +6 -6
  47. package/dist/context/TagStylesContext.js +1 -1
  48. package/dist/custom/hooks.d.ts +2 -2
  49. package/dist/custom/index.js +1 -1
  50. package/dist/editor/LikeC4EditorProvider.d.ts +22 -0
  51. package/dist/editor/LikeC4EditorProvider.js +12 -0
  52. package/dist/editor/__tests__/fixture.d.ts +205 -0
  53. package/dist/editor/applyChangesToManualLayout.d.ts +8 -0
  54. package/dist/editor/applyChangesToManualLayout.js +182 -0
  55. package/dist/editor/editorActor.actions.d.ts +201 -0
  56. package/dist/editor/editorActor.actions.js +149 -0
  57. package/dist/editor/editorActor.d.ts +653 -0
  58. package/dist/editor/editorActor.js +324 -0
  59. package/dist/editor/hotkeyActor.d.ts +7 -0
  60. package/dist/editor/hotkeyActor.js +19 -0
  61. package/dist/editor/index.d.ts +3 -2
  62. package/dist/editor/useEditorActorLogic.d.ts +565 -0
  63. package/dist/editor/useEditorActorLogic.js +54 -0
  64. package/dist/hooks/index.d.ts +2 -1
  65. package/dist/hooks/safeContext.d.ts +3 -2
  66. package/dist/hooks/safeContext.js +7 -4
  67. package/dist/hooks/useDiagram.d.ts +4 -2
  68. package/dist/hooks/useDiagram.js +19 -8
  69. package/dist/hooks/useDiagramCompareLayout.d.ts +8 -0
  70. package/dist/hooks/useDiagramCompareLayout.js +29 -4
  71. package/dist/hooks/useLikeC4Project.d.ts +6 -1
  72. package/dist/hooks/useLikeC4Project.js +14 -2
  73. package/dist/hooks/useMediaPrint.d.ts +6 -0
  74. package/dist/index.d.ts +1 -0
  75. package/dist/index.js +1 -0
  76. package/dist/likec4diagram/DiagramXYFlow.js +11 -7
  77. package/dist/likec4diagram/custom/edges/EdgeDrifts.d.ts +6 -0
  78. package/dist/likec4diagram/custom/edges/EdgeDrifts.js +34 -0
  79. package/dist/likec4diagram/custom/edges/RelationshipEdge.js +90 -54
  80. package/dist/likec4diagram/custom/edges/SequenceStepEdge.js +3 -1
  81. package/dist/likec4diagram/custom/edges/edges.css.d.ts +0 -1
  82. package/dist/likec4diagram/custom/edges/edges.css.js +30 -24
  83. package/dist/likec4diagram/custom/edges/useControlPoints.js +5 -5
  84. package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.js +5 -5
  85. package/dist/likec4diagram/custom/nodes/ElementActions.js +2 -2
  86. package/dist/likec4diagram/custom/nodes/NodeDrifts.d.ts +6 -0
  87. package/dist/likec4diagram/custom/nodes/{ElementNodeDrifts.js → NodeDrifts.js} +12 -13
  88. package/dist/likec4diagram/custom/nodes/SequenceActorNode.js +4 -2
  89. package/dist/likec4diagram/custom/nodes/index.d.ts +1 -0
  90. package/dist/likec4diagram/custom/nodes/nodes.js +61 -23
  91. package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.js +2 -2
  92. package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +2 -2
  93. package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +128 -15
  94. package/dist/likec4diagram/relationship-popover/actor.d.ts +1 -1
  95. package/dist/likec4diagram/state/DiagramActorProvider.d.ts +2 -2
  96. package/dist/likec4diagram/state/DiagramActorProvider.js +63 -72
  97. package/dist/likec4diagram/state/assign.d.ts +14 -7
  98. package/dist/likec4diagram/state/assign.js +28 -200
  99. package/dist/likec4diagram/state/createViewChange.js +23 -30
  100. package/dist/likec4diagram/state/diagram-api.d.ts +20 -6
  101. package/dist/likec4diagram/state/diagram-api.js +58 -52
  102. package/dist/likec4diagram/state/hotkeyActor.d.ts +1 -8
  103. package/dist/likec4diagram/state/hotkeyActor.js +13 -17
  104. package/dist/likec4diagram/state/machine.actions.d.ts +1127 -864
  105. package/dist/likec4diagram/state/machine.actions.js +316 -296
  106. package/dist/likec4diagram/state/machine.actions.layout.d.ts +641 -0
  107. package/dist/likec4diagram/state/machine.actions.layout.js +141 -0
  108. package/dist/likec4diagram/state/machine.d.ts +18 -3712
  109. package/dist/likec4diagram/state/machine.js +64 -73
  110. package/dist/likec4diagram/state/machine.setup.d.ts +80 -26
  111. package/dist/likec4diagram/state/machine.setup.js +44 -7
  112. package/dist/likec4diagram/state/machine.state.initializing.d.ts +58 -17
  113. package/dist/likec4diagram/state/machine.state.initializing.js +14 -14
  114. package/dist/likec4diagram/state/machine.state.navigating.d.ts +5 -108
  115. package/dist/likec4diagram/state/machine.state.navigating.js +187 -35
  116. package/dist/likec4diagram/state/machine.state.ready.d.ts +2997 -2598
  117. package/dist/likec4diagram/state/machine.state.ready.focused.d.ts +710 -0
  118. package/dist/likec4diagram/state/machine.state.ready.focused.js +98 -0
  119. package/dist/likec4diagram/state/machine.state.ready.idle.d.ts +540 -0
  120. package/dist/likec4diagram/state/machine.state.ready.idle.js +105 -0
  121. package/dist/likec4diagram/state/machine.state.ready.js +95 -347
  122. package/dist/likec4diagram/state/machine.state.ready.printing.d.ts +140 -0
  123. package/dist/likec4diagram/state/machine.state.ready.printing.js +40 -0
  124. package/dist/likec4diagram/state/machine.state.ready.walkthrough.d.ts +684 -0
  125. package/dist/likec4diagram/state/machine.state.ready.walkthrough.js +190 -0
  126. package/dist/likec4diagram/state/mediaPrintActor.d.ts +12 -0
  127. package/dist/likec4diagram/state/mediaPrintActor.js +18 -0
  128. package/dist/likec4diagram/state/types.d.ts +11 -9
  129. package/dist/likec4diagram/state/utils.d.ts +44 -5
  130. package/dist/likec4diagram/state/utils.js +62 -6
  131. package/dist/likec4diagram/types.d.ts +8 -13
  132. package/dist/likec4diagram/ui/notation/NotationPanel.css.js +5 -2
  133. package/dist/likec4diagram/ui/notation/NotationPanel.js +3 -3
  134. package/dist/likec4diagram/useLayoutConstraints.js +104 -103
  135. package/dist/likec4diagram/xyflow-diagram/diagram-view.js +12 -15
  136. package/dist/likec4diagram/xyflow-sequence/sequence-layout.js +11 -8
  137. package/dist/navigationpanel/NavigationPanel.js +11 -10
  138. package/dist/navigationpanel/NavigationPanelDropdown.js +7 -7
  139. package/dist/navigationpanel/_common.js +1 -1
  140. package/dist/navigationpanel/actor.d.ts +4 -204
  141. package/dist/navigationpanel/actor.js +1 -1
  142. package/dist/navigationpanel/comparepanel/CompareActionsMenu.d.ts +3 -1
  143. package/dist/navigationpanel/comparepanel/CompareActionsMenu.js +40 -14
  144. package/dist/navigationpanel/comparepanel/ComparePanelControls.js +6 -4
  145. package/dist/navigationpanel/comparepanel/LayoutTypeSwitcher.js +2 -2
  146. package/dist/navigationpanel/controls/DetailsControls.js +2 -2
  147. package/dist/navigationpanel/controls/LayoutWarning.js +2 -1
  148. package/dist/navigationpanel/controls/NavigationButtons.js +2 -2
  149. package/dist/navigationpanel/controls/OpenSource.js +1 -1
  150. package/dist/navigationpanel/controls/SearchControl.js +2 -2
  151. package/dist/navigationpanel/controls/ToggleReadonly.js +32 -19
  152. package/dist/navigationpanel/dropdown/ProjectsMenu.js +1 -1
  153. package/dist/navigationpanel/editorpanel/CenterCamera.js +1 -1
  154. package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.js +1 -1
  155. package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.js +9 -9
  156. package/dist/navigationpanel/editorpanel/ToggleReadonly.js +1 -1
  157. package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +3 -3
  158. package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +9 -9
  159. package/dist/navigationpanel/walkthrough/DynamicViewControls.js +1 -1
  160. package/dist/navigationpanel/walkthrough/WalkthroughPanel.js +4 -3
  161. package/dist/overlays/Overlays.js +24 -12
  162. package/dist/overlays/element-details/ElementDetailsCard.css.js +3 -3
  163. package/dist/overlays/element-details/ElementDetailsCard.js +4 -4
  164. package/dist/overlays/element-details/MetadataValue.d.ts +2 -1
  165. package/dist/overlays/element-details/MetadataValue.js +4 -6
  166. package/dist/overlays/element-details/TabPanelDeployments.js +3 -3
  167. package/dist/overlays/element-details/TabPanelRelationships.js +12 -7
  168. package/dist/overlays/element-details/TabPanelStructure.js +1 -1
  169. package/dist/overlays/element-details/actor.d.ts +8 -83
  170. package/dist/overlays/element-details/actor.js +0 -8
  171. package/dist/overlays/overlay/Overlay.js +10 -10
  172. package/dist/overlays/overlaysActor.d.ts +7 -392
  173. package/dist/overlays/overlaysActor.js +73 -49
  174. package/dist/overlays/relationship-details/RelationshipDetails.js +3 -3
  175. package/dist/overlays/relationship-details/SelectEdge.js +2 -2
  176. package/dist/overlays/relationship-details/_types.d.ts +3 -4
  177. package/dist/overlays/relationship-details/actor.d.ts +6 -562
  178. package/dist/overlays/relationship-details/actor.js +1 -0
  179. package/dist/overlays/relationship-details/custom/ElementActions.js +3 -3
  180. package/dist/overlays/relationship-details/layout-to-xyflow.js +3 -5
  181. package/dist/overlays/relationship-details/layout.d.ts +3 -3
  182. package/dist/overlays/relationship-details/layout.js +4 -4
  183. package/dist/overlays/relationships-browser/RelationshipsBrowser.js +3 -3
  184. package/dist/overlays/relationships-browser/SelectElement.js +2 -2
  185. package/dist/overlays/relationships-browser/_types.d.ts +2 -3
  186. package/dist/overlays/relationships-browser/actor.d.ts +7 -739
  187. package/dist/overlays/relationships-browser/custom/ElementActions.js +3 -3
  188. package/dist/overlays/relationships-browser/layout.d.ts +2 -2
  189. package/dist/overlays/relationships-browser/layout.js +3 -3
  190. package/dist/overlays/relationships-browser/useViewToNodesEdges.js +0 -3
  191. package/dist/overlays/types.d.ts +12 -13
  192. package/dist/search/components/ElementsColumn.js +7 -3
  193. package/dist/search/components/PickView.js +3 -1
  194. package/dist/search/components/SearchByTags.js +1 -1
  195. package/dist/search/components/SearchInput.js +1 -1
  196. package/dist/search/components/ViewsColum.d.ts +3 -1
  197. package/dist/search/components/ViewsColum.js +13 -7
  198. package/dist/search/components/_shared.css.d.ts +1 -1
  199. package/dist/search/searchActor.d.ts +3 -66
  200. package/dist/shadowroot/ShadowRoot.d.ts +5 -7
  201. package/dist/shadowroot/ShadowRoot.js +7 -5
  202. package/dist/shadowroot/styles.css.js +6 -1
  203. package/dist/styles.css2.js +1 -1
  204. package/dist/utils/index.d.ts +2 -2
  205. package/dist/utils/view-bounds.js +7 -6
  206. package/dist/utils/xyflow.d.ts +6 -5
  207. package/dist/utils/xyflow.js +26 -57
  208. package/package.json +24 -23
  209. package/panda.buildinfo.json +65 -71
  210. package/styles-min.css +1 -1
  211. package/styles.css +1 -1
  212. package/dist/base-primitives/edge/edge.css.d.ts +0 -4
  213. package/dist/base-primitives/edge/edge.css.js +0 -71
  214. package/dist/editor/LikeC4EditorContext.d.ts +0 -21
  215. package/dist/likec4diagram/custom/nodes/ElementNodeDrifts.d.ts +0 -4
  216. package/dist/likec4diagram/state/syncManualLayoutActor.d.ts +0 -280
  217. package/dist/likec4diagram/state/syncManualLayoutActor.js +0 -248
  218. package/dist/utils/vector.d.ts +0 -81
  219. package/dist/utils/vector.js +0 -120
  220. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/createReactComponent.js +0 -0
  221. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.js +0 -0
  222. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertTriangle.js +0 -0
  223. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowDownRight.js +0 -0
  224. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowLeft.js +0 -0
  225. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowRight.js +0 -0
  226. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconBolt.js +0 -0
  227. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconBrowser.js +0 -0
  228. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.js +0 -0
  229. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronDown.js +0 -0
  230. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronLeft.js +0 -0
  231. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronRight.js +0 -0
  232. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.js +0 -0
  233. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconCylinder.js +0 -0
  234. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconDeviceMobile.js +0 -0
  235. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconDirectionSignFilled.js +0 -0
  236. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconExternalLink.js +0 -0
  237. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconFileSymlink.js +0 -0
  238. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconFocusCentered.js +0 -0
  239. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconFolderFilled.js +0 -0
  240. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconHelpCircle.js +0 -0
  241. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconId.js +0 -0
  242. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconInfoCircle.js +0 -0
  243. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignBottom.js +0 -0
  244. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignCenter.js +0 -0
  245. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignLeft.js +0 -0
  246. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignMiddle.js +0 -0
  247. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignRight.js +0 -0
  248. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignTop.js +0 -0
  249. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutBoardSplit.js +0 -0
  250. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutCollage.js +0 -0
  251. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutDashboard.js +0 -0
  252. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconLink.js +0 -0
  253. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconLock.js +0 -0
  254. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconLockOpen2.js +0 -0
  255. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerPlayFilled.js +0 -0
  256. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipBackFilled.js +0 -0
  257. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipForwardFilled.js +0 -0
  258. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerStopFilled.js +0 -0
  259. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconRectangularPrism.js +0 -0
  260. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconReorder.js +0 -0
  261. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconRouteOff.js +0 -0
  262. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconSearch.js +0 -0
  263. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconSelector.js +0 -0
  264. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconStack2.js +0 -0
  265. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconStarFilled.js +0 -0
  266. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconTarget.js +0 -0
  267. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconTransform.js +0 -0
  268. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconUser.js +0 -0
  269. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconX.js +0 -0
  270. /package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.35.0_react@19.2.1}/node_modules/@tabler/icons-react/dist/esm/icons/IconZoomScan.js +0 -0
@@ -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, onChange, onEdgeContextMenu, onNavigateTo, onNodeClick, onNodeContextMenu, onOpenSource, onBurgerMenuClick, onLayoutTypeChange, onInitialized, view, className, readonly, controls, fitView, fitViewPadding: _fitViewPadding, pannable, zoomable, background, enableElementTags, enableFocusMode, enableElementDetails, enableRelationshipDetails, enableRelationshipBrowser, enableCompareWithLatest, nodesDraggable, 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, 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;
@@ -1,6 +1,7 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { useCustomCompareMemo } from '@react-hookz/web';
3
3
  import { ReactFlowProvider } from '@xyflow/react';
4
+ import { deepEqual } from 'fast-equals';
4
5
  import { useRef } from 'react';
5
6
  import { isPlainObject, mapValues } from 'remeda';
6
7
  import { RootContainer } from './components/RootContainer.js';
@@ -11,6 +12,7 @@ import { LikeC4DiagramXYFlow } from './likec4diagram/DiagramXYFlow.js';
11
12
  import { DiagramActorProvider } from './likec4diagram/state/DiagramActorProvider.js';
12
13
  import { LikeC4Styles } from './LikeC4Styles.js';
13
14
  import { pickViewBounds } from './utils/view-bounds.js';
15
+ import { useOptionalLikeC4EditorPort } from './editor/LikeC4EditorProvider.js';
14
16
  import { MinZoom, MaxZoom, FitViewPaddings } from './base/const.js';
15
17
  import { EnsureMantine } from './context/EnsureMantine.js';
16
18
  import { FramerMotionConfig } from './context/FramerMotionConfig.js';
@@ -23,7 +25,6 @@ function LikeC4Diagram({
23
25
  onCanvasContextMenu,
24
26
  onCanvasDblClick,
25
27
  onEdgeClick,
26
- onChange,
27
28
  onEdgeContextMenu,
28
29
  onNavigateTo,
29
30
  onNodeClick,
@@ -34,8 +35,7 @@ function LikeC4Diagram({
34
35
  onInitialized,
35
36
  view,
36
37
  className,
37
- readonly = true,
38
- controls = !readonly,
38
+ controls = true,
39
39
  fitView = true,
40
40
  fitViewPadding: _fitViewPadding = controls ? FitViewPaddings.withControls : FitViewPaddings.default,
41
41
  pannable = true,
@@ -47,8 +47,7 @@ function LikeC4Diagram({
47
47
  enableRelationshipDetails = false,
48
48
  enableRelationshipBrowser = false,
49
49
  enableCompareWithLatest = !!onLayoutTypeChange,
50
- nodesDraggable = !readonly,
51
- nodesSelectable = !readonly || enableFocusMode || !!onNavigateTo || !!onNodeClick,
50
+ nodesSelectable,
52
51
  enableNotations = false,
53
52
  showNavigationButtons = !!onNavigateTo,
54
53
  enableDynamicViewWalkthrough = false,
@@ -65,6 +64,9 @@ function LikeC4Diagram({
65
64
  }) {
66
65
  const id = useId();
67
66
  const initialRef = useRef(null);
67
+ const hasEditor = !!useOptionalLikeC4EditorPort();
68
+ const readonly = !hasEditor;
69
+ nodesSelectable ??= hasEditor || enableFocusMode || !!onNavigateTo || !!onNodeClick;
68
70
  const bounds = pickViewBounds(view, dynamicViewVariant);
69
71
  const fitViewPadding = useNormalizedViewPadding(_fitViewPadding);
70
72
  if (initialRef.current == null) {
@@ -92,6 +94,7 @@ function LikeC4Diagram({
92
94
  {
93
95
  features: {
94
96
  enableFitView: fitView,
97
+ enableEditor: hasEditor,
95
98
  enableReadOnly: readonly,
96
99
  enableFocusMode,
97
100
  enableNavigateTo: !!onNavigateTo,
@@ -115,7 +118,6 @@ function LikeC4Diagram({
115
118
  onCanvasContextMenu,
116
119
  onCanvasDblClick,
117
120
  onEdgeClick,
118
- onChange,
119
121
  onEdgeContextMenu,
120
122
  onNavigateTo,
121
123
  onNodeClick,
@@ -139,7 +141,7 @@ function LikeC4Diagram({
139
141
  zoomable,
140
142
  pannable,
141
143
  fitViewPadding,
142
- nodesDraggable,
144
+ nodesDraggable: hasEditor,
143
145
  nodesSelectable,
144
146
  where: where ?? null,
145
147
  dynamicViewVariant,
@@ -179,14 +181,15 @@ function useNormalizedViewPadding(raw) {
179
181
  if (isPlainObject(raw)) {
180
182
  return mapValues(raw, toLiteralPaddingWithUnit);
181
183
  }
182
- return toLiteralPaddingWithUnit(raw);
184
+ const v = toLiteralPaddingWithUnit(raw);
185
+ return {
186
+ x: v,
187
+ y: v
188
+ };
183
189
  },
184
190
  [raw],
185
- compareViewPaddingObject
191
+ deepEqual
186
192
  );
187
193
  }
188
- const compareViewPaddingObject = ([a], [b]) => {
189
- return a === b || isPlainObject(a) && isPlainObject(b) && a.bottom == b.bottom && a.left == b.left && a.right == b.right && a.top == b.top;
190
- };
191
194
 
192
195
  export { LikeC4Diagram };
@@ -29,6 +29,14 @@ export type LikeC4ColorScheme = 'light' | 'dark';
29
29
  export type OverrideReactFlowProps = Pick<ReactFlowProps<Types.AnyNode, Types.AnyEdge>, 'paneClickDistance' | 'nodeClickDistance' | 'selectionKeyCode' | 'panActivationKeyCode' | 'multiSelectionKeyCode' | 'zoomActivationKeyCode' | 'snapToGrid' | 'snapGrid' | 'onlyRenderVisibleElements' | 'nodesDraggable' | 'nodesFocusable' | 'elementsSelectable' | 'selectNodesOnDrag' | 'panOnDrag' | 'preventScrolling' | 'zoomOnScroll' | 'zoomOnPinch' | 'panOnScroll' | 'panOnScrollSpeed' | 'panOnScrollMode' | 'zoomOnDoubleClick' | 'nodeDragThreshold'>;
30
30
  export type PaddingUnit = 'px' | '%';
31
31
  export type PaddingWithUnit = `${number}${PaddingUnit}` | number;
32
+ export type ViewPaddings = {
33
+ top?: PaddingWithUnit;
34
+ right?: PaddingWithUnit;
35
+ bottom?: PaddingWithUnit;
36
+ left?: PaddingWithUnit;
37
+ x?: PaddingWithUnit;
38
+ y?: PaddingWithUnit;
39
+ };
32
40
  /**
33
41
  * Padding around the diagram
34
42
  *
@@ -45,14 +53,7 @@ export type PaddingWithUnit = `${number}${PaddingUnit}` | number;
45
53
  * y: '16px',
46
54
  * }
47
55
  */
48
- export type ViewPadding = PaddingWithUnit | {
49
- top?: PaddingWithUnit;
50
- right?: PaddingWithUnit;
51
- bottom?: PaddingWithUnit;
52
- left?: PaddingWithUnit;
53
- x?: PaddingWithUnit;
54
- y?: PaddingWithUnit;
55
- };
56
+ export type ViewPadding = PaddingWithUnit | ViewPaddings;
56
57
  export interface LikeC4DiagramProperties<A extends Any = Unknown> {
57
58
  view: LayoutedView<A>;
58
59
  className?: string | undefined;
@@ -66,15 +67,10 @@ export interface LikeC4DiagramProperties<A extends Any = Unknown> {
66
67
  * @default true
67
68
  */
68
69
  zoomable?: boolean | undefined;
69
- /**
70
- * Disable any editing (dragging still can be enabled with `nodesDraggable`)
71
- * @default true
72
- */
73
- readonly?: boolean | undefined;
74
70
  /**
75
71
  * Show/hide panel with top left controls
76
72
  *
77
- * @default true if not readonly
73
+ * @default true
78
74
  */
79
75
  controls?: boolean | undefined;
80
76
  /**
@@ -109,13 +105,11 @@ export interface LikeC4DiagramProperties<A extends Any = Unknown> {
109
105
  */
110
106
  fitViewPadding?: ViewPadding | undefined;
111
107
  /**
112
- * @default false if readonly
108
+ * If not readonly, or `enableFocusMode`, `onNavigateTo` or `onNodeClick` are set - nodes will be selectable
109
+ *
110
+ * @default false
113
111
  */
114
112
  nodesSelectable?: boolean | undefined;
115
- /**
116
- * @default false if readonly
117
- */
118
- nodesDraggable?: boolean | undefined;
119
113
  /**
120
114
  * Initial width of the diagram
121
115
  * (supposed to be used during SSR)
@@ -251,7 +245,6 @@ export type OnInitialized = (params: {
251
245
  }) => void;
252
246
  export type OnLayoutTypeChange = (layoutType: LayoutType) => void;
253
247
  export interface LikeC4DiagramEventHandlers<A extends Any = Unknown> {
254
- onChange?: OnChange | null | undefined;
255
248
  onNavigateTo?: OnNavigateTo<A> | null | undefined;
256
249
  onNodeClick?: OnNodeClick<A> | null | undefined;
257
250
  onNodeContextMenu?: OnNodeClick<A> | null | undefined;
@@ -1,7 +1,6 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import { useCustomCompareMemo } from '@react-hookz/web';
3
- import { shallowEqual } from 'fast-equals';
4
- import { useContext } from 'react';
2
+ import { deepEqual } from 'fast-equals';
3
+ import { useContext, useState, useEffect } from 'react';
5
4
  import { LikeC4ProjectsContext } from './context/LikeC4ProjectsContext.js';
6
5
  import { useCallbackRef } from './hooks/useCallbackRef.js';
7
6
 
@@ -15,7 +14,12 @@ function LikeC4ProjectsProvider({
15
14
  console.warn("LikeC4ProjectsProvider should not be nested inside another one");
16
15
  }
17
16
  const onProjectChange = useCallbackRef(_onProjectChange);
18
- const value = useCustomCompareMemo(() => ({ projects, onProjectChange }), [projects, onProjectChange], shallowEqual);
17
+ const [value, setValue] = useState(() => ({ projects, onProjectChange }));
18
+ useEffect(() => {
19
+ setValue((current) => {
20
+ return deepEqual(current.projects, projects) ? current : { projects, onProjectChange };
21
+ });
22
+ }, [projects]);
19
23
  return /* @__PURE__ */ jsx(LikeC4ProjectsContext.Provider, { value, children });
20
24
  }
21
25
 
@@ -7,7 +7,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 whenLight = scheme("light");
11
10
  const MAX_DEPTH = 5;
12
11
  const generateCompoundColors = (rootSelector, name, colors, depth) => {
13
12
  const compoundDarkColor = (color) => toHex(
@@ -47,8 +46,6 @@ ${selector} {
47
46
  --likec4-palette-relation-stroke: ${relationships.line};
48
47
  --likec4-palette-relation-label: ${relationships.label};
49
48
  --likec4-palette-relation-label-bg: ${relationships.labelBg};
50
- }
51
- ${whenLight} ${selector} {
52
49
  --likec4-palette-relation-stroke-selected: ${toRgba(mix(relationships.line, "black", 85))};
53
50
  }
54
51
  ${whenDark} ${selector} {
@@ -1,4 +1,4 @@
1
- import { CSSProperties } from 'react';
1
+ import { CSSProperties, ReactNode } from 'react';
2
2
  import { ElementIconRenderer, NodeRenderers, OverrideReactFlowProps, PaddingWithUnit, ViewPadding } from './LikeC4Diagram.props';
3
3
  import type * as t from '@likec4/core/types';
4
4
  export interface LikeC4ViewProps<A extends t.aux.Any = t.aux.UnknownLayouted> {
@@ -159,7 +159,7 @@ export interface LikeC4ViewProps<A extends t.aux.Any = t.aux.UnknownLayouted> {
159
159
  /**
160
160
  * Children to render inside the diagram (not inside the browser overlay)
161
161
  */
162
- children?: React.ReactNode | undefined;
162
+ children?: ReactNode | undefined;
163
163
  }
164
164
  export interface LikeC4BrowserProps {
165
165
  /**
@@ -250,7 +250,7 @@ export interface LikeC4BrowserProps {
250
250
  /**
251
251
  * Children to render inside the browser overlay
252
252
  */
253
- children?: React.ReactNode | undefined;
253
+ children?: ReactNode | undefined;
254
254
  }
255
255
  /**
256
256
  * Ready-to-use component to display embedded LikeC4 view,
@@ -2,7 +2,8 @@ import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { cx, css } from '@likec4/styles/css';
3
3
  import { Box } from '@likec4/styles/jsx';
4
4
  import { ActionIcon } from '@mantine/core';
5
- import { useState } from 'react';
5
+ import { AnimatePresence } from 'motion/react';
6
+ import { useRef, useState } from 'react';
6
7
  import { isBoolean } from 'remeda';
7
8
  import { FitViewPaddings } from './base/const.js';
8
9
  import { ErrorMessage, ViewNotFound } from './components/ViewNotFound.js';
@@ -13,7 +14,7 @@ import { LikeC4Diagram } from './LikeC4Diagram.js';
13
14
  import { Overlay } from './overlays/overlay/Overlay.js';
14
15
  import { ShadowRoot } from './shadowroot/ShadowRoot.js';
15
16
  import { pickViewBounds } from './utils/view-bounds.js';
16
- import IconX from './node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.2.0/node_modules/@tabler/icons-react/dist/esm/icons/IconX.js';
17
+ import IconX from './node_modules/.pnpm/@tabler_icons-react@3.35.0_react@19.2.1/node_modules/@tabler/icons-react/dist/esm/icons/IconX.js';
17
18
 
18
19
  const cssInteractive = css({
19
20
  cursor: "pointer",
@@ -49,6 +50,7 @@ function LikeC4View({
49
50
  children,
50
51
  ...props
51
52
  }) {
53
+ const rootRef = useRef(null);
52
54
  const likec4model = useOptionalLikeC4Model();
53
55
  const [layoutType, setLayoutType] = useState("manual");
54
56
  const [browserViewId, _onNavigateTo] = useState(null);
@@ -82,9 +84,11 @@ function LikeC4View({
82
84
  const isBrowserEnabled = browser !== false;
83
85
  const browserProps = isBoolean(browser) ? {} : browser;
84
86
  const bounds = pickViewBounds(view, props.dynamicViewVariant);
87
+ const root = rootRef.current ? { root: rootRef.current } : void 0;
85
88
  return /* @__PURE__ */ jsx(
86
89
  ShadowRoot,
87
90
  {
91
+ ref: rootRef,
88
92
  injectFontCss,
89
93
  theme: mantineTheme,
90
94
  colorScheme,
@@ -100,7 +104,6 @@ function LikeC4View({
100
104
  LikeC4Diagram,
101
105
  {
102
106
  view,
103
- readonly: true,
104
107
  pannable,
105
108
  zoomable,
106
109
  background,
@@ -116,7 +119,6 @@ function LikeC4View({
116
119
  enableRelationshipBrowser,
117
120
  enableElementTags: false,
118
121
  controls,
119
- nodesDraggable: false,
120
122
  reduceGraphics,
121
123
  className: cx(
122
124
  "likec4-static-view",
@@ -133,7 +135,7 @@ function LikeC4View({
133
135
  ...props
134
136
  }
135
137
  ),
136
- browserView && /* @__PURE__ */ jsxs(Overlay, { openDelay: 0, onClose: () => onNavigateTo(null), children: [
138
+ /* @__PURE__ */ jsx(AnimatePresence, { ...root, children: browserView && /* @__PURE__ */ jsxs(Overlay, { openDelay: 0, onClose: () => onNavigateTo(null), children: [
137
139
  /* @__PURE__ */ jsx(
138
140
  LikeC4Diagram,
139
141
  {
@@ -152,8 +154,6 @@ function LikeC4View({
152
154
  enableElementTags: true,
153
155
  enableCompareWithLatest: true,
154
156
  controls: true,
155
- readonly: true,
156
- nodesDraggable: false,
157
157
  fitView: true,
158
158
  ...props,
159
159
  fitViewPadding: FitViewPaddings.withControls,
@@ -175,7 +175,7 @@ function LikeC4View({
175
175
  children: /* @__PURE__ */ jsx(IconX, {})
176
176
  }
177
177
  ) })
178
- ] })
178
+ ] }) })
179
179
  ] })
180
180
  }
181
181
  );
@@ -1,5 +1,4 @@
1
- import { CSSProperties } from 'react';
2
- import { Except } from 'type-fest';
1
+ import { CSSProperties, ReactNode } from 'react';
3
2
  import { LikeC4DiagramEventHandlers, LikeC4DiagramProperties } from './LikeC4Diagram.props';
4
3
  import type * as t from '@likec4/core/types';
5
4
  export type ReactLikeC4Props<A extends t.aux.Any = t.aux.UnknownLayouted> = {
@@ -26,10 +25,8 @@ export type ReactLikeC4Props<A extends t.aux.Any = t.aux.UnknownLayouted> = {
26
25
  mantineTheme?: any;
27
26
  /** Function to generate nonce attribute added to all generated `<style />` tags */
28
27
  styleNonce?: string | (() => string) | undefined;
29
- children?: React.ReactNode | undefined;
30
- } & Except<LikeC4DiagramProperties<A>, 'view', {
31
- requireExactProps: true;
32
- }> & LikeC4DiagramEventHandlers<A>;
28
+ children?: ReactNode | undefined;
29
+ } & Omit<LikeC4DiagramProperties<A>, 'view'> & LikeC4DiagramEventHandlers<A>;
33
30
  /**
34
31
  * Ready-to-use component to display embedded LikeC4 view, same as {@link LikeC4View}
35
32
  * But provides more control over the diagram
@@ -16,7 +16,6 @@ function StaticLikeC4Diagram({
16
16
  LikeC4Diagram,
17
17
  {
18
18
  view,
19
- readonly: true,
20
19
  className: cx(className, "likec4-static-view"),
21
20
  fitView,
22
21
  fitViewPadding,
@@ -34,7 +33,6 @@ function StaticLikeC4Diagram({
34
33
  enableFocusMode: false,
35
34
  enableSearch: false,
36
35
  nodesSelectable: false,
37
- nodesDraggable: false,
38
36
  enableElementTags: false,
39
37
  ...rest
40
38
  }
@@ -16,7 +16,7 @@ type WithData<D> = {
16
16
  data: D;
17
17
  };
18
18
  declare function setData<E extends WithData<any>>(value: E, state: Partial<E['data']>): E;
19
- declare function setData<E extends WithData<any>>(state: Partial<E['data']>): (value: E) => E;
19
+ declare function setData<E extends WithData<any>>(state: Partial<NoInfer<E['data']>>): (value: E) => E;
20
20
  export declare const Base: {
21
21
  setDimmed: typeof setDimmed;
22
22
  setHovered: typeof setHovered;
@@ -1,22 +1,32 @@
1
1
  import { deepEqual } from 'fast-equals';
2
- import { isDefined, omit } from 'remeda';
2
+ import { isDefined, pickBy, isShallowEqual } from 'remeda';
3
3
 
4
- function _update(current, update) {
5
- return update.map((next) => {
6
- const existing = current.find((n) => n.id === next.id);
7
- if (existing && existing.type === next.type && existing.source === next.source && existing.target === next.target) {
8
- const isSameData = deepEqual(existing.data, next.data);
9
- if (isSameData && deepEqual(existing.hidden ?? false, next.hidden ?? false) && deepEqual(existing.selected ?? false, next.selected ?? false) && deepEqual(existing.animated ?? false, next.animated ?? false) && deepEqual(existing.sourceHandle ?? null, next.sourceHandle ?? null) && deepEqual(existing.targetHandle ?? null, next.targetHandle ?? null) && deepEqual(existing.zIndex ?? 0, next.zIndex ?? 0) && deepEqual(existing.label ?? null, next.label ?? null)) {
10
- return existing;
11
- }
12
- return {
13
- ...omit(existing, ["hidden", "zIndex"]),
14
- ...next,
15
- data: isSameData ? existing.data : next.data
16
- };
4
+ const EMPTY_OBJ = {};
5
+ function _update(current, updated) {
6
+ if (current === updated) {
7
+ return current;
8
+ }
9
+ updated = updated.map((update) => {
10
+ const existing = current.find(
11
+ (n) => n.id === update.id && n.type === update.type && n.source === update.source && n.target === update.target
12
+ );
13
+ if (!existing) {
14
+ return update;
15
+ }
16
+ const isSameData = deepEqual(existing.data, update.data);
17
+ const data = isSameData ? existing.data : update.data;
18
+ if (isSameData && deepEqual(existing.hidden, update.hidden ?? existing.hidden) && deepEqual(existing.selected, update.selected ?? existing.selected) && deepEqual(existing.selectable, update.selectable ?? existing.selectable) && deepEqual(existing.focusable, update.focusable ?? existing.focusable) && deepEqual(existing.animated, update.animated ?? existing.animated) && deepEqual(existing.className, update.className) && deepEqual(existing.zIndex, update.zIndex ?? existing.zIndex) && deepEqual(existing.label, update.label) && deepEqual(existing.sourceHandle, update.sourceHandle) && deepEqual(existing.targetHandle, update.targetHandle) && deepEqual(existing.style ?? EMPTY_OBJ, update.style ?? EMPTY_OBJ)) {
19
+ return existing;
17
20
  }
18
- return next;
21
+ return {
22
+ // Retain existing properties that are defined, except parentId
23
+ ...pickBy(existing, isDefined),
24
+ // Apply updates, omitting undefined values
25
+ ...pickBy(update, isDefined),
26
+ data
27
+ };
19
28
  });
29
+ return isShallowEqual(current, updated) ? current : updated;
20
30
  }
21
31
  function updateEdges(current, update) {
22
32
  if (isDefined(update)) {
@@ -1,3 +1,17 @@
1
1
  import { BaseNode } from './types';
2
+ /**
3
+ * Updates nodes by merging existing nodes with updated nodes based on their IDs.
4
+ *
5
+ * Can be used in two ways:
6
+ * 1. By providing both current and updated node arrays:
7
+ * `const newNodes = updateNodes(currentNodes, updatedNodes);`
8
+ * 2. By providing only the updated node array, returning a function that takes the current nodes:
9
+ * `const updater = updateNodes(updatedNodes);
10
+ * const newNodes = updater(currentNodes);`
11
+ *
12
+ * @param current - The current array of nodes.
13
+ * @param update - The array of nodes with updates.
14
+ * @returns The updated array of nodes.
15
+ */
2
16
  export declare function updateNodes<N extends BaseNode>(current: N[], update: N[]): N[];
3
17
  export declare function updateNodes<N extends BaseNode>(update: N[]): (current: N[]) => N[];
@@ -1,34 +1,67 @@
1
1
  import { getNodeDimensions } from '@xyflow/system';
2
2
  import { deepEqual } from 'fast-equals';
3
- import { isDefined, omit } from 'remeda';
3
+ import { isDefined, hasSubObject, pickBy, isShallowEqual } from 'remeda';
4
4
 
5
+ const EMPTY_OBJ = {};
5
6
  function _update(current, updated) {
6
- return updated.map((update) => {
7
- const existing = current.find((n) => n.id === update.id);
8
- if (existing && deepEqual(existing.type, update.type)) {
9
- const isSameData = deepEqual(existing.data, update.data);
10
- const { width: existingWidth, height: existingHeight } = getNodeDimensions(existing);
11
- if (isSameData && deepEqual(existingWidth, update.initialWidth) && deepEqual(existingHeight, update.initialHeight) && deepEqual(existing.parentId ?? null, update.parentId ?? null) && deepEqual(existing.hidden ?? false, update.hidden ?? false) && deepEqual(existing.zIndex ?? 0, update.zIndex ?? 0) && deepEqual(existing.position, update.position)) {
12
- return existing;
7
+ if (current === updated) {
8
+ return current;
9
+ }
10
+ updated = updated.map((update) => {
11
+ const existing = current.find((n) => n.id === update.id && n.type === update.type);
12
+ if (!existing) {
13
+ return update;
14
+ }
15
+ const isSameData = hasSubObject(existing.data, update.data);
16
+ let data = isSameData ? existing.data : update.data;
17
+ if (!isSameData) {
18
+ if (isDefined(existing.data.hovered) && !isDefined(update.data.hovered)) {
19
+ data = {
20
+ ...data,
21
+ hovered: existing.data.hovered
22
+ };
13
23
  }
14
- return {
15
- ...omit(existing, ["measured", "parentId", "hidden", "zIndex"]),
16
- ...update,
17
- // Force dimensions from update
18
- width: update.initialWidth,
19
- height: update.initialHeight,
20
- data: isSameData ? existing.data : update.data
21
- };
24
+ if (isDefined(existing.data.dimmed) && !isDefined(update.data.dimmed)) {
25
+ data = {
26
+ ...data,
27
+ dimmed: existing.data.dimmed
28
+ };
29
+ }
30
+ }
31
+ const { width: existingWidth, height: existingHeight } = getNodeDimensions(existing);
32
+ const haveHandles = Object.hasOwn(existing, "handles") || Object.hasOwn(update, "handles");
33
+ const isSameHandles = !haveHandles || deepEqual(existing.handles ?? [], update.handles ?? []);
34
+ if (isSameData && isSameHandles && deepEqual(existingWidth, update.width ?? update.initialWidth) && deepEqual(existingHeight, update.height ?? update.initialHeight) && deepEqual(existing.parentId ?? null, update.parentId ?? null) && deepEqual(existing.hidden, update.hidden ?? existing.hidden) && deepEqual(existing.selected, update.selected ?? existing.selected) && deepEqual(existing.selectable, update.selectable ?? existing.selectable) && deepEqual(existing.focusable, update.focusable ?? existing.focusable) && deepEqual(existing.draggable, update.draggable ?? existing.draggable) && deepEqual(existing.dragHandle, update.dragHandle) && deepEqual(existing.className, update.className) && deepEqual(existing.zIndex, update.zIndex ?? existing.zIndex) && deepEqual(existing.position, update.position) && deepEqual(existing.domAttributes ?? EMPTY_OBJ, update.domAttributes ?? EMPTY_OBJ) && deepEqual(existing.style ?? EMPTY_OBJ, update.style ?? EMPTY_OBJ)) {
35
+ return existing;
22
36
  }
23
- return update;
37
+ const handles = haveHandles && isSameHandles ? existing.handles : update.handles;
38
+ return {
39
+ // Retain existing properties that are defined, except parentId
40
+ ...pickBy(existing, (v, k) => isDefined(v) && k !== "parentId"),
41
+ // Retain measured dimensions from existing if present
42
+ ..."measured" in existing && {
43
+ measured: {
44
+ width: update.width ?? update.initialWidth,
45
+ height: update.height ?? update.initialHeight
46
+ }
47
+ },
48
+ // Apply updates, omitting undefined values
49
+ ...pickBy(update, isDefined),
50
+ // Force dimensions
51
+ width: update.width ?? update.initialWidth,
52
+ height: update.height ?? update.initialHeight,
53
+ ...handles && { handles },
54
+ data
55
+ };
24
56
  });
57
+ return isShallowEqual(current, updated) ? current : updated;
25
58
  }
26
59
  function updateNodes(current, update) {
27
60
  if (isDefined(update)) {
28
61
  return _update(current, update);
29
62
  }
30
63
  update = current;
31
- return (current2) => _update(current2, update);
64
+ return (existing) => _update(existing, update);
32
65
  }
33
66
 
34
67
  export { updateNodes };
@@ -1,8 +1,7 @@
1
1
  import { RichTextOrEmpty as RichTextType } from '@likec4/core/types';
2
- import { BoxProps } from '@likec4/styles/jsx';
3
2
  import { JsxStyleProps } from '@likec4/styles/types';
4
- import { ForwardRefExoticComponent, RefAttributes } from 'react';
5
- export type MarkdownProps = Omit<BoxProps, 'dangerouslySetInnerHTML' | 'children'> & {
3
+ import { ComponentPropsWithoutRef, ForwardRefExoticComponent, DetailedHTMLProps, HTMLAttributes, RefAttributes } from 'react';
4
+ export type MarkdownProps = Omit<ComponentPropsWithoutRef<'div'>, 'dangerouslySetInnerHTML' | 'children' | 'color'> & {
6
5
  value: RichTextType;
7
6
  /**
8
7
  * When markdown block is used inside a diagram node, this variant should be used to apply the likec4 palette.
@@ -30,4 +29,31 @@ export type MarkdownProps = Omit<BoxProps, 'dangerouslySetInnerHTML' | 'children
30
29
  */
31
30
  emptyText?: string;
32
31
  };
33
- export declare const Markdown: ForwardRefExoticComponent<Omit<MarkdownProps, "ref"> & RefAttributes<HTMLDivElement>>;
32
+ export declare const Markdown: ForwardRefExoticComponent<Omit<Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "children" | "color" | "dangerouslySetInnerHTML"> & {
33
+ value: RichTextType;
34
+ /**
35
+ * When markdown block is used inside a diagram node, this variant should be used to apply the likec4 palette.
36
+ * @default false
37
+ */
38
+ uselikec4palette?: boolean;
39
+ /**
40
+ * Scale factor for the block
41
+ * @default 1
42
+ */
43
+ textScale?: number;
44
+ /**
45
+ * Font size for the block
46
+ * @default 'md'
47
+ */
48
+ fontSize?: (JsxStyleProps["fontSize"] & string) | undefined;
49
+ /**
50
+ * If true, the component will not render anything if the value is empty.
51
+ * @default false
52
+ */
53
+ hideIfEmpty?: boolean | undefined;
54
+ /**
55
+ * Text to show if the value is empty.
56
+ * @default "no content"
57
+ */
58
+ emptyText?: string;
59
+ } & RefAttributes<HTMLDivElement>>;
@@ -37,8 +37,9 @@ const Markdown = forwardRef(({
37
37
  ...fontSize && {
38
38
  "--text-fz": `var(--font-sizes-${fontSize}, var(--font-sizes-md))`
39
39
  },
40
- // @ts-expect-error
41
- ["--mantine-scale"]: textScale
40
+ ...textScale !== 1 && {
41
+ ["--mantine-scale"]: textScale
42
+ }
42
43
  },
43
44
  ...content
44
45
  }
@@ -1,4 +1,5 @@
1
+ import { MemoExoticComponent } from 'react';
1
2
  /**
2
3
  * XYFlow requires handles to be defined on nodes.
3
4
  */
4
- export declare const DefaultHandles: () => import("react/jsx-runtime").JSX.Element;
5
+ export declare const DefaultHandles: MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
@@ -1,21 +1,25 @@
1
- import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
- import { Handle, Position } from '@xyflow/react';
1
+ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
2
+ import { Position, Handle } from '@xyflow/react';
3
+ import { memo, Fragment as Fragment$1 } from 'react';
3
4
 
4
- const style = {
5
- top: "50%",
6
- left: "50%",
7
- right: "unset",
8
- bottom: "unset",
9
- visibility: "hidden",
10
- width: 5,
11
- height: 5,
12
- transform: "translate(-50%, -50%)"
13
- };
14
- const DefaultHandles = () => /* @__PURE__ */ jsxs(Fragment, { children: [
15
- /* @__PURE__ */ jsx(Handle, { type: "target", position: Position.Top, style }),
16
- /* @__PURE__ */ jsx(Handle, { type: "target", position: Position.Left, style }),
17
- /* @__PURE__ */ jsx(Handle, { type: "source", position: Position.Right, style }),
18
- /* @__PURE__ */ jsx(Handle, { type: "source", position: Position.Bottom, style })
19
- ] });
5
+ const positions = [Position.Top, Position.Right, Position.Bottom, Position.Left];
6
+ const DefaultHandles = memo(() => /* @__PURE__ */ jsx(Fragment, { children: positions.map((position) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
7
+ /* @__PURE__ */ jsx(
8
+ Handle,
9
+ {
10
+ type: "source",
11
+ position,
12
+ className: "likec4-node-handle-center"
13
+ }
14
+ ),
15
+ /* @__PURE__ */ jsx(
16
+ Handle,
17
+ {
18
+ type: "target",
19
+ position,
20
+ className: "likec4-node-handle-center"
21
+ }
22
+ )
23
+ ] }, position)) }));
20
24
 
21
25
  export { DefaultHandles };
@@ -1,8 +1,9 @@
1
+ import { MouseEvent as ReactMouseEvent, ReactNode } from 'react';
1
2
  import { Simplify } from 'type-fest';
2
3
  import { BaseNodeProps } from '../../base/types';
3
4
  type CompoundActionButtonProps = Simplify<BaseNodeProps & {
4
- icon?: React.ReactNode;
5
- onClick: (e: React.MouseEvent) => void;
5
+ icon?: ReactNode;
6
+ onClick: (e: ReactMouseEvent) => void;
6
7
  }>;
7
8
  export declare function CompoundActionButton({ data: { hovered: isHovered, }, icon, onClick, }: CompoundActionButtonProps): import("react/jsx-runtime").JSX.Element;
8
9
  export {};