@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,147 @@
1
+ import { nothing } from 'lit';
2
+ import { directive, AsyncDirective, PartType } from 'lit/async-directive.js';
3
+ import { ContextRequestEvent } from './context.mjs';
4
+ import { diagramRuntimeContext, diagramNodeContext, diagramEdgeContext } from './contexts.mjs';
5
+ import { isCurrentModelItem } from './model-owner.mjs';
6
+
7
+ const OUTSIDE_TEMPLATE_WARNING = "[flow-ui-diagram] diagramHidden() must be used inside a node or edge template; the binding is ignored.";
8
+ const VIRTUALIZATION_WARNING = "[flow-ui-diagram] diagramHidden() is not supported with virtualization enabled and is ignored: a hidden element is removed from the virtualized render set, which removes the template declaring it. Use the model `hidden` flag instead.";
9
+ const internalIdOf = (item) => item._internalId;
10
+ const toHidden = (value) => typeof value === "boolean" ? value : value != null && value !== "false";
11
+ function requestContext(element, context) {
12
+ let value;
13
+ element.dispatchEvent(new ContextRequestEvent(context, element, (provided) => value = provided));
14
+ return value;
15
+ }
16
+ class DiagramHiddenDirective extends AsyncDirective {
17
+ constructor(partInfo) {
18
+ super(partInfo);
19
+ this.hidden = false;
20
+ this.contextsResolved = false;
21
+ this.applyScheduled = false;
22
+ this.warnedVirtualization = false;
23
+ this.warnedOutsideTemplate = false;
24
+ if (partInfo.type !== PartType.ELEMENT) {
25
+ throw new Error("diagramHidden() can only be used in an element binding, such as <div ${\u2026}>.");
26
+ }
27
+ }
28
+ render(_hidden) {
29
+ return nothing;
30
+ }
31
+ update(part, args) {
32
+ this.element = part.element;
33
+ this.hidden = args.length === 0 || toHidden(args[0]);
34
+ this.scheduleApply();
35
+ return nothing;
36
+ }
37
+ reconnected() {
38
+ this.scheduleApply();
39
+ }
40
+ /** ngDiagram's `ngOnDestroy`: clears this template's declaration, unless the element is gone or replaced. */
41
+ disconnected() {
42
+ const declaration = this.declaration;
43
+ const runtime = this.runtime;
44
+ this.declaration = void 0;
45
+ this.contextsResolved = false;
46
+ this.ownerSubscription?.();
47
+ this.ownerSubscription = void 0;
48
+ if (!declaration || !runtime) {
49
+ return;
50
+ }
51
+ const { flowCore, kind, id } = declaration;
52
+ if (flowCore !== runtime.flowCore.value || !flowCore.isInitialized || flowCore.isVirtualizationActive) {
53
+ return;
54
+ }
55
+ const current = kind === "node" ? flowCore.getNodeById(id) : flowCore.getEdgeById(id);
56
+ if (!current || this.ownerInternalId !== void 0 && internalIdOf(current) !== this.ownerInternalId) {
57
+ return;
58
+ }
59
+ this.write(flowCore, kind, id, false);
60
+ }
61
+ // The element is not in the document yet on the first render (Lit commits a template before inserting it), so
62
+ // the contexts can only be requested a moment later. The engine coalesces registry writes per microtask anyway.
63
+ scheduleApply() {
64
+ if (this.applyScheduled) {
65
+ return;
66
+ }
67
+ this.applyScheduled = true;
68
+ queueMicrotask(() => {
69
+ this.applyScheduled = false;
70
+ this.apply();
71
+ });
72
+ }
73
+ apply() {
74
+ const element = this.element;
75
+ if (!this.isConnected || !element?.isConnected) {
76
+ return;
77
+ }
78
+ this.resolveContexts(element);
79
+ const flowCore = this.runtime?.flowCore.value;
80
+ if (!flowCore) {
81
+ return;
82
+ }
83
+ if (flowCore.isVirtualizationActive) {
84
+ if (!this.warnedVirtualization) {
85
+ this.warnedVirtualization = true;
86
+ console.warn(VIRTUALIZATION_WARNING);
87
+ }
88
+ return;
89
+ }
90
+ const owner = this.resolveOwner();
91
+ if (!owner) {
92
+ const ownerContext = this.nodeContext?.node ?? this.edgeContext?.edge;
93
+ if (ownerContext) {
94
+ this.ownerSubscription ?? (this.ownerSubscription = ownerContext.subscribe(() => {
95
+ this.ownerSubscription?.();
96
+ this.ownerSubscription = void 0;
97
+ this.scheduleApply();
98
+ }));
99
+ return;
100
+ }
101
+ if (!this.warnedOutsideTemplate) {
102
+ this.warnedOutsideTemplate = true;
103
+ console.warn(OUTSIDE_TEMPLATE_WARNING);
104
+ }
105
+ return;
106
+ }
107
+ if (!isCurrentModelItem(flowCore, owner.kind, owner.item)) {
108
+ return;
109
+ }
110
+ if (this.ownerInternalId === void 0) {
111
+ this.ownerInternalId = internalIdOf(owner.item);
112
+ }
113
+ this.write(flowCore, owner.kind, owner.item.id, this.hidden);
114
+ }
115
+ resolveContexts(element) {
116
+ if (this.contextsResolved) {
117
+ return;
118
+ }
119
+ this.contextsResolved = true;
120
+ this.runtime = requestContext(element, diagramRuntimeContext);
121
+ this.nodeContext = requestContext(element, diagramNodeContext);
122
+ this.edgeContext = this.nodeContext ? void 0 : requestContext(element, diagramEdgeContext);
123
+ }
124
+ resolveOwner() {
125
+ const node = this.nodeContext?.node.value;
126
+ if (node) {
127
+ return { kind: "node", item: node };
128
+ }
129
+ const edge = this.edgeContext?.edge.value;
130
+ if (edge && !edge.temporary) {
131
+ return { kind: "edge", item: edge };
132
+ }
133
+ return null;
134
+ }
135
+ write(flowCore, kind, id, hidden) {
136
+ const registry = flowCore.templateVisibilityRegistry;
137
+ if (kind === "node") {
138
+ registry.setNodeHidden(id, hidden);
139
+ } else {
140
+ registry.setEdgeHidden(id, hidden);
141
+ }
142
+ this.declaration = { flowCore, kind, id };
143
+ }
144
+ }
145
+ const diagramHidden = directive(DiagramHiddenDirective);
146
+
147
+ export { diagramHidden };
@@ -0,0 +1,33 @@
1
+ import { Observable, batch } from './observable.mjs';
2
+
3
+ const initialViewport = () => ({ x: 0, y: 0, scale: 1 });
4
+ const sameItems = (a, b) => a === b || a.length === b.length && a.every((item, index) => item === b[index]);
5
+ class LitRenderer {
6
+ constructor() {
7
+ this._nodes = new Observable([], { equals: sameItems });
8
+ this._edges = new Observable([], { equals: sameItems });
9
+ this._viewport = new Observable(initialViewport());
10
+ /** The nodes to render, after virtualization and visibility filtering. */
11
+ this.nodes = this._nodes.asReadonly();
12
+ /** The edges to render, including the temporary edge while linking. */
13
+ this.edges = this._edges.asReadonly();
14
+ this.viewport = this._viewport.asReadonly();
15
+ }
16
+ draw(nodes, edges, viewport) {
17
+ batch(() => {
18
+ this._nodes.set(nodes);
19
+ this._edges.set(edges);
20
+ this._viewport.set(viewport);
21
+ });
22
+ }
23
+ /** Clears everything, for when the diagram's FlowCore is destroyed. */
24
+ reset() {
25
+ batch(() => {
26
+ this._nodes.set([]);
27
+ this._edges.set([]);
28
+ this._viewport.set(initialViewport());
29
+ });
30
+ }
31
+ }
32
+
33
+ export { LitRenderer };
@@ -0,0 +1,108 @@
1
+ import { Observable } from './observable.mjs';
2
+
3
+ const DIAGRAM_ARROW_MARKER_ID = "flow-ui-diagram-arrow";
4
+ const CORE_DEFAULT_ARROW_MARKER_ID = "ng-diagram-arrow";
5
+ const SVG_NS = "http://www.w3.org/2000/svg";
6
+ function supportsContextStroke() {
7
+ if (typeof CSS === "undefined" || typeof CSS.supports !== "function") {
8
+ return true;
9
+ }
10
+ return CSS.supports("stroke", "context-stroke");
11
+ }
12
+ function createArrowMarker(id) {
13
+ const marker = document.createElementNS(SVG_NS, "marker");
14
+ const attributes = {
15
+ id,
16
+ viewBox: "0 9 8 14",
17
+ refX: "6",
18
+ refY: "16",
19
+ markerWidth: "4",
20
+ markerHeight: "7",
21
+ orient: "auto-start-reverse"
22
+ };
23
+ Object.entries(attributes).forEach(([name, value]) => marker.setAttribute(name, value));
24
+ const path = document.createElementNS(SVG_NS, "path");
25
+ const pathAttributes = {
26
+ d: "M1 21L6 16L1 11",
27
+ stroke: "context-stroke",
28
+ fill: "none",
29
+ "stroke-width": "2",
30
+ "stroke-linecap": "round",
31
+ "stroke-linejoin": "round"
32
+ };
33
+ Object.entries(pathAttributes).forEach(([name, value]) => path.setAttribute(name, value));
34
+ marker.appendChild(path);
35
+ return marker;
36
+ }
37
+ class DiagramMarkerRegistry {
38
+ constructor() {
39
+ /** Whether cloned markers keep `context-stroke` / `context-fill` (false in Safari). */
40
+ this.supportsContextStroke = supportsContextStroke();
41
+ this.builtIns = /* @__PURE__ */ new Map();
42
+ this._markers = new Observable(/* @__PURE__ */ new Map());
43
+ /** The registered markers by id, built-ins included. A new map on every change, so edges re-render. */
44
+ this.markers = this._markers.asReadonly();
45
+ if (typeof document !== "undefined") {
46
+ this.builtIns.set(DIAGRAM_ARROW_MARKER_ID, createArrowMarker(DIAGRAM_ARROW_MARKER_ID));
47
+ this.builtIns.set(CORE_DEFAULT_ARROW_MARKER_ID, createArrowMarker(CORE_DEFAULT_ARROW_MARKER_ID));
48
+ this._markers.set(new Map(this.builtIns));
49
+ }
50
+ }
51
+ /** Registers (or replaces) the marker with this id. */
52
+ register(id, element) {
53
+ if (this._markers.value.get(id) === element) {
54
+ return;
55
+ }
56
+ this._markers.update((markers) => new Map(markers).set(id, element));
57
+ }
58
+ /**
59
+ * Unregisters the marker with this id. With `element`, only when that element is the one registered, so a
60
+ * marker that was replaced does not remove its replacement. A built-in marker with the same id comes back.
61
+ */
62
+ unregister(id, element) {
63
+ const current = this._markers.value.get(id);
64
+ if (!current || element && current !== element || current === this.builtIns.get(id)) {
65
+ return;
66
+ }
67
+ this._markers.update((markers) => {
68
+ const next = new Map(markers);
69
+ const builtIn = this.builtIns.get(id);
70
+ if (builtIn) {
71
+ next.set(id, builtIn);
72
+ } else {
73
+ next.delete(id);
74
+ }
75
+ return next;
76
+ });
77
+ }
78
+ has(id) {
79
+ return this._markers.value.has(id);
80
+ }
81
+ /** A deep copy of the marker with the id `newId`, or `null` when no marker has the id `markerId`. */
82
+ clone(markerId, newId) {
83
+ const element = this._markers.value.get(markerId);
84
+ if (!element) {
85
+ return null;
86
+ }
87
+ const clone = element.cloneNode(true);
88
+ clone.id = newId;
89
+ if (!this.supportsContextStroke) {
90
+ replaceContextColors(clone);
91
+ }
92
+ return clone;
93
+ }
94
+ }
95
+ function replaceContextColors(element) {
96
+ if (element.getAttribute("stroke") === "context-stroke") {
97
+ element.setAttribute("stroke", "currentColor");
98
+ }
99
+ const fill = element.getAttribute("fill");
100
+ if (fill === "context-fill" || fill === "context-stroke") {
101
+ element.setAttribute("fill", "currentColor");
102
+ }
103
+ for (const child of Array.from(element.children)) {
104
+ replaceContextColors(child);
105
+ }
106
+ }
107
+
108
+ export { DIAGRAM_ARROW_MARKER_ID, DiagramMarkerRegistry };
@@ -0,0 +1,14 @@
1
+ import { internalIdMiddleware } from '../../diagram-core/middleware-manager/middlewares/internal-id-assignment/internal-id-assignment.mjs';
2
+ import { zIndexMiddleware } from '../../diagram-core/middleware-manager/middlewares/z-index-assignment/z-index-assignment.mjs';
3
+ import { edgesRoutingMiddleware } from '../../diagram-core/middleware-manager/middlewares/edges-routing/edges-routing.mjs';
4
+
5
+ const BUILTIN_MIDDLEWARES = [
6
+ internalIdMiddleware,
7
+ zIndexMiddleware,
8
+ edgesRoutingMiddleware
9
+ ];
10
+ function createMiddlewares(middlewares) {
11
+ return middlewares(BUILTIN_MIDDLEWARES);
12
+ }
13
+
14
+ export { BUILTIN_MIDDLEWARES, createMiddlewares };
@@ -0,0 +1,11 @@
1
+ function isCurrentModelItem(flowCore, kind, item) {
2
+ const current = kind === "node" ? flowCore.getNodeById(item.id) : flowCore.getEdgeById(item.id);
3
+ if (!current) {
4
+ return false;
5
+ }
6
+ const ownerId = item._internalId;
7
+ const currentId = current._internalId;
8
+ return ownerId === void 0 || currentId === void 0 || ownerId === currentId;
9
+ }
10
+
11
+ export { isCurrentModelItem };
@@ -0,0 +1,25 @@
1
+ import { nothing } from 'lit';
2
+ import { directive, Directive, PartType } from 'lit/directive.js';
3
+
4
+ const DIAGRAM_NODE_WRAPPER_CLASS = "flow-ui-diagram-node-wrapper";
5
+ const DIAGRAM_NODE_SELECTED_CLASS = "flow-ui-diagram-node-selected";
6
+ class DiagramNodeSelectedDirective extends Directive {
7
+ constructor(partInfo) {
8
+ super(partInfo);
9
+ if (partInfo.type !== PartType.ELEMENT) {
10
+ throw new Error("diagramNodeSelected() can only be used in an element binding, such as <div ${\u2026}>.");
11
+ }
12
+ }
13
+ render(_node) {
14
+ return nothing;
15
+ }
16
+ update(part, [node]) {
17
+ const classList = part.element.classList;
18
+ classList.add(DIAGRAM_NODE_WRAPPER_CLASS);
19
+ classList.toggle(DIAGRAM_NODE_SELECTED_CLASS, !!node?.selected);
20
+ return nothing;
21
+ }
22
+ }
23
+ const diagramNodeSelected = directive(DiagramNodeSelectedDirective);
24
+
25
+ export { DIAGRAM_NODE_SELECTED_CLASS, DIAGRAM_NODE_WRAPPER_CLASS, diagramNodeSelected };
@@ -0,0 +1,205 @@
1
+ let batchDepth = 0;
2
+ const pendingNotifications = /* @__PURE__ */ new Map();
3
+ function batch(fn) {
4
+ batchDepth++;
5
+ try {
6
+ return fn();
7
+ } finally {
8
+ batchDepth--;
9
+ if (batchDepth === 0) {
10
+ const pending = [...pendingNotifications];
11
+ pendingNotifications.clear();
12
+ for (const [observable, previous] of pending) {
13
+ observable.notifyAfterBatch(previous);
14
+ }
15
+ }
16
+ }
17
+ }
18
+ class Observable {
19
+ constructor(initialValue, options = {}) {
20
+ this.entries = /* @__PURE__ */ new Set();
21
+ this._value = initialValue;
22
+ this.equals = options.equals ?? Object.is;
23
+ }
24
+ get value() {
25
+ return this._value;
26
+ }
27
+ /** The number of active subscriptions. */
28
+ get subscriberCount() {
29
+ return this.entries.size;
30
+ }
31
+ /**
32
+ * Sets the value and notifies listeners if it changed.
33
+ *
34
+ * @returns Whether the value changed
35
+ */
36
+ set(value) {
37
+ const previous = this._value;
38
+ if (this.equals(previous, value)) {
39
+ return false;
40
+ }
41
+ this._value = value;
42
+ if (batchDepth > 0) {
43
+ if (!pendingNotifications.has(this)) {
44
+ pendingNotifications.set(this, previous);
45
+ }
46
+ } else {
47
+ this.notify(value, previous);
48
+ }
49
+ return true;
50
+ }
51
+ /** Sets the value from the current one. */
52
+ update(fn) {
53
+ return this.set(fn(this._value));
54
+ }
55
+ subscribe(listener) {
56
+ const entry = { listener };
57
+ this.entries.add(entry);
58
+ return () => {
59
+ this.entries.delete(entry);
60
+ };
61
+ }
62
+ /** A view without `set`, to hand to consumers. */
63
+ asReadonly() {
64
+ if (!this.readonlyView) {
65
+ const self = this;
66
+ this.readonlyView = {
67
+ get value() {
68
+ return self.value;
69
+ },
70
+ subscribe: (listener) => self.subscribe(listener)
71
+ };
72
+ }
73
+ return this.readonlyView;
74
+ }
75
+ /** @internal Called by {@link batch}. */
76
+ notifyAfterBatch(previous) {
77
+ if (!this.equals(previous, this._value)) {
78
+ this.notify(this._value, previous);
79
+ }
80
+ }
81
+ notify(value, previous) {
82
+ for (const entry of [...this.entries]) {
83
+ if (!this.entries.has(entry)) {
84
+ continue;
85
+ }
86
+ try {
87
+ entry.listener(value, previous);
88
+ } catch (error) {
89
+ console.error("[flow-ui-diagram] Observable listener threw an error.", error);
90
+ }
91
+ if (!Object.is(this._value, value)) {
92
+ return;
93
+ }
94
+ }
95
+ }
96
+ }
97
+ function derived(sources, project, options = {}) {
98
+ const equals = options.equals ?? Object.is;
99
+ let lastInputs;
100
+ let cached;
101
+ let sourceUnsubscribes = [];
102
+ let outputPrimed = false;
103
+ const output = new Observable(void 0, { equals: (a, b) => outputPrimed && equals(a, b) });
104
+ const readInputs = () => sources.map((source) => source.value);
105
+ const inputsChanged = (inputs) => !lastInputs || inputs.some((input, i) => !Object.is(input, lastInputs[i]));
106
+ const compute = () => {
107
+ const inputs = readInputs();
108
+ if (inputsChanged(inputs)) {
109
+ const first = !lastInputs;
110
+ lastInputs = inputs;
111
+ const next = project(...inputs);
112
+ if (first || !equals(cached, next)) {
113
+ cached = next;
114
+ }
115
+ }
116
+ return cached;
117
+ };
118
+ return {
119
+ get value() {
120
+ return compute();
121
+ },
122
+ subscribe(listener) {
123
+ if (output.subscriberCount === 0) {
124
+ output.set(compute());
125
+ outputPrimed = true;
126
+ sourceUnsubscribes = sources.map((source) => source.subscribe(() => output.set(compute())));
127
+ }
128
+ const unsubscribe = output.subscribe(listener);
129
+ return () => {
130
+ unsubscribe();
131
+ if (output.subscriberCount === 0) {
132
+ sourceUnsubscribes.forEach((fn) => fn());
133
+ sourceUnsubscribes = [];
134
+ }
135
+ };
136
+ }
137
+ };
138
+ }
139
+ class DiagramObserver {
140
+ /**
141
+ * Constructs a new `DiagramObserver` instance and adds it to `host`.
142
+ *
143
+ * @param host - Element to re-render.
144
+ * @param source - Observable to observe. If not specified, set it later with {@link DiagramObserver.setSource}.
145
+ * @param callback - Function called with each new value.
146
+ */
147
+ constructor(host, source, callback) {
148
+ this.host = host;
149
+ this.callback = callback;
150
+ this.connected = false;
151
+ this.hasSeen = false;
152
+ this.source = source;
153
+ host.addController(this);
154
+ }
155
+ /** The source's current value, or `undefined` without a source. */
156
+ get value() {
157
+ return this.source?.value;
158
+ }
159
+ /**
160
+ * Replaces the observed observable.
161
+ *
162
+ * @param source - Observable to observe, or `undefined` to stop observing.
163
+ */
164
+ setSource(source) {
165
+ if (source === this.source) {
166
+ return;
167
+ }
168
+ this.detach();
169
+ this.source = source;
170
+ if (this.connected) {
171
+ this.attach();
172
+ }
173
+ }
174
+ /** @internal */
175
+ hostConnected() {
176
+ this.connected = true;
177
+ this.attach();
178
+ }
179
+ /** @internal */
180
+ hostDisconnected() {
181
+ this.connected = false;
182
+ this.detach();
183
+ }
184
+ attach() {
185
+ if (!this.source) {
186
+ return;
187
+ }
188
+ this.unsubscribe = this.source.subscribe((value) => this.handle(value));
189
+ this.handle(this.source.value);
190
+ }
191
+ detach() {
192
+ this.unsubscribe?.();
193
+ this.unsubscribe = void 0;
194
+ }
195
+ handle(value) {
196
+ if (!this.hasSeen || !Object.is(value, this.lastSeen)) {
197
+ this.hasSeen = true;
198
+ this.lastSeen = value;
199
+ this.callback?.(value);
200
+ }
201
+ this.host.requestUpdate();
202
+ }
203
+ }
204
+
205
+ export { DiagramObserver, Observable, batch, derived };
@@ -0,0 +1,56 @@
1
+ const DIAGRAM_PALETTE_ITEM_MIME_TYPE = "application/x-flow-ui-diagram-palette-item";
2
+ class DiagramPaletteDragRegistry {
3
+ constructor() {
4
+ this._current = null;
5
+ }
6
+ /** The drag in progress, or `null`. */
7
+ get current() {
8
+ return this._current;
9
+ }
10
+ /** Records a drag starting from `source`, replacing any other. */
11
+ start(item, source, kind) {
12
+ this._current = { item, source, kind };
13
+ }
14
+ /** Ends the drag, if it is the one `source` started. */
15
+ end(source) {
16
+ if (this._current?.source === source) {
17
+ this._current = null;
18
+ }
19
+ }
20
+ }
21
+ const paletteDragRegistry = new DiagramPaletteDragRegistry();
22
+ function serializePaletteItem(item) {
23
+ return JSON.stringify(item);
24
+ }
25
+ function readPaletteDropData(dataTransfer) {
26
+ if (!dataTransfer) {
27
+ return void 0;
28
+ }
29
+ return dataTransfer.getData(DIAGRAM_PALETTE_ITEM_MIME_TYPE) || dataTransfer.getData("text/plain") || void 0;
30
+ }
31
+ function mayCarryPaletteItem(dataTransfer) {
32
+ const types = dataTransfer ? Array.from(dataTransfer.types ?? []) : [];
33
+ return types.includes(DIAGRAM_PALETTE_ITEM_MIME_TYPE) || types.includes("text/plain");
34
+ }
35
+ function deepElementFromPoint(x, y, root = document) {
36
+ let element = root.elementFromPoint?.(x, y) ?? null;
37
+ while (element?.shadowRoot) {
38
+ const inner = element.shadowRoot.elementFromPoint?.(x, y) ?? null;
39
+ if (!inner || inner === element) {
40
+ break;
41
+ }
42
+ element = inner;
43
+ }
44
+ return element;
45
+ }
46
+ function closestComposed(node, matches) {
47
+ while (node) {
48
+ if (node instanceof Element && matches(node)) {
49
+ return node;
50
+ }
51
+ node = node instanceof ShadowRoot ? node.host : node.parentNode;
52
+ }
53
+ return null;
54
+ }
55
+
56
+ export { DIAGRAM_PALETTE_ITEM_MIME_TYPE, DiagramPaletteDragRegistry, closestComposed, deepElementFromPoint, mayCarryPaletteItem, paletteDragRegistry, readPaletteDropData, serializePaletteItem };
@@ -0,0 +1,27 @@
1
+ const DIAGRAM_PORT_HOVERABLE_CLASS = "flow-ui-diagram-port-hoverable";
2
+ const DIAGRAM_PORT_HOVERABLE_OVER_NODE_CLASS = "flow-ui-diagram-port-hoverable-over-node";
3
+ const DIAGRAM_ROTATE_HANDLE_CLASS = "flow-ui-diagram-rotate-handle";
4
+ function isRotateHandleEvent(event) {
5
+ return event.composedPath().some((target) => target instanceof Element && target.classList.contains(DIAGRAM_ROTATE_HANDLE_CLASS));
6
+ }
7
+ function getPortHoverMode(port, nodeElement) {
8
+ let element = port;
9
+ while (element) {
10
+ if (element !== port) {
11
+ if (element.classList.contains(DIAGRAM_PORT_HOVERABLE_OVER_NODE_CLASS)) {
12
+ return "node";
13
+ }
14
+ if (element.classList.contains(DIAGRAM_PORT_HOVERABLE_CLASS)) {
15
+ return "port";
16
+ }
17
+ }
18
+ if (element === nodeElement) {
19
+ break;
20
+ }
21
+ const root = element.getRootNode();
22
+ element = element.parentElement ?? (root instanceof ShadowRoot ? root.host : null);
23
+ }
24
+ return void 0;
25
+ }
26
+
27
+ export { DIAGRAM_PORT_HOVERABLE_CLASS, DIAGRAM_PORT_HOVERABLE_OVER_NODE_CLASS, DIAGRAM_ROTATE_HANDLE_CLASS, getPortHoverMode, isRotateHandleEvent };