gigaboard 1.3.1 → 1.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 +28 -8
- package/dist/chunk-35HQL3AK.js +19 -0
- package/dist/chunk-35HQL3AK.js.map +1 -0
- package/dist/chunk-375XPUCQ.js +18 -0
- package/dist/chunk-375XPUCQ.js.map +1 -0
- package/dist/chunk-3DEOTW2M.js +16 -0
- package/dist/chunk-3DEOTW2M.js.map +1 -0
- package/dist/chunk-3UFHYHMR.js +16 -0
- package/dist/chunk-3UFHYHMR.js.map +1 -0
- package/dist/chunk-52DIWDSX.js +18 -0
- package/dist/chunk-52DIWDSX.js.map +1 -0
- package/dist/chunk-5OGPVD4R.cjs +18 -0
- package/dist/chunk-5OGPVD4R.cjs.map +1 -0
- package/dist/chunk-6S6THNZP.js +24 -0
- package/dist/chunk-6S6THNZP.js.map +1 -0
- package/dist/chunk-6ZEPUUY5.cjs +18 -0
- package/dist/chunk-6ZEPUUY5.cjs.map +1 -0
- package/dist/chunk-76PL52EB.cjs +21 -0
- package/dist/chunk-76PL52EB.cjs.map +1 -0
- package/dist/chunk-A3HBH676.cjs +20 -0
- package/dist/chunk-A3HBH676.cjs.map +1 -0
- package/dist/chunk-AWNSXENI.js +18 -0
- package/dist/chunk-AWNSXENI.js.map +1 -0
- package/dist/{chunk-GYVBIZKI.js → chunk-BB54XFHQ.js} +3 -3
- package/dist/{chunk-GYVBIZKI.js.map → chunk-BB54XFHQ.js.map} +1 -1
- package/dist/chunk-CMV3NVR3.cjs +18 -0
- package/dist/chunk-CMV3NVR3.cjs.map +1 -0
- package/dist/{chunk-I4BQGFP5.cjs → chunk-D45G3J5E.cjs} +8 -2
- package/dist/chunk-D45G3J5E.cjs.map +1 -0
- package/dist/{chunk-CXDGJMYL.js → chunk-EJUGH25P.js} +8 -2
- package/dist/chunk-EJUGH25P.js.map +1 -0
- package/dist/{chunk-BFMVMUTU.cjs → chunk-ENYRJ4Q2.cjs} +3 -3
- package/dist/{chunk-BFMVMUTU.cjs.map → chunk-ENYRJ4Q2.cjs.map} +1 -1
- package/dist/chunk-EWAHJSTZ.js +18 -0
- package/dist/chunk-EWAHJSTZ.js.map +1 -0
- package/dist/chunk-F2QTCQXE.cjs +20 -0
- package/dist/chunk-F2QTCQXE.cjs.map +1 -0
- package/dist/chunk-FACLRSNS.js +16 -0
- package/dist/chunk-FACLRSNS.js.map +1 -0
- package/dist/chunk-FICI4AMA.cjs +24 -0
- package/dist/chunk-FICI4AMA.cjs.map +1 -0
- package/dist/chunk-FW54YBHD.cjs +23 -0
- package/dist/chunk-FW54YBHD.cjs.map +1 -0
- package/dist/chunk-HL6YTFI6.js +18 -0
- package/dist/chunk-HL6YTFI6.js.map +1 -0
- package/dist/chunk-JHWYLKFQ.cjs +23 -0
- package/dist/chunk-JHWYLKFQ.cjs.map +1 -0
- package/dist/chunk-KYPCPATQ.js +21 -0
- package/dist/chunk-KYPCPATQ.js.map +1 -0
- package/dist/chunk-LIC3EXRR.cjs +20 -0
- package/dist/chunk-LIC3EXRR.cjs.map +1 -0
- package/dist/chunk-M6NSGIVF.cjs +24 -0
- package/dist/chunk-M6NSGIVF.cjs.map +1 -0
- package/dist/chunk-MDBGFL5S.js +22 -0
- package/dist/chunk-MDBGFL5S.js.map +1 -0
- package/dist/chunk-NB62E57G.js +21 -0
- package/dist/chunk-NB62E57G.js.map +1 -0
- package/dist/chunk-QIIIL4BN.cjs +20 -0
- package/dist/chunk-QIIIL4BN.cjs.map +1 -0
- package/dist/chunk-RNC76LWZ.js +16 -0
- package/dist/chunk-RNC76LWZ.js.map +1 -0
- package/dist/chunk-TUO6GFCZ.cjs +20 -0
- package/dist/chunk-TUO6GFCZ.cjs.map +1 -0
- package/dist/chunk-UERUICKB.cjs +20 -0
- package/dist/chunk-UERUICKB.cjs.map +1 -0
- package/dist/chunk-UF32KQA3.cjs +18 -0
- package/dist/chunk-UF32KQA3.cjs.map +1 -0
- package/dist/chunk-W5WAATJ7.js +22 -0
- package/dist/chunk-W5WAATJ7.js.map +1 -0
- package/dist/chunk-WD7Y2RDG.js +16 -0
- package/dist/chunk-WD7Y2RDG.js.map +1 -0
- package/dist/chunk-WNFJK4HA.js +16 -0
- package/dist/chunk-WNFJK4HA.js.map +1 -0
- package/dist/chunk-XQO7TG53.cjs +18 -0
- package/dist/chunk-XQO7TG53.cjs.map +1 -0
- package/dist/chunk-XQW5XTYT.js +18 -0
- package/dist/chunk-XQW5XTYT.js.map +1 -0
- package/dist/chunk-ZB2G3XMO.cjs +18 -0
- package/dist/chunk-ZB2G3XMO.cjs.map +1 -0
- package/dist/chunk-ZZQ5FPWF.cjs +26 -0
- package/dist/chunk-ZZQ5FPWF.cjs.map +1 -0
- 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 +89 -73
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +29 -13
- 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/server.cjs +15 -8
- package/dist/server.cjs.map +1 -1
- package/dist/server.js +10 -3
- package/dist/server.js.map +1 -1
- package/dist/themes/blue.d.cts +255 -3
- package/dist/themes/blue.d.ts +255 -3
- package/dist/themes/cafeCreme.cjs +12 -0
- package/dist/themes/cafeCreme.cjs.map +1 -0
- package/dist/themes/cafeCreme.d.cts +1 -0
- package/dist/themes/cafeCreme.d.ts +1 -0
- package/dist/themes/cafeCreme.js +3 -0
- package/dist/themes/cafeCreme.js.map +1 -0
- package/dist/themes/canvas.cjs +12 -0
- package/dist/themes/canvas.cjs.map +1 -0
- package/dist/themes/canvas.d.cts +1 -0
- package/dist/themes/canvas.d.ts +1 -0
- package/dist/themes/canvas.js +3 -0
- package/dist/themes/canvas.js.map +1 -0
- package/dist/themes/chesscomBlue.cjs +12 -0
- package/dist/themes/chesscomBlue.cjs.map +1 -0
- package/dist/themes/chesscomBlue.d.cts +1 -0
- package/dist/themes/chesscomBlue.d.ts +1 -0
- package/dist/themes/chesscomBlue.js +3 -0
- package/dist/themes/chesscomBlue.js.map +1 -0
- package/dist/themes/chesscomGreen.cjs +12 -0
- package/dist/themes/chesscomGreen.cjs.map +1 -0
- package/dist/themes/chesscomGreen.d.cts +1 -0
- package/dist/themes/chesscomGreen.d.ts +1 -0
- package/dist/themes/chesscomGreen.js +3 -0
- package/dist/themes/chesscomGreen.js.map +1 -0
- package/dist/themes/darkWood.cjs +12 -0
- package/dist/themes/darkWood.cjs.map +1 -0
- package/dist/themes/darkWood.d.cts +1 -0
- package/dist/themes/darkWood.d.ts +1 -0
- package/dist/themes/darkWood.js +3 -0
- package/dist/themes/darkWood.js.map +1 -0
- package/dist/themes/deuteranopia.cjs +12 -0
- package/dist/themes/deuteranopia.cjs.map +1 -0
- package/dist/themes/deuteranopia.d.cts +1 -0
- package/dist/themes/deuteranopia.d.ts +1 -0
- package/dist/themes/deuteranopia.js +3 -0
- package/dist/themes/deuteranopia.js.map +1 -0
- package/dist/themes/espresso.cjs +12 -0
- package/dist/themes/espresso.cjs.map +1 -0
- package/dist/themes/espresso.d.cts +1 -0
- package/dist/themes/espresso.d.ts +1 -0
- package/dist/themes/espresso.js +3 -0
- package/dist/themes/espresso.js.map +1 -0
- package/dist/themes/green.d.cts +1 -1
- package/dist/themes/green.d.ts +1 -1
- package/dist/themes/highContrast.cjs +12 -0
- package/dist/themes/highContrast.cjs.map +1 -0
- package/dist/themes/highContrast.d.cts +1 -0
- package/dist/themes/highContrast.d.ts +1 -0
- package/dist/themes/highContrast.js +3 -0
- package/dist/themes/highContrast.js.map +1 -0
- package/dist/themes/ic.cjs +12 -0
- package/dist/themes/ic.cjs.map +1 -0
- package/dist/themes/ic.d.cts +1 -0
- package/dist/themes/ic.d.ts +1 -0
- package/dist/themes/ic.js +3 -0
- package/dist/themes/ic.js.map +1 -0
- package/dist/themes/leather.cjs +12 -0
- package/dist/themes/leather.cjs.map +1 -0
- package/dist/themes/leather.d.cts +1 -0
- package/dist/themes/leather.d.ts +1 -0
- package/dist/themes/leather.js +3 -0
- package/dist/themes/leather.js.map +1 -0
- package/dist/themes/marble.cjs +12 -0
- package/dist/themes/marble.cjs.map +1 -0
- package/dist/themes/marble.d.cts +1 -0
- package/dist/themes/marble.d.ts +1 -0
- package/dist/themes/marble.js +3 -0
- package/dist/themes/marble.js.map +1 -0
- package/dist/themes/neon.cjs +12 -0
- package/dist/themes/neon.cjs.map +1 -0
- package/dist/themes/neon.d.cts +1 -0
- package/dist/themes/neon.d.ts +1 -0
- package/dist/themes/neon.js +3 -0
- package/dist/themes/neon.js.map +1 -0
- package/dist/themes/newspaper.cjs +12 -0
- package/dist/themes/newspaper.cjs.map +1 -0
- package/dist/themes/newspaper.d.cts +1 -0
- package/dist/themes/newspaper.d.ts +1 -0
- package/dist/themes/newspaper.js +3 -0
- package/dist/themes/newspaper.js.map +1 -0
- package/dist/themes/olive.cjs +12 -0
- package/dist/themes/olive.cjs.map +1 -0
- package/dist/themes/olive.d.cts +1 -0
- package/dist/themes/olive.d.ts +1 -0
- package/dist/themes/olive.js +3 -0
- package/dist/themes/olive.js.map +1 -0
- package/dist/themes/pink.cjs +12 -0
- package/dist/themes/pink.cjs.map +1 -0
- package/dist/themes/pink.d.cts +1 -0
- package/dist/themes/pink.d.ts +1 -0
- package/dist/themes/pink.js +3 -0
- package/dist/themes/pink.js.map +1 -0
- package/dist/themes/purple.cjs +12 -0
- package/dist/themes/purple.cjs.map +1 -0
- package/dist/themes/purple.d.cts +1 -0
- package/dist/themes/purple.d.ts +1 -0
- package/dist/themes/purple.js +3 -0
- package/dist/themes/purple.js.map +1 -0
- package/dist/themes/tritanopia.cjs +12 -0
- package/dist/themes/tritanopia.cjs.map +1 -0
- package/dist/themes/tritanopia.d.cts +1 -0
- package/dist/themes/tritanopia.d.ts +1 -0
- package/dist/themes/tritanopia.js +3 -0
- package/dist/themes/tritanopia.js.map +1 -0
- package/dist/themes/walnut.cjs +12 -0
- package/dist/themes/walnut.cjs.map +1 -0
- package/dist/themes/walnut.d.cts +1 -0
- package/dist/themes/walnut.d.ts +1 -0
- package/dist/themes/walnut.js +3 -0
- package/dist/themes/walnut.js.map +1 -0
- package/dist/themes/wood.d.cts +1 -1
- package/dist/themes/wood.d.ts +1 -1
- package/dist/themes.cjs +116 -8
- package/dist/themes.cjs.map +1 -1
- package/dist/themes.d.cts +1 -1
- package/dist/themes.d.ts +1 -1
- package/dist/themes.js +60 -6
- package/dist/themes.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-CXDGJMYL.js.map +0 -1
- package/dist/chunk-I4BQGFP5.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkENYRJ4Q2_cjs = require('./chunk-ENYRJ4Q2.cjs');
|
|
4
|
+
var chunkD45G3J5E_cjs = require('./chunk-D45G3J5E.cjs');
|
|
5
5
|
require('./chunk-G6ZFOJZR.cjs');
|
|
6
6
|
require('./chunk-AYVQCHSG.cjs');
|
|
7
7
|
require('./chunk-FNRS6YJI.cjs');
|
|
@@ -362,9 +362,12 @@ function SquareImpl({
|
|
|
362
362
|
style: {
|
|
363
363
|
position: "relative",
|
|
364
364
|
// `backgroundColor` (not the `background` shorthand) so the
|
|
365
|
-
// CSS `background-image` set by `useSelectionController`
|
|
366
|
-
// layer on top without clobbering this base colour.
|
|
367
|
-
backgroundColor: `var(${isLight ?
|
|
365
|
+
// CSS `background-image` set by `useSelectionController` (or pseudo-elements)
|
|
366
|
+
// can layer on top without clobbering this base colour.
|
|
367
|
+
backgroundColor: `var(${isLight ? chunkD45G3J5E_cjs.CSS_VARS.SQ_LIGHT : chunkD45G3J5E_cjs.CSS_VARS.SQ_DARK})`,
|
|
368
|
+
backgroundImage: `var(${isLight ? chunkD45G3J5E_cjs.CSS_VARS.SQ_LIGHT_IMAGE : chunkD45G3J5E_cjs.CSS_VARS.SQ_DARK_IMAGE},none)`,
|
|
369
|
+
backgroundSize: `var(${chunkD45G3J5E_cjs.CSS_VARS.SQ_IMAGE_SIZE},cover)`,
|
|
370
|
+
backgroundBlendMode: `var(${chunkD45G3J5E_cjs.CSS_VARS.SQ_BLEND_MODE},normal)`,
|
|
368
371
|
// Cursor is managed by `useCursorController` via injected CSS so
|
|
369
372
|
// it can flip between `pointer` / `grab` / `grabbing` without a
|
|
370
373
|
// React re-render per hover.
|
|
@@ -482,7 +485,7 @@ function CheckLayerInner({ model, orientation }) {
|
|
|
482
485
|
top: `${y}%`,
|
|
483
486
|
width: "12.5%",
|
|
484
487
|
height: "12.5%",
|
|
485
|
-
background: `var(${
|
|
488
|
+
background: `var(${chunkD45G3J5E_cjs.CSS_VARS.CHECK})`,
|
|
486
489
|
pointerEvents: "none",
|
|
487
490
|
zIndex: 2
|
|
488
491
|
}
|
|
@@ -516,7 +519,7 @@ function Coordinates({ orientation, ranksPosition = "left" }) {
|
|
|
516
519
|
position: "absolute",
|
|
517
520
|
left: `${col * 12.5 + 10}%`,
|
|
518
521
|
bottom: "1%",
|
|
519
|
-
color: `var(${isLightSquare ?
|
|
522
|
+
color: `var(${isLightSquare ? chunkD45G3J5E_cjs.CSS_VARS.COORDINATE_LIGHT : chunkD45G3J5E_cjs.CSS_VARS.COORDINATE_DARK})`
|
|
520
523
|
},
|
|
521
524
|
children: letter
|
|
522
525
|
},
|
|
@@ -536,7 +539,7 @@ function Coordinates({ orientation, ranksPosition = "left" }) {
|
|
|
536
539
|
position: "absolute",
|
|
537
540
|
top: `${row * 12.5 + 1}%`,
|
|
538
541
|
...sideStyle,
|
|
539
|
-
color: `var(${isLightSquare ?
|
|
542
|
+
color: `var(${isLightSquare ? chunkD45G3J5E_cjs.CSS_VARS.COORDINATE_LIGHT : chunkD45G3J5E_cjs.CSS_VARS.COORDINATE_DARK})`
|
|
540
543
|
},
|
|
541
544
|
children: rank + 1
|
|
542
545
|
},
|
|
@@ -581,7 +584,10 @@ var DragLayer = react.forwardRef(function DragLayer2({ pieces }, ref) {
|
|
|
581
584
|
slotRefs.current[cell] = el;
|
|
582
585
|
},
|
|
583
586
|
"data-drag-cell": cell,
|
|
584
|
-
style:
|
|
587
|
+
style: {
|
|
588
|
+
...SLOT_STYLE,
|
|
589
|
+
filter: `var(${cell <= 6 ? chunkD45G3J5E_cjs.CSS_VARS.PIECE_FILTER_WHITE : chunkD45G3J5E_cjs.CSS_VARS.PIECE_FILTER_BLACK}, none)`
|
|
590
|
+
},
|
|
585
591
|
children: child
|
|
586
592
|
},
|
|
587
593
|
cell
|
|
@@ -678,7 +684,7 @@ function IllegalFlashLayer({ at, orientation }) {
|
|
|
678
684
|
top: `${y}%`,
|
|
679
685
|
width: "12.5%",
|
|
680
686
|
height: "12.5%",
|
|
681
|
-
background:
|
|
687
|
+
background: chunkD45G3J5E_cjs.DEFAULT_ILLEGAL_FLASH_TINT,
|
|
682
688
|
opacity: 0,
|
|
683
689
|
pointerEvents: "none",
|
|
684
690
|
zIndex: 5
|
|
@@ -713,7 +719,7 @@ function pieceName(cell) {
|
|
|
713
719
|
}
|
|
714
720
|
}
|
|
715
721
|
function announcementFor(lastMove, board, wasCapture) {
|
|
716
|
-
const { from, to, kind, promotion } =
|
|
722
|
+
const { from, to, kind, promotion } = chunkENYRJ4Q2_cjs.decodePackedMove(lastMove);
|
|
717
723
|
if (kind === "castle") {
|
|
718
724
|
const isKingside = (to & 7) > (from & 7);
|
|
719
725
|
return isKingside ? "Castles kingside." : "Castles queenside.";
|
|
@@ -798,7 +804,12 @@ function PieceSlotImpl({ index, model, orientation, pieces }) {
|
|
|
798
804
|
{
|
|
799
805
|
"data-piece-square": algebraicOf3(index),
|
|
800
806
|
"data-piece-cell": cell,
|
|
801
|
-
style: {
|
|
807
|
+
style: {
|
|
808
|
+
...SLOT_BASE_STYLE,
|
|
809
|
+
gridColumnStart: col,
|
|
810
|
+
gridRowStart: row,
|
|
811
|
+
filter: `var(${cell <= 6 ? chunkD45G3J5E_cjs.CSS_VARS.PIECE_FILTER_WHITE : chunkD45G3J5E_cjs.CSS_VARS.PIECE_FILTER_BLACK}, none)`
|
|
812
|
+
},
|
|
802
813
|
children: pieces({ cell, square: index })
|
|
803
814
|
}
|
|
804
815
|
);
|
|
@@ -884,7 +895,7 @@ function PremoveLayerInner({ model, orientation, pieces, from, to }) {
|
|
|
884
895
|
top: `${origin.y}%`,
|
|
885
896
|
width: "12.5%",
|
|
886
897
|
height: "12.5%",
|
|
887
|
-
background:
|
|
898
|
+
background: chunkD45G3J5E_cjs.DEFAULT_PREMOVE_TINT,
|
|
888
899
|
opacity: 0.5
|
|
889
900
|
}
|
|
890
901
|
}
|
|
@@ -898,7 +909,7 @@ function PremoveLayerInner({ model, orientation, pieces, from, to }) {
|
|
|
898
909
|
top: `${target.y}%`,
|
|
899
910
|
width: "12.5%",
|
|
900
911
|
height: "12.5%",
|
|
901
|
-
background:
|
|
912
|
+
background: chunkD45G3J5E_cjs.DEFAULT_PREMOVE_TINT
|
|
902
913
|
}
|
|
903
914
|
}
|
|
904
915
|
),
|
|
@@ -933,20 +944,20 @@ function positionOf4(index, orientation) {
|
|
|
933
944
|
return { x: col * 12.5, y: row * 12.5 };
|
|
934
945
|
}
|
|
935
946
|
var CHOICE_ORDER = [
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
947
|
+
chunkENYRJ4Q2_cjs.PieceType.Queen,
|
|
948
|
+
chunkENYRJ4Q2_cjs.PieceType.Knight,
|
|
949
|
+
chunkENYRJ4Q2_cjs.PieceType.Rook,
|
|
950
|
+
chunkENYRJ4Q2_cjs.PieceType.Bishop
|
|
940
951
|
];
|
|
941
952
|
var SHORTCUTS = {
|
|
942
|
-
q:
|
|
943
|
-
r:
|
|
944
|
-
b:
|
|
945
|
-
n:
|
|
946
|
-
Q:
|
|
947
|
-
R:
|
|
948
|
-
B:
|
|
949
|
-
N:
|
|
953
|
+
q: chunkENYRJ4Q2_cjs.PieceType.Queen,
|
|
954
|
+
r: chunkENYRJ4Q2_cjs.PieceType.Rook,
|
|
955
|
+
b: chunkENYRJ4Q2_cjs.PieceType.Bishop,
|
|
956
|
+
n: chunkENYRJ4Q2_cjs.PieceType.Knight,
|
|
957
|
+
Q: chunkENYRJ4Q2_cjs.PieceType.Queen,
|
|
958
|
+
R: chunkENYRJ4Q2_cjs.PieceType.Rook,
|
|
959
|
+
B: chunkENYRJ4Q2_cjs.PieceType.Bishop,
|
|
960
|
+
N: chunkENYRJ4Q2_cjs.PieceType.Knight
|
|
950
961
|
};
|
|
951
962
|
function PromotionOverlay({
|
|
952
963
|
from: _from,
|
|
@@ -964,7 +975,7 @@ function PromotionOverlay({
|
|
|
964
975
|
[getPromotionPieceAriaLabel, color]
|
|
965
976
|
);
|
|
966
977
|
const [activeAnnouncement, setActiveAnnouncement] = react.useState(
|
|
967
|
-
() => getLabel(CHOICE_ORDER[0] ??
|
|
978
|
+
() => getLabel(CHOICE_ORDER[0] ?? chunkENYRJ4Q2_cjs.PieceType.Queen)
|
|
968
979
|
);
|
|
969
980
|
react.useEffect(() => {
|
|
970
981
|
buttonRefs.current[0]?.focus();
|
|
@@ -979,7 +990,7 @@ function PromotionOverlay({
|
|
|
979
990
|
if (e.key === "Tab") {
|
|
980
991
|
e.preventDefault();
|
|
981
992
|
const activeEl = document.activeElement;
|
|
982
|
-
const currentIdx = buttonRefs.current.
|
|
993
|
+
const currentIdx = buttonRefs.current.indexOf(activeEl);
|
|
983
994
|
let nextIdx;
|
|
984
995
|
if (e.shiftKey) {
|
|
985
996
|
nextIdx = currentIdx <= 0 ? buttonRefs.current.length - 1 : currentIdx - 1;
|
|
@@ -992,7 +1003,7 @@ function PromotionOverlay({
|
|
|
992
1003
|
if (e.key === "ArrowDown" || e.key === "ArrowRight") {
|
|
993
1004
|
e.preventDefault();
|
|
994
1005
|
const activeEl = document.activeElement;
|
|
995
|
-
const currentIdx = buttonRefs.current.
|
|
1006
|
+
const currentIdx = buttonRefs.current.indexOf(activeEl);
|
|
996
1007
|
const nextIdx = currentIdx < 0 ? 0 : (currentIdx + 1) % CHOICE_ORDER.length;
|
|
997
1008
|
buttonRefs.current[nextIdx]?.focus();
|
|
998
1009
|
return;
|
|
@@ -1000,7 +1011,7 @@ function PromotionOverlay({
|
|
|
1000
1011
|
if (e.key === "ArrowUp" || e.key === "ArrowLeft") {
|
|
1001
1012
|
e.preventDefault();
|
|
1002
1013
|
const activeEl = document.activeElement;
|
|
1003
|
-
const currentIdx = buttonRefs.current.
|
|
1014
|
+
const currentIdx = buttonRefs.current.indexOf(activeEl);
|
|
1004
1015
|
const prevIdx = currentIdx <= 0 ? CHOICE_ORDER.length - 1 : currentIdx - 1;
|
|
1005
1016
|
buttonRefs.current[prevIdx]?.focus();
|
|
1006
1017
|
return;
|
|
@@ -1062,7 +1073,7 @@ function PromotionOverlay({
|
|
|
1062
1073
|
overflow: "hidden"
|
|
1063
1074
|
},
|
|
1064
1075
|
children: CHOICE_ORDER.map((piece, index) => {
|
|
1065
|
-
const cell =
|
|
1076
|
+
const cell = chunkENYRJ4Q2_cjs.encodeBoardCell(color, piece);
|
|
1066
1077
|
const label = getLabel(piece);
|
|
1067
1078
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1068
1079
|
"button",
|
|
@@ -1114,13 +1125,13 @@ var srOnlyStyle2 = {
|
|
|
1114
1125
|
};
|
|
1115
1126
|
function pieceName2(t) {
|
|
1116
1127
|
switch (t) {
|
|
1117
|
-
case
|
|
1128
|
+
case chunkENYRJ4Q2_cjs.PieceType.Queen:
|
|
1118
1129
|
return "Queen";
|
|
1119
|
-
case
|
|
1130
|
+
case chunkENYRJ4Q2_cjs.PieceType.Rook:
|
|
1120
1131
|
return "Rook";
|
|
1121
|
-
case
|
|
1132
|
+
case chunkENYRJ4Q2_cjs.PieceType.Bishop:
|
|
1122
1133
|
return "Bishop";
|
|
1123
|
-
case
|
|
1134
|
+
case chunkENYRJ4Q2_cjs.PieceType.Knight:
|
|
1124
1135
|
return "Knight";
|
|
1125
1136
|
default:
|
|
1126
1137
|
return "Piece";
|
|
@@ -1144,7 +1155,12 @@ function StaticPieceLayer({ board, orientation, pieces }) {
|
|
|
1144
1155
|
{
|
|
1145
1156
|
"data-piece-square": algebraicOf3(index),
|
|
1146
1157
|
"data-piece-cell": cell,
|
|
1147
|
-
style: {
|
|
1158
|
+
style: {
|
|
1159
|
+
...SLOT_BASE_STYLE,
|
|
1160
|
+
gridColumnStart: col,
|
|
1161
|
+
gridRowStart: row,
|
|
1162
|
+
filter: `var(${cell <= 6 ? chunkD45G3J5E_cjs.CSS_VARS.PIECE_FILTER_WHITE : chunkD45G3J5E_cjs.CSS_VARS.PIECE_FILTER_BLACK}, none)`
|
|
1163
|
+
},
|
|
1148
1164
|
children: pieces({ cell, square: index })
|
|
1149
1165
|
},
|
|
1150
1166
|
i
|
|
@@ -1395,7 +1411,7 @@ function useArrowGesture(options) {
|
|
|
1395
1411
|
function wouldPromote(fromCell, toIndex) {
|
|
1396
1412
|
if (fromCell === 0) return false;
|
|
1397
1413
|
const pieceType = (fromCell - 1) % 6;
|
|
1398
|
-
if (pieceType !==
|
|
1414
|
+
if (pieceType !== chunkENYRJ4Q2_cjs.PieceType.Pawn) return false;
|
|
1399
1415
|
const toRank = toIndex >> 3;
|
|
1400
1416
|
return toRank === 0 || toRank === 7;
|
|
1401
1417
|
}
|
|
@@ -1406,7 +1422,7 @@ function useClickToMove(model, onMove, onPromotionNeeded, enabled = true) {
|
|
|
1406
1422
|
if (model === null) return;
|
|
1407
1423
|
const snap = model.getSnapshot();
|
|
1408
1424
|
const cell = snap.board[index] ?? 0;
|
|
1409
|
-
const pieceColour = cell === 0 ? -1 : cell > 6 ?
|
|
1425
|
+
const pieceColour = cell === 0 ? -1 : cell > 6 ? chunkENYRJ4Q2_cjs.Color.Black : chunkENYRJ4Q2_cjs.Color.White;
|
|
1410
1426
|
if (snap.selected === null) {
|
|
1411
1427
|
if (pieceColour === snap.turn) model.selectSquare(index);
|
|
1412
1428
|
return;
|
|
@@ -1422,7 +1438,7 @@ function useClickToMove(model, onMove, onPromotionNeeded, enabled = true) {
|
|
|
1422
1438
|
onPromotionNeeded(snap.selected, index);
|
|
1423
1439
|
return;
|
|
1424
1440
|
}
|
|
1425
|
-
const played2 = model.tryMove(snap.selected, index,
|
|
1441
|
+
const played2 = model.tryMove(snap.selected, index, chunkENYRJ4Q2_cjs.PieceType.Queen);
|
|
1426
1442
|
if (played2 !== null && onMove !== void 0) onMove(played2);
|
|
1427
1443
|
return;
|
|
1428
1444
|
}
|
|
@@ -1534,7 +1550,7 @@ function useCursorController(model, containerRef, allowDrag, allowPremove) {
|
|
|
1534
1550
|
};
|
|
1535
1551
|
}, [model, containerRef, allowDrag, allowPremove]);
|
|
1536
1552
|
}
|
|
1537
|
-
var GHOST_OPACITY_VAR =
|
|
1553
|
+
var GHOST_OPACITY_VAR = chunkD45G3J5E_cjs.CSS_VARS.DRAG_GHOST_OPACITY;
|
|
1538
1554
|
function useDrag(options) {
|
|
1539
1555
|
const {
|
|
1540
1556
|
game,
|
|
@@ -1556,7 +1572,7 @@ function useDrag(options) {
|
|
|
1556
1572
|
if (!enabled) return;
|
|
1557
1573
|
const container = containerRef.current;
|
|
1558
1574
|
if (container === null || game === null) return;
|
|
1559
|
-
const controller =
|
|
1575
|
+
const controller = chunkENYRJ4Q2_cjs.createDragController(
|
|
1560
1576
|
activationDistance === void 0 ? {} : { activationDistance }
|
|
1561
1577
|
);
|
|
1562
1578
|
let originEl = null;
|
|
@@ -2334,7 +2350,7 @@ function parseTransitionMove(transition) {
|
|
|
2334
2350
|
};
|
|
2335
2351
|
}
|
|
2336
2352
|
function isPawn(cell) {
|
|
2337
|
-
return !
|
|
2353
|
+
return !chunkENYRJ4Q2_cjs.isEmptyCell(cell) && chunkENYRJ4Q2_cjs.pieceTypeOf(cell) === 0;
|
|
2338
2354
|
}
|
|
2339
2355
|
function controlledFeedbackDescriptors(transition, previousBoard, nextBoard) {
|
|
2340
2356
|
if (transition === null || transition === void 0) return null;
|
|
@@ -2343,25 +2359,25 @@ function controlledFeedbackDescriptors(transition, previousBoard, nextBoard) {
|
|
|
2343
2359
|
const before = transition.direction === "forward" ? previousBoard : nextBoard;
|
|
2344
2360
|
const after = transition.direction === "forward" ? nextBoard : previousBoard;
|
|
2345
2361
|
const movingPiece = before[parsed.from] ?? 0;
|
|
2346
|
-
if (
|
|
2362
|
+
if (chunkENYRJ4Q2_cjs.isEmptyCell(movingPiece)) return null;
|
|
2347
2363
|
const fromFile = parsed.from & 7;
|
|
2348
2364
|
const toFile = parsed.to & 7;
|
|
2349
2365
|
const targetBefore = before[parsed.to] ?? 0;
|
|
2350
2366
|
const targetAfter = after[parsed.to] ?? 0;
|
|
2351
|
-
if (
|
|
2367
|
+
if (chunkENYRJ4Q2_cjs.pieceTypeOf(movingPiece) === 5 && Math.abs(toFile - fromFile) === 2) {
|
|
2352
2368
|
return [{ kind: "castle" }];
|
|
2353
2369
|
}
|
|
2354
|
-
if (parsed.promotion !== null || isPawn(movingPiece) && (parsed.to >> 3 === 0 || parsed.to >> 3 === 7) && !
|
|
2370
|
+
if (parsed.promotion !== null || isPawn(movingPiece) && (parsed.to >> 3 === 0 || parsed.to >> 3 === 7) && !chunkENYRJ4Q2_cjs.isEmptyCell(targetAfter) && chunkENYRJ4Q2_cjs.pieceTypeOf(targetAfter) !== 0) {
|
|
2355
2371
|
return [{ kind: "promotion" }];
|
|
2356
2372
|
}
|
|
2357
|
-
if (!
|
|
2373
|
+
if (!chunkENYRJ4Q2_cjs.isEmptyCell(targetBefore) && chunkENYRJ4Q2_cjs.colorOf(targetBefore) !== chunkENYRJ4Q2_cjs.colorOf(movingPiece)) {
|
|
2358
2374
|
return [{ kind: "capture" }];
|
|
2359
2375
|
}
|
|
2360
|
-
if (isPawn(movingPiece) && fromFile !== toFile &&
|
|
2376
|
+
if (isPawn(movingPiece) && fromFile !== toFile && chunkENYRJ4Q2_cjs.isEmptyCell(targetBefore)) {
|
|
2361
2377
|
const capturedSquare = parsed.from & -8 | toFile;
|
|
2362
2378
|
const capturedBefore = before[capturedSquare] ?? 0;
|
|
2363
2379
|
const capturedAfter = after[capturedSquare] ?? 0;
|
|
2364
|
-
if (!
|
|
2380
|
+
if (!chunkENYRJ4Q2_cjs.isEmptyCell(capturedBefore) && chunkENYRJ4Q2_cjs.colorOf(capturedBefore) !== chunkENYRJ4Q2_cjs.colorOf(movingPiece) && chunkENYRJ4Q2_cjs.isEmptyCell(capturedAfter)) {
|
|
2365
2381
|
return [{ kind: "en-passant" }];
|
|
2366
2382
|
}
|
|
2367
2383
|
}
|
|
@@ -2429,8 +2445,8 @@ function Chessboard(props) {
|
|
|
2429
2445
|
managedArrows,
|
|
2430
2446
|
preserveUserArrowsOnPositionSync,
|
|
2431
2447
|
orientation = "white",
|
|
2432
|
-
theme =
|
|
2433
|
-
pieces =
|
|
2448
|
+
theme = chunkD45G3J5E_cjs.defaultTheme,
|
|
2449
|
+
pieces = chunkD45G3J5E_cjs.defaultPieces,
|
|
2434
2450
|
showCoordinates = true,
|
|
2435
2451
|
ranksPosition = "left",
|
|
2436
2452
|
showLegalTargets = "rings",
|
|
@@ -2469,7 +2485,7 @@ function Chessboard(props) {
|
|
|
2469
2485
|
const fallbackBoard = react.useMemo(() => {
|
|
2470
2486
|
if (fallbackFen === void 0 || fallbackFen === "") return null;
|
|
2471
2487
|
try {
|
|
2472
|
-
return
|
|
2488
|
+
return chunkD45G3J5E_cjs.parseFenPlacement(fallbackFen);
|
|
2473
2489
|
} catch {
|
|
2474
2490
|
return null;
|
|
2475
2491
|
}
|
|
@@ -2547,10 +2563,10 @@ function Chessboard(props) {
|
|
|
2547
2563
|
]);
|
|
2548
2564
|
const palette = react.useMemo(() => {
|
|
2549
2565
|
const merged = {
|
|
2550
|
-
default:
|
|
2551
|
-
shift:
|
|
2552
|
-
alt:
|
|
2553
|
-
ctrl:
|
|
2566
|
+
default: chunkD45G3J5E_cjs.defaultArrowColors.default,
|
|
2567
|
+
shift: chunkD45G3J5E_cjs.defaultArrowColors.shift,
|
|
2568
|
+
alt: chunkD45G3J5E_cjs.defaultArrowColors.alt,
|
|
2569
|
+
ctrl: chunkD45G3J5E_cjs.defaultArrowColors.ctrl
|
|
2554
2570
|
};
|
|
2555
2571
|
if (arrowColors !== void 0) {
|
|
2556
2572
|
for (const k in arrowColors) {
|
|
@@ -2868,15 +2884,15 @@ function useChessGame(options = {}) {
|
|
|
2868
2884
|
const { fen, ...modelOptions } = options;
|
|
2869
2885
|
const [initialModelOptions] = react.useState(() => modelOptions);
|
|
2870
2886
|
const [model, setModel] = react.useState(() => {
|
|
2871
|
-
const adapter =
|
|
2872
|
-
return
|
|
2887
|
+
const adapter = chunkENYRJ4Q2_cjs.createGigachessAdapter(fen);
|
|
2888
|
+
return chunkENYRJ4Q2_cjs.createBoardModel(adapter, modelOptions);
|
|
2873
2889
|
});
|
|
2874
2890
|
const prevFenRef = react.useRef(fen);
|
|
2875
2891
|
react.useEffect(() => {
|
|
2876
2892
|
if (prevFenRef.current !== fen) {
|
|
2877
2893
|
prevFenRef.current = fen;
|
|
2878
|
-
const adapter =
|
|
2879
|
-
const nextModel =
|
|
2894
|
+
const adapter = chunkENYRJ4Q2_cjs.createGigachessAdapter(fen);
|
|
2895
|
+
const nextModel = chunkENYRJ4Q2_cjs.createBoardModel(adapter, initialModelOptions);
|
|
2880
2896
|
setModel((prev) => {
|
|
2881
2897
|
prev.dispose();
|
|
2882
2898
|
return nextModel;
|
|
@@ -2892,59 +2908,59 @@ function useChessGame(options = {}) {
|
|
|
2892
2908
|
}
|
|
2893
2909
|
|
|
2894
2910
|
// src/index.ts
|
|
2895
|
-
var PACKAGE_VERSION = "1.3.
|
|
2911
|
+
var PACKAGE_VERSION = "1.3.3";
|
|
2896
2912
|
|
|
2897
2913
|
Object.defineProperty(exports, "Color", {
|
|
2898
2914
|
enumerable: true,
|
|
2899
|
-
get: function () { return
|
|
2915
|
+
get: function () { return chunkENYRJ4Q2_cjs.Color; }
|
|
2900
2916
|
});
|
|
2901
2917
|
Object.defineProperty(exports, "PieceType", {
|
|
2902
2918
|
enumerable: true,
|
|
2903
|
-
get: function () { return
|
|
2919
|
+
get: function () { return chunkENYRJ4Q2_cjs.PieceType; }
|
|
2904
2920
|
});
|
|
2905
2921
|
Object.defineProperty(exports, "createBoardModel", {
|
|
2906
2922
|
enumerable: true,
|
|
2907
|
-
get: function () { return
|
|
2923
|
+
get: function () { return chunkENYRJ4Q2_cjs.createBoardModel; }
|
|
2908
2924
|
});
|
|
2909
2925
|
Object.defineProperty(exports, "createGigachessAdapter", {
|
|
2910
2926
|
enumerable: true,
|
|
2911
|
-
get: function () { return
|
|
2927
|
+
get: function () { return chunkENYRJ4Q2_cjs.createGigachessAdapter; }
|
|
2912
2928
|
});
|
|
2913
2929
|
Object.defineProperty(exports, "packMove", {
|
|
2914
2930
|
enumerable: true,
|
|
2915
|
-
get: function () { return
|
|
2931
|
+
get: function () { return chunkENYRJ4Q2_cjs.packMove; }
|
|
2916
2932
|
});
|
|
2917
2933
|
Object.defineProperty(exports, "preloadGigachessAdapter", {
|
|
2918
2934
|
enumerable: true,
|
|
2919
|
-
get: function () { return
|
|
2935
|
+
get: function () { return chunkENYRJ4Q2_cjs.preloadGigachessAdapter; }
|
|
2920
2936
|
});
|
|
2921
2937
|
Object.defineProperty(exports, "unpackMove", {
|
|
2922
2938
|
enumerable: true,
|
|
2923
|
-
get: function () { return
|
|
2939
|
+
get: function () { return chunkENYRJ4Q2_cjs.unpackMove; }
|
|
2924
2940
|
});
|
|
2925
2941
|
Object.defineProperty(exports, "CSS_VARS", {
|
|
2926
2942
|
enumerable: true,
|
|
2927
|
-
get: function () { return
|
|
2943
|
+
get: function () { return chunkD45G3J5E_cjs.CSS_VARS; }
|
|
2928
2944
|
});
|
|
2929
2945
|
Object.defineProperty(exports, "DEFAULT_ILLEGAL_FLASH_TINT", {
|
|
2930
2946
|
enumerable: true,
|
|
2931
|
-
get: function () { return
|
|
2947
|
+
get: function () { return chunkD45G3J5E_cjs.DEFAULT_ILLEGAL_FLASH_TINT; }
|
|
2932
2948
|
});
|
|
2933
2949
|
Object.defineProperty(exports, "DEFAULT_PREMOVE_TINT", {
|
|
2934
2950
|
enumerable: true,
|
|
2935
|
-
get: function () { return
|
|
2951
|
+
get: function () { return chunkD45G3J5E_cjs.DEFAULT_PREMOVE_TINT; }
|
|
2936
2952
|
});
|
|
2937
2953
|
Object.defineProperty(exports, "defaultArrowColors", {
|
|
2938
2954
|
enumerable: true,
|
|
2939
|
-
get: function () { return
|
|
2955
|
+
get: function () { return chunkD45G3J5E_cjs.defaultArrowColors; }
|
|
2940
2956
|
});
|
|
2941
2957
|
Object.defineProperty(exports, "defaultPieces", {
|
|
2942
2958
|
enumerable: true,
|
|
2943
|
-
get: function () { return
|
|
2959
|
+
get: function () { return chunkD45G3J5E_cjs.defaultPieces; }
|
|
2944
2960
|
});
|
|
2945
2961
|
Object.defineProperty(exports, "defaultTheme", {
|
|
2946
2962
|
enumerable: true,
|
|
2947
|
-
get: function () { return
|
|
2963
|
+
get: function () { return chunkD45G3J5E_cjs.defaultTheme; }
|
|
2948
2964
|
});
|
|
2949
2965
|
exports.AnimationRunner = AnimationRunner;
|
|
2950
2966
|
exports.Chessboard = Chessboard;
|