@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,8 @@
|
|
|
1
|
+
import { createContext } from './context.mjs';
|
|
2
|
+
|
|
3
|
+
const diagramRuntimeContext = createContext("flow-ui-diagram-runtime");
|
|
4
|
+
const diagramNodeContext = createContext("flow-ui-diagram-node");
|
|
5
|
+
const diagramEdgeContext = createContext("flow-ui-diagram-edge");
|
|
6
|
+
const diagramPaletteItemContext = createContext("flow-ui-diagram-palette-item");
|
|
7
|
+
|
|
8
|
+
export { diagramEdgeContext, diagramNodeContext, diagramPaletteItemContext, diagramRuntimeContext };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const RECENT_POSITION_MS = 5e3;
|
|
2
|
+
class CursorPositionTracker {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.lastPosition = { x: 0, y: 0, timestamp: 0 };
|
|
5
|
+
}
|
|
6
|
+
/** Records a client position. */
|
|
7
|
+
updatePosition(x, y) {
|
|
8
|
+
this.lastPosition = { x, y, timestamp: Date.now() };
|
|
9
|
+
}
|
|
10
|
+
/** A copy of the last known position. */
|
|
11
|
+
getLastPosition() {
|
|
12
|
+
return { ...this.lastPosition };
|
|
13
|
+
}
|
|
14
|
+
/** Whether the last position was recorded within the last five seconds. */
|
|
15
|
+
hasRecentPosition() {
|
|
16
|
+
return Date.now() - this.lastPosition.timestamp < RECENT_POSITION_MS;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { CursorPositionTracker };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { html, nothing } from 'lit';
|
|
2
|
+
|
|
3
|
+
const defaultEdgeTemplate = ({ edge }) => {
|
|
4
|
+
const { label, positionOnEdge } = edge.data ?? {};
|
|
5
|
+
return html`
|
|
6
|
+
<flow-ui-diagram-base-edge class="flow-ui-diagram-default-edge" .edge=${edge}>
|
|
7
|
+
${label ? html`
|
|
8
|
+
<flow-ui-diagram-edge-label
|
|
9
|
+
class="flow-ui-diagram-default-label"
|
|
10
|
+
variant="default"
|
|
11
|
+
.id=${"edge-label"}
|
|
12
|
+
.positionOnEdge=${positionOnEdge ?? 0.5}
|
|
13
|
+
>
|
|
14
|
+
${label}
|
|
15
|
+
</flow-ui-diagram-edge-label>
|
|
16
|
+
` : nothing}
|
|
17
|
+
</flow-ui-diagram-base-edge>
|
|
18
|
+
`;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export { defaultEdgeTemplate };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { diagramGroupHighlighted } from './group-highlighted.mjs';
|
|
3
|
+
import { diagramNodeSelected } from './node-selected.mjs';
|
|
4
|
+
|
|
5
|
+
function defaultNodeLabel(node) {
|
|
6
|
+
const data = node.data;
|
|
7
|
+
return data && "label" in data ? data.label : node.id;
|
|
8
|
+
}
|
|
9
|
+
const defaultNodeTemplate = ({ node }) => html`
|
|
10
|
+
<flow-ui-diagram-base-node class="flow-ui-diagram-default-node">
|
|
11
|
+
<span>${defaultNodeLabel(node)}</span>
|
|
12
|
+
</flow-ui-diagram-base-node>
|
|
13
|
+
`;
|
|
14
|
+
const defaultGroupTemplate = ({ node }) => html`
|
|
15
|
+
<flow-ui-diagram-resize-adornment class="flow-ui-diagram-default-group-adornment">
|
|
16
|
+
<div class="flow-ui-diagram-default-group" ${diagramNodeSelected(node)} ${diagramGroupHighlighted(node)}></div>
|
|
17
|
+
</flow-ui-diagram-resize-adornment>
|
|
18
|
+
`;
|
|
19
|
+
|
|
20
|
+
export { defaultGroupTemplate, defaultNodeLabel, defaultNodeTemplate };
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { ContextConsumer, ContextRequestEvent } from './context.mjs';
|
|
2
|
+
import { diagramRuntimeContext } from './contexts.mjs';
|
|
3
|
+
|
|
4
|
+
class DiagramReferenceController {
|
|
5
|
+
constructor(host, options) {
|
|
6
|
+
this.connected = false;
|
|
7
|
+
this.host = host;
|
|
8
|
+
this.options = options;
|
|
9
|
+
this.consumer = new ContextConsumer(host, {
|
|
10
|
+
context: diagramRuntimeContext,
|
|
11
|
+
callback: () => this.resolve()
|
|
12
|
+
});
|
|
13
|
+
host.addController(this);
|
|
14
|
+
}
|
|
15
|
+
/** The runtime of the resolved diagram, or `undefined` while there is none. */
|
|
16
|
+
get runtime() {
|
|
17
|
+
return this._runtime;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The referenced diagram element, when the reference names one and it was found. `undefined` when the runtime
|
|
21
|
+
* came from the context (or there is none). Pass it on as the `diagram` of nested elements (for example the
|
|
22
|
+
* minimap's zoom controls), which cannot resolve an `id` from inside a shadow root.
|
|
23
|
+
*/
|
|
24
|
+
get target() {
|
|
25
|
+
return this._target;
|
|
26
|
+
}
|
|
27
|
+
hostConnected() {
|
|
28
|
+
this.connected = true;
|
|
29
|
+
this.resolve();
|
|
30
|
+
}
|
|
31
|
+
hostDisconnected() {
|
|
32
|
+
this.connected = false;
|
|
33
|
+
this.stopObserving();
|
|
34
|
+
}
|
|
35
|
+
/** Resolves the reference again. Call it when the host's reference changes. */
|
|
36
|
+
update() {
|
|
37
|
+
this.resolve();
|
|
38
|
+
}
|
|
39
|
+
resolve() {
|
|
40
|
+
if (!this.connected) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const reference = this.options.getReference();
|
|
44
|
+
if (typeof reference === "string" ? reference !== "" : !!reference) {
|
|
45
|
+
let element;
|
|
46
|
+
if (typeof reference === "string") {
|
|
47
|
+
this.observe();
|
|
48
|
+
element = this.lookup(reference);
|
|
49
|
+
} else {
|
|
50
|
+
this.stopObserving();
|
|
51
|
+
element = reference;
|
|
52
|
+
}
|
|
53
|
+
this._target = element;
|
|
54
|
+
this.setRuntime(element ? this.requestRuntime(element) : void 0);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
this.stopObserving();
|
|
58
|
+
this._target = void 0;
|
|
59
|
+
this.setRuntime(this.consumer.hasProvider ? this.consumer.value : void 0);
|
|
60
|
+
}
|
|
61
|
+
lookup(id) {
|
|
62
|
+
const root = this.host.getRootNode();
|
|
63
|
+
return root.getElementById?.(id) ?? void 0;
|
|
64
|
+
}
|
|
65
|
+
/** Asks `element` for its runtime, without letting the request reach a diagram around it. */
|
|
66
|
+
requestRuntime(element) {
|
|
67
|
+
let runtime;
|
|
68
|
+
const event = new ContextRequestEvent(diagramRuntimeContext, this.host, (value) => runtime = value, false);
|
|
69
|
+
const stop = (e) => e.stopPropagation();
|
|
70
|
+
element.addEventListener("context-request", stop);
|
|
71
|
+
element.dispatchEvent(event);
|
|
72
|
+
element.removeEventListener("context-request", stop);
|
|
73
|
+
if (!runtime) {
|
|
74
|
+
const tag = element.localName;
|
|
75
|
+
if (tag.includes("-") && typeof customElements !== "undefined" && !customElements.get(tag)) {
|
|
76
|
+
void customElements.whenDefined(tag).then(() => {
|
|
77
|
+
if (this.options.getReference() && this._target === element) {
|
|
78
|
+
this.resolve();
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return runtime;
|
|
84
|
+
}
|
|
85
|
+
observe() {
|
|
86
|
+
const root = this.host.getRootNode();
|
|
87
|
+
if (typeof MutationObserver === "undefined" || this.observer && this.observedRoot === root) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
this.stopObserving();
|
|
91
|
+
this.observedRoot = root;
|
|
92
|
+
this.observer = new MutationObserver(() => {
|
|
93
|
+
const reference = this.options.getReference();
|
|
94
|
+
if (typeof reference === "string" && this.lookup(reference) !== this._target) {
|
|
95
|
+
this.resolve();
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
this.observer.observe(root, { childList: true, subtree: true, attributes: true, attributeFilter: ["id"] });
|
|
99
|
+
}
|
|
100
|
+
stopObserving() {
|
|
101
|
+
this.observer?.disconnect();
|
|
102
|
+
this.observer = void 0;
|
|
103
|
+
this.observedRoot = void 0;
|
|
104
|
+
}
|
|
105
|
+
setRuntime(runtime) {
|
|
106
|
+
if (runtime === this._runtime) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
this._runtime = runtime;
|
|
110
|
+
this.options.onChange?.(runtime);
|
|
111
|
+
this.host.requestUpdate();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function isInsideDiagramTokens(element) {
|
|
115
|
+
let node = element.parentNode ?? null;
|
|
116
|
+
while (node) {
|
|
117
|
+
if (node instanceof Element && (node.localName === "flow-ui-diagram" || node.hasAttribute(DIAGRAM_TOKENS_ATTRIBUTE))) {
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
node = node instanceof ShadowRoot ? node.host : node.parentNode;
|
|
121
|
+
}
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
const DIAGRAM_TOKENS_ATTRIBUTE = "data-diagram-tokens";
|
|
125
|
+
|
|
126
|
+
export { DIAGRAM_TOKENS_ATTRIBUTE, DiagramReferenceController, isInsideDiagramTokens };
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import '../../diagram-core/set.polyfill.mjs';
|
|
2
|
+
import { BatchedResizeObserver } from './batched-resize-observer.mjs';
|
|
3
|
+
import { CursorPositionTracker } from './cursor-position-tracker.mjs';
|
|
4
|
+
import { DomInputEventsRouter } from './dom-input-events-router.mjs';
|
|
5
|
+
import { DiagramEnvironment } from './environment.mjs';
|
|
6
|
+
import { LitRenderer } from './lit-renderer.mjs';
|
|
7
|
+
import { DiagramMarkerRegistry } from './marker-registry.mjs';
|
|
8
|
+
import { BUILTIN_MIDDLEWARES } from './middlewares.mjs';
|
|
9
|
+
import { Observable, batch } from './observable.mjs';
|
|
10
|
+
import { DiagramPortRegistry } from './port-registry.mjs';
|
|
11
|
+
import { DiagramResizeProcessor } from './resize-processor.mjs';
|
|
12
|
+
import { DiagramBoxSelectionProvider } from './box-selection-provider.mjs';
|
|
13
|
+
import { DiagramTouchEventsState } from './touch-events-state.mjs';
|
|
14
|
+
import { FlowCore } from '../../diagram-core/flow-core.mjs';
|
|
15
|
+
|
|
16
|
+
const NOT_INITIALIZED_ERROR = `[flow-ui-diagram] The diagram engine isn't initialized yet.
|
|
17
|
+
|
|
18
|
+
Wait for initialization first: await \`diagram.initialized\`, listen for the \`flow-ui-diagram-init\` event, or
|
|
19
|
+
observe \`isInitialized\` on the diagram API.`;
|
|
20
|
+
class DiagramRuntime {
|
|
21
|
+
constructor(host, options = {}) {
|
|
22
|
+
this.renderer = new LitRenderer();
|
|
23
|
+
this._flowCore = new Observable(null);
|
|
24
|
+
this._isInitialized = new Observable(false);
|
|
25
|
+
this._config = new Observable(null);
|
|
26
|
+
this._actionState = new Observable({});
|
|
27
|
+
this.flowCore = this._flowCore.asReadonly();
|
|
28
|
+
this.isInitialized = this._isInitialized.asReadonly();
|
|
29
|
+
this.config = this._config.asReadonly();
|
|
30
|
+
this.actionState = this._actionState.asReadonly();
|
|
31
|
+
/** The shared size observer for nodes, ports and edge labels. */
|
|
32
|
+
this.resizeObserver = new BatchedResizeObserver();
|
|
33
|
+
/** Which port elements belong to which node element; measures them for the resize processor. */
|
|
34
|
+
this.portRegistry = new DiagramPortRegistry(() => this.renderer.viewport.value.scale);
|
|
35
|
+
/** The SVG markers edges can use as arrowheads, the built-in arrow included. */
|
|
36
|
+
this.markerRegistry = new DiagramMarkerRegistry();
|
|
37
|
+
/** The gesture that currently owns the pointers, shared by the input controllers. */
|
|
38
|
+
this.touchEventsState = new DiagramTouchEventsState();
|
|
39
|
+
/** The rectangle of the box selection in progress, drawn by the diagram. */
|
|
40
|
+
this.boxSelection = new DiagramBoxSelectionProvider();
|
|
41
|
+
/** The last known mouse position, kept by the cursor-position-tracker controller. */
|
|
42
|
+
this.cursorPosition = new CursorPositionTracker();
|
|
43
|
+
/**
|
|
44
|
+
* The diagram's `nodeTemplateMap`, kept current by the diagram, for elements outside its content layer that
|
|
45
|
+
* render nodes the same way (palette item previews).
|
|
46
|
+
*/
|
|
47
|
+
this.nodeTemplateMap = new Observable(void 0);
|
|
48
|
+
this.stableListeners = /* @__PURE__ */ new Set();
|
|
49
|
+
this.initListeners = /* @__PURE__ */ new Set();
|
|
50
|
+
this.coreUnsubscribes = [];
|
|
51
|
+
this.host = host;
|
|
52
|
+
this.environment = options.environment ?? new DiagramEnvironment();
|
|
53
|
+
this.inputEventsRouter = new DomInputEventsRouter(this.environment);
|
|
54
|
+
this.resizeProcessor = new DiagramResizeProcessor(this, this.resizeObserver);
|
|
55
|
+
this.resizeProcessor.portMeasurer = this.portRegistry;
|
|
56
|
+
}
|
|
57
|
+
/** The diagram's client rect (`getBoundingClientRect()` of the `flow-ui-diagram` element). */
|
|
58
|
+
getDiagramRect() {
|
|
59
|
+
if (this.host.getClientRect) {
|
|
60
|
+
return this.host.getClientRect();
|
|
61
|
+
}
|
|
62
|
+
const { x, y } = this.host.getFlowOffset();
|
|
63
|
+
const { width, height } = this.host.getViewportSize();
|
|
64
|
+
return new DOMRect(x, y, width, height);
|
|
65
|
+
}
|
|
66
|
+
/** How presses change the selection: the diagram's `selectionMode` (`'default'` for any unknown value). */
|
|
67
|
+
get selectionMode() {
|
|
68
|
+
return this.host.getSelectionMode?.() === "toggle" ? "toggle" : "default";
|
|
69
|
+
}
|
|
70
|
+
/** Whether a FlowCore currently exists. */
|
|
71
|
+
get hasFlowCore() {
|
|
72
|
+
return this._flowCore.value !== null;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Destroys the current FlowCore, if any, and creates a new one for `model`. The core draws into the renderer
|
|
76
|
+
* synchronously during construction, then measures and emits `diagramInit` asynchronously.
|
|
77
|
+
*/
|
|
78
|
+
init({ model, middlewares = BUILTIN_MIDDLEWARES, config }) {
|
|
79
|
+
this.destroy();
|
|
80
|
+
const flowCore = new FlowCore(
|
|
81
|
+
model,
|
|
82
|
+
this.renderer,
|
|
83
|
+
this.inputEventsRouter,
|
|
84
|
+
this.environment,
|
|
85
|
+
middlewares,
|
|
86
|
+
() => this.host.getFlowOffset(),
|
|
87
|
+
() => this.host.getViewportSize(),
|
|
88
|
+
config
|
|
89
|
+
);
|
|
90
|
+
const eventManager = flowCore.eventManager;
|
|
91
|
+
this.coreUnsubscribes.push(
|
|
92
|
+
eventManager.on("actionStateChanged", ({ actionState }) => {
|
|
93
|
+
const wasLinking = !!this._actionState.value.linking;
|
|
94
|
+
this._actionState.set(actionState);
|
|
95
|
+
if (wasLinking && !actionState.linking) {
|
|
96
|
+
this.redrawAfterLinking(flowCore);
|
|
97
|
+
}
|
|
98
|
+
}),
|
|
99
|
+
eventManager.on("diagramInit", (event) => {
|
|
100
|
+
clearTimeout(this.initTimer);
|
|
101
|
+
this.initTimer = setTimeout(() => {
|
|
102
|
+
this.initTimer = void 0;
|
|
103
|
+
if (this._flowCore.value !== flowCore) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
this._isInitialized.set(true);
|
|
107
|
+
for (const listener of [...this.initListeners]) {
|
|
108
|
+
this.callSafely(listener, event);
|
|
109
|
+
}
|
|
110
|
+
if (flowCore.config.zoom.zoomToFit.onInit) {
|
|
111
|
+
flowCore.commandHandler.emit("zoomToFit", {});
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
})
|
|
115
|
+
);
|
|
116
|
+
for (const listener of this.stableListeners) {
|
|
117
|
+
this.attach(listener, flowCore);
|
|
118
|
+
}
|
|
119
|
+
batch(() => {
|
|
120
|
+
this._config.set(flowCore.config);
|
|
121
|
+
this._actionState.set({ ...flowCore.actionStateManager.getState() });
|
|
122
|
+
this._flowCore.set(flowCore);
|
|
123
|
+
});
|
|
124
|
+
return flowCore;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Destroys the current FlowCore. This also destroys its model adapter, as in ngDiagram, so a model cannot be
|
|
128
|
+
* reused after its diagram is destroyed. Listeners registered with {@link DiagramRuntime.on} are kept.
|
|
129
|
+
*/
|
|
130
|
+
destroy() {
|
|
131
|
+
const flowCore = this._flowCore.value;
|
|
132
|
+
if (!flowCore) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
clearTimeout(this.initTimer);
|
|
136
|
+
this.initTimer = void 0;
|
|
137
|
+
this.coreUnsubscribes.forEach((unsubscribe) => unsubscribe());
|
|
138
|
+
this.coreUnsubscribes = [];
|
|
139
|
+
for (const listener of this.stableListeners) {
|
|
140
|
+
listener.detach?.();
|
|
141
|
+
listener.detach = void 0;
|
|
142
|
+
}
|
|
143
|
+
batch(() => {
|
|
144
|
+
this._isInitialized.set(false);
|
|
145
|
+
this._flowCore.set(null);
|
|
146
|
+
this._config.set(null);
|
|
147
|
+
this._actionState.set({});
|
|
148
|
+
this.renderer.reset();
|
|
149
|
+
});
|
|
150
|
+
flowCore.destroy();
|
|
151
|
+
}
|
|
152
|
+
/** The current FlowCore. Throws before `init()` and after `destroy()`. */
|
|
153
|
+
provide() {
|
|
154
|
+
const flowCore = this._flowCore.value;
|
|
155
|
+
if (!flowCore) {
|
|
156
|
+
throw new Error(NOT_INITIALIZED_ERROR);
|
|
157
|
+
}
|
|
158
|
+
return flowCore;
|
|
159
|
+
}
|
|
160
|
+
/** Merges `config` into the current FlowCore's config and refreshes the `config` observable. */
|
|
161
|
+
updateConfig(config) {
|
|
162
|
+
const flowCore = this.provide();
|
|
163
|
+
flowCore.updateConfig(config);
|
|
164
|
+
this._config.set(flowCore.config);
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Subscribes to a core event on the current FlowCore and on every FlowCore created later, until the returned
|
|
168
|
+
* function is called. `diagramInit` listeners run after `isInitialized` turns `true`.
|
|
169
|
+
*/
|
|
170
|
+
on(event, callback) {
|
|
171
|
+
const listener = { event, callback };
|
|
172
|
+
if (event === "diagramInit") {
|
|
173
|
+
this.initListeners.add(listener);
|
|
174
|
+
return () => {
|
|
175
|
+
this.initListeners.delete(listener);
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
this.stableListeners.add(listener);
|
|
179
|
+
const flowCore = this._flowCore.value;
|
|
180
|
+
if (flowCore) {
|
|
181
|
+
this.attach(listener, flowCore);
|
|
182
|
+
}
|
|
183
|
+
return () => {
|
|
184
|
+
this.stableListeners.delete(listener);
|
|
185
|
+
listener.detach?.();
|
|
186
|
+
listener.detach = void 0;
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Redraws once a draw or relink has cleared its linking state. The core draws only on model changes, and the
|
|
191
|
+
* relinked edge is left out of the drawing while the linking state names it. The finish commands clear that state
|
|
192
|
+
* after their last model write; ngDiagram's model notifies through an Angular effect, which runs after that, but
|
|
193
|
+
* the default model here notifies in a microtask, which can run before it. Without this the temporary edge would
|
|
194
|
+
* stay on screen in place of the relinked edge until the next model change.
|
|
195
|
+
*/
|
|
196
|
+
redrawAfterLinking(flowCore) {
|
|
197
|
+
if (this._flowCore.value !== flowCore) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
flowCore.renderStrategy.render?.();
|
|
201
|
+
}
|
|
202
|
+
attach(listener, flowCore) {
|
|
203
|
+
listener.detach = flowCore.eventManager.on(listener.event, listener.callback);
|
|
204
|
+
}
|
|
205
|
+
callSafely(listener, event) {
|
|
206
|
+
try {
|
|
207
|
+
listener.callback(event);
|
|
208
|
+
} catch (error) {
|
|
209
|
+
console.error(`[flow-ui-diagram] Listener for "${listener.event}" threw an error.`, error);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export { DiagramRuntime };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { InputEventsRouter } from '../../diagram-core/input-events/input-events.router.mjs';
|
|
2
|
+
|
|
3
|
+
function shouldDiscardEvent(event, type) {
|
|
4
|
+
const attribute = `data-no-${type}`;
|
|
5
|
+
const path = event.composedPath();
|
|
6
|
+
if (path.length === 0) {
|
|
7
|
+
const target = event.target;
|
|
8
|
+
return target instanceof Element && !!target.closest(`[${attribute}="true"]`);
|
|
9
|
+
}
|
|
10
|
+
return path.some((target) => target instanceof Element && target.getAttribute(attribute) === "true");
|
|
11
|
+
}
|
|
12
|
+
const keysMap = {
|
|
13
|
+
arrows: {
|
|
14
|
+
up: "ArrowUp",
|
|
15
|
+
down: "ArrowDown",
|
|
16
|
+
left: "ArrowLeft",
|
|
17
|
+
right: "ArrowRight"
|
|
18
|
+
},
|
|
19
|
+
keys: {
|
|
20
|
+
delete: "Delete",
|
|
21
|
+
backspace: "Backspace"
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
class DomInputEventsRouter extends InputEventsRouter {
|
|
25
|
+
constructor(environment) {
|
|
26
|
+
super();
|
|
27
|
+
/** Guards for common event properties: type, modifiers, buttons and keys. */
|
|
28
|
+
this.eventGuards = {
|
|
29
|
+
isPointerEvent: (event) => this.isPointerEvent(event),
|
|
30
|
+
isKeyboardEvent: (event) => this.isKeyboardEvent(event),
|
|
31
|
+
isWheelEvent: (event) => this.isWheelEvent(event),
|
|
32
|
+
isDomEvent: (event) => this.isDomEvent(event),
|
|
33
|
+
withPrimaryModifier: (event) => this.getModifiers(event).primary,
|
|
34
|
+
withSecondaryModifier: (event) => this.getModifiers(event).secondary,
|
|
35
|
+
withShiftModifier: (event) => this.getModifiers(event).shift,
|
|
36
|
+
withMetaModifier: (event) => this.getModifiers(event).meta,
|
|
37
|
+
withoutModifiers: (event) => Object.values(this.getModifiers(event)).every((modifier) => modifier === false),
|
|
38
|
+
withPrimaryButton: (event) => this.isPointerEvent(event) && (event.button === void 0 || event.button === 0),
|
|
39
|
+
isArrowKeyPressed: (event) => this.isKeyboardEvent(event) && Object.values(keysMap.arrows).includes(event.key),
|
|
40
|
+
isKeyPressed: (key) => (event) => this.isKeyboardEvent(event) && event.key === key,
|
|
41
|
+
isKeyComboPressed: (key, ...mods) => (event) => {
|
|
42
|
+
if (!this.isKeyboardEvent(event))
|
|
43
|
+
return false;
|
|
44
|
+
const modifiersPressed = this.getModifiers(event);
|
|
45
|
+
return mods.every((mod) => modifiersPressed[mod]) && event.key === key;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
this.environment = environment;
|
|
49
|
+
}
|
|
50
|
+
/** Creates the common part of a core input event from a DOM event. */
|
|
51
|
+
getBaseEvent(event) {
|
|
52
|
+
return {
|
|
53
|
+
modifiers: this.getModifiers(event),
|
|
54
|
+
id: this.environment.generateId(),
|
|
55
|
+
timestamp: this.environment.now()
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
getPrimaryModifierKey() {
|
|
59
|
+
if (!this.environment.isClient)
|
|
60
|
+
return "ctrlKey";
|
|
61
|
+
return this.environment.os === "MacOS" ? "metaKey" : "ctrlKey";
|
|
62
|
+
}
|
|
63
|
+
isPointerEvent(event) {
|
|
64
|
+
return this.environment.isClient && typeof PointerEvent !== "undefined" && event instanceof PointerEvent;
|
|
65
|
+
}
|
|
66
|
+
isKeyboardEvent(event) {
|
|
67
|
+
return this.environment.isClient && event instanceof KeyboardEvent;
|
|
68
|
+
}
|
|
69
|
+
isWheelEvent(event) {
|
|
70
|
+
return this.environment.isClient && event instanceof WheelEvent;
|
|
71
|
+
}
|
|
72
|
+
isDomEvent(event) {
|
|
73
|
+
return this.isPointerEvent(event) || this.isKeyboardEvent(event) || this.isWheelEvent(event);
|
|
74
|
+
}
|
|
75
|
+
getModifiers(event) {
|
|
76
|
+
if (!this.isDomEvent(event)) {
|
|
77
|
+
return { primary: false, secondary: false, shift: false, meta: false };
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
primary: event[this.getPrimaryModifierKey()],
|
|
81
|
+
secondary: event.altKey,
|
|
82
|
+
shift: event.shiftKey,
|
|
83
|
+
meta: event.metaKey
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export { DomInputEventsRouter, shouldDiscardEvent };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
class DiagramEnvironment {
|
|
2
|
+
get os() {
|
|
3
|
+
return this.detectOS();
|
|
4
|
+
}
|
|
5
|
+
get browser() {
|
|
6
|
+
return this.detectBrowser();
|
|
7
|
+
}
|
|
8
|
+
get runtime() {
|
|
9
|
+
return this.isClient ? "web" : "node";
|
|
10
|
+
}
|
|
11
|
+
/** Whether the code runs in a browser, with `window` and `document`. */
|
|
12
|
+
get isClient() {
|
|
13
|
+
return typeof window !== "undefined" && typeof document !== "undefined";
|
|
14
|
+
}
|
|
15
|
+
now() {
|
|
16
|
+
return this.isClient ? performance.now() : Date.now();
|
|
17
|
+
}
|
|
18
|
+
generateId() {
|
|
19
|
+
const hasCrypto = this.isClient && typeof crypto !== "undefined" && typeof crypto.randomUUID === "function";
|
|
20
|
+
return hasCrypto ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(36).substring(2, 15)}`;
|
|
21
|
+
}
|
|
22
|
+
detectOS() {
|
|
23
|
+
if (!this.isClient)
|
|
24
|
+
return null;
|
|
25
|
+
const ua = window.navigator.userAgent;
|
|
26
|
+
if (/iPhone|iPad|iPod/.test(ua))
|
|
27
|
+
return "iOS";
|
|
28
|
+
if (/Mac/.test(ua))
|
|
29
|
+
return "MacOS";
|
|
30
|
+
if (/Win/.test(ua))
|
|
31
|
+
return "Windows";
|
|
32
|
+
if (/Android/.test(ua))
|
|
33
|
+
return "Android";
|
|
34
|
+
if (/Linux/.test(ua))
|
|
35
|
+
return "Linux";
|
|
36
|
+
return "Other";
|
|
37
|
+
}
|
|
38
|
+
detectBrowser() {
|
|
39
|
+
if (!this.isClient)
|
|
40
|
+
return null;
|
|
41
|
+
const ua = window.navigator.userAgent;
|
|
42
|
+
if (/OPR/.test(ua))
|
|
43
|
+
return "Opera";
|
|
44
|
+
if (/Edge|Edg/.test(ua))
|
|
45
|
+
return "Edge";
|
|
46
|
+
if (/Chrome/.test(ua))
|
|
47
|
+
return "Chrome";
|
|
48
|
+
if (/Firefox/.test(ua))
|
|
49
|
+
return "Firefox";
|
|
50
|
+
if (/Safari/.test(ua))
|
|
51
|
+
return "Safari";
|
|
52
|
+
if (/Trident/.test(ua))
|
|
53
|
+
return "IE";
|
|
54
|
+
return "Unknown";
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const defaultDiagramEnvironment = new DiagramEnvironment();
|
|
58
|
+
|
|
59
|
+
export { DiagramEnvironment, defaultDiagramEnvironment };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const DIAGRAM_EVENT_NAMES = {
|
|
2
|
+
diagramInit: "flow-ui-diagram-init",
|
|
3
|
+
selectionMoved: "flow-ui-diagram-selection-moved",
|
|
4
|
+
selectionChanged: "flow-ui-diagram-selection-changed",
|
|
5
|
+
selectionRemoved: "flow-ui-diagram-selection-removed",
|
|
6
|
+
groupMembershipChanged: "flow-ui-diagram-group-membership-changed",
|
|
7
|
+
selectionRotated: "flow-ui-diagram-selection-rotated",
|
|
8
|
+
viewportChanged: "flow-ui-diagram-viewport-changed",
|
|
9
|
+
edgeDrawn: "flow-ui-diagram-edge-drawn",
|
|
10
|
+
edgeDrawEnded: "flow-ui-diagram-edge-draw-ended",
|
|
11
|
+
edgeRelinkStarted: "flow-ui-diagram-edge-relink-started",
|
|
12
|
+
edgeRelinkEnded: "flow-ui-diagram-edge-relink-ended",
|
|
13
|
+
clipboardPasted: "flow-ui-diagram-clipboard-pasted",
|
|
14
|
+
nodeResized: "flow-ui-diagram-node-resized",
|
|
15
|
+
paletteItemDropped: "flow-ui-diagram-palette-item-dropped",
|
|
16
|
+
nodeResizeStarted: "flow-ui-diagram-node-resize-started",
|
|
17
|
+
nodeResizeEnded: "flow-ui-diagram-node-resize-ended",
|
|
18
|
+
nodeRotateStarted: "flow-ui-diagram-node-rotate-started",
|
|
19
|
+
nodeRotateEnded: "flow-ui-diagram-node-rotate-ended",
|
|
20
|
+
selectionGestureEnded: "flow-ui-diagram-selection-gesture-ended",
|
|
21
|
+
nodeDragStarted: "flow-ui-diagram-node-drag-started",
|
|
22
|
+
nodeDragEnded: "flow-ui-diagram-node-drag-ended"
|
|
23
|
+
};
|
|
24
|
+
function bridgeDiagramEvents(runtime, dispatch) {
|
|
25
|
+
const unsubscribes = Object.keys(DIAGRAM_EVENT_NAMES).map(
|
|
26
|
+
(coreEvent) => runtime.on(coreEvent, (event) => dispatch(DIAGRAM_EVENT_NAMES[coreEvent], event))
|
|
27
|
+
);
|
|
28
|
+
return () => unsubscribes.forEach((unsubscribe) => unsubscribe());
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { DIAGRAM_EVENT_NAMES, bridgeDiagramEvents };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
function isInteractionActive(actionState) {
|
|
2
|
+
return !!(actionState.dragging || actionState.linking || actionState.resize || actionState.rotation || actionState.panning || actionState.selection);
|
|
3
|
+
}
|
|
4
|
+
class FlowOffset {
|
|
5
|
+
constructor(element, actionState) {
|
|
6
|
+
this.element = element;
|
|
7
|
+
this.cachedOffset = null;
|
|
8
|
+
this.interactionActive = false;
|
|
9
|
+
/** The current offset. Bound, so it can be handed to the core as a function. */
|
|
10
|
+
this.get = () => {
|
|
11
|
+
if (this.interactionActive && this.cachedOffset) {
|
|
12
|
+
return this.cachedOffset;
|
|
13
|
+
}
|
|
14
|
+
const rect = this.element.getBoundingClientRect();
|
|
15
|
+
const offset = { x: rect.left, y: rect.top };
|
|
16
|
+
if (this.interactionActive) {
|
|
17
|
+
this.cachedOffset = offset;
|
|
18
|
+
}
|
|
19
|
+
return offset;
|
|
20
|
+
};
|
|
21
|
+
this.unsubscribe = actionState.subscribe((state) => {
|
|
22
|
+
const active = isInteractionActive(state);
|
|
23
|
+
if (active && !this.interactionActive) {
|
|
24
|
+
this.interactionActive = true;
|
|
25
|
+
} else if (!active && this.interactionActive) {
|
|
26
|
+
this.interactionActive = false;
|
|
27
|
+
this.cachedOffset = null;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/** Drops the cached offset, for when the element moved or resized. */
|
|
32
|
+
invalidate() {
|
|
33
|
+
this.cachedOffset = null;
|
|
34
|
+
}
|
|
35
|
+
/** Forgets any gesture in progress, for when the FlowCore is re-created. */
|
|
36
|
+
reset() {
|
|
37
|
+
this.cachedOffset = null;
|
|
38
|
+
this.interactionActive = false;
|
|
39
|
+
}
|
|
40
|
+
destroy() {
|
|
41
|
+
this.unsubscribe();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { FlowOffset };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { nothing } from 'lit';
|
|
2
|
+
import { directive, Directive, PartType } from 'lit/directive.js';
|
|
3
|
+
import { DIAGRAM_NODE_WRAPPER_CLASS } from './node-selected.mjs';
|
|
4
|
+
|
|
5
|
+
const DIAGRAM_GROUP_HIGHLIGHT_CLASS = "flow-ui-diagram-group-highlight";
|
|
6
|
+
class DiagramGroupHighlightedDirective extends Directive {
|
|
7
|
+
constructor(partInfo) {
|
|
8
|
+
super(partInfo);
|
|
9
|
+
if (partInfo.type !== PartType.ELEMENT) {
|
|
10
|
+
throw new Error("diagramGroupHighlighted() can only be used in an element binding, such as <div ${\u2026}>.");
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
render(_node) {
|
|
14
|
+
return nothing;
|
|
15
|
+
}
|
|
16
|
+
update(part, [node]) {
|
|
17
|
+
const classList = part.element.classList;
|
|
18
|
+
classList.add(DIAGRAM_NODE_WRAPPER_CLASS);
|
|
19
|
+
classList.toggle(DIAGRAM_GROUP_HIGHLIGHT_CLASS, !!node?.highlighted);
|
|
20
|
+
return nothing;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const diagramGroupHighlighted = directive(DiagramGroupHighlightedDirective);
|
|
24
|
+
|
|
25
|
+
export { DIAGRAM_GROUP_HIGHLIGHT_CLASS, diagramGroupHighlighted };
|