@emuanalytics/flow-rdf-ui 4.2.0 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -0
- package/THIRD_PARTY_NOTICES.md +220 -0
- package/dist/components/alert/alert.component.mjs +3 -0
- package/dist/components/animation/animation.component.mjs +1 -0
- package/dist/components/autocomplete/autocomplete.component.mjs +38 -14
- package/dist/components/avatar/avatar.component.mjs +3 -0
- package/dist/components/badge/badge.component.mjs +1 -0
- package/dist/components/base-control/base-control.component.mjs +3 -0
- package/dist/components/breadcrumb/breadcrumb.component.mjs +3 -0
- package/dist/components/breadcrumb-item/breadcrumb-item.component.mjs +1 -0
- package/dist/components/busy-overlay/busy-overlay.component.mjs +3 -0
- package/dist/components/button/button.component.mjs +4 -0
- package/dist/components/button-group/button-group.component.mjs +1 -0
- package/dist/components/calendar/calendar.component.mjs +6 -0
- package/dist/components/card/card.component.mjs +1 -0
- package/dist/components/carousel/carousel.component.mjs +3 -0
- package/dist/components/carousel-item/carousel-item.component.mjs +1 -0
- package/dist/components/chart/chart.component.mjs +1 -0
- package/dist/components/chart/chartjs-plugins/luxon.adapter.mjs +78 -0
- package/dist/components/chart/chartjs-support.mjs +2 -0
- package/dist/components/checkbox/checkbox.component.mjs +3 -0
- package/dist/components/checkbox-group/checkbox-group.component.mjs +3 -0
- package/dist/components/color-mapper/color-mapper.component.mjs +21 -0
- package/dist/components/color-picker/color-picker.component.mjs +8 -0
- package/dist/components/color-stop/color-stop.component.mjs +17 -0
- package/dist/components/date-time-picker/date-time-picker.component.mjs +6 -0
- package/dist/components/details/details.component.mjs +3 -0
- package/dist/components/diagram/diagram-panel.styles.mjs +44 -0
- package/dist/components/diagram/diagram-tokens.styles.mjs +148 -0
- package/dist/components/diagram/diagram.component.mjs +355 -0
- package/dist/components/diagram/diagram.mjs +5 -0
- package/dist/components/diagram/diagram.styles.mjs +95 -0
- package/dist/components/diagram-background/diagram-background.component.mjs +163 -0
- package/dist/components/diagram-background/diagram-background.mjs +5 -0
- package/dist/components/diagram-background/diagram-background.styles.mjs +58 -0
- package/dist/components/diagram-base-edge/diagram-base-edge.component.mjs +326 -0
- package/dist/components/diagram-base-edge/diagram-base-edge.mjs +5 -0
- package/dist/components/diagram-base-edge/diagram-base-edge.styles.mjs +147 -0
- package/dist/components/diagram-base-node/diagram-base-node.component.mjs +84 -0
- package/dist/components/diagram-base-node/diagram-base-node.mjs +5 -0
- package/dist/components/diagram-base-node/diagram-base-node.styles.mjs +37 -0
- package/dist/components/diagram-edge/diagram-edge.component.mjs +56 -0
- package/dist/components/diagram-edge/diagram-edge.mjs +5 -0
- package/dist/components/diagram-edge/diagram-edge.styles.mjs +37 -0
- package/dist/components/diagram-edge-label/diagram-edge-label.component.mjs +202 -0
- package/dist/components/diagram-edge-label/diagram-edge-label.mjs +5 -0
- package/dist/components/diagram-edge-label/diagram-edge-label.styles.mjs +54 -0
- package/dist/components/diagram-marker/diagram-marker.component.mjs +84 -0
- package/dist/components/diagram-marker/diagram-marker.mjs +5 -0
- package/dist/components/diagram-marker/diagram-marker.styles.mjs +9 -0
- package/dist/components/diagram-minimap/diagram-minimap.component.mjs +298 -0
- package/dist/components/diagram-minimap/diagram-minimap.mjs +5 -0
- package/dist/components/diagram-minimap/diagram-minimap.styles.mjs +83 -0
- package/dist/components/diagram-node/diagram-node-template.styles.mjs +36 -0
- package/dist/components/diagram-node/diagram-node.component.mjs +183 -0
- package/dist/components/diagram-node/diagram-node.mjs +6 -0
- package/dist/components/diagram-node/diagram-node.styles.mjs +29 -0
- package/dist/components/diagram-palette-item/diagram-palette-item.component.mjs +168 -0
- package/dist/components/diagram-palette-item/diagram-palette-item.mjs +5 -0
- package/dist/components/diagram-palette-item/diagram-palette-item.styles.mjs +20 -0
- package/dist/components/diagram-palette-item-preview/diagram-palette-item-preview.component.mjs +245 -0
- package/dist/components/diagram-palette-item-preview/diagram-palette-item-preview.mjs +6 -0
- package/dist/components/diagram-palette-item-preview/diagram-palette-item-preview.styles.mjs +41 -0
- package/dist/components/diagram-port/diagram-port.component.mjs +273 -0
- package/dist/components/diagram-port/diagram-port.mjs +5 -0
- package/dist/components/diagram-port/diagram-port.styles.mjs +116 -0
- package/dist/components/diagram-resize-adornment/diagram-resize-adornment.component.mjs +124 -0
- package/dist/components/diagram-resize-adornment/diagram-resize-adornment.mjs +5 -0
- package/dist/components/diagram-resize-adornment/diagram-resize-adornment.styles.mjs +136 -0
- package/dist/components/diagram-rotate-adornment/diagram-rotate-adornment.component.mjs +125 -0
- package/dist/components/diagram-rotate-adornment/diagram-rotate-adornment.mjs +5 -0
- package/dist/components/diagram-rotate-adornment/diagram-rotate-adornment.styles.mjs +65 -0
- package/dist/components/diagram-zoom-controls/diagram-zoom-controls.component.mjs +158 -0
- package/dist/components/diagram-zoom-controls/diagram-zoom-controls.mjs +5 -0
- package/dist/components/diagram-zoom-controls/diagram-zoom-controls.styles.mjs +66 -0
- package/dist/components/dialog/dialog.component.mjs +4 -0
- package/dist/components/divider/divider.component.mjs +1 -0
- package/dist/components/drawer/drawer.component.mjs +3 -0
- package/dist/components/dropdown/dropdown.component.mjs +2 -1
- package/dist/components/form-group/form-group.component.mjs +1 -0
- package/dist/components/gauge/gauge.component.mjs +6 -0
- package/dist/components/icon/icon.component.mjs +1 -0
- package/dist/components/icon/library.system.mjs +2 -0
- package/dist/components/icon-button/icon-button.component.mjs +5 -0
- package/dist/components/input/input.component.mjs +5 -0
- package/dist/components/list/list.component.mjs +1 -0
- package/dist/components/list-item/list-item.component.mjs +17 -0
- package/dist/components/map/map.component.mjs +3 -0
- package/dist/components/map/map.styles.mjs +10 -0
- package/dist/components/menu/menu.component.mjs +1 -0
- package/dist/components/menu-item/menu-item.component.mjs +3 -0
- package/dist/components/menu-label/menu-label.component.mjs +1 -0
- package/dist/components/mutation-observer/mutation-observer.component.mjs +1 -0
- package/dist/components/option/option.component.mjs +2 -1
- package/dist/components/panel/panel.component.mjs +85 -1
- package/dist/components/panel/panel.styles.mjs +29 -0
- package/dist/components/panel-header/panel-header.component.mjs +3 -0
- package/dist/components/popup/popup.component.mjs +1 -0
- package/dist/components/progress-bar/progress-bar.component.mjs +1 -0
- package/dist/components/progress-ring/progress-ring.component.mjs +1 -0
- package/dist/components/query-builder/query-builder.component.mjs +27 -0
- package/dist/components/radio/radio.component.mjs +3 -0
- package/dist/components/radio-group/radio-group.component.mjs +3 -0
- package/dist/components/range/range.component.mjs +9 -0
- package/dist/components/resize-observer/resize-observer.component.mjs +1 -0
- package/dist/components/scroll-view/scroll-view.component.mjs +1 -0
- package/dist/components/select/select.component.mjs +3 -5
- package/dist/components/split-view/split-view-layout-registry.mjs +44 -0
- package/dist/components/split-view/split-view-layout.mjs +607 -0
- package/dist/components/split-view/split-view.component.mjs +502 -468
- package/dist/components/split-view/split-view.styles.mjs +25 -0
- package/dist/components/split-view-divider/split-view-divider.component.mjs +2 -53
- package/dist/components/split-view-divider/split-view-divider.styles.mjs +28 -16
- package/dist/components/split-view-pane/split-view-pane.component.mjs +197 -18
- package/dist/components/split-view-pane/split-view-pane.styles.mjs +52 -0
- package/dist/components/split-view-toggle-button/split-view-toggle-button.component.mjs +5 -0
- package/dist/components/stepper/stepper.component.mjs +1 -0
- package/dist/components/stepper-panel/stepper-panel.component.mjs +1 -0
- package/dist/components/switch/switch.component.mjs +3 -0
- package/dist/components/tab/tab.component.mjs +4 -0
- package/dist/components/tab-group/tab-group.component.mjs +176 -6
- package/dist/components/tab-group/tab-group.styles.mjs +44 -0
- package/dist/components/tab-panel/tab-panel.component.mjs +1 -0
- package/dist/components/tag/tag.component.mjs +2 -1
- package/dist/components/textarea/textarea.component.mjs +1 -0
- package/dist/components/timer/ticker.mjs +7 -0
- package/dist/components/timer/timer.component.mjs +44 -3
- package/dist/components/timer/timer.styles.mjs +6 -2
- package/dist/components/tool-button/tool-button.component.mjs +4 -0
- package/dist/components/tool-button-group/tool-button-group.component.mjs +3 -0
- package/dist/components/tooltip/tooltip.component.mjs +3 -0
- package/dist/components/tree/tree.component.mjs +1 -0
- package/dist/components/tree-item/tree-item.component.mjs +5 -0
- package/dist/components/visually-hidden/visually-hidden.component.mjs +1 -0
- package/dist/custom-elements.json +11803 -5676
- package/dist/diagram/api/diagram-api-base.mjs +16 -0
- package/dist/diagram/api/diagram-api.mjs +399 -0
- package/dist/diagram/api/diagram-clipboard-api.mjs +52 -0
- package/dist/diagram/api/diagram-groups-api.mjs +46 -0
- package/dist/diagram/api/diagram-model-api.mjs +447 -0
- package/dist/diagram/api/diagram-nodes-api.mjs +61 -0
- package/dist/diagram/api/diagram-selection-api.mjs +56 -0
- package/dist/diagram/api/diagram-viewport-api.mjs +169 -0
- package/dist/diagram/api/emit-with-measurement-option.mjs +21 -0
- package/dist/diagram/input/box-selection-controller.mjs +104 -0
- package/dist/diagram/input/context-menu-controller.mjs +196 -0
- package/dist/diagram/input/cursor-position-tracker-controller.mjs +18 -0
- package/dist/diagram/input/input-controller.mjs +31 -0
- package/dist/diagram/input/keyboard-actions/moving-action.mjs +27 -0
- package/dist/diagram/input/keyboard-actions/panning-action.mjs +27 -0
- package/dist/diagram/input/keyboard-actions/paste-action.mjs +17 -0
- package/dist/diagram/input/keyboard-actions/zoom-action.mjs +30 -0
- package/dist/diagram/input/keyboard-inputs-controller.mjs +121 -0
- package/dist/diagram/input/linking-controller.mjs +127 -0
- package/dist/diagram/input/linking-events.mjs +61 -0
- package/dist/diagram/input/manual-linking.mjs +101 -0
- package/dist/diagram/input/mobile-box-selection-controller.mjs +133 -0
- package/dist/diagram/input/mobile-panning-controller.mjs +114 -0
- package/dist/diagram/input/mobile-zooming-controller.mjs +110 -0
- package/dist/diagram/input/object-selection-controller.mjs +152 -0
- package/dist/diagram/input/palette-drop-controller.mjs +92 -0
- package/dist/diagram/input/panning-controller.mjs +147 -0
- package/dist/diagram/input/pointer-move-selection-controller.mjs +191 -0
- package/dist/diagram/input/relinking-gesture.mjs +182 -0
- package/dist/diagram/input/resize-controller.mjs +122 -0
- package/dist/diagram/input/rotate-controller.mjs +126 -0
- package/dist/diagram/input/zooming-wheel-controller.mjs +55 -0
- package/dist/diagram/minimap/minimap-calculations.mjs +83 -0
- package/dist/diagram/minimap/minimap-navigation-controller.mjs +150 -0
- package/dist/diagram/minimap/minimap-node-cache.mjs +19 -0
- package/dist/diagram/minimap/minimap-strategies.mjs +44 -0
- package/dist/diagram/model/diagram-model-adapter.mjs +97 -0
- package/dist/diagram/model/initialize-model.mjs +31 -0
- package/dist/diagram/model/strip-runtime-properties.mjs +30 -0
- package/dist/diagram/runtime/attribute-converters.mjs +11 -0
- package/dist/diagram/runtime/batched-resize-observer.mjs +168 -0
- package/dist/diagram/runtime/box-selection-provider.mjs +9 -0
- package/dist/diagram/runtime/context.mjs +132 -0
- package/dist/diagram/runtime/contexts.mjs +8 -0
- package/dist/diagram/runtime/cursor-position-tracker.mjs +20 -0
- package/dist/diagram/runtime/default-edge-templates.mjs +21 -0
- package/dist/diagram/runtime/default-node-templates.mjs +20 -0
- package/dist/diagram/runtime/diagram-reference.mjs +126 -0
- package/dist/diagram/runtime/diagram-runtime.mjs +214 -0
- package/dist/diagram/runtime/dom-input-events-router.mjs +88 -0
- package/dist/diagram/runtime/environment.mjs +59 -0
- package/dist/diagram/runtime/event-bridge.mjs +31 -0
- package/dist/diagram/runtime/flow-offset.mjs +45 -0
- package/dist/diagram/runtime/group-highlighted.mjs +25 -0
- package/dist/diagram/runtime/hidden.mjs +147 -0
- package/dist/diagram/runtime/lit-renderer.mjs +33 -0
- package/dist/diagram/runtime/marker-registry.mjs +108 -0
- package/dist/diagram/runtime/middlewares.mjs +14 -0
- package/dist/diagram/runtime/model-owner.mjs +11 -0
- package/dist/diagram/runtime/node-selected.mjs +25 -0
- package/dist/diagram/runtime/observable.mjs +205 -0
- package/dist/diagram/runtime/palette-drag.mjs +56 -0
- package/dist/diagram/runtime/port-hover.mjs +27 -0
- package/dist/diagram/runtime/port-registry.mjs +87 -0
- package/dist/diagram/runtime/resize-processor.mjs +207 -0
- package/dist/diagram/runtime/template-resolver.mjs +98 -0
- package/dist/diagram/runtime/touch-events-state.mjs +52 -0
- package/dist/diagram/utilities.mjs +27 -0
- package/dist/diagram-core/action-state-manager/action-state-manager.mjs +238 -0
- package/dist/diagram-core/batch-processor/batch-processor.mjs +144 -0
- package/dist/diagram-core/command-handler/command-handler.mjs +62 -0
- package/dist/diagram-core/command-handler/commands/add-to-group.mjs +32 -0
- package/dist/diagram-core/command-handler/commands/add-update-delete.mjs +196 -0
- package/dist/diagram-core/command-handler/commands/centering.mjs +73 -0
- package/dist/diagram-core/command-handler/commands/copy-paste.mjs +223 -0
- package/dist/diagram-core/command-handler/commands/cut.mjs +9 -0
- package/dist/diagram-core/command-handler/commands/delete-selection.mjs +32 -0
- package/dist/diagram-core/command-handler/commands/detach-on-node-delete.mjs +77 -0
- package/dist/diagram-core/command-handler/commands/highlight-group.mjs +45 -0
- package/dist/diagram-core/command-handler/commands/index.mjs +88 -0
- package/dist/diagram-core/command-handler/commands/init.mjs +11 -0
- package/dist/diagram-core/command-handler/commands/linking/cancel-linking.mjs +26 -0
- package/dist/diagram-core/command-handler/commands/linking/finish-linking-to-position.mjs +33 -0
- package/dist/diagram-core/command-handler/commands/linking/finish-linking.mjs +108 -0
- package/dist/diagram-core/command-handler/commands/linking/finish-relinking.mjs +91 -0
- package/dist/diagram-core/command-handler/commands/linking/linking-gesture.mjs +13 -0
- package/dist/diagram-core/command-handler/commands/linking/move-temporary-edge.mjs +98 -0
- package/dist/diagram-core/command-handler/commands/linking/start-linking-from-position.mjs +23 -0
- package/dist/diagram-core/command-handler/commands/linking/start-linking.mjs +47 -0
- package/dist/diagram-core/command-handler/commands/linking/start-relinking.mjs +51 -0
- package/dist/diagram-core/command-handler/commands/linking/utils.mjs +103 -0
- package/dist/diagram-core/command-handler/commands/move-nodes-lifecycle.mjs +14 -0
- package/dist/diagram-core/command-handler/commands/move-viewport.mjs +48 -0
- package/dist/diagram-core/command-handler/commands/move.mjs +90 -0
- package/dist/diagram-core/command-handler/commands/remove-from-group.mjs +22 -0
- package/dist/diagram-core/command-handler/commands/resize-node-lifecycle.mjs +14 -0
- package/dist/diagram-core/command-handler/commands/resize-node.mjs +214 -0
- package/dist/diagram-core/command-handler/commands/rotate-node-lifecycle.mjs +14 -0
- package/dist/diagram-core/command-handler/commands/rotate-node.mjs +53 -0
- package/dist/diagram-core/command-handler/commands/selection.mjs +69 -0
- package/dist/diagram-core/command-handler/commands/z-order.mjs +125 -0
- package/dist/diagram-core/command-handler/commands/zoom-to-fit.mjs +118 -0
- package/dist/diagram-core/command-handler/commands/zoom.mjs +26 -0
- package/dist/diagram-core/edge-routing-manager/edge-routing-manager.mjs +253 -0
- package/dist/diagram-core/edge-routing-manager/resolve-label-position.mjs +13 -0
- package/dist/diagram-core/edge-routing-manager/routings/bezier/bezier-routing.mjs +73 -0
- package/dist/diagram-core/edge-routing-manager/routings/bezier/compute-bezier-path.mjs +24 -0
- package/dist/diagram-core/edge-routing-manager/routings/bezier/compute-bezier-point-at-distance.mjs +37 -0
- package/dist/diagram-core/edge-routing-manager/routings/bezier/compute-bezier-point-on-path.mjs +33 -0
- package/dist/diagram-core/edge-routing-manager/routings/bezier/compute-bezier-points.mjs +31 -0
- package/dist/diagram-core/edge-routing-manager/routings/orthogonal/compute-orthogonal-path.mjs +56 -0
- package/dist/diagram-core/edge-routing-manager/routings/orthogonal/compute-orthogonal-point-at-distance.mjs +12 -0
- package/dist/diagram-core/edge-routing-manager/routings/orthogonal/compute-orthogonal-point-on-path.mjs +38 -0
- package/dist/diagram-core/edge-routing-manager/routings/orthogonal/compute-orthogonal-points.mjs +26 -0
- package/dist/diagram-core/edge-routing-manager/routings/orthogonal/orthogonal-routing.mjs +69 -0
- package/dist/diagram-core/edge-routing-manager/routings/orthogonal/utils/get-offset-point.mjs +14 -0
- package/dist/diagram-core/edge-routing-manager/routings/orthogonal/utils/pathpoints/get-pathpoints-from-bottom.mjs +104 -0
- package/dist/diagram-core/edge-routing-manager/routings/orthogonal/utils/pathpoints/get-pathpoints-from-left.mjs +91 -0
- package/dist/diagram-core/edge-routing-manager/routings/orthogonal/utils/pathpoints/get-pathpoints-from-right.mjs +88 -0
- package/dist/diagram-core/edge-routing-manager/routings/orthogonal/utils/pathpoints/get-pathpoints-from-top.mjs +168 -0
- package/dist/diagram-core/edge-routing-manager/routings/orthogonal/utils/pathpoints/get-pathpoints.mjs +23 -0
- package/dist/diagram-core/edge-routing-manager/routings/polyline/compute-polyline-point-at-distance.mjs +12 -0
- package/dist/diagram-core/edge-routing-manager/routings/polyline/compute-polyline-point-on-path.mjs +41 -0
- package/dist/diagram-core/edge-routing-manager/routings/polyline/polyline-routing.mjs +81 -0
- package/dist/diagram-core/edge-routing-manager/utils/linear-segment-utils.mjs +27 -0
- package/dist/diagram-core/edge-routing-manager/utils/normalize-distance.mjs +6 -0
- package/dist/diagram-core/event-manager/event-manager.mjs +164 -0
- package/dist/diagram-core/flow-config/default-flow-config.mjs +143 -0
- package/dist/diagram-core/flow-core.mjs +541 -0
- package/dist/diagram-core/input-events/handlers/box-selection/box-selection.handler.mjs +69 -0
- package/dist/diagram-core/input-events/handlers/cancel-interaction/cancel-interaction.handler.mjs +9 -0
- package/dist/diagram-core/input-events/handlers/copy/copy.handler.mjs +9 -0
- package/dist/diagram-core/input-events/handlers/cut/cut.handler.mjs +9 -0
- package/dist/diagram-core/input-events/handlers/delete-selection/delete-selection.handler.mjs +9 -0
- package/dist/diagram-core/input-events/handlers/event-handler.mjs +29 -0
- package/dist/diagram-core/input-events/handlers/keyboard-move-selection/keyboard-move-selection.handler.mjs +130 -0
- package/dist/diagram-core/input-events/handlers/keyboard-panning/keyboard-panning.handler.mjs +31 -0
- package/dist/diagram-core/input-events/handlers/linking/linking.handler.mjs +77 -0
- package/dist/diagram-core/input-events/handlers/movable-selection.mjs +26 -0
- package/dist/diagram-core/input-events/handlers/palette-drop/palette-drop.handler.mjs +20 -0
- package/dist/diagram-core/input-events/handlers/panning/panning-handler-factory.mjs +8 -0
- package/dist/diagram-core/input-events/handlers/panning/panning.handler.mjs +41 -0
- package/dist/diagram-core/input-events/handlers/panning/virtualized-panning.handler.mjs +77 -0
- package/dist/diagram-core/input-events/handlers/paste/paste.handler.mjs +17 -0
- package/dist/diagram-core/input-events/handlers/pointer-move-selection/pointer-move-selection.handler.mjs +220 -0
- package/dist/diagram-core/input-events/handlers/redo/redo.handler.mjs +14 -0
- package/dist/diagram-core/input-events/handlers/relinking/relinking.handler.mjs +62 -0
- package/dist/diagram-core/input-events/handlers/resize/resize.handler.mjs +174 -0
- package/dist/diagram-core/input-events/handlers/rotate/rotate.handler.mjs +107 -0
- package/dist/diagram-core/input-events/handlers/select/select.handler.mjs +42 -0
- package/dist/diagram-core/input-events/handlers/select-all/select-all.handler.mjs +10 -0
- package/dist/diagram-core/input-events/handlers/undo/undo.handler.mjs +14 -0
- package/dist/diagram-core/input-events/handlers/wheel-panning/wheel-panning.handler.mjs +25 -0
- package/dist/diagram-core/input-events/handlers/zooming/zooming.handler.mjs +28 -0
- package/dist/diagram-core/input-events/input-events.router.mjs +75 -0
- package/dist/diagram-core/interaction-coordinator/interaction-coordinator.mjs +75 -0
- package/dist/diagram-core/label-batch-processor/label-batch-processor.mjs +19 -0
- package/dist/diagram-core/math/angle-between-points/angle-between-points.mjs +5 -0
- package/dist/diagram-core/math/angle-to-side/angle-to-side.mjs +27 -0
- package/dist/diagram-core/math/calculate-edge-panning-force/calculate-edge-panning-force.mjs +34 -0
- package/dist/diagram-core/math/clamp/clamp.mjs +5 -0
- package/dist/diagram-core/math/distance-between-points/distance-between-points.mjs +5 -0
- package/dist/diagram-core/math/ng-diagram-math.mjs +25 -0
- package/dist/diagram-core/math/normalize-angle/normalize-angle.mjs +5 -0
- package/dist/diagram-core/math/snap-angle/snap-angle.mjs +43 -0
- package/dist/diagram-core/math/snap-number/snap-number.mjs +3 -0
- package/dist/diagram-core/math/snap-point/snap-point.mjs +8 -0
- package/dist/diagram-core/math/subtract-points/subtract-points.mjs +5 -0
- package/dist/diagram-core/measurement-tracker/measurement-tracker.mjs +182 -0
- package/dist/diagram-core/middleware-manager/middleware-executor.mjs +246 -0
- package/dist/diagram-core/middleware-manager/middleware-manager.mjs +93 -0
- package/dist/diagram-core/middleware-manager/middlewares/edges-routing/edges-routing.mjs +149 -0
- package/dist/diagram-core/middleware-manager/middlewares/edges-routing/get-edge-points.mjs +93 -0
- package/dist/diagram-core/middleware-manager/middlewares/edges-routing/get-source-target-positions.mjs +90 -0
- package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/clipboard-paste.emitter.mjs +34 -0
- package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/diagram-init.emitter.mjs +190 -0
- package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/edge-draw-ended.emitter.mjs +51 -0
- package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/edge-drawn.emitter.mjs +35 -0
- package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/edge-relink.emitter.mjs +58 -0
- package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/group-membership-changed.emitter.mjs +49 -0
- package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/node-drag-lifecycle.emitter.mjs +54 -0
- package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/node-resize-lifecycle.emitter.mjs +44 -0
- package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/node-rotate-lifecycle.emitter.mjs +44 -0
- package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/palette-item-dropped.emitter.mjs +26 -0
- package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/selection-changed.emitter.mjs +61 -0
- package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/selection-gesture-ended.emitter.mjs +32 -0
- package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/selection-moved.emitter.mjs +57 -0
- package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/selection-removed.emitter.mjs +40 -0
- package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/selection-rotated.emitter.mjs +33 -0
- package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/size-changed.emitter.mjs +33 -0
- package/dist/diagram-core/middleware-manager/middlewares/event-emitter/emitters/viewport-changed.emitter.mjs +19 -0
- package/dist/diagram-core/middleware-manager/middlewares/event-emitter/event-emitter.middleware.mjs +69 -0
- package/dist/diagram-core/middleware-manager/middlewares/hidden-computation/hidden-computation.mjs +66 -0
- package/dist/diagram-core/middleware-manager/middlewares/internal-id-assignment/internal-id-assignment.mjs +24 -0
- package/dist/diagram-core/middleware-manager/middlewares/logger/logger.mjs +18 -0
- package/dist/diagram-core/middleware-manager/middlewares/measured-bounds-assignment/is-node-fully-measured.mjs +20 -0
- package/dist/diagram-core/middleware-manager/middlewares/measured-bounds-assignment/measured-bounds-assignment.mjs +59 -0
- package/dist/diagram-core/middleware-manager/middlewares/measurement-tracking/measurement-tracking.middleware.mjs +55 -0
- package/dist/diagram-core/middleware-manager/middlewares/z-index-assignment/utils/assign-edges-z-index.mjs +12 -0
- package/dist/diagram-core/middleware-manager/middlewares/z-index-assignment/utils/assign-node-z-index.mjs +61 -0
- package/dist/diagram-core/middleware-manager/middlewares/z-index-assignment/utils/create-group-children-map.mjs +14 -0
- package/dist/diagram-core/middleware-manager/middlewares/z-index-assignment/utils/initialize-z-index.mjs +30 -0
- package/dist/diagram-core/middleware-manager/middlewares/z-index-assignment/utils/sort-children.mjs +36 -0
- package/dist/diagram-core/middleware-manager/middlewares/z-index-assignment/z-index-assignment.mjs +240 -0
- package/dist/diagram-core/middleware-manager/pass-settlement.mjs +68 -0
- package/dist/diagram-core/model-lookup/model-lookup.mjs +394 -0
- package/dist/diagram-core/port-batch-processor/port-batch-processor.mjs +20 -0
- package/dist/diagram-core/render-strategy/base-render-strategy.mjs +26 -0
- package/dist/diagram-core/render-strategy/direct/direct-render-strategy.mjs +33 -0
- package/dist/diagram-core/render-strategy/render-performance-logger.mjs +42 -0
- package/dist/diagram-core/render-strategy/virtualized/idle-render-scheduler.mjs +43 -0
- package/dist/diagram-core/render-strategy/virtualized/result-cache.mjs +63 -0
- package/dist/diagram-core/render-strategy/virtualized/viewport-utils.mjs +40 -0
- package/dist/diagram-core/render-strategy/virtualized/virtualized-render-strategy.mjs +91 -0
- package/dist/diagram-core/render-strategy/virtualized/visible-elements-resolver.mjs +120 -0
- package/dist/diagram-core/render-strategy/virtualized/zoom-tracker.mjs +38 -0
- package/dist/diagram-core/set.polyfill.mjs +24 -0
- package/dist/diagram-core/shortcut-manager/default-shortcuts.mjs +99 -0
- package/dist/diagram-core/shortcut-manager/shortcut-manager.mjs +140 -0
- package/dist/diagram-core/spatial-hash/collision-detection.mjs +74 -0
- package/dist/diagram-core/spatial-hash/spatial-hash.mjs +161 -0
- package/dist/diagram-core/spatial-hash/utils.mjs +92 -0
- package/dist/diagram-core/transaction-manager/transaction-context.mjs +40 -0
- package/dist/diagram-core/transaction-manager/transaction-manager.mjs +94 -0
- package/dist/diagram-core/transaction-manager/transaction.mjs +179 -0
- package/dist/diagram-core/types/edge.interface.mjs +3 -0
- package/dist/diagram-core/types/node.interface.mjs +3 -0
- package/dist/diagram-core/types/utils.mjs +3 -0
- package/dist/diagram-core/updater/init-updater/init-state.mjs +356 -0
- package/dist/diagram-core/updater/init-updater/init-updater.mjs +275 -0
- package/dist/diagram-core/updater/init-updater/late-arrival-queue.mjs +71 -0
- package/dist/diagram-core/updater/init-updater/stability-detector.mjs +63 -0
- package/dist/diagram-core/updater/internal-updater/internal-updater.mjs +166 -0
- package/dist/diagram-core/utils/change-generation.mjs +13 -0
- package/dist/diagram-core/utils/compute-floating-edge-side.mjs +35 -0
- package/dist/diagram-core/utils/constants.mjs +3 -0
- package/dist/diagram-core/utils/dangling-edges.mjs +89 -0
- package/dist/diagram-core/utils/deep-merge.mjs +22 -0
- package/dist/diagram-core/utils/dimensions.mjs +52 -0
- package/dist/diagram-core/utils/get-node-border-intersection.mjs +99 -0
- package/dist/diagram-core/utils/get-port-flow-position.mjs +55 -0
- package/dist/diagram-core/utils/group-size.mjs +32 -0
- package/dist/diagram-core/utils/is-group.mjs +5 -0
- package/dist/diagram-core/utils/measurement-validation.mjs +11 -0
- package/dist/diagram-core/utils/object-properties.mjs +22 -0
- package/dist/diagram-core/utils/rects-points-sizes.mjs +148 -0
- package/dist/diagram-core/utils/relinking.mjs +6 -0
- package/dist/diagram-core/utils/semaphore.mjs +43 -0
- package/dist/diagram-core/utils/snap-node-position.mjs +11 -0
- package/dist/diagram-core/utils/sort-nodes-by-z-index.mjs +22 -0
- package/dist/diagram-core/visibility/effective-visibility.mjs +28 -0
- package/dist/diagram-core/visibility/template-visibility-registry.mjs +87 -0
- package/dist/index.d.mts +13416 -3794
- package/dist/index.d.ts +13416 -3794
- package/dist/index.mjs +34 -0
- package/dist/internal/content-size.mjs +14 -0
- package/dist/internal/custom-boolean-converter.mjs +18 -0
- package/dist/internal/flow-ui-rdf-element.mjs +57 -5
- package/dist/package.json.mjs +1 -1
- package/dist/utilities/register-components.mjs +77 -142
- package/dist/vscode.html-custom-data.json +460 -187
- package/package.json +16 -8
- package/themes/dark.css +2 -0
- package/themes/dark.styles.js +2 -0
- package/themes/light.css +2 -0
- package/themes/light.styles.js +2 -0
|
@@ -0,0 +1,541 @@
|
|
|
1
|
+
import { ActionStateManager } from './action-state-manager/action-state-manager.mjs';
|
|
2
|
+
import { CommandHandler } from './command-handler/command-handler.mjs';
|
|
3
|
+
import { createFlowConfig } from './flow-config/default-flow-config.mjs';
|
|
4
|
+
import { InteractionCoordinator } from './interaction-coordinator/interaction-coordinator.mjs';
|
|
5
|
+
import { LabelBatchProcessor } from './label-batch-processor/label-batch-processor.mjs';
|
|
6
|
+
import { MeasurementTracker } from './measurement-tracker/measurement-tracker.mjs';
|
|
7
|
+
import { MiddlewareManager } from './middleware-manager/middleware-manager.mjs';
|
|
8
|
+
import { ModelLookup } from './model-lookup/model-lookup.mjs';
|
|
9
|
+
import { PortBatchProcessor } from './port-batch-processor/port-batch-processor.mjs';
|
|
10
|
+
import { SpatialHash } from './spatial-hash/spatial-hash.mjs';
|
|
11
|
+
import { getNodesInRange, getNearestNodeInRange, getNearestPortInRange, getOverlappingNodes } from './spatial-hash/utils.mjs';
|
|
12
|
+
import { TransactionManager } from './transaction-manager/transaction-manager.mjs';
|
|
13
|
+
import { InitUpdater } from './updater/init-updater/init-updater.mjs';
|
|
14
|
+
import { InternalUpdater } from './updater/internal-updater/internal-updater.mjs';
|
|
15
|
+
import { TemplateVisibilityRegistry } from './visibility/template-visibility-registry.mjs';
|
|
16
|
+
import { Semaphore } from './utils/semaphore.mjs';
|
|
17
|
+
import { ChangeGeneration } from './utils/change-generation.mjs';
|
|
18
|
+
import { EventManager } from './event-manager/event-manager.mjs';
|
|
19
|
+
import { DirectRenderStrategy } from './render-strategy/direct/direct-render-strategy.mjs';
|
|
20
|
+
import { VirtualizedRenderStrategy } from './render-strategy/virtualized/virtualized-render-strategy.mjs';
|
|
21
|
+
import { EdgeRoutingManager } from './edge-routing-manager/edge-routing-manager.mjs';
|
|
22
|
+
import { ShortcutManager } from './shortcut-manager/shortcut-manager.mjs';
|
|
23
|
+
import { deepMerge } from './utils/deep-merge.mjs';
|
|
24
|
+
import { loggerMiddleware } from './middleware-manager/middlewares/logger/logger.mjs';
|
|
25
|
+
|
|
26
|
+
class FlowCore {
|
|
27
|
+
constructor(modelAdapter, renderer, inputEventsRouter, environment, middlewares, getFlowOffset, getViewportSize, config = {}) {
|
|
28
|
+
this.renderer = renderer;
|
|
29
|
+
this.inputEventsRouter = inputEventsRouter;
|
|
30
|
+
this.environment = environment;
|
|
31
|
+
this.updateSemaphore = new Semaphore(1);
|
|
32
|
+
/**
|
|
33
|
+
* Bumped by the hidden-computation middleware whenever a pass changed some
|
|
34
|
+
* element's effective visibility (`computedHidden`). Render caches keyed on
|
|
35
|
+
* things a visibility toggle does not change (element counts, viewport)
|
|
36
|
+
* compare its version as an O(1) invalidation signal.
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
this.visibilityGeneration = new ChangeGeneration();
|
|
40
|
+
this.destroyed = false;
|
|
41
|
+
/** Whether a template-visibility flush microtask is already queued. */
|
|
42
|
+
this.templateVisibilityFlushScheduled = false;
|
|
43
|
+
/** Whether the queued flush must run a middleware pass (node/edge change). */
|
|
44
|
+
this.templateVisibilityFlushNeedsPass = false;
|
|
45
|
+
this._model = modelAdapter;
|
|
46
|
+
this._config = createFlowConfig(config, this);
|
|
47
|
+
this.environment = environment;
|
|
48
|
+
this.commandHandler = new CommandHandler(this);
|
|
49
|
+
this.spatialHash = new SpatialHash();
|
|
50
|
+
this.initUpdater = new InitUpdater(this);
|
|
51
|
+
this.internalUpdater = new InternalUpdater(this);
|
|
52
|
+
this.modelLookup = new ModelLookup(this);
|
|
53
|
+
this.eventManager = new EventManager();
|
|
54
|
+
this.actionStateManager = new ActionStateManager(this.eventManager);
|
|
55
|
+
this.directRenderStrategy = new DirectRenderStrategy(this);
|
|
56
|
+
this.virtualizedRenderStrategy = new VirtualizedRenderStrategy(this);
|
|
57
|
+
this.middlewareManager = new MiddlewareManager(this, middlewares);
|
|
58
|
+
this.transactionManager = new TransactionManager(this);
|
|
59
|
+
this.interactionCoordinator = new InteractionCoordinator(this);
|
|
60
|
+
this.portBatchProcessor = new PortBatchProcessor(this.getNodeById.bind(this));
|
|
61
|
+
this.labelBatchProcessor = new LabelBatchProcessor(this.getEdgeById.bind(this));
|
|
62
|
+
this.measurementTracker = new MeasurementTracker();
|
|
63
|
+
this.templateVisibilityRegistry = new TemplateVisibilityRegistry();
|
|
64
|
+
this.templateVisibilityRegistry.onNodeOrEdgeVisibilityChange = () => this.scheduleTemplateVisibilityFlush(true);
|
|
65
|
+
this.templateVisibilityRegistry.onPortOrLabelVisibilityChange = () => this.scheduleTemplateVisibilityFlush(false);
|
|
66
|
+
this.edgeRoutingManager = new EdgeRoutingManager(
|
|
67
|
+
this.config.edgeRouting.defaultRouting,
|
|
68
|
+
() => this.config.edgeRouting || {}
|
|
69
|
+
);
|
|
70
|
+
this.getFlowOffset = getFlowOffset || (() => ({ x: 0, y: 0 }));
|
|
71
|
+
this.getViewportSize = getViewportSize || (() => ({ width: 0, height: 0 }));
|
|
72
|
+
this.shortcutManager = new ShortcutManager(this);
|
|
73
|
+
this.inputEventsRouter.registerDefaultCallbacks(this);
|
|
74
|
+
this.init();
|
|
75
|
+
}
|
|
76
|
+
destroy() {
|
|
77
|
+
this.destroyed = true;
|
|
78
|
+
this.virtualizedRenderStrategy.destroy();
|
|
79
|
+
this.eventManager.offAll();
|
|
80
|
+
this.model.destroy();
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Coalesces template-visibility registry callbacks: any number of registry
|
|
84
|
+
* writes landing in the same microtask tick get one
|
|
85
|
+
* {@link InitUpdater.refreshHiddenEntities} prune and (for node/edge
|
|
86
|
+
* changes) one `templateVisibilityChange` middleware pass. Both flags are
|
|
87
|
+
* cleared BEFORE the flush body runs, so a write landing while the pass is
|
|
88
|
+
* still in flight re-arms the flush and gets exactly one follow-up.
|
|
89
|
+
*/
|
|
90
|
+
scheduleTemplateVisibilityFlush(needsPass) {
|
|
91
|
+
this.templateVisibilityFlushNeedsPass || (this.templateVisibilityFlushNeedsPass = needsPass);
|
|
92
|
+
if (this.templateVisibilityFlushScheduled) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
this.templateVisibilityFlushScheduled = true;
|
|
96
|
+
queueMicrotask(() => {
|
|
97
|
+
this.templateVisibilityFlushScheduled = false;
|
|
98
|
+
const needsPass2 = this.templateVisibilityFlushNeedsPass;
|
|
99
|
+
this.templateVisibilityFlushNeedsPass = false;
|
|
100
|
+
if (this.destroyed) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
this.initUpdater.refreshHiddenEntities();
|
|
104
|
+
if (needsPass2) {
|
|
105
|
+
this.applyUpdate({}, "templateVisibilityChange").catch((error) => {
|
|
106
|
+
console.error("[ngDiagram] Failed to apply template visibility change.", error);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
init() {
|
|
112
|
+
this.initializeViewportSize();
|
|
113
|
+
this.renderStrategy.init();
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Sets initial viewport size from element dimensions.
|
|
117
|
+
*
|
|
118
|
+
* This must be called BEFORE renderStrategy.init() for two reasons:
|
|
119
|
+
* 1. The viewport size is needed for features like zoomToFit on init
|
|
120
|
+
* 2. At this point, no onChange callbacks are registered yet, so updateMetadata won't trigger events
|
|
121
|
+
*
|
|
122
|
+
* Without this, the ResizeObserver might not fire on reinitialization,
|
|
123
|
+
* leaving viewport.width/height as undefined.
|
|
124
|
+
*/
|
|
125
|
+
initializeViewportSize() {
|
|
126
|
+
const { width, height } = this.getViewportSize();
|
|
127
|
+
if (width > 0 && height > 0) {
|
|
128
|
+
const currentMetadata = this.model.getMetadata();
|
|
129
|
+
this.model.updateMetadata({
|
|
130
|
+
...currentMetadata,
|
|
131
|
+
viewport: {
|
|
132
|
+
...currentMetadata.viewport,
|
|
133
|
+
width,
|
|
134
|
+
height
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Gets the current model that flow core is using
|
|
141
|
+
*/
|
|
142
|
+
get model() {
|
|
143
|
+
return this._model;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Gets the current environment information
|
|
147
|
+
*/
|
|
148
|
+
getEnvironment() {
|
|
149
|
+
return this.environment;
|
|
150
|
+
}
|
|
151
|
+
get config() {
|
|
152
|
+
return this._config;
|
|
153
|
+
}
|
|
154
|
+
updateConfig(updatedConfig) {
|
|
155
|
+
this._config = deepMerge(this._config, updatedConfig);
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Registers a new middleware in the chain
|
|
159
|
+
* @param middleware Middleware to register
|
|
160
|
+
* @returns Function to unregister the middleware
|
|
161
|
+
*/
|
|
162
|
+
registerMiddleware(middleware) {
|
|
163
|
+
return this.middlewareManager.register(middleware);
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Unregister a middleware from the chain
|
|
167
|
+
* @param name Name of the middleware to unregister
|
|
168
|
+
*/
|
|
169
|
+
unregisterMiddleware(name) {
|
|
170
|
+
this.middlewareManager.unregister(name);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Gets the current state of the flow
|
|
174
|
+
*/
|
|
175
|
+
getState() {
|
|
176
|
+
return {
|
|
177
|
+
nodes: this.model.getNodes(),
|
|
178
|
+
edges: this.model.getEdges(),
|
|
179
|
+
metadata: this.model.getMetadata()
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Gets the active render strategy based on virtualization config.
|
|
184
|
+
* When virtualization is enabled, uses VirtualizedRenderStrategy.
|
|
185
|
+
* When disabled, uses DirectRenderStrategy.
|
|
186
|
+
*/
|
|
187
|
+
get renderStrategy() {
|
|
188
|
+
return this.isVirtualizationActive ? this.virtualizedRenderStrategy : this.directRenderStrategy;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Sets the current state of the flow
|
|
192
|
+
* @param state State to set
|
|
193
|
+
*/
|
|
194
|
+
setState(state) {
|
|
195
|
+
this.model.updateNodes(state.nodes);
|
|
196
|
+
this.model.updateEdges(state.edges);
|
|
197
|
+
this.model.updateMetadata(state.metadata);
|
|
198
|
+
this.modelLookup.desynchronize();
|
|
199
|
+
}
|
|
200
|
+
async transaction(nameOrCallback, callbackOrOptions, options) {
|
|
201
|
+
let results;
|
|
202
|
+
let transactionOptions;
|
|
203
|
+
if (typeof nameOrCallback === "function") {
|
|
204
|
+
transactionOptions = callbackOrOptions;
|
|
205
|
+
} else {
|
|
206
|
+
transactionOptions = options;
|
|
207
|
+
}
|
|
208
|
+
if (transactionOptions?.waitForMeasurements && this.transactionManager.isActive()) {
|
|
209
|
+
console.warn(
|
|
210
|
+
"[ngDiagram] waitForMeasurements is ignored on a nested transaction \u2014 its updates are applied (and measured) only when the root transaction commits. Pass the option to the root transaction instead."
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
if (typeof nameOrCallback === "function") {
|
|
214
|
+
results = await this.transactionManager.transaction(nameOrCallback, transactionOptions ?? {});
|
|
215
|
+
} else {
|
|
216
|
+
const callback = callbackOrOptions;
|
|
217
|
+
if (!callback) {
|
|
218
|
+
throw new Error("Callback is required when transaction name is provided");
|
|
219
|
+
}
|
|
220
|
+
results = await this.transactionManager.transaction(nameOrCallback, callback, transactionOptions ?? {});
|
|
221
|
+
}
|
|
222
|
+
let measurementTracking = null;
|
|
223
|
+
if (results.commandsCount > 0) {
|
|
224
|
+
if (transactionOptions?.waitForMeasurements) {
|
|
225
|
+
const internalOptions = transactionOptions;
|
|
226
|
+
measurementTracking = {
|
|
227
|
+
discoveryWindowMs: internalOptions._measurementDiscoveryWindowTimeout,
|
|
228
|
+
debounceMs: internalOptions._measurementDebounceTimeout
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
await this.applyUpdateToModel(results.results, results.actionTypes, measurementTracking);
|
|
232
|
+
}
|
|
233
|
+
if (measurementTracking) {
|
|
234
|
+
await this.measurementTracker.waitForMeasurements();
|
|
235
|
+
}
|
|
236
|
+
return results;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Applies an update to the flow state
|
|
240
|
+
* @param stateUpdate Partial state to apply
|
|
241
|
+
* @param modelActionTypes Action type(s) that triggered this update. Can be a single type or an array of types (from transactions).
|
|
242
|
+
*/
|
|
243
|
+
async applyUpdate(stateUpdate, modelActionTypes) {
|
|
244
|
+
const actionTypesArray = Array.isArray(modelActionTypes) ? modelActionTypes : [modelActionTypes];
|
|
245
|
+
if (this.transactionManager.isActive()) {
|
|
246
|
+
this.transactionManager.queueUpdate(stateUpdate, actionTypesArray);
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
return this.applyUpdateToModel(stateUpdate, actionTypesArray);
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Runs an update through the middleware chain and commits it to the model,
|
|
253
|
+
* bypassing the active-transaction routing in `applyUpdate`.
|
|
254
|
+
*/
|
|
255
|
+
async applyUpdateToModel(stateUpdate, modelActionTypes, measurementTracking = null) {
|
|
256
|
+
const actionTypesArray = Array.isArray(modelActionTypes) ? modelActionTypes : [modelActionTypes];
|
|
257
|
+
await this.updateSemaphore.acquire();
|
|
258
|
+
try {
|
|
259
|
+
if (measurementTracking) {
|
|
260
|
+
this.measurementTracker.requestTracking(measurementTracking);
|
|
261
|
+
}
|
|
262
|
+
const currentState = this.getState();
|
|
263
|
+
const finalState = await this.middlewareManager.execute(currentState, stateUpdate, actionTypesArray);
|
|
264
|
+
if (finalState) {
|
|
265
|
+
this.setState(finalState);
|
|
266
|
+
this.eventManager.flushDeferredEmits();
|
|
267
|
+
} else {
|
|
268
|
+
this.eventManager.clearDeferredEmits();
|
|
269
|
+
}
|
|
270
|
+
} finally {
|
|
271
|
+
if (measurementTracking && this.measurementTracker.isTrackingRequested()) {
|
|
272
|
+
this.measurementTracker.cancelTrackingRequest();
|
|
273
|
+
}
|
|
274
|
+
this.updateSemaphore.release();
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Opens an out-of-band measurement round (used by `invalidateMeasurements`) and
|
|
279
|
+
* resolves once the triggered measurements settle.
|
|
280
|
+
*/
|
|
281
|
+
async trackMeasurements(entityIds) {
|
|
282
|
+
await this.updateSemaphore.acquire();
|
|
283
|
+
try {
|
|
284
|
+
this.measurementTracker.trackParticipants(entityIds);
|
|
285
|
+
} finally {
|
|
286
|
+
this.updateSemaphore.release();
|
|
287
|
+
}
|
|
288
|
+
return this.measurementTracker.waitForMeasurements();
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Fast-path for viewport-only updates (panning/zooming).
|
|
292
|
+
* Bypasses middleware chain and only updates viewport metadata.
|
|
293
|
+
* Use this for high-frequency viewport changes where middleware processing is unnecessary.
|
|
294
|
+
*/
|
|
295
|
+
applyViewportOnlyUpdate(viewportUpdate) {
|
|
296
|
+
const currentMetadata = this.model.getMetadata();
|
|
297
|
+
const currentViewport = currentMetadata.viewport;
|
|
298
|
+
const newViewport = { ...currentViewport, ...viewportUpdate };
|
|
299
|
+
if (newViewport.x === currentViewport.x && newViewport.y === currentViewport.y && newViewport.scale === currentViewport.scale) {
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
this.model.updateMetadata({
|
|
303
|
+
...currentMetadata,
|
|
304
|
+
viewport: newViewport
|
|
305
|
+
});
|
|
306
|
+
this.eventManager.emit("viewportChanged", {
|
|
307
|
+
viewport: newViewport,
|
|
308
|
+
previousViewport: currentViewport
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Converts a client position to a flow position
|
|
313
|
+
* @param clientPosition Client position
|
|
314
|
+
* @returns { x: number, y: number } Flow position
|
|
315
|
+
*/
|
|
316
|
+
clientToFlowPosition(clientPosition) {
|
|
317
|
+
const { x: viewportX, y: viewportY, scale } = this.model.getMetadata().viewport;
|
|
318
|
+
const { x: flowOffsetX, y: flowOffsetY } = this.getFlowOffset();
|
|
319
|
+
return {
|
|
320
|
+
x: (clientPosition.x - viewportX - flowOffsetX) / scale,
|
|
321
|
+
y: (clientPosition.y - viewportY - flowOffsetY) / scale
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Converts a flow position to a client position
|
|
326
|
+
* @param flowPosition Flow position
|
|
327
|
+
* @returns { x: number, y: number } Client position
|
|
328
|
+
*/
|
|
329
|
+
flowToClientPosition(flowPosition) {
|
|
330
|
+
const { x: viewportX, y: viewportY, scale } = this.model.getMetadata().viewport;
|
|
331
|
+
const { x: flowOffsetX, y: flowOffsetY } = this.getFlowOffset();
|
|
332
|
+
return {
|
|
333
|
+
x: flowPosition.x * scale + viewportX + flowOffsetX,
|
|
334
|
+
y: flowPosition.y * scale + viewportY + flowOffsetY
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Converts a client position to a position relative to the flow viewport
|
|
339
|
+
* @param clientPosition Client position
|
|
340
|
+
* @returns position on the flow viewport
|
|
341
|
+
*/
|
|
342
|
+
clientToFlowViewportPosition(clientPosition) {
|
|
343
|
+
const { x: flowOffsetX, y: flowOffsetY } = this.getFlowOffset();
|
|
344
|
+
return {
|
|
345
|
+
x: clientPosition.x - flowOffsetX,
|
|
346
|
+
y: clientPosition.y - flowOffsetY
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Gets a node by id
|
|
351
|
+
* @param nodeId Node id
|
|
352
|
+
* @returns Node
|
|
353
|
+
*/
|
|
354
|
+
getNodeById(nodeId) {
|
|
355
|
+
return this.modelLookup.getNodeById(nodeId);
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Gets an edge by id
|
|
359
|
+
* @param edgeId Edge id
|
|
360
|
+
* @returns Edge
|
|
361
|
+
*/
|
|
362
|
+
getEdgeById(edgeId) {
|
|
363
|
+
return this.modelLookup.getEdgeById(edgeId);
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Registers a cleanup for the gesture that is starting; it runs when
|
|
367
|
+
* {@link cancelActiveInteraction} aborts the gesture. The caller must
|
|
368
|
+
* unregister it in its own normal teardown, or stale cleanups accumulate.
|
|
369
|
+
*
|
|
370
|
+
* @returns Function that unregisters the callback
|
|
371
|
+
*/
|
|
372
|
+
registerInteractionCleanup(cleanup) {
|
|
373
|
+
return this.interactionCoordinator.registerInteractionCleanup(cleanup);
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Whether {@link cancelActiveInteraction} is mid-flight — its rollback has
|
|
377
|
+
* not committed yet, so input read now could capture geometry it is about
|
|
378
|
+
* to rewrite.
|
|
379
|
+
*/
|
|
380
|
+
isCancellingInteraction() {
|
|
381
|
+
return this.interactionCoordinator.isCancellingInteraction();
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* Whether an interactive gesture (linking, dragging, resizing, rotating,
|
|
385
|
+
* panning) is currently in progress, or a gesture's listener cleanup is
|
|
386
|
+
* still registered.
|
|
387
|
+
*/
|
|
388
|
+
hasActiveInteraction() {
|
|
389
|
+
return this.interactionCoordinator.hasActiveInteraction();
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Aborts the in-progress gesture (linking, drag, resize, rotate or pan):
|
|
393
|
+
* removes its listeners, restores the state it modified (the viewport is
|
|
394
|
+
* not rolled back) and fires the "ended" event with the `cancelled` reason.
|
|
395
|
+
* No-op when nothing is active, when the gesture is already completing, or
|
|
396
|
+
* while a transaction is active (refused with a console warning).
|
|
397
|
+
*
|
|
398
|
+
* @returns Whether any gesture or registered cleanup was torn down
|
|
399
|
+
*/
|
|
400
|
+
cancelActiveInteraction() {
|
|
401
|
+
return this.interactionCoordinator.cancelActiveInteraction();
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Gets all nodes in a range from a point
|
|
405
|
+
* @param point Point to check from
|
|
406
|
+
* @param range Range to check in
|
|
407
|
+
* @returns Array of nodes in range
|
|
408
|
+
*/
|
|
409
|
+
getNodesInRange(point, range) {
|
|
410
|
+
return getNodesInRange(this, point, range);
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Gets the nearest node in a range from a point
|
|
414
|
+
* @param point Point to check from
|
|
415
|
+
* @param range Range to check in
|
|
416
|
+
* @returns Nearest node in range or null
|
|
417
|
+
*/
|
|
418
|
+
getNearestNodeInRange(point, range) {
|
|
419
|
+
return getNearestNodeInRange(this, point, range);
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Gets the nearest port in a range from a point
|
|
423
|
+
* @param point Point to check from
|
|
424
|
+
* @param range Range to check in
|
|
425
|
+
* @returns Nearest port in range or null
|
|
426
|
+
*/
|
|
427
|
+
getNearestPortInRange(point, range) {
|
|
428
|
+
return getNearestPortInRange(this, point, range);
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Gets all edges connected to a node
|
|
432
|
+
* @param nodeId Node id
|
|
433
|
+
* @returns Array of edges where the node is either source or target
|
|
434
|
+
*/
|
|
435
|
+
getConnectedEdges(nodeId) {
|
|
436
|
+
return this.modelLookup.getConnectedEdges(nodeId);
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Gets all nodes connected to a node via edges
|
|
440
|
+
* @param nodeId Node id
|
|
441
|
+
* @returns Array of nodes connected to the given node
|
|
442
|
+
*/
|
|
443
|
+
getConnectedNodes(nodeId) {
|
|
444
|
+
return this.modelLookup.getConnectedNodes(nodeId);
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* Gets the source and target nodes of an edge
|
|
448
|
+
* @param edgeId Edge id
|
|
449
|
+
* @returns Object containing source and target nodes, or null if edge doesn't exist
|
|
450
|
+
*/
|
|
451
|
+
getNodeEnds(edgeId) {
|
|
452
|
+
return this.modelLookup.getNodeEnds(edgeId);
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Gets all children nodes for a given group node id
|
|
456
|
+
* @param groupId group node id
|
|
457
|
+
* @returns Array of child nodes
|
|
458
|
+
*/
|
|
459
|
+
getChildren(groupId) {
|
|
460
|
+
return this.modelLookup.getChildren(groupId);
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* Gets all nested children (descendants) of a group node
|
|
464
|
+
* @param groupId Group node id
|
|
465
|
+
* @returns Array of all descendant nodes (children, grandchildren, etc.)
|
|
466
|
+
*/
|
|
467
|
+
getChildrenNested(groupId) {
|
|
468
|
+
return this.modelLookup.getAllDescendants(groupId);
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Checks if a node is a nested child (descendant) of a group node
|
|
472
|
+
* @param nodeId Node id
|
|
473
|
+
* @param groupId Group node id
|
|
474
|
+
* @returns True if the node is part of the group's nested subgraph
|
|
475
|
+
*/
|
|
476
|
+
isNestedChild(nodeId, groupId) {
|
|
477
|
+
return this.modelLookup.isNodeDescendantOfGroup(nodeId, groupId);
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* Gets the full chain of parent group Nodes for a given nodeId.
|
|
481
|
+
* @param nodeId Node id
|
|
482
|
+
* @returns Array of parent group Node objects, from closest parent to farthest ancestor
|
|
483
|
+
*/
|
|
484
|
+
getParentHierarchy(nodeId) {
|
|
485
|
+
return this.modelLookup.getParentChain(nodeId);
|
|
486
|
+
}
|
|
487
|
+
getOverlappingNodes(nodeOrId) {
|
|
488
|
+
return getOverlappingNodes(this, nodeOrId);
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* Checks if a node is currently rendered (visible in viewport).
|
|
492
|
+
* In direct mode, always returns true. In virtualized mode, checks if the node
|
|
493
|
+
* is in the current set of visible nodes.
|
|
494
|
+
*
|
|
495
|
+
* @param nodeId Node id to check
|
|
496
|
+
* @returns True if the node is currently rendered
|
|
497
|
+
*/
|
|
498
|
+
isNodeCurrentlyRendered(nodeId) {
|
|
499
|
+
return this.renderStrategy.isNodeRendered(nodeId);
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Returns the current zoom scale
|
|
503
|
+
*/
|
|
504
|
+
getScale() {
|
|
505
|
+
return this.model.getMetadata().viewport.scale;
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* Returns the current viewport
|
|
509
|
+
*/
|
|
510
|
+
getViewport() {
|
|
511
|
+
return this.model.getMetadata().viewport;
|
|
512
|
+
}
|
|
513
|
+
get updater() {
|
|
514
|
+
return this.initUpdater.isInitialized ? this.internalUpdater : this.initUpdater;
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* Returns true if the diagram has completed its initialization phase.
|
|
518
|
+
*/
|
|
519
|
+
get isInitialized() {
|
|
520
|
+
return this.initUpdater.isInitialized;
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* Returns true if virtualization is enabled.
|
|
524
|
+
*/
|
|
525
|
+
get isVirtualizationActive() {
|
|
526
|
+
return this.config.virtualization.enabled;
|
|
527
|
+
}
|
|
528
|
+
setDebugMode(debugMode) {
|
|
529
|
+
if (debugMode) {
|
|
530
|
+
window.flowCore = this;
|
|
531
|
+
if (!this.middlewareManager.isRegistered(loggerMiddleware.name)) {
|
|
532
|
+
this.registerMiddleware(loggerMiddleware);
|
|
533
|
+
}
|
|
534
|
+
} else {
|
|
535
|
+
delete window.flowCore;
|
|
536
|
+
this.unregisterMiddleware(loggerMiddleware.name);
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
export { FlowCore };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { getNodesInRect } from '../../../spatial-hash/utils.mjs';
|
|
2
|
+
import { EventHandler } from '../event-handler.mjs';
|
|
3
|
+
|
|
4
|
+
class BoxSelectionEventHandler extends EventHandler {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
this.isBoxSelecting = false;
|
|
8
|
+
}
|
|
9
|
+
handle(event) {
|
|
10
|
+
switch (event.phase) {
|
|
11
|
+
case "start": {
|
|
12
|
+
this.startPoint = event.lastInputPoint;
|
|
13
|
+
this.isBoxSelecting = true;
|
|
14
|
+
break;
|
|
15
|
+
}
|
|
16
|
+
case "continue": {
|
|
17
|
+
if (!this.isBoxSelecting || !this.flow.config.boxSelection.realtime) {
|
|
18
|
+
break;
|
|
19
|
+
}
|
|
20
|
+
this.boxSelect(event);
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
case "end": {
|
|
24
|
+
if (!this.isBoxSelecting) {
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
this.boxSelect(event);
|
|
28
|
+
this.flow.commandHandler.emit("selectEnd");
|
|
29
|
+
this.startPoint = void 0;
|
|
30
|
+
this.isBoxSelecting = false;
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
boxSelect(event) {
|
|
36
|
+
if (!this.startPoint) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const lastPoint = event.lastInputPoint;
|
|
40
|
+
const { x: startX, y: startY } = this.flow.clientToFlowPosition(this.startPoint);
|
|
41
|
+
const { x: lastX, y: lastY } = this.flow.clientToFlowPosition(lastPoint);
|
|
42
|
+
const x = Math.min(startX, lastX);
|
|
43
|
+
const y = Math.min(startY, lastY);
|
|
44
|
+
const width = Math.abs(lastX - startX);
|
|
45
|
+
const height = Math.abs(lastY - startY);
|
|
46
|
+
const rect = {
|
|
47
|
+
x,
|
|
48
|
+
y,
|
|
49
|
+
width,
|
|
50
|
+
height
|
|
51
|
+
};
|
|
52
|
+
const edges = this.flow.model.getEdges();
|
|
53
|
+
const nodeIds = new Set(
|
|
54
|
+
getNodesInRect(this.flow, rect, this.flow.config.boxSelection.partialInclusion).map((node) => node.id)
|
|
55
|
+
);
|
|
56
|
+
const isPointInRect = (point) => !!point && point.x >= rect.x && point.x <= rect.x + rect.width && point.y >= rect.y && point.y <= rect.y + rect.height;
|
|
57
|
+
const isEndpointInBox = (nodeId, position) => nodeId ? nodeIds.has(nodeId) : isPointInRect(position);
|
|
58
|
+
const edgesBetweenIds = edges.filter(
|
|
59
|
+
(edge) => !edge.computedHidden && isEndpointInBox(edge.source, edge.sourcePosition) && isEndpointInBox(edge.target, edge.targetPosition)
|
|
60
|
+
).map((edge) => edge.id);
|
|
61
|
+
this.flow.commandHandler.emit("select", {
|
|
62
|
+
nodeIds: [...nodeIds],
|
|
63
|
+
edgeIds: edgesBetweenIds,
|
|
64
|
+
multiSelection: false
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export { BoxSelectionEventHandler };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
class EventHandler {
|
|
2
|
+
constructor(flow) {
|
|
3
|
+
this.flow = flow;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Claims the teardown of the gesture owning `state`, so a racing cancel()
|
|
7
|
+
* (or a second one) no-ops. Requires one state object per gesture lifetime —
|
|
8
|
+
* linking stamps its replaced state instead, drag uses `DragGesture.ended`.
|
|
9
|
+
*/
|
|
10
|
+
claimTeardown(state) {
|
|
11
|
+
this.claimedTeardownState = state;
|
|
12
|
+
}
|
|
13
|
+
/** Whether `state`'s teardown was already claimed by an in-flight end or cancel. */
|
|
14
|
+
isTeardownClaimed(state) {
|
|
15
|
+
return state !== void 0 && state === this.claimedTeardownState;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Aborts the tracked gesture without the side effects of a normal `end`
|
|
19
|
+
* (no edge creation, no group drop). Default: no-op.
|
|
20
|
+
*
|
|
21
|
+
* @returns Whether anything was torn down — `false` when there is no gesture
|
|
22
|
+
* or its teardown is already claimed by an in-flight end or cancel.
|
|
23
|
+
*/
|
|
24
|
+
cancel() {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { EventHandler };
|