cm-chessboard 8.11.3 → 8.11.5
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/assets/extensions/arrows/arrows.css +5 -5
- package/assets/extensions/arrows/arrows.scss +4 -4
- package/examples/extensions/arrows-extension.html +1 -0
- package/examples/extensions/promotion-dialog-extension.html +8 -1
- package/index.html +3 -3
- package/package.json +1 -1
- package/src/extensions/arrows/Arrows.js +1 -0
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
stroke-linecap: butt;
|
|
35
35
|
opacity: 0.4;
|
|
36
36
|
}
|
|
37
|
-
.cm-chessboard .arrow-
|
|
38
|
-
fill:
|
|
37
|
+
.cm-chessboard .arrow-secondary .arrow-head {
|
|
38
|
+
fill: #666;
|
|
39
39
|
fill-rule: nonzero;
|
|
40
40
|
}
|
|
41
|
-
.cm-chessboard .arrow-
|
|
42
|
-
stroke:
|
|
43
|
-
stroke-linecap:
|
|
41
|
+
.cm-chessboard .arrow-secondary .arrow-line {
|
|
42
|
+
stroke: #666;
|
|
43
|
+
stroke-linecap: butt;
|
|
44
44
|
opacity: 0.5;
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -43,14 +43,14 @@
|
|
|
43
43
|
opacity: 0.4;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
.arrow-
|
|
46
|
+
.arrow-secondary {
|
|
47
47
|
.arrow-head {
|
|
48
|
-
fill:
|
|
48
|
+
fill: #666;
|
|
49
49
|
fill-rule: nonzero;
|
|
50
50
|
}
|
|
51
51
|
.arrow-line {
|
|
52
|
-
stroke:
|
|
53
|
-
stroke-linecap:
|
|
52
|
+
stroke: #666;
|
|
53
|
+
stroke-linecap: butt;
|
|
54
54
|
opacity: 0.5;
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -55,6 +55,7 @@ console.log(chessboard.getArrows())
|
|
|
55
55
|
chessboard.addArrow(ARROW_TYPE.info, "b8", "c6")
|
|
56
56
|
chessboard.addArrow(ARROW_TYPE.success, "d2", "d3")
|
|
57
57
|
chessboard.addArrow(ARROW_TYPE.warning, "g5", "e6")
|
|
58
|
+
chessboard.addArrow(ARROW_TYPE.secondary, "a1", "c3")
|
|
58
59
|
console.log(chessboard.getArrows())
|
|
59
60
|
|
|
60
61
|
</script>
|
|
@@ -23,12 +23,19 @@
|
|
|
23
23
|
import {Chessboard, COLOR, INPUT_EVENT_TYPE} from "../../src/Chessboard.js"
|
|
24
24
|
import {PromotionDialog} from "../../src/extensions/promotion-dialog/PromotionDialog.js"
|
|
25
25
|
import {Markers} from "../../src/extensions/markers/Markers.js"
|
|
26
|
+
import {Accessibility} from "../../src/extensions/accessibility/Accessibility.js"
|
|
26
27
|
|
|
27
28
|
const position = "4k3/1P6/8/8/6r1/8/8/2R1K3 w - - 0 1"
|
|
28
29
|
const chessboard = new Chessboard(document.getElementById("chessboard"), {
|
|
29
30
|
position: position,
|
|
30
31
|
assetsUrl: "../../assets/",
|
|
31
|
-
extensions: [{class: PromotionDialog}, {class: Markers}
|
|
32
|
+
extensions: [{class: PromotionDialog}, {class: Markers}, {class: Accessibility, props: {
|
|
33
|
+
brailleNotationInAlt: true, // show the braille notation of the game in the alt attribute of the SVG
|
|
34
|
+
boardAsTable: true, // display the board additionally as HTML table
|
|
35
|
+
movePieceForm: true, // display a form to move a piece (from, to, move)
|
|
36
|
+
piecesAsList: true, // display the pieces additionally as List
|
|
37
|
+
visuallyHidden: true // hide all those extra outputs visually but keep them accessible for screen readers and braille displays
|
|
38
|
+
}}]
|
|
32
39
|
})
|
|
33
40
|
chessboard.enableMoveInput((event) => {
|
|
34
41
|
if (event.type === INPUT_EVENT_TYPE.validateMoveInput) {
|
package/index.html
CHANGED
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
<li><a href="examples/extensions/arrows-extension.html">Arrows extension</a></li>
|
|
43
43
|
</ul>
|
|
44
44
|
</li>
|
|
45
|
-
<li>Draw HTML over the board with <a href="examples/extensions/html-layer-extension.html">HTML Layer extension</a></li>
|
|
46
|
-
<li>Allow displaying a promotion dialog with <a href="examples/extensions/promotion-dialog-extension.html">PromotionDialog extension</a></li>
|
|
47
|
-
<li>Make the board accessible
|
|
45
|
+
<li>Draw HTML over the board with the <a href="examples/extensions/html-layer-extension.html">HTML Layer extension</a></li>
|
|
46
|
+
<li>Allow displaying a promotion dialog with the <a href="examples/extensions/promotion-dialog-extension.html">PromotionDialog extension</a></li>
|
|
47
|
+
<li>Make the board accessible, add screen-reader support with the <a href="examples/extensions/accessibility-extension.html">Accessibility extension</a></li>
|
|
48
48
|
</ul>
|
|
49
49
|
</div>
|
|
50
50
|
<h2>Chessboard</h2>
|
package/package.json
CHANGED
|
@@ -11,6 +11,7 @@ import {Utils} from "../../lib/Utils.js"
|
|
|
11
11
|
export const ARROW_TYPE = {
|
|
12
12
|
default: {class: "arrow-success"},
|
|
13
13
|
success: {class: "arrow-success"},
|
|
14
|
+
secondary: {class: "arrow-secondary"},
|
|
14
15
|
warning: {class: "arrow-warning"},
|
|
15
16
|
info: {class: "arrow-info"},
|
|
16
17
|
danger: {class: "arrow-danger"}
|