@scriptonita/chess-football-ui 0.2.1 → 0.4.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-J2TBQPPC.cjs → chunk-LTFNSTAQ.cjs} +6 -36
- package/dist/chunk-LTFNSTAQ.cjs.map +1 -0
- package/dist/{chunk-YLNDQ4HG.js → chunk-N24LGLLO.js} +4 -36
- package/dist/chunk-N24LGLLO.js.map +1 -0
- package/dist/index.cjs +55 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -5
- package/dist/index.d.ts +26 -5
- package/dist/index.js +46 -3
- package/dist/index.js.map +1 -1
- package/dist/store.cjs +3 -3
- package/dist/store.d.cts +3 -6
- package/dist/store.d.ts +3 -6
- package/dist/store.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-J2TBQPPC.cjs.map +0 -1
- package/dist/chunk-YLNDQ4HG.js.map +0 -1
|
@@ -4,39 +4,6 @@ var zustand = require('zustand');
|
|
|
4
4
|
var chessFootballEngine = require('@scriptonita/chess-football-engine');
|
|
5
5
|
|
|
6
6
|
// src/store/use-game-store.ts
|
|
7
|
-
var getInitialBoardState = (servingSide, currentScore = { white: 0, black: 0 }, maxActionPoints = 5) => {
|
|
8
|
-
const pieces = [];
|
|
9
|
-
const addPiece = (type, side, x, y) => {
|
|
10
|
-
pieces.push({ id: `${side}_${type}_${x}_${y}`, type, side, pos: { x, y }, hasMovedThisTurn: false });
|
|
11
|
-
};
|
|
12
|
-
addPiece("rook", "white", 0, 1);
|
|
13
|
-
addPiece("rook", "white", 8, 1);
|
|
14
|
-
addPiece("bishop", "white", 3, 2);
|
|
15
|
-
addPiece("bishop", "white", 5, 2);
|
|
16
|
-
addPiece("king", "white", 4, 1);
|
|
17
|
-
addPiece("queen", "white", 4, 5);
|
|
18
|
-
addPiece("knight", "white", 2, 4);
|
|
19
|
-
addPiece("knight", "white", 6, 4);
|
|
20
|
-
addPiece("rook", "black", 0, 10);
|
|
21
|
-
addPiece("rook", "black", 8, 10);
|
|
22
|
-
addPiece("bishop", "black", 3, 9);
|
|
23
|
-
addPiece("bishop", "black", 5, 9);
|
|
24
|
-
addPiece("king", "black", 4, 10);
|
|
25
|
-
addPiece("queen", "black", 4, 6);
|
|
26
|
-
addPiece("knight", "black", 2, 7);
|
|
27
|
-
addPiece("knight", "black", 6, 7);
|
|
28
|
-
const servingQueen = pieces.find((p) => p.side === servingSide && p.type === "queen");
|
|
29
|
-
return {
|
|
30
|
-
pieces,
|
|
31
|
-
ball: { pos: { ...servingQueen.pos }, holderId: servingQueen.id },
|
|
32
|
-
score: currentScore,
|
|
33
|
-
actionPoints: maxActionPoints,
|
|
34
|
-
maxActionPoints,
|
|
35
|
-
turn: servingSide,
|
|
36
|
-
moveHistory: [],
|
|
37
|
-
turnNumber: 1
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
7
|
var useGameStore = zustand.create((set) => ({
|
|
41
8
|
boardState: null,
|
|
42
9
|
selectedPieceId: null,
|
|
@@ -79,7 +46,10 @@ var useGameStore = zustand.create((set) => ({
|
|
|
79
46
|
})
|
|
80
47
|
}));
|
|
81
48
|
|
|
82
|
-
exports
|
|
49
|
+
Object.defineProperty(exports, "getInitialBoardState", {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
get: function () { return chessFootballEngine.getInitialBoardState; }
|
|
52
|
+
});
|
|
83
53
|
exports.useGameStore = useGameStore;
|
|
84
|
-
//# sourceMappingURL=chunk-
|
|
85
|
-
//# sourceMappingURL=chunk-
|
|
54
|
+
//# sourceMappingURL=chunk-LTFNSTAQ.cjs.map
|
|
55
|
+
//# sourceMappingURL=chunk-LTFNSTAQ.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/store/use-game-store.ts"],"names":["create","applyMove","applyPass","applyEndTurn"],"mappings":";;;;;;AAqBO,IAAM,YAAA,GAAeA,cAAA,CAAkB,CAAC,GAAA,MAAS;AAAA,EACpD,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ess-football-engine'\nimport { applyMove, applyPass, applyEndTurn } from '@scriptonita/chess-football-engine'\n\n// The canonical kickoff position lives in the engine (rules-adjacent). Re-exported\n// here so app imports from `@scriptonita/chess-football-ui/store` keep working.\nexport { getInitialBoardState } from '@scriptonita/chess-football-engine'\n\ninterface GameStore {\n boardState: BoardState | null\n selectedPieceId: string | null\n interactionMode: 'move' | 'pass' | null\n setBoardState: (state: BoardState) => void\n setSelectedPieceId: (id: string | null) => void\n setInteractionMode: (mode: 'move' | 'pass' | null) => void\n resetTurn: () => void\n movePiece: (pieceId: string, to: Position) => void\n passBall: (to: Position) => void\n endTurn: () => void\n}\n\nexport const useGameStore = create<GameStore>((set) => ({\n boardState: null,\n selectedPieceId: null,\n interactionMode: null,\n\n setBoardState: (state) => set({ boardState: state }),\n setSelectedPieceId: (id) => set({ selectedPieceId: id }),\n setInteractionMode: (mode) => set({ interactionMode: mode }),\n\n resetTurn: () => set((state) => {\n if (!state.boardState) return state\n return {\n boardState: {\n ...state.boardState,\n actionPoints: state.boardState.maxActionPoints ?? 5,\n pieces: state.boardState.pieces.map(p => ({ ...p, hasMovedThisTurn: false })),\n },\n }\n }),\n\n movePiece: (pieceId, to) => set((state) => {\n if (!state.boardState || state.boardState.actionPoints <= 0) return state\n const piece = state.boardState.pieces.find(p => p.id === pieceId)\n if (!piece || piece.hasMovedThisTurn) return state\n\n const { boardState } = applyMove(state.boardState, pieceId, to)\n return { boardState, selectedPieceId: null, interactionMode: null }\n }),\n\n passBall: (to) => set((state) => {\n if (!state.boardState || state.boardState.actionPoints <= 0 || !state.boardState.ball.holderId) return state\n const holder = state.boardState.pieces.find(p => p.id === state.boardState!.ball.holderId)\n if (!holder) return state\n\n const { boardState, forcedTurnEnd } = applyPass(state.boardState, to)\n const keepSelection = !forcedTurnEnd && boardState.ball.holderId\n return {\n boardState,\n selectedPieceId: keepSelection ? boardState.ball.holderId : null,\n interactionMode: keepSelection ? 'pass' : null,\n }\n }),\n\n endTurn: () => set((state) => {\n if (!state.boardState) return state\n return { boardState: applyEndTurn(state.boardState) }\n }),\n}))\n"]}
|
|
@@ -1,40 +1,8 @@
|
|
|
1
1
|
import { create } from 'zustand';
|
|
2
2
|
import { applyEndTurn, applyPass, applyMove } from '@scriptonita/chess-football-engine';
|
|
3
|
+
export { getInitialBoardState } from '@scriptonita/chess-football-engine';
|
|
3
4
|
|
|
4
5
|
// src/store/use-game-store.ts
|
|
5
|
-
var getInitialBoardState = (servingSide, currentScore = { white: 0, black: 0 }, maxActionPoints = 5) => {
|
|
6
|
-
const pieces = [];
|
|
7
|
-
const addPiece = (type, side, x, y) => {
|
|
8
|
-
pieces.push({ id: `${side}_${type}_${x}_${y}`, type, side, pos: { x, y }, hasMovedThisTurn: false });
|
|
9
|
-
};
|
|
10
|
-
addPiece("rook", "white", 0, 1);
|
|
11
|
-
addPiece("rook", "white", 8, 1);
|
|
12
|
-
addPiece("bishop", "white", 3, 2);
|
|
13
|
-
addPiece("bishop", "white", 5, 2);
|
|
14
|
-
addPiece("king", "white", 4, 1);
|
|
15
|
-
addPiece("queen", "white", 4, 5);
|
|
16
|
-
addPiece("knight", "white", 2, 4);
|
|
17
|
-
addPiece("knight", "white", 6, 4);
|
|
18
|
-
addPiece("rook", "black", 0, 10);
|
|
19
|
-
addPiece("rook", "black", 8, 10);
|
|
20
|
-
addPiece("bishop", "black", 3, 9);
|
|
21
|
-
addPiece("bishop", "black", 5, 9);
|
|
22
|
-
addPiece("king", "black", 4, 10);
|
|
23
|
-
addPiece("queen", "black", 4, 6);
|
|
24
|
-
addPiece("knight", "black", 2, 7);
|
|
25
|
-
addPiece("knight", "black", 6, 7);
|
|
26
|
-
const servingQueen = pieces.find((p) => p.side === servingSide && p.type === "queen");
|
|
27
|
-
return {
|
|
28
|
-
pieces,
|
|
29
|
-
ball: { pos: { ...servingQueen.pos }, holderId: servingQueen.id },
|
|
30
|
-
score: currentScore,
|
|
31
|
-
actionPoints: maxActionPoints,
|
|
32
|
-
maxActionPoints,
|
|
33
|
-
turn: servingSide,
|
|
34
|
-
moveHistory: [],
|
|
35
|
-
turnNumber: 1
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
6
|
var useGameStore = create((set) => ({
|
|
39
7
|
boardState: null,
|
|
40
8
|
selectedPieceId: null,
|
|
@@ -77,6 +45,6 @@ var useGameStore = create((set) => ({
|
|
|
77
45
|
})
|
|
78
46
|
}));
|
|
79
47
|
|
|
80
|
-
export {
|
|
81
|
-
//# sourceMappingURL=chunk-
|
|
82
|
-
//# sourceMappingURL=chunk-
|
|
48
|
+
export { useGameStore };
|
|
49
|
+
//# sourceMappingURL=chunk-N24LGLLO.js.map
|
|
50
|
+
//# sourceMappingURL=chunk-N24LGLLO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/store/use-game-store.ts"],"names":[],"mappings":";;;;;AAqBO,IAAM,YAAA,GAAe,MAAA,CAAkB,CAAC,GAAA,MAAS;AAAA,EACpD,UAAA,EAAY,IAAA;AAAA,EACZ,eAAA,EAAiB,IAAA;AAAA,EACjB,eAAA,EAAiB,IAAA;AAAA,EAEjB,eAAe,CAAC,KAAA,KAAU,IAAI,EAAE,UAAA,EAAY,OAAO,CAAA;AAAA,EACnD,oBAAoB,CAAC,EAAA,KAAO,IAAI,EAAE,eAAA,EAAiB,IAAI,CAAA;AAAA,EACvD,oBAAoB,CAAC,IAAA,KAAS,IAAI,EAAE,eAAA,EAAiB,MAAM,CAAA;AAAA,EAE3D,SAAA,EAAW,MAAM,GAAA,CAAI,CAAC,KAAA,KAAU;AAC5B,IAAA,IAAI,CAAC,KAAA,CAAM,UAAA,EAAY,OAAO,KAAA;AAC9B,IAAA,OAAO;AAAA,MACH,UAAA,EAAY;AAAA,QACR,GAAG,KAAA,CAAM,UAAA;AAAA,QACT,YAAA,EAAc,KAAA,CAAM,UAAA,CAAW,eAAA,IAAmB,CAAA;AAAA,QAClD,MAAA,EAAQ,KAAA,CAAM,UAAA,CAAW,MAAA,CAAO,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;AACpE,IAAA,MAAM,aAAA,GAAgB,CAAC,aAAA,IAAiB,UAAA,CAAW,IAAA,CAAK,QAAA;AACxD,IAAA,OAAO;AAAA,MACH,UAAA;AAAA,MACA,eAAA,EAAiB,aAAA,GAAgB,UAAA,CAAW,IAAA,CAAK,QAAA,GAAW,IAAA;AAAA,MAC5D,eAAA,EAAiB,gBAAgB,MAAA,GAAS;AAAA,KAC9C;AAAA,EACJ,CAAC,CAAA;AAAA,EAED,OAAA,EAAS,MAAM,GAAA,CAAI,CAAC,KAAA,KAAU;AAC1B,IAAA,IAAI,CAAC,KAAA,CAAM,UAAA,EAAY,OAAO,KAAA;AAC9B,IAAA,OAAO,EAAE,UAAA,EAAY,YAAA,CAAa,KAAA,CAAM,UAAU,CAAA,EAAE;AAAA,EACxD,CAAC;AACL,CAAA,CAAE","file":"chunk-N24LGLLO.js","sourcesContent":["import { create } from 'zustand'\nimport type { BoardState, Position } from '@scriptonita/chess-football-engine'\nimport { applyMove, applyPass, applyEndTurn } from '@scriptonita/chess-football-engine'\n\n// The canonical kickoff position lives in the engine (rules-adjacent). Re-exported\n// here so app imports from `@scriptonita/chess-football-ui/store` keep working.\nexport { getInitialBoardState } from '@scriptonita/chess-football-engine'\n\ninterface GameStore {\n boardState: BoardState | null\n selectedPieceId: string | null\n interactionMode: 'move' | 'pass' | null\n setBoardState: (state: BoardState) => void\n setSelectedPieceId: (id: string | null) => void\n setInteractionMode: (mode: 'move' | 'pass' | null) => void\n resetTurn: () => void\n movePiece: (pieceId: string, to: Position) => void\n passBall: (to: Position) => void\n endTurn: () => void\n}\n\nexport const useGameStore = create<GameStore>((set) => ({\n boardState: null,\n selectedPieceId: null,\n interactionMode: null,\n\n setBoardState: (state) => set({ boardState: state }),\n setSelectedPieceId: (id) => set({ selectedPieceId: id }),\n setInteractionMode: (mode) => set({ interactionMode: mode }),\n\n resetTurn: () => set((state) => {\n if (!state.boardState) return state\n return {\n boardState: {\n ...state.boardState,\n actionPoints: state.boardState.maxActionPoints ?? 5,\n pieces: state.boardState.pieces.map(p => ({ ...p, hasMovedThisTurn: false })),\n },\n }\n }),\n\n movePiece: (pieceId, to) => set((state) => {\n if (!state.boardState || state.boardState.actionPoints <= 0) return state\n const piece = state.boardState.pieces.find(p => p.id === pieceId)\n if (!piece || piece.hasMovedThisTurn) return state\n\n const { boardState } = applyMove(state.boardState, pieceId, to)\n return { boardState, selectedPieceId: null, interactionMode: null }\n }),\n\n passBall: (to) => set((state) => {\n if (!state.boardState || state.boardState.actionPoints <= 0 || !state.boardState.ball.holderId) return state\n const holder = state.boardState.pieces.find(p => p.id === state.boardState!.ball.holderId)\n if (!holder) return state\n\n const { boardState, forcedTurnEnd } = applyPass(state.boardState, to)\n const keepSelection = !forcedTurnEnd && boardState.ball.holderId\n return {\n boardState,\n selectedPieceId: keepSelection ? boardState.ball.holderId : null,\n interactionMode: keepSelection ? 'pass' : null,\n }\n }),\n\n endTurn: () => set((state) => {\n if (!state.boardState) return state\n return { boardState: applyEndTurn(state.boardState) }\n }),\n}))\n"]}
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkLTFNSTAQ_cjs = require('./chunk-LTFNSTAQ.cjs');
|
|
4
4
|
var chessFootballEngine = require('@scriptonita/chess-football-engine');
|
|
5
5
|
var clsx = require('clsx');
|
|
6
6
|
var tailwindMerge = require('tailwind-merge');
|
|
@@ -146,6 +146,49 @@ var Football = ({ className }) => {
|
|
|
146
146
|
}
|
|
147
147
|
);
|
|
148
148
|
};
|
|
149
|
+
var STATIC_I18N_KEYS = [
|
|
150
|
+
"actionPointsAriaLabel",
|
|
151
|
+
"actionPointsShort",
|
|
152
|
+
"endTurn",
|
|
153
|
+
"endTurnConfirm",
|
|
154
|
+
"endTurnConfirmDescription",
|
|
155
|
+
"endTurnConfirmYes",
|
|
156
|
+
"endTurnKeepPlaying",
|
|
157
|
+
"history.empty",
|
|
158
|
+
"history.goal",
|
|
159
|
+
"history.interception",
|
|
160
|
+
"history.move",
|
|
161
|
+
"history.offside",
|
|
162
|
+
"history.pass",
|
|
163
|
+
"history.tackle",
|
|
164
|
+
"history.title",
|
|
165
|
+
"history.turn",
|
|
166
|
+
"history.viewAll",
|
|
167
|
+
"move",
|
|
168
|
+
"offsideWarning",
|
|
169
|
+
"pass",
|
|
170
|
+
"selectedPiece.alreadyMoved",
|
|
171
|
+
"selectedPiece.atSquare",
|
|
172
|
+
"selectedPiece.empty",
|
|
173
|
+
"selectedPiece.hasBall",
|
|
174
|
+
"teamBlack",
|
|
175
|
+
"teamWhite",
|
|
176
|
+
"waitingRival",
|
|
177
|
+
"yourTurn"
|
|
178
|
+
];
|
|
179
|
+
var PIECE_I18N_KEYS = [...Object.values(chessFootballEngine.SHORT_KEY), ...Object.values(chessFootballEngine.LONG_KEY)].map(
|
|
180
|
+
(label) => `pieces.${label}`
|
|
181
|
+
);
|
|
182
|
+
var EVENT_TOAST_I18N_KEYS = [
|
|
183
|
+
"eventToast.interception",
|
|
184
|
+
"eventToast.offside",
|
|
185
|
+
"eventToast.tackle"
|
|
186
|
+
];
|
|
187
|
+
var GAME_I18N_KEYS = [
|
|
188
|
+
...STATIC_I18N_KEYS,
|
|
189
|
+
...PIECE_I18N_KEYS,
|
|
190
|
+
...EVENT_TOAST_I18N_KEYS
|
|
191
|
+
];
|
|
149
192
|
var fallback = (key) => key;
|
|
150
193
|
var GameI18nContext = React.createContext(fallback);
|
|
151
194
|
function GameI18nProvider({ t, children }) {
|
|
@@ -166,7 +209,7 @@ function GameBoard({ userSide, showCoordinates = false, keyboardNav = true }) {
|
|
|
166
209
|
setInteractionMode,
|
|
167
210
|
movePiece,
|
|
168
211
|
passBall
|
|
169
|
-
} =
|
|
212
|
+
} = chunkLTFNSTAQ_cjs.useGameStore();
|
|
170
213
|
const [cursor, setCursor] = React.useState(null);
|
|
171
214
|
const [disambiguateAt, setDisambiguateAt] = React.useState(null);
|
|
172
215
|
const prevBallRef = React.useRef(boardState?.ball);
|
|
@@ -599,7 +642,7 @@ function Scoreboard({
|
|
|
599
642
|
userSide
|
|
600
643
|
}) {
|
|
601
644
|
const t = useGameT();
|
|
602
|
-
const { boardState } =
|
|
645
|
+
const { boardState } = chunkLTFNSTAQ_cjs.useGameStore();
|
|
603
646
|
if (!boardState?.score) return null;
|
|
604
647
|
const { score, turn, actionPoints, kingMustRelease } = boardState;
|
|
605
648
|
const myScore = userSide === "white" ? score.white : score.black;
|
|
@@ -686,7 +729,7 @@ function MiniScoreboard({
|
|
|
686
729
|
className
|
|
687
730
|
}) {
|
|
688
731
|
const t = useGameT();
|
|
689
|
-
const { boardState } =
|
|
732
|
+
const { boardState } = chunkLTFNSTAQ_cjs.useGameStore();
|
|
690
733
|
if (!boardState?.score) return null;
|
|
691
734
|
const { score, turn } = boardState;
|
|
692
735
|
const myScore = userSide === "white" ? score.white : score.black;
|
|
@@ -791,7 +834,7 @@ function GameControls({ isMyTurn }) {
|
|
|
791
834
|
const {
|
|
792
835
|
boardState,
|
|
793
836
|
endTurn
|
|
794
|
-
} =
|
|
837
|
+
} = chunkLTFNSTAQ_cjs.useGameStore();
|
|
795
838
|
const t = useGameT();
|
|
796
839
|
const [showEndTurnConfirm, setShowEndTurnConfirm] = React.useState(false);
|
|
797
840
|
if (!boardState) return null;
|
|
@@ -850,7 +893,7 @@ var PIECE_ICON2 = {
|
|
|
850
893
|
};
|
|
851
894
|
function SelectedPieceDetail({ isMyTurn, className }) {
|
|
852
895
|
const t = useGameT();
|
|
853
|
-
const { boardState, selectedPieceId } =
|
|
896
|
+
const { boardState, selectedPieceId } = chunkLTFNSTAQ_cjs.useGameStore();
|
|
854
897
|
if (!boardState) return null;
|
|
855
898
|
const piece = boardState.pieces.find((p) => p.id === selectedPieceId);
|
|
856
899
|
if (!piece) {
|
|
@@ -913,7 +956,7 @@ function SelectedPieceDetail({ isMyTurn, className }) {
|
|
|
913
956
|
}
|
|
914
957
|
function MoveHistory({ scrollable = true, limit, className }) {
|
|
915
958
|
const t = useGameT();
|
|
916
|
-
const { boardState } =
|
|
959
|
+
const { boardState } = chunkLTFNSTAQ_cjs.useGameStore();
|
|
917
960
|
const scrollRef = React.useRef(null);
|
|
918
961
|
const history = boardState?.moveHistory ?? [];
|
|
919
962
|
const visible = limit ? history.slice(-limit) : history;
|
|
@@ -1021,7 +1064,7 @@ function HistoryRow({ entry, isLatest }) {
|
|
|
1021
1064
|
var COLS2 = 9;
|
|
1022
1065
|
var ROWS2 = 12;
|
|
1023
1066
|
function StaticGameBoard() {
|
|
1024
|
-
const boardState = React.useMemo(() =>
|
|
1067
|
+
const boardState = React.useMemo(() => chunkLTFNSTAQ_cjs.getInitialBoardState("white"), []);
|
|
1025
1068
|
const renderSquares = () => {
|
|
1026
1069
|
const squares = [];
|
|
1027
1070
|
for (let y = ROWS2 - 1; y >= 0; y--) {
|
|
@@ -1112,7 +1155,7 @@ function StaticGameBoard() {
|
|
|
1112
1155
|
}
|
|
1113
1156
|
function TurnBanner({ isMyTurn, waitingLabel, className }) {
|
|
1114
1157
|
const t = useGameT();
|
|
1115
|
-
const { boardState } =
|
|
1158
|
+
const { boardState } = chunkLTFNSTAQ_cjs.useGameStore();
|
|
1116
1159
|
if (!boardState) return null;
|
|
1117
1160
|
const { actionPoints, maxActionPoints } = boardState;
|
|
1118
1161
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -1156,7 +1199,7 @@ var TOAST_CONFIG = {
|
|
|
1156
1199
|
};
|
|
1157
1200
|
function EventToast({ className }) {
|
|
1158
1201
|
const t = useGameT();
|
|
1159
|
-
const { boardState } =
|
|
1202
|
+
const { boardState } = chunkLTFNSTAQ_cjs.useGameStore();
|
|
1160
1203
|
const [toast, setToast] = React.useState(null);
|
|
1161
1204
|
React.useEffect(() => {
|
|
1162
1205
|
const lastMove = boardState?.lastMove;
|
|
@@ -1195,7 +1238,7 @@ function EventToast({ className }) {
|
|
|
1195
1238
|
);
|
|
1196
1239
|
}
|
|
1197
1240
|
function MobileHistory({ className }) {
|
|
1198
|
-
const { boardState } =
|
|
1241
|
+
const { boardState } = chunkLTFNSTAQ_cjs.useGameStore();
|
|
1199
1242
|
const [open, setOpen] = React.useState(false);
|
|
1200
1243
|
const lastMove = boardState?.moveHistory?.at(-1);
|
|
1201
1244
|
if (!lastMove) return null;
|
|
@@ -1306,6 +1349,7 @@ exports.Button = Button;
|
|
|
1306
1349
|
exports.ConfirmDialog = ConfirmDialog;
|
|
1307
1350
|
exports.EventToast = EventToast;
|
|
1308
1351
|
exports.Football = Football;
|
|
1352
|
+
exports.GAME_I18N_KEYS = GAME_I18N_KEYS;
|
|
1309
1353
|
exports.GameBoard = GameBoard;
|
|
1310
1354
|
exports.GameControls = GameControls;
|
|
1311
1355
|
exports.GameI18nProvider = GameI18nProvider;
|