import GridRange, { type GridRangeIndex, type SELECTION_DIRECTION } from './GridRange'; import type { CommitGestureOptions, GestureExtendOptions, GestureMode, Selection } from './Selection'; /** * Maps modifier-key state on a mouse event to the appropriate `GestureMode`. * The four modifier combinations partition the gesture space: * - shift + ctrl/meta → `maximize` * - shift alone → `extend` * - ctrl/meta alone → `add` * - no modifiers → `replace` */ export declare function gestureModeFromModifiers(modifiers: { isShiftKey: boolean; isModifierKey: boolean; }): GestureMode; /** * Shape describing how a mouse gesture should mutate the selection's ranges. * Consumed by each `Selection` implementation's `withGestureExtend` to install * the transient overlay. */ export type GestureExtendResult = { /** The new range list to install as the transient overlay. */ newRanges: readonly GridRange[]; /** * True when the caller should drop any previously-committed selection state * (relevant to `KeyedSelection.selectedKeys`; ignored by `RangedSelection`). */ isReplacing: boolean; /** * True when the caller should trim to the last committed range before * installing the new ranges. Applies to `extend` mode. */ trimBefore: boolean; /** * True when the caller should reset the gesture anchor to `cursor` after * installing. False preserves the existing anchor. */ resetAnchor: boolean; }; /** * Compute the geometry for a mouse gesture. Given the current active ranges, * gesture anchor, cursor position, and mode, returns the new overlay ranges * plus the flags describing how the caller should install them. * * This is the shared arithmetic used by both `RangedSelection` and * `KeyedSelection` for their `withGestureExtend` implementations. */ export declare function computeGestureExtend(activeRanges: readonly GridRange[], anchor: { row: GridRangeIndex; column: GridRangeIndex; } | null, cursor: { row: GridRangeIndex; column: GridRangeIndex; }, opts: GestureExtendOptions): GestureExtendResult; /** * Returns the next cursor cell in `direction` walking through `ranges`. * Falls back to walking the full grid when the ranges are empty or contain * exactly one cell — matches Tab/Enter behavior for single-cell selections. * Shared by `RangedSelection` and `KeyedSelection` implementations of * `getNextCursorInDirection`. */ export declare function nextCursorInRanges(ranges: readonly GridRange[], current: { row: GridRangeIndex; column: GridRangeIndex; }, direction: SELECTION_DIRECTION, bounds: { columnCount: number; rowCount: number; }): { row: GridRangeIndex; column: GridRangeIndex; } | null; /** * Returns the first cell of `ranges` bounded to `[columnCount, rowCount]`. * Shared by `RangedSelection` and `KeyedSelection` implementations of * `getCursorLandingCell`. */ export declare function cursorLandingCellForRanges(ranges: readonly GridRange[], bounds: { columnCount: number; rowCount: number; }): { row: GridRangeIndex; column: GridRangeIndex; } | null; /** * Returns `settled` with the post-commit cursor placed. Uses `opts.cursor` * as the target; substitutes `landing` when the target falls outside a * non-empty settled selection; preserves the target when settled is empty * (matches Escape's "cursor survives clear" semantics). * * Callers pass `landing` precomputed from the pre-commit selection so this * helper doesn't need to reach back into the caller's overlay state. * Returns `settled` unchanged when the cursor is already correct so * mouseUp no-ops preserve reference equality. */ export declare function withCommittedCursor(settled: S, landing: { row: GridRangeIndex; column: GridRangeIndex; } | null, opts: CommitGestureOptions): S; //# sourceMappingURL=GridSelectionUtils.d.ts.map