@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.
- package/README.md +58 -0
- package/THIRD_PARTY_NOTICES.md +220 -0
- package/dist/components/alert/alert.component.mjs +13 -10
- package/dist/components/animation/animation.component.mjs +3 -2
- package/dist/components/autocomplete/autocomplete.component.mjs +21 -20
- package/dist/components/avatar/avatar.component.mjs +10 -12
- 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 +15 -14
- package/dist/components/busy-overlay/busy-overlay.component.mjs +3 -0
- package/dist/components/button/button.component.mjs +7 -3
- package/dist/components/button/button.styles.mjs +5 -5
- package/dist/components/button-group/button-group.component.mjs +1 -0
- package/dist/components/calendar/calendar.component.mjs +29 -6
- package/dist/components/card/card.component.mjs +5 -4
- package/dist/components/carousel/carousel.component.mjs +45 -42
- package/dist/components/carousel-item/carousel-item.component.mjs +2 -0
- package/dist/components/chart/chart.component.mjs +5 -4
- package/dist/components/chart/chartjs-plugins/luxon.adapter.mjs +78 -0
- package/dist/components/chart/chartjs-plugins/plugin.flow-ui-colors.mjs +1 -1
- package/dist/components/chart/chartjs-support.mjs +2 -0
- package/dist/components/checkbox/checkbox.component.mjs +21 -18
- package/dist/components/checkbox-group/checkbox-group.component.mjs +3 -0
- package/dist/components/color-mapper/color-mapper.component.mjs +27 -6
- package/dist/components/color-picker/color-picker.component.mjs +79 -71
- package/dist/components/color-picker/color-picker.styles.mjs +4 -2
- package/dist/components/color-stop/color-stop.component.mjs +19 -2
- package/dist/components/date-time-picker/date-time-picker.component.mjs +35 -29
- 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 +68 -0
- package/dist/components/dialog/dialog.component.mjs +5 -1
- package/dist/components/divider/divider.component.mjs +1 -0
- package/dist/components/drawer/drawer.component.mjs +22 -19
- 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 +10 -2
- package/dist/components/icon/icon.component.mjs +1 -0
- package/dist/components/icon/library.mjs +7 -4
- 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 +21 -11
- package/dist/components/list/list.component.mjs +1 -0
- package/dist/components/list-item/list-item.component.mjs +34 -17
- 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 +5 -6
- 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 +14 -8
- package/dist/components/popup/popup.component.mjs +12 -11
- package/dist/components/progress-bar/progress-bar.component.mjs +3 -2
- package/dist/components/progress-ring/progress-ring.component.mjs +1 -0
- package/dist/components/query-builder/converters/javascript-filter-converter.mjs +0 -4
- package/dist/components/query-builder/converters/map-layer-filter-converter.mjs +0 -4
- package/dist/components/query-builder/query-builder.component.mjs +42 -15
- package/dist/components/radio/radio.component.mjs +10 -7
- package/dist/components/radio-group/radio-group.component.mjs +4 -1
- package/dist/components/range/range.component.mjs +4 -0
- package/dist/components/resize-observer/resize-observer.component.mjs +2 -1
- package/dist/components/scroll-view/scroll-view.component.mjs +1 -0
- package/dist/components/scroll-view/scroll-view.styles.mjs +20 -7
- package/dist/components/select/select.component.mjs +19 -21
- 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/split-view-toggle-button/split-view-toggle-button.styles.mjs +3 -3
- package/dist/components/stepper/stepper.component.mjs +3 -2
- package/dist/components/stepper-panel/stepper-panel.component.mjs +4 -3
- package/dist/components/switch/switch.component.mjs +9 -8
- package/dist/components/tab/tab.component.mjs +21 -17
- package/dist/components/tab-group/tab-group.component.mjs +218 -44
- 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 +13 -12
- package/dist/components/textarea/textarea.component.mjs +11 -4
- 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 +5 -2
- 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 +7890 -1741
- 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 +13296 -3667
- package/dist/index.d.ts +13296 -3667
- 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/internal/form.mjs +1 -1
- package/dist/internal/on-off-converter.mjs +21 -0
- package/dist/package.json.mjs +1 -1
- package/dist/utilities/register-components.mjs +77 -142
- package/dist/vscode.html-custom-data.json +426 -156
- package/package.json +35 -40
- package/themes/dark.css +7 -5
- package/themes/dark.styles.js +7 -5
- package/themes/light.css +7 -5
- package/themes/light.styles.js +7 -5
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { DiagramInputController } from '../input/input-controller.mjs';
|
|
2
|
+
import { minimapToDiagramPoint } from './minimap-calculations.mjs';
|
|
3
|
+
|
|
4
|
+
class MinimapNavigationController extends DiagramInputController {
|
|
5
|
+
constructor(host, getRuntime, source) {
|
|
6
|
+
super(host, getRuntime);
|
|
7
|
+
this.source = source;
|
|
8
|
+
this.isDragging = false;
|
|
9
|
+
this.lastPosition = { x: 0, y: 0 };
|
|
10
|
+
this.pointerId = null;
|
|
11
|
+
/** Kept so the cancel path can release the capture without an event. */
|
|
12
|
+
this.captureElement = null;
|
|
13
|
+
this.unregisterInteractionCleanup = null;
|
|
14
|
+
this.onPointerMove = (event) => {
|
|
15
|
+
if (!this.isDragging) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const delta = { x: event.clientX - this.lastPosition.x, y: event.clientY - this.lastPosition.y };
|
|
19
|
+
this.lastPosition = { x: event.clientX, y: event.clientY };
|
|
20
|
+
const { scale: minimapScale } = this.source.getTransform();
|
|
21
|
+
const { scale: viewportScale } = this.source.getViewport();
|
|
22
|
+
const sizeRatio = this.clientToMinimapRatio();
|
|
23
|
+
const dx = -(delta.x * sizeRatio.x / minimapScale) * viewportScale;
|
|
24
|
+
const dy = -(delta.y * sizeRatio.y / minimapScale) * viewportScale;
|
|
25
|
+
if (dx || dy) {
|
|
26
|
+
void this.runtimeWithCore?.flowCore.commandHandler.emit("moveViewportBy", { x: dx, y: dy });
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
this.onPointerUp = () => {
|
|
30
|
+
if (this.runtimeWithCore) {
|
|
31
|
+
this.setPanningState(false);
|
|
32
|
+
}
|
|
33
|
+
this.removeListeners();
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/** Whether a drag is in progress. */
|
|
37
|
+
get active() {
|
|
38
|
+
return this.isDragging;
|
|
39
|
+
}
|
|
40
|
+
onPointerDown(event) {
|
|
41
|
+
if (event.button !== 0 || this.isDragging) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const core = this.runtimeWithCore;
|
|
45
|
+
if (!core) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
event.preventDefault();
|
|
49
|
+
event.stopPropagation();
|
|
50
|
+
this.capturePointer(event);
|
|
51
|
+
this.isDragging = true;
|
|
52
|
+
this.lastPosition = { x: event.clientX, y: event.clientY };
|
|
53
|
+
this.setPanningState(true);
|
|
54
|
+
this.attachDocumentListeners();
|
|
55
|
+
this.unregisterInteractionCleanup = core.flowCore.registerInteractionCleanup(() => this.removeListeners());
|
|
56
|
+
this.jumpIfOutsideViewport(event);
|
|
57
|
+
}
|
|
58
|
+
destroy() {
|
|
59
|
+
if (this.isDragging && this.runtimeWithCore) {
|
|
60
|
+
this.setPanningState(false);
|
|
61
|
+
}
|
|
62
|
+
this.removeListeners();
|
|
63
|
+
}
|
|
64
|
+
/** Centers the viewport on the pressed point when the press is outside the viewport rectangle. */
|
|
65
|
+
jumpIfOutsideViewport(event) {
|
|
66
|
+
const point = this.minimapPoint(event);
|
|
67
|
+
if (!point) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const rect = this.source.getViewportRect();
|
|
71
|
+
const inside = point.x >= rect.x && point.x <= rect.x + rect.width && point.y >= rect.y && point.y <= rect.y + rect.height;
|
|
72
|
+
if (inside) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const viewport = this.source.getViewport();
|
|
76
|
+
const target = minimapToDiagramPoint(point, this.source.getTransform());
|
|
77
|
+
const x = (viewport.width ?? 0) / 2 - target.x * viewport.scale;
|
|
78
|
+
const y = (viewport.height ?? 0) / 2 - target.y * viewport.scale;
|
|
79
|
+
void this.runtimeWithCore?.flowCore.commandHandler.emit("moveViewport", { x, y });
|
|
80
|
+
}
|
|
81
|
+
/** The pointer position in minimap coordinates, from the pressed SVG's client rect. */
|
|
82
|
+
minimapPoint(event) {
|
|
83
|
+
const element = event.currentTarget;
|
|
84
|
+
if (!element || typeof element.getBoundingClientRect !== "function") {
|
|
85
|
+
return void 0;
|
|
86
|
+
}
|
|
87
|
+
const rect = element.getBoundingClientRect();
|
|
88
|
+
if (!rect.width || !rect.height) {
|
|
89
|
+
return void 0;
|
|
90
|
+
}
|
|
91
|
+
const { width, height } = this.source.getSize();
|
|
92
|
+
return {
|
|
93
|
+
x: (event.clientX - rect.left) * width / rect.width,
|
|
94
|
+
y: (event.clientY - rect.top) * height / rect.height
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/** Minimap units per client pixel (1 unless the minimap is scaled by CSS). */
|
|
98
|
+
clientToMinimapRatio() {
|
|
99
|
+
const rect = this.captureElement?.getBoundingClientRect?.();
|
|
100
|
+
const { width, height } = this.source.getSize();
|
|
101
|
+
if (!rect || !rect.width || !rect.height) {
|
|
102
|
+
return { x: 1, y: 1 };
|
|
103
|
+
}
|
|
104
|
+
return { x: width / rect.width, y: height / rect.height };
|
|
105
|
+
}
|
|
106
|
+
removeListeners() {
|
|
107
|
+
this.unregisterInteractionCleanup?.();
|
|
108
|
+
this.unregisterInteractionCleanup = null;
|
|
109
|
+
this.isDragging = false;
|
|
110
|
+
this.releasePointer();
|
|
111
|
+
this.removeDocumentListeners();
|
|
112
|
+
}
|
|
113
|
+
capturePointer(event) {
|
|
114
|
+
const target = event.currentTarget ?? event.target;
|
|
115
|
+
target.setPointerCapture?.(event.pointerId);
|
|
116
|
+
this.pointerId = event.pointerId;
|
|
117
|
+
this.captureElement = target;
|
|
118
|
+
}
|
|
119
|
+
releasePointer() {
|
|
120
|
+
const { captureElement, pointerId } = this;
|
|
121
|
+
if (captureElement && pointerId !== null && captureElement.hasPointerCapture?.(pointerId)) {
|
|
122
|
+
captureElement.releasePointerCapture(pointerId);
|
|
123
|
+
}
|
|
124
|
+
this.pointerId = null;
|
|
125
|
+
this.captureElement = null;
|
|
126
|
+
}
|
|
127
|
+
attachDocumentListeners() {
|
|
128
|
+
document.addEventListener("pointermove", this.onPointerMove);
|
|
129
|
+
document.addEventListener("pointerup", this.onPointerUp);
|
|
130
|
+
document.addEventListener("pointercancel", this.onPointerUp);
|
|
131
|
+
}
|
|
132
|
+
removeDocumentListeners() {
|
|
133
|
+
document.removeEventListener("pointermove", this.onPointerMove);
|
|
134
|
+
document.removeEventListener("pointerup", this.onPointerUp);
|
|
135
|
+
document.removeEventListener("pointercancel", this.onPointerUp);
|
|
136
|
+
}
|
|
137
|
+
setPanningState(active) {
|
|
138
|
+
const actionStateManager = this.runtimeWithCore?.flowCore.actionStateManager;
|
|
139
|
+
if (!actionStateManager) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
if (active) {
|
|
143
|
+
actionStateManager.panning = { active: true };
|
|
144
|
+
} else {
|
|
145
|
+
actionStateManager.clearPanning();
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export { MinimapNavigationController };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
class MinimapNodeCache {
|
|
2
|
+
constructor() {
|
|
3
|
+
this.cache = /* @__PURE__ */ new WeakMap();
|
|
4
|
+
}
|
|
5
|
+
clear() {
|
|
6
|
+
this.cache = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
}
|
|
8
|
+
getOrCompute(node, compute) {
|
|
9
|
+
const cached = this.cache.get(node);
|
|
10
|
+
if (cached) {
|
|
11
|
+
return cached;
|
|
12
|
+
}
|
|
13
|
+
const data = compute();
|
|
14
|
+
this.cache.set(node, data);
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { MinimapNodeCache };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { calculatePartsBounds } from '../../diagram-core/utils/dimensions.mjs';
|
|
2
|
+
import { extractNodeBounds, calculateBoundsFromPositions } from './minimap-calculations.mjs';
|
|
3
|
+
import { MinimapNodeCache } from './minimap-node-cache.mjs';
|
|
4
|
+
|
|
5
|
+
const ZERO_RECT = { x: 0, y: 0, width: 0, height: 0 };
|
|
6
|
+
class DirectMinimapStrategy {
|
|
7
|
+
/** @param getNodes - The rendered nodes (`runtime.renderer.nodes.value`). */
|
|
8
|
+
constructor(getNodes) {
|
|
9
|
+
this.getNodes = getNodes;
|
|
10
|
+
this.cache = new MinimapNodeCache();
|
|
11
|
+
}
|
|
12
|
+
computeMinimapNodes(styleFn, templates) {
|
|
13
|
+
if (styleFn !== this.lastStyleFn || templates !== this.lastTemplates) {
|
|
14
|
+
this.cache.clear();
|
|
15
|
+
this.lastStyleFn = styleFn;
|
|
16
|
+
this.lastTemplates = templates;
|
|
17
|
+
}
|
|
18
|
+
return this.getNodes().filter((node) => !node.computedHidden).map(
|
|
19
|
+
(node) => this.cache.getOrCompute(node, () => ({
|
|
20
|
+
bounds: extractNodeBounds(node),
|
|
21
|
+
diagramNode: node,
|
|
22
|
+
nodeStyle: styleFn?.(node) ?? {},
|
|
23
|
+
template: templates(node.type)
|
|
24
|
+
}))
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
computeDiagramBounds() {
|
|
28
|
+
return calculatePartsBounds(this.getNodes(), []) ?? ZERO_RECT;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
class VirtualizedMinimapStrategy {
|
|
32
|
+
/** @param getModelNodes - Every node in the model. */
|
|
33
|
+
constructor(getModelNodes) {
|
|
34
|
+
this.getModelNodes = getModelNodes;
|
|
35
|
+
}
|
|
36
|
+
computeMinimapNodes() {
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
computeDiagramBounds() {
|
|
40
|
+
return calculateBoundsFromPositions(this.getModelNodes());
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { DirectMinimapStrategy, VirtualizedMinimapStrategy };
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { stripNodeRuntimeProperties, stripEdgeRuntimeProperties } from './strip-runtime-properties.mjs';
|
|
2
|
+
|
|
3
|
+
const initialMetadata = () => ({ viewport: { x: 0, y: 0, scale: 1 } });
|
|
4
|
+
class DefaultDiagramModelAdapter {
|
|
5
|
+
constructor() {
|
|
6
|
+
/**
|
|
7
|
+
* Strips runtime-computed properties from nodes in `toJSON()`. Replacing it to keep runtime properties will
|
|
8
|
+
* probably break the diagram when the data is loaded back. Set it through `initializeModel` options.
|
|
9
|
+
*/
|
|
10
|
+
this.stripNodeRuntimeProperties = stripNodeRuntimeProperties;
|
|
11
|
+
/** Strips runtime-computed properties from edges in `toJSON()`. See `stripNodeRuntimeProperties`. */
|
|
12
|
+
this.stripEdgeRuntimeProperties = stripEdgeRuntimeProperties;
|
|
13
|
+
this.nodes = [];
|
|
14
|
+
this.edges = [];
|
|
15
|
+
this.metadata = initialMetadata();
|
|
16
|
+
this.callbacks = [];
|
|
17
|
+
this.notificationScheduled = false;
|
|
18
|
+
/** Bumped by `destroy()` so a notification queued before it is dropped. */
|
|
19
|
+
this.generation = 0;
|
|
20
|
+
}
|
|
21
|
+
destroy() {
|
|
22
|
+
this.generation++;
|
|
23
|
+
this.notificationScheduled = false;
|
|
24
|
+
this.callbacks = [];
|
|
25
|
+
this.nodes = [];
|
|
26
|
+
this.edges = [];
|
|
27
|
+
this.metadata = initialMetadata();
|
|
28
|
+
}
|
|
29
|
+
getNodes() {
|
|
30
|
+
return this.nodes;
|
|
31
|
+
}
|
|
32
|
+
getEdges() {
|
|
33
|
+
return this.edges;
|
|
34
|
+
}
|
|
35
|
+
getMetadata() {
|
|
36
|
+
return this.metadata;
|
|
37
|
+
}
|
|
38
|
+
updateNodes(next) {
|
|
39
|
+
const value = typeof next === "function" ? next(this.nodes) : next;
|
|
40
|
+
if (value !== this.nodes) {
|
|
41
|
+
this.nodes = value;
|
|
42
|
+
this.scheduleNotification();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
updateEdges(next) {
|
|
46
|
+
const value = typeof next === "function" ? next(this.edges) : next;
|
|
47
|
+
if (value !== this.edges) {
|
|
48
|
+
this.edges = value;
|
|
49
|
+
this.scheduleNotification();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
updateMetadata(next) {
|
|
53
|
+
const value = typeof next === "function" ? next(this.metadata) : next;
|
|
54
|
+
if (value !== this.metadata) {
|
|
55
|
+
this.metadata = value;
|
|
56
|
+
this.scheduleNotification();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
onChange(callback) {
|
|
60
|
+
this.callbacks.push(callback);
|
|
61
|
+
}
|
|
62
|
+
unregisterOnChange(callback) {
|
|
63
|
+
this.callbacks = this.callbacks.filter((cb) => cb !== callback);
|
|
64
|
+
}
|
|
65
|
+
undo() {
|
|
66
|
+
console.warn("Undo is not implemented in the default diagram model. Supply a custom ModelAdapter to support undo.");
|
|
67
|
+
}
|
|
68
|
+
redo() {
|
|
69
|
+
console.warn("Redo is not implemented in the default diagram model. Supply a custom ModelAdapter to support redo.");
|
|
70
|
+
}
|
|
71
|
+
toJSON() {
|
|
72
|
+
return JSON.stringify({
|
|
73
|
+
nodes: this.nodes.map((node) => this.stripNodeRuntimeProperties(node)),
|
|
74
|
+
edges: this.edges.map((edge) => this.stripEdgeRuntimeProperties(edge)),
|
|
75
|
+
metadata: this.metadata
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
scheduleNotification() {
|
|
79
|
+
if (this.notificationScheduled) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
this.notificationScheduled = true;
|
|
83
|
+
const generation = this.generation;
|
|
84
|
+
queueMicrotask(() => {
|
|
85
|
+
if (generation !== this.generation || !this.notificationScheduled) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
this.notificationScheduled = false;
|
|
89
|
+
const changes = { nodes: this.nodes, edges: this.edges, metadata: this.metadata };
|
|
90
|
+
for (const callback of [...this.callbacks]) {
|
|
91
|
+
callback(changes);
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export { DefaultDiagramModelAdapter };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { defaultDiagramEnvironment } from '../runtime/environment.mjs';
|
|
2
|
+
import { DefaultDiagramModelAdapter } from './diagram-model-adapter.mjs';
|
|
3
|
+
import { stripNodeRuntimeProperties, stripEdgeRuntimeProperties } from './strip-runtime-properties.mjs';
|
|
4
|
+
import { assignInternalId } from '../../diagram-core/middleware-manager/middlewares/internal-id-assignment/internal-id-assignment.mjs';
|
|
5
|
+
|
|
6
|
+
function initializeModel(model = {}, options) {
|
|
7
|
+
const adapter = new DefaultDiagramModelAdapter();
|
|
8
|
+
if (options?.stripNodeRuntimeProperties) {
|
|
9
|
+
adapter.stripNodeRuntimeProperties = options.stripNodeRuntimeProperties;
|
|
10
|
+
}
|
|
11
|
+
if (options?.stripEdgeRuntimeProperties) {
|
|
12
|
+
adapter.stripEdgeRuntimeProperties = options.stripEdgeRuntimeProperties;
|
|
13
|
+
}
|
|
14
|
+
return initializeModelAdapter(adapter, model, options);
|
|
15
|
+
}
|
|
16
|
+
function initializeModelAdapter(adapter, model, options) {
|
|
17
|
+
const environment = options?.environment ?? defaultDiagramEnvironment;
|
|
18
|
+
const generateId = () => environment.generateId();
|
|
19
|
+
const stripNode = options?.stripNodeRuntimeProperties ?? stripNodeRuntimeProperties;
|
|
20
|
+
const stripEdge = options?.stripEdgeRuntimeProperties ?? stripEdgeRuntimeProperties;
|
|
21
|
+
if (model) {
|
|
22
|
+
adapter.updateNodes(model.nodes || []);
|
|
23
|
+
adapter.updateEdges(model.edges || []);
|
|
24
|
+
adapter.updateMetadata((prev) => ({ ...prev, ...model.metadata }));
|
|
25
|
+
}
|
|
26
|
+
adapter.updateNodes(adapter.getNodes().map((node) => assignInternalId(stripNode(node), generateId)));
|
|
27
|
+
adapter.updateEdges(adapter.getEdges().map((edge) => assignInternalId(stripEdge(edge), generateId)));
|
|
28
|
+
return adapter;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { initializeModel, initializeModelAdapter };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
function stripNodeRuntimeProperties(node) {
|
|
2
|
+
const {
|
|
3
|
+
selected: _selected,
|
|
4
|
+
measuredPorts: _measuredPorts,
|
|
5
|
+
measuredBounds: _measuredBounds,
|
|
6
|
+
computedZIndex: _computedZIndex,
|
|
7
|
+
computedHidden: _computedHidden,
|
|
8
|
+
_internalId,
|
|
9
|
+
...rest
|
|
10
|
+
} = node;
|
|
11
|
+
return rest;
|
|
12
|
+
}
|
|
13
|
+
function stripEdgeRuntimeProperties(edge) {
|
|
14
|
+
const {
|
|
15
|
+
sourcePosition,
|
|
16
|
+
targetPosition,
|
|
17
|
+
measuredLabels: _measuredLabels,
|
|
18
|
+
computedZIndex: _computedZIndex,
|
|
19
|
+
computedHidden: _computedHidden,
|
|
20
|
+
_internalId,
|
|
21
|
+
...rest
|
|
22
|
+
} = edge;
|
|
23
|
+
return {
|
|
24
|
+
...rest,
|
|
25
|
+
...!edge.source && sourcePosition ? { sourcePosition } : {},
|
|
26
|
+
...!edge.target && targetPosition ? { targetPosition } : {}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { stripEdgeRuntimeProperties, stripNodeRuntimeProperties };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const optionalBooleanConverter = {
|
|
2
|
+
fromAttribute: (value) => value === null ? void 0 : value !== "false",
|
|
3
|
+
toAttribute: (value) => value === void 0 ? null : String(value)
|
|
4
|
+
};
|
|
5
|
+
const SIDES = ["top", "right", "bottom", "left"];
|
|
6
|
+
const sidesConverter = {
|
|
7
|
+
fromAttribute: (value) => value === null ? SIDES : value.split(/[\s,]+/).map((side) => side.trim()).filter((side) => SIDES.includes(side)),
|
|
8
|
+
toAttribute: (value) => value.join(" ")
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export { optionalBooleanConverter, sidesConverter };
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
class BatchedResizeObserver {
|
|
2
|
+
constructor() {
|
|
3
|
+
this.observer = null;
|
|
4
|
+
this.observedElements = /* @__PURE__ */ new WeakMap();
|
|
5
|
+
this.entityIndex = /* @__PURE__ */ new Map();
|
|
6
|
+
this.config = null;
|
|
7
|
+
this.rafId = null;
|
|
8
|
+
// At most one pending entry per element, the newest: a batch can span several deliveries, and only an
|
|
9
|
+
// element's latest measurement matters
|
|
10
|
+
this.pendingEntries = /* @__PURE__ */ new Map();
|
|
11
|
+
if (typeof ResizeObserver === "undefined") {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
this.observer = new ResizeObserver((entries) => {
|
|
15
|
+
const resizingNodeId = this.config?.activeResizeNodeId();
|
|
16
|
+
for (const entry of entries) {
|
|
17
|
+
this.pendingEntries.set(entry.target, { entry, resizingNodeId });
|
|
18
|
+
}
|
|
19
|
+
if (this.config?.onObserverActivity) {
|
|
20
|
+
const metadataList = [];
|
|
21
|
+
for (const entry of entries) {
|
|
22
|
+
const metadata = this.observedElements.get(entry.target);
|
|
23
|
+
if (metadata) {
|
|
24
|
+
metadataList.push(metadata);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (metadataList.length > 0) {
|
|
28
|
+
this.config.onObserverActivity(metadataList);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (!this.rafId) {
|
|
32
|
+
this.rafId = requestAnimationFrame(() => {
|
|
33
|
+
requestAnimationFrame(() => {
|
|
34
|
+
this.processBatch();
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/** Sets the batch processor and the activity callbacks. */
|
|
41
|
+
configure(config) {
|
|
42
|
+
this.config = config;
|
|
43
|
+
}
|
|
44
|
+
/** Observes an element's size, recording what it is. */
|
|
45
|
+
observe(element, metadata) {
|
|
46
|
+
const previous = this.observedElements.get(element);
|
|
47
|
+
if (previous) {
|
|
48
|
+
this.removeFromEntityIndex(element, previous);
|
|
49
|
+
}
|
|
50
|
+
this.observedElements.set(element, metadata);
|
|
51
|
+
this.addToEntityIndex(element, metadata);
|
|
52
|
+
this.observer?.observe(element);
|
|
53
|
+
}
|
|
54
|
+
/** Stops observing an element. Safe for an element that was never observed. */
|
|
55
|
+
unobserve(element) {
|
|
56
|
+
const metadata = this.observedElements.get(element);
|
|
57
|
+
if (metadata) {
|
|
58
|
+
this.removeFromEntityIndex(element, metadata);
|
|
59
|
+
this.observedElements.delete(element);
|
|
60
|
+
}
|
|
61
|
+
this.pendingEntries.delete(element);
|
|
62
|
+
this.observer?.unobserve(element);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Makes the observer deliver a fresh entry for the element. Use it when the element moved without changing
|
|
66
|
+
* size, which `ResizeObserver` alone does not report.
|
|
67
|
+
*/
|
|
68
|
+
invalidate(element) {
|
|
69
|
+
if (!this.observedElements.has(element)) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
this.observer?.unobserve(element);
|
|
73
|
+
this.observer?.observe(element);
|
|
74
|
+
}
|
|
75
|
+
getMetadata(element) {
|
|
76
|
+
return this.observedElements.get(element);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Re-measures a node's element and all its ports.
|
|
80
|
+
*
|
|
81
|
+
* @returns The entity keys invalidated: `['node:<nodeId>']`, or `[]` when nothing is observed for the node
|
|
82
|
+
*/
|
|
83
|
+
invalidateNode(nodeId) {
|
|
84
|
+
return this.invalidateByKey(`node:${nodeId}`);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Re-measures all of an edge's labels.
|
|
88
|
+
*
|
|
89
|
+
* @returns The entity keys invalidated: `['edge:<edgeId>']`, or `[]` when nothing is observed for the edge
|
|
90
|
+
*/
|
|
91
|
+
invalidateEdgeLabels(edgeId) {
|
|
92
|
+
return this.invalidateByKey(`edge:${edgeId}`);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Re-measures every observed element.
|
|
96
|
+
*
|
|
97
|
+
* @returns The entity keys invalidated
|
|
98
|
+
*/
|
|
99
|
+
invalidateAll() {
|
|
100
|
+
const entityKeys = [];
|
|
101
|
+
for (const [key, elements] of this.entityIndex) {
|
|
102
|
+
entityKeys.push(key);
|
|
103
|
+
for (const element of elements) {
|
|
104
|
+
this.invalidate(element);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return entityKeys;
|
|
108
|
+
}
|
|
109
|
+
/** Disconnects the observer and drops pending work. The instance cannot be used afterwards. */
|
|
110
|
+
destroy() {
|
|
111
|
+
if (this.rafId) {
|
|
112
|
+
cancelAnimationFrame(this.rafId);
|
|
113
|
+
this.rafId = null;
|
|
114
|
+
}
|
|
115
|
+
this.pendingEntries.clear();
|
|
116
|
+
this.observer?.disconnect();
|
|
117
|
+
this.entityIndex.clear();
|
|
118
|
+
}
|
|
119
|
+
invalidateByKey(key) {
|
|
120
|
+
const elements = this.entityIndex.get(key);
|
|
121
|
+
if (!elements) {
|
|
122
|
+
return [];
|
|
123
|
+
}
|
|
124
|
+
for (const element of elements) {
|
|
125
|
+
this.invalidate(element);
|
|
126
|
+
}
|
|
127
|
+
return [key];
|
|
128
|
+
}
|
|
129
|
+
getEntityKey(metadata) {
|
|
130
|
+
switch (metadata.type) {
|
|
131
|
+
case "node":
|
|
132
|
+
case "port":
|
|
133
|
+
return `node:${metadata.nodeId}`;
|
|
134
|
+
case "edge-label":
|
|
135
|
+
return `edge:${metadata.edgeId}`;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
addToEntityIndex(element, metadata) {
|
|
139
|
+
const key = this.getEntityKey(metadata);
|
|
140
|
+
let set = this.entityIndex.get(key);
|
|
141
|
+
if (!set) {
|
|
142
|
+
set = /* @__PURE__ */ new Set();
|
|
143
|
+
this.entityIndex.set(key, set);
|
|
144
|
+
}
|
|
145
|
+
set.add(element);
|
|
146
|
+
}
|
|
147
|
+
removeFromEntityIndex(element, metadata) {
|
|
148
|
+
const key = this.getEntityKey(metadata);
|
|
149
|
+
const set = this.entityIndex.get(key);
|
|
150
|
+
if (set) {
|
|
151
|
+
set.delete(element);
|
|
152
|
+
if (set.size === 0) {
|
|
153
|
+
this.entityIndex.delete(key);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
processBatch() {
|
|
158
|
+
const entries = [...this.pendingEntries.values()];
|
|
159
|
+
this.pendingEntries.clear();
|
|
160
|
+
this.rafId = null;
|
|
161
|
+
if (entries.length === 0 || !this.config) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
this.config.processBatch(entries);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export { BatchedResizeObserver };
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
function createContext(key) {
|
|
2
|
+
return key;
|
|
3
|
+
}
|
|
4
|
+
class ContextRequestEvent extends Event {
|
|
5
|
+
constructor(context, contextTarget, callback, subscribe) {
|
|
6
|
+
super("context-request", { bubbles: true, composed: true });
|
|
7
|
+
this.context = context;
|
|
8
|
+
this.contextTarget = contextTarget;
|
|
9
|
+
this.callback = callback;
|
|
10
|
+
this.subscribe = subscribe;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
const pendingConsumers = /* @__PURE__ */ new Set();
|
|
14
|
+
function isComposedDescendant(ancestor, node) {
|
|
15
|
+
while (node) {
|
|
16
|
+
if (node === ancestor) {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
node = node.parentNode ?? (node instanceof ShadowRoot ? node.host : null);
|
|
20
|
+
}
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
class ContextProvider {
|
|
24
|
+
constructor(host, options) {
|
|
25
|
+
this.subscriptions = /* @__PURE__ */ new Map();
|
|
26
|
+
this.onContextRequest = (event) => {
|
|
27
|
+
if (event.context !== this.context) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const consumerHost = event.contextTarget ?? event.composedPath()[0];
|
|
31
|
+
if (consumerHost === this.host) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
event.stopPropagation();
|
|
35
|
+
const callback = event.callback;
|
|
36
|
+
if (event.subscribe) {
|
|
37
|
+
let unsubscribe = this.subscriptions.get(callback);
|
|
38
|
+
if (!unsubscribe) {
|
|
39
|
+
unsubscribe = () => {
|
|
40
|
+
this.subscriptions.delete(callback);
|
|
41
|
+
};
|
|
42
|
+
this.subscriptions.set(callback, unsubscribe);
|
|
43
|
+
}
|
|
44
|
+
callback(this._value, unsubscribe);
|
|
45
|
+
} else {
|
|
46
|
+
callback(this._value);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
this.host = host;
|
|
50
|
+
this.context = options.context;
|
|
51
|
+
this._value = options.initialValue;
|
|
52
|
+
host.addEventListener("context-request", this.onContextRequest);
|
|
53
|
+
host.addController?.(this);
|
|
54
|
+
}
|
|
55
|
+
get value() {
|
|
56
|
+
return this._value;
|
|
57
|
+
}
|
|
58
|
+
/** Sets the value and calls every subscribed consumer, unless the value is unchanged and `force` is false. */
|
|
59
|
+
setValue(value, force = false) {
|
|
60
|
+
if (!force && Object.is(value, this._value)) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
this._value = value;
|
|
64
|
+
for (const [callback, unsubscribe] of [...this.subscriptions]) {
|
|
65
|
+
callback(value, unsubscribe);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
hostConnected() {
|
|
69
|
+
for (const consumer of [...pendingConsumers]) {
|
|
70
|
+
if (consumer.context === this.context && isComposedDescendant(this.host, consumer.host)) {
|
|
71
|
+
consumer.retry();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
class ContextConsumer {
|
|
77
|
+
constructor(host, options) {
|
|
78
|
+
this.provided = false;
|
|
79
|
+
this.onValue = (value, unsubscribe) => {
|
|
80
|
+
if (this.unsubscribe) {
|
|
81
|
+
if (this.unsubscribe !== unsubscribe) {
|
|
82
|
+
this.provided = false;
|
|
83
|
+
this.unsubscribe();
|
|
84
|
+
}
|
|
85
|
+
if (!this.subscribe) {
|
|
86
|
+
this.unsubscribe();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
pendingConsumers.delete(this);
|
|
90
|
+
this.value = value;
|
|
91
|
+
this.host.requestUpdate?.();
|
|
92
|
+
if (!this.provided || this.subscribe) {
|
|
93
|
+
this.provided = true;
|
|
94
|
+
this.userCallback?.(value, unsubscribe);
|
|
95
|
+
}
|
|
96
|
+
this.unsubscribe = unsubscribe;
|
|
97
|
+
};
|
|
98
|
+
this.host = host;
|
|
99
|
+
this.context = options.context;
|
|
100
|
+
this.subscribe = options.subscribe ?? false;
|
|
101
|
+
this.userCallback = options.callback;
|
|
102
|
+
host.addController?.(this);
|
|
103
|
+
}
|
|
104
|
+
/** Whether a provider has answered since the host last connected. */
|
|
105
|
+
get hasProvider() {
|
|
106
|
+
return this.provided;
|
|
107
|
+
}
|
|
108
|
+
hostConnected() {
|
|
109
|
+
this.dispatchRequest();
|
|
110
|
+
}
|
|
111
|
+
hostDisconnected() {
|
|
112
|
+
pendingConsumers.delete(this);
|
|
113
|
+
this.unsubscribe?.();
|
|
114
|
+
this.unsubscribe = void 0;
|
|
115
|
+
this.provided = false;
|
|
116
|
+
}
|
|
117
|
+
/** @internal Called by a provider that connected after this consumer's request went unanswered. */
|
|
118
|
+
retry() {
|
|
119
|
+
if (!this.provided && this.host.isConnected) {
|
|
120
|
+
this.dispatchRequest();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
dispatchRequest() {
|
|
124
|
+
pendingConsumers.delete(this);
|
|
125
|
+
this.host.dispatchEvent(new ContextRequestEvent(this.context, this.host, this.onValue, this.subscribe));
|
|
126
|
+
if (!this.provided) {
|
|
127
|
+
pendingConsumers.add(this);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export { ContextConsumer, ContextProvider, ContextRequestEvent, createContext };
|