next-chessground 1.3.4 → 1.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +141 -0
- package/dist/index.es.js +3 -8111
- package/dist/index.js +3 -8127
- package/package.json +3 -1
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
// Basic type definitions for chess components
|
|
4
|
+
interface ChessgroundConfig {
|
|
5
|
+
fen?: string;
|
|
6
|
+
orientation?: 'white' | 'black';
|
|
7
|
+
turnColor?: 'white' | 'black';
|
|
8
|
+
check?: boolean | string;
|
|
9
|
+
lastMove?: [string, string];
|
|
10
|
+
selected?: string;
|
|
11
|
+
coordinates?: boolean;
|
|
12
|
+
autoCastle?: boolean;
|
|
13
|
+
viewOnly?: boolean;
|
|
14
|
+
disableContextMenu?: boolean;
|
|
15
|
+
resizable?: boolean;
|
|
16
|
+
addPieceZIndex?: boolean;
|
|
17
|
+
highlight?: {
|
|
18
|
+
lastMove?: boolean;
|
|
19
|
+
check?: boolean;
|
|
20
|
+
};
|
|
21
|
+
animation?: {
|
|
22
|
+
enabled?: boolean;
|
|
23
|
+
duration?: number;
|
|
24
|
+
};
|
|
25
|
+
movable?: {
|
|
26
|
+
free?: boolean;
|
|
27
|
+
color?: 'white' | 'black' | 'both';
|
|
28
|
+
showDests?: boolean;
|
|
29
|
+
events?: {
|
|
30
|
+
after?: (orig: string, dest: string, metadata: any) => void;
|
|
31
|
+
afterNewPiece?: (role: string, key: string, metadata: any) => void;
|
|
32
|
+
};
|
|
33
|
+
rookCastle?: boolean;
|
|
34
|
+
};
|
|
35
|
+
premovable?: {
|
|
36
|
+
enabled?: boolean;
|
|
37
|
+
showDests?: boolean;
|
|
38
|
+
castle?: boolean;
|
|
39
|
+
events?: {
|
|
40
|
+
set?: (orig: string, dest: string, metadata: any) => void;
|
|
41
|
+
unset?: () => void;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
predroppable?: {
|
|
45
|
+
enabled?: boolean;
|
|
46
|
+
events?: {
|
|
47
|
+
set?: (role: string, key: string) => void;
|
|
48
|
+
unset?: () => void;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
draggable?: {
|
|
52
|
+
enabled?: boolean;
|
|
53
|
+
distance?: number;
|
|
54
|
+
autoDistance?: boolean;
|
|
55
|
+
showGhost?: boolean;
|
|
56
|
+
deleteOnDropOff?: boolean;
|
|
57
|
+
};
|
|
58
|
+
selectable?: {
|
|
59
|
+
enabled?: boolean;
|
|
60
|
+
};
|
|
61
|
+
drawable?: {
|
|
62
|
+
enabled?: boolean;
|
|
63
|
+
visible?: boolean;
|
|
64
|
+
defaultSnapToValidMove?: boolean;
|
|
65
|
+
eraseOnClick?: boolean;
|
|
66
|
+
shapes?: any[];
|
|
67
|
+
autoShapes?: any[];
|
|
68
|
+
brushes?: any;
|
|
69
|
+
pieces?: {
|
|
70
|
+
baseUrl?: string;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
onChange?: (shapes: any[]) => void;
|
|
74
|
+
onMove?: (orig: string, dest: string, capturedPiece?: any) => void;
|
|
75
|
+
onDropNewPiece?: (piece: any, key: string) => void;
|
|
76
|
+
onSelect?: (key: string) => void;
|
|
77
|
+
items?: any;
|
|
78
|
+
shapes?: any[];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
interface NextChessgroundProps extends ChessgroundConfig {
|
|
82
|
+
width?: string | number;
|
|
83
|
+
height?: string | number;
|
|
84
|
+
style?: React.CSSProperties;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
interface Theme {
|
|
88
|
+
board: string;
|
|
89
|
+
pieces: string;
|
|
90
|
+
playSounds: boolean;
|
|
91
|
+
sounds: string;
|
|
92
|
+
highlight: boolean;
|
|
93
|
+
coordinates: boolean;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
interface ThemeContextType {
|
|
97
|
+
theme: Theme;
|
|
98
|
+
setTheme: (theme: Theme | ((prev: Theme) => Theme)) => void;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Component declarations
|
|
102
|
+
declare const NextChessground: React.ForwardRefExoticComponent<NextChessgroundProps & React.RefAttributes<any>>;
|
|
103
|
+
declare const NextEditor: React.ForwardRefExoticComponent<NextChessgroundProps & React.RefAttributes<any>>;
|
|
104
|
+
|
|
105
|
+
// Hook declarations
|
|
106
|
+
declare function useChess(): any;
|
|
107
|
+
declare function useChessground(): ThemeContextType;
|
|
108
|
+
|
|
109
|
+
// Context declarations
|
|
110
|
+
declare const ChessProvider: React.ComponentType<{ children: ReactNode }>;
|
|
111
|
+
declare function useChessContext(): any;
|
|
112
|
+
|
|
113
|
+
declare const DrillProvider: React.ComponentType<{ children: ReactNode }>;
|
|
114
|
+
declare function useDrillContext(): any;
|
|
115
|
+
|
|
116
|
+
declare const PuzzleProvider: React.ComponentType<{ children: ReactNode }>;
|
|
117
|
+
declare function usePuzzleContext(): any;
|
|
118
|
+
|
|
119
|
+
// Utility declarations
|
|
120
|
+
declare const constants: any;
|
|
121
|
+
declare const Stockfish: any;
|
|
122
|
+
declare function isValidFen(fen: string): boolean;
|
|
123
|
+
|
|
124
|
+
// Function declarations
|
|
125
|
+
declare function getNextMoment(...args: any[]): any;
|
|
126
|
+
declare function checkDrillMove(...args: any[]): any;
|
|
127
|
+
declare function getNextShape(...args: any[]): any;
|
|
128
|
+
declare function parseFen(fen: string): any;
|
|
129
|
+
declare function extractFen(...args: any[]): any;
|
|
130
|
+
declare function getMoveNumber(...args: any[]): any;
|
|
131
|
+
declare function isMoveActive(...args: any[]): any;
|
|
132
|
+
declare function showMoveIndex(...args: any[]): any;
|
|
133
|
+
declare function getMoveSuffix(...args: any[]): any;
|
|
134
|
+
declare function compareMoves(...args: any[]): any;
|
|
135
|
+
declare function goodMove(...args: any[]): any;
|
|
136
|
+
declare function badMove(...args: any[]): any;
|
|
137
|
+
declare function replyMove(...args: any[]): any;
|
|
138
|
+
declare function wasSolved(...args: any[]): any;
|
|
139
|
+
declare function getMoveArrow(...args: any[]): any;
|
|
140
|
+
|
|
141
|
+
export { ChessProvider, ChessgroundConfig, DrillProvider, NextChessground, NextChessgroundProps, NextEditor, PuzzleProvider, Stockfish, Theme, ThemeContextType, badMove, checkDrillMove, compareMoves, constants, NextChessground as default, extractFen, getMoveArrow, getMoveNumber, getMoveSuffix, getNextMoment, getNextShape, goodMove, isMoveActive, isValidFen, parseFen, replyMove, showMoveIndex, useChess, useChessContext, useChessground, useDrillContext, usePuzzleContext, wasSolved };
|