UNPKG

chessground12

Version:
36 lines (35 loc) 2.91 kB
import type { HeadlessState } from './state'; import { Color, Geometry, Key, NumberPair, Piece, PiecesDiff } from './types'; export declare function callUserFunction<T extends (...args: any[]) => void>(f: T | undefined, ...args: Parameters<T>): void; export declare function toggleOrientation(state: HeadlessState): void; export declare function reset(state: HeadlessState): void; export declare function setPieces(state: HeadlessState, pieces: PiecesDiff): void; export declare function setPlinths(state: HeadlessState, plinths: PiecesDiff): void; export declare function setLastMove(state: HeadlessState, from: string, to: string): void; export declare function setCheck(state: HeadlessState, color: Color | boolean): void; export declare function unsetPremove(state: HeadlessState): void; export declare function unsetPredrop(state: HeadlessState): void; export declare function baseMove(state: HeadlessState, orig: Key, dest: Key): Piece | boolean; export declare function baseNewPiece(state: HeadlessState, piece: Piece, key: Key, force?: boolean): boolean; export declare function userMove(state: HeadlessState, orig: Key, dest: Key): boolean; /** * TODO: I believe this function is always called with orig=='a0'. Maybe consider changing that parameter to piece/role instead. * I think we currently artificially assign state.pieces[a0] to the current pocket piece being dragged/selected, but it is imho hackish * and we might little by little make existing code agnostic of that hack instead of tightly coupling it to it and making it depend * on having that there, with the eventual goal of making pocket dynamics more of a first class citizens rather than hacks on top of * regular chess movements dynamics * */ export declare function dropNewPiece(state: HeadlessState, orig: Key, dest: Key, force?: boolean): void; export declare function selectSquare(state: HeadlessState, key: Key, force?: boolean): void; export declare function setSelected(state: HeadlessState, key: Key): void; export declare function unselect(state: HeadlessState): void; export declare function canMove(state: HeadlessState, orig: Key, dest: Key): boolean; export declare function isPredroppable(state: HeadlessState): boolean; export declare function isDraggable(state: HeadlessState, orig: Key): boolean; export declare function playPremove(state: HeadlessState): boolean; export declare function playPredrop(state: HeadlessState): boolean; export declare function cancelMove(state: HeadlessState): void; export declare function stop(state: HeadlessState): void; export declare function getKeyAtDomPos(pos: NumberPair, asWhite: boolean, bounds: DOMRect, geom: Geometry): Key | undefined; export declare function getSnappedKeyAtDomPos(orig: Key, pos: NumberPair, asWhite: boolean, bounds: DOMRect, geom: Geometry): Key | undefined; export declare function whitePov(s: HeadlessState): boolean;