/** * Grid container resizing — drag the grid's own edges and corners. * * Owns the handle elements, the pointer gesture, and the single place the * container's width/height are written. The `GridApi` size methods write * through this same controller, so a programmatic resize and a dragged one * cannot disagree about the current size or skip an event. * * ### What gets sized * The **container element** the host handed to `GridCore`, not the internal * `.pg-grid` wrapper. The wrapper is `width: 100%; height: 100%`, so it follows * the container automatically, and sizing the container is what "resize the * whole grid" means from the outside. * * ### Why nothing here re-renders * `ScrollController` already observes the body panels with a `ResizeObserver` * and fires its scroll callbacks when they change, which schedules a render and * re-resolves flex columns. A resize therefore propagates through the existing * path; this controller only changes the box. * * ### Top / left handles * Growing from the top or left edge has to keep the *opposite* edge visually * fixed, which a height/width change alone does not do — the element's origin * stays put and it grows the wrong way. Those handles therefore also shift * `margin-top` / `margin-left` by the negated delta. See * {@link GridResizeConfig.handles}. * * @packageDocumentation */ import type { EventBus } from '../event-bus/event-bus'; import { GridResizeHandle, GridResizeSource, type GridResizeConfig, type GridSize } from '../types/grid-resize.types'; /** * Drives grid container resizing. * * One instance per grid, created by `GridRenderer` and mounted onto the grid * wrapper. */ export declare class GridResizeController { private readonly containerEl; private readonly eventBus; /** Handle elements by handle id, so a config change can add/remove individually. */ private readonly handleEls; private wrapperEl; private drag; private config; /** Bound once so add/removeEventListener see the same reference. */ private readonly onPointerMove; private readonly onPointerUp; /** * @param containerEl - The element the host passed to `GridCore`; the box this resizes. * @param eventBus - Emits the three resize lifecycle events. * @param config - Initial configuration. */ constructor(containerEl: HTMLElement, eventBus: EventBus, config?: GridResizeConfig); /** * Builds the handles into the grid wrapper. * * @param wrapperEl - `.pg-grid`, which is `position: relative` and therefore * the containing block the absolutely-positioned handles need. */ mount(wrapperEl: HTMLElement): void; /** @returns The container's current outer size, measured from the DOM. */ getSize(): GridSize; /** * Writes a width and/or height onto the container and announces the change. * * The single write path: dragging calls it, and so does every `GridApi` size * method. `undefined` leaves a dimension alone; `null` removes the override so * the stylesheet's value applies again. * * @param size - Dimensions to apply. * @param source - What caused the change, forwarded to `GRID_RESIZED`. * @param handle - The handle responsible, for a drag. */ setSize(size: { width?: number | string | null; height?: number | string | null; }, source?: GridResizeSource, handle?: GridResizeHandle | null): void; /** Drops both overrides and the margin compensation a top/left drag applied. */ reset(): void; /** * Replaces the configuration and rebuilds the handles to match. * * @param config - Merged over the current configuration. */ updateConfig(config: GridResizeConfig): void; /** Turns dragging on or off without discarding the configuration. */ setEnabled(enabled: boolean): void; /** `true` when handles are currently mounted. */ get isEnabled(): boolean; /** `true` while a handle drag is in progress. */ get isResizing(): boolean; /** Removes every handle and any in-flight listener. */ destroy(): void; /** * Brings the mounted handles in line with the configuration — adding those * that appeared, removing those that went, and leaving untouched ones alone * so a config change mid-hover does not flicker. */ private syncHandles; /** * The configured handles, minus any the axis locks rule out. * * A locked axis drops the edge handles for it outright, and demotes corners * to their still-free axis — dragging the bottom-right corner of a * width-locked grid should still change the height rather than do nothing. */ private resolveHandles; /** Builds one handle element, wired to start a drag. */ private buildHandle; private handlePointerDown; private handlePointerMove; private handlePointerUp; /** Ends the gesture and detaches its listeners. Safe to call when idle. */ private releasePointer; private clampWidth; private clampHeight; } //# sourceMappingURL=grid-resize-controller.d.ts.map