@emuanalytics/flow-rdf-ui 4.2.1 → 4.3.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 (401) hide show
  1. package/README.md +58 -0
  2. package/THIRD_PARTY_NOTICES.md +220 -0
  3. package/dist/components/alert/alert.component.mjs +3 -0
  4. package/dist/components/animation/animation.component.mjs +1 -0
  5. package/dist/components/autocomplete/autocomplete.component.mjs +3 -4
  6. package/dist/components/avatar/avatar.component.mjs +3 -0
  7. package/dist/components/badge/badge.component.mjs +1 -0
  8. package/dist/components/base-control/base-control.component.mjs +3 -0
  9. package/dist/components/breadcrumb/breadcrumb.component.mjs +3 -0
  10. package/dist/components/breadcrumb-item/breadcrumb-item.component.mjs +1 -0
  11. package/dist/components/busy-overlay/busy-overlay.component.mjs +3 -0
  12. package/dist/components/button/button.component.mjs +4 -0
  13. package/dist/components/button-group/button-group.component.mjs +1 -0
  14. package/dist/components/calendar/calendar.component.mjs +6 -0
  15. package/dist/components/card/card.component.mjs +1 -0
  16. package/dist/components/carousel/carousel.component.mjs +3 -0
  17. package/dist/components/carousel-item/carousel-item.component.mjs +1 -0
  18. package/dist/components/chart/chart.component.mjs +1 -0
  19. package/dist/components/chart/chartjs-plugins/luxon.adapter.mjs +78 -0
  20. package/dist/components/chart/chartjs-support.mjs +2 -0
  21. package/dist/components/checkbox/checkbox.component.mjs +3 -0
  22. package/dist/components/checkbox-group/checkbox-group.component.mjs +3 -0
  23. package/dist/components/color-mapper/color-mapper.component.mjs +21 -0
  24. package/dist/components/color-picker/color-picker.component.mjs +8 -0
  25. package/dist/components/color-stop/color-stop.component.mjs +17 -0
  26. package/dist/components/date-time-picker/date-time-picker.component.mjs +6 -0
  27. package/dist/components/details/details.component.mjs +3 -0
  28. package/dist/components/diagram/diagram-panel.styles.mjs +44 -0
  29. package/dist/components/diagram/diagram-tokens.styles.mjs +148 -0
  30. package/dist/components/diagram/diagram.component.mjs +355 -0
  31. package/dist/components/diagram/diagram.mjs +5 -0
  32. package/dist/components/diagram/diagram.styles.mjs +95 -0
  33. package/dist/components/diagram-background/diagram-background.component.mjs +163 -0
  34. package/dist/components/diagram-background/diagram-background.mjs +5 -0
  35. package/dist/components/diagram-background/diagram-background.styles.mjs +58 -0
  36. package/dist/components/diagram-base-edge/diagram-base-edge.component.mjs +326 -0
  37. package/dist/components/diagram-base-edge/diagram-base-edge.mjs +5 -0
  38. package/dist/components/diagram-base-edge/diagram-base-edge.styles.mjs +147 -0
  39. package/dist/components/diagram-base-node/diagram-base-node.component.mjs +84 -0
  40. package/dist/components/diagram-base-node/diagram-base-node.mjs +5 -0
  41. package/dist/components/diagram-base-node/diagram-base-node.styles.mjs +37 -0
  42. package/dist/components/diagram-edge/diagram-edge.component.mjs +56 -0
  43. package/dist/components/diagram-edge/diagram-edge.mjs +5 -0
  44. package/dist/components/diagram-edge/diagram-edge.styles.mjs +37 -0
  45. package/dist/components/diagram-edge-label/diagram-edge-label.component.mjs +202 -0
  46. package/dist/components/diagram-edge-label/diagram-edge-label.mjs +5 -0
  47. package/dist/components/diagram-edge-label/diagram-edge-label.styles.mjs +54 -0
  48. package/dist/components/diagram-marker/diagram-marker.component.mjs +84 -0
  49. package/dist/components/diagram-marker/diagram-marker.mjs +5 -0
  50. package/dist/components/diagram-marker/diagram-marker.styles.mjs +9 -0
  51. package/dist/components/diagram-minimap/diagram-minimap.component.mjs +298 -0
  52. package/dist/components/diagram-minimap/diagram-minimap.mjs +5 -0
  53. package/dist/components/diagram-minimap/diagram-minimap.styles.mjs +83 -0
  54. package/dist/components/diagram-node/diagram-node-template.styles.mjs +36 -0
  55. package/dist/components/diagram-node/diagram-node.component.mjs +183 -0
  56. package/dist/components/diagram-node/diagram-node.mjs +6 -0
  57. package/dist/components/diagram-node/diagram-node.styles.mjs +29 -0
  58. package/dist/components/diagram-palette-item/diagram-palette-item.component.mjs +168 -0
  59. package/dist/components/diagram-palette-item/diagram-palette-item.mjs +5 -0
  60. package/dist/components/diagram-palette-item/diagram-palette-item.styles.mjs +20 -0
  61. package/dist/components/diagram-palette-item-preview/diagram-palette-item-preview.component.mjs +245 -0
  62. package/dist/components/diagram-palette-item-preview/diagram-palette-item-preview.mjs +6 -0
  63. package/dist/components/diagram-palette-item-preview/diagram-palette-item-preview.styles.mjs +41 -0
  64. package/dist/components/diagram-port/diagram-port.component.mjs +273 -0
  65. package/dist/components/diagram-port/diagram-port.mjs +5 -0
  66. package/dist/components/diagram-port/diagram-port.styles.mjs +116 -0
  67. package/dist/components/diagram-resize-adornment/diagram-resize-adornment.component.mjs +124 -0
  68. package/dist/components/diagram-resize-adornment/diagram-resize-adornment.mjs +5 -0
  69. package/dist/components/diagram-resize-adornment/diagram-resize-adornment.styles.mjs +136 -0
  70. package/dist/components/diagram-rotate-adornment/diagram-rotate-adornment.component.mjs +125 -0
  71. package/dist/components/diagram-rotate-adornment/diagram-rotate-adornment.mjs +5 -0
  72. package/dist/components/diagram-rotate-adornment/diagram-rotate-adornment.styles.mjs +65 -0
  73. package/dist/components/diagram-zoom-controls/diagram-zoom-controls.component.mjs +158 -0
  74. package/dist/components/diagram-zoom-controls/diagram-zoom-controls.mjs +5 -0
  75. package/dist/components/diagram-zoom-controls/diagram-zoom-controls.styles.mjs +66 -0
  76. package/dist/components/dialog/dialog.component.mjs +4 -0
  77. package/dist/components/divider/divider.component.mjs +1 -0
  78. package/dist/components/drawer/drawer.component.mjs +3 -0
  79. package/dist/components/dropdown/dropdown.component.mjs +2 -1
  80. package/dist/components/form-group/form-group.component.mjs +1 -0
  81. package/dist/components/gauge/gauge.component.mjs +6 -0
  82. package/dist/components/icon/icon.component.mjs +1 -0
  83. package/dist/components/icon/library.system.mjs +2 -0
  84. package/dist/components/icon-button/icon-button.component.mjs +5 -0
  85. package/dist/components/input/input.component.mjs +5 -0
  86. package/dist/components/list/list.component.mjs +1 -0
  87. package/dist/components/list-item/list-item.component.mjs +17 -0
  88. package/dist/components/map/map.component.mjs +3 -0
  89. package/dist/components/map/map.styles.mjs +10 -0
  90. package/dist/components/menu/menu.component.mjs +1 -0
  91. package/dist/components/menu-item/menu-item.component.mjs +3 -0
  92. package/dist/components/menu-label/menu-label.component.mjs +1 -0
  93. package/dist/components/mutation-observer/mutation-observer.component.mjs +1 -0
  94. package/dist/components/option/option.component.mjs +2 -1
  95. package/dist/components/panel/panel.component.mjs +85 -1
  96. package/dist/components/panel/panel.styles.mjs +29 -0
  97. package/dist/components/panel-header/panel-header.component.mjs +3 -0
  98. package/dist/components/popup/popup.component.mjs +1 -0
  99. package/dist/components/progress-bar/progress-bar.component.mjs +1 -0
  100. package/dist/components/progress-ring/progress-ring.component.mjs +1 -0
  101. package/dist/components/query-builder/query-builder.component.mjs +27 -0
  102. package/dist/components/radio/radio.component.mjs +3 -0
  103. package/dist/components/radio-group/radio-group.component.mjs +3 -0
  104. package/dist/components/range/range.component.mjs +4 -0
  105. package/dist/components/resize-observer/resize-observer.component.mjs +1 -0
  106. package/dist/components/scroll-view/scroll-view.component.mjs +1 -0
  107. package/dist/components/select/select.component.mjs +3 -5
  108. package/dist/components/split-view/split-view-layout-registry.mjs +44 -0
  109. package/dist/components/split-view/split-view-layout.mjs +607 -0
  110. package/dist/components/split-view/split-view.component.mjs +502 -468
  111. package/dist/components/split-view/split-view.styles.mjs +25 -0
  112. package/dist/components/split-view-divider/split-view-divider.component.mjs +2 -53
  113. package/dist/components/split-view-divider/split-view-divider.styles.mjs +28 -16
  114. package/dist/components/split-view-pane/split-view-pane.component.mjs +197 -18
  115. package/dist/components/split-view-pane/split-view-pane.styles.mjs +52 -0
  116. package/dist/components/split-view-toggle-button/split-view-toggle-button.component.mjs +5 -0
  117. package/dist/components/stepper/stepper.component.mjs +1 -0
  118. package/dist/components/stepper-panel/stepper-panel.component.mjs +1 -0
  119. package/dist/components/switch/switch.component.mjs +3 -0
  120. package/dist/components/tab/tab.component.mjs +4 -0
  121. package/dist/components/tab-group/tab-group.component.mjs +176 -6
  122. package/dist/components/tab-group/tab-group.styles.mjs +44 -0
  123. package/dist/components/tab-panel/tab-panel.component.mjs +1 -0
  124. package/dist/components/tag/tag.component.mjs +2 -1
  125. package/dist/components/textarea/textarea.component.mjs +1 -0
  126. package/dist/components/timer/ticker.mjs +7 -0
  127. package/dist/components/timer/timer.component.mjs +44 -3
  128. package/dist/components/timer/timer.styles.mjs +6 -2
  129. package/dist/components/tool-button/tool-button.component.mjs +4 -0
  130. package/dist/components/tool-button-group/tool-button-group.component.mjs +3 -0
  131. package/dist/components/tooltip/tooltip.component.mjs +3 -0
  132. package/dist/components/tree/tree.component.mjs +1 -0
  133. package/dist/components/tree-item/tree-item.component.mjs +5 -0
  134. package/dist/components/visually-hidden/visually-hidden.component.mjs +1 -0
  135. package/dist/custom-elements.json +7002 -867
  136. package/dist/diagram/api/diagram-api-base.mjs +16 -0
  137. package/dist/diagram/api/diagram-api.mjs +399 -0
  138. package/dist/diagram/api/diagram-clipboard-api.mjs +52 -0
  139. package/dist/diagram/api/diagram-groups-api.mjs +46 -0
  140. package/dist/diagram/api/diagram-model-api.mjs +447 -0
  141. package/dist/diagram/api/diagram-nodes-api.mjs +61 -0
  142. package/dist/diagram/api/diagram-selection-api.mjs +56 -0
  143. package/dist/diagram/api/diagram-viewport-api.mjs +169 -0
  144. package/dist/diagram/api/emit-with-measurement-option.mjs +21 -0
  145. package/dist/diagram/input/box-selection-controller.mjs +104 -0
  146. package/dist/diagram/input/context-menu-controller.mjs +196 -0
  147. package/dist/diagram/input/cursor-position-tracker-controller.mjs +18 -0
  148. package/dist/diagram/input/input-controller.mjs +31 -0
  149. package/dist/diagram/input/keyboard-actions/moving-action.mjs +27 -0
  150. package/dist/diagram/input/keyboard-actions/panning-action.mjs +27 -0
  151. package/dist/diagram/input/keyboard-actions/paste-action.mjs +17 -0
  152. package/dist/diagram/input/keyboard-actions/zoom-action.mjs +30 -0
  153. package/dist/diagram/input/keyboard-inputs-controller.mjs +121 -0
  154. package/dist/diagram/input/linking-controller.mjs +127 -0
  155. package/dist/diagram/input/linking-events.mjs +61 -0
  156. package/dist/diagram/input/manual-linking.mjs +101 -0
  157. package/dist/diagram/input/mobile-box-selection-controller.mjs +133 -0
  158. package/dist/diagram/input/mobile-panning-controller.mjs +114 -0
  159. package/dist/diagram/input/mobile-zooming-controller.mjs +110 -0
  160. package/dist/diagram/input/object-selection-controller.mjs +152 -0
  161. package/dist/diagram/input/palette-drop-controller.mjs +92 -0
  162. package/dist/diagram/input/panning-controller.mjs +147 -0
  163. package/dist/diagram/input/pointer-move-selection-controller.mjs +191 -0
  164. package/dist/diagram/input/relinking-gesture.mjs +182 -0
  165. package/dist/diagram/input/resize-controller.mjs +122 -0
  166. package/dist/diagram/input/rotate-controller.mjs +126 -0
  167. package/dist/diagram/input/zooming-wheel-controller.mjs +55 -0
  168. package/dist/diagram/minimap/minimap-calculations.mjs +83 -0
  169. package/dist/diagram/minimap/minimap-navigation-controller.mjs +150 -0
  170. package/dist/diagram/minimap/minimap-node-cache.mjs +19 -0
  171. package/dist/diagram/minimap/minimap-strategies.mjs +44 -0
  172. package/dist/diagram/model/diagram-model-adapter.mjs +97 -0
  173. package/dist/diagram/model/initialize-model.mjs +31 -0
  174. package/dist/diagram/model/strip-runtime-properties.mjs +30 -0
  175. package/dist/diagram/runtime/attribute-converters.mjs +11 -0
  176. package/dist/diagram/runtime/batched-resize-observer.mjs +168 -0
  177. package/dist/diagram/runtime/box-selection-provider.mjs +9 -0
  178. package/dist/diagram/runtime/context.mjs +132 -0
  179. package/dist/diagram/runtime/contexts.mjs +8 -0
  180. package/dist/diagram/runtime/cursor-position-tracker.mjs +20 -0
  181. package/dist/diagram/runtime/default-edge-templates.mjs +21 -0
  182. package/dist/diagram/runtime/default-node-templates.mjs +20 -0
  183. package/dist/diagram/runtime/diagram-reference.mjs +126 -0
  184. package/dist/diagram/runtime/diagram-runtime.mjs +214 -0
  185. package/dist/diagram/runtime/dom-input-events-router.mjs +88 -0
  186. package/dist/diagram/runtime/environment.mjs +59 -0
  187. package/dist/diagram/runtime/event-bridge.mjs +31 -0
  188. package/dist/diagram/runtime/flow-offset.mjs +45 -0
  189. package/dist/diagram/runtime/group-highlighted.mjs +25 -0
  190. package/dist/diagram/runtime/hidden.mjs +147 -0
  191. package/dist/diagram/runtime/lit-renderer.mjs +33 -0
  192. package/dist/diagram/runtime/marker-registry.mjs +108 -0
  193. package/dist/diagram/runtime/middlewares.mjs +14 -0
  194. package/dist/diagram/runtime/model-owner.mjs +11 -0
  195. package/dist/diagram/runtime/node-selected.mjs +25 -0
  196. package/dist/diagram/runtime/observable.mjs +205 -0
  197. package/dist/diagram/runtime/palette-drag.mjs +56 -0
  198. package/dist/diagram/runtime/port-hover.mjs +27 -0
  199. package/dist/diagram/runtime/port-registry.mjs +87 -0
  200. package/dist/diagram/runtime/resize-processor.mjs +207 -0
  201. package/dist/diagram/runtime/template-resolver.mjs +98 -0
  202. package/dist/diagram/runtime/touch-events-state.mjs +52 -0
  203. package/dist/diagram/utilities.mjs +27 -0
  204. package/dist/diagram-core/action-state-manager/action-state-manager.mjs +238 -0
  205. package/dist/diagram-core/batch-processor/batch-processor.mjs +144 -0
  206. package/dist/diagram-core/command-handler/command-handler.mjs +62 -0
  207. package/dist/diagram-core/command-handler/commands/add-to-group.mjs +32 -0
  208. package/dist/diagram-core/command-handler/commands/add-update-delete.mjs +196 -0
  209. package/dist/diagram-core/command-handler/commands/centering.mjs +73 -0
  210. package/dist/diagram-core/command-handler/commands/copy-paste.mjs +223 -0
  211. package/dist/diagram-core/command-handler/commands/cut.mjs +9 -0
  212. package/dist/diagram-core/command-handler/commands/delete-selection.mjs +32 -0
  213. package/dist/diagram-core/command-handler/commands/detach-on-node-delete.mjs +77 -0
  214. package/dist/diagram-core/command-handler/commands/highlight-group.mjs +45 -0
  215. package/dist/diagram-core/command-handler/commands/index.mjs +88 -0
  216. package/dist/diagram-core/command-handler/commands/init.mjs +11 -0
  217. package/dist/diagram-core/command-handler/commands/linking/cancel-linking.mjs +26 -0
  218. package/dist/diagram-core/command-handler/commands/linking/finish-linking-to-position.mjs +33 -0
  219. package/dist/diagram-core/command-handler/commands/linking/finish-linking.mjs +108 -0
  220. package/dist/diagram-core/command-handler/commands/linking/finish-relinking.mjs +91 -0
  221. package/dist/diagram-core/command-handler/commands/linking/linking-gesture.mjs +13 -0
  222. package/dist/diagram-core/command-handler/commands/linking/move-temporary-edge.mjs +98 -0
  223. package/dist/diagram-core/command-handler/commands/linking/start-linking-from-position.mjs +23 -0
  224. package/dist/diagram-core/command-handler/commands/linking/start-linking.mjs +47 -0
  225. package/dist/diagram-core/command-handler/commands/linking/start-relinking.mjs +51 -0
  226. package/dist/diagram-core/command-handler/commands/linking/utils.mjs +103 -0
  227. package/dist/diagram-core/command-handler/commands/move-nodes-lifecycle.mjs +14 -0
  228. package/dist/diagram-core/command-handler/commands/move-viewport.mjs +48 -0
  229. package/dist/diagram-core/command-handler/commands/move.mjs +90 -0
  230. package/dist/diagram-core/command-handler/commands/remove-from-group.mjs +22 -0
  231. package/dist/diagram-core/command-handler/commands/resize-node-lifecycle.mjs +14 -0
  232. package/dist/diagram-core/command-handler/commands/resize-node.mjs +214 -0
  233. package/dist/diagram-core/command-handler/commands/rotate-node-lifecycle.mjs +14 -0
  234. package/dist/diagram-core/command-handler/commands/rotate-node.mjs +53 -0
  235. package/dist/diagram-core/command-handler/commands/selection.mjs +69 -0
  236. package/dist/diagram-core/command-handler/commands/z-order.mjs +125 -0
  237. package/dist/diagram-core/command-handler/commands/zoom-to-fit.mjs +118 -0
  238. package/dist/diagram-core/command-handler/commands/zoom.mjs +26 -0
  239. package/dist/diagram-core/edge-routing-manager/edge-routing-manager.mjs +253 -0
  240. package/dist/diagram-core/edge-routing-manager/resolve-label-position.mjs +13 -0
  241. package/dist/diagram-core/edge-routing-manager/routings/bezier/bezier-routing.mjs +73 -0
  242. package/dist/diagram-core/edge-routing-manager/routings/bezier/compute-bezier-path.mjs +24 -0
  243. package/dist/diagram-core/edge-routing-manager/routings/bezier/compute-bezier-point-at-distance.mjs +37 -0
  244. package/dist/diagram-core/edge-routing-manager/routings/bezier/compute-bezier-point-on-path.mjs +33 -0
  245. package/dist/diagram-core/edge-routing-manager/routings/bezier/compute-bezier-points.mjs +31 -0
  246. package/dist/diagram-core/edge-routing-manager/routings/orthogonal/compute-orthogonal-path.mjs +56 -0
  247. package/dist/diagram-core/edge-routing-manager/routings/orthogonal/compute-orthogonal-point-at-distance.mjs +12 -0
  248. package/dist/diagram-core/edge-routing-manager/routings/orthogonal/compute-orthogonal-point-on-path.mjs +38 -0
  249. package/dist/diagram-core/edge-routing-manager/routings/orthogonal/compute-orthogonal-points.mjs +26 -0
  250. package/dist/diagram-core/edge-routing-manager/routings/orthogonal/orthogonal-routing.mjs +69 -0
  251. package/dist/diagram-core/edge-routing-manager/routings/orthogonal/utils/get-offset-point.mjs +14 -0
  252. package/dist/diagram-core/edge-routing-manager/routings/orthogonal/utils/pathpoints/get-pathpoints-from-bottom.mjs +104 -0
  253. package/dist/diagram-core/edge-routing-manager/routings/orthogonal/utils/pathpoints/get-pathpoints-from-left.mjs +91 -0
  254. package/dist/diagram-core/edge-routing-manager/routings/orthogonal/utils/pathpoints/get-pathpoints-from-right.mjs +88 -0
  255. package/dist/diagram-core/edge-routing-manager/routings/orthogonal/utils/pathpoints/get-pathpoints-from-top.mjs +168 -0
  256. package/dist/diagram-core/edge-routing-manager/routings/orthogonal/utils/pathpoints/get-pathpoints.mjs +23 -0
  257. package/dist/diagram-core/edge-routing-manager/routings/polyline/compute-polyline-point-at-distance.mjs +12 -0
  258. package/dist/diagram-core/edge-routing-manager/routings/polyline/compute-polyline-point-on-path.mjs +41 -0
  259. package/dist/diagram-core/edge-routing-manager/routings/polyline/polyline-routing.mjs +81 -0
  260. package/dist/diagram-core/edge-routing-manager/utils/linear-segment-utils.mjs +27 -0
  261. package/dist/diagram-core/edge-routing-manager/utils/normalize-distance.mjs +6 -0
  262. package/dist/diagram-core/event-manager/event-manager.mjs +164 -0
  263. package/dist/diagram-core/flow-config/default-flow-config.mjs +143 -0
  264. package/dist/diagram-core/flow-core.mjs +541 -0
  265. package/dist/diagram-core/input-events/handlers/box-selection/box-selection.handler.mjs +69 -0
  266. package/dist/diagram-core/input-events/handlers/cancel-interaction/cancel-interaction.handler.mjs +9 -0
  267. package/dist/diagram-core/input-events/handlers/copy/copy.handler.mjs +9 -0
  268. package/dist/diagram-core/input-events/handlers/cut/cut.handler.mjs +9 -0
  269. package/dist/diagram-core/input-events/handlers/delete-selection/delete-selection.handler.mjs +9 -0
  270. package/dist/diagram-core/input-events/handlers/event-handler.mjs +29 -0
  271. package/dist/diagram-core/input-events/handlers/keyboard-move-selection/keyboard-move-selection.handler.mjs +130 -0
  272. package/dist/diagram-core/input-events/handlers/keyboard-panning/keyboard-panning.handler.mjs +31 -0
  273. package/dist/diagram-core/input-events/handlers/linking/linking.handler.mjs +77 -0
  274. package/dist/diagram-core/input-events/handlers/movable-selection.mjs +26 -0
  275. package/dist/diagram-core/input-events/handlers/palette-drop/palette-drop.handler.mjs +20 -0
  276. package/dist/diagram-core/input-events/handlers/panning/panning-handler-factory.mjs +8 -0
  277. package/dist/diagram-core/input-events/handlers/panning/panning.handler.mjs +41 -0
  278. package/dist/diagram-core/input-events/handlers/panning/virtualized-panning.handler.mjs +77 -0
  279. package/dist/diagram-core/input-events/handlers/paste/paste.handler.mjs +17 -0
  280. package/dist/diagram-core/input-events/handlers/pointer-move-selection/pointer-move-selection.handler.mjs +220 -0
  281. package/dist/diagram-core/input-events/handlers/redo/redo.handler.mjs +14 -0
  282. package/dist/diagram-core/input-events/handlers/relinking/relinking.handler.mjs +62 -0
  283. package/dist/diagram-core/input-events/handlers/resize/resize.handler.mjs +174 -0
  284. package/dist/diagram-core/input-events/handlers/rotate/rotate.handler.mjs +107 -0
  285. package/dist/diagram-core/input-events/handlers/select/select.handler.mjs +42 -0
  286. package/dist/diagram-core/input-events/handlers/select-all/select-all.handler.mjs +10 -0
  287. package/dist/diagram-core/input-events/handlers/undo/undo.handler.mjs +14 -0
  288. package/dist/diagram-core/input-events/handlers/wheel-panning/wheel-panning.handler.mjs +25 -0
  289. package/dist/diagram-core/input-events/handlers/zooming/zooming.handler.mjs +28 -0
  290. package/dist/diagram-core/input-events/input-events.router.mjs +75 -0
  291. package/dist/diagram-core/interaction-coordinator/interaction-coordinator.mjs +75 -0
  292. package/dist/diagram-core/label-batch-processor/label-batch-processor.mjs +19 -0
  293. package/dist/diagram-core/math/angle-between-points/angle-between-points.mjs +5 -0
  294. package/dist/diagram-core/math/angle-to-side/angle-to-side.mjs +27 -0
  295. package/dist/diagram-core/math/calculate-edge-panning-force/calculate-edge-panning-force.mjs +34 -0
  296. package/dist/diagram-core/math/clamp/clamp.mjs +5 -0
  297. package/dist/diagram-core/math/distance-between-points/distance-between-points.mjs +5 -0
  298. package/dist/diagram-core/math/ng-diagram-math.mjs +25 -0
  299. package/dist/diagram-core/math/normalize-angle/normalize-angle.mjs +5 -0
  300. package/dist/diagram-core/math/snap-angle/snap-angle.mjs +43 -0
  301. package/dist/diagram-core/math/snap-number/snap-number.mjs +3 -0
  302. package/dist/diagram-core/math/snap-point/snap-point.mjs +8 -0
  303. package/dist/diagram-core/math/subtract-points/subtract-points.mjs +5 -0
  304. package/dist/diagram-core/measurement-tracker/measurement-tracker.mjs +182 -0
  305. package/dist/diagram-core/middleware-manager/middleware-executor.mjs +246 -0
  306. package/dist/diagram-core/middleware-manager/middleware-manager.mjs +93 -0
  307. package/dist/diagram-core/middleware-manager/middlewares/edges-routing/edges-routing.mjs +149 -0
  308. package/dist/diagram-core/middleware-manager/middlewares/edges-routing/get-edge-points.mjs +93 -0
  309. package/dist/diagram-core/middleware-manager/middlewares/edges-routing/get-source-target-positions.mjs +90 -0
  310. package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/clipboard-paste.emitter.mjs +34 -0
  311. package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/diagram-init.emitter.mjs +190 -0
  312. package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/edge-draw-ended.emitter.mjs +51 -0
  313. package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/edge-drawn.emitter.mjs +35 -0
  314. package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/edge-relink.emitter.mjs +58 -0
  315. package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/group-membership-changed.emitter.mjs +49 -0
  316. package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/node-drag-lifecycle.emitter.mjs +54 -0
  317. package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/node-resize-lifecycle.emitter.mjs +44 -0
  318. package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/node-rotate-lifecycle.emitter.mjs +44 -0
  319. package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/palette-item-dropped.emitter.mjs +26 -0
  320. package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/selection-changed.emitter.mjs +61 -0
  321. package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/selection-gesture-ended.emitter.mjs +32 -0
  322. package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/selection-moved.emitter.mjs +57 -0
  323. package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/selection-removed.emitter.mjs +40 -0
  324. package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/selection-rotated.emitter.mjs +33 -0
  325. package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/size-changed.emitter.mjs +33 -0
  326. package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/viewport-changed.emitter.mjs +19 -0
  327. package/dist/diagram-core/middleware-manager/middlewares/event-emitter/event-emitter.middleware.mjs +69 -0
  328. package/dist/diagram-core/middleware-manager/middlewares/hidden-computation/hidden-computation.mjs +66 -0
  329. package/dist/diagram-core/middleware-manager/middlewares/internal-id-assignment/internal-id-assignment.mjs +24 -0
  330. package/dist/diagram-core/middleware-manager/middlewares/logger/logger.mjs +18 -0
  331. package/dist/diagram-core/middleware-manager/middlewares/measured-bounds-assignment/is-node-fully-measured.mjs +20 -0
  332. package/dist/diagram-core/middleware-manager/middlewares/measured-bounds-assignment/measured-bounds-assignment.mjs +59 -0
  333. package/dist/diagram-core/middleware-manager/middlewares/measurement-tracking/measurement-tracking.middleware.mjs +55 -0
  334. package/dist/diagram-core/middleware-manager/middlewares/z-index-assignment/utils/assign-edges-z-index.mjs +12 -0
  335. package/dist/diagram-core/middleware-manager/middlewares/z-index-assignment/utils/assign-node-z-index.mjs +61 -0
  336. package/dist/diagram-core/middleware-manager/middlewares/z-index-assignment/utils/create-group-children-map.mjs +14 -0
  337. package/dist/diagram-core/middleware-manager/middlewares/z-index-assignment/utils/initialize-z-index.mjs +30 -0
  338. package/dist/diagram-core/middleware-manager/middlewares/z-index-assignment/utils/sort-children.mjs +36 -0
  339. package/dist/diagram-core/middleware-manager/middlewares/z-index-assignment/z-index-assignment.mjs +240 -0
  340. package/dist/diagram-core/middleware-manager/pass-settlement.mjs +68 -0
  341. package/dist/diagram-core/model-lookup/model-lookup.mjs +394 -0
  342. package/dist/diagram-core/port-batch-processor/port-batch-processor.mjs +20 -0
  343. package/dist/diagram-core/render-strategy/base-render-strategy.mjs +26 -0
  344. package/dist/diagram-core/render-strategy/direct/direct-render-strategy.mjs +33 -0
  345. package/dist/diagram-core/render-strategy/render-performance-logger.mjs +42 -0
  346. package/dist/diagram-core/render-strategy/virtualized/idle-render-scheduler.mjs +43 -0
  347. package/dist/diagram-core/render-strategy/virtualized/result-cache.mjs +63 -0
  348. package/dist/diagram-core/render-strategy/virtualized/viewport-utils.mjs +40 -0
  349. package/dist/diagram-core/render-strategy/virtualized/virtualized-render-strategy.mjs +91 -0
  350. package/dist/diagram-core/render-strategy/virtualized/visible-elements-resolver.mjs +120 -0
  351. package/dist/diagram-core/render-strategy/virtualized/zoom-tracker.mjs +38 -0
  352. package/dist/diagram-core/set.polyfill.mjs +24 -0
  353. package/dist/diagram-core/shortcut-manager/default-shortcuts.mjs +99 -0
  354. package/dist/diagram-core/shortcut-manager/shortcut-manager.mjs +140 -0
  355. package/dist/diagram-core/spatial-hash/collision-detection.mjs +74 -0
  356. package/dist/diagram-core/spatial-hash/spatial-hash.mjs +161 -0
  357. package/dist/diagram-core/spatial-hash/utils.mjs +92 -0
  358. package/dist/diagram-core/transaction-manager/transaction-context.mjs +40 -0
  359. package/dist/diagram-core/transaction-manager/transaction-manager.mjs +94 -0
  360. package/dist/diagram-core/transaction-manager/transaction.mjs +179 -0
  361. package/dist/diagram-core/types/edge.interface.mjs +3 -0
  362. package/dist/diagram-core/types/node.interface.mjs +3 -0
  363. package/dist/diagram-core/types/utils.mjs +3 -0
  364. package/dist/diagram-core/updater/init-updater/init-state.mjs +356 -0
  365. package/dist/diagram-core/updater/init-updater/init-updater.mjs +275 -0
  366. package/dist/diagram-core/updater/init-updater/late-arrival-queue.mjs +71 -0
  367. package/dist/diagram-core/updater/init-updater/stability-detector.mjs +63 -0
  368. package/dist/diagram-core/updater/internal-updater/internal-updater.mjs +166 -0
  369. package/dist/diagram-core/utils/change-generation.mjs +13 -0
  370. package/dist/diagram-core/utils/compute-floating-edge-side.mjs +35 -0
  371. package/dist/diagram-core/utils/constants.mjs +3 -0
  372. package/dist/diagram-core/utils/dangling-edges.mjs +89 -0
  373. package/dist/diagram-core/utils/deep-merge.mjs +22 -0
  374. package/dist/diagram-core/utils/dimensions.mjs +52 -0
  375. package/dist/diagram-core/utils/get-node-border-intersection.mjs +99 -0
  376. package/dist/diagram-core/utils/get-port-flow-position.mjs +55 -0
  377. package/dist/diagram-core/utils/group-size.mjs +32 -0
  378. package/dist/diagram-core/utils/is-group.mjs +5 -0
  379. package/dist/diagram-core/utils/measurement-validation.mjs +11 -0
  380. package/dist/diagram-core/utils/object-properties.mjs +22 -0
  381. package/dist/diagram-core/utils/rects-points-sizes.mjs +148 -0
  382. package/dist/diagram-core/utils/relinking.mjs +6 -0
  383. package/dist/diagram-core/utils/semaphore.mjs +43 -0
  384. package/dist/diagram-core/utils/snap-node-position.mjs +11 -0
  385. package/dist/diagram-core/utils/sort-nodes-by-z-index.mjs +22 -0
  386. package/dist/diagram-core/visibility/effective-visibility.mjs +28 -0
  387. package/dist/diagram-core/visibility/template-visibility-registry.mjs +87 -0
  388. package/dist/index.d.mts +13406 -3796
  389. package/dist/index.d.ts +13406 -3796
  390. package/dist/index.mjs +34 -0
  391. package/dist/internal/content-size.mjs +14 -0
  392. package/dist/internal/custom-boolean-converter.mjs +18 -0
  393. package/dist/internal/flow-ui-rdf-element.mjs +57 -5
  394. package/dist/package.json.mjs +1 -1
  395. package/dist/utilities/register-components.mjs +77 -142
  396. package/dist/vscode.html-custom-data.json +369 -96
  397. package/package.json +16 -8
  398. package/themes/dark.css +2 -0
  399. package/themes/dark.styles.js +2 -0
  400. package/themes/light.css +2 -0
  401. package/themes/light.styles.js +2 -0
