@likec4/diagram 1.45.0 → 1.46.2

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 (206) hide show
  1. package/bundle/index.js +2488 -1959
  2. package/dist/LikeC4Diagram.d.ts +1 -1
  3. package/dist/LikeC4Diagram.js +8 -7
  4. package/dist/LikeC4Diagram.props.d.ts +4 -12
  5. package/dist/LikeC4ProjectsProvider.js +8 -4
  6. package/dist/LikeC4View.js +1 -5
  7. package/dist/ReactLikeC4.d.ts +1 -4
  8. package/dist/StaticLikeC4Diagram.js +0 -2
  9. package/dist/base-primitives/NodeHandles.d.ts +2 -1
  10. package/dist/base-primitives/NodeHandles.js +22 -18
  11. package/dist/base-primitives/compound/CompoundActionButton.js +1 -1
  12. package/dist/base-primitives/compound/CompoundDetailsButton.js +1 -1
  13. package/dist/base-primitives/edge/EdgeActionButton.js +1 -1
  14. package/dist/base-primitives/edge/EdgeContainer.d.ts +1 -1
  15. package/dist/base-primitives/edge/EdgeContainer.js +2 -3
  16. package/dist/base-primitives/edge/EdgeLabel.js +16 -16
  17. package/dist/base-primitives/edge/EdgeLabelContainer.d.ts +1 -1
  18. package/dist/base-primitives/edge/EdgeLabelContainer.js +5 -4
  19. package/dist/base-primitives/edge/EdgePath.js +13 -18
  20. package/dist/base-primitives/element/ElementActionButtons.js +1 -1
  21. package/dist/base-primitives/element/ElementDetailsButton.js +1 -1
  22. package/dist/base-primitives/memoNode.js +1 -1
  23. package/dist/components/ErrorFallback.js +1 -1
  24. package/dist/components/Link.js +2 -2
  25. package/dist/context/DiagramEventHandlers.js +0 -1
  26. package/dist/context/DiagramFeatures.d.ts +1 -1
  27. package/dist/context/DiagramFeatures.js +1 -0
  28. package/dist/context/EnsureMantine.js +2 -1
  29. package/dist/context/IconRenderer.js +6 -6
  30. package/dist/editor/LikeC4EditorProvider.d.ts +22 -0
  31. package/dist/editor/LikeC4EditorProvider.js +12 -0
  32. package/dist/editor/__tests__/fixture.d.ts +205 -0
  33. package/dist/editor/applyChangesToManualLayout.d.ts +8 -0
  34. package/dist/editor/applyChangesToManualLayout.js +182 -0
  35. package/dist/editor/editorActor.actions.d.ts +201 -0
  36. package/dist/editor/editorActor.actions.js +149 -0
  37. package/dist/editor/editorActor.d.ts +653 -0
  38. package/dist/editor/editorActor.js +324 -0
  39. package/dist/editor/hotkeyActor.d.ts +7 -0
  40. package/dist/editor/hotkeyActor.js +19 -0
  41. package/dist/editor/index.d.ts +3 -2
  42. package/dist/editor/useEditorActorLogic.d.ts +565 -0
  43. package/dist/editor/useEditorActorLogic.js +54 -0
  44. package/dist/hooks/safeContext.d.ts +3 -2
  45. package/dist/hooks/safeContext.js +7 -4
  46. package/dist/hooks/useDiagram.d.ts +4 -2
  47. package/dist/hooks/useDiagram.js +19 -8
  48. package/dist/hooks/useDiagramCompareLayout.d.ts +8 -0
  49. package/dist/hooks/useDiagramCompareLayout.js +22 -2
  50. package/dist/index.d.ts +1 -0
  51. package/dist/index.js +1 -0
  52. package/dist/likec4diagram/DiagramXYFlow.js +1 -2
  53. package/dist/likec4diagram/custom/edges/EdgeDrifts.js +1 -5
  54. package/dist/likec4diagram/custom/edges/RelationshipEdge.js +74 -48
  55. package/dist/likec4diagram/custom/edges/edges.css.d.ts +0 -1
  56. package/dist/likec4diagram/custom/edges/edges.css.js +30 -24
  57. package/dist/likec4diagram/custom/edges/useControlPoints.js +2 -2
  58. package/dist/likec4diagram/custom/nodes/ElementActions.js +2 -2
  59. package/dist/likec4diagram/custom/nodes/NodeDrifts.js +4 -9
  60. package/dist/likec4diagram/custom/nodes/nodes.js +3 -6
  61. package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.js +2 -2
  62. package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +2 -2
  63. package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +127 -14
  64. package/dist/likec4diagram/state/DiagramActorProvider.js +63 -71
  65. package/dist/likec4diagram/state/assign.d.ts +4 -1
  66. package/dist/likec4diagram/state/assign.js +11 -8
  67. package/dist/likec4diagram/state/createViewChange.js +13 -9
  68. package/dist/likec4diagram/state/diagram-api.d.ts +20 -2
  69. package/dist/likec4diagram/state/diagram-api.js +58 -44
  70. package/dist/likec4diagram/state/hotkeyActor.d.ts +1 -1
  71. package/dist/likec4diagram/state/hotkeyActor.js +12 -0
  72. package/dist/likec4diagram/state/machine.actions.d.ts +774 -195
  73. package/dist/likec4diagram/state/machine.actions.js +185 -74
  74. package/dist/likec4diagram/state/machine.actions.layout.d.ts +93 -31
  75. package/dist/likec4diagram/state/machine.actions.layout.js +16 -4
  76. package/dist/likec4diagram/state/machine.d.ts +5 -4
  77. package/dist/likec4diagram/state/machine.js +11 -6
  78. package/dist/likec4diagram/state/machine.setup.d.ts +20 -9
  79. package/dist/likec4diagram/state/machine.setup.js +18 -3
  80. package/dist/likec4diagram/state/machine.state.initializing.d.ts +34 -18
  81. package/dist/likec4diagram/state/machine.state.initializing.js +10 -10
  82. package/dist/likec4diagram/state/machine.state.navigating.js +28 -9
  83. package/dist/likec4diagram/state/machine.state.ready.d.ts +1368 -434
  84. package/dist/likec4diagram/state/machine.state.ready.focused.d.ts +363 -39
  85. package/dist/likec4diagram/state/machine.state.ready.focused.js +17 -4
  86. package/dist/likec4diagram/state/machine.state.ready.idle.d.ts +104 -38
  87. package/dist/likec4diagram/state/machine.state.ready.idle.js +14 -5
  88. package/dist/likec4diagram/state/machine.state.ready.js +13 -90
  89. package/dist/likec4diagram/state/machine.state.ready.printing.d.ts +18 -6
  90. package/dist/likec4diagram/state/machine.state.ready.walkthrough.d.ts +204 -31
  91. package/dist/likec4diagram/state/machine.state.ready.walkthrough.js +14 -1
  92. package/dist/likec4diagram/state/types.d.ts +6 -2
  93. package/dist/likec4diagram/state/utils.d.ts +33 -7
  94. package/dist/likec4diagram/state/utils.js +23 -7
  95. package/dist/likec4diagram/ui/notation/NotationPanel.js +3 -3
  96. package/dist/likec4diagram/useLayoutConstraints.js +5 -9
  97. package/dist/navigationpanel/NavigationPanel.js +6 -9
  98. package/dist/navigationpanel/NavigationPanelDropdown.js +7 -7
  99. package/dist/navigationpanel/_common.js +1 -1
  100. package/dist/navigationpanel/comparepanel/CompareActionsMenu.d.ts +3 -1
  101. package/dist/navigationpanel/comparepanel/CompareActionsMenu.js +40 -14
  102. package/dist/navigationpanel/comparepanel/ComparePanelControls.js +6 -4
  103. package/dist/navigationpanel/comparepanel/LayoutTypeSwitcher.js +2 -2
  104. package/dist/navigationpanel/controls/DetailsControls.js +2 -2
  105. package/dist/navigationpanel/controls/LayoutWarning.js +2 -1
  106. package/dist/navigationpanel/controls/NavigationButtons.js +2 -2
  107. package/dist/navigationpanel/controls/OpenSource.js +1 -1
  108. package/dist/navigationpanel/controls/SearchControl.js +2 -2
  109. package/dist/navigationpanel/controls/ToggleReadonly.js +25 -17
  110. package/dist/navigationpanel/dropdown/ProjectsMenu.js +1 -1
  111. package/dist/navigationpanel/editorpanel/CenterCamera.js +1 -1
  112. package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.js +1 -1
  113. package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.js +9 -9
  114. package/dist/navigationpanel/editorpanel/ToggleReadonly.js +1 -1
  115. package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +3 -3
  116. package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +66 -66
  117. package/dist/navigationpanel/walkthrough/DynamicViewControls.js +1 -1
  118. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/createReactComponent.js +1 -1
  119. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.js +1 -1
  120. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertTriangle.js +1 -1
  121. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowDownRight.js +1 -1
  122. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowLeft.js +1 -1
  123. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowRight.js +1 -1
  124. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconBolt.js +1 -1
  125. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconBrowser.js +1 -1
  126. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.js +1 -1
  127. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronDown.js +1 -1
  128. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronLeft.js +1 -1
  129. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronRight.js +1 -1
  130. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.js +1 -1
  131. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconCylinder.js +1 -1
  132. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconDeviceMobile.js +1 -1
  133. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconDirectionSignFilled.js +1 -1
  134. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconExternalLink.js +1 -1
  135. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconFileSymlink.js +1 -1
  136. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconFocusCentered.js +1 -1
  137. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconFolderFilled.js +1 -1
  138. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconHelpCircle.js +1 -1
  139. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconId.js +1 -1
  140. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconInfoCircle.js +1 -1
  141. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignBottom.js +1 -1
  142. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignCenter.js +1 -1
  143. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignLeft.js +1 -1
  144. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignMiddle.js +1 -1
  145. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignRight.js +1 -1
  146. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutAlignTop.js +1 -1
  147. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutBoardSplit.js +1 -1
  148. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutCollage.js +1 -1
  149. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutDashboard.js +1 -1
  150. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconLink.js +1 -1
  151. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconLock.js +1 -1
  152. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconLockOpen2.js +1 -1
  153. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerPlayFilled.js +1 -1
  154. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipBackFilled.js +1 -1
  155. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipForwardFilled.js +1 -1
  156. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerStopFilled.js +1 -1
  157. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconRectangularPrism.js +1 -1
  158. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconReorder.js +1 -1
  159. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconRouteOff.js +1 -1
  160. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconSearch.js +1 -1
  161. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconSelector.js +1 -1
  162. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconStack2.js +1 -1
  163. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconStarFilled.js +1 -1
  164. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconTarget.js +1 -1
  165. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconTransform.js +1 -1
  166. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconUser.js +1 -1
  167. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconX.js +1 -1
  168. package/dist/node_modules/.pnpm/{@tabler_icons-react@3.35.0_react@19.2.0 → @tabler_icons-react@3.36.0_react@19.2.3}/node_modules/@tabler/icons-react/dist/esm/icons/IconZoomScan.js +1 -1
  169. package/dist/overlays/Overlays.js +23 -11
  170. package/dist/overlays/element-details/ElementDetailsCard.css.js +8 -11
  171. package/dist/overlays/element-details/ElementDetailsCard.js +4 -4
  172. package/dist/overlays/element-details/MetadataValue.js +4 -6
  173. package/dist/overlays/element-details/TabPanelDeployments.js +3 -3
  174. package/dist/overlays/element-details/TabPanelRelationships.js +12 -7
  175. package/dist/overlays/element-details/TabPanelStructure.js +1 -1
  176. package/dist/overlays/overlaysActor.js +6 -5
  177. package/dist/overlays/relationship-details/RelationshipDetails.js +3 -3
  178. package/dist/overlays/relationship-details/SelectEdge.js +2 -2
  179. package/dist/overlays/relationship-details/custom/ElementActions.js +3 -3
  180. package/dist/overlays/relationships-browser/RelationshipsBrowser.js +3 -3
  181. package/dist/overlays/relationships-browser/SelectElement.js +2 -2
  182. package/dist/overlays/relationships-browser/custom/ElementActions.js +3 -3
  183. package/dist/search/components/ElementsColumn.js +16 -11
  184. package/dist/search/components/PickView.js +3 -1
  185. package/dist/search/components/SearchByTags.js +1 -1
  186. package/dist/search/components/SearchInput.js +1 -1
  187. package/dist/search/components/ViewsColum.d.ts +3 -1
  188. package/dist/search/components/ViewsColum.js +14 -9
  189. package/dist/search/components/utils.d.ts +6 -0
  190. package/dist/search/components/utils.js +4 -1
  191. package/dist/shadowroot/styles.css.js +6 -1
  192. package/dist/styles.css2.js +1 -1
  193. package/dist/utils/index.d.ts +2 -2
  194. package/dist/utils/xyflow.d.ts +2 -3
  195. package/dist/utils/xyflow.js +9 -8
  196. package/package.json +22 -22
  197. package/panda.buildinfo.json +61 -80
  198. package/styles-min.css +1 -1
  199. package/styles.css +1 -1
  200. package/dist/base-primitives/edge/edge.css.d.ts +0 -4
  201. package/dist/base-primitives/edge/edge.css.js +0 -71
  202. package/dist/editor/LikeC4EditorContext.d.ts +0 -21
  203. package/dist/likec4diagram/state/syncManualLayoutActor.d.ts +0 -46
  204. package/dist/likec4diagram/state/syncManualLayoutActor.js +0 -309
  205. package/dist/utils/vector.d.ts +0 -86
  206. package/dist/utils/vector.js +0 -127
