cm-chessboard 8.3.1 → 8.3.3

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/README.md CHANGED
@@ -218,25 +218,34 @@ board.enableMoveInput((event) => {
218
218
  The event has the following **`event.type`**:
219
219
 
220
220
  - **`INPUT_EVENT_TYPE.moveInputStarted`**: User started the move input, `event.squareFrom` contains the coordinates.
221
- Return true or false to validate the start square.
222
- - **`INPUT_EVENT_TYPE.validateMoveInput`**: User finished the move input, `event.squareFrom` and `event.squareTo`
223
- contain the coordinates. Return true or false to validate the move input.
224
- - **`INPUT_EVENT_TYPE.moveInputCanceled`**: User canceled the move with clicking again on the start square or clicking
225
- outside the board.
221
+ Return `true` or `false` to validate the start square. `false` cancels the move.
222
+ - **`INPUT_EVENT_TYPE.validateMoveInput`**: To validate the users move input. `event.squareFrom` and `event.squareTo`
223
+ contain the coordinates. Return `true` or `false` to validate the move. `false` cancels the move.
224
+ - **`INPUT_EVENT_TYPE.moveInputCanceled`**: The user canceled the move with clicking again on the start square, clicking
225
+ outside the board or right click.
226
+ - **`INPUT_EVENT_TYPE.moveInputFinished`**: Fired after the move was made.
227
+ - **`INPUT_EVENT_TYPE.movingOverSquare`**: Fired, when the user moves the piece over a square. `event.square` contains
228
+ the coordinates.
226
229
 
227
230
  ```javascript
228
231
  chessboard.enableMoveInput((event) => {
232
+ console.log("move input", event)
229
233
  switch (event.type) {
230
234
  case INPUT_EVENT_TYPE.moveInputStarted:
231
- console.log(`moveInputStarted: ${event.squareFrom}`)
232
- // return `true`, if input is accepted/valid, `false` aborts the interaction, the piece will not move
233
- return true
235
+ log(`moveInputStarted: ${event.squareFrom}`)
236
+ return true // false cancels move
234
237
  case INPUT_EVENT_TYPE.validateMoveInput:
235
- console.log(`validateMoveInput: ${event.squareFrom}-${event.squareTo}`)
236
- // return true, if input is accepted/valid, `false` takes the move back
237
- return true
238
+ log(`validateMoveInput: ${event.squareFrom}-${event.squareTo}`)
239
+ return true // false cancels move
238
240
  case INPUT_EVENT_TYPE.moveInputCanceled:
239
- console.log(`moveInputCanceled`)
241
+ log(`moveInputCanceled`)
242
+ break
243
+ case INPUT_EVENT_TYPE.moveInputFinished:
244
+ log(`moveInputFinished`)
245
+ break
246
+ case INPUT_EVENT_TYPE.movingOverSquare:
247
+ log(`movingOverSquare: ${event.square}`)
248
+ break
240
249
  }
241
250
  }, COLOR.white)
242
251
  ```
package/index.html CHANGED
@@ -27,11 +27,11 @@ It works, it is cool and it is easy to use. 👍</p>
27
27
  </ul>
28
28
  <h3>Examples using the cm-chessboard extensions</h3>
29
29
  <ul>
30
- <li><a href="examples/extensions/accessibility-extension.html">Accessibility extension</a></li>
31
- <li><a href="examples/extensions/arrows-extension.html">Arrows extension</a></li>
32
- <li><a href="examples/extensions/html-layer-extension.html">HTML Layer extension</a> 🆕</li>
33
30
  <li><a href="examples/extensions/markers-extension.html">Markers extension</a></li>
31
+ <li><a href="examples/extensions/arrows-extension.html">Arrows extension</a></li>
32
+ <li><a href="examples/extensions/html-layer-extension.html">HTML Layer extension</a></li>
34
33
  <li><a href="examples/extensions/promotion-dialog-extension.html">PromotionDialog extension</a></li>
34
+ <li><a href="examples/extensions/accessibility-extension.html">Accessibility extension</a></li>
35
35
  <li><a href="examples/extensions/render-video-extension.html">RenderVideo extension</a></li>
36
36
  </ul>
37
37
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cm-chessboard",
3
- "version": "8.3.1",
3
+ "version": "8.3.3",
4
4
  "description": "A JavaScript chessboard which is lightweight, ES6 module based, responsive, SVG rendered and without dependencies.",
5
5
  "keywords": [
6
6
  "chess",
@@ -1,21 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <link rel="stylesheet" href="../assets/chessboard.css">
5
- <title>frame test</title>
6
- </head>
7
- <body>
8
- Board:
9
- <div id="board"></div>
10
-
11
- <script type="module">
12
- import { Chessboard } from '../src/Chessboard.js'
13
-
14
- const board = new Chessboard(document.getElementById('board'), {
15
- position: 'start',
16
- sprite: {url: '../assets/images/chessboard-sprite.svg'},
17
- style: {borderType: 'frame'}
18
- })
19
- </script>
20
- </body>
21
- </html>