import { InternalInteractionDecision } from './interactionManager'; import { RelativePoint } from '../cells/renderer/types'; import { CanvasClickDispatchResult } from '../cells/renderer/performCanvasClick'; import { ResolvedCanvasInteractionConfig } from '../core/canvasInteraction'; export type InteractionPhase = 'pointer-select' | 'cell-click' | 'renderer-click' | 'contextmenu-capture' | 'contextmenu-glide' | 'editor-activation'; export type InteractionSessionSource = 'pointer' | 'click' | 'contextmenu' | 'keyboard' | 'synthetic'; export interface ArmedEditorRequest { target: 'self'; armedAt: number; consumed?: boolean; } export interface InteractionSession { id: number; key: string; cell: readonly [number, number]; relativePoint: RelativePoint; interaction: ResolvedCanvasInteractionConfig; decision: InternalInteractionDecision; clickResult?: CanvasClickDispatchResult; consumedPhases: Set; startedAt: number; button?: number; source: InteractionSessionSource; editorRequest?: ArmedEditorRequest; } export interface BeginInteractionSessionArgs { cell: readonly [number, number]; relativePoint: RelativePoint; interaction: ResolvedCanvasInteractionConfig; button?: number; source: InteractionSessionSource; startedAt?: number; } export interface FindInteractionSessionArgs { cell: readonly [number, number]; relativePoint: RelativePoint; button?: number; maxAgeMs?: number; } export interface InteractionSessionStore { beginOrGet: (args: BeginInteractionSessionArgs) => InteractionSession; findMatching: (args: FindInteractionSessionArgs) => InteractionSession | undefined; getCurrent: () => InteractionSession | undefined; storeClickResult: (session: InteractionSession, result: CanvasClickDispatchResult) => void; consumeClickResult: (args: FindInteractionSessionArgs) => CanvasClickDispatchResult | undefined; consumePhase: (session: InteractionSession, phase: InteractionPhase) => boolean; armEditorRequest: (session: InteractionSession, request: { target: 'self'; }) => void; consumeEditorRequest: (cell: readonly [number, number], maxAgeMs?: number) => { target: 'self'; } | undefined; isMatchingRecent: (phase: InteractionPhase, cell: readonly [number, number], maxAgeMs?: number) => boolean; clearStale: (maxAgeMs?: number) => void; clear: () => void; } export declare function buildInteractionSessionKey({ cell, relativePoint, button, }: { cell: readonly [number, number]; relativePoint: RelativePoint; button?: number; }): string; export declare function createInteractionSessionStore(): InteractionSessionStore;