chessground12
Version:
Extended lishuuro.org Chess UI
105 lines (104 loc) • 3.04 kB
TypeScript
import type { HeadlessState } from './state';
import type { DrawShape, DrawBrushes } from './draw';
import { Color, Dests, DropDests, Elements, FEN, Geometry, Key, MoveMetadata, Notation, Piece, PocketRoles, Role, SetPremoveMetadata, Variant } from './types';
export interface Config {
fen?: FEN;
orientation?: Color;
turnColor?: Color;
check?: Color | boolean;
lastMove?: Key[];
selected?: Key;
coordinates?: boolean;
autoCastle?: boolean;
viewOnly?: boolean;
disableContextMenu?: boolean;
addPieceZIndex?: boolean;
addDimensionsCssVars?: boolean;
blockTouchScroll?: boolean;
highlight?: {
lastMove?: boolean;
check?: boolean;
};
animation?: {
enabled?: boolean;
duration?: number;
};
movable?: {
free?: boolean;
color?: Color | 'both';
dests?: Dests;
showDests?: boolean;
events?: {
after?: (orig: Key, dest: Key, metadata: MoveMetadata) => void;
afterNewPiece?: (role: Role, key: Key, metadata: MoveMetadata) => void;
};
rookCastle?: boolean;
};
premovable?: {
enabled?: boolean;
showDests?: boolean;
castle?: boolean;
dests?: Key[];
events?: {
set?: (orig: Key, dest: Key, metadata?: SetPremoveMetadata) => void;
unset?: () => void;
};
};
predroppable?: {
enabled?: boolean;
showDropDests?: boolean;
dropDests?: Key[];
current?: {
role: Role;
key: Key;
};
events?: {
set?: (role: Role, key: Key) => void;
unset?: () => void;
};
};
draggable?: {
enabled?: boolean;
distance?: number;
autoDistance?: boolean;
showGhost?: boolean;
deleteOnDropOff?: boolean;
};
selectable?: {
enabled?: boolean;
};
events?: {
change?: () => void;
move?: (orig: Key, dest: Key, capturedPiece?: Piece) => void;
dropNewPiece?: (piece: Piece, key: Key) => void;
select?: (key: Key) => void;
insert?: (elements: Elements) => void;
pocketSelect: (piece: Piece) => void;
};
dropmode?: {
active?: boolean;
piece?: Piece;
showDropDests?: boolean;
dropDests?: DropDests;
};
drawable?: {
enabled?: boolean;
visible?: boolean;
defaultSnapToValidMove?: boolean;
eraseOnClick?: boolean;
shapes?: DrawShape[];
autoShapes?: DrawShape[];
brushes?: DrawBrushes;
pieces?: {
baseUrl?: string;
};
onChange?: (shapes: DrawShape[]) => void;
};
geometry?: Geometry;
variant?: Variant;
chess960?: boolean;
notation?: Notation;
pocketRoles?: PocketRoles;
}
export declare function applyAnimation(state: HeadlessState, config: Config): void;
export declare function configure(state: HeadlessState, config: Config): void;