@@ -1,12 +1,14 @@
1
1
  import { nonNullable, nonexhaustive, invariant } from '@likec4/core';
2
2
  import { nodeToRect } from '@xyflow/system';
3
3
  import { produce } from 'immer';
4
- import { isTruthy, hasAtLeast } from 'remeda';
4
+ import { hasAtLeast, isTruthy } from 'remeda';
5
5
  import { assertEvent } from 'xstate';
6
+ import { convertToXYFlow } from '../convert-to-xyflow.js';
6
7
  import { createLayoutConstraints } from '../useLayoutConstraints.js';
7
8
  import { getAligner, toNodeRect } from './aligners.js';
8
9
  import { resetEdgeControlPoints, mergeXYNodesEdges, focusNodesEdges } from './assign.js';
9
- import { createViewChange } from './createViewChange.js';
10
+ import { setViewport, cancelFitDiagram, raiseFitDiagram } from './machine.actions.layout.js';
11
+ export { assignViewportBefore, fitDiagram, fitFocusedBounds, raiseSetViewport, raiseUpdateView, returnViewportBefore } from './machine.actions.layout.js';
10
12
  import { machine } from './machine.setup.js';
11
13
  import { typedSystem, findDiagramEdge, findDiagramNode } from './utils.js';
12
14
  import { Base } from '../../base/Base.js';
