@scriptonita/chess-football-ui 0.2.0 → 0.2.1
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/index.cjs +2 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -93,14 +93,6 @@ function GamePiece({ piece, isSelected, hasBall, onClick }) {
|
|
|
93
93
|
children: [
|
|
94
94
|
/* @__PURE__ */ jsxRuntime.jsx(PieceIcon, { type: piece.type, side: piece.side }),
|
|
95
95
|
hasBall && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 rounded-full ring-2 ring-orange-400 pointer-events-none" }),
|
|
96
|
-
piece.hasMovedThisTurn && /* @__PURE__ */ jsxRuntime.jsx(
|
|
97
|
-
"span",
|
|
98
|
-
{
|
|
99
|
-
"aria-hidden": "true",
|
|
100
|
-
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",
|
|
101
|
-
children: "\u2713"
|
|
102
|
-
}
|
|
103
|
-
),
|
|
104
96
|
isSelected && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 rounded-full animate-pulse ring-2 ring-yellow-400 ring-offset-2 ring-offset-transparent" })
|
|
105
97
|
]
|
|
106
98
|
}
|
|
@@ -220,6 +212,7 @@ function GameBoard({ userSide, showCoordinates = false, keyboardNav = true }) {
|
|
|
220
212
|
const ballCarrier = ball.holderId ? boardState.pieces.find((p) => p.id === ball.holderId) ?? null : null;
|
|
221
213
|
const isOffsideRisk = !!ballCarrier && ballCarrier.type !== "king" && userSide !== null && ballCarrier.side === userSide && boardState.turn === userSide && chessFootballEngine.isInEnemyArea(ballCarrier.pos, ballCarrier.side);
|
|
222
214
|
const handleSquareClick = (x, y) => {
|
|
215
|
+
setCursor(null);
|
|
223
216
|
const isValidMove = validMoves.some((m) => m.x === x && m.y === y);
|
|
224
217
|
const isValidPass = validPasses.some((p) => p.x === x && p.y === y);
|
|
225
218
|
if (isValidMove && isValidPass) {
|
|
@@ -421,8 +414,7 @@ function GameBoard({ userSide, showCoordinates = false, keyboardNav = true }) {
|
|
|
421
414
|
tabIndex: 0,
|
|
422
415
|
role: "application",
|
|
423
416
|
"aria-label": "Game board \u2014 arrow keys to move the cursor, Enter to act",
|
|
424
|
-
onKeyDown: handleKeyDown
|
|
425
|
-
onFocus: () => setCursor((c) => c ?? defaultCursor())
|
|
417
|
+
onKeyDown: handleKeyDown
|
|
426
418
|
} : {},
|
|
427
419
|
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", style: { containerType: "inline-size" }, children: [
|
|
428
420
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-9 gap-[1px]", children: renderSquares() }),
|