@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
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import { html } from 'lit';
|
|
1
|
+
import { html, nothing } from 'lit';
|
|
2
2
|
import { state, query, property } from 'lit/decorators.js';
|
|
3
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
4
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
5
|
+
import { repeat } from 'lit/directives/repeat.js';
|
|
4
6
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
5
7
|
import { boolean } from '../../internal/boolean.mjs';
|
|
8
|
+
import { CONTENT_RESIZE_EVENT } from '../../internal/content-size.mjs';
|
|
6
9
|
import FlowRdfElement from '../../internal/flow-ui-rdf-element.mjs';
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
+
import { LocalizeController } from '../../utilities/localize.mjs';
|
|
11
|
+
import FlowUiSplitViewDivider from '../split-view-divider/split-view-divider.component.mjs';
|
|
12
|
+
import { createSplitLayout, dragDivider, resizeContainer, computeLayout, describeChanges, syncPanes, rememberLayout, setContentSize, setPaneOpen, describeDivider } from './split-view-layout.mjs';
|
|
13
|
+
import { leaveLayoutRegistry, rememberedLayout, joinLayoutRegistry, storeLayout } from './split-view-layout-registry.mjs';
|
|
10
14
|
import styles from './split-view.styles.mjs';
|
|
11
15
|
|
|
12
16
|
var __defProp = Object.defineProperty;
|
|
@@ -20,554 +24,584 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
20
24
|
__defProp(target, key, result);
|
|
21
25
|
return result;
|
|
22
26
|
};
|
|
27
|
+
const PANE_TAG = "flow-ui-split-view-pane";
|
|
28
|
+
const PANE_ATTRIBUTES = ["id", "size", "min-size", "max-size", "closed-size", "closed", "hidden"];
|
|
29
|
+
const GENERATED_PANE_ID = /^flow-ui-split-view-pane-\d+$/;
|
|
30
|
+
const ANIMATION_TIMEOUT = 1e3;
|
|
31
|
+
const KEYBOARD_STEP = 10;
|
|
32
|
+
const KEYBOARD_LARGE_STEP = 50;
|
|
33
|
+
let internalKeyCount = 0;
|
|
34
|
+
const internalKeys = /* @__PURE__ */ new WeakMap();
|
|
35
|
+
function internalKey(pane) {
|
|
36
|
+
let key = internalKeys.get(pane);
|
|
37
|
+
if (!key) {
|
|
38
|
+
key = `\0pane-${++internalKeyCount}`;
|
|
39
|
+
internalKeys.set(pane, key);
|
|
40
|
+
}
|
|
41
|
+
return key;
|
|
42
|
+
}
|
|
43
|
+
function readString(pane, name, attribute) {
|
|
44
|
+
const value = pane[name];
|
|
45
|
+
return typeof value === "string" ? value : pane.getAttribute(attribute) ?? void 0;
|
|
46
|
+
}
|
|
47
|
+
function readSize(pane, name, attribute) {
|
|
48
|
+
const value = readString(pane, name, attribute);
|
|
49
|
+
if (value === "content" && pane.contentSizable === false) {
|
|
50
|
+
return name === "size" ? "auto" : "0px";
|
|
51
|
+
}
|
|
52
|
+
return value;
|
|
53
|
+
}
|
|
54
|
+
function readBoolean(pane, name) {
|
|
55
|
+
const value = pane[name];
|
|
56
|
+
return value === void 0 ? pane.hasAttribute(name) : boolean(value, true);
|
|
57
|
+
}
|
|
58
|
+
function sameElements(a, b) {
|
|
59
|
+
return a.length === b.length && a.every((element, i) => element === b[i]);
|
|
60
|
+
}
|
|
61
|
+
function isTrackTransition(animation) {
|
|
62
|
+
return !!animation.transitionProperty?.startsWith("grid-template");
|
|
63
|
+
}
|
|
64
|
+
function controlledPane(divider) {
|
|
65
|
+
return divider.before.closable || !divider.after.closable ? divider.before : divider.after;
|
|
66
|
+
}
|
|
23
67
|
class FlowUiSplitView extends FlowRdfElement {
|
|
24
68
|
constructor() {
|
|
25
|
-
super(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
69
|
+
super();
|
|
70
|
+
/** The solver state. Replaced (never mutated) by `commit()` on every trigger. */
|
|
71
|
+
this.layoutState = createSplitLayout();
|
|
72
|
+
/**
|
|
73
|
+
* What a split view without an id remembers about its panes with an id, for the element's lifetime. A split view with
|
|
74
|
+
* an id keeps it in the page-level registry instead (see `split-view-layout-registry.ts`).
|
|
75
|
+
*/
|
|
76
|
+
this.layoutMemory = {};
|
|
77
|
+
/** Solver key of each child pane. */
|
|
78
|
+
this.paneKeys = /* @__PURE__ */ new Map();
|
|
79
|
+
/** Size of a divider along the split axis, in px, measured from a rendered divider. */
|
|
80
|
+
this.dividerSize = 2;
|
|
81
|
+
/** Set when the child pane list changed since the last commit (removed or added panes don't animate). */
|
|
82
|
+
this.paneListChanged = false;
|
|
83
|
+
this.localize = new LocalizeController(this);
|
|
84
|
+
/** Panes whose content size may have changed, measured in the next animation frame. */
|
|
85
|
+
this.contentChanged = /* @__PURE__ */ new Set();
|
|
86
|
+
this.childObserver = new MutationObserver(() => this.syncPanes());
|
|
87
|
+
this.paneObserver = new MutationObserver(() => this.syncPanes());
|
|
88
|
+
this.resizeObserver = new ResizeObserver((entries) => this.handleResize(entries));
|
|
89
|
+
this.panes = [];
|
|
90
|
+
this.animating = false;
|
|
30
91
|
this.noDragClose = false;
|
|
31
|
-
this.positions = ["auto", "auto", "auto", "auto"];
|
|
32
92
|
this.vertical = false;
|
|
33
93
|
this.dragging = false;
|
|
94
|
+
// -------------------------------------------------------------------------------------------------------------------
|
|
95
|
+
// Content-sized panes
|
|
96
|
+
/** A content-sized pane's content may have changed size: measure it in the next animation frame. */
|
|
97
|
+
this.handleContentResize = (event) => {
|
|
98
|
+
event.stopPropagation();
|
|
99
|
+
const pane = event.target;
|
|
100
|
+
if (pane.localName !== PANE_TAG || pane.parentElement !== this) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
this.contentChanged.add(pane);
|
|
104
|
+
this.contentFrame ?? (this.contentFrame = requestAnimationFrame(() => {
|
|
105
|
+
this.contentFrame = void 0;
|
|
106
|
+
const panes = this.panes.filter((p) => this.contentChanged.has(p));
|
|
107
|
+
this.contentChanged.clear();
|
|
108
|
+
this.syncPanes();
|
|
109
|
+
this.commit(this.measureContent(this.layoutState, panes));
|
|
110
|
+
}));
|
|
111
|
+
};
|
|
112
|
+
this.handleDividerPointerMove = (event) => {
|
|
113
|
+
const drag = this.drag;
|
|
114
|
+
if (!drag || event.pointerId !== drag.pointerId) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
drag.last = this.pointerPosition(event, drag.sign);
|
|
118
|
+
this.commit(dragDivider(drag.start, drag.key, drag.last - drag.origin, { noDragClose: this.noDragClose }), {
|
|
119
|
+
drag: true
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
this.handleDividerPointerUp = (event) => {
|
|
123
|
+
const drag = this.drag;
|
|
124
|
+
if (!drag || event.pointerId !== drag.pointerId) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
const rect = this.getBoundingClientRect();
|
|
128
|
+
const outside = event.clientX < rect.left || event.clientX > rect.right || event.clientY < rect.top || event.clientY > rect.bottom;
|
|
129
|
+
this.endDrag(outside);
|
|
130
|
+
};
|
|
131
|
+
this.handleDividerPointerCancel = (event) => {
|
|
132
|
+
if (this.drag && event.pointerId === this.drag.pointerId) {
|
|
133
|
+
this.endDrag(false);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
this.addEventListener(CONTENT_RESIZE_EVENT, this.handleContentResize);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* The actual sizes of the panes, in CSS px units, in the order of the child panes (`0px` for hidden panes), or
|
|
140
|
+
* `auto` for each pane before the split view is first laid out. Note that this property is read-only output: setting
|
|
141
|
+
* it has no effect. Use each pane's `size` to set its preferred size.
|
|
142
|
+
*/
|
|
143
|
+
get positions() {
|
|
144
|
+
return this.paneSizes()?.map((size) => `${size}px`) ?? this.panes.map(() => "auto");
|
|
145
|
+
}
|
|
146
|
+
set positions(_value) {
|
|
34
147
|
}
|
|
35
148
|
connectedCallback() {
|
|
36
149
|
super.connectedCallback();
|
|
37
150
|
this.vertical = boolean(this.vertical, true);
|
|
38
151
|
this.noDragClose = boolean(this.noDragClose, true);
|
|
39
|
-
this.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
this.mutationObserver = new MutationObserver(async (mutations) => {
|
|
43
|
-
const panelsAdded = mutations.map((m) => Array.from(m.addedNodes.values())).flat().filter((n) => n instanceof FlowUiSplitViewPane);
|
|
44
|
-
const panelsRemoved = mutations.map((m) => Array.from(m.removedNodes.values())).flat().filter((n) => n instanceof FlowUiSplitViewPane);
|
|
45
|
-
if (panelsAdded.length > 0) {
|
|
46
|
-
this.handlePanelAdded(panelsAdded[0]);
|
|
47
|
-
}
|
|
48
|
-
if (panelsRemoved.length > 0) {
|
|
49
|
-
this.handlePanelRemoved(panelsRemoved[0]);
|
|
50
|
-
}
|
|
51
|
-
this.layoutPanels();
|
|
52
|
-
});
|
|
53
|
-
this.updateComplete.then(() => {
|
|
54
|
-
this.updatePanelInfo();
|
|
55
|
-
this.mutationObserver.observe(this, {
|
|
56
|
-
attributes: true,
|
|
57
|
-
childList: true,
|
|
58
|
-
subtree: true,
|
|
59
|
-
attributeFilter: ["closed", "hidden", "min-size", "max-size", "closed-size", "size"]
|
|
60
|
-
});
|
|
152
|
+
this.childObserver.observe(this, { childList: true, attributes: true, attributeFilter: ["id"] });
|
|
153
|
+
this.syncPanes(true);
|
|
154
|
+
if (this.hasUpdated) {
|
|
61
155
|
this.resizeObserver.observe(this.splitView);
|
|
62
|
-
|
|
63
|
-
});
|
|
156
|
+
}
|
|
64
157
|
}
|
|
65
158
|
disconnectedCallback() {
|
|
66
|
-
this.
|
|
159
|
+
this.childObserver.disconnect();
|
|
160
|
+
this.paneObserver.disconnect();
|
|
67
161
|
this.resizeObserver.disconnect();
|
|
162
|
+
this.cancelContentFrame();
|
|
163
|
+
if (this.registryId) {
|
|
164
|
+
leaveLayoutRegistry(this.registryId, this);
|
|
165
|
+
this.registryId = void 0;
|
|
166
|
+
}
|
|
167
|
+
if (this.drag) {
|
|
168
|
+
this.endDrag(false);
|
|
169
|
+
}
|
|
170
|
+
this.stopAnimation();
|
|
68
171
|
super.disconnectedCallback();
|
|
69
172
|
}
|
|
173
|
+
firstUpdated(changed) {
|
|
174
|
+
super.firstUpdated(changed);
|
|
175
|
+
this.resizeObserver.observe(this.splitView);
|
|
176
|
+
}
|
|
177
|
+
updated(changed) {
|
|
178
|
+
super.updated(changed);
|
|
179
|
+
for (const slot of this.renderRoot.querySelectorAll("slot.split-view__pane")) {
|
|
180
|
+
const assigned = slot.assignedNodes();
|
|
181
|
+
if (slot.pane && (assigned.length !== 1 || assigned[0] !== slot.pane)) {
|
|
182
|
+
slot.assign(slot.pane);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
const divider = this.renderRoot.querySelector(".split-view__divider:not([hidden])");
|
|
186
|
+
const dividerSize = divider ? this.vertical ? divider.offsetHeight : divider.offsetWidth : 0;
|
|
187
|
+
if (dividerSize > 0 && dividerSize !== this.dividerSize || changed.has("vertical")) {
|
|
188
|
+
this.dividerSize = dividerSize > 0 ? dividerSize : this.dividerSize;
|
|
189
|
+
this.commit(resizeContainer(this.layoutState, this.containerSize(this.layoutState)));
|
|
190
|
+
}
|
|
191
|
+
}
|
|
70
192
|
render() {
|
|
71
|
-
const
|
|
193
|
+
const hidden = this.panes.map((pane) => readBoolean(pane, "hidden"));
|
|
194
|
+
const dividerVisible = (i) => !hidden[i] && hidden.slice(0, i).some((h) => !h);
|
|
195
|
+
const sizes = this.paneSizes();
|
|
196
|
+
const tracks = sizes && [
|
|
197
|
+
...this.panes.flatMap((_, i) => [
|
|
198
|
+
...i > 0 ? [dividerVisible(i) ? `${this.dividerSize}px` : "0px"] : [],
|
|
199
|
+
`${sizes[i]}px`
|
|
200
|
+
]),
|
|
201
|
+
// Slack (space no pane can take) and any fraction of a pixel go to a trailing empty track
|
|
202
|
+
"minmax(0, 1fr)"
|
|
203
|
+
];
|
|
204
|
+
const templateProperty = this.vertical ? "grid-template-rows" : "grid-template-columns";
|
|
205
|
+
const placementProperty = this.vertical ? "grid-row" : "grid-column";
|
|
72
206
|
return html`
|
|
73
207
|
<div
|
|
74
|
-
class=${classMap({
|
|
75
|
-
"split-view": true,
|
|
76
|
-
"split-view--animating": isNumber(this.animatingPanelIndex)
|
|
77
|
-
})}
|
|
208
|
+
class=${classMap({ "split-view": true, "split-view--animating": this.animating })}
|
|
78
209
|
?dragging=${this.dragging}
|
|
79
|
-
|
|
80
|
-
@flow-ui-drag-start=${this.handleDragStart}
|
|
81
|
-
@flow-ui-drag-end=${this.handleDragEnd}
|
|
82
|
-
@pointerleave=${this.handlePointerLeave}
|
|
210
|
+
style=${styleMap(tracks ? { [templateProperty]: tracks.join(" ") } : {})}
|
|
83
211
|
@flow-ui-collapse=${this.handleCollapseExpand}
|
|
84
212
|
@flow-ui-expand=${this.handleCollapseExpand}
|
|
85
213
|
@transitionend=${this.handleTransitionEnd}
|
|
86
|
-
style=${styleMap({
|
|
87
|
-
[gridTemplateProperty]: this.positions.join(" ")
|
|
88
|
-
})}
|
|
89
214
|
>
|
|
90
|
-
|
|
215
|
+
${repeat(
|
|
216
|
+
this.panes,
|
|
217
|
+
(pane) => pane,
|
|
218
|
+
(pane, i) => html`
|
|
219
|
+
${i > 0 ? this.renderSplitDivider(i, dividerVisible(i), placementProperty) : nothing}
|
|
220
|
+
<slot
|
|
221
|
+
class="split-view__pane"
|
|
222
|
+
style=${styleMap({ [placementProperty]: `${2 * i + 1}` })}
|
|
223
|
+
.pane=${pane}
|
|
224
|
+
></slot>
|
|
225
|
+
`
|
|
226
|
+
)}
|
|
91
227
|
</div>
|
|
92
228
|
`;
|
|
93
229
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
230
|
+
/**
|
|
231
|
+
* The divider before pane `index`: a separator whose ARIA value is the size of the pane it controls, as a percentage
|
|
232
|
+
* of the space the panes share (the WAI-ARIA window splitter pattern).
|
|
233
|
+
*/
|
|
234
|
+
renderSplitDivider(index, visible, placementProperty) {
|
|
235
|
+
const divider = visible ? this.describeDivider(index) : void 0;
|
|
236
|
+
const controlled = divider && controlledPane(divider);
|
|
237
|
+
const controlledElement = controlled && this.paneByKey(controlled.key);
|
|
238
|
+
const disabled = !!controlled && !divider.movable && !this.canToggle(controlled) && this.drag?.index !== index;
|
|
239
|
+
const container = this.layoutState.container;
|
|
240
|
+
const percent = (px) => Math.round(Math.min(px, container) / container * 100);
|
|
241
|
+
const values = controlled && !disabled && {
|
|
242
|
+
now: percent(controlled.size),
|
|
243
|
+
min: percent(controlled.closable && !this.noDragClose ? controlled.closedSize : controlled.minSize),
|
|
244
|
+
max: percent(controlled.maxSize)
|
|
245
|
+
};
|
|
246
|
+
return html`
|
|
247
|
+
<flow-ui-split-view-divider
|
|
248
|
+
class="split-view__divider"
|
|
249
|
+
part="divider"
|
|
250
|
+
role="separator"
|
|
251
|
+
aria-orientation=${this.vertical ? "horizontal" : "vertical"}
|
|
252
|
+
aria-label=${this.localize.term("resize")}
|
|
253
|
+
aria-valuenow=${ifDefined(values ? values.now : void 0)}
|
|
254
|
+
aria-valuemin=${ifDefined(values ? Math.min(values.min, values.now) : void 0)}
|
|
255
|
+
aria-valuemax=${ifDefined(values ? Math.max(values.max, values.now) : void 0)}
|
|
256
|
+
tabindex=${ifDefined(disabled ? void 0 : "0")}
|
|
257
|
+
style=${styleMap({ [placementProperty]: `${2 * index}` })}
|
|
258
|
+
.ariaControlsElements=${controlledElement ? [controlledElement] : null}
|
|
259
|
+
?vertical=${this.vertical}
|
|
260
|
+
?hidden=${!visible}
|
|
261
|
+
?disabled=${disabled}
|
|
262
|
+
?dragging=${this.dragging && this.drag?.index === index}
|
|
263
|
+
@keydown=${(event) => this.handleDividerKeyDown(event, index)}
|
|
264
|
+
@pointerdown=${(event) => this.handleDividerPointerDown(event, index)}
|
|
265
|
+
@pointermove=${this.handleDividerPointerMove}
|
|
266
|
+
@pointerup=${this.handleDividerPointerUp}
|
|
267
|
+
@pointercancel=${this.handleDividerPointerCancel}
|
|
268
|
+
@lostpointercapture=${this.handleDividerPointerCancel}
|
|
269
|
+
></flow-ui-split-view-divider>
|
|
270
|
+
`;
|
|
97
271
|
}
|
|
272
|
+
// -------------------------------------------------------------------------------------------------------------------
|
|
273
|
+
// Solver
|
|
98
274
|
/**
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
* @param startIndex panel index to start growing from
|
|
103
|
-
* @param direction 1 (right/down) or -1 (left/up)
|
|
104
|
-
* @param caOpen whether panels can be opened to grow space
|
|
105
|
-
* @param amount Number of pixels to grow by
|
|
106
|
-
* @param dryRun if true, don't actually row panels, just calculate the amount that can be grown
|
|
275
|
+
* Make `next` the solver state and apply it: the panes' `closed` properties (auto-close, auto-reopen and drag snaps
|
|
276
|
+
* set them without events), the grid tracks, and the open and close animation.
|
|
107
277
|
*/
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
const panelCurrentSize = this.actualPanelSize(panel);
|
|
116
|
-
const panelMaxSize = this.sizeToPixels(panel.maxSize ?? "100%");
|
|
117
|
-
if (panelCurrentSize >= panelMaxSize) {
|
|
118
|
-
continue;
|
|
119
|
-
}
|
|
120
|
-
const panelGrowableSize = panelMaxSize - panelCurrentSize;
|
|
121
|
-
if (panelGrowableSize > 0) {
|
|
122
|
-
const growAmount = Math.min(amount, panelGrowableSize);
|
|
123
|
-
amount -= growAmount;
|
|
124
|
-
amountGrown += growAmount;
|
|
125
|
-
}
|
|
126
|
-
if (amount <= 0) {
|
|
127
|
-
break;
|
|
128
|
-
}
|
|
278
|
+
commit(next, options = {}) {
|
|
279
|
+
const previous = this.layoutState;
|
|
280
|
+
const paneListChanged = this.paneListChanged;
|
|
281
|
+
this.paneListChanged = false;
|
|
282
|
+
if (next === previous) {
|
|
283
|
+
return;
|
|
129
284
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
const panelMaxSize = this.sizeToPixels(panel.maxSize ?? "100%");
|
|
138
|
-
if (panelCurrentSize >= panelMaxSize) {
|
|
139
|
-
continue;
|
|
140
|
-
}
|
|
141
|
-
const panelGrowableSize = panelMaxSize - panelCurrentSize;
|
|
142
|
-
if (panelGrowableSize > 0) {
|
|
143
|
-
const growAmount = Math.min(amount, panelGrowableSize);
|
|
144
|
-
if (!dryRun) {
|
|
145
|
-
panel.size = panelCurrentSize + growAmount + "px";
|
|
146
|
-
}
|
|
147
|
-
amount -= growAmount;
|
|
148
|
-
amountGrown += growAmount;
|
|
149
|
-
}
|
|
150
|
-
if (amount <= 0) {
|
|
151
|
-
break;
|
|
152
|
-
}
|
|
285
|
+
this.layoutState = next;
|
|
286
|
+
this.storeMemory();
|
|
287
|
+
const closed = new Map(next.panes.map((pane) => [pane.key, !!pane.closed]));
|
|
288
|
+
for (const pane of this.panes) {
|
|
289
|
+
const value = closed.get(this.paneKeys.get(pane));
|
|
290
|
+
if (value !== void 0 && readBoolean(pane, "closed") !== value) {
|
|
291
|
+
pane.closed = value;
|
|
153
292
|
}
|
|
154
293
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
continue;
|
|
160
|
-
}
|
|
161
|
-
const panelClosedSize = this.sizeToPixels(panel.closedSize ?? "0px");
|
|
162
|
-
const panelOpenSize = this.sizeToPixels(isNumber(panel.size) ? panel.size : panel.minSize ?? "0px");
|
|
163
|
-
if (panelOpenSize === 0 || panelClosedSize === 0) {
|
|
164
|
-
continue;
|
|
165
|
-
}
|
|
166
|
-
const panelGrowableSize = panelOpenSize - panelClosedSize;
|
|
167
|
-
if (panelGrowableSize > 0 && panelGrowableSize <= amount) {
|
|
168
|
-
if (!dryRun) {
|
|
169
|
-
panel.closed = false;
|
|
170
|
-
}
|
|
171
|
-
amount -= panelGrowableSize;
|
|
172
|
-
amountGrown += panelGrowableSize;
|
|
173
|
-
}
|
|
174
|
-
if (amount <= 0) {
|
|
175
|
-
break;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
294
|
+
const hadLayout = !!computeLayout(previous);
|
|
295
|
+
const layout = computeLayout(next);
|
|
296
|
+
if (layout) {
|
|
297
|
+
this.layout = layout;
|
|
178
298
|
}
|
|
179
|
-
|
|
180
|
-
}
|
|
181
|
-
handleCollapseExpand(event) {
|
|
182
|
-
event.stopPropagation();
|
|
183
|
-
if (!this.isPanel(event.target)) {
|
|
299
|
+
if (options.drag) {
|
|
184
300
|
return;
|
|
185
301
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
if (sizeDelta > 0) {
|
|
205
|
-
panel.size = "auto";
|
|
302
|
+
if (this.drag) {
|
|
303
|
+
this.drag.start = next;
|
|
304
|
+
this.drag.origin = this.drag.last;
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
if (hadLayout && layout && !paneListChanged && describeChanges(previous, next).some(
|
|
308
|
+
({ change, persistent }) => change === "opened" || change === "closed" || persistent
|
|
309
|
+
)) {
|
|
310
|
+
this.startAnimation();
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
/** Reconcile the solver with the child panes and their attributes. */
|
|
314
|
+
syncPanes(observe = false) {
|
|
315
|
+
const panes = [...this.children].filter((child) => child.localName === PANE_TAG);
|
|
316
|
+
if (observe || !sameElements(panes, this.panes)) {
|
|
317
|
+
this.paneObserver.disconnect();
|
|
318
|
+
for (const pane of panes) {
|
|
319
|
+
this.paneObserver.observe(pane, { attributes: true, attributeFilter: PANE_ATTRIBUTES });
|
|
206
320
|
}
|
|
321
|
+
this.paneListChanged = this.paneListChanged || !sameElements(panes, this.panes);
|
|
322
|
+
this.panes = panes;
|
|
323
|
+
}
|
|
324
|
+
const keys = /* @__PURE__ */ new Map();
|
|
325
|
+
const descriptors = panes.map((pane) => {
|
|
326
|
+
const id = pane.id;
|
|
327
|
+
const persistent = !!id && !GENERATED_PANE_ID.test(id) && ![...keys.values()].includes(id);
|
|
328
|
+
const key = persistent ? id : internalKey(pane);
|
|
329
|
+
keys.set(pane, key);
|
|
330
|
+
return {
|
|
331
|
+
key,
|
|
332
|
+
persistent,
|
|
333
|
+
size: readSize(pane, "size", "size"),
|
|
334
|
+
minSize: readString(pane, "minSize", "min-size"),
|
|
335
|
+
maxSize: readString(pane, "maxSize", "max-size"),
|
|
336
|
+
closedSize: readSize(pane, "closedSize", "closed-size"),
|
|
337
|
+
hidden: readBoolean(pane, "hidden"),
|
|
338
|
+
closed: readBoolean(pane, "closed")
|
|
339
|
+
};
|
|
340
|
+
});
|
|
341
|
+
this.paneKeys = keys;
|
|
342
|
+
const idChanged = this.updateRegistryId();
|
|
343
|
+
const base = idChanged && this.registryId && !this.layoutState.laidOut ? createSplitLayout() : this.layoutState;
|
|
344
|
+
const memory = this.registryId ? rememberedLayout(this.registryId) : this.layoutMemory;
|
|
345
|
+
const synced = syncPanes(base, descriptors, memory);
|
|
346
|
+
this.commit(resizeContainer(synced, this.containerSize(synced)));
|
|
347
|
+
if (idChanged) {
|
|
348
|
+
this.storeMemory();
|
|
207
349
|
}
|
|
208
350
|
}
|
|
209
351
|
/**
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
* @param event
|
|
213
|
-
*
|
|
352
|
+
* Register the split view under its current `id` in the layout registry (it is unregistered when disconnected).
|
|
353
|
+
* Returns `true` if the id it is registered under changed.
|
|
214
354
|
*/
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
if (
|
|
218
|
-
return;
|
|
355
|
+
updateRegistryId() {
|
|
356
|
+
const id = this.isConnected && this.id ? this.id : void 0;
|
|
357
|
+
if (id === this.registryId) {
|
|
358
|
+
return false;
|
|
219
359
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
const dragPanelMaxSize = this.sizeToPixels(dragPanel.maxSize ?? "100%");
|
|
235
|
-
const dragPanelMaxExpansion = dragPanelMaxSize - dragPanelSize;
|
|
236
|
-
let requiredSpace = Math.min(Math.abs(dragDelta), dragPanelMaxExpansion);
|
|
237
|
-
const shrinkStartIndex = dragPanelIndex + dragDirection;
|
|
238
|
-
const shrinkableSpace = this.shrinkPanels(shrinkStartIndex, dragDirection, !this.noDragClose, requiredSpace, true);
|
|
239
|
-
if (dragPanel.closed) {
|
|
240
|
-
if (this.noDragClose) {
|
|
241
|
-
return;
|
|
242
|
-
}
|
|
243
|
-
const closedSize = this.sizeToPixels(dragPanel.closedSize ?? "0px");
|
|
244
|
-
const minSize = this.sizeToPixels(dragPanel.minSize ?? "0px");
|
|
245
|
-
const requiredOpeningSpace = minSize - closedSize;
|
|
246
|
-
if (requiredOpeningSpace <= requiredSpace && requiredOpeningSpace <= shrinkableSpace) {
|
|
247
|
-
const amountShrunk = this.shrinkPanels(
|
|
248
|
-
shrinkStartIndex,
|
|
249
|
-
dragDirection,
|
|
250
|
-
!this.noDragClose,
|
|
251
|
-
requiredOpeningSpace
|
|
252
|
-
);
|
|
253
|
-
if (amountShrunk >= requiredOpeningSpace) {
|
|
254
|
-
dragPanel.closed = false;
|
|
255
|
-
dragPanel.size = dragPanel.minSize;
|
|
256
|
-
requiredSpace -= requiredOpeningSpace;
|
|
257
|
-
}
|
|
258
|
-
}
|
|
360
|
+
if (this.registryId) {
|
|
361
|
+
leaveLayoutRegistry(this.registryId, this);
|
|
362
|
+
}
|
|
363
|
+
this.registryId = id;
|
|
364
|
+
if (id) {
|
|
365
|
+
joinLayoutRegistry(id, this);
|
|
366
|
+
}
|
|
367
|
+
return true;
|
|
368
|
+
}
|
|
369
|
+
/** Remember the panes' preferred sizes and user-closed states, in the registry if the split view has an id. */
|
|
370
|
+
storeMemory() {
|
|
371
|
+
const memory = rememberLayout(this.layoutState);
|
|
372
|
+
if (this.registryId) {
|
|
373
|
+
storeLayout(this.registryId, memory);
|
|
259
374
|
} else {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
375
|
+
this.layoutMemory = memory;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* The space the solver shares between the panes: the split view's size along its axis less the visible dividers.
|
|
380
|
+
* 0 while the split view has no size (for example in an inactive tab panel), so that nothing is laid out.
|
|
381
|
+
*/
|
|
382
|
+
containerSize(state2) {
|
|
383
|
+
const rect = this.containerRect;
|
|
384
|
+
if (!rect || rect.width <= 0 || rect.height <= 0) {
|
|
385
|
+
return 0;
|
|
386
|
+
}
|
|
387
|
+
const visible = state2.panes.filter((pane) => pane.presence === "present").length;
|
|
388
|
+
return Math.max(0, (this.vertical ? rect.height : rect.width) - Math.max(0, visible - 1) * this.dividerSize);
|
|
389
|
+
}
|
|
390
|
+
/** The actual size of each child pane, in px, or `undefined` before the first layout. */
|
|
391
|
+
paneSizes() {
|
|
392
|
+
if (!this.layout) {
|
|
393
|
+
return void 0;
|
|
394
|
+
}
|
|
395
|
+
const sizes = new Map(this.layout.panes.map((pane) => [pane.key, pane.size]));
|
|
396
|
+
return this.panes.map((pane) => sizes.get(this.paneKeys.get(pane) ?? "") ?? 0);
|
|
397
|
+
}
|
|
398
|
+
handleResize(entries) {
|
|
399
|
+
const { width, height } = entries[entries.length - 1].contentRect;
|
|
400
|
+
const wasEmpty = this.containerSize(this.layoutState) === 0;
|
|
401
|
+
this.containerRect = { width, height };
|
|
402
|
+
let next = resizeContainer(this.layoutState, this.containerSize(this.layoutState));
|
|
403
|
+
if (wasEmpty && this.containerSize(next) > 0) {
|
|
404
|
+
next = this.measureContent(next, this.panes);
|
|
405
|
+
}
|
|
406
|
+
this.commit(next);
|
|
407
|
+
}
|
|
408
|
+
/** Measure the content of `panes` and give the sizes to the solver. Panes that aren't rendered are skipped. */
|
|
409
|
+
measureContent(state2, panes) {
|
|
410
|
+
let next = state2;
|
|
411
|
+
for (const pane of panes) {
|
|
412
|
+
const key = this.paneKeys.get(pane);
|
|
413
|
+
const sizes = key !== void 0 ? pane.measureContentSize?.(this.vertical) : void 0;
|
|
414
|
+
if (sizes) {
|
|
415
|
+
next = setContentSize(next, key, sizes);
|
|
268
416
|
}
|
|
269
417
|
}
|
|
418
|
+
return next;
|
|
270
419
|
}
|
|
271
|
-
|
|
272
|
-
this.
|
|
420
|
+
cancelContentFrame() {
|
|
421
|
+
if (this.contentFrame !== void 0) {
|
|
422
|
+
cancelAnimationFrame(this.contentFrame);
|
|
423
|
+
this.contentFrame = void 0;
|
|
424
|
+
}
|
|
425
|
+
this.contentChanged.clear();
|
|
273
426
|
}
|
|
274
|
-
|
|
427
|
+
// -------------------------------------------------------------------------------------------------------------------
|
|
428
|
+
// Open and close
|
|
429
|
+
handleCollapseExpand(event) {
|
|
275
430
|
event.stopPropagation();
|
|
276
|
-
|
|
431
|
+
const pane = event.target;
|
|
432
|
+
if (pane.localName !== PANE_TAG || pane.parentElement !== this) {
|
|
277
433
|
return;
|
|
278
434
|
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
const panelBoundingRect = panel.getBoundingClientRect();
|
|
284
|
-
const panelCurrentSize = this.vertical ? panelBoundingRect.height : panelBoundingRect.width;
|
|
285
|
-
panel.size = panelCurrentSize + "px";
|
|
286
|
-
});
|
|
435
|
+
const key = this.paneKeys.get(pane);
|
|
436
|
+
if (key === void 0) {
|
|
437
|
+
this.syncPanes();
|
|
438
|
+
return;
|
|
287
439
|
}
|
|
288
|
-
this.
|
|
440
|
+
this.commit(setPaneOpen(this.layoutState, key, !readBoolean(pane, "closed")));
|
|
289
441
|
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
442
|
+
startAnimation() {
|
|
443
|
+
this.animating = true;
|
|
444
|
+
clearTimeout(this.animationTimer);
|
|
445
|
+
const timer = setTimeout(() => this.stopAnimation(), ANIMATION_TIMEOUT);
|
|
446
|
+
this.animationTimer = timer;
|
|
447
|
+
this.panes.forEach((pane) => pane.setAnimating?.(true));
|
|
448
|
+
this.updateComplete.then(() => {
|
|
449
|
+
if (this.animationTimer === timer && !this.splitView.getAnimations().some(isTrackTransition)) {
|
|
450
|
+
this.stopAnimation();
|
|
451
|
+
}
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
stopAnimation() {
|
|
455
|
+
clearTimeout(this.animationTimer);
|
|
456
|
+
this.animationTimer = void 0;
|
|
457
|
+
if (this.animating) {
|
|
458
|
+
this.animating = false;
|
|
459
|
+
this.panes.forEach((pane) => pane.setAnimating?.(false));
|
|
294
460
|
}
|
|
295
461
|
}
|
|
296
462
|
handleTransitionEnd(event) {
|
|
297
|
-
if (event.
|
|
298
|
-
|
|
463
|
+
if (event.target === event.currentTarget && event.propertyName.startsWith("grid-template")) {
|
|
464
|
+
this.stopAnimation();
|
|
299
465
|
}
|
|
300
|
-
this.animatingPanelIndex = void 0;
|
|
301
466
|
}
|
|
302
|
-
|
|
303
|
-
|
|
467
|
+
// -------------------------------------------------------------------------------------------------------------------
|
|
468
|
+
// Dragging dividers
|
|
469
|
+
//
|
|
470
|
+
// The listeners are on this split view's own dividers, with pointer capture, so drags in nested split views never
|
|
471
|
+
// reach this one.
|
|
472
|
+
/** -1 for a horizontal split view in a right-to-left page, where the grid lays the panes out from the right. */
|
|
473
|
+
inlineSign() {
|
|
474
|
+
return !this.vertical && getComputedStyle(this).direction === "rtl" ? -1 : 1;
|
|
304
475
|
}
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
this.
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
if (
|
|
324
|
-
return
|
|
325
|
-
}
|
|
326
|
-
let panelSize = clamp(
|
|
327
|
-
this.sizeToPixels(panel.size),
|
|
328
|
-
this.sizeToPixels(panel.minSize ?? "0px"),
|
|
329
|
-
this.sizeToPixels(panel.maxSize ?? "100%")
|
|
330
|
-
);
|
|
331
|
-
if (panel.minSize) {
|
|
332
|
-
panelSize = Math.max(panelSize, this.sizeToPixels(panel.minSize));
|
|
333
|
-
}
|
|
334
|
-
if (panel.maxSize) {
|
|
335
|
-
panelSize = Math.min(panelSize, this.sizeToPixels(panel.maxSize));
|
|
336
|
-
}
|
|
337
|
-
return panelSize;
|
|
338
|
-
});
|
|
339
|
-
const totalFixedSize = panelSizes.filter((size) => typeof size === "number").reduce((a, b) => a + b, 0);
|
|
340
|
-
const autoPanels = panelSizes.reduce((accum, panelSize, index) => {
|
|
341
|
-
if (panelSize === "auto") {
|
|
342
|
-
accum.push({ panelIndex: index, size: 0 });
|
|
476
|
+
pointerPosition(event, sign) {
|
|
477
|
+
return this.vertical ? event.clientY : event.clientX * sign;
|
|
478
|
+
}
|
|
479
|
+
/** The divider rendered before pane `index`, or `undefined` before the first layout or if it isn't visible. */
|
|
480
|
+
describeDivider(index) {
|
|
481
|
+
const key = this.keyBeforeDivider(index);
|
|
482
|
+
return key === void 0 ? void 0 : describeDivider(this.layoutState, key, { noDragClose: this.noDragClose });
|
|
483
|
+
}
|
|
484
|
+
paneByKey(key) {
|
|
485
|
+
return this.panes.find((pane) => this.paneKeys.get(pane) === key);
|
|
486
|
+
}
|
|
487
|
+
/** Enter can open the pane (any closed pane), or close it (following the snap rule and `no-drag-close`). */
|
|
488
|
+
canToggle(pane) {
|
|
489
|
+
return !!pane.closed || pane.closable && !this.noDragClose;
|
|
490
|
+
}
|
|
491
|
+
/** Solver key of the visible pane before the divider rendered before pane `index`. */
|
|
492
|
+
keyBeforeDivider(index) {
|
|
493
|
+
for (let i = index - 1; i >= 0; i--) {
|
|
494
|
+
if (!readBoolean(this.panes[i], "hidden")) {
|
|
495
|
+
return this.paneKeys.get(this.panes[i]);
|
|
343
496
|
}
|
|
344
|
-
return accum;
|
|
345
|
-
}, []);
|
|
346
|
-
let availableFlexSize = splitViewSize - totalFixedSize;
|
|
347
|
-
let layoutIteration = 0;
|
|
348
|
-
while (availableFlexSize > 0 && layoutIteration < 5) {
|
|
349
|
-
availableFlexSize = this.layoutAutoPanels(autoPanels, availableFlexSize, layoutIteration === 0);
|
|
350
|
-
layoutIteration++;
|
|
351
|
-
}
|
|
352
|
-
autoPanels.forEach((panelInfo) => {
|
|
353
|
-
panelSizes[panelInfo.panelIndex] = panelInfo.size;
|
|
354
|
-
});
|
|
355
|
-
const totalLayoutSize = panelSizes.reduce((a, b) => isNumber(a) && isNumber(b) ? a + b : a, 0);
|
|
356
|
-
if (totalLayoutSize > splitViewSize) {
|
|
357
|
-
console.warn(
|
|
358
|
-
`Total panel size (${totalLayoutSize}px) exceeds split view size (${splitViewSize}px). This may lead to unexpected layout issues.`
|
|
359
|
-
);
|
|
360
|
-
}
|
|
361
|
-
this.positions = panelSizes.map((size) => size + "px");
|
|
362
|
-
for (const panel of this._panels) {
|
|
363
|
-
panel.divider = !panel.hidden;
|
|
364
|
-
}
|
|
365
|
-
const lastVisiblePanel = this._panels.slice().reverse().find((panel) => !panel.hidden);
|
|
366
|
-
if (lastVisiblePanel) {
|
|
367
|
-
lastVisiblePanel.divider = false;
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
layoutAutoPanels(autoPanels, totalAutoSize, initialize = false) {
|
|
371
|
-
if (autoPanels?.length === 0) {
|
|
372
|
-
return totalAutoSize;
|
|
373
|
-
}
|
|
374
|
-
if (initialize) {
|
|
375
|
-
autoPanels.forEach((panelInfo) => {
|
|
376
|
-
const panel = this._panels[panelInfo.panelIndex];
|
|
377
|
-
const minSize = this.sizeToPixels(panel.minSize ?? "0px");
|
|
378
|
-
panelInfo.size = minSize;
|
|
379
|
-
totalAutoSize -= minSize;
|
|
380
|
-
});
|
|
381
497
|
}
|
|
382
|
-
|
|
383
|
-
const panel = this._panels[panelInfo.panelIndex];
|
|
384
|
-
const panelMaxSize = this.sizeToPixels(panel.maxSize ?? "100%");
|
|
385
|
-
return panelInfo.size < panelMaxSize;
|
|
386
|
-
});
|
|
387
|
-
if (expandableAutoPanels.length > 0) {
|
|
388
|
-
const autoSizePerPanel = totalAutoSize / expandableAutoPanels.length;
|
|
389
|
-
let allocatedSize = 0;
|
|
390
|
-
expandableAutoPanels.forEach((panelInfo) => {
|
|
391
|
-
const panel = this._panels[panelInfo.panelIndex];
|
|
392
|
-
const panelMaxSize = this.sizeToPixels(panel.maxSize ?? "100%");
|
|
393
|
-
const newSize = Math.min(panelInfo.size + autoSizePerPanel, panelMaxSize);
|
|
394
|
-
allocatedSize += newSize - panelInfo.size;
|
|
395
|
-
panelInfo.size = newSize;
|
|
396
|
-
});
|
|
397
|
-
totalAutoSize -= allocatedSize;
|
|
398
|
-
}
|
|
399
|
-
return totalAutoSize;
|
|
498
|
+
return void 0;
|
|
400
499
|
}
|
|
401
|
-
|
|
402
|
-
const
|
|
403
|
-
|
|
500
|
+
handleDividerPointerDown(event, index) {
|
|
501
|
+
const divider = event.currentTarget;
|
|
502
|
+
const key = this.keyBeforeDivider(index);
|
|
503
|
+
if (event.button !== 0 || divider.disabled || this.drag || key === void 0) {
|
|
404
504
|
return;
|
|
405
505
|
}
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
const sizeToShrink = totalPanelSize - clientSize;
|
|
411
|
-
this.shrinkPanels(this._panels.length - 1, -1, true, Math.abs(sizeToShrink));
|
|
412
|
-
} else if (sizeDelta > 0) {
|
|
413
|
-
const sizeToGrow = clientSize - totalPanelSize;
|
|
414
|
-
this.growPanels(0, 1, true, sizeToGrow);
|
|
506
|
+
event.preventDefault();
|
|
507
|
+
try {
|
|
508
|
+
divider.setPointerCapture(event.pointerId);
|
|
509
|
+
} catch {
|
|
415
510
|
}
|
|
416
|
-
this.
|
|
511
|
+
const sign = this.inlineSign();
|
|
512
|
+
const origin = this.pointerPosition(event, sign);
|
|
513
|
+
this.stopAnimation();
|
|
514
|
+
this.drag = { pointerId: event.pointerId, index, key, sign, start: this.layoutState, origin, last: origin };
|
|
515
|
+
this.dragging = true;
|
|
417
516
|
}
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
* @param direction 1 (right/down) or -1 (left/up)
|
|
424
|
-
* @param canClose whether panels can be closed to make space
|
|
425
|
-
* @param amount Number of pixels to shrink by
|
|
426
|
-
* @param dryRun if true, don't actually shrink panels, just calculate the amount that can be shrunk
|
|
427
|
-
*/
|
|
428
|
-
shrinkPanels(startIndex, direction, canClose, amount, dryRun = false) {
|
|
429
|
-
let amountShrunk = 0;
|
|
430
|
-
for (let i = startIndex; i >= 0 && i < this._panels.length; i += direction) {
|
|
431
|
-
const panel = this._panels[i];
|
|
432
|
-
if (panel.hidden) {
|
|
433
|
-
continue;
|
|
434
|
-
}
|
|
435
|
-
if (panel.size !== "auto") {
|
|
436
|
-
continue;
|
|
437
|
-
}
|
|
438
|
-
const panelCurrentSize = this.actualPanelSize(panel);
|
|
439
|
-
const panelMinSize = this.sizeToPixels(panel.minSize ?? "0px");
|
|
440
|
-
const panelClosedSize = this.sizeToPixels(panel.closedSize ?? "0px");
|
|
441
|
-
const panelShrinkableSize = panelCurrentSize - Math.max(panelMinSize, panelClosedSize);
|
|
442
|
-
if (panelShrinkableSize > 0) {
|
|
443
|
-
const shrinkAmount = Math.min(amount, panelShrinkableSize);
|
|
444
|
-
amount -= shrinkAmount;
|
|
445
|
-
amountShrunk += shrinkAmount;
|
|
446
|
-
}
|
|
447
|
-
if (amount <= 0) {
|
|
448
|
-
break;
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
if (amount > 0) {
|
|
452
|
-
for (let i = startIndex; i >= 0 && i < this._panels.length; i += direction) {
|
|
453
|
-
const panel = this._panels[i];
|
|
454
|
-
if (panel.hidden || panel.closed || panel.size === "auto") {
|
|
455
|
-
continue;
|
|
456
|
-
}
|
|
457
|
-
const panelCurrentSize = this.actualPanelSize(panel);
|
|
458
|
-
const panelMinSize = this.sizeToPixels(panel.minSize ?? "0px");
|
|
459
|
-
const panelClosedSize = this.sizeToPixels(panel.closedSize ?? "0px");
|
|
460
|
-
const panelShrinkableSize = panelCurrentSize - Math.max(panelMinSize, panelClosedSize);
|
|
461
|
-
if (panelShrinkableSize > 0) {
|
|
462
|
-
const shrinkAmount = Math.min(amount, panelShrinkableSize);
|
|
463
|
-
if (!dryRun) {
|
|
464
|
-
panel.size = panelCurrentSize - shrinkAmount + "px";
|
|
465
|
-
}
|
|
466
|
-
amount -= shrinkAmount;
|
|
467
|
-
amountShrunk += shrinkAmount;
|
|
468
|
-
}
|
|
469
|
-
if (amount <= 0) {
|
|
470
|
-
break;
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
if (amount > 0 && canClose) {
|
|
475
|
-
for (let i = startIndex; i >= 0 && i < this._panels.length; i += direction) {
|
|
476
|
-
const panel = this._panels[i];
|
|
477
|
-
const panelMinSize = this.sizeToPixels(panel.minSize ?? "0px");
|
|
478
|
-
const panelClosedSize = this.sizeToPixels(panel.closedSize ?? "0px");
|
|
479
|
-
if (panel.hidden || panel.closed || panelClosedSize === 0 || panelMinSize === 0) {
|
|
480
|
-
continue;
|
|
481
|
-
}
|
|
482
|
-
const panelShrinkableSize = panelMinSize - panelClosedSize;
|
|
483
|
-
if (panelShrinkableSize > 0 && amount >= panelShrinkableSize) {
|
|
484
|
-
const shrinkAmount = Math.min(amount, panelShrinkableSize);
|
|
485
|
-
if (!dryRun) {
|
|
486
|
-
panel.closed = true;
|
|
487
|
-
}
|
|
488
|
-
amount -= shrinkAmount;
|
|
489
|
-
amountShrunk += shrinkAmount;
|
|
490
|
-
}
|
|
491
|
-
if (amount <= 0) {
|
|
492
|
-
break;
|
|
493
|
-
}
|
|
494
|
-
}
|
|
517
|
+
endDrag(cancel) {
|
|
518
|
+
const drag = this.drag;
|
|
519
|
+
this.drag = void 0;
|
|
520
|
+
if (cancel) {
|
|
521
|
+
this.commit(drag.start, { drag: true });
|
|
495
522
|
}
|
|
496
|
-
|
|
523
|
+
this.dragging = false;
|
|
497
524
|
}
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
525
|
+
// -------------------------------------------------------------------------------------------------------------------
|
|
526
|
+
// Keyboard
|
|
527
|
+
//
|
|
528
|
+
// Like pointer drags, keys are handled on this split view's own dividers, so a nested split view's keys never reach
|
|
529
|
+
// this one.
|
|
530
|
+
handleDividerKeyDown(event, index) {
|
|
531
|
+
const divider = event.currentTarget;
|
|
532
|
+
const key = this.keyBeforeDivider(index);
|
|
533
|
+
const info = this.describeDivider(index);
|
|
534
|
+
if (this.drag || divider.disabled || key === void 0 || !info || event.altKey || event.ctrlKey || event.metaKey) {
|
|
535
|
+
return;
|
|
501
536
|
}
|
|
502
|
-
|
|
503
|
-
|
|
537
|
+
const step = event.shiftKey ? KEYBOARD_LARGE_STEP : KEYBOARD_STEP;
|
|
538
|
+
const sign = this.inlineSign();
|
|
539
|
+
const [back, forward] = this.vertical ? ["ArrowUp", "ArrowDown"] : ["ArrowLeft", "ArrowRight"];
|
|
540
|
+
let delta;
|
|
541
|
+
switch (event.key) {
|
|
542
|
+
case back:
|
|
543
|
+
delta = -step * sign;
|
|
544
|
+
break;
|
|
545
|
+
case forward:
|
|
546
|
+
delta = step * sign;
|
|
547
|
+
break;
|
|
548
|
+
case "Home":
|
|
549
|
+
delta = -this.layoutState.container;
|
|
550
|
+
break;
|
|
551
|
+
case "End":
|
|
552
|
+
delta = this.layoutState.container;
|
|
553
|
+
break;
|
|
554
|
+
case "Enter":
|
|
555
|
+
event.preventDefault();
|
|
556
|
+
this.toggleControlledPane(info);
|
|
557
|
+
return;
|
|
558
|
+
default:
|
|
559
|
+
return;
|
|
504
560
|
}
|
|
505
|
-
|
|
561
|
+
event.preventDefault();
|
|
562
|
+
const options = { noDragClose: this.noDragClose };
|
|
563
|
+
let next = dragDivider(this.layoutState, key, delta, options);
|
|
564
|
+
const growing = delta > 0 ? info.before : info.after;
|
|
565
|
+
const toMin = growing.minSize - growing.size;
|
|
566
|
+
if (next === this.layoutState && growing.closed && growing.closable && toMin > Math.abs(delta)) {
|
|
567
|
+
next = dragDivider(this.layoutState, key, Math.sign(delta) * toMin, options);
|
|
568
|
+
}
|
|
569
|
+
this.commit(next, { drag: true });
|
|
506
570
|
}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
handlePanelRemoved(panel) {
|
|
517
|
-
this.updatePanelInfo();
|
|
518
|
-
if (!this.restorePanelLayouts()) {
|
|
519
|
-
this.growPanels(this._panels.length - 1, -1, true, this.sizeToPixels(panel.size));
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
updatePanelInfo() {
|
|
523
|
-
this._panels = [...this.panelSlot.assignedElements()].filter(
|
|
524
|
-
(el) => el.tagName.toLowerCase() === "flow-ui-split-view-pane"
|
|
525
|
-
);
|
|
526
|
-
}
|
|
527
|
-
// Key used to stor panel layouts for a given set of panels
|
|
528
|
-
// This is a comma-separated concatenation of panel ids e.g. 'pane-1,pane-2,pane-3'
|
|
529
|
-
panelLayoutsKey() {
|
|
530
|
-
return this._panels.map((panel) => panel.id).join(",");
|
|
531
|
-
}
|
|
532
|
-
savePanelLayouts() {
|
|
533
|
-
const panelLayoutsKey = this.panelLayoutsKey();
|
|
534
|
-
const panelLayouts = this._panels.map(
|
|
535
|
-
(panel) => ({ id: panel.id, size: panel.size, closed: panel.closed })
|
|
536
|
-
);
|
|
537
|
-
this._panelLayouts[panelLayoutsKey] = panelLayouts;
|
|
538
|
-
}
|
|
539
|
-
restorePanelLayouts() {
|
|
540
|
-
const panelLayoutsKey = this.panelLayoutsKey();
|
|
541
|
-
if (this._panelLayouts[panelLayoutsKey]) {
|
|
542
|
-
this._panelLayouts[panelLayoutsKey].forEach((panelLayout) => {
|
|
543
|
-
const panel = this._panels.find((p) => p.id === panelLayout.id);
|
|
544
|
-
if (panel) {
|
|
545
|
-
panel.size = panelLayout.size;
|
|
546
|
-
panel.closed = panelLayout.closed;
|
|
547
|
-
}
|
|
548
|
-
});
|
|
549
|
-
return true;
|
|
571
|
+
/** Enter: open or close the pane the divider controls, as its header or a toggle button does (with events). */
|
|
572
|
+
toggleControlledPane(divider) {
|
|
573
|
+
const controlled = controlledPane(divider);
|
|
574
|
+
const pane = this.paneByKey(controlled.key);
|
|
575
|
+
if (!pane || !this.canToggle(controlled)) {
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
578
|
+
if (controlled.closed) {
|
|
579
|
+
pane.expand();
|
|
550
580
|
} else {
|
|
551
|
-
|
|
581
|
+
pane.collapse();
|
|
552
582
|
}
|
|
553
583
|
}
|
|
554
584
|
}
|
|
585
|
+
FlowUiSplitView.tagName = "flow-ui-split-view";
|
|
555
586
|
FlowUiSplitView.styles = styles;
|
|
587
|
+
FlowUiSplitView.dependencies = [FlowUiSplitViewDivider];
|
|
588
|
+
// One slot per pane, assigned in `updated()`, so that dividers can be rendered between the panes
|
|
589
|
+
FlowUiSplitView.shadowRootOptions = { ...FlowRdfElement.shadowRootOptions, slotAssignment: "manual" };
|
|
556
590
|
__decorateClass([
|
|
557
591
|
state()
|
|
558
|
-
], FlowUiSplitView.prototype, "
|
|
592
|
+
], FlowUiSplitView.prototype, "panes", 2);
|
|
559
593
|
__decorateClass([
|
|
560
|
-
|
|
561
|
-
], FlowUiSplitView.prototype, "
|
|
594
|
+
state()
|
|
595
|
+
], FlowUiSplitView.prototype, "layout", 2);
|
|
596
|
+
__decorateClass([
|
|
597
|
+
state()
|
|
598
|
+
], FlowUiSplitView.prototype, "animating", 2);
|
|
562
599
|
__decorateClass([
|
|
563
600
|
query(".split-view")
|
|
564
601
|
], FlowUiSplitView.prototype, "splitView", 2);
|
|
565
602
|
__decorateClass([
|
|
566
603
|
property({ attribute: "no-drag-close", type: Boolean })
|
|
567
604
|
], FlowUiSplitView.prototype, "noDragClose", 2);
|
|
568
|
-
__decorateClass([
|
|
569
|
-
property({ type: Array })
|
|
570
|
-
], FlowUiSplitView.prototype, "positions", 2);
|
|
571
605
|
__decorateClass([
|
|
572
606
|
property({ type: Boolean, reflect: true })
|
|
573
607
|
], FlowUiSplitView.prototype, "vertical", 2);
|