@@ -68,18 +70,21 @@ const assignLastClickedNode = () => machine.assign(({ context, event }) => {
68
70
  });
69
71
  const assignFocusedNode = () => machine.assign(({ event }) => {
70
72
  let focusedNode;
73
+ let autoUnfocusTimer = false;
71
74
  switch (event.type) {
72
75
  case "xyflow.nodeClick":
73
76
  focusedNode = event.node.data.id;
74
77
  break;
75
78
  case "focus.node":
76
79
  focusedNode = event.nodeId;
80
+ autoUnfocusTimer = event.autoUnfocus === true;
77
81
  break;
78
82
  default:
79
83
  throw new Error(`Unexpected event type: ${event.type} in action 'assign: focusedNode'`);
80
84
  }
81
85
  return {
82
- focusedNode
86
+ focusedNode,
87
+ autoUnfocusTimer
83
88
  };
84
89
  });
85
90
  const resetLastClickedNode = () => machine.assign(() => ({
@@ -95,11 +100,19 @@ const updateInputs = () => machine.assign(({ event }) => {
95
100
  assertEvent(event, "update.inputs");
96
101
  return { ...event.inputs };
97
102
  });
98
- const updateXYNodesEdges = () => machine.assign(({ context, event }) => {
99
- assertEvent(event, "update.view");
100
- const update = mergeXYNodesEdges(context, event);
101
- let { lastClickedNode, focusedNode } = context;
102
- if (lastClickedNode || focusedNode) {
103
+ const assignXYDataFromView = (view) => machine.assign(({ context, event }) => {
104
+ let xydata;
105
+ {
106
+ assertEvent(event, "update.view");
107
+ xydata = "xynodes" in event ? event : convertToXYFlow({
108
+ dynamicViewVariant: context.dynamicViewVariant,
109
+ view: event.view,
110
+ where: context.where
111
+ });
112
+ }
113
+ const update = mergeXYNodesEdges(context, xydata);
114
+ let { lastClickedNode, focusedNode, activeWalkthrough } = context;
115
+ if (lastClickedNode || focusedNode || activeWalkthrough) {
103
116
  const nodeIds = new Set(update.xynodes.map((n) => n.id));
104
117
  if (lastClickedNode && !nodeIds.has(lastClickedNode.id)) {
105
118
  lastClickedNode = null;
@@ -107,15 +120,27 @@ const updateXYNodesEdges = () => machine.assign(({ context, event }) => {
107
120
  if (focusedNode && !nodeIds.has(focusedNode)) {
108
121
  focusedNode = null;
109
122
  }
123
+ const stepId = activeWalkthrough?.stepId;
124
+ if (stepId && !update.xyedges.some((e) => e.id === stepId)) {
125
+ activeWalkthrough = null;
126
+ }
110
127
  return {
111
128
  ...update,
112
129
  lastClickedNode,
113
- focusedNode
130
+ focusedNode,
131
+ activeWalkthrough
114
132
  };
115
133
  }
116
134
  return update;
117
135
  });
118
- const focusOnNodesAndEdges = () => machine.assign(focusNodesEdges);
136
+ const focusOnNodesAndEdges = () => machine.enqueueActions(({ context, enqueue }) => {
137
+ const next = focusNodesEdges(context);
138
+ if (next) {
139
+ enqueue.assign(next);
140
+ } else {
141
+ enqueue.raise({ type: "key.esc" });
142
+ }
143
+ });
119
144
  const undimEverything = () => machine.assign(({ context }) => ({
120
145
  xynodes: context.xynodes.map(Base.setDimmed(false)),
121
146
  xyedges: context.xyedges.map(Base.setData({
@@ -204,15 +229,22 @@ const emitEdgeClick = () => machine.emit(({ context, event }) => {
204
229
  xyedge: event.edge
205
230
  };
206
231
  });
207
- const emitOnChange = () => machine.enqueueActions(({ event, enqueue }) => {
208
- assertEvent(event, "emit.onChange");
232
+ const triggerChange = (viewChange) => machine.enqueueActions(({ event, enqueue }) => {
233
+ let change = viewChange;
234
+ if (!change) {
235
+ assertEvent(event, "trigger.change");
236
+ change = event.change;
237
+ }
209
238
  enqueue.assign({
210
239
  viewportChangedManually: true
211
240
  });
212
- enqueue.emit({
213
- type: "onChange",
214
- change: event.change
215
- });
241
+ enqueue.sendTo(
242
+ typedSystem.editorActor,
243
+ {
244
+ type: "change",
245
+ change
246
+ }
247
+ );
216
248
  });
217
249
  const emitOnLayoutTypeChange = () => machine.enqueueActions(({ event, system, context, enqueue }) => {
218
250
  if (!context.features.enableCompareWithLatest) {
@@ -230,16 +262,9 @@ const emitOnLayoutTypeChange = () => machine.enqueueActions(({ event, system, co
230
262
  }
231
263
  if (context.toggledFeatures.enableCompareWithLatest === true) {
232
264
  if (currentLayoutType === "manual" && nextLayoutType === "auto") {
233
- const syncLayoutActor = typedSystem(system).syncLayoutActorRef;
234
- const syncState = syncLayoutActor?.getSnapshot().value;
235
- const isPending = syncLayoutActor && (syncState === "pending" || syncState === "paused");
236
- if (isPending) {
237
- enqueue.sendTo(syncLayoutActor, { type: "cancel" });
238
- enqueue.emit({
239
- type: "onChange",
240
- change: createViewChange(context)
241
- });
242
- }
265
+ typedSystem(system).editorActorRef?.send({
266
+ type: "cancel"
267
+ });
243
268
  }
244
269
  const currentViewport = context.viewport;
245
270
  if (currentLayoutType === "auto") {
@@ -308,26 +333,20 @@ const resetEdgesControlPoints = () => machine.assign(({ context }) => {
308
333
  })
309
334
  };
310
335
  });
311
- const notationsHighlight = (params) => machine.assign(({ context, event }) => {
312
- if (!params) {
313
- assertEvent(event, "notations.highlight");
314
- params = {
315
- ...event
316
- };
317
- }
318
- const notation = params.notation;
319
- const kinds = params.kind ? [params.kind] : notation.kinds;
336
+ const notationsHighlight = () => machine.assign(({ context, event }) => {
337
+ assertEvent(event, "notations.highlight");
338
+ const { notation, kind } = event;
339
+ const targetKinds = kind ? [kind] : notation.kinds;
340
+ const shouldHighlight = (node) => node.notation === notation.title && node.shape === notation.shape && node.color === notation.color && targetKinds.includes(node.kind);
320
341
  const xynodes = context.xynodes.map((n) => {
321
342
  const node = findDiagramNode(context, n.id);
322
- if (node && node.notation === notation.title && node.shape === notation.shape && node.color === notation.color && kinds.includes(node.kind)) {
323
- return Base.setDimmed(n, false);
324
- }
325
- return Base.setDimmed(n, "immediate");
343
+ const highlighted = node && shouldHighlight(node);
344
+ return Base.setDimmed(n, highlighted ? false : "immediate");
326
345
  });
327
- return {
328
- xynodes,
329
- xyedges: context.xyedges.map(Base.setDimmed("immediate"))
330
- };
346
+ const xyedges = context.xyedges.map((edge) => {
347
+ return Base.setDimmed(edge, true);
348
+ });
349
+ return { xynodes, xyedges };
331
350
  });
332
351
  const tagHighlight = () => machine.assign(({ context, event }) => {
333
352
  assertEvent(event, "tag.highlight");
@@ -352,33 +371,33 @@ const assignToggledFeatures = () => machine.assign(({ context, event }) => {
352
371
  };
353
372
  });
354
373
  const closeSearch = () => machine.sendTo(
355
- ({ system }) => typedSystem(system).searchActorRef,
374
+ typedSystem.searchActor,
356
375
  {
357
376
  type: "close"
358
377
  }
359
378
  );
360
379
  const closeAllOverlays = () => machine.sendTo(
361
- ({ system }) => typedSystem(system).overlaysActorRef,
380
+ typedSystem.overlaysActor,
362
381
  {
363
382
  type: "close.all"
364
383
  }
365
384
  );
366
- const stopSyncLayout = () => machine.enqueueActions(({ enqueue, system }) => {
367
- const syncLayoutActor = typedSystem(system).syncLayoutActorRef;
368
- if (!syncLayoutActor) return;
369
- enqueue.stopChild(syncLayoutActor);
370
- });
371
- const ensureSyncLayoutActor = () => machine.enqueueActions(({ context, enqueue, system, check }) => {
372
- const isReadOnly = check("enabled: Readonly");
373
- const syncLayoutActor = typedSystem(system).syncLayoutActorRef;
374
- if (isReadOnly && syncLayoutActor) {
375
- enqueue.stopChild(syncLayoutActor);
385
+ const stopEditorActor = () => machine.enqueueActions(({ enqueue, system }) => {
386
+ const actor = typedSystem(system).editorActorRef;
387
+ if (!actor) return;
388
+ enqueue.stopChild(actor);
389
+ });
390
+ const ensureEditorActor = () => machine.enqueueActions(({ enqueue, context, system, check }) => {
391
+ const hasEditor = check("enabled: Editor");
392
+ const editor = typedSystem(system).editorActorRef;
393
+ if (!hasEditor && editor) {
394
+ enqueue.stopChild(editor);
376
395
  return;
377
396
  }
378
- if (!isReadOnly && !syncLayoutActor) {
379
- enqueue.spawnChild("syncManualLayoutActorLogic", {
380
- id: "syncLayout",
381
- systemId: "syncLayout",
397
+ if (hasEditor && !editor) {
398
+ enqueue.spawnChild("editorActor", {
399
+ id: "editor",
400
+ systemId: "editor",
382
401
  input: {
383
402
  viewId: context.view.id
384
403
  },
@@ -387,33 +406,33 @@ const ensureSyncLayoutActor = () => machine.enqueueActions(({ context, enqueue,
387
406
  }
388
407
  });
389
408
  const startEditing = (subject = "node") => machine.sendTo(
390
- ({ system }) => typedSystem(system).syncLayoutActorRef,
409
+ typedSystem.editorActor,
391
410
  {
392
- type: "editing.start",
411
+ type: "edit.start",
393
412
  subject
394
413
  }
395
414
  );
396
415
  const sendSynced = () => machine.sendTo(
397
- ({ system }) => typedSystem(system).syncLayoutActorRef,
416
+ typedSystem.editorActor,
398
417
  {
399
418
  type: "synced"
400
419
  }
401
420
  );
402
421
  const stopEditing = (wasChanged = true) => machine.sendTo(
403
- ({ system }) => typedSystem(system).syncLayoutActorRef,
422
+ typedSystem.editorActor,
404
423
  {
405
- type: "editing.stop",
424
+ type: "edit.finish",
406
425
  wasChanged
407
426
  }
408
427
  );
409
428
  const cancelEditing = () => machine.sendTo(
410
- ({ system }) => typedSystem(system).syncLayoutActorRef,
429
+ typedSystem.editorActor,
411
430
  {
412
431
  type: "cancel"
413
432
  }
414
433
  );
415
434
  const hasModelFqn = (node) => "modelFqn" in node.data && isTruthy(node.data.modelFqn);
416
- const openElementDetails = (params) => machine.enqueueActions(({ context, event, enqueue, system }) => {
435
+ const openElementDetails = (params) => machine.enqueueActions(({ context, event, enqueue }) => {
417
436
  let initiatedFrom = null;
418
437
  let fromNodeId, subject;
419
438
  switch (true) {
@@ -467,7 +486,7 @@ const openElementDetails = (params) => machine.enqueueActions(({ context, event,
467
486
  };
468
487
  }
469
488
  enqueue.sendTo(
470
- typedSystem(system).overlaysActorRef,
489
+ typedSystem.overlaysActor,
471
490
  {
472
491
  type: "open.elementDetails",
473
492
  subject,
@@ -476,6 +495,47 @@ const openElementDetails = (params) => machine.enqueueActions(({ context, event,
476
495
  }
477
496
  );
478
497
  });
498
+ const openOverlay = () => machine.enqueueActions(({ context, event, enqueue, check }) => {
499
+ assertEvent(event, ["open.relationshipsBrowser", "open.relationshipDetails", "open.elementDetails"]);
500
+ if (!check("enabled: Overlays")) {
501
+ console.warn("Overlays feature is disabled");
502
+ return;
503
+ }
504
+ switch (event.type) {
505
+ case "open.elementDetails": {
506
+ check("enabled: ElementDetails") ? enqueue(openElementDetails()) : console.warn("ElementDetails feature is disabled");
507
+ break;
508
+ }
509
+ case "open.relationshipsBrowser": {
510
+ enqueue.sendTo(
511
+ typedSystem.overlaysActor,
512
+ {
513
+ type: "open.relationshipsBrowser",
514
+ subject: event.fqn,
515
+ viewId: context.view.id,
516
+ scope: "view",
517
+ closeable: true,
518
+ enableChangeScope: true,
519
+ enableSelectSubject: true
520
+ }
521
+ );
522
+ break;
523
+ }
524
+ case "open.relationshipDetails": {
525
+ enqueue.sendTo(
526
+ typedSystem.overlaysActor,
527
+ {
528
+ type: "open.relationshipDetails",
529
+ viewId: context.view.id,
530
+ ...event.params
531
+ }
532
+ );
533
+ break;
534
+ }
535
+ default:
536
+ nonexhaustive(event);
537
+ }
538
+ });
479
539
  const openSourceOfFocusedOrLastClickedNode = () => machine.enqueueActions(({ context, enqueue }) => {
480
540
  const nodeId = context.focusedNode ?? context.lastClickedNode?.id;
481
541
  if (!nodeId || !context.features.enableVscode) return;
@@ -552,9 +612,15 @@ const onEdgeMouseLeave = () => machine.enqueueActions(({ enqueue, context, event
552
612
  });
553
613
  const startHotKeyActor = () => machine.spawnChild("hotkeyActorLogic", { id: "hotkey" });
554
614
  const stopHotKeyActor = () => machine.stopChild("hotkey");
615
+ const AUTO_UNFOCUS_DELAY = 3e3;
616
+ const startAutoUnfocusTimer = () => machine.enqueueActions(({ context, enqueue }) => {
617
+ if (context.autoUnfocusTimer && AUTO_UNFOCUS_DELAY > 0) {
618
+ enqueue.raise({ type: "focus.autoUnfocus" }, { delay: AUTO_UNFOCUS_DELAY, id: "autoUnfocusTimer" });
619
+ }
620
+ });
621
+ const cancelAutoUnfocusTimer = () => machine.cancel("autoUnfocusTimer");
555
622
  const handleNavigate = () => machine.enqueueActions(({ enqueue, context, event }) => {
556
623
  assertEvent(event, ["navigate.to", "navigate.back", "navigate.forward"]);
557
- console.log(`Handle ${event.type}`);
558
624
  const {
559
625
  view,
560
626
  focusedNode,
@@ -589,10 +655,6 @@ const handleNavigate = () => machine.enqueueActions(({ enqueue, context, event }
589
655
  });
590
656
  history = [..._history];
591
657
  history[currentIndex] = updatedEntry;
592
- console.log("Update current history entry", {
593
- before: _history[currentIndex],
594
- after: updatedEntry
595
- });
596
658
  }
597
659
  switch (event.type) {
598
660
  case "navigate.to": {
@@ -604,7 +666,8 @@ const handleNavigate = () => machine.enqueueActions(({ enqueue, context, event }
604
666
  lastOnNavigate: {
605
667
  fromView: context.view.id,
606
668
  toView: event.viewId,
607
- fromNode: event.fromNode ?? null
669
+ fromNode: event.fromNode ?? null,
670
+ focusOnElement: event.focusOnElement ?? null
608
671
  }
609
672
  });
610
673
  enqueue(emitNavigateTo());
@@ -640,5 +703,53 @@ const handleNavigate = () => machine.enqueueActions(({ enqueue, context, event }
640
703
  nonexhaustive(event);
641
704
  }
642
705
  });
706
+ const updateView = () => machine.enqueueActions(
707
+ ({ enqueue, event, context }) => {
708
+ if (event.type !== "update.view") {
709
+ console.warn(`Ignoring unexpected event type: ${event.type} in action 'update.view'`);
710
+ return;
711
+ }
712
+ const nextView = event.view;
713
+ const isAnotherView = nextView.id !== context.view.id;
714
+ if (isAnotherView) {
715
+ console.warn("updateView called for another view - ignoring", { event });
716
+ return;
717
+ }
718
+ enqueue(assignXYDataFromView());
719
+ if (event.source === "editor") {
720
+ return;
721
+ }
722
+ enqueue(sendSynced());
723
+ let recenter = !context.viewportChangedManually && !context.focusedNode && !context.activeWalkthrough;
724
+ if (context.toggledFeatures.enableCompareWithLatest === true && context.view._layout !== nextView._layout) {
725
+ if (nextView._layout === "auto" && context.viewportOnAutoLayout) {
726
+ enqueue(
727
+ setViewport({
728
+ viewport: context.viewportOnAutoLayout,
729
+ duration: 0
730
+ })
731
+ );
732
+ return;
733
+ }
734
+ if (nextView._layout === "manual" && context.viewportOnManualLayout) {
735
+ enqueue(
736
+ setViewport({
737
+ viewport: context.viewportOnManualLayout,
738
+ duration: 0
739
+ })
740
+ );
741
+ return;
742
+ }
743
+ }
744
+ recenter = recenter || nextView._type === "dynamic" && context.view._type === "dynamic" && nextView.variant !== context.view.variant;
745
+ recenter = recenter || context.toggledFeatures.enableCompareWithLatest === true && !!nextView._layout && context.view._layout !== nextView._layout;
746
+ if (recenter) {
747
+ enqueue(cancelFitDiagram());
748
+ enqueue(raiseFitDiagram({
749
+ bounds: event.view.bounds
750
+ }));
751
+ }
752
+ }
753
+ );
643
754
 
644
- export { assignDynamicViewVariant, assignFocusedNode, assignLastClickedNode, assignToggledFeatures, cancelEditing, closeAllOverlays, closeSearch, disableCompareWithLatest, emitEdgeClick, emitInitialized, emitNavigateTo, emitNodeClick, emitOnChange, emitOnLayoutTypeChange, emitOpenSource, emitPaneClick, ensureOverlaysActor, ensureSearchActor, ensureSyncLayoutActor, focusOnNodesAndEdges, handleNavigate, layoutAlign, notationsHighlight, onEdgeDoubleClick, onEdgeMouseEnter, onEdgeMouseLeave, onNodeMouseEnter, onNodeMouseLeave, openElementDetails, openSourceOfFocusedOrLastClickedNode, resetEdgesControlPoints, resetLastClickedNode, sendSynced, startEditing, startHotKeyActor, stopEditing, stopHotKeyActor, stopSyncLayout, tagHighlight, undimEverything, updateFeatures, updateInputs, updateXYNodesEdges };
755
+ export { assignDynamicViewVariant, assignFocusedNode, assignLastClickedNode, assignToggledFeatures, assignXYDataFromView, cancelAutoUnfocusTimer, cancelEditing, cancelFitDiagram, closeAllOverlays, closeSearch, disableCompareWithLatest, emitEdgeClick, emitInitialized, emitNavigateTo, emitNodeClick, emitOnLayoutTypeChange, emitOpenSource, emitPaneClick, ensureEditorActor, ensureOverlaysActor, ensureSearchActor, focusOnNodesAndEdges, handleNavigate, layoutAlign, notationsHighlight, onEdgeDoubleClick, onEdgeMouseEnter, onEdgeMouseLeave, onNodeMouseEnter, onNodeMouseLeave, openElementDetails, openOverlay, openSourceOfFocusedOrLastClickedNode, raiseFitDiagram, resetEdgesControlPoints, resetLastClickedNode, sendSynced, setViewport, startAutoUnfocusTimer, startEditing, startHotKeyActor, stopEditing, stopEditorActor, stopHotKeyActor, tagHighlight, triggerChange, undimEverything, updateFeatures, updateInputs, updateView };