import type CellCoords from './cell/coords'; import type { EngineContext } from './wire'; /** * Assembles the Event module's dependencies from the engine composition context. The DOM roots, * settings, event manager, table, and selection manager fold into this one object; the parent Event * (for clones) stays a separate constructor argument because it is per-instance, not engine-wide. * * @param {EngineContext} ctx The engine composition context. * @returns {object} The Event dependency set. */ export declare function createEventDeps(ctx: EngineContext): { facadeGetter: Function; rootDocument: Document; rootWindow: Window; geometryReader: import("./domMeasure/geometryReader").GeometryReader; wtSettings: import("./settings").default; eventManager: import("../../../eventManager").default; wtTable: import("./table/baseTable").default; selectionManager: import("./selection").SelectionManager; }; /** * The Event module dependencies, inferred from `createEventDeps`. */ export type EventDeps = ReturnType; /** * @class Event */ declare class Event { #private; /** * State object tracking momentum scrolling status and timeout. * * @type {{ ongoing?: boolean; _timeout?: ReturnType }} */ momentumScrolling: { ongoing?: boolean; _timeout?: ReturnType; }; /** * Flag indicating whether a touch event is currently being processed. * * @type {boolean} */ touchApplied: boolean; /** * Reference to the last element the mouse was over, or null if none. * * @type {HTMLElement | null} */ lastMouseOver: HTMLElement | null; /** * @param {EventDeps} deps The Event module dependencies. * @param {Event} [parent=null] The main Event instance. */ constructor(deps: EventDeps, parent?: Event | null); /** * Adds listeners for mouse and touch events. * * @private */ registerEvents(): void; /** * Checks if an element is already selected. * * @private * @param {Element} touchTarget An element to check. * @returns {boolean} */ selectedCellWasTouched(touchTarget: Element | null): boolean; /** * Gets closest TD or TH element. * * @private * @param {Element} elem An element from the traversing starts. * @returns {object} Contains coordinates and reference to TD or TH if it exists. Otherwise it's empty object. */ parentCell(elem: Element | null): { coords: CellCoords | null; TD: HTMLTableCellElement | null; }; /** * OnMouseDown callback. * * @private * @param {MouseEvent} event The mouse event object. */ onMouseDown(event: MouseEvent | TouchEvent): void; /** * OnContextMenu callback. * * @private * @param {MouseEvent} event The mouse event object. */ onContextMenu(event: MouseEvent): void; /** * OnMouseOver callback. * * @private * @param {MouseEvent} event The mouse event object. */ onMouseOver(event: MouseEvent): void; /** * OnMouseMove callback. * * @private * @param {MouseEvent} event The mouse event object. */ onMouseMove(event: MouseEvent): void; /** * OnMouseOut callback. * * @private * @param {MouseEvent} event The mouse event object. */ onMouseOut(event: MouseEvent): void; /** * OnMouseUp callback. * * @private * @param {MouseEvent} event The mouse event object. */ onMouseUp(event: MouseEvent | TouchEvent): void; /** * OnTouchStart callback. Captures the gesture start so the synthesized mousedown can be * deferred to `touchend`; this lets a touch-drag gesture scroll the grid without * re-triggering the cell selection (see issue #11659). * * @private * @param {TouchEvent} event The touch event object. */ onTouchStart(event: TouchEvent): void; /** * OnTouchEnd callback. Fires the deferred mousedown only when the gesture is a tap * (no movement past the threshold and no long-press); for a scroll gesture the * selection stays untouched (see issue #11659). * * @private * @param {TouchEvent} event The touch event object. */ onTouchEnd(event: TouchEvent): void; /** * OnTouchCancel callback. Browsers cancel a gesture instead of ending it whenever the system * claims the touch (an edge-swipe, a dialog, a context callout) — `touchend` then never fires. * Without this reset `touchApplied` stays `true` and every REAL mouse `mouseup` is routed into * the touch tap detector, which has no button filter, so two right-clicks or two drag-selections * ending on the same cell within the double-tap window would fire a phantom double-click. * It also releases the mouse-down flag: a long-press fires `onMouseDown` from its timer, and * after a cancel no `mouseup` ever follows, which would leave mouse-move selection dragging * armed until the next click. The pending synthesized-pair flag is cleared for the same reason * the scroll branch of `onTouchEnd` clears it: a cancelled gesture armed nothing, so a * still-pending flag belongs to an earlier gesture whose pair never came, and left in place it * would drop the next real mouse pair inside the ceiling on engines that do not report the * input origin. * * @private */ onTouchCancel(): void; /** * Holder `scroll` callback. Cancels the long-press timer and runs the momentum-scroll * bookkeeping. When called during an active touch sequence it also marks the gesture * as a scroll so the deferred mousedown is not fired on `touchend` - native scrolling * can start at ~8px, before the 10px LONG_PRESS_MOVE_THRESHOLD that `onTouchMove` * watches (issue #11659). * * @private */ onHolderScroll(): void; /** * OnTouchMove callback. Once the finger moves beyond the threshold, marks the gesture as a * scroll so `touchend` skips firing the deferred mousedown, and cancels the long-press timer. * * @private * @param {TouchEvent} event The touch event object. */ onTouchMove(event: TouchEvent): void; /** * Call listener with backward compatibility. * * @private * @param {string} name Name of listener. * @param {MouseEvent} event The event object. * @param {CellCoords} coords Coordinates. * @param {HTMLElement} target Event target. */ callListener(name: string, event: Event | MouseEvent | TouchEvent, coords: CellCoords, target: HTMLElement): void; /** * Clears double-click timeouts and destroys the internal eventManager instance. */ destroy(): void; } export default Event;