-
Notifications
You must be signed in to change notification settings - Fork 81
/
Copy pathchessboard.d.ts
48 lines (43 loc) · 1.58 KB
/
chessboard.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { Component, CSSProperties } from 'react';
import { Square } from "chess.js"
type Piece =
'wP' | 'wN' | 'wB' | 'wR' | 'wQ' | 'wK' |
'bP' | 'bN' | 'bB' | 'bR' | 'bQ' | 'bK'
;
type Position = {
[pos in Square]?: Piece
}
type CustomPieces = {
[piece in Piece]?: (obj: {isDragging: boolean, squareWidth: number, droppedPiece: Piece, targetSquare: Square, sourceSquare: Square}) => JSX.Element
}
interface Props {
allowDrag?: (obj: {piece: Piece, sourceSquare: Square}) => boolean,
boardStyle?: CSSProperties,
calcWidth?: (obj: {screenWidth: number, screenHeight: number}) => number,
darkSquareStyle?: CSSProperties,
draggable?: boolean,
dropOffBoard?: 'snapback' | 'trash',
dropSquareStyle?: CSSProperties,
getPosition?: (currentPosition: Position) => void,
id?: string | number,
lightSquareStyle?: CSSProperties,
onDragOverSquare?: (square: Square) => void,
onDrop?: (obj: {sourceSquare: Square, targetSquare: Square, piece: Piece}) => void,
onMouseOutSquare?: (square: Square) => void,
onMouseOverSquare?: (square: Square) => void,
onPieceClick?: (piece: Piece) => void,
onSquareClick?: (square: Square) => void,
onSquareRightClick?: (square: Square) => void,
orientation?: 'white' | 'black',
pieces?: CustomPieces,
position?: string | Position,
roughSquare?: (obj: {squareElement: SVGElement, squareWidth: number}) => void,
showNotation?: boolean,
sparePieces?: boolean,
squareStyles?: {[square in Square]?: CSSProperties},
transitionDuration?: number,
width?: number,
undo?: boolean,
}
export default class Chessboard extends Component<Props> {
}