import { RpgActionInput, RpgActionName } from '@rpgjs/common'; import { RpgClientEngine } from '../RpgClientEngine'; export type RpgInteractionEventName = "pointerenter" | "pointerleave" | "pointerover" | "pointerout" | "pointerdown" | "pointerup" | "pointermove" | "click" | "dragstart" | "dragmove" | "drop" | "cancel"; export type RpgInteractionPosition = { x: number; y: number; }; export type RpgInteractionBounds = { left: number; top: number; right: number; bottom: number; width: number; height: number; centerX: number; centerY: number; contains(point: RpgInteractionPosition | null | undefined): boolean; }; export type RpgInteractionBoundsSet = { bounds?: RpgInteractionBounds; hitbox?: RpgInteractionBounds; graphic?: RpgInteractionBounds; [key: string]: RpgInteractionBounds | undefined; }; export type RpgInteractionTile = { x: number; y: number; worldX: number; worldY: number; width: number; height: number; }; export type RpgInteractionState = { hovered: boolean; pressed: boolean; selected: boolean; dragging: boolean; data: Record; overlays: Record; }; export type RpgInteractionOverlay = { component: any; props?: Record; }; export type RpgInteractionMatcher = string | ((ctx: RpgInteractionMatcherContext) => boolean); export type RpgInteractionMatcherContext = { client: RpgClientEngine; target: any; sprite: any; }; export type RpgInteractionHandler = (ctx: RpgInteractionContext) => void; export type RpgInteractionBehavior = { component?: any; props?: Record | ((ctx: RpgInteractionContext) => Record); dependencies?: any[] | ((ctx: RpgInteractionContext) => any[]); cursor?: string | ((ctx: RpgInteractionContext) => string | undefined); hitTest?: (ctx: RpgInteractionContext) => boolean; pointerenter?: RpgInteractionHandler; pointerleave?: RpgInteractionHandler; pointerover?: RpgInteractionHandler; pointerout?: RpgInteractionHandler; pointerdown?: RpgInteractionHandler; pointerup?: RpgInteractionHandler; pointermove?: RpgInteractionHandler; click?: RpgInteractionHandler; dragstart?: RpgInteractionHandler; dragmove?: RpgInteractionHandler; drop?: RpgInteractionHandler; cancel?: RpgInteractionHandler; }; export type RpgInteractionComponentEntry = { component: any; props: Record; dependencies: any[]; }; export type RpgInteractionContext = { client: RpgClientEngine; target: any; sprite: any; event?: any; behavior: RpgInteractionBehavior; behaviorId: string; pointer: { screen(): RpgInteractionPosition | null; world(): RpgInteractionPosition | null; tile(): RpgInteractionTile | null; }; bounds(kind?: string): RpgInteractionBounds; state: { value(): RpgInteractionState; get(key: string): T | undefined; set(key: string, value: any): void; patch(patch: Partial>): void; }; overlay: { render(component: any, props?: Record): void; update(props?: Record): void; clear(): void; }; select(selected?: boolean): void; action(action: RpgActionName, data?: any): void; action(input: RpgActionInput): void; cancel(): void; }; type InteractionEventInput = { event?: any; bounds?: RpgInteractionBoundsSet; }; export declare class RpgClientInteractions { private client; private registrations; private states; private activeDrag?; private nextId; constructor(client: RpgClientEngine); use(matcher: RpgInteractionMatcher, behavior: RpgInteractionBehavior | any): () => void; getState(sprite: any): RpgInteractionState; getRenderedComponents(sprite: any, bounds?: RpgInteractionBoundsSet): RpgInteractionComponentEntry[]; cursorFor(sprite: any, bounds?: RpgInteractionBoundsSet): string | undefined; handle(sprite: any, type: RpgInteractionEventName, input?: InteractionEventInput): void; handlePointerMove(event?: any): void; handlePointerUp(event?: any): void; cancelDrag(event?: any): void; private getMatches; private matches; private createContext; private callHandler; private passesHitTest; private isDraggable; private defaultComponentProps; private resolveProps; private resolveDependencies; private getSpriteId; private patchState; private patchStateData; private patchOverlay; private updateOverlay; private clearOverlay; private getPointerTile; } export declare function hoverPopover(component: any, props?: Record): RpgInteractionBehavior; export declare function selectable(options?: { cursor?: string; onSelect?: RpgInteractionHandler; }): RpgInteractionBehavior; export declare function draggable(options?: { cursor?: string; start?: RpgInteractionHandler; move?: RpgInteractionHandler; drop?: RpgInteractionHandler; cancel?: RpgInteractionHandler; }): RpgInteractionBehavior; export declare function dragToTile(options: { action?: RpgActionName; data?: (ctx: RpgInteractionContext) => any; onDrop?: RpgInteractionHandler; cursor?: string; }): RpgInteractionBehavior; export {};