@@ -0,0 +1,63 @@
1
+ class StabilityDetector {
2
+ /**
3
+ * Creates a new StabilityDetector.
4
+ *
5
+ * @param shouldWait - If false, stability is immediate (no waiting)
6
+ * @param stabilityDelay - Milliseconds of inactivity before considering stable
7
+ */
8
+ constructor(shouldWait, stabilityDelay) {
9
+ this.shouldWait = shouldWait;
10
+ this.stabilityDelay = stabilityDelay;
11
+ /** Active debounce timer, cleared and reset on each notify() */
12
+ this.stabilityTimeout = null;
13
+ /** Resolver function for the stability promise */
14
+ this.resolveStability = () => null;
15
+ /** Count of events received (for logging/debugging) */
16
+ this.eventCount = 0;
17
+ this.stabilityPromise = new Promise((resolve) => {
18
+ this.resolveStability = resolve;
19
+ });
20
+ }
21
+ /**
22
+ * Signals that an event occurred. Resets the stability timer.
23
+ * Each call restarts the countdown - stability is only reached after
24
+ * stabilityDelay ms with no notify() calls.
25
+ */
26
+ notify() {
27
+ this.eventCount++;
28
+ this.resetStabilityTimer();
29
+ }
30
+ /**
31
+ * Returns a promise that resolves when activity has stabilized.
32
+ *
33
+ * Behavior:
34
+ * - If shouldWait is false: Resolves immediately
35
+ * - If no events yet: Starts timer, waits for incoming events
36
+ * - If events occurred: Timer already running from notify() calls
37
+ *
38
+ * @returns Promise that resolves when stable (no activity for stabilityDelay ms)
39
+ */
40
+ waitForStability() {
41
+ if (!this.shouldWait) {
42
+ this.resolveStability();
43
+ } else if (this.eventCount === 0) {
44
+ this.resetStabilityTimer();
45
+ }
46
+ return this.stabilityPromise;
47
+ }
48
+ /**
49
+ * Resets the debounce timer.
50
+ * Clears any existing timer and starts a new countdown.
51
+ */
52
+ resetStabilityTimer() {
53
+ if (this.stabilityTimeout) {
54
+ clearTimeout(this.stabilityTimeout);
55
+ }
56
+ this.stabilityTimeout = setTimeout(() => {
57
+ this.resolveStability();
58
+ this.stabilityTimeout = null;
59
+ }, this.stabilityDelay);
60
+ }
61
+ }
62
+
63
+ export { StabilityDetector };
@@ -0,0 +1,166 @@
1
+ import { isZeroSize } from '../../utils/measurement-validation.mjs';
2
+ import { omitProperties, hasChangedProperties } from '../../utils/object-properties.mjs';
3
+ import { MEASURED_PORT_PROPERTIES } from '../../types/node.interface.mjs';
4
+ import { MEASURED_LABEL_PROPERTIES } from '../../types/edge.interface.mjs';
5
+ import { isSameRect, getRect } from '../../utils/rects-points-sizes.mjs';
6
+
7
+ class InternalUpdater {
8
+ constructor(flowCore) {
9
+ this.flowCore = flowCore;
10
+ // Stable callback references so BatchProcessor can group keys into a single invocation
11
+ this.onPortAddsFlush = (all) => {
12
+ return this.flowCore.commandHandler.emit("addPortsBulk", { additions: all });
13
+ };
14
+ this.onPortUpdatesFlush = (all) => {
15
+ return this.flowCore.commandHandler.emit("updatePortsBulk", { updates: all });
16
+ };
17
+ this.onPortDeletesFlush = (all) => {
18
+ return this.flowCore.commandHandler.emit("deletePortsBulk", { deletions: all });
19
+ };
20
+ this.onLabelAddsFlush = (all) => {
21
+ return this.flowCore.commandHandler.emit("addEdgeLabelsBulk", { additions: all });
22
+ };
23
+ this.onLabelUpdatesFlush = (all) => {
24
+ return this.flowCore.commandHandler.emit("updateEdgeLabelsBulk", { updates: all });
25
+ };
26
+ this.onLabelDeletesFlush = (all) => {
27
+ return this.flowCore.commandHandler.emit("deleteEdgeLabelsBulk", { deletions: all });
28
+ };
29
+ }
30
+ /**
31
+ * @internal
32
+ */
33
+ applyNodeSize(nodeId, size) {
34
+ this.applyNodeSizes([{ id: nodeId, size }]);
35
+ }
36
+ /**
37
+ * @internal
38
+ */
39
+ applyNodeSizes(updates) {
40
+ const isResizing = this.flowCore.actionStateManager.isResizing();
41
+ const filtered = updates.filter(({ id, size }) => {
42
+ if (isZeroSize(size))
43
+ return false;
44
+ const node = this.flowCore.getNodeById(id);
45
+ if (!node)
46
+ return false;
47
+ if (node.size && isResizing)
48
+ return false;
49
+ return !isSameRect(getRect(node), getRect({ size }));
50
+ });
51
+ if (filtered.length > 0) {
52
+ this.flowCore.commandHandler.emit("updateNodes", { nodes: filtered });
53
+ }
54
+ }
55
+ /**
56
+ * @internal
57
+ * An add for a port already in the model is a component recreation whose
58
+ * batched add never lands — re-apply its authored (non-measured) properties.
59
+ */
60
+ addPort(nodeId, port) {
61
+ const exists = this.flowCore.getNodeById(nodeId)?.measuredPorts?.some(({ id }) => id === port.id);
62
+ if (exists) {
63
+ this.applyPortChanges(nodeId, [{ portId: port.id, portChanges: omitProperties(port, MEASURED_PORT_PROPERTIES) }]);
64
+ }
65
+ this.flowCore.portBatchProcessor.processAdd(nodeId, port, this.onPortAddsFlush);
66
+ }
67
+ /**
68
+ * @internal
69
+ */
70
+ deletePort(nodeId, portId) {
71
+ this.flowCore.portBatchProcessor.processDelete(nodeId, portId, this.onPortDeletesFlush);
72
+ }
73
+ /**
74
+ * @internal
75
+ * Filters out updates where no property actually differs from current state.
76
+ */
77
+ applyPortChanges(nodeId, portUpdates) {
78
+ const node = this.flowCore.getNodeById(nodeId);
79
+ if (!node) {
80
+ return;
81
+ }
82
+ const filteredUpdates = this.filterUnchangedPortUpdates(node, this.rejectZeroSizePortGeometry(portUpdates));
83
+ if (filteredUpdates.length === 0) {
84
+ return;
85
+ }
86
+ for (const portUpdate of filteredUpdates) {
87
+ this.flowCore.portBatchProcessor.processUpdate(nodeId, portUpdate, this.onPortUpdatesFlush);
88
+ }
89
+ }
90
+ /**
91
+ * @internal
92
+ * See {@link addPort} — same recreation handling for labels.
93
+ */
94
+ addEdgeLabel(edgeId, label) {
95
+ const exists = this.flowCore.getEdgeById(edgeId)?.measuredLabels?.some(({ id }) => id === label.id);
96
+ if (exists) {
97
+ this.applyEdgeLabelChanges(edgeId, [
98
+ { labelId: label.id, labelChanges: omitProperties(label, MEASURED_LABEL_PROPERTIES) }
99
+ ]);
100
+ }
101
+ this.flowCore.labelBatchProcessor.processAdd(edgeId, label, this.onLabelAddsFlush);
102
+ }
103
+ /**
104
+ * @internal
105
+ */
106
+ deleteEdgeLabel(edgeId, labelId) {
107
+ this.flowCore.labelBatchProcessor.processDelete(edgeId, labelId, this.onLabelDeletesFlush);
108
+ }
109
+ /**
110
+ * @internal
111
+ * Filters out updates where no property actually differs from current state.
112
+ */
113
+ applyEdgeLabelChanges(edgeId, labelUpdates) {
114
+ const filteredUpdates = this.filterUnchangedLabelUpdates(edgeId, this.rejectZeroSizeLabelGeometry(labelUpdates));
115
+ if (filteredUpdates.length === 0) {
116
+ return;
117
+ }
118
+ for (const labelUpdate of filteredUpdates) {
119
+ this.flowCore.labelBatchProcessor.processUpdate(edgeId, labelUpdate, this.onLabelUpdatesFlush);
120
+ }
121
+ }
122
+ /**
123
+ * Drops measured geometry (size + position) from updates carrying a 0×0 size —
124
+ * the display: none signature — so hiding an observed port never corrupts its
125
+ * last valid geometry. Non-measured properties in the same update still apply.
126
+ */
127
+ rejectZeroSizePortGeometry(portUpdates) {
128
+ return portUpdates.map(
129
+ (update) => isZeroSize(update.portChanges.size) ? { ...update, portChanges: omitProperties(update.portChanges, MEASURED_PORT_PROPERTIES) } : update
130
+ ).filter(({ portChanges }) => Object.keys(portChanges).length > 0);
131
+ }
132
+ /**
133
+ * See {@link rejectZeroSizePortGeometry} — same guard for edge labels.
134
+ */
135
+ rejectZeroSizeLabelGeometry(labelUpdates) {
136
+ return labelUpdates.map(
137
+ (update) => isZeroSize(update.labelChanges.size) ? { ...update, labelChanges: omitProperties(update.labelChanges, MEASURED_LABEL_PROPERTIES) } : update
138
+ ).filter(({ labelChanges }) => Object.keys(labelChanges).length > 0);
139
+ }
140
+ /**
141
+ * Filters out port updates where none of the changed properties actually differ from current state.
142
+ */
143
+ filterUnchangedPortUpdates(node, portUpdates) {
144
+ const measuredPortsMap = new Map((node.measuredPorts ?? []).map((port) => [port.id, port]));
145
+ return portUpdates.filter(({ portId, portChanges }) => {
146
+ const measuredPort = measuredPortsMap.get(portId);
147
+ return !!measuredPort && hasChangedProperties(measuredPort, portChanges);
148
+ });
149
+ }
150
+ /**
151
+ * Filters out label updates where none of the changed properties actually differ from current state.
152
+ */
153
+ filterUnchangedLabelUpdates(edgeId, labelUpdates) {
154
+ const edge = this.flowCore.getEdgeById(edgeId);
155
+ if (!edge) {
156
+ return [];
157
+ }
158
+ const measuredLabelsMap = new Map((edge.measuredLabels ?? []).map((label) => [label.id, label]));
159
+ return labelUpdates.filter(({ labelId, labelChanges }) => {
160
+ const label = measuredLabelsMap.get(labelId);
161
+ return !!label && hasChangedProperties(label, labelChanges);
162
+ });
163
+ }
164
+ }
165
+
166
+ export { InternalUpdater };
@@ -0,0 +1,13 @@
1
+ class ChangeGeneration {
2
+ constructor() {
3
+ this.v = 0;
4
+ }
5
+ bump() {
6
+ this.v++;
7
+ }
8
+ get version() {
9
+ return this.v;
10
+ }
11
+ }
12
+
13
+ export { ChangeGeneration };
@@ -0,0 +1,35 @@
1
+ import { NgDiagramMath } from '../math/ng-diagram-math.mjs';
2
+
3
+ const computeFloatingEndSide = (startNode, startPort, cursorPosition) => {
4
+ if (!startNode) {
5
+ return "left";
6
+ }
7
+ let startCenter;
8
+ if (startPort && startNode.measuredPorts) {
9
+ const port = startNode.measuredPorts.find((p) => p.id === startPort);
10
+ if (port?.position) {
11
+ startCenter = {
12
+ x: startNode.position.x + port.position.x + (port.size?.width ?? 0) / 2,
13
+ y: startNode.position.y + port.position.y + (port.size?.height ?? 0) / 2
14
+ };
15
+ } else {
16
+ startCenter = {
17
+ x: startNode.position.x + (startNode.size?.width ?? 100) / 2,
18
+ y: startNode.position.y + (startNode.size?.height ?? 50) / 2
19
+ };
20
+ }
21
+ } else {
22
+ startCenter = {
23
+ x: startNode.position.x + (startNode.size?.width ?? 100) / 2,
24
+ y: startNode.position.y + (startNode.size?.height ?? 50) / 2
25
+ };
26
+ }
27
+ const angle = NgDiagramMath.angleBetweenPoints(startCenter, cursorPosition);
28
+ return NgDiagramMath.angleToSide(angle, true);
29
+ };
30
+ const computeFloatingStartSide = (floatingStartPosition, endPosition) => {
31
+ const angle = NgDiagramMath.angleBetweenPoints(floatingStartPosition, endPosition);
32
+ return NgDiagramMath.angleToSide(angle, false);
33
+ };
34
+
35
+ export { computeFloatingEndSide, computeFloatingStartSide };
@@ -0,0 +1,3 @@
1
+ const FPS_60 = 1e3 / 60;
2
+
3
+ export { FPS_60 };
@@ -0,0 +1,89 @@
1
+ import { getPortFlowPosition } from './get-port-flow-position.mjs';
2
+
3
+ const hasFreeEndpoint = (edge, end) => {
4
+ if (end === "source") {
5
+ return !edge.source;
6
+ }
7
+ if (end === "target") {
8
+ return !edge.target;
9
+ }
10
+ return !edge.source || !edge.target;
11
+ };
12
+ const isDanglingEdge = (edge) => hasFreeEndpoint(edge);
13
+ const getDanglingEndpoints = (edges) => {
14
+ const endpoints = [];
15
+ for (const edge of edges) {
16
+ if (edge.temporary || edge.computedHidden) {
17
+ continue;
18
+ }
19
+ if (!edge.source && edge.sourcePosition) {
20
+ endpoints.push({ edge, end: "source", position: edge.sourcePosition });
21
+ }
22
+ if (!edge.target && edge.targetPosition) {
23
+ endpoints.push({ edge, end: "target", position: edge.targetPosition });
24
+ }
25
+ }
26
+ return endpoints;
27
+ };
28
+ const computeDetachAnchor = (edge, end, node) => {
29
+ const portId = end === "source" ? edge.sourcePort : edge.targetPort;
30
+ if (node && portId) {
31
+ const portPosition = getPortFlowPosition(node, portId);
32
+ if (portPosition) {
33
+ return portPosition;
34
+ }
35
+ }
36
+ const points = edge.points;
37
+ if (points && points.length > 0) {
38
+ return end === "source" ? points[0] : points[points.length - 1];
39
+ }
40
+ if (node) {
41
+ return {
42
+ x: node.position.x + (node.size?.width ?? 0) / 2,
43
+ y: node.position.y + (node.size?.height ?? 0) / 2
44
+ };
45
+ }
46
+ return null;
47
+ };
48
+ const alignManualPointsPatch = (edge, end, anchor) => {
49
+ if (edge.routingMode !== "manual" || !edge.points || edge.points.length === 0) {
50
+ return {};
51
+ }
52
+ const points = edge.points.map((point) => ({ ...point }));
53
+ points[end === "source" ? 0 : points.length - 1] = { x: anchor.x, y: anchor.y };
54
+ return { points };
55
+ };
56
+ const getNearestDanglingEndpointInRange = (edges, point, range) => {
57
+ let bestEdge = null;
58
+ let bestEnd = "source";
59
+ let bestPosition = null;
60
+ let bestDistSq = range * range;
61
+ const consider = (edge, end, position) => {
62
+ if (!position) {
63
+ return;
64
+ }
65
+ const dx = position.x - point.x;
66
+ const dy = position.y - point.y;
67
+ const distSq = dx * dx + dy * dy;
68
+ if (distSq <= bestDistSq) {
69
+ bestDistSq = distSq;
70
+ bestEdge = edge;
71
+ bestEnd = end;
72
+ bestPosition = position;
73
+ }
74
+ };
75
+ for (const edge of edges) {
76
+ if (edge.temporary || edge.computedHidden) {
77
+ continue;
78
+ }
79
+ if (!edge.source) {
80
+ consider(edge, "source", edge.sourcePosition);
81
+ }
82
+ if (!edge.target) {
83
+ consider(edge, "target", edge.targetPosition);
84
+ }
85
+ }
86
+ return bestEdge && bestPosition ? { edge: bestEdge, end: bestEnd, position: bestPosition } : null;
87
+ };
88
+
89
+ export { alignManualPointsPatch, computeDetachAnchor, getDanglingEndpoints, getNearestDanglingEndpointInRange, hasFreeEndpoint, isDanglingEdge };
@@ -0,0 +1,22 @@
1
+ function deepMerge(original, override) {
2
+ const result = { ...original };
3
+ for (const key in override) {
4
+ if (Object.hasOwn(override, key)) {
5
+ const value = override[key];
6
+ const defaultValue = original[key];
7
+ if (value !== void 0) {
8
+ if (typeof value === "object" && value !== null && !Array.isArray(value) && typeof value !== "function" && typeof defaultValue === "object" && defaultValue !== null && !Array.isArray(defaultValue) && typeof defaultValue !== "function") {
9
+ result[key] = deepMerge(
10
+ defaultValue,
11
+ value
12
+ );
13
+ } else {
14
+ result[key] = value;
15
+ }
16
+ }
17
+ }
18
+ }
19
+ return result;
20
+ }
21
+
22
+ export { deepMerge };
@@ -0,0 +1,52 @@
1
+ import { unionRect, boundingRectOfPoints, getRect, getRotatedBoundingRect } from './rects-points-sizes.mjs';
2
+
3
+ const calculateNodeBounds = (nodes) => {
4
+ return unionRect(
5
+ nodes.filter((node) => !node.computedHidden).map((node) => node.measuredBounds).filter((rect) => rect !== void 0)
6
+ );
7
+ };
8
+ const calculateEdgeBounds = (edges) => {
9
+ return unionRect(edges.filter((edge) => !edge.computedHidden && edge.points?.length).map(getEdgeMeasuredBounds));
10
+ };
11
+ const calculatePartsBounds = (nodes, edges) => {
12
+ const partsBounds = [calculateNodeBounds(nodes), calculateEdgeBounds(edges)].filter(
13
+ (rect) => rect !== null
14
+ );
15
+ return unionRect(partsBounds);
16
+ };
17
+ const getEdgeMeasuredBounds = (edge) => {
18
+ const points = edge.points || [];
19
+ const pointsBounds = boundingRectOfPoints(points);
20
+ const labels = edge.measuredLabels || [];
21
+ if (labels.length === 0) {
22
+ return pointsBounds;
23
+ }
24
+ const labelRects = labels.filter((label) => label.position && label.size).map((label) => ({
25
+ x: label.position.x - label.size.width / 2,
26
+ y: label.position.y - label.size.height / 2,
27
+ width: label.size.width,
28
+ height: label.size.height
29
+ }));
30
+ return unionRect([pointsBounds, ...labelRects]);
31
+ };
32
+ const getNodeMeasuredBounds = (node, templateVisibilityRegistry) => {
33
+ const ports = (node.measuredPorts || []).filter(
34
+ (port) => !templateVisibilityRegistry?.isPortHidden(node.id, port.id)
35
+ );
36
+ const { x, y, width, height } = getRect(node);
37
+ const localNodeRect = { x: 0, y: 0, width, height };
38
+ const rotatedLocalRect = getRotatedBoundingRect(localNodeRect, node.angle || 0);
39
+ const portRects = ports.map((port) => {
40
+ const { x: px, y: py, width: pw, height: ph } = getRect(port);
41
+ return { x: px, y: py, width: pw, height: ph };
42
+ });
43
+ const localBounds = unionRect([rotatedLocalRect, ...portRects]);
44
+ return {
45
+ x: x + localBounds.x,
46
+ y: y + localBounds.y,
47
+ width: localBounds.width,
48
+ height: localBounds.height
49
+ };
50
+ };
51
+
52
+ export { calculatePartsBounds, getEdgeMeasuredBounds, getNodeMeasuredBounds };
@@ -0,0 +1,99 @@
1
+ import { getRect } from './rects-points-sizes.mjs';
2
+
3
+ const rotatePoint = (point, center, angle) => {
4
+ const cos = Math.cos(angle);
5
+ const sin = Math.sin(angle);
6
+ const dx = point.x - center.x;
7
+ const dy = point.y - center.y;
8
+ return {
9
+ x: center.x + dx * cos - dy * sin,
10
+ y: center.y + dx * sin + dy * cos
11
+ };
12
+ };
13
+ const lineSegmentIntersection = (p1, p2, p3, p4) => {
14
+ const d = (p1.x - p2.x) * (p3.y - p4.y) - (p1.y - p2.y) * (p3.x - p4.x);
15
+ if (Math.abs(d) < 1e-10)
16
+ return null;
17
+ const t = ((p1.x - p3.x) * (p3.y - p4.y) - (p1.y - p3.y) * (p3.x - p4.x)) / d;
18
+ const u = -((p1.x - p2.x) * (p1.y - p3.y) - (p1.y - p2.y) * (p1.x - p3.x)) / d;
19
+ if (t >= 0 && t <= 1 && u >= 0 && u <= 1) {
20
+ return {
21
+ x: p1.x + t * (p2.x - p1.x),
22
+ y: p1.y + t * (p2.y - p1.y)
23
+ };
24
+ }
25
+ return null;
26
+ };
27
+ const getOutwardNormal = (edgeStart, edgeEnd) => {
28
+ const edgeX = edgeEnd.x - edgeStart.x;
29
+ const edgeY = edgeEnd.y - edgeStart.y;
30
+ const normalX = edgeY;
31
+ const normalY = -edgeX;
32
+ const length = Math.hypot(normalX, normalY);
33
+ if (length === 0)
34
+ return { x: 1, y: 0 };
35
+ return { x: normalX / length, y: normalY / length };
36
+ };
37
+ const normalToSide = (normal) => {
38
+ if (Math.abs(normal.x) >= Math.abs(normal.y)) {
39
+ return normal.x >= 0 ? "right" : "left";
40
+ } else {
41
+ return normal.y >= 0 ? "bottom" : "top";
42
+ }
43
+ };
44
+ const getNodeBorderIntersection = (node, from) => {
45
+ const nodeRect = getRect({ position: node.position, size: node.size });
46
+ const angle = (node.angle || 0) * Math.PI / 180;
47
+ const center = {
48
+ x: nodeRect.x + nodeRect.width / 2,
49
+ y: nodeRect.y + nodeRect.height / 2
50
+ };
51
+ if (from.x === center.x && from.y === center.y) {
52
+ const rightPoint = angle !== 0 ? rotatePoint({ x: nodeRect.x + nodeRect.width, y: center.y }, center, angle) : { x: nodeRect.x + nodeRect.width, y: center.y };
53
+ const exitNormal = angle !== 0 ? rotatePoint({ x: 1, y: 0 }, { x: 0, y: 0 }, angle) : { x: 1, y: 0 };
54
+ return {
55
+ x: rightPoint.x,
56
+ y: rightPoint.y,
57
+ side: normalToSide(exitNormal)
58
+ };
59
+ }
60
+ const corners = [
61
+ { x: nodeRect.x, y: nodeRect.y },
62
+ { x: nodeRect.x + nodeRect.width, y: nodeRect.y },
63
+ { x: nodeRect.x + nodeRect.width, y: nodeRect.y + nodeRect.height },
64
+ { x: nodeRect.x, y: nodeRect.y + nodeRect.height }
65
+ ];
66
+ const rotatedCorners = angle !== 0 ? corners.map((c) => rotatePoint(c, center, angle)) : corners;
67
+ let closestDistance = Infinity;
68
+ let hitEdgeStart = null;
69
+ let hitEdgeEnd = null;
70
+ for (let i = 0; i < 4; i++) {
71
+ const edgeStart = rotatedCorners[i];
72
+ const edgeEnd = rotatedCorners[(i + 1) % 4];
73
+ const intersection = lineSegmentIntersection(from, center, edgeStart, edgeEnd);
74
+ if (intersection) {
75
+ const dist = Math.hypot(intersection.x - from.x, intersection.y - from.y);
76
+ if (dist < closestDistance) {
77
+ closestDistance = dist;
78
+ hitEdgeStart = edgeStart;
79
+ hitEdgeEnd = edgeEnd;
80
+ }
81
+ }
82
+ }
83
+ if (!hitEdgeStart || !hitEdgeEnd) {
84
+ return { x: center.x, y: center.y, side: "right" };
85
+ }
86
+ const outwardNormal = getOutwardNormal(hitEdgeStart, hitEdgeEnd);
87
+ const side = normalToSide(outwardNormal);
88
+ const sideCenter = {
89
+ x: (hitEdgeStart.x + hitEdgeEnd.x) / 2,
90
+ y: (hitEdgeStart.y + hitEdgeEnd.y) / 2
91
+ };
92
+ return {
93
+ x: sideCenter.x,
94
+ y: sideCenter.y,
95
+ side
96
+ };
97
+ };
98
+
99
+ export { getNodeBorderIntersection };
@@ -0,0 +1,55 @@
1
+ import { getRect } from './rects-points-sizes.mjs';
2
+
3
+ const getRotatedPortSide = (initialPosition, rotation) => {
4
+ const positionMap = {
5
+ top: ["top", "right", "bottom", "left"],
6
+ right: ["right", "bottom", "left", "top"],
7
+ bottom: ["bottom", "left", "top", "right"],
8
+ left: ["left", "top", "right", "bottom"]
9
+ };
10
+ const rotationIndex = Math.round(rotation / 90) % 4;
11
+ return positionMap[initialPosition][rotationIndex];
12
+ };
13
+ const getPortPosition = (port, node) => {
14
+ const { x: px, y: py, width: pw, height: ph } = getRect(port);
15
+ const x = px + node.position.x;
16
+ const y = py + node.position.y;
17
+ let actualSide = port.side;
18
+ if (node.angle && node.angle !== 0) {
19
+ actualSide = getRotatedPortSide(port.side, node.angle);
20
+ }
21
+ if (actualSide === "left") {
22
+ return { x, y: y + ph / 2 };
23
+ }
24
+ if (actualSide === "top") {
25
+ return { x: x + pw / 2, y };
26
+ }
27
+ if (actualSide === "bottom") {
28
+ return { x: x + pw / 2, y: y + ph };
29
+ }
30
+ if (actualSide === "right") {
31
+ return { x: x + pw, y: y + ph / 2 };
32
+ }
33
+ return { x, y };
34
+ };
35
+ const getPortFlowPosition = (node, portId) => {
36
+ const port = node.measuredPorts?.find((port2) => port2.id === portId);
37
+ if (!port) {
38
+ return null;
39
+ }
40
+ return getPortPosition(port, node);
41
+ };
42
+ const getPortFlowPositionSide = (node, portId) => {
43
+ const port = node.measuredPorts?.find((port2) => port2.id === portId);
44
+ if (!port) {
45
+ return null;
46
+ }
47
+ const position = getPortPosition(port, node);
48
+ let actualSide = port.side;
49
+ if (node.angle && node.angle !== 0) {
50
+ actualSide = getRotatedPortSide(port.side, node.angle);
51
+ }
52
+ return { ...position, side: actualSide };
53
+ };
54
+
55
+ export { getPortFlowPosition, getPortFlowPositionSide, getPortPosition };
@@ -0,0 +1,32 @@
1
+ import { getNodeMeasuredBounds } from './dimensions.mjs';
2
+ import { getBoundsFromRect, getRect } from './rects-points-sizes.mjs';
3
+
4
+ const calculateGroupBounds = (childNodes, group, { useGroupRect = true, allowResizeBelowChildrenBounds = true } = {}) => {
5
+ if (!group.size?.width || !group.size?.height) {
6
+ throw new Error("Group must have both width and height defined");
7
+ }
8
+ if (allowResizeBelowChildrenBounds) {
9
+ return { left: Infinity, top: Infinity, right: -Infinity, bottom: -Infinity };
10
+ }
11
+ const groupBounds = getBoundsFromRect(getRect(group));
12
+ if (!childNodes.length) {
13
+ return groupBounds;
14
+ }
15
+ const bounds = childNodes.reduce(
16
+ (acc, node) => {
17
+ if (node.size && (!node.size.width || !node.size.height)) {
18
+ throw new Error(`calculateGroupBounds: child node ${node.id} does not have both width and height defined`);
19
+ }
20
+ const nodeBounds = node.measuredBounds ? getBoundsFromRect(node.measuredBounds) : getBoundsFromRect(getNodeMeasuredBounds(node));
21
+ acc.left = Math.min(acc.left, nodeBounds.left);
22
+ acc.top = Math.min(acc.top, nodeBounds.top);
23
+ acc.right = Math.max(acc.right, nodeBounds.right);
24
+ acc.bottom = Math.max(acc.bottom, nodeBounds.bottom);
25
+ return acc;
26
+ },
27
+ useGroupRect ? groupBounds : { left: Infinity, top: Infinity, right: -Infinity, bottom: -Infinity }
28
+ );
29
+ return bounds;
30
+ };
31
+
32
+ export { calculateGroupBounds };
@@ -0,0 +1,5 @@
1
+ function isGroup(node) {
2
+ return node.isGroup === true;
3
+ }
4
+
5
+ export { isGroup };
@@ -0,0 +1,11 @@
1
+ const isValidSize = (size) => {
2
+ return (size?.width ?? 0) > 0 && (size?.height ?? 0) > 0;
3
+ };
4
+ const isZeroSize = (size) => {
5
+ return size?.width === 0 && size?.height === 0;
6
+ };
7
+ const isValidPosition = (position) => {
8
+ return position?.x != null && position?.y != null && !isNaN(position.x) && !isNaN(position.y);
9
+ };
10
+
11
+ export { isValidPosition, isValidSize, isZeroSize };
@@ -0,0 +1,22 @@
1
+ const omitProperties = (source, excluded) => {
2
+ const result = { ...source };
3
+ for (const key of excluded) {
4
+ delete result[key];
5
+ }
6
+ return result;
7
+ };
8
+ const isSameValue = (a, b) => {
9
+ if (Object.is(a, b)) {
10
+ return true;
11
+ }
12
+ if (typeof a !== "object" || a === null || typeof b !== "object" || b === null) {
13
+ return false;
14
+ }
15
+ const aEntries = Object.entries(a);
16
+ return aEntries.length === Object.keys(b).length && aEntries.every(([key, value]) => Object.is(value, b[key]));
17
+ };
18
+ const hasChangedProperties = (current, changes) => Object.keys(changes).some(
19
+ (key) => changes[key] !== void 0 && !isSameValue(current[key], changes[key])
20
+ );
21
+
22
+ export { hasChangedProperties, isSameValue, omitProperties };