@alepot55/chessboardjs 1.0.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.
- package/chessboard.css +102 -0
- package/chessboard.js +1160 -0
- package/chessboardCDN.js +1160 -0
- package/default_pieces/bb.svg +1 -0
- package/default_pieces/bw.svg +1 -0
- package/default_pieces/kb.svg +1 -0
- package/default_pieces/kw.svg +1 -0
- package/default_pieces/nb.svg +1 -0
- package/default_pieces/nw.svg +1 -0
- package/default_pieces/pb.svg +1 -0
- package/default_pieces/pw.svg +1 -0
- package/default_pieces/qb.svg +1 -0
- package/default_pieces/qw.svg +1 -0
- package/default_pieces/rb.svg +1 -0
- package/default_pieces/rw.svg +1 -0
- package/package.json +27 -0
package/chessboard.css
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--dimBoard: 600px;
|
|
3
|
+
--pieceRatio: 0.9;
|
|
4
|
+
|
|
5
|
+
--blackSquare: #b58863;
|
|
6
|
+
--whiteSquare: #f0d9b5;
|
|
7
|
+
--highlightSquare: yellow;
|
|
8
|
+
--selectedSquareWhite: #ababaa;
|
|
9
|
+
--selectedSquareBlack: #ababaa;
|
|
10
|
+
--movedSquareBlack: #e9e981;
|
|
11
|
+
--movedSquareWhite: #f1f1a0;
|
|
12
|
+
--choiceSquare: white;
|
|
13
|
+
--coverSquare: black;
|
|
14
|
+
--hintColor: #ababaa;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.board {
|
|
18
|
+
display: grid;
|
|
19
|
+
grid-template: repeat(8, 1fr) / repeat(8, 1fr);
|
|
20
|
+
width: var(--dimBoard);
|
|
21
|
+
height: var(--dimBoard);
|
|
22
|
+
border: 1px solid black;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.square {
|
|
26
|
+
width: calc(var(--dimBoard) / 8);
|
|
27
|
+
height: calc(var(--dimBoard) / 8);
|
|
28
|
+
display: flex;
|
|
29
|
+
justify-content: center;
|
|
30
|
+
align-items: center;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.piece {
|
|
34
|
+
position: absolute;
|
|
35
|
+
z-index: 10;
|
|
36
|
+
width: calc(calc(var(--dimBoard) / 8) * var(--pieceRatio));
|
|
37
|
+
height: calc(calc(var(--dimBoard) / 8) * var(--pieceRatio));
|
|
38
|
+
|
|
39
|
+
/* No selection */
|
|
40
|
+
-webkit-user-select: none; /* Safari */
|
|
41
|
+
-moz-user-select: none; /* Firefox */
|
|
42
|
+
-ms-user-select: none; /* IE10+/Edge */
|
|
43
|
+
user-select: none; /* Standard */
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.choicable {
|
|
47
|
+
z-index: 25;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.hint {
|
|
51
|
+
background: var(--hintColor);
|
|
52
|
+
width: calc(calc(var(--dimBoard) / 8) / 3.5);
|
|
53
|
+
height: calc(calc(var(--dimBoard) / 8) / 3.5);
|
|
54
|
+
position: absolute;
|
|
55
|
+
z-index: 5;
|
|
56
|
+
border-radius: 50%;
|
|
57
|
+
opacity: 0.8;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.catchable {
|
|
61
|
+
width: calc(calc(var(--dimBoard) / 8) * 0.9);
|
|
62
|
+
height: calc(calc(var(--dimBoard) / 8) * 0.9);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.blackSquare {
|
|
66
|
+
background: var(--blackSquare);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.whiteSquare {
|
|
70
|
+
background: var(--whiteSquare);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.selectedSquareWhite {
|
|
74
|
+
background: var(--selectedSquareWhite);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.selectedSquareBlack {
|
|
78
|
+
background: var(--selectedSquareBlack);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.movedSquareBlack {
|
|
82
|
+
background: var(--movedSquareBlack);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.movedSquareWhite {
|
|
86
|
+
background: var(--movedSquareWhite);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.choice {
|
|
90
|
+
background: var(--choiceSquare);
|
|
91
|
+
z-index: 20;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.cover {
|
|
95
|
+
background: var(--coverSquare);
|
|
96
|
+
opacity: 0.5;
|
|
97
|
+
z-index: 20;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.highlighted {
|
|
101
|
+
box-shadow: inset 0 0 10px var(--highlightSquare);
|
|
102
|
+
}
|