gigaboard 1.2.3 → 1.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.
- package/dist/{chunk-J6GGNP5S.js → chunk-ANUAGER2.js} +3 -3
- package/dist/{chunk-J6GGNP5S.js.map → chunk-ANUAGER2.js.map} +1 -1
- package/dist/{chunk-UUTEFNFO.cjs → chunk-E7NSAFSC.cjs} +3 -3
- package/dist/{chunk-UUTEFNFO.cjs.map → chunk-E7NSAFSC.cjs.map} +1 -1
- package/dist/core.cjs +44 -44
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/index.cjs +43 -43
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/pieces.cjs +1 -1
- package/dist/pieces.cjs.map +1 -1
- package/dist/pieces.d.cts +1 -1
- package/dist/pieces.d.ts +1 -1
- package/dist/pieces.js +1 -1
- package/dist/pieces.js.map +1 -1
- package/dist/themes/blue.d.cts +1 -1
- package/dist/themes/blue.d.ts +1 -1
- package/dist/themes.cjs +1 -1
- package/dist/themes.cjs.map +1 -1
- package/dist/themes.js +1 -1
- package/dist/themes.js.map +1 -1
- package/package.json +1 -1
package/dist/core.cjs
CHANGED
|
@@ -1,180 +1,180 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkE7NSAFSC_cjs = require('./chunk-E7NSAFSC.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "BOARD_CELL_BB", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkE7NSAFSC_cjs.BOARD_CELL_BB; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "BOARD_CELL_BK", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkE7NSAFSC_cjs.BOARD_CELL_BK; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "BOARD_CELL_BN", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkE7NSAFSC_cjs.BOARD_CELL_BN; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "BOARD_CELL_BP", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkE7NSAFSC_cjs.BOARD_CELL_BP; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "BOARD_CELL_BQ", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkE7NSAFSC_cjs.BOARD_CELL_BQ; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "BOARD_CELL_BR", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkE7NSAFSC_cjs.BOARD_CELL_BR; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "BOARD_CELL_EMPTY", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunkE7NSAFSC_cjs.BOARD_CELL_EMPTY; }
|
|
34
34
|
});
|
|
35
35
|
Object.defineProperty(exports, "BOARD_CELL_WB", {
|
|
36
36
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunkE7NSAFSC_cjs.BOARD_CELL_WB; }
|
|
38
38
|
});
|
|
39
39
|
Object.defineProperty(exports, "BOARD_CELL_WK", {
|
|
40
40
|
enumerable: true,
|
|
41
|
-
get: function () { return
|
|
41
|
+
get: function () { return chunkE7NSAFSC_cjs.BOARD_CELL_WK; }
|
|
42
42
|
});
|
|
43
43
|
Object.defineProperty(exports, "BOARD_CELL_WN", {
|
|
44
44
|
enumerable: true,
|
|
45
|
-
get: function () { return
|
|
45
|
+
get: function () { return chunkE7NSAFSC_cjs.BOARD_CELL_WN; }
|
|
46
46
|
});
|
|
47
47
|
Object.defineProperty(exports, "BOARD_CELL_WP", {
|
|
48
48
|
enumerable: true,
|
|
49
|
-
get: function () { return
|
|
49
|
+
get: function () { return chunkE7NSAFSC_cjs.BOARD_CELL_WP; }
|
|
50
50
|
});
|
|
51
51
|
Object.defineProperty(exports, "BOARD_CELL_WQ", {
|
|
52
52
|
enumerable: true,
|
|
53
|
-
get: function () { return
|
|
53
|
+
get: function () { return chunkE7NSAFSC_cjs.BOARD_CELL_WQ; }
|
|
54
54
|
});
|
|
55
55
|
Object.defineProperty(exports, "BOARD_CELL_WR", {
|
|
56
56
|
enumerable: true,
|
|
57
|
-
get: function () { return
|
|
57
|
+
get: function () { return chunkE7NSAFSC_cjs.BOARD_CELL_WR; }
|
|
58
58
|
});
|
|
59
59
|
Object.defineProperty(exports, "Color", {
|
|
60
60
|
enumerable: true,
|
|
61
|
-
get: function () { return
|
|
61
|
+
get: function () { return chunkE7NSAFSC_cjs.Color; }
|
|
62
62
|
});
|
|
63
63
|
Object.defineProperty(exports, "MOVE2_PROMO_BISHOP", {
|
|
64
64
|
enumerable: true,
|
|
65
|
-
get: function () { return
|
|
65
|
+
get: function () { return chunkE7NSAFSC_cjs.MOVE2_PROMO_BISHOP; }
|
|
66
66
|
});
|
|
67
67
|
Object.defineProperty(exports, "MOVE2_PROMO_KNIGHT", {
|
|
68
68
|
enumerable: true,
|
|
69
|
-
get: function () { return
|
|
69
|
+
get: function () { return chunkE7NSAFSC_cjs.MOVE2_PROMO_KNIGHT; }
|
|
70
70
|
});
|
|
71
71
|
Object.defineProperty(exports, "MOVE2_PROMO_NONE", {
|
|
72
72
|
enumerable: true,
|
|
73
|
-
get: function () { return
|
|
73
|
+
get: function () { return chunkE7NSAFSC_cjs.MOVE2_PROMO_NONE; }
|
|
74
74
|
});
|
|
75
75
|
Object.defineProperty(exports, "MOVE2_PROMO_QUEEN", {
|
|
76
76
|
enumerable: true,
|
|
77
|
-
get: function () { return
|
|
77
|
+
get: function () { return chunkE7NSAFSC_cjs.MOVE2_PROMO_QUEEN; }
|
|
78
78
|
});
|
|
79
79
|
Object.defineProperty(exports, "MOVE2_PROMO_ROOK", {
|
|
80
80
|
enumerable: true,
|
|
81
|
-
get: function () { return
|
|
81
|
+
get: function () { return chunkE7NSAFSC_cjs.MOVE2_PROMO_ROOK; }
|
|
82
82
|
});
|
|
83
83
|
Object.defineProperty(exports, "PACKAGE_VERSION", {
|
|
84
84
|
enumerable: true,
|
|
85
|
-
get: function () { return
|
|
85
|
+
get: function () { return chunkE7NSAFSC_cjs.PACKAGE_VERSION; }
|
|
86
86
|
});
|
|
87
87
|
Object.defineProperty(exports, "PieceType", {
|
|
88
88
|
enumerable: true,
|
|
89
|
-
get: function () { return
|
|
89
|
+
get: function () { return chunkE7NSAFSC_cjs.PieceType; }
|
|
90
90
|
});
|
|
91
91
|
Object.defineProperty(exports, "animationInspect", {
|
|
92
92
|
enumerable: true,
|
|
93
|
-
get: function () { return
|
|
93
|
+
get: function () { return chunkE7NSAFSC_cjs.animationInspect; }
|
|
94
94
|
});
|
|
95
95
|
Object.defineProperty(exports, "colorOf", {
|
|
96
96
|
enumerable: true,
|
|
97
|
-
get: function () { return
|
|
97
|
+
get: function () { return chunkE7NSAFSC_cjs.colorOf; }
|
|
98
98
|
});
|
|
99
99
|
Object.defineProperty(exports, "createArrowModel", {
|
|
100
100
|
enumerable: true,
|
|
101
|
-
get: function () { return
|
|
101
|
+
get: function () { return chunkE7NSAFSC_cjs.createArrowModel; }
|
|
102
102
|
});
|
|
103
103
|
Object.defineProperty(exports, "createBoardModel", {
|
|
104
104
|
enumerable: true,
|
|
105
|
-
get: function () { return
|
|
105
|
+
get: function () { return chunkE7NSAFSC_cjs.createBoardModel; }
|
|
106
106
|
});
|
|
107
107
|
Object.defineProperty(exports, "createBoardStore", {
|
|
108
108
|
enumerable: true,
|
|
109
|
-
get: function () { return
|
|
109
|
+
get: function () { return chunkE7NSAFSC_cjs.createBoardStore; }
|
|
110
110
|
});
|
|
111
111
|
Object.defineProperty(exports, "createDragController", {
|
|
112
112
|
enumerable: true,
|
|
113
|
-
get: function () { return
|
|
113
|
+
get: function () { return chunkE7NSAFSC_cjs.createDragController; }
|
|
114
114
|
});
|
|
115
115
|
Object.defineProperty(exports, "createGigachessAdapter", {
|
|
116
116
|
enumerable: true,
|
|
117
|
-
get: function () { return
|
|
117
|
+
get: function () { return chunkE7NSAFSC_cjs.createGigachessAdapter; }
|
|
118
118
|
});
|
|
119
119
|
Object.defineProperty(exports, "createLegalMoveIndex", {
|
|
120
120
|
enumerable: true,
|
|
121
|
-
get: function () { return
|
|
121
|
+
get: function () { return chunkE7NSAFSC_cjs.createLegalMoveIndex; }
|
|
122
122
|
});
|
|
123
123
|
Object.defineProperty(exports, "createPremoveBuffer", {
|
|
124
124
|
enumerable: true,
|
|
125
|
-
get: function () { return
|
|
125
|
+
get: function () { return chunkE7NSAFSC_cjs.createPremoveBuffer; }
|
|
126
126
|
});
|
|
127
127
|
Object.defineProperty(exports, "decodePackedMove", {
|
|
128
128
|
enumerable: true,
|
|
129
|
-
get: function () { return
|
|
129
|
+
get: function () { return chunkE7NSAFSC_cjs.decodePackedMove; }
|
|
130
130
|
});
|
|
131
131
|
Object.defineProperty(exports, "encodeBoardCell", {
|
|
132
132
|
enumerable: true,
|
|
133
|
-
get: function () { return
|
|
133
|
+
get: function () { return chunkE7NSAFSC_cjs.encodeBoardCell; }
|
|
134
134
|
});
|
|
135
135
|
Object.defineProperty(exports, "isEmptyCell", {
|
|
136
136
|
enumerable: true,
|
|
137
|
-
get: function () { return
|
|
137
|
+
get: function () { return chunkE7NSAFSC_cjs.isEmptyCell; }
|
|
138
138
|
});
|
|
139
139
|
Object.defineProperty(exports, "isSquareIndex", {
|
|
140
140
|
enumerable: true,
|
|
141
|
-
get: function () { return
|
|
141
|
+
get: function () { return chunkE7NSAFSC_cjs.isSquareIndex; }
|
|
142
142
|
});
|
|
143
143
|
Object.defineProperty(exports, "makeArrow", {
|
|
144
144
|
enumerable: true,
|
|
145
|
-
get: function () { return
|
|
145
|
+
get: function () { return chunkE7NSAFSC_cjs.makeArrow; }
|
|
146
146
|
});
|
|
147
147
|
Object.defineProperty(exports, "makePremove", {
|
|
148
148
|
enumerable: true,
|
|
149
|
-
get: function () { return
|
|
149
|
+
get: function () { return chunkE7NSAFSC_cjs.makePremove; }
|
|
150
150
|
});
|
|
151
151
|
Object.defineProperty(exports, "packMove", {
|
|
152
152
|
enumerable: true,
|
|
153
|
-
get: function () { return
|
|
153
|
+
get: function () { return chunkE7NSAFSC_cjs.packMove; }
|
|
154
154
|
});
|
|
155
155
|
Object.defineProperty(exports, "pieceTypeOf", {
|
|
156
156
|
enumerable: true,
|
|
157
|
-
get: function () { return
|
|
157
|
+
get: function () { return chunkE7NSAFSC_cjs.pieceTypeOf; }
|
|
158
158
|
});
|
|
159
159
|
Object.defineProperty(exports, "planAnimations", {
|
|
160
160
|
enumerable: true,
|
|
161
|
-
get: function () { return
|
|
161
|
+
get: function () { return chunkE7NSAFSC_cjs.planAnimations; }
|
|
162
162
|
});
|
|
163
163
|
Object.defineProperty(exports, "preloadGigachessAdapter", {
|
|
164
164
|
enumerable: true,
|
|
165
|
-
get: function () { return
|
|
165
|
+
get: function () { return chunkE7NSAFSC_cjs.preloadGigachessAdapter; }
|
|
166
166
|
});
|
|
167
167
|
Object.defineProperty(exports, "toSquareIndex", {
|
|
168
168
|
enumerable: true,
|
|
169
|
-
get: function () { return
|
|
169
|
+
get: function () { return chunkE7NSAFSC_cjs.toSquareIndex; }
|
|
170
170
|
});
|
|
171
171
|
Object.defineProperty(exports, "unpackMove", {
|
|
172
172
|
enumerable: true,
|
|
173
|
-
get: function () { return
|
|
173
|
+
get: function () { return chunkE7NSAFSC_cjs.unpackMove; }
|
|
174
174
|
});
|
|
175
175
|
Object.defineProperty(exports, "writeBoardCell", {
|
|
176
176
|
enumerable: true,
|
|
177
|
-
get: function () { return
|
|
177
|
+
get: function () { return chunkE7NSAFSC_cjs.writeBoardCell; }
|
|
178
178
|
});
|
|
179
179
|
//# sourceMappingURL=core.cjs.map
|
|
180
180
|
//# sourceMappingURL=core.cjs.map
|
package/dist/core.d.cts
CHANGED
|
@@ -159,6 +159,6 @@ declare function makePremove(from: SquareIndex, to: SquareIndex, promotion?: Pie
|
|
|
159
159
|
*/
|
|
160
160
|
|
|
161
161
|
/** Package version. Baked in at build time by the consumer's bundler. */
|
|
162
|
-
declare const PACKAGE_VERSION = "
|
|
162
|
+
declare const PACKAGE_VERSION = "1.3.0";
|
|
163
163
|
|
|
164
164
|
export { AnimDescriptor, Arrow, type ArrowModel, PACKAGE_VERSION, PackedMove, PieceType, Premove, type PremoveBuffer, SquareIndex, animationInspect, colorOf, createArrowModel, createPremoveBuffer, decodePackedMove, makeArrow, makePremove, pieceTypeOf, planAnimations };
|
package/dist/core.d.ts
CHANGED
|
@@ -159,6 +159,6 @@ declare function makePremove(from: SquareIndex, to: SquareIndex, promotion?: Pie
|
|
|
159
159
|
*/
|
|
160
160
|
|
|
161
161
|
/** Package version. Baked in at build time by the consumer's bundler. */
|
|
162
|
-
declare const PACKAGE_VERSION = "
|
|
162
|
+
declare const PACKAGE_VERSION = "1.3.0";
|
|
163
163
|
|
|
164
164
|
export { AnimDescriptor, Arrow, type ArrowModel, PACKAGE_VERSION, PackedMove, PieceType, Premove, type PremoveBuffer, SquareIndex, animationInspect, colorOf, createArrowModel, createPremoveBuffer, decodePackedMove, makeArrow, makePremove, pieceTypeOf, planAnimations };
|
package/dist/core.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { BOARD_CELL_BB, BOARD_CELL_BK, BOARD_CELL_BN, BOARD_CELL_BP, BOARD_CELL_BQ, BOARD_CELL_BR, BOARD_CELL_EMPTY, BOARD_CELL_WB, BOARD_CELL_WK, BOARD_CELL_WN, BOARD_CELL_WP, BOARD_CELL_WQ, BOARD_CELL_WR, Color, MOVE2_PROMO_BISHOP, MOVE2_PROMO_KNIGHT, MOVE2_PROMO_NONE, MOVE2_PROMO_QUEEN, MOVE2_PROMO_ROOK, PACKAGE_VERSION, PieceType, animationInspect, colorOf, createArrowModel, createBoardModel, createBoardStore, createDragController, createGigachessAdapter, createLegalMoveIndex, createPremoveBuffer, decodePackedMove, encodeBoardCell, isEmptyCell, isSquareIndex, makeArrow, makePremove, packMove, pieceTypeOf, planAnimations, preloadGigachessAdapter, toSquareIndex, unpackMove, writeBoardCell } from './chunk-
|
|
1
|
+
export { BOARD_CELL_BB, BOARD_CELL_BK, BOARD_CELL_BN, BOARD_CELL_BP, BOARD_CELL_BQ, BOARD_CELL_BR, BOARD_CELL_EMPTY, BOARD_CELL_WB, BOARD_CELL_WK, BOARD_CELL_WN, BOARD_CELL_WP, BOARD_CELL_WQ, BOARD_CELL_WR, Color, MOVE2_PROMO_BISHOP, MOVE2_PROMO_KNIGHT, MOVE2_PROMO_NONE, MOVE2_PROMO_QUEEN, MOVE2_PROMO_ROOK, PACKAGE_VERSION, PieceType, animationInspect, colorOf, createArrowModel, createBoardModel, createBoardStore, createDragController, createGigachessAdapter, createLegalMoveIndex, createPremoveBuffer, decodePackedMove, encodeBoardCell, isEmptyCell, isSquareIndex, makeArrow, makePremove, packMove, pieceTypeOf, planAnimations, preloadGigachessAdapter, toSquareIndex, unpackMove, writeBoardCell } from './chunk-ANUAGER2.js';
|
|
2
2
|
//# sourceMappingURL=core.js.map
|
|
3
3
|
//# sourceMappingURL=core.js.map
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkE7NSAFSC_cjs = require('./chunk-E7NSAFSC.cjs');
|
|
4
4
|
var chunkI4BQGFP5_cjs = require('./chunk-I4BQGFP5.cjs');
|
|
5
5
|
require('./chunk-G6ZFOJZR.cjs');
|
|
6
6
|
require('./chunk-AYVQCHSG.cjs');
|
|
@@ -713,7 +713,7 @@ function pieceName(cell) {
|
|
|
713
713
|
}
|
|
714
714
|
}
|
|
715
715
|
function announcementFor(lastMove, board, wasCapture) {
|
|
716
|
-
const { from, to, kind, promotion } =
|
|
716
|
+
const { from, to, kind, promotion } = chunkE7NSAFSC_cjs.decodePackedMove(lastMove);
|
|
717
717
|
if (kind === "castle") {
|
|
718
718
|
const isKingside = (to & 7) > (from & 7);
|
|
719
719
|
return isKingside ? "Castles kingside." : "Castles queenside.";
|
|
@@ -933,20 +933,20 @@ function positionOf4(index, orientation) {
|
|
|
933
933
|
return { x: col * 12.5, y: row * 12.5 };
|
|
934
934
|
}
|
|
935
935
|
var CHOICE_ORDER = [
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
936
|
+
chunkE7NSAFSC_cjs.PieceType.Queen,
|
|
937
|
+
chunkE7NSAFSC_cjs.PieceType.Knight,
|
|
938
|
+
chunkE7NSAFSC_cjs.PieceType.Rook,
|
|
939
|
+
chunkE7NSAFSC_cjs.PieceType.Bishop
|
|
940
940
|
];
|
|
941
941
|
var SHORTCUTS = {
|
|
942
|
-
q:
|
|
943
|
-
r:
|
|
944
|
-
b:
|
|
945
|
-
n:
|
|
946
|
-
Q:
|
|
947
|
-
R:
|
|
948
|
-
B:
|
|
949
|
-
N:
|
|
942
|
+
q: chunkE7NSAFSC_cjs.PieceType.Queen,
|
|
943
|
+
r: chunkE7NSAFSC_cjs.PieceType.Rook,
|
|
944
|
+
b: chunkE7NSAFSC_cjs.PieceType.Bishop,
|
|
945
|
+
n: chunkE7NSAFSC_cjs.PieceType.Knight,
|
|
946
|
+
Q: chunkE7NSAFSC_cjs.PieceType.Queen,
|
|
947
|
+
R: chunkE7NSAFSC_cjs.PieceType.Rook,
|
|
948
|
+
B: chunkE7NSAFSC_cjs.PieceType.Bishop,
|
|
949
|
+
N: chunkE7NSAFSC_cjs.PieceType.Knight
|
|
950
950
|
};
|
|
951
951
|
function PromotionOverlay({
|
|
952
952
|
from: _from,
|
|
@@ -964,7 +964,7 @@ function PromotionOverlay({
|
|
|
964
964
|
[getPromotionPieceAriaLabel, color]
|
|
965
965
|
);
|
|
966
966
|
const [activeAnnouncement, setActiveAnnouncement] = react.useState(
|
|
967
|
-
() => getLabel(CHOICE_ORDER[0] ??
|
|
967
|
+
() => getLabel(CHOICE_ORDER[0] ?? chunkE7NSAFSC_cjs.PieceType.Queen)
|
|
968
968
|
);
|
|
969
969
|
react.useEffect(() => {
|
|
970
970
|
buttonRefs.current[0]?.focus();
|
|
@@ -1062,7 +1062,7 @@ function PromotionOverlay({
|
|
|
1062
1062
|
overflow: "hidden"
|
|
1063
1063
|
},
|
|
1064
1064
|
children: CHOICE_ORDER.map((piece, index) => {
|
|
1065
|
-
const cell =
|
|
1065
|
+
const cell = chunkE7NSAFSC_cjs.encodeBoardCell(color, piece);
|
|
1066
1066
|
const label = getLabel(piece);
|
|
1067
1067
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1068
1068
|
"button",
|
|
@@ -1114,13 +1114,13 @@ var srOnlyStyle2 = {
|
|
|
1114
1114
|
};
|
|
1115
1115
|
function pieceName2(t) {
|
|
1116
1116
|
switch (t) {
|
|
1117
|
-
case
|
|
1117
|
+
case chunkE7NSAFSC_cjs.PieceType.Queen:
|
|
1118
1118
|
return "Queen";
|
|
1119
|
-
case
|
|
1119
|
+
case chunkE7NSAFSC_cjs.PieceType.Rook:
|
|
1120
1120
|
return "Rook";
|
|
1121
|
-
case
|
|
1121
|
+
case chunkE7NSAFSC_cjs.PieceType.Bishop:
|
|
1122
1122
|
return "Bishop";
|
|
1123
|
-
case
|
|
1123
|
+
case chunkE7NSAFSC_cjs.PieceType.Knight:
|
|
1124
1124
|
return "Knight";
|
|
1125
1125
|
default:
|
|
1126
1126
|
return "Piece";
|
|
@@ -1395,7 +1395,7 @@ function useArrowGesture(options) {
|
|
|
1395
1395
|
function wouldPromote(fromCell, toIndex) {
|
|
1396
1396
|
if (fromCell === 0) return false;
|
|
1397
1397
|
const pieceType = (fromCell - 1) % 6;
|
|
1398
|
-
if (pieceType !==
|
|
1398
|
+
if (pieceType !== chunkE7NSAFSC_cjs.PieceType.Pawn) return false;
|
|
1399
1399
|
const toRank = toIndex >> 3;
|
|
1400
1400
|
return toRank === 0 || toRank === 7;
|
|
1401
1401
|
}
|
|
@@ -1406,7 +1406,7 @@ function useClickToMove(model, onMove, onPromotionNeeded, enabled = true) {
|
|
|
1406
1406
|
if (model === null) return;
|
|
1407
1407
|
const snap = model.getSnapshot();
|
|
1408
1408
|
const cell = snap.board[index] ?? 0;
|
|
1409
|
-
const pieceColour = cell === 0 ? -1 : cell > 6 ?
|
|
1409
|
+
const pieceColour = cell === 0 ? -1 : cell > 6 ? chunkE7NSAFSC_cjs.Color.Black : chunkE7NSAFSC_cjs.Color.White;
|
|
1410
1410
|
if (snap.selected === null) {
|
|
1411
1411
|
if (pieceColour === snap.turn) model.selectSquare(index);
|
|
1412
1412
|
return;
|
|
@@ -1422,7 +1422,7 @@ function useClickToMove(model, onMove, onPromotionNeeded, enabled = true) {
|
|
|
1422
1422
|
onPromotionNeeded(snap.selected, index);
|
|
1423
1423
|
return;
|
|
1424
1424
|
}
|
|
1425
|
-
const played2 = model.tryMove(snap.selected, index,
|
|
1425
|
+
const played2 = model.tryMove(snap.selected, index, chunkE7NSAFSC_cjs.PieceType.Queen);
|
|
1426
1426
|
if (played2 !== null && onMove !== void 0) onMove(played2);
|
|
1427
1427
|
return;
|
|
1428
1428
|
}
|
|
@@ -1556,7 +1556,7 @@ function useDrag(options) {
|
|
|
1556
1556
|
if (!enabled) return;
|
|
1557
1557
|
const container = containerRef.current;
|
|
1558
1558
|
if (container === null || game === null) return;
|
|
1559
|
-
const controller =
|
|
1559
|
+
const controller = chunkE7NSAFSC_cjs.createDragController(
|
|
1560
1560
|
activationDistance === void 0 ? {} : { activationDistance }
|
|
1561
1561
|
);
|
|
1562
1562
|
let originEl = null;
|
|
@@ -2334,7 +2334,7 @@ function parseTransitionMove(transition) {
|
|
|
2334
2334
|
};
|
|
2335
2335
|
}
|
|
2336
2336
|
function isPawn(cell) {
|
|
2337
|
-
return !
|
|
2337
|
+
return !chunkE7NSAFSC_cjs.isEmptyCell(cell) && chunkE7NSAFSC_cjs.pieceTypeOf(cell) === 0;
|
|
2338
2338
|
}
|
|
2339
2339
|
function controlledFeedbackDescriptors(transition, previousBoard, nextBoard) {
|
|
2340
2340
|
if (transition === null || transition === void 0) return null;
|
|
@@ -2343,25 +2343,25 @@ function controlledFeedbackDescriptors(transition, previousBoard, nextBoard) {
|
|
|
2343
2343
|
const before = transition.direction === "forward" ? previousBoard : nextBoard;
|
|
2344
2344
|
const after = transition.direction === "forward" ? nextBoard : previousBoard;
|
|
2345
2345
|
const movingPiece = before[parsed.from] ?? 0;
|
|
2346
|
-
if (
|
|
2346
|
+
if (chunkE7NSAFSC_cjs.isEmptyCell(movingPiece)) return null;
|
|
2347
2347
|
const fromFile = parsed.from & 7;
|
|
2348
2348
|
const toFile = parsed.to & 7;
|
|
2349
2349
|
const targetBefore = before[parsed.to] ?? 0;
|
|
2350
2350
|
const targetAfter = after[parsed.to] ?? 0;
|
|
2351
|
-
if (
|
|
2351
|
+
if (chunkE7NSAFSC_cjs.pieceTypeOf(movingPiece) === 5 && Math.abs(toFile - fromFile) === 2) {
|
|
2352
2352
|
return [{ kind: "castle" }];
|
|
2353
2353
|
}
|
|
2354
|
-
if (parsed.promotion !== null || isPawn(movingPiece) && (parsed.to >> 3 === 0 || parsed.to >> 3 === 7) && !
|
|
2354
|
+
if (parsed.promotion !== null || isPawn(movingPiece) && (parsed.to >> 3 === 0 || parsed.to >> 3 === 7) && !chunkE7NSAFSC_cjs.isEmptyCell(targetAfter) && chunkE7NSAFSC_cjs.pieceTypeOf(targetAfter) !== 0) {
|
|
2355
2355
|
return [{ kind: "promotion" }];
|
|
2356
2356
|
}
|
|
2357
|
-
if (!
|
|
2357
|
+
if (!chunkE7NSAFSC_cjs.isEmptyCell(targetBefore) && chunkE7NSAFSC_cjs.colorOf(targetBefore) !== chunkE7NSAFSC_cjs.colorOf(movingPiece)) {
|
|
2358
2358
|
return [{ kind: "capture" }];
|
|
2359
2359
|
}
|
|
2360
|
-
if (isPawn(movingPiece) && fromFile !== toFile &&
|
|
2360
|
+
if (isPawn(movingPiece) && fromFile !== toFile && chunkE7NSAFSC_cjs.isEmptyCell(targetBefore)) {
|
|
2361
2361
|
const capturedSquare = parsed.from & -8 | toFile;
|
|
2362
2362
|
const capturedBefore = before[capturedSquare] ?? 0;
|
|
2363
2363
|
const capturedAfter = after[capturedSquare] ?? 0;
|
|
2364
|
-
if (!
|
|
2364
|
+
if (!chunkE7NSAFSC_cjs.isEmptyCell(capturedBefore) && chunkE7NSAFSC_cjs.colorOf(capturedBefore) !== chunkE7NSAFSC_cjs.colorOf(movingPiece) && chunkE7NSAFSC_cjs.isEmptyCell(capturedAfter)) {
|
|
2365
2365
|
return [{ kind: "en-passant" }];
|
|
2366
2366
|
}
|
|
2367
2367
|
}
|
|
@@ -2868,15 +2868,15 @@ function useChessGame(options = {}) {
|
|
|
2868
2868
|
const { fen, ...modelOptions } = options;
|
|
2869
2869
|
const [initialModelOptions] = react.useState(() => modelOptions);
|
|
2870
2870
|
const [model, setModel] = react.useState(() => {
|
|
2871
|
-
const adapter =
|
|
2872
|
-
return
|
|
2871
|
+
const adapter = chunkE7NSAFSC_cjs.createGigachessAdapter(fen);
|
|
2872
|
+
return chunkE7NSAFSC_cjs.createBoardModel(adapter, modelOptions);
|
|
2873
2873
|
});
|
|
2874
2874
|
const prevFenRef = react.useRef(fen);
|
|
2875
2875
|
react.useEffect(() => {
|
|
2876
2876
|
if (prevFenRef.current !== fen) {
|
|
2877
2877
|
prevFenRef.current = fen;
|
|
2878
|
-
const adapter =
|
|
2879
|
-
const nextModel =
|
|
2878
|
+
const adapter = chunkE7NSAFSC_cjs.createGigachessAdapter(fen);
|
|
2879
|
+
const nextModel = chunkE7NSAFSC_cjs.createBoardModel(adapter, initialModelOptions);
|
|
2880
2880
|
setModel((prev) => {
|
|
2881
2881
|
prev.dispose();
|
|
2882
2882
|
return nextModel;
|
|
@@ -2892,35 +2892,35 @@ function useChessGame(options = {}) {
|
|
|
2892
2892
|
}
|
|
2893
2893
|
|
|
2894
2894
|
// src/index.ts
|
|
2895
|
-
var PACKAGE_VERSION = "
|
|
2895
|
+
var PACKAGE_VERSION = "1.3.0";
|
|
2896
2896
|
|
|
2897
2897
|
Object.defineProperty(exports, "Color", {
|
|
2898
2898
|
enumerable: true,
|
|
2899
|
-
get: function () { return
|
|
2899
|
+
get: function () { return chunkE7NSAFSC_cjs.Color; }
|
|
2900
2900
|
});
|
|
2901
2901
|
Object.defineProperty(exports, "PieceType", {
|
|
2902
2902
|
enumerable: true,
|
|
2903
|
-
get: function () { return
|
|
2903
|
+
get: function () { return chunkE7NSAFSC_cjs.PieceType; }
|
|
2904
2904
|
});
|
|
2905
2905
|
Object.defineProperty(exports, "createBoardModel", {
|
|
2906
2906
|
enumerable: true,
|
|
2907
|
-
get: function () { return
|
|
2907
|
+
get: function () { return chunkE7NSAFSC_cjs.createBoardModel; }
|
|
2908
2908
|
});
|
|
2909
2909
|
Object.defineProperty(exports, "createGigachessAdapter", {
|
|
2910
2910
|
enumerable: true,
|
|
2911
|
-
get: function () { return
|
|
2911
|
+
get: function () { return chunkE7NSAFSC_cjs.createGigachessAdapter; }
|
|
2912
2912
|
});
|
|
2913
2913
|
Object.defineProperty(exports, "packMove", {
|
|
2914
2914
|
enumerable: true,
|
|
2915
|
-
get: function () { return
|
|
2915
|
+
get: function () { return chunkE7NSAFSC_cjs.packMove; }
|
|
2916
2916
|
});
|
|
2917
2917
|
Object.defineProperty(exports, "preloadGigachessAdapter", {
|
|
2918
2918
|
enumerable: true,
|
|
2919
|
-
get: function () { return
|
|
2919
|
+
get: function () { return chunkE7NSAFSC_cjs.preloadGigachessAdapter; }
|
|
2920
2920
|
});
|
|
2921
2921
|
Object.defineProperty(exports, "unpackMove", {
|
|
2922
2922
|
enumerable: true,
|
|
2923
|
-
get: function () { return
|
|
2923
|
+
get: function () { return chunkE7NSAFSC_cjs.unpackMove; }
|
|
2924
2924
|
});
|
|
2925
2925
|
Object.defineProperty(exports, "CSS_VARS", {
|
|
2926
2926
|
enumerable: true,
|