@emuanalytics/flow-rdf-ui 4.2.1 → 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 +3 -4
- 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 +4 -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 +7002 -867
- 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 +13406 -3796
- package/dist/index.d.ts +13406 -3796
- 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 +369 -96
- 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,607 @@
|
|
|
1
|
+
const NUMBER = "[+-]?(?:\\d+\\.?\\d*|\\.\\d+)(?:e[+-]?\\d+)?";
|
|
2
|
+
const PX_PATTERN = new RegExp(`^(${NUMBER})(?:px)?$`, "i");
|
|
3
|
+
const PERCENT_PATTERN = new RegExp(`^(${NUMBER})%$`, "i");
|
|
4
|
+
function parseSize(raw) {
|
|
5
|
+
if (raw === void 0 || raw === null) {
|
|
6
|
+
return void 0;
|
|
7
|
+
}
|
|
8
|
+
const value = String(raw).trim().toLowerCase();
|
|
9
|
+
if (value === "auto" || value === "content") {
|
|
10
|
+
return { kind: value };
|
|
11
|
+
}
|
|
12
|
+
let match = PX_PATTERN.exec(value);
|
|
13
|
+
if (match) {
|
|
14
|
+
return { kind: "px", value: Math.max(0, parseFloat(match[1])) };
|
|
15
|
+
}
|
|
16
|
+
match = PERCENT_PATTERN.exec(value);
|
|
17
|
+
if (match) {
|
|
18
|
+
return { kind: "percent", value: Math.max(0, parseFloat(match[1])) };
|
|
19
|
+
}
|
|
20
|
+
return void 0;
|
|
21
|
+
}
|
|
22
|
+
function toPx(size, container) {
|
|
23
|
+
if (size.kind === "px") {
|
|
24
|
+
return Math.round(size.value);
|
|
25
|
+
}
|
|
26
|
+
if (size.kind === "percent") {
|
|
27
|
+
return Math.round(size.value / 100 * container);
|
|
28
|
+
}
|
|
29
|
+
return void 0;
|
|
30
|
+
}
|
|
31
|
+
function clamp(value, min, max) {
|
|
32
|
+
return Math.max(min, Math.min(max, value));
|
|
33
|
+
}
|
|
34
|
+
function resolvePane(pane, container) {
|
|
35
|
+
const { constraints } = pane;
|
|
36
|
+
const size = parseSize(constraints.size);
|
|
37
|
+
const minSpec = parseSize(constraints.minSize);
|
|
38
|
+
const maxSpec = parseSize(constraints.maxSize);
|
|
39
|
+
const closedSpec = parseSize(constraints.closedSize);
|
|
40
|
+
const min = (minSpec && toPx(minSpec, container)) ?? 0;
|
|
41
|
+
const max = Math.max(min, (maxSpec && toPx(maxSpec, container)) ?? Infinity);
|
|
42
|
+
let closedSize = 0;
|
|
43
|
+
let closable = false;
|
|
44
|
+
if (closedSpec?.kind === "content") {
|
|
45
|
+
closedSize = pane.closedContentSize ?? 0;
|
|
46
|
+
closable = true;
|
|
47
|
+
} else if (closedSpec) {
|
|
48
|
+
closedSize = toPx(closedSpec, container) ?? 0;
|
|
49
|
+
closable = closedSize > 0;
|
|
50
|
+
}
|
|
51
|
+
const kind = size?.kind === "content" ? "content" : size?.kind === "px" || size?.kind === "percent" ? "fixed" : "auto";
|
|
52
|
+
const preferredSpec = parseSize(pane.preferred);
|
|
53
|
+
const preferred = preferredSpec && toPx(preferredSpec, container);
|
|
54
|
+
let base;
|
|
55
|
+
let growLimit = max;
|
|
56
|
+
if (kind === "content") {
|
|
57
|
+
const content = clamp(pane.contentSize ?? 0, min, max);
|
|
58
|
+
base = clamp(Math.min(content, pane.contentCap ?? Infinity), min, max);
|
|
59
|
+
growLimit = content;
|
|
60
|
+
} else if (preferred !== void 0) {
|
|
61
|
+
base = clamp(preferred, min, max);
|
|
62
|
+
} else if (kind === "fixed") {
|
|
63
|
+
base = clamp(toPx(size, container), min, max);
|
|
64
|
+
} else {
|
|
65
|
+
base = min;
|
|
66
|
+
}
|
|
67
|
+
return { kind, percent: size?.kind === "percent", min, max, closedSize, closable, base, growLimit };
|
|
68
|
+
}
|
|
69
|
+
function isVisible(pane) {
|
|
70
|
+
return pane.presence === "present";
|
|
71
|
+
}
|
|
72
|
+
function proportional(amount, weights) {
|
|
73
|
+
const total = weights.reduce((a, b) => a + b, 0);
|
|
74
|
+
if (total <= 0) {
|
|
75
|
+
return weights.map(() => 0);
|
|
76
|
+
}
|
|
77
|
+
const exact = weights.map((w) => amount * w / total);
|
|
78
|
+
const result = exact.map((x) => Math.floor(x));
|
|
79
|
+
let remainder = amount - result.reduce((a, b) => a + b, 0);
|
|
80
|
+
const order = exact.map((x, i) => ({ i, frac: x - Math.floor(x) })).sort((a, b) => b.frac - a.frac || a.i - b.i);
|
|
81
|
+
for (const { i } of order) {
|
|
82
|
+
if (remainder <= 0) {
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
result[i]++;
|
|
86
|
+
remainder--;
|
|
87
|
+
}
|
|
88
|
+
return result;
|
|
89
|
+
}
|
|
90
|
+
function shareEvenly(sizes, indices, amount, limit, direction) {
|
|
91
|
+
let active = indices.filter((i) => (sizes[i] - limit(i)) * direction < 0);
|
|
92
|
+
while (amount > 0 && active.length > 0) {
|
|
93
|
+
const share = Math.floor(amount / active.length);
|
|
94
|
+
const extra = amount % active.length;
|
|
95
|
+
active.forEach((i, j) => {
|
|
96
|
+
const bonus = direction === 1 ? j < extra : j >= active.length - extra;
|
|
97
|
+
const room = Math.abs(limit(i) - sizes[i]);
|
|
98
|
+
const change = Math.min(share + (bonus ? 1 : 0), room);
|
|
99
|
+
sizes[i] += change * direction;
|
|
100
|
+
amount -= change;
|
|
101
|
+
});
|
|
102
|
+
active = active.filter((i) => (sizes[i] - limit(i)) * direction < 0);
|
|
103
|
+
}
|
|
104
|
+
return amount;
|
|
105
|
+
}
|
|
106
|
+
function sequentially(sizes, indices, amount, limit, direction) {
|
|
107
|
+
for (const i of indices) {
|
|
108
|
+
if (amount <= 0) {
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
const change = Math.min(amount, Math.max(0, (limit(i) - sizes[i]) * direction));
|
|
112
|
+
sizes[i] += change * direction;
|
|
113
|
+
amount -= change;
|
|
114
|
+
}
|
|
115
|
+
return amount;
|
|
116
|
+
}
|
|
117
|
+
const layoutCache = /* @__PURE__ */ new WeakMap();
|
|
118
|
+
function computeLayout(state) {
|
|
119
|
+
if (layoutCache.has(state)) {
|
|
120
|
+
return layoutCache.get(state);
|
|
121
|
+
}
|
|
122
|
+
const layout = solve(state);
|
|
123
|
+
layoutCache.set(state, layout);
|
|
124
|
+
return layout;
|
|
125
|
+
}
|
|
126
|
+
function solve(state) {
|
|
127
|
+
const container = state.container;
|
|
128
|
+
if (container <= 0) {
|
|
129
|
+
return void 0;
|
|
130
|
+
}
|
|
131
|
+
const { panes } = state;
|
|
132
|
+
const resolved = panes.map((pane) => resolvePane(pane, container));
|
|
133
|
+
const sizes = panes.map(() => 0);
|
|
134
|
+
const visible = panes.map((_, i) => i).filter((i) => isVisible(panes[i]));
|
|
135
|
+
const closed = visible.filter((i) => panes[i].closed);
|
|
136
|
+
const open = visible.filter((i) => !panes[i].closed);
|
|
137
|
+
let slack = 0;
|
|
138
|
+
let overflow = false;
|
|
139
|
+
const closedTotal = closed.reduce((sum, i) => sum + resolved[i].closedSize, 0);
|
|
140
|
+
const available = container - closedTotal;
|
|
141
|
+
const result = () => ({
|
|
142
|
+
container,
|
|
143
|
+
panes: panes.map((pane, i) => ({
|
|
144
|
+
key: pane.key,
|
|
145
|
+
size: sizes[i],
|
|
146
|
+
visible: isVisible(pane),
|
|
147
|
+
closed: pane.closed,
|
|
148
|
+
minSize: resolved[i].min,
|
|
149
|
+
maxSize: resolved[i].max
|
|
150
|
+
})),
|
|
151
|
+
slack,
|
|
152
|
+
overflow
|
|
153
|
+
});
|
|
154
|
+
if (available < 0) {
|
|
155
|
+
const shares = proportional(
|
|
156
|
+
container,
|
|
157
|
+
closed.map((i) => resolved[i].closedSize)
|
|
158
|
+
);
|
|
159
|
+
closed.forEach((i, j) => sizes[i] = shares[j]);
|
|
160
|
+
overflow = true;
|
|
161
|
+
return result();
|
|
162
|
+
}
|
|
163
|
+
closed.forEach((i) => sizes[i] = resolved[i].closedSize);
|
|
164
|
+
if (open.length === 0) {
|
|
165
|
+
slack = available;
|
|
166
|
+
return result();
|
|
167
|
+
}
|
|
168
|
+
if (open.length === 1 && resolved[open[0]].kind !== "content") {
|
|
169
|
+
sizes[open[0]] = available;
|
|
170
|
+
return result();
|
|
171
|
+
}
|
|
172
|
+
const minTotal = open.reduce((sum, i) => sum + resolved[i].min, 0);
|
|
173
|
+
if (minTotal > available) {
|
|
174
|
+
const shares = proportional(
|
|
175
|
+
available,
|
|
176
|
+
open.map((i) => resolved[i].min)
|
|
177
|
+
);
|
|
178
|
+
open.forEach((i, j) => sizes[i] = shares[j]);
|
|
179
|
+
overflow = true;
|
|
180
|
+
return result();
|
|
181
|
+
}
|
|
182
|
+
open.forEach((i) => sizes[i] = resolved[i].base);
|
|
183
|
+
const autos = open.filter((i) => resolved[i].kind === "auto");
|
|
184
|
+
const others = open.filter((i) => resolved[i].kind !== "auto");
|
|
185
|
+
const difference = available - open.reduce((sum, i) => sum + sizes[i], 0);
|
|
186
|
+
if (difference >= 0) {
|
|
187
|
+
let surplus = shareEvenly(sizes, autos, difference, (i) => resolved[i].max, 1);
|
|
188
|
+
if (surplus > 0) {
|
|
189
|
+
surplus = growFixed(state, resolved, sizes, others, surplus);
|
|
190
|
+
}
|
|
191
|
+
slack = surplus;
|
|
192
|
+
} else {
|
|
193
|
+
const deficit = shareEvenly(sizes, autos, -difference, (i) => resolved[i].min, -1);
|
|
194
|
+
if (deficit > 0) {
|
|
195
|
+
const unclaimed = others.filter((i) => panes[i].claimSeq === void 0).reverse();
|
|
196
|
+
const claimed = others.filter((i) => panes[i].claimSeq !== void 0).sort((a, b) => panes[a].claimSeq - panes[b].claimSeq);
|
|
197
|
+
sequentially(sizes, [...unclaimed, ...claimed], deficit, (i) => resolved[i].min, -1);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return result();
|
|
201
|
+
}
|
|
202
|
+
function growFixed(state, resolved, sizes, others, surplus) {
|
|
203
|
+
const growable = others.filter((i) => resolved[i].kind === "fixed");
|
|
204
|
+
const limit = (i) => resolved[i].max;
|
|
205
|
+
state.panes.forEach((pane, k) => {
|
|
206
|
+
if (surplus <= 0) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
let released = 0;
|
|
210
|
+
if (isVisible(pane) && pane.closed) {
|
|
211
|
+
released = Math.max(0, resolved[k].base - resolved[k].closedSize);
|
|
212
|
+
} else if (!isVisible(pane) && !pane.newcomer) {
|
|
213
|
+
released = pane.closed ? resolved[k].closedSize : resolved[k].base;
|
|
214
|
+
}
|
|
215
|
+
if (released > 0) {
|
|
216
|
+
const portion = Math.min(surplus, released);
|
|
217
|
+
const order = [...growable.filter((i) => i > k), ...growable.filter((i) => i < k)];
|
|
218
|
+
surplus -= portion - sequentially(sizes, order, portion, limit, 1);
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
return sequentially(sizes, growable, surplus, limit, 1);
|
|
222
|
+
}
|
|
223
|
+
function fits(panes, container) {
|
|
224
|
+
let total = 0;
|
|
225
|
+
for (const pane of panes) {
|
|
226
|
+
if (isVisible(pane)) {
|
|
227
|
+
const r = resolvePane(pane, container);
|
|
228
|
+
total += pane.closed ? r.closedSize : r.min;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return total <= container;
|
|
232
|
+
}
|
|
233
|
+
function fit(state, { allowClose, protect }) {
|
|
234
|
+
const { container } = state;
|
|
235
|
+
if (container <= 0) {
|
|
236
|
+
return state;
|
|
237
|
+
}
|
|
238
|
+
return allowClose ? refit(state, protect) : reopen(state);
|
|
239
|
+
}
|
|
240
|
+
function refit(state, protect) {
|
|
241
|
+
const { container } = state;
|
|
242
|
+
const trial = state.panes.map((pane) => pane.closed === "auto" ? { ...pane, closed: false } : pane);
|
|
243
|
+
const order = [];
|
|
244
|
+
while (!fits(trial, container)) {
|
|
245
|
+
let candidate = -1;
|
|
246
|
+
for (let i = trial.length - 1; i >= 0; i--) {
|
|
247
|
+
const pane = trial[i];
|
|
248
|
+
if (!isVisible(pane) || pane.closed || protect?.has(pane.key)) {
|
|
249
|
+
continue;
|
|
250
|
+
}
|
|
251
|
+
const r = resolvePane(pane, container);
|
|
252
|
+
if (r.closable && r.closedSize < r.min) {
|
|
253
|
+
candidate = i;
|
|
254
|
+
break;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
if (candidate < 0) {
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
260
|
+
trial[candidate] = { ...trial[candidate], closed: "auto" };
|
|
261
|
+
order.push(candidate);
|
|
262
|
+
}
|
|
263
|
+
const current = state.panes.map((pane, i) => ({ pane, i })).filter(({ pane }) => pane.closed === "auto").sort((a, b) => a.pane.autoClosedSeq - b.pane.autoClosedSeq).map(({ i }) => i);
|
|
264
|
+
if (current.length === order.length && current.every((i, j) => i === order[j])) {
|
|
265
|
+
return state;
|
|
266
|
+
}
|
|
267
|
+
let seq = state.seq;
|
|
268
|
+
const panes = state.panes.map(
|
|
269
|
+
(pane) => pane.closed === "auto" ? { ...pane, closed: false, autoClosedSeq: void 0 } : pane
|
|
270
|
+
);
|
|
271
|
+
for (const i of order) {
|
|
272
|
+
panes[i] = { ...panes[i], closed: "auto", autoClosedSeq: ++seq };
|
|
273
|
+
}
|
|
274
|
+
return { ...state, seq, panes };
|
|
275
|
+
}
|
|
276
|
+
function reopen(state) {
|
|
277
|
+
const { container } = state;
|
|
278
|
+
const panes = [...state.panes];
|
|
279
|
+
let changed = false;
|
|
280
|
+
for (; ; ) {
|
|
281
|
+
let top = -1;
|
|
282
|
+
panes.forEach((pane, i) => {
|
|
283
|
+
if (isVisible(pane) && pane.closed === "auto" && (top < 0 || pane.autoClosedSeq > panes[top].autoClosedSeq)) {
|
|
284
|
+
top = i;
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
if (top < 0) {
|
|
288
|
+
break;
|
|
289
|
+
}
|
|
290
|
+
const trial = [...panes];
|
|
291
|
+
trial[top] = { ...panes[top], closed: false, autoClosedSeq: void 0 };
|
|
292
|
+
if (!fits(trial, container)) {
|
|
293
|
+
break;
|
|
294
|
+
}
|
|
295
|
+
panes[top] = trial[top];
|
|
296
|
+
changed = true;
|
|
297
|
+
}
|
|
298
|
+
return changed ? { ...state, panes } : state;
|
|
299
|
+
}
|
|
300
|
+
function createSplitLayout() {
|
|
301
|
+
return { container: 0, laidOut: false, seq: 0, panes: [] };
|
|
302
|
+
}
|
|
303
|
+
function resizeContainer(state, size) {
|
|
304
|
+
const container = Number.isFinite(size) && size > 0 ? Math.floor(size + 1e-3) : 0;
|
|
305
|
+
if (container === state.container) {
|
|
306
|
+
return state;
|
|
307
|
+
}
|
|
308
|
+
const next = { ...state, container, laidOut: state.laidOut || container > 0 };
|
|
309
|
+
return fit(next, { allowClose: true });
|
|
310
|
+
}
|
|
311
|
+
function syncPanes(state, descriptors, memory) {
|
|
312
|
+
const oldByKey = new Map(state.panes.map((pane) => [pane.key, pane]));
|
|
313
|
+
const seen = /* @__PURE__ */ new Set();
|
|
314
|
+
const opened = /* @__PURE__ */ new Set();
|
|
315
|
+
const present = [];
|
|
316
|
+
let seq = state.seq;
|
|
317
|
+
let structural = false;
|
|
318
|
+
let changed = false;
|
|
319
|
+
for (const descriptor of descriptors) {
|
|
320
|
+
let key = descriptor.key;
|
|
321
|
+
let persistent = !!descriptor.persistent;
|
|
322
|
+
if (seen.has(key)) {
|
|
323
|
+
let n = 2;
|
|
324
|
+
while (seen.has(`${key}#${n}`)) {
|
|
325
|
+
n++;
|
|
326
|
+
}
|
|
327
|
+
key = `${key}#${n}`;
|
|
328
|
+
persistent = false;
|
|
329
|
+
}
|
|
330
|
+
seen.add(key);
|
|
331
|
+
const constraints = {
|
|
332
|
+
size: descriptor.size,
|
|
333
|
+
minSize: descriptor.minSize,
|
|
334
|
+
maxSize: descriptor.maxSize,
|
|
335
|
+
closedSize: descriptor.closedSize
|
|
336
|
+
};
|
|
337
|
+
const presence = descriptor.hidden ? "hidden" : "present";
|
|
338
|
+
const old = oldByKey.get(key);
|
|
339
|
+
if (!old) {
|
|
340
|
+
const remembered = persistent ? memory?.[key] : void 0;
|
|
341
|
+
const usable = remembered && remembered.size === descriptor.size;
|
|
342
|
+
present.push({
|
|
343
|
+
key,
|
|
344
|
+
persistent,
|
|
345
|
+
constraints,
|
|
346
|
+
preferred: usable ? remembered.preferred : void 0,
|
|
347
|
+
contentCap: usable ? remembered.contentCap : void 0,
|
|
348
|
+
closed: descriptor.closed || remembered?.userClosed ? "user" : false,
|
|
349
|
+
presence,
|
|
350
|
+
newcomer: state.laidOut,
|
|
351
|
+
claimSeq: state.laidOut ? ++seq : void 0
|
|
352
|
+
});
|
|
353
|
+
structural = true;
|
|
354
|
+
changed = true;
|
|
355
|
+
continue;
|
|
356
|
+
}
|
|
357
|
+
let pane = old;
|
|
358
|
+
const update = (patch) => {
|
|
359
|
+
pane = { ...pane, ...patch };
|
|
360
|
+
changed = true;
|
|
361
|
+
};
|
|
362
|
+
if (!sameConstraints(old.constraints, constraints)) {
|
|
363
|
+
update(
|
|
364
|
+
old.constraints.size !== constraints.size ? { constraints, preferred: void 0, contentCap: void 0 } : { constraints }
|
|
365
|
+
);
|
|
366
|
+
structural = true;
|
|
367
|
+
}
|
|
368
|
+
if (old.persistent !== persistent) {
|
|
369
|
+
update({ persistent });
|
|
370
|
+
}
|
|
371
|
+
if (old.presence !== presence) {
|
|
372
|
+
update({ presence });
|
|
373
|
+
structural = true;
|
|
374
|
+
}
|
|
375
|
+
if (old.presence === "departed") {
|
|
376
|
+
if (descriptor.closed && !pane.closed) {
|
|
377
|
+
update({ closed: "user" });
|
|
378
|
+
}
|
|
379
|
+
} else if (descriptor.closed === true && !pane.closed) {
|
|
380
|
+
update({ closed: "user", autoClosedSeq: void 0 });
|
|
381
|
+
} else if (descriptor.closed === false && pane.closed) {
|
|
382
|
+
update({ closed: false, autoClosedSeq: void 0, claimSeq: ++seq });
|
|
383
|
+
opened.add(key);
|
|
384
|
+
}
|
|
385
|
+
present.push(pane);
|
|
386
|
+
}
|
|
387
|
+
const attached = /* @__PURE__ */ new Map();
|
|
388
|
+
let anchor = null;
|
|
389
|
+
for (const old of state.panes) {
|
|
390
|
+
if (seen.has(old.key)) {
|
|
391
|
+
anchor = old.key;
|
|
392
|
+
} else if (old.persistent) {
|
|
393
|
+
if (old.presence !== "departed") {
|
|
394
|
+
structural = true;
|
|
395
|
+
changed = true;
|
|
396
|
+
}
|
|
397
|
+
const list = attached.get(anchor) ?? [];
|
|
398
|
+
list.push(old.presence === "departed" ? old : { ...old, presence: "departed" });
|
|
399
|
+
attached.set(anchor, list);
|
|
400
|
+
} else {
|
|
401
|
+
structural = true;
|
|
402
|
+
changed = true;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
const panes = [...attached.get(null) ?? []];
|
|
406
|
+
for (const pane of present) {
|
|
407
|
+
panes.push(pane, ...attached.get(pane.key) ?? []);
|
|
408
|
+
}
|
|
409
|
+
if (!changed && panes.every((pane, i) => pane === state.panes[i])) {
|
|
410
|
+
return state;
|
|
411
|
+
}
|
|
412
|
+
return fit({ ...state, seq, panes }, { allowClose: structural, protect: opened });
|
|
413
|
+
}
|
|
414
|
+
function sameConstraints(a, b) {
|
|
415
|
+
return a.size === b.size && a.minSize === b.minSize && a.maxSize === b.maxSize && a.closedSize === b.closedSize;
|
|
416
|
+
}
|
|
417
|
+
function setPaneOpen(state, key, open) {
|
|
418
|
+
const index = state.panes.findIndex((pane2) => pane2.key === key);
|
|
419
|
+
if (index < 0) {
|
|
420
|
+
return state;
|
|
421
|
+
}
|
|
422
|
+
const pane = state.panes[index];
|
|
423
|
+
if (open === !pane.closed && (open || pane.closed === "user")) {
|
|
424
|
+
return state;
|
|
425
|
+
}
|
|
426
|
+
const panes = [...state.panes];
|
|
427
|
+
let seq = state.seq;
|
|
428
|
+
panes[index] = open ? { ...pane, closed: false, autoClosedSeq: void 0, claimSeq: ++seq } : { ...pane, closed: "user", autoClosedSeq: void 0 };
|
|
429
|
+
return fit({ ...state, seq, panes }, { allowClose: false, protect: /* @__PURE__ */ new Set([key]) });
|
|
430
|
+
}
|
|
431
|
+
function setContentSize(state, key, sizes) {
|
|
432
|
+
const index = state.panes.findIndex((pane2) => pane2.key === key);
|
|
433
|
+
if (index < 0) {
|
|
434
|
+
return state;
|
|
435
|
+
}
|
|
436
|
+
const pane = state.panes[index];
|
|
437
|
+
const round = (value, current) => value === void 0 || !Number.isFinite(value) ? current : Math.max(0, Math.ceil(value - 1e-3));
|
|
438
|
+
const contentSize = round(sizes.open, pane.contentSize);
|
|
439
|
+
const closedContentSize = round(sizes.closed, pane.closedContentSize);
|
|
440
|
+
if (contentSize === pane.contentSize && closedContentSize === pane.closedContentSize) {
|
|
441
|
+
return state;
|
|
442
|
+
}
|
|
443
|
+
const panes = [...state.panes];
|
|
444
|
+
panes[index] = { ...pane, contentSize, closedContentSize };
|
|
445
|
+
return fit({ ...state, panes }, { allowClose: true });
|
|
446
|
+
}
|
|
447
|
+
function dragDivider(start, key, delta, options = {}) {
|
|
448
|
+
const layout = computeLayout(start);
|
|
449
|
+
const amount = Math.round(Math.abs(delta));
|
|
450
|
+
if (!layout || amount === 0) {
|
|
451
|
+
return start;
|
|
452
|
+
}
|
|
453
|
+
const { panes, container } = start;
|
|
454
|
+
const resolved = panes.map((pane) => resolvePane(pane, container));
|
|
455
|
+
const visible = panes.map((_, i) => i).filter((i) => isVisible(panes[i]));
|
|
456
|
+
const position = visible.indexOf(panes.findIndex((pane) => pane.key === key));
|
|
457
|
+
if (position < 0 || position === visible.length - 1) {
|
|
458
|
+
return start;
|
|
459
|
+
}
|
|
460
|
+
const before = visible.slice(0, position + 1).reverse();
|
|
461
|
+
const after = visible.slice(position + 1);
|
|
462
|
+
const [growing, shrinking] = delta > 0 ? [before, after] : [after, before];
|
|
463
|
+
const sizes = layout.panes.map((pane) => pane.size);
|
|
464
|
+
const closed = panes.map((pane) => pane.closed);
|
|
465
|
+
const first = growing[0];
|
|
466
|
+
let snapOpen = false;
|
|
467
|
+
if (closed[first] && resolved[first].closable) {
|
|
468
|
+
if (resolved[first].closedSize + amount < resolved[first].min) {
|
|
469
|
+
return start;
|
|
470
|
+
}
|
|
471
|
+
snapOpen = true;
|
|
472
|
+
sizes[first] = resolved[first].closedSize;
|
|
473
|
+
}
|
|
474
|
+
const canGrow = (i) => !closed[i] || i === first && snapOpen;
|
|
475
|
+
const room = growing.filter(canGrow).reduce((sum, i) => sum + Math.max(0, resolved[i].growLimit - sizes[i]), 0);
|
|
476
|
+
let remaining = amount;
|
|
477
|
+
let given = 0;
|
|
478
|
+
for (const i of shrinking) {
|
|
479
|
+
if (remaining <= 0 || given >= room) {
|
|
480
|
+
break;
|
|
481
|
+
}
|
|
482
|
+
if (closed[i]) {
|
|
483
|
+
continue;
|
|
484
|
+
}
|
|
485
|
+
const r = resolved[i];
|
|
486
|
+
const soft = Math.max(0, sizes[i] - r.min);
|
|
487
|
+
const free = room - given;
|
|
488
|
+
if (remaining <= soft) {
|
|
489
|
+
const take = Math.min(remaining, free);
|
|
490
|
+
sizes[i] -= take;
|
|
491
|
+
given += take;
|
|
492
|
+
remaining -= take;
|
|
493
|
+
continue;
|
|
494
|
+
}
|
|
495
|
+
const full = sizes[i] - r.closedSize;
|
|
496
|
+
if (r.closable && !options.noDragClose && full > 0 && full <= free) {
|
|
497
|
+
sizes[i] = r.closedSize;
|
|
498
|
+
closed[i] = "user";
|
|
499
|
+
given += full;
|
|
500
|
+
remaining -= full;
|
|
501
|
+
} else {
|
|
502
|
+
const take = Math.min(soft, free);
|
|
503
|
+
sizes[i] -= take;
|
|
504
|
+
given += take;
|
|
505
|
+
remaining -= take;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
if (snapOpen && resolved[first].closedSize + given < resolved[first].min) {
|
|
509
|
+
return start;
|
|
510
|
+
}
|
|
511
|
+
if (given === 0) {
|
|
512
|
+
return start;
|
|
513
|
+
}
|
|
514
|
+
sequentially(sizes, growing.filter(canGrow), given, (i) => resolved[i].growLimit, 1);
|
|
515
|
+
if (snapOpen) {
|
|
516
|
+
closed[first] = false;
|
|
517
|
+
}
|
|
518
|
+
let seq = start.seq;
|
|
519
|
+
const next = [...panes];
|
|
520
|
+
const committed = /* @__PURE__ */ new Set();
|
|
521
|
+
const commit = (i) => {
|
|
522
|
+
committed.add(i);
|
|
523
|
+
const pane = panes[i];
|
|
524
|
+
if (closed[i]) {
|
|
525
|
+
next[i] = { ...pane, closed: "user", autoClosedSeq: void 0 };
|
|
526
|
+
return;
|
|
527
|
+
}
|
|
528
|
+
const r = resolved[i];
|
|
529
|
+
const patch = pane.closed ? { closed: false, autoClosedSeq: void 0, claimSeq: ++seq } : {};
|
|
530
|
+
if (r.kind === "content") {
|
|
531
|
+
patch.contentCap = sizes[i] < r.growLimit ? sizes[i] : void 0;
|
|
532
|
+
} else {
|
|
533
|
+
patch.preferred = r.percent ? `${sizes[i] / container * 100}%` : `${sizes[i]}px`;
|
|
534
|
+
}
|
|
535
|
+
next[i] = { ...pane, ...patch };
|
|
536
|
+
};
|
|
537
|
+
visible.forEach((i) => {
|
|
538
|
+
if (sizes[i] !== layout.panes[i].size || closed[i] !== panes[i].closed) {
|
|
539
|
+
commit(i);
|
|
540
|
+
}
|
|
541
|
+
});
|
|
542
|
+
for (let pass = 0; pass < panes.length; pass++) {
|
|
543
|
+
const solved = computeLayout({ ...start, seq, panes: [...next] });
|
|
544
|
+
const moved = visible.filter((i) => !committed.has(i) && !closed[i] && solved.panes[i].size !== sizes[i]);
|
|
545
|
+
if (moved.length === 0) {
|
|
546
|
+
break;
|
|
547
|
+
}
|
|
548
|
+
moved.forEach(commit);
|
|
549
|
+
}
|
|
550
|
+
return { ...start, seq, panes: [...next] };
|
|
551
|
+
}
|
|
552
|
+
function describeChanges(previous, next) {
|
|
553
|
+
const before = new Map(previous.panes.map((pane) => [pane.key, pane]));
|
|
554
|
+
const changes = [];
|
|
555
|
+
for (const pane of next.panes) {
|
|
556
|
+
const old = before.get(pane.key);
|
|
557
|
+
before.delete(pane.key);
|
|
558
|
+
const wasVisible = !!old && isVisible(old);
|
|
559
|
+
const { key, persistent } = pane;
|
|
560
|
+
if (isVisible(pane) && !wasVisible) {
|
|
561
|
+
changes.push({ key, change: "appeared", auto: false, persistent });
|
|
562
|
+
} else if (!isVisible(pane) && wasVisible) {
|
|
563
|
+
changes.push({ key, change: "disappeared", auto: false, persistent });
|
|
564
|
+
} else if (isVisible(pane) && old && !!old.closed !== !!pane.closed) {
|
|
565
|
+
const auto = pane.closed ? pane.closed === "auto" : old.closed === "auto" && old.claimSeq === pane.claimSeq;
|
|
566
|
+
changes.push({ key, change: pane.closed ? "closed" : "opened", auto, persistent });
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
for (const old of before.values()) {
|
|
570
|
+
if (isVisible(old)) {
|
|
571
|
+
changes.push({ key: old.key, change: "disappeared", auto: false, persistent: old.persistent });
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
return changes;
|
|
575
|
+
}
|
|
576
|
+
function rememberLayout(state) {
|
|
577
|
+
const memory = {};
|
|
578
|
+
for (const pane of state.panes) {
|
|
579
|
+
if (pane.persistent) {
|
|
580
|
+
memory[pane.key] = {
|
|
581
|
+
size: pane.constraints.size,
|
|
582
|
+
preferred: pane.preferred,
|
|
583
|
+
contentCap: pane.contentCap,
|
|
584
|
+
userClosed: pane.closed === "user"
|
|
585
|
+
};
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
return memory;
|
|
589
|
+
}
|
|
590
|
+
function describeDivider(state, key, options = {}) {
|
|
591
|
+
const layout = computeLayout(state);
|
|
592
|
+
const { panes, container } = state;
|
|
593
|
+
const index = panes.findIndex((pane) => pane.key === key);
|
|
594
|
+
const next = panes.findIndex((pane, i) => i > index && isVisible(pane));
|
|
595
|
+
if (!layout || index < 0 || !isVisible(panes[index]) || next < 0) {
|
|
596
|
+
return void 0;
|
|
597
|
+
}
|
|
598
|
+
const side = (i) => {
|
|
599
|
+
const { closable, closedSize } = resolvePane(panes[i], container);
|
|
600
|
+
const { size, closed, minSize, maxSize } = layout.panes[i];
|
|
601
|
+
return { key: panes[i].key, size, closed, closable, closedSize, minSize, maxSize };
|
|
602
|
+
};
|
|
603
|
+
const movable = dragDivider(state, key, container, options) !== state || dragDivider(state, key, -container, options) !== state;
|
|
604
|
+
return { before: side(index), after: side(next), movable };
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
export { computeLayout, createSplitLayout, describeChanges, describeDivider, dragDivider, rememberLayout, resizeContainer, setContentSize, setPaneOpen, syncPanes };
|