@alepot55/chessboardjs 2.2.1 → 2.3.0

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.
Files changed (74) hide show
  1. package/README.md +125 -401
  2. package/assets/themes/alepot/theme.json +42 -0
  3. package/assets/themes/default/theme.json +42 -0
  4. package/dist/chessboard.cjs.js +11785 -0
  5. package/dist/chessboard.css +243 -0
  6. package/dist/chessboard.esm.js +11716 -0
  7. package/dist/chessboard.iife.js +11791 -0
  8. package/dist/chessboard.umd.js +11791 -0
  9. package/package.json +33 -3
  10. package/{chessboard.move.js → src/components/Move.js} +3 -3
  11. package/src/components/Piece.js +771 -0
  12. package/{chessboard.square.js → src/components/Square.js} +61 -8
  13. package/src/constants/index.js +15 -0
  14. package/src/constants/positions.js +62 -0
  15. package/src/core/Chessboard.js +2346 -0
  16. package/src/core/ChessboardConfig.js +707 -0
  17. package/src/core/ChessboardFactory.js +385 -0
  18. package/src/core/index.js +141 -0
  19. package/src/errors/ChessboardError.js +133 -0
  20. package/src/errors/index.js +15 -0
  21. package/src/errors/messages.js +189 -0
  22. package/src/index.js +103 -0
  23. package/src/services/AnimationService.js +180 -0
  24. package/src/services/BoardService.js +156 -0
  25. package/src/services/CoordinateService.js +355 -0
  26. package/src/services/EventService.js +955 -0
  27. package/src/services/MoveService.js +567 -0
  28. package/src/services/PieceService.js +339 -0
  29. package/src/services/PositionService.js +237 -0
  30. package/src/services/ValidationService.js +673 -0
  31. package/src/services/index.js +14 -0
  32. package/src/styles/animations.css +46 -0
  33. package/{chessboard.css → src/styles/board.css} +30 -7
  34. package/src/styles/index.css +4 -0
  35. package/src/styles/pieces.css +70 -0
  36. package/src/utils/animations.js +37 -0
  37. package/{chess.js → src/utils/chess.js} +16 -16
  38. package/src/utils/coordinates.js +62 -0
  39. package/src/utils/cross-browser.js +150 -0
  40. package/src/utils/logger.js +422 -0
  41. package/src/utils/performance.js +311 -0
  42. package/src/utils/validation.js +458 -0
  43. package/.babelrc +0 -4
  44. package/chessboard.bundle.js +0 -3422
  45. package/chessboard.config.js +0 -147
  46. package/chessboard.js +0 -979
  47. package/chessboard.piece.js +0 -115
  48. package/jest.config.js +0 -7
  49. package/rollup.config.js +0 -11
  50. package/test/chessboard.test.js +0 -128
  51. /package/{alepot_theme → assets/themes/alepot}/bb.svg +0 -0
  52. /package/{alepot_theme → assets/themes/alepot}/bw.svg +0 -0
  53. /package/{alepot_theme → assets/themes/alepot}/kb.svg +0 -0
  54. /package/{alepot_theme → assets/themes/alepot}/kw.svg +0 -0
  55. /package/{alepot_theme → assets/themes/alepot}/nb.svg +0 -0
  56. /package/{alepot_theme → assets/themes/alepot}/nw.svg +0 -0
  57. /package/{alepot_theme → assets/themes/alepot}/pb.svg +0 -0
  58. /package/{alepot_theme → assets/themes/alepot}/pw.svg +0 -0
  59. /package/{alepot_theme → assets/themes/alepot}/qb.svg +0 -0
  60. /package/{alepot_theme → assets/themes/alepot}/qw.svg +0 -0
  61. /package/{alepot_theme → assets/themes/alepot}/rb.svg +0 -0
  62. /package/{alepot_theme → assets/themes/alepot}/rw.svg +0 -0
  63. /package/{default_pieces → assets/themes/default}/bb.svg +0 -0
  64. /package/{default_pieces → assets/themes/default}/bw.svg +0 -0
  65. /package/{default_pieces → assets/themes/default}/kb.svg +0 -0
  66. /package/{default_pieces → assets/themes/default}/kw.svg +0 -0
  67. /package/{default_pieces → assets/themes/default}/nb.svg +0 -0
  68. /package/{default_pieces → assets/themes/default}/nw.svg +0 -0
  69. /package/{default_pieces → assets/themes/default}/pb.svg +0 -0
  70. /package/{default_pieces → assets/themes/default}/pw.svg +0 -0
  71. /package/{default_pieces → assets/themes/default}/qb.svg +0 -0
  72. /package/{default_pieces → assets/themes/default}/qw.svg +0 -0
  73. /package/{default_pieces → assets/themes/default}/rb.svg +0 -0
  74. /package/{default_pieces → assets/themes/default}/rw.svg +0 -0
