@emuanalytics/flow-rdf-ui 4.2.1 → 4.3.1

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 (411) hide show
  1. package/README.md +58 -0
  2. package/THIRD_PARTY_NOTICES.md +220 -0
  3. package/dist/components/alert/alert.component.mjs +13 -10
  4. package/dist/components/animation/animation.component.mjs +3 -2
  5. package/dist/components/autocomplete/autocomplete.component.mjs +21 -20
  6. package/dist/components/avatar/avatar.component.mjs +10 -12
  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 +15 -14
  11. package/dist/components/busy-overlay/busy-overlay.component.mjs +3 -0
  12. package/dist/components/button/button.component.mjs +7 -3
  13. package/dist/components/button/button.styles.mjs +5 -5
  14. package/dist/components/button-group/button-group.component.mjs +1 -0
  15. package/dist/components/calendar/calendar.component.mjs +29 -6
  16. package/dist/components/card/card.component.mjs +5 -4
  17. package/dist/components/carousel/carousel.component.mjs +45 -42
  18. package/dist/components/carousel-item/carousel-item.component.mjs +2 -0
  19. package/dist/components/chart/chart.component.mjs +5 -4
  20. package/dist/components/chart/chartjs-plugins/luxon.adapter.mjs +78 -0
  21. package/dist/components/chart/chartjs-plugins/plugin.flow-ui-colors.mjs +1 -1
  22. package/dist/components/chart/chartjs-support.mjs +2 -0
  23. package/dist/components/checkbox/checkbox.component.mjs +21 -18
  24. package/dist/components/checkbox-group/checkbox-group.component.mjs +3 -0
  25. package/dist/components/color-mapper/color-mapper.component.mjs +27 -6
  26. package/dist/components/color-picker/color-picker.component.mjs +79 -71
  27. package/dist/components/color-picker/color-picker.styles.mjs +4 -2
  28. package/dist/components/color-stop/color-stop.component.mjs +19 -2
  29. package/dist/components/date-time-picker/date-time-picker.component.mjs +35 -29
  30. package/dist/components/details/details.component.mjs +3 -0
  31. package/dist/components/diagram/diagram-panel.styles.mjs +44 -0
  32. package/dist/components/diagram/diagram-tokens.styles.mjs +148 -0
  33. package/dist/components/diagram/diagram.component.mjs +355 -0
  34. package/dist/components/diagram/diagram.mjs +5 -0
  35. package/dist/components/diagram/diagram.styles.mjs +95 -0
  36. package/dist/components/diagram-background/diagram-background.component.mjs +163 -0
  37. package/dist/components/diagram-background/diagram-background.mjs +5 -0
  38. package/dist/components/diagram-background/diagram-background.styles.mjs +58 -0
  39. package/dist/components/diagram-base-edge/diagram-base-edge.component.mjs +326 -0
  40. package/dist/components/diagram-base-edge/diagram-base-edge.mjs +5 -0
  41. package/dist/components/diagram-base-edge/diagram-base-edge.styles.mjs +147 -0
  42. package/dist/components/diagram-base-node/diagram-base-node.component.mjs +84 -0
  43. package/dist/components/diagram-base-node/diagram-base-node.mjs +5 -0
  44. package/dist/components/diagram-base-node/diagram-base-node.styles.mjs +37 -0
  45. package/dist/components/diagram-edge/diagram-edge.component.mjs +56 -0
  46. package/dist/components/diagram-edge/diagram-edge.mjs +5 -0
  47. package/dist/components/diagram-edge/diagram-edge.styles.mjs +37 -0
  48. package/dist/components/diagram-edge-label/diagram-edge-label.component.mjs +202 -0
  49. package/dist/components/diagram-edge-label/diagram-edge-label.mjs +5 -0
  50. package/dist/components/diagram-edge-label/diagram-edge-label.styles.mjs +54 -0
  51. package/dist/components/diagram-marker/diagram-marker.component.mjs +84 -0
  52. package/dist/components/diagram-marker/diagram-marker.mjs +5 -0
  53. package/dist/components/diagram-marker/diagram-marker.styles.mjs +9 -0
  54. package/dist/components/diagram-minimap/diagram-minimap.component.mjs +298 -0
  55. package/dist/components/diagram-minimap/diagram-minimap.mjs +5 -0
  56. package/dist/components/diagram-minimap/diagram-minimap.styles.mjs +83 -0
  57. package/dist/components/diagram-node/diagram-node-template.styles.mjs +36 -0
  58. package/dist/components/diagram-node/diagram-node.component.mjs +183 -0
  59. package/dist/components/diagram-node/diagram-node.mjs +6 -0
  60. package/dist/components/diagram-node/diagram-node.styles.mjs +29 -0
  61. package/dist/components/diagram-palette-item/diagram-palette-item.component.mjs +168 -0
  62. package/dist/components/diagram-palette-item/diagram-palette-item.mjs +5 -0
  63. package/dist/components/diagram-palette-item/diagram-palette-item.styles.mjs +20 -0
  64. package/dist/components/diagram-palette-item-preview/diagram-palette-item-preview.component.mjs +245 -0
  65. package/dist/components/diagram-palette-item-preview/diagram-palette-item-preview.mjs +6 -0
  66. package/dist/components/diagram-palette-item-preview/diagram-palette-item-preview.styles.mjs +41 -0
  67. package/dist/components/diagram-port/diagram-port.component.mjs +273 -0
  68. package/dist/components/diagram-port/diagram-port.mjs +5 -0
  69. package/dist/components/diagram-port/diagram-port.styles.mjs +116 -0
  70. package/dist/components/diagram-resize-adornment/diagram-resize-adornment.component.mjs +124 -0
  71. package/dist/components/diagram-resize-adornment/diagram-resize-adornment.mjs +5 -0
  72. package/dist/components/diagram-resize-adornment/diagram-resize-adornment.styles.mjs +136 -0
  73. package/dist/components/diagram-rotate-adornment/diagram-rotate-adornment.component.mjs +125 -0
  74. package/dist/components/diagram-rotate-adornment/diagram-rotate-adornment.mjs +5 -0
  75. package/dist/components/diagram-rotate-adornment/diagram-rotate-adornment.styles.mjs +65 -0
  76. package/dist/components/diagram-zoom-controls/diagram-zoom-controls.component.mjs +158 -0
  77. package/dist/components/diagram-zoom-controls/diagram-zoom-controls.mjs +5 -0
  78. package/dist/components/diagram-zoom-controls/diagram-zoom-controls.styles.mjs +68 -0
  79. package/dist/components/dialog/dialog.component.mjs +5 -1
  80. package/dist/components/divider/divider.component.mjs +1 -0
  81. package/dist/components/drawer/drawer.component.mjs +22 -19
  82. package/dist/components/dropdown/dropdown.component.mjs +2 -1
  83. package/dist/components/form-group/form-group.component.mjs +1 -0
  84. package/dist/components/gauge/gauge.component.mjs +10 -2
  85. package/dist/components/icon/icon.component.mjs +1 -0
  86. package/dist/components/icon/library.mjs +7 -4
  87. package/dist/components/icon/library.system.mjs +2 -0
  88. package/dist/components/icon-button/icon-button.component.mjs +5 -0
  89. package/dist/components/input/input.component.mjs +21 -11
  90. package/dist/components/list/list.component.mjs +1 -0
  91. package/dist/components/list-item/list-item.component.mjs +34 -17
  92. package/dist/components/map/map.component.mjs +3 -0
  93. package/dist/components/map/map.styles.mjs +10 -0
  94. package/dist/components/menu/menu.component.mjs +1 -0
  95. package/dist/components/menu-item/menu-item.component.mjs +3 -0
  96. package/dist/components/menu-label/menu-label.component.mjs +1 -0
  97. package/dist/components/mutation-observer/mutation-observer.component.mjs +5 -6
  98. package/dist/components/option/option.component.mjs +2 -1
  99. package/dist/components/panel/panel.component.mjs +85 -1
  100. package/dist/components/panel/panel.styles.mjs +29 -0
  101. package/dist/components/panel-header/panel-header.component.mjs +14 -8
  102. package/dist/components/popup/popup.component.mjs +12 -11
  103. package/dist/components/progress-bar/progress-bar.component.mjs +3 -2
  104. package/dist/components/progress-ring/progress-ring.component.mjs +1 -0
  105. package/dist/components/query-builder/converters/javascript-filter-converter.mjs +0 -4
  106. package/dist/components/query-builder/converters/map-layer-filter-converter.mjs +0 -4
  107. package/dist/components/query-builder/query-builder.component.mjs +42 -15
  108. package/dist/components/radio/radio.component.mjs +10 -7
  109. package/dist/components/radio-group/radio-group.component.mjs +4 -1
  110. package/dist/components/range/range.component.mjs +4 -0
  111. package/dist/components/resize-observer/resize-observer.component.mjs +2 -1
  112. package/dist/components/scroll-view/scroll-view.component.mjs +1 -0
  113. package/dist/components/scroll-view/scroll-view.styles.mjs +20 -7
  114. package/dist/components/select/select.component.mjs +19 -21
  115. package/dist/components/split-view/split-view-layout-registry.mjs +44 -0
  116. package/dist/components/split-view/split-view-layout.mjs +607 -0
  117. package/dist/components/split-view/split-view.component.mjs +502 -468
  118. package/dist/components/split-view/split-view.styles.mjs +25 -0
  119. package/dist/components/split-view-divider/split-view-divider.component.mjs +2 -53
  120. package/dist/components/split-view-divider/split-view-divider.styles.mjs +28 -16
  121. package/dist/components/split-view-pane/split-view-pane.component.mjs +197 -18
  122. package/dist/components/split-view-pane/split-view-pane.styles.mjs +52 -0
  123. package/dist/components/split-view-toggle-button/split-view-toggle-button.component.mjs +5 -0
  124. package/dist/components/split-view-toggle-button/split-view-toggle-button.styles.mjs +3 -3
  125. package/dist/components/stepper/stepper.component.mjs +3 -2
  126. package/dist/components/stepper-panel/stepper-panel.component.mjs +4 -3
  127. package/dist/components/switch/switch.component.mjs +9 -8
  128. package/dist/components/tab/tab.component.mjs +21 -17
  129. package/dist/components/tab-group/tab-group.component.mjs +218 -44
  130. package/dist/components/tab-group/tab-group.styles.mjs +44 -0
  131. package/dist/components/tab-panel/tab-panel.component.mjs +1 -0
  132. package/dist/components/tag/tag.component.mjs +13 -12
  133. package/dist/components/textarea/textarea.component.mjs +11 -4
  134. package/dist/components/timer/ticker.mjs +7 -0
  135. package/dist/components/timer/timer.component.mjs +44 -3
  136. package/dist/components/timer/timer.styles.mjs +6 -2
  137. package/dist/components/tool-button/tool-button.component.mjs +4 -0
  138. package/dist/components/tool-button-group/tool-button-group.component.mjs +3 -0
  139. package/dist/components/tooltip/tooltip.component.mjs +3 -0
  140. package/dist/components/tree/tree.component.mjs +5 -2
  141. package/dist/components/tree-item/tree-item.component.mjs +5 -0
  142. package/dist/components/visually-hidden/visually-hidden.component.mjs +1 -0
  143. package/dist/custom-elements.json +7890 -1741
  144. package/dist/diagram/api/diagram-api-base.mjs +16 -0
  145. package/dist/diagram/api/diagram-api.mjs +399 -0
  146. package/dist/diagram/api/diagram-clipboard-api.mjs +52 -0
  147. package/dist/diagram/api/diagram-groups-api.mjs +46 -0
  148. package/dist/diagram/api/diagram-model-api.mjs +447 -0
  149. package/dist/diagram/api/diagram-nodes-api.mjs +61 -0
  150. package/dist/diagram/api/diagram-selection-api.mjs +56 -0
  151. package/dist/diagram/api/diagram-viewport-api.mjs +169 -0
  152. package/dist/diagram/api/emit-with-measurement-option.mjs +21 -0
  153. package/dist/diagram/input/box-selection-controller.mjs +104 -0
  154. package/dist/diagram/input/context-menu-controller.mjs +196 -0
  155. package/dist/diagram/input/cursor-position-tracker-controller.mjs +18 -0
  156. package/dist/diagram/input/input-controller.mjs +31 -0
  157. package/dist/diagram/input/keyboard-actions/moving-action.mjs +27 -0
  158. package/dist/diagram/input/keyboard-actions/panning-action.mjs +27 -0
  159. package/dist/diagram/input/keyboard-actions/paste-action.mjs +17 -0
  160. package/dist/diagram/input/keyboard-actions/zoom-action.mjs +30 -0
  161. package/dist/diagram/input/keyboard-inputs-controller.mjs +121 -0
  162. package/dist/diagram/input/linking-controller.mjs +127 -0
  163. package/dist/diagram/input/linking-events.mjs +61 -0
  164. package/dist/diagram/input/manual-linking.mjs +101 -0
  165. package/dist/diagram/input/mobile-box-selection-controller.mjs +133 -0
  166. package/dist/diagram/input/mobile-panning-controller.mjs +114 -0
  167. package/dist/diagram/input/mobile-zooming-controller.mjs +110 -0
  168. package/dist/diagram/input/object-selection-controller.mjs +152 -0
  169. package/dist/diagram/input/palette-drop-controller.mjs +92 -0
  170. package/dist/diagram/input/panning-controller.mjs +147 -0
  171. package/dist/diagram/input/pointer-move-selection-controller.mjs +191 -0
  172. package/dist/diagram/input/relinking-gesture.mjs +182 -0
  173. package/dist/diagram/input/resize-controller.mjs +122 -0
  174. package/dist/diagram/input/rotate-controller.mjs +126 -0
  175. package/dist/diagram/input/zooming-wheel-controller.mjs +55 -0
  176. package/dist/diagram/minimap/minimap-calculations.mjs +83 -0
  177. package/dist/diagram/minimap/minimap-navigation-controller.mjs +150 -0
  178. package/dist/diagram/minimap/minimap-node-cache.mjs +19 -0
  179. package/dist/diagram/minimap/minimap-strategies.mjs +44 -0
  180. package/dist/diagram/model/diagram-model-adapter.mjs +97 -0
  181. package/dist/diagram/model/initialize-model.mjs +31 -0
  182. package/dist/diagram/model/strip-runtime-properties.mjs +30 -0
  183. package/dist/diagram/runtime/attribute-converters.mjs +11 -0
  184. package/dist/diagram/runtime/batched-resize-observer.mjs +168 -0
  185. package/dist/diagram/runtime/box-selection-provider.mjs +9 -0
  186. package/dist/diagram/runtime/context.mjs +132 -0
  187. package/dist/diagram/runtime/contexts.mjs +8 -0
  188. package/dist/diagram/runtime/cursor-position-tracker.mjs +20 -0
  189. package/dist/diagram/runtime/default-edge-templates.mjs +21 -0
  190. package/dist/diagram/runtime/default-node-templates.mjs +20 -0
  191. package/dist/diagram/runtime/diagram-reference.mjs +126 -0
  192. package/dist/diagram/runtime/diagram-runtime.mjs +214 -0
  193. package/dist/diagram/runtime/dom-input-events-router.mjs +88 -0
  194. package/dist/diagram/runtime/environment.mjs +59 -0
  195. package/dist/diagram/runtime/event-bridge.mjs +31 -0
  196. package/dist/diagram/runtime/flow-offset.mjs +45 -0
  197. package/dist/diagram/runtime/group-highlighted.mjs +25 -0
  198. package/dist/diagram/runtime/hidden.mjs +147 -0
  199. package/dist/diagram/runtime/lit-renderer.mjs +33 -0
  200. package/dist/diagram/runtime/marker-registry.mjs +108 -0
  201. package/dist/diagram/runtime/middlewares.mjs +14 -0
  202. package/dist/diagram/runtime/model-owner.mjs +11 -0
  203. package/dist/diagram/runtime/node-selected.mjs +25 -0
  204. package/dist/diagram/runtime/observable.mjs +205 -0
  205. package/dist/diagram/runtime/palette-drag.mjs +56 -0
  206. package/dist/diagram/runtime/port-hover.mjs +27 -0
  207. package/dist/diagram/runtime/port-registry.mjs +87 -0
  208. package/dist/diagram/runtime/resize-processor.mjs +207 -0
  209. package/dist/diagram/runtime/template-resolver.mjs +98 -0
  210. package/dist/diagram/runtime/touch-events-state.mjs +52 -0
  211. package/dist/diagram/utilities.mjs +27 -0
  212. package/dist/diagram-core/action-state-manager/action-state-manager.mjs +238 -0
  213. package/dist/diagram-core/batch-processor/batch-processor.mjs +144 -0
  214. package/dist/diagram-core/command-handler/command-handler.mjs +62 -0
  215. package/dist/diagram-core/command-handler/commands/add-to-group.mjs +32 -0
  216. package/dist/diagram-core/command-handler/commands/add-update-delete.mjs +196 -0
  217. package/dist/diagram-core/command-handler/commands/centering.mjs +73 -0
  218. package/dist/diagram-core/command-handler/commands/copy-paste.mjs +223 -0
  219. package/dist/diagram-core/command-handler/commands/cut.mjs +9 -0
  220. package/dist/diagram-core/command-handler/commands/delete-selection.mjs +32 -0
  221. package/dist/diagram-core/command-handler/commands/detach-on-node-delete.mjs +77 -0
  222. package/dist/diagram-core/command-handler/commands/highlight-group.mjs +45 -0
  223. package/dist/diagram-core/command-handler/commands/index.mjs +88 -0
  224. package/dist/diagram-core/command-handler/commands/init.mjs +11 -0
  225. package/dist/diagram-core/command-handler/commands/linking/cancel-linking.mjs +26 -0
  226. package/dist/diagram-core/command-handler/commands/linking/finish-linking-to-position.mjs +33 -0
  227. package/dist/diagram-core/command-handler/commands/linking/finish-linking.mjs +108 -0
  228. package/dist/diagram-core/command-handler/commands/linking/finish-relinking.mjs +91 -0
  229. package/dist/diagram-core/command-handler/commands/linking/linking-gesture.mjs +13 -0
  230. package/dist/diagram-core/command-handler/commands/linking/move-temporary-edge.mjs +98 -0
  231. package/dist/diagram-core/command-handler/commands/linking/start-linking-from-position.mjs +23 -0
  232. package/dist/diagram-core/command-handler/commands/linking/start-linking.mjs +47 -0
  233. package/dist/diagram-core/command-handler/commands/linking/start-relinking.mjs +51 -0
  234. package/dist/diagram-core/command-handler/commands/linking/utils.mjs +103 -0
  235. package/dist/diagram-core/command-handler/commands/move-nodes-lifecycle.mjs +14 -0
  236. package/dist/diagram-core/command-handler/commands/move-viewport.mjs +48 -0
  237. package/dist/diagram-core/command-handler/commands/move.mjs +90 -0
  238. package/dist/diagram-core/command-handler/commands/remove-from-group.mjs +22 -0
  239. package/dist/diagram-core/command-handler/commands/resize-node-lifecycle.mjs +14 -0
  240. package/dist/diagram-core/command-handler/commands/resize-node.mjs +214 -0
  241. package/dist/diagram-core/command-handler/commands/rotate-node-lifecycle.mjs +14 -0
  242. package/dist/diagram-core/command-handler/commands/rotate-node.mjs +53 -0
  243. package/dist/diagram-core/command-handler/commands/selection.mjs +69 -0
  244. package/dist/diagram-core/command-handler/commands/z-order.mjs +125 -0
  245. package/dist/diagram-core/command-handler/commands/zoom-to-fit.mjs +118 -0
  246. package/dist/diagram-core/command-handler/commands/zoom.mjs +26 -0
  247. package/dist/diagram-core/edge-routing-manager/edge-routing-manager.mjs +253 -0
  248. package/dist/diagram-core/edge-routing-manager/resolve-label-position.mjs +13 -0
  249. package/dist/diagram-core/edge-routing-manager/routings/bezier/bezier-routing.mjs +73 -0
  250. package/dist/diagram-core/edge-routing-manager/routings/bezier/compute-bezier-path.mjs +24 -0
  251. package/dist/diagram-core/edge-routing-manager/routings/bezier/compute-bezier-point-at-distance.mjs +37 -0
  252. package/dist/diagram-core/edge-routing-manager/routings/bezier/compute-bezier-point-on-path.mjs +33 -0
  253. package/dist/diagram-core/edge-routing-manager/routings/bezier/compute-bezier-points.mjs +31 -0
  254. package/dist/diagram-core/edge-routing-manager/routings/orthogonal/compute-orthogonal-path.mjs +56 -0
  255. package/dist/diagram-core/edge-routing-manager/routings/orthogonal/compute-orthogonal-point-at-distance.mjs +12 -0
  256. package/dist/diagram-core/edge-routing-manager/routings/orthogonal/compute-orthogonal-point-on-path.mjs +38 -0
  257. package/dist/diagram-core/edge-routing-manager/routings/orthogonal/compute-orthogonal-points.mjs +26 -0
  258. package/dist/diagram-core/edge-routing-manager/routings/orthogonal/orthogonal-routing.mjs +69 -0
  259. package/dist/diagram-core/edge-routing-manager/routings/orthogonal/utils/get-offset-point.mjs +14 -0
  260. package/dist/diagram-core/edge-routing-manager/routings/orthogonal/utils/pathpoints/get-pathpoints-from-bottom.mjs +104 -0
  261. package/dist/diagram-core/edge-routing-manager/routings/orthogonal/utils/pathpoints/get-pathpoints-from-left.mjs +91 -0
  262. package/dist/diagram-core/edge-routing-manager/routings/orthogonal/utils/pathpoints/get-pathpoints-from-right.mjs +88 -0
  263. package/dist/diagram-core/edge-routing-manager/routings/orthogonal/utils/pathpoints/get-pathpoints-from-top.mjs +168 -0
  264. package/dist/diagram-core/edge-routing-manager/routings/orthogonal/utils/pathpoints/get-pathpoints.mjs +23 -0
  265. package/dist/diagram-core/edge-routing-manager/routings/polyline/compute-polyline-point-at-distance.mjs +12 -0
  266. package/dist/diagram-core/edge-routing-manager/routings/polyline/compute-polyline-point-on-path.mjs +41 -0
  267. package/dist/diagram-core/edge-routing-manager/routings/polyline/polyline-routing.mjs +81 -0
  268. package/dist/diagram-core/edge-routing-manager/utils/linear-segment-utils.mjs +27 -0
  269. package/dist/diagram-core/edge-routing-manager/utils/normalize-distance.mjs +6 -0
  270. package/dist/diagram-core/event-manager/event-manager.mjs +164 -0
  271. package/dist/diagram-core/flow-config/default-flow-config.mjs +143 -0
  272. package/dist/diagram-core/flow-core.mjs +541 -0
  273. package/dist/diagram-core/input-events/handlers/box-selection/box-selection.handler.mjs +69 -0
  274. package/dist/diagram-core/input-events/handlers/cancel-interaction/cancel-interaction.handler.mjs +9 -0
  275. package/dist/diagram-core/input-events/handlers/copy/copy.handler.mjs +9 -0
  276. package/dist/diagram-core/input-events/handlers/cut/cut.handler.mjs +9 -0
  277. package/dist/diagram-core/input-events/handlers/delete-selection/delete-selection.handler.mjs +9 -0
  278. package/dist/diagram-core/input-events/handlers/event-handler.mjs +29 -0
  279. package/dist/diagram-core/input-events/handlers/keyboard-move-selection/keyboard-move-selection.handler.mjs +130 -0
  280. package/dist/diagram-core/input-events/handlers/keyboard-panning/keyboard-panning.handler.mjs +31 -0
  281. package/dist/diagram-core/input-events/handlers/linking/linking.handler.mjs +77 -0
  282. package/dist/diagram-core/input-events/handlers/movable-selection.mjs +26 -0
  283. package/dist/diagram-core/input-events/handlers/palette-drop/palette-drop.handler.mjs +20 -0
  284. package/dist/diagram-core/input-events/handlers/panning/panning-handler-factory.mjs +8 -0
  285. package/dist/diagram-core/input-events/handlers/panning/panning.handler.mjs +41 -0
  286. package/dist/diagram-core/input-events/handlers/panning/virtualized-panning.handler.mjs +77 -0
  287. package/dist/diagram-core/input-events/handlers/paste/paste.handler.mjs +17 -0
  288. package/dist/diagram-core/input-events/handlers/pointer-move-selection/pointer-move-selection.handler.mjs +220 -0
  289. package/dist/diagram-core/input-events/handlers/redo/redo.handler.mjs +14 -0
  290. package/dist/diagram-core/input-events/handlers/relinking/relinking.handler.mjs +62 -0
  291. package/dist/diagram-core/input-events/handlers/resize/resize.handler.mjs +174 -0
  292. package/dist/diagram-core/input-events/handlers/rotate/rotate.handler.mjs +107 -0
  293. package/dist/diagram-core/input-events/handlers/select/select.handler.mjs +42 -0
  294. package/dist/diagram-core/input-events/handlers/select-all/select-all.handler.mjs +10 -0
  295. package/dist/diagram-core/input-events/handlers/undo/undo.handler.mjs +14 -0
  296. package/dist/diagram-core/input-events/handlers/wheel-panning/wheel-panning.handler.mjs +25 -0
  297. package/dist/diagram-core/input-events/handlers/zooming/zooming.handler.mjs +28 -0
  298. package/dist/diagram-core/input-events/input-events.router.mjs +75 -0
  299. package/dist/diagram-core/interaction-coordinator/interaction-coordinator.mjs +75 -0
  300. package/dist/diagram-core/label-batch-processor/label-batch-processor.mjs +19 -0
  301. package/dist/diagram-core/math/angle-between-points/angle-between-points.mjs +5 -0
  302. package/dist/diagram-core/math/angle-to-side/angle-to-side.mjs +27 -0
  303. package/dist/diagram-core/math/calculate-edge-panning-force/calculate-edge-panning-force.mjs +34 -0
  304. package/dist/diagram-core/math/clamp/clamp.mjs +5 -0
  305. package/dist/diagram-core/math/distance-between-points/distance-between-points.mjs +5 -0
  306. package/dist/diagram-core/math/ng-diagram-math.mjs +25 -0
  307. package/dist/diagram-core/math/normalize-angle/normalize-angle.mjs +5 -0
  308. package/dist/diagram-core/math/snap-angle/snap-angle.mjs +43 -0
  309. package/dist/diagram-core/math/snap-number/snap-number.mjs +3 -0
  310. package/dist/diagram-core/math/snap-point/snap-point.mjs +8 -0
  311. package/dist/diagram-core/math/subtract-points/subtract-points.mjs +5 -0
  312. package/dist/diagram-core/measurement-tracker/measurement-tracker.mjs +182 -0
  313. package/dist/diagram-core/middleware-manager/middleware-executor.mjs +246 -0
  314. package/dist/diagram-core/middleware-manager/middleware-manager.mjs +93 -0
  315. package/dist/diagram-core/middleware-manager/middlewares/edges-routing/edges-routing.mjs +149 -0
  316. package/dist/diagram-core/middleware-manager/middlewares/edges-routing/get-edge-points.mjs +93 -0
  317. package/dist/diagram-core/middleware-manager/middlewares/edges-routing/get-source-target-positions.mjs +90 -0
  318. package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/clipboard-paste.emitter.mjs +34 -0
  319. package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/diagram-init.emitter.mjs +190 -0
  320. package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/edge-draw-ended.emitter.mjs +51 -0
  321. package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/edge-drawn.emitter.mjs +35 -0
  322. package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/edge-relink.emitter.mjs +58 -0
  323. package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/group-membership-changed.emitter.mjs +49 -0
  324. package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/node-drag-lifecycle.emitter.mjs +54 -0
  325. package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/node-resize-lifecycle.emitter.mjs +44 -0
  326. package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/node-rotate-lifecycle.emitter.mjs +44 -0
  327. package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/palette-item-dropped.emitter.mjs +26 -0
  328. package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/selection-changed.emitter.mjs +61 -0
  329. package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/selection-gesture-ended.emitter.mjs +32 -0
  330. package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/selection-moved.emitter.mjs +57 -0
  331. package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/selection-removed.emitter.mjs +40 -0
  332. package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/selection-rotated.emitter.mjs +33 -0
  333. package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/size-changed.emitter.mjs +33 -0
  334. package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/viewport-changed.emitter.mjs +19 -0
  335. package/dist/diagram-core/middleware-manager/middlewares/event-emitter/event-emitter.middleware.mjs +69 -0
  336. package/dist/diagram-core/middleware-manager/middlewares/hidden-computation/hidden-computation.mjs +66 -0
  337. package/dist/diagram-core/middleware-manager/middlewares/internal-id-assignment/internal-id-assignment.mjs +24 -0
  338. package/dist/diagram-core/middleware-manager/middlewares/logger/logger.mjs +18 -0
  339. package/dist/diagram-core/middleware-manager/middlewares/measured-bounds-assignment/is-node-fully-measured.mjs +20 -0
  340. package/dist/diagram-core/middleware-manager/middlewares/measured-bounds-assignment/measured-bounds-assignment.mjs +59 -0
  341. package/dist/diagram-core/middleware-manager/middlewares/measurement-tracking/measurement-tracking.middleware.mjs +55 -0
  342. package/dist/diagram-core/middleware-manager/middlewares/z-index-assignment/utils/assign-edges-z-index.mjs +12 -0
  343. package/dist/diagram-core/middleware-manager/middlewares/z-index-assignment/utils/assign-node-z-index.mjs +61 -0
  344. package/dist/diagram-core/middleware-manager/middlewares/z-index-assignment/utils/create-group-children-map.mjs +14 -0
  345. package/dist/diagram-core/middleware-manager/middlewares/z-index-assignment/utils/initialize-z-index.mjs +30 -0
  346. package/dist/diagram-core/middleware-manager/middlewares/z-index-assignment/utils/sort-children.mjs +36 -0
  347. package/dist/diagram-core/middleware-manager/middlewares/z-index-assignment/z-index-assignment.mjs +240 -0
  348. package/dist/diagram-core/middleware-manager/pass-settlement.mjs +68 -0
  349. package/dist/diagram-core/model-lookup/model-lookup.mjs +394 -0
  350. package/dist/diagram-core/port-batch-processor/port-batch-processor.mjs +20 -0
  351. package/dist/diagram-core/render-strategy/base-render-strategy.mjs +26 -0
  352. package/dist/diagram-core/render-strategy/direct/direct-render-strategy.mjs +33 -0
  353. package/dist/diagram-core/render-strategy/render-performance-logger.mjs +42 -0
  354. package/dist/diagram-core/render-strategy/virtualized/idle-render-scheduler.mjs +43 -0
  355. package/dist/diagram-core/render-strategy/virtualized/result-cache.mjs +63 -0
  356. package/dist/diagram-core/render-strategy/virtualized/viewport-utils.mjs +40 -0
  357. package/dist/diagram-core/render-strategy/virtualized/virtualized-render-strategy.mjs +91 -0
  358. package/dist/diagram-core/render-strategy/virtualized/visible-elements-resolver.mjs +120 -0
  359. package/dist/diagram-core/render-strategy/virtualized/zoom-tracker.mjs +38 -0
  360. package/dist/diagram-core/set.polyfill.mjs +24 -0
  361. package/dist/diagram-core/shortcut-manager/default-shortcuts.mjs +99 -0
  362. package/dist/diagram-core/shortcut-manager/shortcut-manager.mjs +140 -0
  363. package/dist/diagram-core/spatial-hash/collision-detection.mjs +74 -0
  364. package/dist/diagram-core/spatial-hash/spatial-hash.mjs +161 -0
  365. package/dist/diagram-core/spatial-hash/utils.mjs +92 -0
  366. package/dist/diagram-core/transaction-manager/transaction-context.mjs +40 -0
  367. package/dist/diagram-core/transaction-manager/transaction-manager.mjs +94 -0
  368. package/dist/diagram-core/transaction-manager/transaction.mjs +179 -0
  369. package/dist/diagram-core/types/edge.interface.mjs +3 -0
  370. package/dist/diagram-core/types/node.interface.mjs +3 -0
  371. package/dist/diagram-core/types/utils.mjs +3 -0
  372. package/dist/diagram-core/updater/init-updater/init-state.mjs +356 -0
  373. package/dist/diagram-core/updater/init-updater/init-updater.mjs +275 -0
  374. package/dist/diagram-core/updater/init-updater/late-arrival-queue.mjs +71 -0
  375. package/dist/diagram-core/updater/init-updater/stability-detector.mjs +63 -0
  376. package/dist/diagram-core/updater/internal-updater/internal-updater.mjs +166 -0
  377. package/dist/diagram-core/utils/change-generation.mjs +13 -0
  378. package/dist/diagram-core/utils/compute-floating-edge-side.mjs +35 -0
  379. package/dist/diagram-core/utils/constants.mjs +3 -0
  380. package/dist/diagram-core/utils/dangling-edges.mjs +89 -0
  381. package/dist/diagram-core/utils/deep-merge.mjs +22 -0
  382. package/dist/diagram-core/utils/dimensions.mjs +52 -0
  383. package/dist/diagram-core/utils/get-node-border-intersection.mjs +99 -0
  384. package/dist/diagram-core/utils/get-port-flow-position.mjs +55 -0
  385. package/dist/diagram-core/utils/group-size.mjs +32 -0
  386. package/dist/diagram-core/utils/is-group.mjs +5 -0
  387. package/dist/diagram-core/utils/measurement-validation.mjs +11 -0
  388. package/dist/diagram-core/utils/object-properties.mjs +22 -0
  389. package/dist/diagram-core/utils/rects-points-sizes.mjs +148 -0
  390. package/dist/diagram-core/utils/relinking.mjs +6 -0
  391. package/dist/diagram-core/utils/semaphore.mjs +43 -0
  392. package/dist/diagram-core/utils/snap-node-position.mjs +11 -0
  393. package/dist/diagram-core/utils/sort-nodes-by-z-index.mjs +22 -0
  394. package/dist/diagram-core/visibility/effective-visibility.mjs +28 -0
  395. package/dist/diagram-core/visibility/template-visibility-registry.mjs +87 -0
  396. package/dist/index.d.mts +13296 -3667
  397. package/dist/index.d.ts +13296 -3667
  398. package/dist/index.mjs +34 -0
  399. package/dist/internal/content-size.mjs +14 -0
  400. package/dist/internal/custom-boolean-converter.mjs +18 -0
  401. package/dist/internal/flow-ui-rdf-element.mjs +57 -5
  402. package/dist/internal/form.mjs +1 -1
  403. package/dist/internal/on-off-converter.mjs +21 -0
  404. package/dist/package.json.mjs +1 -1
  405. package/dist/utilities/register-components.mjs +77 -142
  406. package/dist/vscode.html-custom-data.json +426 -156
  407. package/package.json +35 -40
  408. package/themes/dark.css +7 -5
  409. package/themes/dark.styles.js +7 -5
  410. package/themes/light.css +7 -5
  411. package/themes/light.styles.js +7 -5
