@scriptonita/chess-football-ui 0.2.0 → 0.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-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 +13 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -11
- 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
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useGameStore, getInitialBoardState } from './chunk-
|
|
1
|
+
import { useGameStore, getInitialBoardState } from './chunk-N24LGLLO.js';
|
|
2
2
|
import { getValidMoves, getValidPasses, isInEnemyArea, RANK_LABELS, FILE_LABELS, LONG_KEY, squareName, SHORT_KEY } from '@scriptonita/chess-football-engine';
|
|
3
3
|
import { clsx } from 'clsx';
|
|
4
4
|
import { twMerge } from 'tailwind-merge';
|
|
@@ -72,14 +72,6 @@ function GamePiece({ piece, isSelected, hasBall, onClick }) {
|
|
|
72
72
|
children: [
|
|
73
73
|
/* @__PURE__ */ jsx(PieceIcon, { type: piece.type, side: piece.side }),
|
|
74
74
|
hasBall && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 rounded-full ring-2 ring-orange-400 pointer-events-none" }),
|
|
75
|
-
piece.hasMovedThisTurn && /* @__PURE__ */ jsx(
|
|
76
|
-
"span",
|
|
77
|
-
{
|
|
78
|
-
"aria-hidden": "true",
|
|
79
|
-
className: "absolute top-0.5 right-0.5 w-[14px] h-[14px] rounded-full bg-fg-muted/80 flex items-center justify-center text-[9px] text-bg-primary font-bold leading-none pointer-events-none",
|
|
80
|
-
children: "\u2713"
|
|
81
|
-
}
|
|
82
|
-
),
|
|
83
75
|
isSelected && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 rounded-full animate-pulse ring-2 ring-yellow-400 ring-offset-2 ring-offset-transparent" })
|
|
84
76
|
]
|
|
85
77
|
}
|
|
@@ -199,6 +191,7 @@ function GameBoard({ userSide, showCoordinates = false, keyboardNav = true }) {
|
|
|
199
191
|
const ballCarrier = ball.holderId ? boardState.pieces.find((p) => p.id === ball.holderId) ?? null : null;
|
|
200
192
|
const isOffsideRisk = !!ballCarrier && ballCarrier.type !== "king" && userSide !== null && ballCarrier.side === userSide && boardState.turn === userSide && isInEnemyArea(ballCarrier.pos, ballCarrier.side);
|
|
201
193
|
const handleSquareClick = (x, y) => {
|
|
194
|
+
setCursor(null);
|
|
202
195
|
const isValidMove = validMoves.some((m) => m.x === x && m.y === y);
|
|
203
196
|
const isValidPass = validPasses.some((p) => p.x === x && p.y === y);
|
|
204
197
|
if (isValidMove && isValidPass) {
|
|
@@ -400,8 +393,7 @@ function GameBoard({ userSide, showCoordinates = false, keyboardNav = true }) {
|
|
|
400
393
|
tabIndex: 0,
|
|
401
394
|
role: "application",
|
|
402
395
|
"aria-label": "Game board \u2014 arrow keys to move the cursor, Enter to act",
|
|
403
|
-
onKeyDown: handleKeyDown
|
|
404
|
-
onFocus: () => setCursor((c) => c ?? defaultCursor())
|
|
396
|
+
onKeyDown: handleKeyDown
|
|
405
397
|
} : {},
|
|
406
398
|
children: /* @__PURE__ */ jsxs("div", { className: "relative", style: { containerType: "inline-size" }, children: [
|
|
407
399
|
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-9 gap-[1px]", children: renderSquares() }),
|