package/README.md CHANGED
@@ -3,444 +3,168 @@
3
3
  [Chessboard.js](https://sites.google.com/view/chessboard-js/home) is a lightweight and versatile NPM package that lets you easily integrate an interactive, customizable chessboard into your web applications. Use it for game displays, chess lessons, analysis tools, or any project that needs a visual chess interface.
4
4
 
5
5
  ## Overview
6
+
6
7
  [Chessboard.js](https://sites.google.com/view/chessboard-js/home) is designed with simplicity and flexibility in mind. Configure board appearance, piece sets, orientation, highlighting, animations, and more through a rich API. The board updates dynamically with user interactions and programmatic moves.
7
8
 
8
9
  ## Installation
10
+
9
11
  ```bash
10
12
  npm i @alepot55/chessboardjs
11
13
  ```
12
14
 
13
15
  ## Usage
14
- Import and initialize the chessboard into your project:
15
- ```javascript
16
- import Chessboard from 'chessboardjs';
17
-
18
- const config = {
19
- id: 'board', // HTML element id for the board
20
- piecesPath: 'path/to/pieces', // Path or object/function returning piece image paths
21
- position: 'start', // Valid FEN string or predefined position ('start' for initial setup)
22
- size: 400, // Board size in pixels or 'auto'
23
- orientation: 'w', // Board orientation: 'w' for white at bottom, 'b' for black at bottom
24
- draggable: true, // Enable drag and drop for pieces
25
- clickable: true, // Allow clickable moves and interactions
26
- onlyLegalMoves: true, // Restrict piece moves to legal moves only
27
- onMove: (move) => { // Callback when a move is attempted
28
- console.log('Move attempted:', move);
29
- return true; // Accept the move
30
- },
31
- onMoveEnd: (move) => {
32
- console.log('Move executed:', move);
33
- },
34
- // ...other configuration options...
35
- };
36
-
37
- const board = new Chessboard(config);
38
- ```
39
16
 
40
- ## Configuration
41
-
42
- Configuration is done by passing an object to the constructor. Below is an example with the main attributes and a brief description:
17
+ Import and initialize the chessboard into your project:
43
18
 
44
19
  ```javascript
20
+ import Chessboard from "chessboardjs";
21
+
45
22
  const config = {
46
- id: 'board', // ID of the HTML element where the chessboard is rendered
47
- piecesPath: 'path/to/pieces', // Path (or function) to retrieve piece images
48
- position: 'start', // Initial position ('start' for standard setup or a FEN string)
49
- size: 400, // Chessboard size (pixels number or 'auto')
50
- orientation: 'w', // Board orientation: 'w' (white at the bottom) or 'b' (black at the bottom)
51
- draggable: true, // Enable dragging of pieces
52
- clickable: true, // Enable piece selection via click
53
- onlyLegalMoves: true, // Allow only legal moves
54
- moveAnimation: 'ease', // Transition function for move animations (e.g., 'ease', 'linear')
55
- moveTime: 'fast', // Duration for move animation ('fast', 'normal', 'slow', etc.)
56
- snapbackAnimation: 'ease', // Transition function for snapback animation (when an invalid move occurs)
57
- snapbackTime: 'fast', // Duration for snapback animation
58
- fadeAnimation: 'ease', // Transition function for fade animations
59
- fadeTime: 'fast', // Duration for fade animation
60
- whiteSquare: '#f0d9b5', // Color of white squares
61
- blackSquare: '#b58863', // Color of black squares
62
- highlight: 'yellow', // Color used to highlight moves
63
- selectedSquareWhite: '#ababaa',// Highlight color for selected white squares
64
- selectedSquareBlack: '#ababaa',// Highlight color for selected black squares
65
- movedSquareWhite: '#f1f1a0', // Color to indicate moved white squares
66
- movedSquareBlack: '#e9e981', // Color to indicate moved black squares
67
- choiceSquare: 'white', // Color used to indicate square selection
68
- coverSquare: 'black', // Color used to cover squares during certain interactions
69
- hintColor: '#ababaa', // Color for move hints
70
- // Optional event callbacks:
71
- onMove: (move) => { // Called when a move is attempted
72
- console.log('Move attempted:', move);
73
- return true;
23
+ id: "board",
24
+ piecesPath: "path/to/pieces",
25
+ position: "start",
26
+ size: 400,
27
+ orientation: "w",
28
+ draggable: true,
29
+ clickable: true,
30
+ onlyLegalMoves: true,
31
+ onMove: (move) => {
32
+ console.log("Move attempted:", move);
33
+ return true;
74
34
  },
75
- onMoveEnd: (move) => { // Called when a move is completed
76
- console.log('Move executed:', move);
35
+ onMoveEnd: (move) => {
36
+ console.log("Move executed:", move);
77
37
  },
78
- // ...other callbacks and options...
38
+ // ...other configuration options...
79
39
  };
80
40
 
81
- // Usage:
82
41
  const board = new Chessboard(config);
83
42
  ```
84
43
 
85
- ## API Documentation
86
-
87
- ### Constructor
88
- - **new Chessboard(config)**
89
- - Initializes a new chessboard using the provided configuration object.
90
-
91
- ### Public Functions for Users
92
-
93
- - **move(move, animation)**
94
- - Moves a piece from one square to another.
95
- - Example:
96
- ```javascript
97
- board.move('e2e4', true);
98
- ```
99
-
100
- - **clear(animation)**
101
- - Clears the board of all pieces.
102
- - Example:
103
- ```javascript
104
- board.clear();
105
- ```
106
-
107
- - **insert(square, piece)**
108
- - Inserts a piece on a given square.
109
- - Example:
110
- ```javascript
111
- board.insert('d4', 'qw');
112
- ```
113
-
114
- - **get(square)**
115
- - Returns the identifier of the piece at the given square.
116
- - Example:
117
- ```javascript
118
- const pieceId = board.get('e4');
119
- console.log('Piece at e4:', pieceId);
120
- ```
121
-
122
- - **position(position, color)**
123
- - Updates the board position. Optionally, flips orientation if a color parameter is provided.
124
- - Example:
125
- ```javascript
126
- board.position('rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1');
127
- ```
128
-
129
- - **flip()**
130
- - Flips the board orientation between white and black.
131
- - Example:
132
- ```javascript
133
- board.flip();
134
- ```
135
-
136
- - **build()**
137
- - Rebuilds or initializes the board and its elements.
138
- - Example:
139
- ```javascript
140
- board.build();
141
- ```
142
-
143
- - **resize(value)**
144
- - Dynamically resizes the board. Accepts a number (pixels) or 'auto'.
145
- - Example:
146
- ```javascript
147
- board.resize(500);
148
- ```
149
-
150
- - **destroy()**
151
- - Destroys the board, removes all event listeners, and cleans up the DOM.
152
- - Example:
153
- ```javascript
154
- board.destroy();
155
- ```
156
-
157
- - **piece(square)**
158
- - Returns the piece identifier at the specified square.
159
- - Example:
160
- ```javascript
161
- const currentPiece = board.piece('f6');
162
- ```
163
-
164
- - **highlight(square) and dehighlight(square)**
165
- - Highlights or removes highlight from a given square.
166
- - Example:
167
- ```javascript
168
- board.highlight('e4');
169
- board.dehighlight('e4');
170
- ```
171
-
172
- - **turn() and fen()**
173
- - `turn()` returns the color whose turn it is ('w' or 'b').
174
- - `fen()` returns the current board state in FEN notation.
175
- - Example:
176
- ```javascript
177
- console.log('Current turn:', board.turn());
178
- console.log('FEN:', board.fen());
179
- ```
44
+ ## API Quick Reference
45
+
46
+ | Category | Method | Description |
47
+ | --------------------- | ------------------------------- | ---------------------------------- |
48
+ | **Position & State** | `getPosition()` | Get FEN string of current position |
49
+ | | `setPosition(fen, opts)` | Set board position (FEN/object) |
50
+ | | `reset(opts)` | Reset to starting position |
51
+ | | `clear(opts)` | Clear the board |
52
+ | **Move Management** | `movePiece(move, opts)` | Make a move (string/object) |
53
+ | | `undoMove(opts)` | Undo last move |
54
+ | | `redoMove(opts)` | Redo last undone move |
55
+ | | `getLegalMoves(square)` | Get legal moves for a square |
56
+ | **Piece Management** | `getPiece(square)` | Get piece at a square |
57
+ | | `putPiece(piece, square, opts)` | Put a piece on a square |
58
+ | | `removePiece(square, opts)` | Remove a piece from a square |
59
+ | **Board Control** | `flipBoard(opts)` | Flip the board orientation |
60
+ | | `setOrientation(color, opts)` | Set board orientation |
61
+ | | `getOrientation()` | Get current orientation |
62
+ | | `resizeBoard(size)` | Resize the board |
63
+ | **Highlighting & UI** | `highlight(square, opts)` | Highlight a square |
64
+ | | `dehighlight(square, opts)` | Remove highlight from a square |
65
+ | **Game Info** | `fen()` | Get FEN string |
66
+ | | `turn()` | Get current turn ('w' or 'b') |
67
+ | | `isGameOver()` | Is the game over? |
68
+ | | `isCheckmate()` | Is it checkmate? |
69
+ | | `isDraw()` | Is it draw? |
70
+ | | `getHistory()` | Get move history |
71
+ | **Lifecycle** | `destroy()` | Destroy the board and cleanup |
72
+ | | `rebuild()` | Re-initialize the board |
73
+ | **Configuration** | `getConfig()` | Get current config |
74
+ | | `setConfig(newConfig)` | Update config |
75
+
76
+ > **Note:** Legacy methods like `move`, `clear`, `start`, `insert`, `get`, `piece`, etc. are still available as aliases but are deprecated. Use the new API for all new code.
180
77
 
181
- For further details, refer to the full API documentation at the project website or within the source code.
182
-
183
- # Chessboard.js – User API & Chess.js Integration
78
+ ## API Documentation
184
79
 
185
- This document details the functions available to users for interacting with the Chessboard.js instance and the underlying Chess.js game. The functions are grouped by purpose and presented in a logical order.
80
+ ### Position & State
186
81
 
187
- ---
188
-
189
- ## 1. Board Setup & Initialization
190
-
191
- - **build()**
192
- Initializes (or rebuilds) the board and its elements.
193
- _Example:_
194
- ```js
195
- board.build();
196
- ```
197
-
198
- - **clear(options = {}, animation = true)**
199
- Clears the board of all pieces and updates the display.
200
- _Example:_
201
- ```js
202
- board.clear();
203
- ```
204
-
205
- - **reset(animation = true)**
206
- Resets the game to the starting position.
207
- _Example:_
208
- ```js
209
- board.reset();
210
- ```
82
+ ```js
83
+ board.getPosition(); // Get FEN string
84
+ board.setPosition("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"); // Set position
85
+ board.reset(); // Reset to starting position
86
+ board.clear(); // Clear the board
87
+ ```
211
88
 
212
- ---
89
+ ### Move Management
213
90
 
214
- ## 2. Orientation
215
-
216
- - **getOrientation()**
217
- Returns the current board orientation.
218
- _Example:_
219
- ```js
220
- console.log("Orientation:", board.getOrientation());
221
- ```
222
-
223
- - **setOrientation(color, animation = true)**
224
- Sets the board’s orientation. If an invalid color is passed, it flips the board.
225
- _Example:_
226
- ```js
227
- try {
228
- board.setOrientation('w');
229
- } catch (e) {
230
- console.error(e.message);
231
- }
232
- ```
233
-
234
- - **flip(animation = true)**
235
- Flips the board orientation (updates pieces and clears highlights).
236
- _Example:_
237
- ```js
238
- board.flip();
239
- ```
91
+ ```js
92
+ board.movePiece("e2e4"); // Make a move
93
+ board.undoMove(); // Undo last move
94
+ board.redoMove(); // Redo last undone move
95
+ board.getLegalMoves("e2"); // Get legal moves for a square
96
+ ```
240
97
 
241
- ---
98
+ ### Piece Management
242
99
 
243
- ## 3. Game State & Display
244
-
245
- - **ascii()**
246
- Returns an ASCII diagram representing the current position.
247
- _Example:_
248
- ```js
249
- console.log(board.ascii());
250
- ```
251
-
252
- - **board()**
253
- Returns the current board as a 2D array.
254
- _Example:_
255
- ```js
256
- console.table(board.board());
257
- ```
258
-
259
- - **fen()**
260
- Retrieves the FEN string for the current board state.
261
- _Example:_
262
- ```js
263
- console.log("FEN:", board.fen());
264
- ```
100
+ ```js
101
+ board.getPiece("e4"); // Get piece at e4
102
+ board.putPiece("qw", "d4"); // Put a queen on d4
103
+ board.removePiece("d4"); // Remove piece from d4
104
+ ```
265
105
 
266
- ---
106
+ ### Board Control
267
107
 
268
- ## 4. Accessors & History
269
-
270
- - **get(squareId)**
271
- Returns the piece on the specified square.
272
- _Example:_
273
- ```js
274
- const piece = board.get('e4');
275
- console.log("Piece at e4:", piece);
276
- ```
277
-
278
- - **getCastlingRights(color)**
279
- Returns the castling rights for the given color.
280
- _Example:_
281
- ```js
282
- console.log("Castling rights for white:", board.getCastlingRights('w'));
283
- ```
284
-
285
- - **getComment()** and **getComments()**
286
- Retrieves a single comment or all comments attached to positions.
287
- _Example:_
288
- ```js
289
- console.log("Comment:", board.getComment());
290
- ```
291
-
292
- - **history(options = {})**
293
- Returns the moves history, optionally verbose.
294
- _Example:_
295
- ```js
296
- console.log("History:", board.history({ verbose: true }));
297
- ```
298
-
299
- - **lastMove()**
300
- Returns the last move made.
301
- _Example:_
302
- ```js
303
- console.log("Last move:", board.lastMove());
304
- ```
305
-
306
- - **moveNumber()**
307
- Returns the current move number.
308
- _Example:_
309
- ```js
310
- console.log("Move number:", board.moveNumber());
311
- ```
312
-
313
- - **moves(options = {})**
314
- Provides a list of legal moves.
315
- _Example:_
316
- ```js
317
- console.log("Legal moves:", board.moves());
318
- ```
319
-
320
- - **pgn(options = {})**
321
- Returns the game in PGN format.
322
- _Example:_
323
- ```js
324
- console.log("PGN:", board.pgn());
325
- ```
326
-
327
- - **squareColor(squareId)**
328
- Returns the color (light or dark) of the specified square.
329
- _Example:_
330
- ```js
331
- console.log("Square e4 is:", board.squareColor('e4'));
332
- ```
333
-
334
- - **turn()**
335
- Indicates which side's turn it is ('w' or 'b').
336
- _Example:_
337
- ```js
338
- console.log("Turn:", board.turn());
339
- ```
108
+ ```js
109
+ board.flipBoard(); // Flip orientation
110
+ board.setOrientation("b"); // Set orientation to black
111
+ console.log(board.getOrientation()); // Get current orientation
112
+ board.resizeBoard(500); // Resize board
113
+ ```
340
114
 
341
- ---
115
+ ### Highlighting & UI
342
116
 
343
- ## 5. Game State Checks
344
-
345
- - **isCheckmate()**
346
- Checks if the current position is checkmate.
347
- _Example:_
348
- ```js
349
- if (board.isCheckmate()) console.log("Checkmate!");
350
- ```
351
-
352
- - **isDraw()**
353
- Checks if the game is drawn.
354
- - **isDrawByFiftyMoves()**
355
- - **isInsufficientMaterial()**
356
- - **isGameOver()**
357
- - **isStalemate()**
358
- - **isThreefoldRepetition()**
359
- Each returns a Boolean indicating the respective state.
360
- _Example:_
361
- ```js
362
- if (board.isGameOver()) console.log("Game over!");
363
- ```
117
+ ```js
118
+ board.highlight("e4"); // Highlight e4
119
+ board.dehighlight("e4"); // Remove highlight from e4
120
+ ```
364
121
 
365
- ---
122
+ ### Game Info
366
123
 
367
- ## 6. Game Modification
368
-
369
- - **load(fen, options = {}, animation = true)**
370
- Loads a new position from a FEN string.
371
- _Example:_
372
- ```js
373
- board.load('rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR');
374
- ```
375
-
376
- - **loadPgn(pgn, options = {}, animation = true)**
377
- Loads a game using a PGN string.
378
- _Example:_
379
- ```js
380
- board.loadPgn(pgnData);
381
- ```
382
-
383
- - **put(pieceId, squareId, animation = true)**
384
- Places a piece on the board.
385
- _Example:_
386
- ```js
387
- board.put('pw', 'd4');
388
- ```
389
-
390
- - **remove(squareId, animation = true)**
391
- Removes the piece from the given square.
392
- _Example:_
393
- ```js
394
- const removed = board.remove('d4');
395
- console.log("Removed:", removed);
396
- ```
397
-
398
- - **removeComment()**, **removeComments()**, **removeHeader(field)**
399
- Remove comments or PGN headers from the game.
400
- _Example:_
401
- ```js
402
- board.removeComment();
403
- ```
404
-
405
- - **setCastlingRights(color, rights)**
406
- Sets castling rights for a specified color.
407
- _Example:_
408
- ```js
409
- board.setCastlingRights('w', { k: false, q: true });
410
- ```
411
-
412
- - **setComment(comment)** and **setHeader(key, value)**
413
- Attach a comment to the current position or set a PGN header.
414
- _Example:_
415
- ```js
416
- board.setComment("King's pawn opening");
417
- board.setHeader('White', 'PlayerOne');
418
- ```
124
+ ```js
125
+ console.log(board.fen()); // Get FEN
126
+ console.log(board.turn()); // Get turn
127
+ console.log(board.isGameOver()); // Is game over?
128
+ console.log(board.isCheckmate()); // Is checkmate?
129
+ console.log(board.isDraw()); // Is draw?
130
+ console.log(board.getHistory()); // Get move history
131
+ ```
419
132
 
420
- ---
133
+ ### Lifecycle
421
134
 
422
- ## 7. Move Reversal
135
+ ```js
136
+ board.destroy(); // Destroy the board
137
+ board.rebuild(); // Re-initialize the board
138
+ ```
423
139
 
424
- - **undo()**
425
- Reverts the last move played.
426
- _Example:_
427
- ```js
428
- const undone = board.undo();
429
- if (undone) console.log("Move undone:", undone);
430
- ```
140
+ ### Configuration
431
141
 
432
- ---
142
+ ```js
143
+ console.log(board.getConfig()); // Get config
144
+ board.setConfig({ size: 600 }); // Update config
145
+ ```
433
146
 
434
- ## 8. Utility
147
+ ## Deprecated Aliases
148
+
149
+ - `move(move, animation)` → use `movePiece(move, { animate: animation })`
150
+ - `clear(animation)` → use `clear({ animate: animation })`
151
+ - `start(animation)` → use `reset({ animate: animation })`
152
+ - `insert(square, piece)` → use `putPiece(piece, square)`
153
+ - `get(square)`/`piece(square)` → use `getPiece(square)`
154
+
155
+ ## Static/Factory Methods
156
+
157
+ ```js
158
+ // Create a new board
159
+ const board = Chessboard.create("board", config);
160
+ // Create from template
161
+ const board2 = Chessboard.fromTemplate("board2", "default", config);
162
+ // List all instances
163
+ const allBoards = Chessboard.listInstances();
164
+ // Destroy all boards
165
+ Chessboard.destroyAll();
166
+ ```
435
167
 
436
- - **validateFen(fen)**
437
- Validates a given FEN string.
438
- _Example:_
439
- ```js
440
- const result = board.validateFen('rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1');
441
- console.log("FEN valid?", result.ok);
442
- ```
443
-
444
168
  ---
445
169
 
446
- This documentation groups the API functions by their purpose. Developers can mix these methods to query the game state, update the board, load new positions, and more.
170
+ For further details, refer to the full API documentation at the project website or within the source code.
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "alepot",
3
+ "displayName": "Alepot Theme",
4
+ "description": "Custom theme by alepot55 with unique piece designs",
5
+ "author": "alepot55",
6
+ "version": "1.0.0",
7
+ "pieces": {
8
+ "format": "svg",
9
+ "path": "./",
10
+ "mapping": {
11
+ "wp": "pw.svg",
12
+ "wr": "rw.svg",
13
+ "wn": "nw.svg",
14
+ "wb": "bw.svg",
15
+ "wq": "qw.svg",
16
+ "wk": "kw.svg",
17
+ "bp": "pb.svg",
18
+ "br": "rb.svg",
19
+ "bn": "nb.svg",
20
+ "bb": "bb.svg",
21
+ "bq": "qb.svg",
22
+ "bk": "kb.svg"
23
+ }
24
+ },
25
+ "colors": {
26
+ "whiteSquare": "#f0d9b5",
27
+ "blackSquare": "#b58863",
28
+ "highlight": "#ffff00",
29
+ "selectedSquareWhite": "#ababaa",
30
+ "selectedSquareBlack": "#ababaa",
31
+ "movedSquareWhite": "#f1f1a0",
32
+ "movedSquareBlack": "#e9e981",
33
+ "choiceSquare": "white",
34
+ "coverSquare": "black",
35
+ "hintColor": "#ababaa"
36
+ },
37
+ "animations": {
38
+ "moveTime": 200,
39
+ "fadeTime": 150,
40
+ "snapbackTime": 150
41
+ }
42
+ }
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "default",
3
+ "displayName": "Default Theme",
4
+ "description": "The classic chessboard theme with traditional pieces",
5
+ "author": "alepot55",
6
+ "version": "1.0.0",
7
+ "pieces": {
8
+ "format": "svg",
9
+ "path": "./",
10
+ "mapping": {
11
+ "wp": "pw.svg",
12
+ "wr": "rw.svg",
13
+ "wn": "nw.svg",
14
+ "wb": "bw.svg",
15
+ "wq": "qw.svg",
16
+ "wk": "kw.svg",
17
+ "bp": "pb.svg",
18
+ "br": "rb.svg",
19
+ "bn": "nb.svg",
20
+ "bb": "bb.svg",
21
+ "bq": "qb.svg",
22
+ "bk": "kb.svg"
23
+ }
24
+ },
25
+ "colors": {
26
+ "whiteSquare": "#f0d9b5",
27
+ "blackSquare": "#b58863",
28
+ "highlight": "yellow",
29
+ "selectedSquareWhite": "#ababaa",
30
+ "selectedSquareBlack": "#ababaa",
31
+ "movedSquareWhite": "#f1f1a0",
32
+ "movedSquareBlack": "#e9e981",
33
+ "choiceSquare": "white",
34
+ "coverSquare": "black",
35
+ "hintColor": "#ababaa"
36
+ },
37
+ "animations": {
38
+ "moveTime": 200,
39
+ "fadeTime": 150,
40
+ "snapbackTime": 150
41
+ }
42
+ }