cm-chessboard 4.0.4 → 4.0.8
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 +57 -33
- package/assets/styles/_cm-chessboard-theme.scss +11 -2
- package/assets/styles/cm-chessboard.css +1 -1
- package/assets/styles/cm-chessboard.css.map +1 -1
- package/docs/PositionsAnimation.md +11 -0
- package/docs/PreMoves.md +1 -0
- package/examples/pieces-animation.html +25 -15
- package/examples/validate-moves.html +5 -7
- package/package.json +1 -1
- package/src/cm-chessboard/Chessboard.js +47 -86
- package/src/cm-chessboard/{ChessboardMoveInput.js → core/MoveInput.js} +14 -17
- package/src/cm-chessboard/{Position.js → core/Position.js} +26 -5
- package/src/cm-chessboard/core/PositionAnimationsQueue.js +274 -0
- package/src/cm-chessboard/{ChessboardState.js → core/State.js} +19 -12
- package/src/cm-chessboard/{ChessboardView.js → core/View.js} +29 -57
- package/src/cm-chessboard/{ChessboardViewAccessible.js → core/ViewAccessible.js} +6 -6
- package/test/TestPiecesAnimation.js +13 -16
- package/test/TestPosition.js +1 -1
- package/src/cm-chessboard/ChessboardPiecesAnimation.js +0 -142
- package/src/cm-chessboard/Observed.js +0 -40
package/README.md
CHANGED
|
@@ -36,13 +36,26 @@ aspects of chess games.
|
|
|
36
36
|
**Option 3:** Use it via CDN https://cdn.jsdelivr.net/npm/cm-chessboard@3.18.0/src/cm-chessboard/Chessboard.js
|
|
37
37
|
|
|
38
38
|
After installation, copy the sprite in `cm-chessboard/assets/images/` to your projects `assets/images/`
|
|
39
|
-
folder. If you put the sprite somewhere else you have to configure the location
|
|
39
|
+
folder. If you put the sprite somewhere else you have to configure the location
|
|
40
|
+
with `{sprite.url: "./url/of/chessboard-sprite.svg"}`
|
|
40
41
|
(see section 'Configuration' below).
|
|
41
42
|
|
|
42
43
|
To run the unit tests in `/test` you first have to `npm install` the dev dependencies. Without tests there are no
|
|
43
44
|
dependencies.
|
|
44
45
|
|
|
45
|
-
##
|
|
46
|
+
## Version 4.x has many changes
|
|
47
|
+
|
|
48
|
+
> With the new version 4 of cm-chessboard I completely redesigned the animation of positions with
|
|
49
|
+
> the use of promises.
|
|
50
|
+
|
|
51
|
+
The pieces animations are now smoother and less error-prone for race conditions.
|
|
52
|
+
|
|
53
|
+
As of version 4.x, the API functions `setPosition()`, `setPiece()` and `movePiece()` are **not animated** as default.
|
|
54
|
+
If you want some pieces animations you have to give the parameter `animated = true`.
|
|
55
|
+
|
|
56
|
+
Also in 4.x the chessboard will become more accessible for visually impaired people but this is in alpha stage for now.
|
|
57
|
+
|
|
58
|
+
## Usage
|
|
46
59
|
|
|
47
60
|
Preconditions for using cm-chessboard in a web page:
|
|
48
61
|
|
|
@@ -69,23 +82,30 @@ examples.
|
|
|
69
82
|
Below is the default configuration
|
|
70
83
|
|
|
71
84
|
```javascript
|
|
72
|
-
|
|
85
|
+
let defaultProps = {
|
|
73
86
|
position: "empty", // set as fen, "start" or "empty"
|
|
74
87
|
orientation: COLOR.white, // white on bottom
|
|
88
|
+
responsive: true, // resizes the board based on element size
|
|
89
|
+
animationDuration: 300, // pieces animation duration in milliseconds. Disable all animation with `0`.
|
|
75
90
|
style: {
|
|
76
|
-
cssClass: "default",
|
|
91
|
+
cssClass: "default", // set the css theme of the board, try "green", "blue" or "chess-club"
|
|
77
92
|
showCoordinates: true, // show ranks and files
|
|
78
|
-
borderType: BORDER_TYPE.
|
|
79
|
-
aspectRatio: 1, // height/width
|
|
93
|
+
borderType: BORDER_TYPE.none, // "thin" thin border, "frame" wide border with coordinates in it, "none" no border
|
|
94
|
+
aspectRatio: 1, // height/width of the board
|
|
80
95
|
moveFromMarker: MARKER_TYPE.frame, // the marker used to mark the start square
|
|
81
|
-
moveToMarker: MARKER_TYPE.frame // the marker used to mark the square where the figure is moving to
|
|
96
|
+
moveToMarker: MARKER_TYPE.frame, // the marker used to mark the square where the figure is moving to
|
|
82
97
|
},
|
|
83
|
-
responsive: true, // resizes the board based on element size
|
|
84
|
-
animationDuration: 300, // pieces animation duration in milliseconds
|
|
85
98
|
sprite: {
|
|
86
|
-
url: "./assets/images/chessboard-sprite
|
|
87
|
-
size: 40, // the sprite size, defaults to 40x40px
|
|
88
|
-
cache: true // cache the sprite
|
|
99
|
+
url: "./assets/images/chessboard-sprite.svg", // pieces and markers are stored in a sprite file
|
|
100
|
+
size: 40, // the sprite tiles size, defaults to 40x40px
|
|
101
|
+
cache: true // cache the sprite
|
|
102
|
+
},
|
|
103
|
+
accessibility: { // accessibility functions are in "alpha" version for now, they might not work as expected
|
|
104
|
+
brailleNotationInAlt: true, // show the braille notation of the game in the alt attribute of the svg
|
|
105
|
+
movePieceForm: false, // display a form to move a piece (from, to, move)
|
|
106
|
+
boardAsTable: false, // display the board additionally as HTML table
|
|
107
|
+
piecesAsList: false, // display the pieces additionally as List
|
|
108
|
+
visuallyHidden: true // hide all those extra outputs visually but keep them accessible for screen readers and braille displays
|
|
89
109
|
}
|
|
90
110
|
}
|
|
91
111
|
```
|
|
@@ -94,32 +114,32 @@ props = {
|
|
|
94
114
|
|
|
95
115
|
### constructor
|
|
96
116
|
|
|
97
|
-
`new Chessboard(
|
|
117
|
+
`new Chessboard(context, props = {})`
|
|
98
118
|
|
|
99
|
-
- **`
|
|
119
|
+
- **`context`**: the HTML DOM element being the container of the widget
|
|
100
120
|
- **`props`**: The board configuration (properties)
|
|
101
121
|
|
|
102
|
-
### setPiece(square, piece)
|
|
122
|
+
### setPiece(square, piece, animated = false)
|
|
103
123
|
|
|
104
|
-
Sets a piece on a square. Example: `board.setPiece("e4", PIECE.blackKnight)` or
|
|
105
|
-
`board.setPiece("e4", "bn")`. Remove a Piece with `board.setPiece("e4", null)`.
|
|
124
|
+
Sets a piece on a square. Example: `board.setPiece("e4", PIECE.blackKnight, true)` or
|
|
125
|
+
`board.setPiece("e4", "bn")`. Remove a Piece with `board.setPiece("e4", null)`. Returns a **Promise**, which is
|
|
126
|
+
resolved,
|
|
127
|
+
after the animation finished.
|
|
106
128
|
|
|
107
129
|
### getPiece(square)
|
|
108
130
|
|
|
109
131
|
Returns the piece on a square or `undefined` if the square is empty.
|
|
110
132
|
|
|
111
|
-
### movePiece(squareFrom, squareTo, animated =
|
|
133
|
+
### movePiece(squareFrom, squareTo, animated = false)
|
|
112
134
|
|
|
113
|
-
Move a piece from `squareFrom` to `squareTo`. Returns a **Promise**, which is resolved,
|
|
135
|
+
Move a piece from `squareFrom` to `squareTo`. Returns a **Promise**, which is resolved, after the animation finished.
|
|
114
136
|
|
|
115
137
|
[Example for **movePiece**](https://shaack.com/projekte/cm-chessboard/examples/pieces-animation.html)
|
|
116
138
|
|
|
117
|
-
### setPosition(fen, animated =
|
|
118
|
-
|
|
119
|
-
Sets the position as `fen`. Special values are `"start"`, sets the chess start position and
|
|
120
|
-
`"empty"`, sets an empty board. When `animated` is set `false`, the new position will be shown instant.
|
|
139
|
+
### setPosition(fen, animated = false)
|
|
121
140
|
|
|
122
|
-
|
|
141
|
+
Sets the position as `fen`. Special values are "start", sets the chess start position and
|
|
142
|
+
"empty", sets an empty board. Returns a **Promise**, which is resolved, after the animation finished.
|
|
123
143
|
|
|
124
144
|
[Example for **setPosition**](https://shaack.com/projekte/cm-chessboard/examples/pieces-animation.html)
|
|
125
145
|
|
|
@@ -131,11 +151,13 @@ Returns the board position as `fen`.
|
|
|
131
151
|
|
|
132
152
|
Adds a marker on a square.
|
|
133
153
|
|
|
134
|
-
Default types are: `MARKER_TYPE.frame`, `MARKER_TYPE.square`, `MARKER_TYPE.dot`, `MARKER_TYPE.circle` exportet
|
|
154
|
+
Default types are: `MARKER_TYPE.frame`, `MARKER_TYPE.square`, `MARKER_TYPE.dot`, `MARKER_TYPE.circle` exportet
|
|
155
|
+
by `Chessboard.js`.
|
|
135
156
|
|
|
136
157
|
#### You can create your own marker types:
|
|
137
158
|
|
|
138
|
-
Just create an object like `const myMarker = {class: "markerCssClass", slice: "markerSliceId"}`, where `class` is the
|
|
159
|
+
Just create an object like `const myMarker = {class: "markerCssClass", slice: "markerSliceId"}`, where `class` is the
|
|
160
|
+
css class of the marker for styling
|
|
139
161
|
and `slice` is the `id` in `sprite.svg`. See also [Create your own custom markers](#create-your-own-custom-markers)
|
|
140
162
|
below.
|
|
141
163
|
|
|
@@ -271,7 +293,8 @@ It's a circle with the radius 18 and its center at 20/20.
|
|
|
271
293
|
|
|
272
294
|
Important is the id "markerCircle". You can set the marker
|
|
273
295
|
with `board.addMarker("e4", {class: "markerSquare", slice: "markerSquare"})`
|
|
274
|
-
"emphasize" is the css class, which defines the color and opacity of the marker. "slice" is the id of the marker in the
|
|
296
|
+
"emphasize" is the css class, which defines the color and opacity of the marker. "slice" is the id of the marker in the
|
|
297
|
+
SVG. This is
|
|
275
298
|
also demonstrated in the [mark squares example](https://shaack.com/projekte/cm-chessboard/examples/input-callbacks.html)
|
|
276
299
|
.
|
|
277
300
|
|
|
@@ -282,14 +305,15 @@ These are the css styles of the markers "markerSquare" and "markerCircleRed".
|
|
|
282
305
|
|
|
283
306
|
```css
|
|
284
307
|
marker.markerSquare {
|
|
285
|
-
|
|
286
|
-
|
|
308
|
+
fill: black;
|
|
309
|
+
opacity: 0.11;
|
|
287
310
|
}
|
|
311
|
+
|
|
288
312
|
marker.markerCircleRed {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
313
|
+
stroke: #aa0000;
|
|
314
|
+
stroke-width: 3px;
|
|
315
|
+
opacity: 0.4;
|
|
316
|
+
}
|
|
293
317
|
```
|
|
294
318
|
|
|
295
319
|
So you can simply add a marker with the id `myMarkerIdInSvg` to the SVG, and add the class `myMarkerCssClass` to the
|
|
@@ -21,7 +21,16 @@ $border: $square-black, $frame-bg: $square-white,) {
|
|
|
21
21
|
.border {
|
|
22
22
|
stroke: $border;
|
|
23
23
|
stroke-width: 0.7%;
|
|
24
|
-
fill:
|
|
24
|
+
fill: $square-white;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
&.border-type-none {
|
|
29
|
+
.board {
|
|
30
|
+
.border {
|
|
31
|
+
stroke: $border;
|
|
32
|
+
stroke-width: 0;
|
|
33
|
+
fill: $square-white;
|
|
25
34
|
}
|
|
26
35
|
}
|
|
27
36
|
}
|
|
@@ -56,4 +65,4 @@ $border: $square-black, $frame-bg: $square-white,) {
|
|
|
56
65
|
}
|
|
57
66
|
}
|
|
58
67
|
}
|
|
59
|
-
}
|
|
68
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
.cm-chessboard .board.input-enabled .square{cursor:pointer}.cm-chessboard .markers .marker.markerFrame,.cm-chessboard .markers .marker.marker-frame{stroke:black;stroke-width:1.8px;opacity:0.5}.cm-chessboard .markers .marker.markerFrameRed,.cm-chessboard .markers .marker.marker-frame-red{stroke:#aa0000;stroke-width:1.8px;opacity:0.4}.cm-chessboard .markers .marker.markerSquare,.cm-chessboard .markers .marker.marker-square{fill:black;opacity:0.11}.cm-chessboard .markers .marker.markerDot,.cm-chessboard .markers .marker.marker-dot{fill:black;opacity:0.3}.cm-chessboard .markers .marker.markerCircle,.cm-chessboard .markers .marker.marker-circle{stroke:#000055;stroke-width:3px;opacity:0.4}.cm-chessboard .markers .marker.markerCircleRed,.cm-chessboard .markers .marker.marker-circle-red{stroke:#aa0000;stroke-width:3px;opacity:0.4}.cm-chessboard .pieces,.cm-chessboard .markers{pointer-events:none}.cm-chessboard-content .list-inline{padding-left:0;list-style:none}.cm-chessboard-content .list-inline-item{display:inline-block}.cm-chessboard-content .list-inline-item:not(:last-child){margin-right:1rem}.cm-chessboard-content .list-inline{padding-left:0;list-style:none}.cm-chessboard-content .list-inline-item{display:inline-block}.cm-chessboard-content .list-inline-item:not(:last-child){margin-right:1rem}.visually-hidden{position:absolute;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden}.cm-chessboard.default .board .square.white{fill:#ecdab9}.cm-chessboard.default .board .square.black{fill:#c5a076}.cm-chessboard.default.border-type-thin .board .border{stroke:#c5a076;stroke-width:0.7%;fill:
|
|
1
|
+
.cm-chessboard .board.input-enabled .square{cursor:pointer}.cm-chessboard .markers .marker.markerFrame,.cm-chessboard .markers .marker.marker-frame{stroke:black;stroke-width:1.8px;opacity:0.5}.cm-chessboard .markers .marker.markerFrameRed,.cm-chessboard .markers .marker.marker-frame-red{stroke:#aa0000;stroke-width:1.8px;opacity:0.4}.cm-chessboard .markers .marker.markerSquare,.cm-chessboard .markers .marker.marker-square{fill:black;opacity:0.11}.cm-chessboard .markers .marker.markerDot,.cm-chessboard .markers .marker.marker-dot{fill:black;opacity:0.3}.cm-chessboard .markers .marker.markerCircle,.cm-chessboard .markers .marker.marker-circle{stroke:#000055;stroke-width:3px;opacity:0.4}.cm-chessboard .markers .marker.markerCircleRed,.cm-chessboard .markers .marker.marker-circle-red{stroke:#aa0000;stroke-width:3px;opacity:0.4}.cm-chessboard .pieces,.cm-chessboard .markers{pointer-events:none}.cm-chessboard-content .list-inline{padding-left:0;list-style:none}.cm-chessboard-content .list-inline-item{display:inline-block}.cm-chessboard-content .list-inline-item:not(:last-child){margin-right:1rem}.cm-chessboard-content .list-inline{padding-left:0;list-style:none}.cm-chessboard-content .list-inline-item{display:inline-block}.cm-chessboard-content .list-inline-item:not(:last-child){margin-right:1rem}.visually-hidden{position:absolute;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden}.cm-chessboard.default .board .square.white{fill:#ecdab9}.cm-chessboard.default .board .square.black{fill:#c5a076}.cm-chessboard.default.border-type-thin .board .border{stroke:#c5a076;stroke-width:0.7%;fill:#ecdab9}.cm-chessboard.default.border-type-none .board .border{stroke:#c5a076;stroke-width:0;fill:#ecdab9}.cm-chessboard.default.border-type-frame .board .border{fill:#ecdab9;stroke:none}.cm-chessboard.default.border-type-frame .board .border-inner{fill:transparent;stroke:#c5a076;stroke-width:0.7%}.cm-chessboard.default .coordinates{pointer-events:none;user-select:none}.cm-chessboard.default .coordinates .coordinate{fill:#c5a076;font-size:7px;cursor:default}.cm-chessboard.default .coordinates .coordinate.black{fill:#ecdab9}.cm-chessboard.default .coordinates .coordinate.white{fill:#c5a076}.cm-chessboard.default-contrast .board .square.white{fill:#ecdab9}.cm-chessboard.default-contrast .board .square.black{fill:#c5a076}.cm-chessboard.default-contrast.border-type-thin .board .border{stroke:#c5a076;stroke-width:0.7%;fill:#ecdab9}.cm-chessboard.default-contrast.border-type-none .board .border{stroke:#c5a076;stroke-width:0;fill:#ecdab9}.cm-chessboard.default-contrast.border-type-frame .board .border{fill:#ecdab9;stroke:none}.cm-chessboard.default-contrast.border-type-frame .board .border-inner{fill:transparent;stroke:#c5a076;stroke-width:0.7%}.cm-chessboard.default-contrast .coordinates{pointer-events:none;user-select:none}.cm-chessboard.default-contrast .coordinates .coordinate{fill:#c5a076;font-size:7px;cursor:default}.cm-chessboard.default-contrast .coordinates .coordinate.black{fill:#333}.cm-chessboard.default-contrast .coordinates .coordinate.white{fill:#333}.cm-chessboard.green .board .square.white{fill:#E0DDCC}.cm-chessboard.green .board .square.black{fill:#4c946a}.cm-chessboard.green.border-type-thin .board .border{stroke:#4c946a;stroke-width:0.7%;fill:#E0DDCC}.cm-chessboard.green.border-type-none .board .border{stroke:#4c946a;stroke-width:0;fill:#E0DDCC}.cm-chessboard.green.border-type-frame .board .border{fill:#E0DDCC;stroke:none}.cm-chessboard.green.border-type-frame .board .border-inner{fill:transparent;stroke:#4c946a;stroke-width:0.7%}.cm-chessboard.green .coordinates{pointer-events:none;user-select:none}.cm-chessboard.green .coordinates .coordinate{fill:#4c946a;font-size:7px;cursor:default}.cm-chessboard.green .coordinates .coordinate.black{fill:#E0DDCC}.cm-chessboard.green .coordinates .coordinate.white{fill:#4c946a}.cm-chessboard.blue .board .square.white{fill:#d8ecfb}.cm-chessboard.blue .board .square.black{fill:#86afcf}.cm-chessboard.blue.border-type-thin .board .border{stroke:#86afcf;stroke-width:0.7%;fill:#d8ecfb}.cm-chessboard.blue.border-type-none .board .border{stroke:#86afcf;stroke-width:0;fill:#d8ecfb}.cm-chessboard.blue.border-type-frame .board .border{fill:#d8ecfb;stroke:none}.cm-chessboard.blue.border-type-frame .board .border-inner{fill:transparent;stroke:#86afcf;stroke-width:0.7%}.cm-chessboard.blue .coordinates{pointer-events:none;user-select:none}.cm-chessboard.blue .coordinates .coordinate{fill:#86afcf;font-size:7px;cursor:default}.cm-chessboard.blue .coordinates .coordinate.black{fill:#d8ecfb}.cm-chessboard.blue .coordinates .coordinate.white{fill:#86afcf}.cm-chessboard.chess-club .board .square.white{fill:#E6D3B1}.cm-chessboard.chess-club .board .square.black{fill:#AF6B3F}.cm-chessboard.chess-club.border-type-thin .board .border{stroke:#692e2b;stroke-width:0.7%;fill:#E6D3B1}.cm-chessboard.chess-club.border-type-none .board .border{stroke:#692e2b;stroke-width:0;fill:#E6D3B1}.cm-chessboard.chess-club.border-type-frame .board .border{fill:#692e2b;stroke:none}.cm-chessboard.chess-club.border-type-frame .board .border-inner{fill:transparent;stroke:#692e2b;stroke-width:0.7%}.cm-chessboard.chess-club .coordinates{pointer-events:none;user-select:none}.cm-chessboard.chess-club .coordinates .coordinate{fill:#E6D3B1;font-size:7px;cursor:default}.cm-chessboard.chess-club .coordinates .coordinate.black{fill:#E6D3B1}.cm-chessboard.chess-club .coordinates .coordinate.white{fill:#AF6B3F}.cm-chessboard.chessboard-js .board .square.white{fill:#f0d9b5}.cm-chessboard.chessboard-js .board .square.black{fill:#b58863}.cm-chessboard.chessboard-js.border-type-thin .board .border{stroke:#404040;stroke-width:0.7%;fill:#f0d9b5}.cm-chessboard.chessboard-js.border-type-none .board .border{stroke:#404040;stroke-width:0;fill:#f0d9b5}.cm-chessboard.chessboard-js.border-type-frame .board .border{fill:#f0d9b5;stroke:none}.cm-chessboard.chessboard-js.border-type-frame .board .border-inner{fill:transparent;stroke:#404040;stroke-width:0.7%}.cm-chessboard.chessboard-js .coordinates{pointer-events:none;user-select:none}.cm-chessboard.chessboard-js .coordinates .coordinate{fill:#404040;font-size:7px;cursor:default}.cm-chessboard.chessboard-js .coordinates .coordinate.black{fill:#f0d9b5}.cm-chessboard.chessboard-js .coordinates .coordinate.white{fill:#b58863}.cm-chessboard.black-and-white .board .square.white{fill:#fff}.cm-chessboard.black-and-white .board .square.black{fill:#9c9c9c}.cm-chessboard.black-and-white.border-type-thin .board .border{stroke:#9c9c9c;stroke-width:0.7%;fill:#fff}.cm-chessboard.black-and-white.border-type-none .board .border{stroke:#9c9c9c;stroke-width:0;fill:#fff}.cm-chessboard.black-and-white.border-type-frame .board .border{fill:#fff;stroke:none}.cm-chessboard.black-and-white.border-type-frame .board .border-inner{fill:transparent;stroke:#9c9c9c;stroke-width:0.7%}.cm-chessboard.black-and-white .coordinates{pointer-events:none;user-select:none}.cm-chessboard.black-and-white .coordinates .coordinate{fill:#9c9c9c;font-size:7px;cursor:default}.cm-chessboard.black-and-white .coordinates .coordinate.black{fill:#fff}.cm-chessboard.black-and-white .coordinates .coordinate.white{fill:#9c9c9c}
|
|
2
2
|
|
|
3
3
|
/*# sourceMappingURL=cm-chessboard.css.map */
|
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
"_cm-chessboard-theme.scss"
|
|
7
7
|
],
|
|
8
8
|
"names": [],
|
|
9
|
-
"mappings": "AAGA,AAGM,cAHQ,CACZ,MAAM,AACH,cAAc,CACb,OAAO,AAAC,CACN,MAAM,CAAE,OAAO,CAChB,AALP,AAYM,cAZQ,CASZ,QAAQ,CACN,OAAO,AAEJ,YAAY,CAZnB,cAAc,CASZ,QAAQ,CACN,OAAO,AAEW,aAAa,AAAC,CAC5B,MAAM,CAAE,KAAK,CACb,YAAY,CAAE,KAAK,CACnB,OAAO,CAAE,GAAG,CACb,AAhBP,AAkBM,cAlBQ,CASZ,QAAQ,CACN,OAAO,AAQJ,eAAe,CAlBtB,cAAc,CASZ,QAAQ,CACN,OAAO,AAQc,iBAAiB,AAAC,CACnC,MAAM,CAAE,OAAO,CACf,YAAY,CAAE,KAAK,CACnB,OAAO,CAAE,GAAG,CACb,AAtBP,AAwBM,cAxBQ,CASZ,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AAE,CAAC,CACf,IAAI,CDsGE,IAAO,CCrGd,AAjCT,AAuCQ,cAvCM,AAAA,gBAAgB,AAqCzB,kBAAkB,CACjB,MAAM,CACJ,OAAO,AAAC,CACN,IAAI,CD8FE,IAAO,CC7Fb,MAAM,CAAE,IAAI,CACb,AA1CT,AA2CQ,cA3CM,AAAA,gBAAgB,AAqCzB,kBAAkB,CACjB,MAAM,CAKJ,aAAa,AAAC,CACZ,IAAI,CAAE,WAAW,CACjB,MAAM,CDyFS,OAAO,CCxFtB,YAAY,CAAE,IAAI,CACnB,AA/CT,AAkDI,cAlDU,AAAA,gBAAgB,CAkD1B,YAAY,AAAC,CACX,cAAc,CAAE,IAAI,CACpB,WAAW,CAAE,IAAI,CAalB,AAjEL,AAsDM,cAtDQ,AAAA,gBAAgB,CAkD1B,YAAY,CAIV,WAAW,AAAC,CACV,IAAI,CD+Ea,OAAO,CC9ExB,SAAS,CAAE,GAAG,CACd,MAAM,CAAE,OAAO,CAOhB,AAhEP,AA0DQ,cA1DM,AAAA,gBAAgB,CAkD1B,YAAY,CAIV,WAAW,AAIR,MAAM,AAAC,CACN,IAAI,CD2EE,IAAO,CC1Ed,AA5DT,AA6DQ,cA7DM,AAAA,gBAAgB,CAkD1B,YAAY,CAIV,WAAW,AAOR,MAAM,AAAC,CACN,IAAI,CDwEW,OAAO,CCvEvB"
|
|
10
10
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Positions Queue
|
|
2
|
+
|
|
3
|
+
- Extra Class
|
|
4
|
+
- Holds the Queue
|
|
5
|
+
- API
|
|
6
|
+
- `isRunning(): boolean`
|
|
7
|
+
- `pushPosition(position, animated)`
|
|
8
|
+
- `run(): Promise` // starts the animation, callback when finished, if running : Promis
|
|
9
|
+
- `skip(callback): Promise` // skips all running steps, displays the last position and returns to callback
|
|
10
|
+
- Positions are set immediately in the Model
|
|
11
|
+
- Then they are pushed into an Animations queue and run (if not running)
|
package/docs/PreMoves.md
CHANGED
|
@@ -13,16 +13,26 @@
|
|
|
13
13
|
<p>Animations are queued automatically.</p>
|
|
14
14
|
<div class="board" id="board"></div>
|
|
15
15
|
<br/>
|
|
16
|
-
<
|
|
16
|
+
<h3>Not animated</h3>
|
|
17
|
+
<button onclick="setPosition('empty').then(() => { console.log('empty finished')})">Empty Position</button>
|
|
17
18
|
<button onclick="setPosition('start')">Start Position</button>
|
|
18
19
|
<button onclick="setPosition('rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR')">Position 1</button>
|
|
19
20
|
<button onclick="setPosition('rnbqkbnr/pp1ppppp/8/2p5/4P3/5N2/PPPP1PPP/RNBQKB1R')">Position 2</button>
|
|
20
21
|
<button onclick="setPosition('rn2k1r1/ppp1pp1p/3p2p1/5bn1/P7/2N2B2/1PPPPP2/2BNK1RR')">Position 3</button>
|
|
21
22
|
<button onclick="switchOrientation()">Switch Orientation</button>
|
|
23
|
+
<h3>Animated</h3>
|
|
24
|
+
<button onclick="setPosition('empty', true).then(() => { console.log('empty animated finished')})">Empty Position</button>
|
|
25
|
+
<button onclick="setPosition('start', true)">Start Position</button>
|
|
26
|
+
<button onclick="setPosition('rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR', true)">Position 1</button>
|
|
27
|
+
<button onclick="setPosition('rnbqkbnr/pp1ppppp/8/2p5/4P3/5N2/PPPP1PPP/RNBQKB1R', true)">Position 2</button>
|
|
28
|
+
<button onclick="setPosition('rn2k1r1/ppp1pp1p/3p2p1/5bn1/P7/2N2B2/1PPPPP2/2BNK1RR', true)">Position 3</button>
|
|
29
|
+
<button onclick="switchOrientation(true)">Switch Orientation</button>
|
|
30
|
+
|
|
22
31
|
<pre><button onclick="window.board.setPosition('rn2k1r1/ppp1pp1p/3p2p1/5bn1/P7/2N2B2/1PPPPP2/2BNK1RR')">Position 3</button></pre>
|
|
23
32
|
<br/>
|
|
24
|
-
Move piece from
|
|
25
|
-
|
|
33
|
+
Move piece <label for="moveFrom">from</label> <input id="moveFrom" type="text" size="2" value="e2"/> <label
|
|
34
|
+
for="moveTo">to</label> <input id="moveTo" type="text" size="2"
|
|
35
|
+
value="e4"/>
|
|
26
36
|
<button onclick="movePiece()">Do move</button>
|
|
27
37
|
<pre>board.movePiece(squareFrom, squareTo)</pre>
|
|
28
38
|
<br/>
|
|
@@ -43,27 +53,27 @@ await board.movePiece("d5", "f4")
|
|
|
43
53
|
animationDuration: 500
|
|
44
54
|
})
|
|
45
55
|
let i = 0
|
|
46
|
-
window.setPosition = (position) => {
|
|
56
|
+
window.setPosition = (position, animated) => {
|
|
47
57
|
i++
|
|
48
|
-
board.setPosition(position)
|
|
49
|
-
console.log("setPosition resolved", position, i)
|
|
50
|
-
})
|
|
58
|
+
return board.setPosition(position, animated)
|
|
51
59
|
}
|
|
52
|
-
window.switchOrientation = () => {
|
|
53
|
-
board.setOrientation(board.getOrientation() === 'w' ? 'b' : 'w')
|
|
60
|
+
window.switchOrientation = (animated) => {
|
|
61
|
+
board.setOrientation(board.getOrientation() === 'w' ? 'b' : 'w', animated)
|
|
54
62
|
}
|
|
55
63
|
window.movePiece = () => {
|
|
56
64
|
const squareFrom = document.getElementById("moveFrom").value
|
|
57
65
|
const squareTo = document.getElementById("moveTo").value
|
|
58
66
|
console.log("movePiece", squareFrom, squareTo)
|
|
59
|
-
board.movePiece(squareFrom, squareTo)
|
|
67
|
+
board.movePiece(squareFrom, squareTo, true)
|
|
60
68
|
}
|
|
61
69
|
window.knightMove = async () => {
|
|
62
|
-
|
|
63
|
-
board.
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
70
|
+
board.setPiece("e5", PIECE.wn)
|
|
71
|
+
board.movePiece("e5", "c4", true)
|
|
72
|
+
board.movePiece("c4", "d6", true)
|
|
73
|
+
board.movePiece("d6", "f5", true)
|
|
74
|
+
board.movePiece("f5", "h4", true)
|
|
75
|
+
board.movePiece("h4", "g6", true)
|
|
76
|
+
board.movePiece("g6", "e5", true)
|
|
67
77
|
}
|
|
68
78
|
</script>
|
|
69
79
|
</body>
|
|
@@ -38,7 +38,7 @@ function inputHandler(event) {
|
|
|
38
38
|
if (event.type === INPUT_EVENT_TYPE.moveStart) {
|
|
39
39
|
const moves = chess.moves({square: event.square, verbose: true});
|
|
40
40
|
event.chessboard.addMarker(event.square, MARKER_TYPE.square)
|
|
41
|
-
for (const move of moves) {
|
|
41
|
+
for (const move of moves) { // draw dots on possible moves
|
|
42
42
|
event.chessboard.addMarker(move.to, MARKER_TYPE.dot)
|
|
43
43
|
}
|
|
44
44
|
return moves.length > 0
|
|
@@ -46,9 +46,7 @@ function inputHandler(event) {
|
|
|
46
46
|
const move = {from: event.squareFrom, to: event.squareTo}
|
|
47
47
|
const result = chess.move(move)
|
|
48
48
|
if (result) {
|
|
49
|
-
event.chessboard.removeMarkers(undefined, MARKER_TYPE.square)
|
|
50
49
|
event.chessboard.disableMoveInput()
|
|
51
|
-
event.chessboard.setPosition(chess.fen())
|
|
52
50
|
const possibleMoves = chess.moves({verbose: true})
|
|
53
51
|
if (possibleMoves.length > 0) {
|
|
54
52
|
const randomIndex = Math.floor(Math.random() * possibleMoves.length)
|
|
@@ -56,7 +54,7 @@ function inputHandler(event) {
|
|
|
56
54
|
setTimeout(() => { // smoother with 500ms delay
|
|
57
55
|
chess.move({from: randomMove.from, to: randomMove.to})
|
|
58
56
|
event.chessboard.enableMoveInput(inputHandler, COLOR.white)
|
|
59
|
-
event.chessboard.setPosition(chess.fen())
|
|
57
|
+
event.chessboard.setPosition(chess.fen(), true)
|
|
60
58
|
}, 500)
|
|
61
59
|
}
|
|
62
60
|
} else {
|
|
@@ -97,7 +95,6 @@ board.enableMoveInput(inputHandler, COLOR.white)
|
|
|
97
95
|
const result = chess.move(move)
|
|
98
96
|
if (result) {
|
|
99
97
|
event.chessboard.disableMoveInput()
|
|
100
|
-
event.chessboard.setPosition(chess.fen())
|
|
101
98
|
const possibleMoves = chess.moves({verbose: true})
|
|
102
99
|
if (possibleMoves.length > 0) {
|
|
103
100
|
const randomIndex = Math.floor(Math.random() * possibleMoves.length)
|
|
@@ -105,7 +102,7 @@ board.enableMoveInput(inputHandler, COLOR.white)
|
|
|
105
102
|
setTimeout(() => { // smoother with 500ms delay
|
|
106
103
|
chess.move({from: randomMove.from, to: randomMove.to})
|
|
107
104
|
event.chessboard.enableMoveInput(inputHandler, COLOR.white)
|
|
108
|
-
event.chessboard.setPosition(chess.fen())
|
|
105
|
+
event.chessboard.setPosition(chess.fen(), true)
|
|
109
106
|
}, 500)
|
|
110
107
|
}
|
|
111
108
|
} else {
|
|
@@ -119,7 +116,8 @@ board.enableMoveInput(inputHandler, COLOR.white)
|
|
|
119
116
|
position: chess.fen(),
|
|
120
117
|
sprite: {url: "../assets/images/chessboard-sprite-staunty.svg"},
|
|
121
118
|
style: {moveFromMarker: undefined, moveToMarker: undefined}, // disable standard markers
|
|
122
|
-
orientation: COLOR.white
|
|
119
|
+
orientation: COLOR.white,
|
|
120
|
+
animationDuration: 500
|
|
123
121
|
})
|
|
124
122
|
board.enableMoveInput(inputHandler, COLOR.white)
|
|
125
123
|
</script>
|
package/package.json
CHANGED
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
* License: MIT, see file 'LICENSE'
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import {State} from "./core/State.js"
|
|
8
|
+
import {ViewAccessible} from "./core/ViewAccessible.js"
|
|
9
|
+
import {PositionAnimationsQueue} from "./core/PositionAnimationsQueue.js"
|
|
10
|
+
import {Position} from "./core/Position.js"
|
|
9
11
|
|
|
10
12
|
export const COLOR = {
|
|
11
13
|
white: "w",
|
|
@@ -35,8 +37,6 @@ export const PIECE = {
|
|
|
35
37
|
wp: "wp", wb: "wb", wn: "wn", wr: "wr", wq: "wq", wk: "wk",
|
|
36
38
|
bp: "bp", bb: "bb", bn: "bn", br: "br", bq: "bq", bk: "bk",
|
|
37
39
|
}
|
|
38
|
-
export const FEN_START_POSITION = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
|
|
39
|
-
export const FEN_EMPTY_POSITION = "8/8/8/8/8/8/8/8"
|
|
40
40
|
|
|
41
41
|
export class Chessboard {
|
|
42
42
|
|
|
@@ -45,29 +45,29 @@ export class Chessboard {
|
|
|
45
45
|
throw new Error("container element is " + context)
|
|
46
46
|
}
|
|
47
47
|
this.context = context
|
|
48
|
-
this.id = (Math.random() + 1).toString(36).
|
|
48
|
+
this.id = (Math.random() + 1).toString(36).substring(2, 8)
|
|
49
49
|
let defaultProps = {
|
|
50
50
|
position: "empty", // set as fen, "start" or "empty"
|
|
51
51
|
orientation: COLOR.white, // white on bottom
|
|
52
|
-
animationDuration: 300, // pieces animation duration in milliseconds
|
|
53
52
|
responsive: true, // resizes the board based on element size
|
|
53
|
+
animationDuration: 300, // pieces animation duration in milliseconds. Disable all animation with `0`.
|
|
54
54
|
style: {
|
|
55
|
-
cssClass: "default",
|
|
55
|
+
cssClass: "default", // set the css theme of the board, try "green", "blue" or "chess-club"
|
|
56
56
|
showCoordinates: true, // show ranks and files
|
|
57
|
-
borderType: BORDER_TYPE.none, // thin
|
|
57
|
+
borderType: BORDER_TYPE.none, // "thin" thin border, "frame" wide border with coordinates in it, "none" no border
|
|
58
58
|
aspectRatio: 1, // height/width of the board
|
|
59
59
|
moveFromMarker: MARKER_TYPE.frame, // the marker used to mark the start square
|
|
60
60
|
moveToMarker: MARKER_TYPE.frame, // the marker used to mark the square where the figure is moving to
|
|
61
61
|
},
|
|
62
62
|
sprite: {
|
|
63
|
-
url: "./assets/images/chessboard-sprite.svg", // pieces and markers are stored
|
|
64
|
-
size: 40, // the sprite size, defaults to 40x40px
|
|
63
|
+
url: "./assets/images/chessboard-sprite.svg", // pieces and markers are stored in a sprite file
|
|
64
|
+
size: 40, // the sprite tiles size, defaults to 40x40px
|
|
65
65
|
cache: true // cache the sprite
|
|
66
66
|
},
|
|
67
|
-
accessibility: {
|
|
67
|
+
accessibility: { // accessibility functions are in "alpha" version for now, they might not work as expected
|
|
68
68
|
brailleNotationInAlt: true, // show the braille notation of the game in the alt attribute of the svg
|
|
69
|
-
boardAsTable: false, // display the board additionally as HTML table
|
|
70
69
|
movePieceForm: false, // display a form to move a piece (from, to, move)
|
|
70
|
+
boardAsTable: false, // display the board additionally as HTML table
|
|
71
71
|
piecesAsList: false, // display the pieces additionally as List
|
|
72
72
|
visuallyHidden: true // hide all those extra outputs visually but keep them accessible for screen readers and braille displays
|
|
73
73
|
}
|
|
@@ -88,88 +88,57 @@ export class Chessboard {
|
|
|
88
88
|
Object.assign(this.props.accessibility, props.accessibility)
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
this.state = new
|
|
92
|
-
this.view = new
|
|
93
|
-
|
|
94
|
-
this.state.addObserver(() => {
|
|
95
|
-
if(this.view) {
|
|
96
|
-
this.view.drawPieces()
|
|
97
|
-
}
|
|
98
|
-
})
|
|
99
|
-
*/
|
|
100
|
-
if (this.props.position === "start") {
|
|
101
|
-
this.state.setPosition(FEN_START_POSITION)
|
|
102
|
-
} else if (this.props.position === "empty" || this.props.position === undefined) {
|
|
103
|
-
this.state.setPosition(FEN_EMPTY_POSITION)
|
|
104
|
-
} else {
|
|
105
|
-
this.state.setPosition(this.props.position)
|
|
106
|
-
}
|
|
91
|
+
this.state = new State()
|
|
92
|
+
this.view = new ViewAccessible(this)
|
|
93
|
+
this.positionAnimationsQueue = new PositionAnimationsQueue(this)
|
|
107
94
|
this.state.orientation = this.props.orientation
|
|
108
95
|
this.view.redraw()
|
|
96
|
+
this.state.position = new Position(this.props.position)
|
|
97
|
+
this.view.redrawPieces()
|
|
109
98
|
}
|
|
110
99
|
|
|
111
100
|
// API //
|
|
112
101
|
|
|
113
|
-
setPiece(square, piece) {
|
|
102
|
+
async setPiece(square, piece, animated = false) {
|
|
103
|
+
const positionFrom = this.state.position.clone()
|
|
114
104
|
this.state.position.setPiece(square, piece)
|
|
115
|
-
this.
|
|
105
|
+
return this.positionAnimationsQueue.enqueuePositionChange(positionFrom, this.state.position.clone(), animated)
|
|
116
106
|
}
|
|
117
107
|
|
|
118
|
-
|
|
119
|
-
|
|
108
|
+
async movePiece(squareFrom, squareTo, animated = false) {
|
|
109
|
+
const positionFrom = this.state.position.clone()
|
|
110
|
+
this.state.position.movePiece(squareFrom, squareTo)
|
|
111
|
+
return this.positionAnimationsQueue.enqueuePositionChange(positionFrom, this.state.position.clone(), animated)
|
|
120
112
|
}
|
|
121
113
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
if(!pieceFrom) {
|
|
127
|
-
reject("no piece on square " + squareFrom)
|
|
128
|
-
} else {
|
|
129
|
-
this.state.position.setPiece(squareFrom, null)
|
|
130
|
-
this.state.position.setPiece(squareTo, pieceFrom)
|
|
131
|
-
if (animated) {
|
|
132
|
-
this.view.animatePieces(prevSquares, this.state.position.squares, () => {
|
|
133
|
-
resolve()
|
|
134
|
-
})
|
|
135
|
-
} else {
|
|
136
|
-
this.view.drawPieces(this.state.position.squares)
|
|
137
|
-
resolve()
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
})
|
|
114
|
+
async setPosition(fen, animated = false) {
|
|
115
|
+
const positionFrom = this.state.position.clone()
|
|
116
|
+
this.state.position.setFen(fen)
|
|
117
|
+
return this.positionAnimationsQueue.enqueuePositionChange(positionFrom, this.state.position.clone(), animated)
|
|
141
118
|
}
|
|
142
119
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
const fenNormalized = fenParts[0]
|
|
153
|
-
|
|
154
|
-
if (fenNormalized !== currentFen) {
|
|
155
|
-
const prevSquares = this.state.position.squares.slice(0) // clone
|
|
156
|
-
this.state.setPosition(fen)
|
|
157
|
-
if (animated) {
|
|
158
|
-
this.view.animatePieces(prevSquares, this.state.position.squares.slice(0), () => {
|
|
159
|
-
resolve()
|
|
160
|
-
})
|
|
161
|
-
} else {
|
|
162
|
-
this.view.drawPieces(this.state.position.squares)
|
|
163
|
-
resolve()
|
|
164
|
-
}
|
|
165
|
-
} else {
|
|
166
|
-
resolve()
|
|
167
|
-
}
|
|
120
|
+
async setOrientation(color, animated = false) {
|
|
121
|
+
const position = this.state.position.clone()
|
|
122
|
+
if(this.boardTurning) {
|
|
123
|
+
console.log("setOrientation is only once in queue allowed")
|
|
124
|
+
return
|
|
125
|
+
}
|
|
126
|
+
this.boardTurning = true
|
|
127
|
+
return this.positionAnimationsQueue.enqueueTurnBoard(position, color, animated).then(() => {
|
|
128
|
+
this.boardTurning = false
|
|
168
129
|
})
|
|
169
130
|
}
|
|
170
131
|
|
|
132
|
+
getPiece(square) {
|
|
133
|
+
return this.state.position.getPiece(square)
|
|
134
|
+
}
|
|
135
|
+
|
|
171
136
|
getPosition() {
|
|
172
|
-
return this.state.
|
|
137
|
+
return this.state.position.getFen()
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
getOrientation() {
|
|
141
|
+
return this.state.orientation
|
|
173
142
|
}
|
|
174
143
|
|
|
175
144
|
addMarker(square, type) {
|
|
@@ -199,16 +168,8 @@ export class Chessboard {
|
|
|
199
168
|
this.view.drawMarkers()
|
|
200
169
|
}
|
|
201
170
|
|
|
202
|
-
setOrientation(color) {
|
|
203
|
-
this.state.orientation = color
|
|
204
|
-
return this.view.redraw()
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
getOrientation() {
|
|
208
|
-
return this.state.orientation
|
|
209
|
-
}
|
|
210
|
-
|
|
211
171
|
destroy() {
|
|
172
|
+
this.positionAnimationsQueue.destroy()
|
|
212
173
|
this.view.destroy()
|
|
213
174
|
this.view = undefined
|
|
214
175
|
this.state = undefined
|