@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
@@ -11,7 +11,7 @@ export declare function useDiagramActorSnapshot<T = unknown>(selector: (state: D
11
11
  export declare function useDiagramContext<T = unknown>(selector: (context: DiagramContext) => T, compare?: (a: NoInfer<T>, b: NoInfer<T>) => boolean, deps?: DependencyList): T;
12
12
  type PickEmittedEvent<T> = T extends DiagramEmittedEvents['type'] ? DiagramEmittedEvents & {
13
13
  type: T;
14
- } : never;
14
+ } : unknown;
15
15
  /**
16
16
  * Subscribe to diagram emitted events
17
17
  * @example
@@ -21,4 +21,6 @@ type PickEmittedEvent<T> = T extends DiagramEmittedEvents['type'] ? DiagramEmitt
21
21
  * })
22
22
  * ```
23
23
  */
24
- export declare function useOnDiagramEvent<T extends DiagramEmittedEvents['type']>(event: T, callback: (event: PickEmittedEvent<T>) => void): void;
24
+ export declare function useOnDiagramEvent<T extends DiagramEmittedEvents['type'] | '*'>(event: T, callback: (event: PickEmittedEvent<T>) => void, options?: {
25
+ once?: boolean;
26
+ }): void;
@@ -3,6 +3,7 @@ import { shallowEqual } from 'fast-equals';
3
3
  import { useCallback, useRef, useEffect } from 'react';
4
4
  import { useDiagramActorRef } from './safeContext.js';
5
5
  export { useDiagram } from './safeContext.js';
6
+ import { useCallbackRef } from './useCallbackRef.js';
6
7
 
7
8
  function useDiagramActorSnapshot(selector, compare = shallowEqual) {
8
9
  const actorRef = useDiagramActorRef();
@@ -10,21 +11,31 @@ function useDiagramActorSnapshot(selector, compare = shallowEqual) {
10
11
  }
11
12
  function useDiagramContext(selector, compare = shallowEqual, deps) {
12
13
  const actorRef = useDiagramActorRef();
13
- const select = useCallback((s) => selector(s.context), deps ?? []);
14
+ const selectorRef = useCallbackRef(selector);
15
+ const select = useCallback((s) => selectorRef(s.context), deps ?? []);
14
16
  return useSelector(actorRef, select, compare);
15
17
  }
16
- function useOnDiagramEvent(event, callback) {
18
+ function useOnDiagramEvent(event, callback, options) {
17
19
  const actorRef = useDiagramActorRef();
18
- const callbackRef = useRef(callback);
19
- callbackRef.current = callback;
20
+ const callbackRef = useCallbackRef(callback);
21
+ const wasCalled = useRef(false);
22
+ const once = options?.once ?? false;
20
23
  useEffect(() => {
21
- const subscription = actorRef.on(event, (payload) => {
22
- callbackRef.current(payload);
24
+ if (once && wasCalled.current) {
25
+ return;
26
+ }
27
+ let subscription = actorRef.on(event, (payload) => {
28
+ callbackRef(payload);
29
+ wasCalled.current = true;
30
+ if (once) {
31
+ subscription?.unsubscribe();
32
+ subscription = null;
33
+ }
23
34
  });
24
35
  return () => {
25
- subscription.unsubscribe();
36
+ subscription?.unsubscribe();
26
37
  };
27
- }, [actorRef, event]);
38
+ }, [actorRef, event, once]);
28
39
  }
29
40
 
30
41
  export { useDiagramActorRef, useDiagramActorSnapshot, useDiagramContext, useOnDiagramEvent };
@@ -1,16 +1,20 @@
1
1
  import { DiagramActorSnapshot } from '../likec4diagram/state/types';
2
2
  import type * as t from '@likec4/core/types';
3
3
  declare const selectCompareLayoutState: ({ context }: DiagramActorSnapshot) => {
4
+ hasEditor: false;
4
5
  isEnabled: false;
5
6
  isEditable: false;
6
7
  isActive: false;
7
8
  drifts: never[];
9
+ canApplyLatest: boolean;
8
10
  layout: t.LayoutType;
9
11
  } | {
12
+ hasEditor: boolean;
10
13
  isEnabled: true;
11
14
  isEditable: boolean;
12
15
  isActive: boolean;
13
16
  drifts: t.NonEmptyReadonlyArray<t.LayoutedViewDriftReason>;
17
+ canApplyLatest: boolean;
14
18
  layout: t.LayoutType;
15
19
  };
16
20
  type DiagramCompareLayoutState = ReturnType<typeof selectCompareLayoutState>;
@@ -23,6 +27,10 @@ type DiagramCompareLayoutOps = {
23
27
  * Switches the layout type between 'auto' and 'manual'.
24
28
  */
25
29
  switchLayout: (layoutType: t.LayoutType) => void;
30
+ /**
31
+ * Merges the latest layout into the manual layout.
32
+ */
33
+ applyLatestToManual: () => void;
26
34
  /**
27
35
  * Resets the manual layout to its default state.
28
36
  */
@@ -1,24 +1,34 @@
1
+ import { nonNullable } from '@likec4/core';
1
2
  import { useSelector } from '@xstate/react';
2
3
  import { shallowEqual } from 'fast-equals';
4
+ import { deriveToggledFeatures } from '../likec4diagram/state/machine.setup.js';
3
5
  import { useDiagramActorRef } from './safeContext.js';
4
6
  import { useCallbackRef } from './useCallbackRef.js';
5
7
 
6
8
  const selectCompareLayoutState = ({ context }) => {
7
9
  const drifts = context.view.drifts ?? null;
8
- if (!context.features.enableCompareWithLatest || !drifts) {
10
+ if (!context.features.enableCompareWithLatest || !drifts || drifts.length === 0) {
9
11
  return {
12
+ hasEditor: false,
10
13
  isEnabled: false,
11
14
  isEditable: false,
12
15
  isActive: false,
13
16
  drifts: [],
17
+ canApplyLatest: false,
14
18
  layout: context.view._layout ?? "auto"
15
19
  };
16
20
  }
21
+ const {
22
+ enableCompareWithLatest,
23
+ enableReadOnly
24
+ } = deriveToggledFeatures(context);
17
25
  return {
26
+ hasEditor: context.features.enableEditor,
18
27
  isEnabled: true,
19
- isEditable: !context.features.enableReadOnly,
20
- isActive: context.toggledFeatures.enableCompareWithLatest === true,
28
+ isEditable: !enableReadOnly,
29
+ isActive: enableCompareWithLatest === true,
21
30
  drifts,
31
+ canApplyLatest: !drifts.includes("type-changed"),
22
32
  layout: context.view._layout ?? "auto"
23
33
  };
24
34
  };
@@ -54,7 +64,22 @@ function useDiagramCompareLayout() {
54
64
  }
55
65
  actorRef.send({ type: "layout.resetManualLayout" });
56
66
  });
57
- return [state, { toggleCompare, switchLayout, resetManualLayout }];
67
+ const applyLatestToManual = useCallbackRef(() => {
68
+ if (!state.isEnabled) {
69
+ console.warn("Compare with latest feature is not enabled");
70
+ return;
71
+ }
72
+ const editor = nonNullable(actorRef.system?.get("editor"), "editor actor not found");
73
+ editor.send({ type: "applyLatestToManual" });
74
+ if (state.isActive) {
75
+ actorRef.send({
76
+ type: "toggle.feature",
77
+ feature: "CompareWithLatest",
78
+ forceValue: false
79
+ });
80
+ }
81
+ });
82
+ return [state, { toggleCompare, switchLayout, resetManualLayout, applyLatestToManual }];
58
83
  }
59
84
 
60
85
  export { useDiagramCompareLayout };
@@ -17,6 +17,11 @@ export declare function useLikeC4ProjectsContext(): LikeC4ProjectsContext;
17
17
  */
18
18
  export declare function useHasProjects(): boolean;
19
19
  /**
20
- * @returns The current project id.
20
+ * @returns Current project id, as provided by LikeC4Model
21
21
  */
22
22
  export declare function useLikeC4ProjectId(): ProjectId;
23
+ /**
24
+ * Returns current LikeC4 project.
25
+ * Requires both LikeC4ModelProvider and LikeC4ProjectsProvider in the tree.*
26
+ */
27
+ export declare function useLikeC4Project(): LikeC4Project;
@@ -29,9 +29,21 @@ function useHasProjects() {
29
29
  function useLikeC4ProjectId() {
30
30
  const ctx = useContext(LikeC4ModelContext);
31
31
  if (!ctx) {
32
- throw new Error("No LikeC4ModelContext found");
32
+ throw new Error("No LikeC4ModelProvider found");
33
33
  }
34
34
  return ctx.projectId;
35
35
  }
36
+ function useLikeC4Project() {
37
+ const projectId = useLikeC4ProjectId();
38
+ const projectsCtx = useContext(LikeC4ProjectsContext);
39
+ if (!projectsCtx) {
40
+ throw new Error("No LikeC4ProjectsProvider found");
41
+ }
42
+ const project = projectsCtx.projects.find((p) => p.id === projectId);
43
+ if (!project) {
44
+ throw new Error(`Project with id '${projectId}' not found in LikeC4ProjectsProvider`);
45
+ }
46
+ return project;
47
+ }
36
48
 
37
- export { useHasProjects, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext };
49
+ export { useHasProjects, useLikeC4Project, useLikeC4ProjectId, useLikeC4Projects, useLikeC4ProjectsContext };
@@ -0,0 +1,6 @@
1
+ import { ReadableAtom } from 'nanostores';
2
+ export declare const $isPrint: ReadableAtom<boolean>;
3
+ /**
4
+ * Hook to determine if the current media is print.
5
+ */
6
+ export declare function useMediaPrint(): boolean;
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export { IconRendererProvider } from './context/IconRenderer';
2
2
  export { LikeC4Diagram, type LikeC4DiagramProps, } from './LikeC4Diagram';
3
3
  export type { ElementIconRenderer, ElementIconRendererProps, LikeC4ColorScheme, NodeRenderers, OnCanvasClick, OnChange, OnEdgeClick, OnInitialized, OnNavigateTo, OnNodeClick, OnOpenSource, PaddingWithUnit, ViewPadding, WhereOperator, } from './LikeC4Diagram.props';
4
4
  export { LikeC4ModelProvider, type LikeC4ModelProviderProps, } from './LikeC4ModelProvider';
5
+ export { type LikeC4EditorPort, LikeC4EditorProvider, type LikeC4EditorProviderProps, } from './editor/LikeC4EditorProvider';
5
6
  export { LikeC4ProjectsProvider, type LikeC4ProjectsProviderProps, } from './LikeC4ProjectsProvider';
6
7
  export { type DiagramApi, type DiagramContext, useDiagram, useDiagramContext, useOnDiagramEvent, } from './hooks/useDiagram';
7
8
  export { useLikeC4Model, useLikeC4Specification, useLikeC4ViewModel, } from './hooks/useLikeC4Model';
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  export { IconRendererProvider } from './context/IconRenderer.js';
2
2
  export { LikeC4Diagram } from './LikeC4Diagram.js';
3
3
  export { LikeC4ModelProvider } from './LikeC4ModelProvider.js';
4
+ export { LikeC4EditorProvider } from './editor/LikeC4EditorProvider.js';
4
5
  export { LikeC4ProjectsProvider } from './LikeC4ProjectsProvider.js';
5
6
  export { useDiagramContext, useOnDiagramEvent } from './hooks/useDiagram.js';
6
7
  export { useLikeC4Model, useLikeC4Specification, useLikeC4ViewModel } from './hooks/useLikeC4Model.js';
@@ -11,6 +11,7 @@ import { useIsReducedGraphics, usePanningAtom } from '../context/RootContainerCo
11
11
  import { useDiagramActorSnapshot } from '../hooks/useDiagram.js';
12
12
  import { depsShallowEqual, useUpdateEffect } from '../hooks/useUpdateEffect.js';
13
13
  import { BuiltinEdges, BuiltinNodes } from './custom/index.js';
14
+ import { deriveToggledFeatures } from './state/machine.setup.js';
14
15
  import { useLayoutConstraints } from './useLayoutConstraints.js';
15
16
  import { useDiagram } from '../hooks/safeContext.js';
16
17
  import { useDiagramEventHandlers } from '../context/DiagramEventHandlers.js';
@@ -44,9 +45,8 @@ function prepareNodeTypes(nodeTypes) {
44
45
  };
45
46
  }
46
47
  const selectXYProps = ({ context: ctx, children }) => {
47
- const toggledFeatures = ctx.toggledFeatures;
48
- const enableReadOnly = ctx.features.enableReadOnly || toggledFeatures.enableReadOnly === true;
49
- const isNotEditingEdge = enableReadOnly || children.syncLayout?.getSnapshot().context.editing !== "edge";
48
+ const { enableReadOnly } = deriveToggledFeatures(ctx);
49
+ const isNotEditingEdge = enableReadOnly || children.editor?.getSnapshot().context.editing !== "edge";
50
50
  return {
51
51
  enableReadOnly,
52
52
  initialized: ctx.initialized.xydata && ctx.initialized.xyflow,
@@ -57,11 +57,11 @@ const selectXYProps = ({ context: ctx, children }) => {
57
57
  nodesDraggable: !enableReadOnly && ctx.nodesDraggable,
58
58
  nodesSelectable: ctx.nodesSelectable && isNotEditingEdge,
59
59
  fitViewPadding: ctx.fitViewPadding,
60
- enableFitView: ctx.toggledFeatures.enableFitView ?? ctx.features.enableFitView,
60
+ enableFitView: ctx.features.enableFitView,
61
61
  ...!ctx.features.enableFitView && {
62
62
  viewport: {
63
- x: -Math.min(ctx.view.bounds.x, 0),
64
- y: -Math.min(ctx.view.bounds.y, 0),
63
+ x: -ctx.view.bounds.x,
64
+ y: -ctx.view.bounds.y,
65
65
  zoom: 1
66
66
  }
67
67
  }
@@ -109,7 +109,11 @@ function LikeC4DiagramXYFlow({
109
109
  notPanning();
110
110
  }), onMoveEnd = useCallbackRef((event, viewport) => {
111
111
  isPanning.clear();
112
- diagram.send({ type: "xyflow.viewportMoved", viewport, manually: !!event });
112
+ diagram.send({
113
+ type: "xyflow.viewportMoved",
114
+ viewport,
115
+ manually: !!event
116
+ });
113
117
  }), onViewportResize = useCallbackRef(() => {
114
118
  diagram.send({ type: "xyflow.resized" });
115
119
  }), nodeTypes = useCustomCompareMemo(
@@ -0,0 +1,6 @@
1
+ import { Types } from '../../types';
2
+ export type EdgeDriftsProps = {
3
+ edgeProps: Types.EdgeProps;
4
+ svgPath: string;
5
+ };
6
+ export declare function EdgeDrifts({ edgeProps: { data }, svgPath, }: EdgeDriftsProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,34 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { cx, css } from '@likec4/styles/css';
3
+
4
+ function EdgeDrifts({
5
+ edgeProps: { data },
6
+ svgPath
7
+ }) {
8
+ const drifts = data.drifts;
9
+ if (!drifts || drifts.length === 0) {
10
+ return null;
11
+ }
12
+ return /* @__PURE__ */ jsx(
13
+ "path",
14
+ {
15
+ className: cx(
16
+ "react-flow__edge-path",
17
+ css({
18
+ pointerEvents: "none",
19
+ stroke: "likec4.compare.manual.outline",
20
+ fill: "none",
21
+ strokeWidth: {
22
+ base: "8px",
23
+ _whenHovered: "12px"
24
+ },
25
+ strokeOpacity: 0.5
26
+ })
27
+ ),
28
+ d: svgPath,
29
+ strokeLinecap: "round"
30
+ }
31
+ );
32
+ }
33
+
34
+ export { EdgeDrifts };
@@ -1,9 +1,7 @@
1
1
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
- import { cx } from '@likec4/styles/css';
3
- import { useRafEffect } from '@react-hookz/web';
2
+ import { css, cx } from '@likec4/styles/css';
4
3
  import { EdgeLabelRenderer } from '@xyflow/react';
5
- import { useState, useRef } from 'react';
6
- import { ZIndexes } from '../../../base/const.js';
4
+ import { useState, useRef, useEffect } from 'react';
7
5
  import { useEnabledFeatures } from '../../../context/DiagramFeatures.js';
8
6
  import { useCallbackRef } from '../../../hooks/useCallbackRef.js';
9
7
  import '@xstate/react';
@@ -12,7 +10,8 @@ import { useDiagram } from '../../../hooks/safeContext.js';
12
10
  import { useUpdateEffect } from '../../../hooks/useUpdateEffect.js';
13
11
  import { useXYFlow, useXYStoreApi } from '../../../hooks/useXYFlow.js';
14
12
  import { isSamePoint } from '../../../utils/xyflow.js';
15
- import { controlDragging, controlPointsContainer, controlPoint } from './edges.css.js';
13
+ import { EdgeDrifts } from './EdgeDrifts.js';
14
+ import { controlPointsContainer, controlPoint } from './edges.css.js';
16
15
  import { useControlPoints } from './useControlPoints.js';
17
16
  import { useRelationshipEdgePath } from './useRelationshipEdgePath.js';
18
17
  import { memoEdge } from '../../../base-primitives/memoEdge.js';
@@ -31,25 +30,26 @@ const getEdgeCenter = (path) => {
31
30
  };
32
31
  const RelationshipEdge = memoEdge((props) => {
33
32
  const [isControlPointDragging, setIsControlPointDragging] = useState(false);
33
+ const isControlPointDraggingRef = useRef(isControlPointDragging);
34
+ isControlPointDraggingRef.current = isControlPointDragging;
34
35
  const xyflow = useXYFlow();
35
36
  const diagram = useDiagram();
36
37
  const {
37
38
  enableNavigateTo,
38
- enableReadOnly
39
+ enableReadOnly,
40
+ enableCompareWithLatest
39
41
  } = useEnabledFeatures();
40
42
  const enabledEditing = !enableReadOnly;
41
43
  const {
42
44
  id,
43
45
  selected = false,
44
46
  data: {
45
- hovered = false,
46
- active = false,
47
47
  labelBBox,
48
48
  labelXY,
49
49
  ...data
50
50
  }
51
51
  } = props;
52
- const navigateTo = enableNavigateTo ? data.navigateTo : void 0;
52
+ const navigateTo = enableNavigateTo && !isControlPointDragging ? data.navigateTo : void 0;
53
53
  const {
54
54
  controlPoints,
55
55
  setControlPoints,
@@ -66,21 +66,22 @@ const RelationshipEdge = memoEdge((props) => {
66
66
  y: labelXY?.y ?? labelY
67
67
  });
68
68
  useUpdateEffect(() => {
69
- setLabelPos({
69
+ if (isControlPointDraggingRef.current) {
70
+ return;
71
+ }
72
+ const next = {
70
73
  x: labelX,
71
74
  y: labelY
72
- });
75
+ };
76
+ setLabelPos((current) => isSamePoint(current, next) ? current : next);
73
77
  }, [labelX, labelY]);
74
78
  const svgPathRef = useRef(null);
75
- useRafEffect(() => {
79
+ useEffect(() => {
76
80
  const path = svgPathRef.current;
77
81
  if (!path || !isControlPointDragging) return;
78
- setLabelPos(getEdgeCenter(path));
82
+ const next = getEdgeCenter(path);
83
+ setLabelPos((current) => isSamePoint(current, next) ? current : next);
79
84
  }, [edgePath, isControlPointDragging]);
80
- if (isControlPointDragging) {
81
- labelX = labelPos.x;
82
- labelY = labelPos.y;
83
- }
84
85
  const updateEdgeData = useCallbackRef((controlPoints2) => {
85
86
  const point = svgPathRef.current ? getEdgeCenter(svgPathRef.current) : null;
86
87
  if (labelBBox && point) {
@@ -89,8 +90,7 @@ const RelationshipEdge = memoEdge((props) => {
89
90
  labelBBox: {
90
91
  ...labelBBox,
91
92
  ...point
92
- },
93
- labelXY: point
93
+ }
94
94
  });
95
95
  } else {
96
96
  diagram.updateEdgeData(id, { controlPoints: controlPoints2 });
@@ -124,7 +124,7 @@ const RelationshipEdge = memoEdge((props) => {
124
124
  if (e.pointerType !== "mouse") {
125
125
  return;
126
126
  }
127
- if (e.button !== 2) {
127
+ if (e.button !== 2 && !selected) {
128
128
  return;
129
129
  }
130
130
  e.stopPropagation();
@@ -152,46 +152,65 @@ const RelationshipEdge = memoEdge((props) => {
152
152
  };
153
153
  }
154
154
  return /* @__PURE__ */ jsxs(Fragment, { children: [
155
- /* @__PURE__ */ jsxs(EdgeContainer, { ...props, className: cx(isControlPointDragging && controlDragging), children: [
156
- /* @__PURE__ */ jsx(
157
- EdgePath,
158
- {
159
- edgeProps: props,
160
- svgPath: edgePath,
161
- ref: svgPathRef,
162
- isDragging: isControlPointDragging,
163
- ...enabledEditing && {
164
- onEdgePointerDown
155
+ /* @__PURE__ */ jsxs(
156
+ EdgeContainer,
157
+ {
158
+ ...props,
159
+ className: css({
160
+ "& .react-flow__edge-interaction": {
161
+ cursor: enabledEditing && selected ? "copy" : void 0
165
162
  }
166
- }
167
- ),
168
- labelBBox && /* @__PURE__ */ jsx(
169
- EdgeLabelContainer,
170
- {
171
- edgeProps: props,
172
- labelPosition: { x: labelX, y: labelY },
173
- children: /* @__PURE__ */ jsx(
174
- EdgeLabel,
163
+ }),
164
+ children: [
165
+ /* @__PURE__ */ jsx(
166
+ EdgePath,
175
167
  {
176
- pointerEvents: enabledEditing ? "none" : "all",
177
168
  edgeProps: props,
178
- children: !enabledEditing && navigateTo && /* @__PURE__ */ jsx(
179
- EdgeActionButton,
169
+ svgPath: edgePath,
170
+ ref: svgPathRef,
171
+ isDragging: isControlPointDragging,
172
+ ...enabledEditing && {
173
+ onEdgePointerDown
174
+ }
175
+ }
176
+ ),
177
+ enableCompareWithLatest && /* @__PURE__ */ jsx(
178
+ EdgeDrifts,
179
+ {
180
+ edgeProps: props,
181
+ svgPath: edgePath
182
+ }
183
+ ),
184
+ labelBBox && /* @__PURE__ */ jsx(
185
+ EdgeLabelContainer,
186
+ {
187
+ edgeProps: props,
188
+ labelPosition: isControlPointDragging ? labelPos : { x: labelX, y: labelY },
189
+ children: /* @__PURE__ */ jsx(
190
+ EdgeLabel,
180
191
  {
181
- onClick: (e) => {
182
- e.stopPropagation();
183
- diagram.navigateTo(navigateTo);
184
- }
192
+ pointerEvents: enabledEditing ? "none" : "all",
193
+ edgeProps: props,
194
+ children: navigateTo && /* @__PURE__ */ jsx(
195
+ EdgeActionButton,
196
+ {
197
+ onClick: (e) => {
198
+ e.stopPropagation();
199
+ diagram.navigateTo(navigateTo);
200
+ }
201
+ }
202
+ )
185
203
  }
186
204
  )
187
205
  }
188
206
  )
189
- }
190
- )
191
- ] }),
192
- enabledEditing && controlPoints.length > 0 && (selected || active || hovered || isControlPointDragging) && /* @__PURE__ */ jsx(
207
+ ]
208
+ }
209
+ ),
210
+ enabledEditing && controlPoints.length > 0 && /* @__PURE__ */ jsx(
193
211
  ControlPoints,
194
212
  {
213
+ isControlPointDragging,
195
214
  edgeProps: props,
196
215
  controlPoints,
197
216
  onMove: setControlPoints,
@@ -199,13 +218,14 @@ const RelationshipEdge = memoEdge((props) => {
199
218
  onCancelMove: onControlPointerCancelMove,
200
219
  onFinishMove: onControlPointerFinishMove,
201
220
  onDelete: onControlPointerDelete,
202
- zIndex: ZIndexes.Element + 500
221
+ zIndex: 9999
203
222
  }
204
223
  )
205
224
  ] });
206
225
  });
207
226
  RelationshipEdge.displayName = "RelationshipEdge";
208
227
  function ControlPoints({
228
+ isControlPointDragging,
209
229
  edgeProps,
210
230
  controlPoints,
211
231
  onMove,
@@ -286,7 +306,7 @@ function ControlPoints({
286
306
  }, 10);
287
307
  };
288
308
  const onControlPointerDown = useCallbackRef((e) => {
289
- const { domNode, addSelectedEdges } = xyflowStore.getState();
309
+ const { domNode, addSelectedEdges, edges, unselectNodesAndEdges } = xyflowStore.getState();
290
310
  if (!domNode || e.pointerType !== "mouse") {
291
311
  return;
292
312
  }
@@ -297,6 +317,9 @@ function ControlPoints({
297
317
  switch (e.button) {
298
318
  case 0: {
299
319
  e.stopPropagation();
320
+ unselectNodesAndEdges({
321
+ edges: edges.filter((ed) => ed.selected && ed.id !== edgeId)
322
+ });
300
323
  addSelectedEdges([edgeId]);
301
324
  onLmbControlPointerDown(index, e, domNode);
302
325
  break;
@@ -306,6 +329,17 @@ function ControlPoints({
306
329
  break;
307
330
  }
308
331
  });
332
+ const onControlPointerDblClick = useCallbackRef((e) => {
333
+ const { domNode } = xyflowStore.getState();
334
+ if (!domNode || e.pointerType !== "mouse") {
335
+ return;
336
+ }
337
+ const index = parseFloat(e.currentTarget.getAttribute("data-control-point-index") || "");
338
+ if (isNaN(index)) {
339
+ throw new Error("data-control-point-index is not a number");
340
+ }
341
+ onRmbControlPointerDown(index, e);
342
+ });
309
343
  return /* @__PURE__ */ jsx(EdgeLabelRenderer, { children: /* @__PURE__ */ jsx(
310
344
  EdgeContainer,
311
345
  {
@@ -319,16 +353,18 @@ function ControlPoints({
319
353
  children: /* @__PURE__ */ jsx(
320
354
  "g",
321
355
  {
356
+ "data-active": isControlPointDragging ? true : void 0,
357
+ className: "group",
322
358
  onContextMenu: stopAndPrevent,
323
359
  children: controlPoints.map((p, i) => /* @__PURE__ */ jsx(
324
360
  "circle",
325
361
  {
326
362
  "data-control-point-index": i,
327
363
  onPointerDownCapture: onControlPointerDown,
364
+ onDoubleClick: onControlPointerDblClick,
328
365
  className: cx("nodrag nopan", controlPoint),
329
366
  cx: p.x,
330
- cy: p.y,
331
- r: 3
367
+ cy: p.y
332
368
  },
333
369
  "controlPoints" + edgeId + "#" + i
334
370
  ))
@@ -5,6 +5,7 @@ import '@xstate/react';
5
5
  import 'fast-equals';
6
6
  import 'react';
7
7
  import { useDiagram } from '../../../hooks/safeContext.js';
8
+ import { EdgeDrifts } from './EdgeDrifts.js';
8
9
  import { EdgeContainer } from '../../../base-primitives/edge/EdgeContainer.js';
9
10
  import { EdgePath } from '../../../base-primitives/edge/EdgePath.js';
10
11
  import { EdgeLabelContainer } from '../../../base-primitives/edge/EdgeLabelContainer.js';
@@ -13,7 +14,7 @@ import { EdgeActionButton } from '../../../base-primitives/edge/EdgeActionButton
13
14
 
14
15
  const LABEL_OFFSET = 16;
15
16
  function SequenceStepEdge(props) {
16
- const { enableNavigateTo } = useEnabledFeatures();
17
+ const { enableNavigateTo, enableCompareWithLatest } = useEnabledFeatures();
17
18
  const diagram = useDiagram();
18
19
  const { navigateTo } = props.data;
19
20
  const isSelfLoop = props.source === props.target;
@@ -50,6 +51,7 @@ function SequenceStepEdge(props) {
50
51
  svgPath: path
51
52
  }
52
53
  ),
54
+ enableCompareWithLatest && /* @__PURE__ */ jsx(EdgeDrifts, { edgeProps: props, svgPath: path }),
53
55
  /* @__PURE__ */ jsx(
54
56
  EdgeLabelContainer,
55
57
  {
@@ -1,3 +1,2 @@
1
1
  export declare const controlPointsContainer: string;
2
2
  export declare const controlPoint: string;
3
- export declare const controlDragging: string;