@@ -0,0 +1,68 @@
1
+ class PassSettlement {
2
+ constructor(resolvePass, rejectPass) {
3
+ this.resolvePass = resolvePass;
4
+ this.rejectPass = rejectPass;
5
+ this.outcome = null;
6
+ this.suspended = [];
7
+ }
8
+ isSettled() {
9
+ return this.outcome !== null;
10
+ }
11
+ /** Registers a pending next() promise, resumed when the pass settles. */
12
+ suspend(resolver) {
13
+ this.suspended.push(resolver);
14
+ }
15
+ /**
16
+ * Settles the pass exactly once — resumes every suspended caller and settles
17
+ * the pass promise. A late 'failed' outcome is reported as a stray error;
18
+ * other late outcomes are no-ops.
19
+ */
20
+ settle(outcome) {
21
+ if (this.outcome !== null) {
22
+ if (outcome.kind === "failed") {
23
+ this.reportStrayError(outcome.error);
24
+ }
25
+ return;
26
+ }
27
+ this.outcome = outcome;
28
+ switch (outcome.kind) {
29
+ case "completed":
30
+ this.resolvePass(outcome.state);
31
+ this.drain((resolver) => resolver.resolve(outcome.state));
32
+ break;
33
+ case "cancelled":
34
+ this.drain((resolver) => resolver.resolve(outcome.state));
35
+ this.resolvePass(void 0);
36
+ break;
37
+ case "failed":
38
+ this.drain((resolver) => resolver.reject(outcome.error));
39
+ this.rejectPass(outcome.error);
40
+ break;
41
+ }
42
+ }
43
+ /** The result a late next() call returns after the pass has settled. */
44
+ lateNextResult() {
45
+ const outcome = this.outcome;
46
+ if (outcome === null) {
47
+ throw new Error("lateNextResult() requires a settled pass");
48
+ }
49
+ return outcome.kind === "failed" ? Promise.reject(outcome.error) : Promise.resolve(outcome.state);
50
+ }
51
+ /**
52
+ * Reports any error the pass rejection does not already carry — only cascade
53
+ * rethrows of the already-reported pass error stay silent.
54
+ */
55
+ reportStrayError(error) {
56
+ if (this.outcome?.kind === "failed" && error === this.outcome.error) {
57
+ return;
58
+ }
59
+ console.error("[ngDiagram]", error);
60
+ }
61
+ drain(resume) {
62
+ while (this.suspended.length > 0) {
63
+ resume(this.suspended.pop());
64
+ }
65
+ }
66
+ }
67
+
68
+ export { PassSettlement };
@@ -0,0 +1,394 @@
1
+ import { isGroup } from '../utils/is-group.mjs';
2
+
3
+ const MODEL_INTEGRITY_MISSING_PARENT_ERROR = (nodeId, parentId) => `[ngDiagram] Model integrity error: Node references non-existent parent.
4
+
5
+ Node ID: ${nodeId}
6
+ Parent ID: ${parentId}
7
+
8
+ This indicates corrupted model data. The group hierarchy will be incomplete.
9
+
10
+ Documentation: https://www.ngdiagram.dev/docs/guides/nodes/groups/`;
11
+ const MODEL_INTEGRITY_INVALID_PARENT_ERROR = (nodeId, parentId, parentType) => `[ngDiagram] Model integrity error: Node's parent is not a group.
12
+
13
+ Node ID: ${nodeId}
14
+ Parent ID: ${parentId}
15
+ Parent type: ${parentType}
16
+
17
+ This indicates incorrect model structure. The group hierarchy will be incomplete.
18
+
19
+ Documentation: https://www.ngdiagram.dev/docs/guides/nodes/groups/`;
20
+ class ModelLookup {
21
+ constructor(flowCore) {
22
+ this.flowCore = flowCore;
23
+ this._nodesMap = { map: /* @__PURE__ */ new Map(), synchronized: false };
24
+ this._edgesMap = { map: /* @__PURE__ */ new Map(), synchronized: false };
25
+ this._directChildrenMap = { map: /* @__PURE__ */ new Map(), synchronized: false };
26
+ this._descendantsCache = { map: /* @__PURE__ */ new Map(), synchronized: false };
27
+ // Cache for all descendants
28
+ this._connectedEdgesMap = { map: /* @__PURE__ */ new Map(), synchronized: false };
29
+ this._danglingEdges = { edges: [], synchronized: false };
30
+ }
31
+ /**
32
+ * Desynchronizes the model lookup
33
+ */
34
+ desynchronize() {
35
+ this._nodesMap.synchronized = false;
36
+ this._edgesMap.synchronized = false;
37
+ this._directChildrenMap.synchronized = false;
38
+ this._descendantsCache.synchronized = false;
39
+ this._connectedEdgesMap.synchronized = false;
40
+ this._danglingEdges.synchronized = false;
41
+ }
42
+ /**
43
+ * Gets the nodes map if it is not synchronized synchronize it
44
+ * @returns Nodes map
45
+ */
46
+ get nodesMap() {
47
+ if (!this._nodesMap.synchronized) {
48
+ this._nodesMap = {
49
+ map: new Map(this.flowCore.getState().nodes.map((node) => [node.id, node])),
50
+ synchronized: true
51
+ };
52
+ }
53
+ return this._nodesMap.map;
54
+ }
55
+ /**
56
+ * Gets the edges map if it is not synchronized synchronize it
57
+ * @returns Edges map
58
+ */
59
+ get edgesMap() {
60
+ if (!this._edgesMap.synchronized) {
61
+ this._edgesMap = {
62
+ map: new Map(this.flowCore.getState().edges.map((edge) => [edge.id, edge])),
63
+ synchronized: true
64
+ };
65
+ }
66
+ return this._edgesMap.map;
67
+ }
68
+ /**
69
+ * Gets the direct children map if it is not synchronized synchronize it
70
+ * @returns Direct children map
71
+ */
72
+ get directChildrenMap() {
73
+ if (!this._directChildrenMap.synchronized) {
74
+ this._directChildrenMap = {
75
+ map: this.buildDirectChildrenMap(this.flowCore.getState().nodes),
76
+ synchronized: true
77
+ };
78
+ }
79
+ return this._directChildrenMap.map;
80
+ }
81
+ /**
82
+ * Gets the connected edges map if it is not synchronized synchronize it
83
+ * @returns Connected edges map
84
+ */
85
+ get connectedEdgesMap() {
86
+ if (!this._connectedEdgesMap.synchronized) {
87
+ this._connectedEdgesMap = {
88
+ map: this.buildConnectedEdgesMap(this.flowCore.getState().edges),
89
+ synchronized: true
90
+ };
91
+ }
92
+ return this._connectedEdgesMap.map;
93
+ }
94
+ /**
95
+ * Committed edges with at least one free (unconnected) endpoint. Rebuilt
96
+ * lazily after a state change with one pass over all edges (the same profile
97
+ * as {@link connectedEdgesMap}), then served from cache until the next
98
+ * change, so consumers iterate only the dangling subset.
99
+ * @returns Dangling edges array
100
+ */
101
+ get danglingEdges() {
102
+ if (!this._danglingEdges.synchronized) {
103
+ this._danglingEdges = {
104
+ edges: this.flowCore.getState().edges.filter((edge) => !edge.source || !edge.target),
105
+ synchronized: true
106
+ };
107
+ }
108
+ return this._danglingEdges.edges;
109
+ }
110
+ /**
111
+ * Gets the descendants cache if it is not synchronized synchronize it
112
+ * @returns Descendants cache
113
+ */
114
+ get descendantsCache() {
115
+ if (!this._descendantsCache.synchronized) {
116
+ this._descendantsCache = { map: /* @__PURE__ */ new Map(), synchronized: true };
117
+ }
118
+ return this._descendantsCache.map;
119
+ }
120
+ /**
121
+ * Builds a map of group nodes to their children
122
+ * @param nodes Nodes array
123
+ * @returns Map where key is group id and value is array of child ids
124
+ */
125
+ buildDirectChildrenMap(nodes) {
126
+ const childrenMap = /* @__PURE__ */ new Map();
127
+ for (const node of nodes) {
128
+ if (node.groupId) {
129
+ const children = childrenMap.get(node.groupId) || [];
130
+ children.push(node.id);
131
+ childrenMap.set(node.groupId, children);
132
+ }
133
+ }
134
+ return childrenMap;
135
+ }
136
+ /**
137
+ * Builds a map of nodes to their connected edges
138
+ * @param edges Edges array
139
+ * @returns Map where key is node id and value is array of connected edge ids
140
+ */
141
+ buildConnectedEdgesMap(edges) {
142
+ const connectedEdgesMap = /* @__PURE__ */ new Map();
143
+ for (const edge of edges) {
144
+ const sourceEdges = connectedEdgesMap.get(edge.source) || [];
145
+ sourceEdges.push(edge.id);
146
+ connectedEdgesMap.set(edge.source, sourceEdges);
147
+ const targetEdges = connectedEdgesMap.get(edge.target) || [];
148
+ targetEdges.push(edge.id);
149
+ connectedEdgesMap.set(edge.target, targetEdges);
150
+ }
151
+ return connectedEdgesMap;
152
+ }
153
+ /**
154
+ * Gets a node by id
155
+ * @param nodeId Node id
156
+ * @returns Node
157
+ */
158
+ getNodeById(nodeId) {
159
+ return this.nodesMap.get(nodeId) ?? null;
160
+ }
161
+ /**
162
+ * Gets an edge by id
163
+ * @param edgeId Edge id
164
+ * @returns Edge
165
+ */
166
+ getEdgeById(edgeId) {
167
+ return this.edgesMap.get(edgeId) ?? null;
168
+ }
169
+ /**
170
+ * Gets all edges connected to a node
171
+ * @param nodeId Node id
172
+ * @returns Array of edges where the node is either source or target
173
+ */
174
+ getConnectedEdges(nodeId) {
175
+ const edgeIds = this.connectedEdgesMap.get(nodeId) ?? [];
176
+ return edgeIds.map((id) => this.getEdgeById(id)).filter((edge) => edge !== null);
177
+ }
178
+ /**
179
+ * Gets all nodes connected to a node via edges
180
+ * @param nodeId Node id
181
+ * @returns Array of nodes connected to the given node
182
+ */
183
+ getConnectedNodes(nodeId) {
184
+ const edgeIds = this.connectedEdgesMap.get(nodeId) ?? [];
185
+ const connectedNodeIds = /* @__PURE__ */ new Set();
186
+ for (const edgeId of edgeIds) {
187
+ const edge = this.getEdgeById(edgeId);
188
+ if (edge) {
189
+ const otherNodeId = edge.source === nodeId ? edge.target : edge.source;
190
+ connectedNodeIds.add(otherNodeId);
191
+ }
192
+ }
193
+ return Array.from(connectedNodeIds).map((id) => this.getNodeById(id)).filter((node) => node !== null);
194
+ }
195
+ /**
196
+ * Gets the source and target nodes of an edge
197
+ * @param edgeId Edge id
198
+ * @returns Object containing source and target nodes, or null if edge doesn't exist
199
+ */
200
+ getNodeEnds(edgeId) {
201
+ const edge = this.getEdgeById(edgeId);
202
+ if (!edge) {
203
+ return null;
204
+ }
205
+ const source = this.getNodeById(edge.source);
206
+ const target = this.getNodeById(edge.target);
207
+ if (!source || !target) {
208
+ return null;
209
+ }
210
+ return { source, target };
211
+ }
212
+ /**
213
+ * Gets all children ids for a given group node id
214
+ * @param groupId group node id
215
+ * @returns Array of child node ids
216
+ */
217
+ getChildrenIds(groupId) {
218
+ return this.directChildrenMap.get(groupId) ?? [];
219
+ }
220
+ /**
221
+ * Gets all children nodes for a given group node id
222
+ * @param groupId group node id
223
+ * @returns Array of child nodes
224
+ */
225
+ getChildren(groupId) {
226
+ const childrenIds = this.getChildrenIds(groupId);
227
+ if (!childrenIds)
228
+ return [];
229
+ return childrenIds.map((id) => this.getNodeById(id)).filter((node) => node !== null);
230
+ }
231
+ /**
232
+ * Gets all descendant IDs for a given group node id (with caching)
233
+ * @param groupId group node id
234
+ * @returns Array of all descendant node ids (children, grandchildren, etc.)
235
+ */
236
+ getAllDescendantIds(groupId) {
237
+ if (this.descendantsCache.has(groupId)) {
238
+ return this.descendantsCache.get(groupId);
239
+ }
240
+ const descendants = this.computeAllDescendants(groupId);
241
+ this.descendantsCache.set(groupId, descendants);
242
+ return descendants;
243
+ }
244
+ /**
245
+ * Recursively computes all descendants for a given group node id
246
+ * @param groupId group node id
247
+ * @returns Array of all descendant node ids
248
+ */
249
+ computeAllDescendants(groupId) {
250
+ const directChildren = this.getChildrenIds(groupId);
251
+ if (!directChildren || directChildren.length === 0) {
252
+ return [];
253
+ }
254
+ const allDescendants = [...directChildren];
255
+ for (const childId of directChildren) {
256
+ const childDescendants = this.computeAllDescendants(childId);
257
+ allDescendants.push(...childDescendants);
258
+ }
259
+ return allDescendants;
260
+ }
261
+ /**
262
+ * Gets all descendant nodes for a given group node id
263
+ * @param groupId group node id
264
+ * @returns Array of all descendant nodes (children, grandchildren, etc.)
265
+ */
266
+ getAllDescendants(groupId) {
267
+ const descendantIds = this.getAllDescendantIds(groupId);
268
+ return descendantIds.map((id) => this.getNodeById(id)).filter((node) => node !== null);
269
+ }
270
+ /**
271
+ * Checks if a node has children
272
+ * @param nodeId Node id
273
+ * @returns True if the node has children
274
+ */
275
+ hasChildren(nodeId) {
276
+ return this.directChildrenMap.has(nodeId) && this.directChildrenMap.get(nodeId).length > 0;
277
+ }
278
+ /**
279
+ * Checks if a node has any descendants (children, grandchildren, etc.)
280
+ * @param nodeId Node id
281
+ * @returns True if the node has any descendants
282
+ */
283
+ hasDescendants(nodeId) {
284
+ return this.getAllDescendantIds(nodeId).length > 0;
285
+ }
286
+ /**
287
+ * Gets the children map (read-only access)
288
+ * @returns Children map
289
+ */
290
+ getChildrenMap() {
291
+ return this.directChildrenMap;
292
+ }
293
+ /**
294
+ * Gets all selected nodes
295
+ * @returns Array of directly selected nodes
296
+ */
297
+ getSelectedNodes() {
298
+ return this.flowCore.getState().nodes.filter((node) => node.selected);
299
+ }
300
+ /**
301
+ * Gets the children of a node
302
+ * @param nodeId Node id
303
+ * @param directOnly Whether to get only direct children
304
+ * @returns Array of children nodes
305
+ */
306
+ getNodeChildren(nodeId, { directOnly = true } = {}) {
307
+ return directOnly ? this.getChildren(nodeId) : this.getAllDescendants(nodeId);
308
+ }
309
+ /**
310
+ * Gets the children ids of a node
311
+ * @param nodeId Node id
312
+ * @param directOnly Whether to get only direct children
313
+ * @returns Array of children node ids
314
+ */
315
+ getNodeChildrenIds(nodeId, { directOnly = true } = {}) {
316
+ return directOnly ? this.getChildrenIds(nodeId) : this.getAllDescendantIds(nodeId);
317
+ }
318
+ /**
319
+ * Gets all selected nodes with their children
320
+ * @returns Array of selected nodes with their children
321
+ */
322
+ getSelectedNodesWithChildren({ directOnly = true } = {}) {
323
+ const selectedNodes = this.getSelectedNodes();
324
+ const allSelectedNodesIds = /* @__PURE__ */ new Set();
325
+ const allSelectedNodes = [];
326
+ for (const node of selectedNodes) {
327
+ if (allSelectedNodesIds.has(node.id))
328
+ continue;
329
+ allSelectedNodesIds.add(node.id);
330
+ allSelectedNodes.push(node);
331
+ const children = this.getNodeChildren(node.id, { directOnly });
332
+ for (const child of children) {
333
+ if (allSelectedNodesIds.has(child.id))
334
+ continue;
335
+ allSelectedNodesIds.add(child.id);
336
+ allSelectedNodes.push(child);
337
+ }
338
+ }
339
+ return allSelectedNodes;
340
+ }
341
+ /**
342
+ * Gets all selected edges
343
+ * @returns Array of selected edges
344
+ */
345
+ getSelectedEdges() {
346
+ return this.flowCore.getState().edges.filter((edge) => edge.selected);
347
+ }
348
+ /**
349
+ * Checks if a node is descendant of a group node
350
+ * @param nodeId Node id
351
+ * @param groupId Group node id
352
+ * @returns True if the node is descendant of the group node
353
+ */
354
+ isNodeDescendantOfGroup(nodeId, groupId) {
355
+ return this.getAllDescendantIds(groupId).includes(nodeId);
356
+ }
357
+ /**
358
+ * Check for potential circular dependency between a node and a group
359
+ * @param nodeId Node id
360
+ * @param groupId Group node id
361
+ * @returns True if the group is a descendant of the node or the node is the group
362
+ */
363
+ wouldCreateCircularDependency(nodeId, groupId) {
364
+ if (nodeId === groupId) {
365
+ return true;
366
+ }
367
+ return this.isNodeDescendantOfGroup(groupId, nodeId);
368
+ }
369
+ /**
370
+ * Gets the full chain of parent group Nodes for a given nodeId.
371
+ * @param nodeId Node id
372
+ * @returns Array of parent group Node objects, from closest parent to farthest ancestor
373
+ */
374
+ getParentChain(nodeId) {
375
+ const chain = [];
376
+ let current = this.getNodeById(nodeId);
377
+ while (current && current.groupId) {
378
+ const parent = this.getNodeById(current.groupId);
379
+ if (!parent) {
380
+ console.error(MODEL_INTEGRITY_MISSING_PARENT_ERROR(current.id, current.groupId));
381
+ return chain;
382
+ }
383
+ if (!isGroup(parent)) {
384
+ console.error(MODEL_INTEGRITY_INVALID_PARENT_ERROR(current.id, parent.id, parent.type || "unknown"));
385
+ return chain;
386
+ }
387
+ chain.push(parent);
388
+ current = parent;
389
+ }
390
+ return chain;
391
+ }
392
+ }
393
+
394
+ export { MODEL_INTEGRITY_INVALID_PARENT_ERROR, MODEL_INTEGRITY_MISSING_PARENT_ERROR, ModelLookup };
@@ -0,0 +1,20 @@
1
+ import { BatchProcessor } from '../batch-processor/batch-processor.mjs';
2
+ import { isValidSize, isValidPosition } from '../utils/measurement-validation.mjs';
3
+
4
+ const toPortUpdates = (ports) => ports.map(({ id, size, position }) => ({ portId: id, portChanges: { size, position } }));
5
+ class PortBatchProcessor extends BatchProcessor {
6
+ constructor(getNodeById) {
7
+ super((nodeId) => {
8
+ const ports = getNodeById(nodeId)?.measuredPorts ?? [];
9
+ const measured = /* @__PURE__ */ new Set();
10
+ for (const port of ports) {
11
+ if (isValidSize(port.size) && isValidPosition(port.position)) {
12
+ measured.add(port.id);
13
+ }
14
+ }
15
+ return measured;
16
+ });
17
+ }
18
+ }
19
+
20
+ export { PortBatchProcessor, toPortUpdates };
@@ -0,0 +1,26 @@
1
+ import { RenderPerformanceLogger } from './render-performance-logger.mjs';
2
+
3
+ class BaseRenderStrategy {
4
+ constructor(flowCore) {
5
+ this.flowCore = flowCore;
6
+ this.performanceLogger = new RenderPerformanceLogger();
7
+ }
8
+ render() {
9
+ const { nodes, edges, metadata } = this.flowCore.getState();
10
+ const linking = this.flowCore.actionStateManager.linking;
11
+ const temporaryEdge = linking?.temporaryEdge;
12
+ const { nodes: visibleNodes, edges: processedEdges } = this.process(nodes, edges, metadata.viewport);
13
+ const relinkedEdgeId = linking?.relink?.edgeId;
14
+ const visibleEdges = relinkedEdgeId ? processedEdges.filter((edge) => edge.id !== relinkedEdgeId) : processedEdges;
15
+ const anchoredEndNodeId = linking?.relink?.end === "source" ? temporaryEdge?.target : temporaryEdge?.source;
16
+ const isTemporaryEdgeVisible = temporaryEdge?.temporary && !(anchoredEndNodeId && this.flowCore.getNodeById(anchoredEndNodeId)?.computedHidden);
17
+ const finalEdges = isTemporaryEdgeVisible ? [...visibleEdges, temporaryEdge] : visibleEdges;
18
+ this.performanceLogger.withPerformanceLogging(
19
+ () => this.flowCore.renderer.draw(visibleNodes, finalEdges, metadata.viewport),
20
+ visibleNodes,
21
+ this.flowCore.config.debugMode
22
+ );
23
+ }
24
+ }
25
+
26
+ export { BaseRenderStrategy };
@@ -0,0 +1,33 @@
1
+ import { BaseRenderStrategy } from '../base-render-strategy.mjs';
2
+
3
+ const EMPTY_SET = /* @__PURE__ */ new Set();
4
+ class DirectRenderStrategy extends BaseRenderStrategy {
5
+ constructor(flowCore) {
6
+ super(flowCore);
7
+ }
8
+ init() {
9
+ this.render();
10
+ this.flowCore.model.onChange((state) => {
11
+ this.flowCore.spatialHash.process(state.nodes);
12
+ this.flowCore.modelLookup.desynchronize();
13
+ this.render();
14
+ });
15
+ const nodes = this.flowCore.model.getNodes();
16
+ const edges = this.flowCore.model.getEdges();
17
+ this.flowCore.initUpdater.start(nodes, edges, async () => {
18
+ await this.flowCore.commandHandler.emit("init", {
19
+ renderedNodeIds: nodes.map((n) => n.id),
20
+ renderedEdgeIds: edges.map((e) => e.id)
21
+ });
22
+ });
23
+ }
24
+ process(nodes, edges) {
25
+ return { nodes, edges, nodeIds: EMPTY_SET, edgeIds: EMPTY_SET };
26
+ }
27
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
28
+ isNodeRendered(_nodeId) {
29
+ return true;
30
+ }
31
+ }
32
+
33
+ export { DirectRenderStrategy };
@@ -0,0 +1,42 @@
1
+ class RenderPerformanceLogger {
2
+ constructor() {
3
+ this.lastVisibleNodeIds = null;
4
+ }
5
+ withPerformanceLogging(drawFn, nodes, enabled) {
6
+ if (!enabled) {
7
+ drawFn();
8
+ return;
9
+ }
10
+ const { added, removed, total } = this.calculateNodeDiff(nodes);
11
+ const shouldLog = added > 0 || removed > 0;
12
+ const startTime = performance.now();
13
+ drawFn();
14
+ if (shouldLog) {
15
+ requestAnimationFrame(() => {
16
+ requestAnimationFrame(() => {
17
+ console.log(
18
+ `[ngDiagram] Render: +${added} -${removed} nodes (total: ${total}): ${(performance.now() - startTime).toFixed(2)}ms`
19
+ );
20
+ });
21
+ });
22
+ }
23
+ }
24
+ calculateNodeDiff(nodes) {
25
+ const currentNodeIds = new Set(nodes.map((n) => n.id));
26
+ const prevNodeIds = this.lastVisibleNodeIds ?? /* @__PURE__ */ new Set();
27
+ let added = 0;
28
+ let removed = 0;
29
+ for (const id of currentNodeIds) {
30
+ if (!prevNodeIds.has(id))
31
+ added++;
32
+ }
33
+ for (const id of prevNodeIds) {
34
+ if (!currentNodeIds.has(id))
35
+ removed++;
36
+ }
37
+ this.lastVisibleNodeIds = currentNodeIds;
38
+ return { added, removed, total: currentNodeIds.size };
39
+ }
40
+ }
41
+
42
+ export { RenderPerformanceLogger };
@@ -0,0 +1,43 @@
1
+ class IdleRenderScheduler {
2
+ constructor(flowCore, onIdle) {
3
+ this.flowCore = flowCore;
4
+ this.onIdle = onIdle;
5
+ this.wasPanning = false;
6
+ this.idleTimeout = null;
7
+ this.unsubscribeActionState = null;
8
+ }
9
+ init() {
10
+ this.unsubscribeActionState = this.flowCore.eventManager.on("actionStateChanged", ({ actionState }) => {
11
+ const isPanning = !!actionState.panning?.active;
12
+ if (this.wasPanning && !isPanning) {
13
+ this.scheduleIdleRender();
14
+ } else if (isPanning && this.idleTimeout) {
15
+ clearTimeout(this.idleTimeout);
16
+ this.idleTimeout = null;
17
+ }
18
+ this.wasPanning = isPanning;
19
+ });
20
+ }
21
+ scheduleIdleRender() {
22
+ if (this.idleTimeout) {
23
+ clearTimeout(this.idleTimeout);
24
+ }
25
+ const delay = this.flowCore.config.virtualization.idleDelay ?? 100;
26
+ this.idleTimeout = setTimeout(() => {
27
+ this.onIdle();
28
+ this.idleTimeout = null;
29
+ }, delay);
30
+ }
31
+ destroy() {
32
+ if (this.idleTimeout) {
33
+ clearTimeout(this.idleTimeout);
34
+ this.idleTimeout = null;
35
+ }
36
+ if (this.unsubscribeActionState) {
37
+ this.unsubscribeActionState();
38
+ this.unsubscribeActionState = null;
39
+ }
40
+ }
41
+ }
42
+
43
+ export { IdleRenderScheduler };
@@ -0,0 +1,63 @@
1
+ import { isViewportSimilar, hasMovedTooFar } from './viewport-utils.mjs';
2
+
3
+ class ResultCache {
4
+ constructor() {
5
+ this.cachedResult = null;
6
+ this.lastViewportRect = null;
7
+ this.lastNodesLength = 0;
8
+ this.lastEdgesLength = 0;
9
+ }
10
+ hasCache() {
11
+ return this.cachedResult !== null;
12
+ }
13
+ isNodeInCache(nodeId) {
14
+ return this.cachedResult?.nodeIds.has(nodeId) ?? false;
15
+ }
16
+ /**
17
+ * Returns cached result by filtering from current arrays using cached IDs.
18
+ * Always creates fresh filtered arrays to ensure consistency with rendered content.
19
+ */
20
+ get(nodes, edges) {
21
+ const cached = this.cachedResult;
22
+ const filteredNodes = nodes.filter((n) => cached.nodeIds.has(n.id));
23
+ const filteredEdges = edges.filter((e) => cached.edgeIds.has(e.id));
24
+ return {
25
+ nodes: filteredNodes,
26
+ edges: filteredEdges,
27
+ nodeIds: cached.nodeIds,
28
+ edgeIds: cached.edgeIds
29
+ };
30
+ }
31
+ set(result, nodes, edges, viewportRect) {
32
+ this.cachedResult = result;
33
+ this.lastViewportRect = viewportRect;
34
+ this.lastNodesLength = nodes.length;
35
+ this.lastEdgesLength = edges.length;
36
+ }
37
+ canUse(nodesLength, edgesLength, viewportRect) {
38
+ if (!this.cachedResult || !this.lastViewportRect) {
39
+ return false;
40
+ }
41
+ if (nodesLength !== this.lastNodesLength || edgesLength !== this.lastEdgesLength) {
42
+ return false;
43
+ }
44
+ return isViewportSimilar(this.lastViewportRect, viewportRect);
45
+ }
46
+ hasMovedTooFar(viewportRect) {
47
+ if (!this.lastViewportRect) {
48
+ return true;
49
+ }
50
+ return hasMovedTooFar(viewportRect, this.lastViewportRect);
51
+ }
52
+ invalidateViewport() {
53
+ this.lastViewportRect = null;
54
+ }
55
+ invalidate() {
56
+ this.cachedResult = null;
57
+ this.lastViewportRect = null;
58
+ this.lastNodesLength = 0;
59
+ this.lastEdgesLength = 0;
60
+ }
61
+ }
62
+
63
+ export { ResultCache };