chessground12
Version:
Extended lishuuro.org Chess UI
29 lines (28 loc) • 1.93 kB
TypeScript
import type { HeadlessState, State } from './state';
import { Elements, FEN, MouchEvent, PocketRoles, Pockets } from './types';
/**
* Logically maybe belongs to fen.ts, but put here to avoid merge conflicts from upsteam
* Analogous to fen.ts->read(), but for pocket part of FEN
* TODO: See todo in fen.ts->read() as well. Not sure if pocket parsing belongs there unless return
* type is extended to contain pocket state.
* */
export declare function readPockets(fen: FEN, pocketRoles: PocketRoles): Pockets;
export declare function renderPocketsInitial(state: HeadlessState, elements: Elements, pocketTop?: HTMLElement, pocketBottom?: HTMLElement): void;
export declare function click(state: HeadlessState, e: MouchEvent): void;
export declare function drag(state: HeadlessState, e: MouchEvent): void;
/**
* updates each piece element attributes based on state
* */
export declare function renderPockets(state: State): void;
export declare function pockets2str(pockets: Pockets): string;
/**
* todo: Ideally this whole method should disappear. It is legacy solution from when pocket was outside CG for the case
* when dragging started while another premove/predrop was set. After that premove/drop executes and turn is again
* opp's, we are again in predrop state and need to set those again
* Maybe predroppable should be initialized in board.ts->setSelected() and implemented similarly as premove dests
* Could happen together with further refactoring to make pocket more of a first class citizen and enable other
* stuff like highlighting last move etc. maybe.
* Even if not made part of the setSelected infrastructure, i am pretty sure this is not needed if we track and
* check better what is dragged/clicked and with proper combination of if-s in render.ts and clean-up-to-undef logic
* */
export declare function setPredropDests(state: HeadlessState): void;