react-native-chess-kit 0.5.0 → 0.5.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.
Files changed (60) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +168 -168
  3. package/lib/commonjs/board-annotations.js +8 -8
  4. package/lib/commonjs/board-arrows.js +7 -7
  5. package/lib/commonjs/board-background.js +5 -5
  6. package/lib/commonjs/board-coordinates.js +8 -8
  7. package/lib/commonjs/board-drag-ghost.js +10 -10
  8. package/lib/commonjs/board-highlights.js +15 -15
  9. package/lib/commonjs/board-legal-dots.js +5 -5
  10. package/lib/commonjs/board-piece.js +25 -25
  11. package/lib/commonjs/board-pieces.js +6 -6
  12. package/lib/commonjs/board.js +24 -24
  13. package/lib/commonjs/promotion-picker.js +8 -8
  14. package/lib/commonjs/static-board.js +7 -7
  15. package/lib/commonjs/use-board-gesture.js +52 -33
  16. package/lib/commonjs/use-board-gesture.js.map +1 -1
  17. package/lib/commonjs/use-board-pieces.js +15 -15
  18. package/lib/commonjs/use-board-state.js +8 -8
  19. package/lib/commonjs/use-premove.js +12 -12
  20. package/lib/module/board-annotations.js +8 -8
  21. package/lib/module/board-arrows.js +7 -7
  22. package/lib/module/board-background.js +5 -5
  23. package/lib/module/board-coordinates.js +8 -8
  24. package/lib/module/board-drag-ghost.js +10 -10
  25. package/lib/module/board-highlights.js +15 -15
  26. package/lib/module/board-legal-dots.js +5 -5
  27. package/lib/module/board-piece.js +25 -25
  28. package/lib/module/board-pieces.js +6 -6
  29. package/lib/module/board.js +24 -24
  30. package/lib/module/promotion-picker.js +8 -8
  31. package/lib/module/static-board.js +7 -7
  32. package/lib/module/use-board-gesture.js +52 -33
  33. package/lib/module/use-board-gesture.js.map +1 -1
  34. package/lib/module/use-board-pieces.js +15 -15
  35. package/lib/module/use-board-state.js +8 -8
  36. package/lib/module/use-premove.js +12 -12
  37. package/lib/typescript/use-board-gesture.d.ts.map +1 -1
  38. package/package.json +1 -1
  39. package/src/board-annotations.tsx +147 -147
  40. package/src/board-arrows.tsx +197 -197
  41. package/src/board-background.tsx +46 -46
  42. package/src/board-coordinates.tsx +192 -192
  43. package/src/board-drag-ghost.tsx +132 -132
  44. package/src/board-highlights.tsx +226 -226
  45. package/src/board-legal-dots.tsx +73 -73
  46. package/src/board-piece.tsx +160 -160
  47. package/src/board-pieces.tsx +63 -63
  48. package/src/board.tsx +685 -685
  49. package/src/constants.ts +103 -103
  50. package/src/index.ts +101 -101
  51. package/src/pieces/default-pieces.tsx +383 -383
  52. package/src/pieces/index.ts +1 -1
  53. package/src/promotion-picker.tsx +147 -147
  54. package/src/static-board.tsx +187 -187
  55. package/src/themes.ts +129 -129
  56. package/src/types.ts +373 -373
  57. package/src/use-board-gesture.ts +429 -412
  58. package/src/use-board-pieces.ts +158 -158
  59. package/src/use-board-state.ts +111 -111
  60. package/src/use-premove.ts +59 -59
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 anas-asghar4831
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 anas-asghar4831
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,168 +1,168 @@
1
- # react-native-chess-kit
2
-
3
- High-performance chess board for React Native. Built for 60fps on budget Android devices.
4
-
5
- ## Performance
6
-
7
- | Metric | react-native-chess-kit | expo-chessboard |
8
- |--------|----------------------|-----------------|
9
- | Gesture handlers | 1 (centralized) | 32 (one per piece) |
10
- | Mounted components | ~40 | ~281 |
11
- | Native views | ~75 | ~470 |
12
- | React Context providers | 0 | 8 |
13
- | Re-renders during drag | 0 | Per-frame |
14
-
15
- Zero React re-renders during drag -- all animation runs on the UI thread via Reanimated worklets. Pieces animate only `transform` + `opacity` (Reanimated's fast path). Stable piece IDs survive position changes without unmount/remount cycles.
16
-
17
- ## Installation
18
-
19
- ```bash
20
- npm install react-native-chess-kit
21
- ```
22
-
23
- ### Peer dependencies
24
-
25
- ```bash
26
- npm install react-native-reanimated react-native-gesture-handler chess.js
27
- ```
28
-
29
- | Package | Version |
30
- |---------|---------|
31
- | react-native-reanimated | >= 3.0.0 |
32
- | react-native-gesture-handler | >= 2.0.0 |
33
- | chess.js | >= 1.0.0 |
34
- | react | >= 18.0.0 |
35
- | react-native | >= 0.70.0 |
36
-
37
- ## Usage
38
-
39
- ```tsx
40
- import { useRef } from 'react';
41
- import { Board } from 'react-native-chess-kit';
42
- import type { BoardRef } from 'react-native-chess-kit';
43
-
44
- function ChessScreen() {
45
- const boardRef = useRef<BoardRef>(null);
46
-
47
- return (
48
- <Board
49
- ref={boardRef}
50
- fen="rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
51
- orientation="white"
52
- boardSize={360}
53
- gestureEnabled={true}
54
- player="white"
55
- colors={{ light: '#eeeed2', dark: '#769656' }}
56
- moveDuration={200}
57
- withLetters={true}
58
- withNumbers={true}
59
- showLegalMoves={true}
60
- moveMethod="both"
61
- onMove={({ from, to }) => {
62
- console.log(`Moved from ${from} to ${to}`);
63
- }}
64
- />
65
- );
66
- }
67
- ```
68
-
69
- ## Props
70
-
71
- | Prop | Type | Default | Description |
72
- |------|------|---------|-------------|
73
- | `fen` | `string` | required | Board position in FEN notation |
74
- | `orientation` | `'white' \| 'black'` | required | Which color is at the bottom |
75
- | `boardSize` | `number` | required | Board width/height in pixels |
76
- | `gestureEnabled` | `boolean` | required | Whether touch interaction is enabled |
77
- | `player` | `'white' \| 'black' \| 'both'` | required | Which side can move pieces |
78
- | `colors` | `{ light: string, dark: string }` | required | Square colors |
79
- | `moveDuration` | `number` | required | Animation duration in ms (0 = instant) |
80
- | `withLetters` | `boolean` | required | Show file labels (a-h) |
81
- | `withNumbers` | `boolean` | required | Show rank numbers (1-8) |
82
- | `showLegalMoves` | `boolean` | required | Show legal move dots on piece selection |
83
- | `moveMethod` | `'drag' \| 'click' \| 'both'` | required | How the user moves pieces |
84
- | `onMove` | `(info: { from, to }) => void` | optional | Called after a move gesture completes |
85
- | `renderPiece` | `(code, size) => ReactElement` | optional | Custom piece renderer |
86
-
87
- ## Ref API
88
-
89
- ```ts
90
- const boardRef = useRef<BoardRef>(null);
91
-
92
- // Programmatic move (e.g. opponent's move, puzzle auto-play)
93
- boardRef.current?.move({ from: 'e2', to: 'e4' });
94
-
95
- // Highlight a square
96
- boardRef.current?.highlight('e4', 'rgba(255, 255, 0, 0.5)');
97
-
98
- // Clear all highlights
99
- boardRef.current?.clearHighlights();
100
-
101
- // Reset to a new position
102
- boardRef.current?.resetBoard('rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1');
103
-
104
- // Undo the last visual move (snap back)
105
- boardRef.current?.undo();
106
- ```
107
-
108
- ## Custom Piece Rendering
109
-
110
- Use `renderPiece` to provide your own piece images:
111
-
112
- ```tsx
113
- import { Image } from 'expo-image';
114
-
115
- const PIECE_IMAGES = {
116
- wp: require('./assets/pieces/wp.png'),
117
- wn: require('./assets/pieces/wn.png'),
118
- // ... etc
119
- };
120
-
121
- <Board
122
- renderPiece={(code, size) => (
123
- <Image
124
- source={PIECE_IMAGES[code]}
125
- style={{ width: size, height: size }}
126
- cachePolicy="memory-disk"
127
- />
128
- )}
129
- // ... other props
130
- />
131
- ```
132
-
133
- ## Exports
134
-
135
- ```ts
136
- // Component
137
- export { Board } from 'react-native-chess-kit';
138
-
139
- // Types
140
- export type {
141
- BoardRef,
142
- BoardProps,
143
- BoardColors,
144
- BoardPiece,
145
- ChessColor,
146
- MoveMethod,
147
- GestureState,
148
- LegalMoveTarget,
149
- ParsedPiece,
150
- } from 'react-native-chess-kit';
151
-
152
- // Utilities (useful for overlay positioning)
153
- export { squareToXY, xyToSquare } from 'react-native-chess-kit';
154
- ```
155
-
156
- ## Architecture
157
-
158
- The board follows the chess.com / lichess pattern:
159
-
160
- - **Single gesture handler** at the board level (not per-piece)
161
- - **Reanimated shared values** for drag state (zero JS thread work during drag)
162
- - **Stable piece IDs** via smart FEN diffing (pieces survive position changes)
163
- - **chess.js** for internal legal move validation
164
- - **Worklet-only animation** using transform + opacity (Reanimated fast path)
165
-
166
- ## License
167
-
168
- MIT
1
+ # react-native-chess-kit
2
+
3
+ High-performance chess board for React Native. Built for 60fps on budget Android devices.
4
+
5
+ ## Performance
6
+
7
+ | Metric | react-native-chess-kit | expo-chessboard |
8
+ |--------|----------------------|-----------------|
9
+ | Gesture handlers | 1 (centralized) | 32 (one per piece) |
10
+ | Mounted components | ~40 | ~281 |
11
+ | Native views | ~75 | ~470 |
12
+ | React Context providers | 0 | 8 |
13
+ | Re-renders during drag | 0 | Per-frame |
14
+
15
+ Zero React re-renders during drag -- all animation runs on the UI thread via Reanimated worklets. Pieces animate only `transform` + `opacity` (Reanimated's fast path). Stable piece IDs survive position changes without unmount/remount cycles.
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ npm install react-native-chess-kit
21
+ ```
22
+
23
+ ### Peer dependencies
24
+
25
+ ```bash
26
+ npm install react-native-reanimated react-native-gesture-handler chess.js
27
+ ```
28
+
29
+ | Package | Version |
30
+ |---------|---------|
31
+ | react-native-reanimated | >= 3.0.0 |
32
+ | react-native-gesture-handler | >= 2.0.0 |
33
+ | chess.js | >= 1.0.0 |
34
+ | react | >= 18.0.0 |
35
+ | react-native | >= 0.70.0 |
36
+
37
+ ## Usage
38
+
39
+ ```tsx
40
+ import { useRef } from 'react';
41
+ import { Board } from 'react-native-chess-kit';
42
+ import type { BoardRef } from 'react-native-chess-kit';
43
+
44
+ function ChessScreen() {
45
+ const boardRef = useRef<BoardRef>(null);
46
+
47
+ return (
48
+ <Board
49
+ ref={boardRef}
50
+ fen="rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
51
+ orientation="white"
52
+ boardSize={360}
53
+ gestureEnabled={true}
54
+ player="white"
55
+ colors={{ light: '#eeeed2', dark: '#769656' }}
56
+ moveDuration={200}
57
+ withLetters={true}
58
+ withNumbers={true}
59
+ showLegalMoves={true}
60
+ moveMethod="both"
61
+ onMove={({ from, to }) => {
62
+ console.log(`Moved from ${from} to ${to}`);
63
+ }}
64
+ />
65
+ );
66
+ }
67
+ ```
68
+
69
+ ## Props
70
+
71
+ | Prop | Type | Default | Description |
72
+ |------|------|---------|-------------|
73
+ | `fen` | `string` | required | Board position in FEN notation |
74
+ | `orientation` | `'white' \| 'black'` | required | Which color is at the bottom |
75
+ | `boardSize` | `number` | required | Board width/height in pixels |
76
+ | `gestureEnabled` | `boolean` | required | Whether touch interaction is enabled |
77
+ | `player` | `'white' \| 'black' \| 'both'` | required | Which side can move pieces |
78
+ | `colors` | `{ light: string, dark: string }` | required | Square colors |
79
+ | `moveDuration` | `number` | required | Animation duration in ms (0 = instant) |
80
+ | `withLetters` | `boolean` | required | Show file labels (a-h) |
81
+ | `withNumbers` | `boolean` | required | Show rank numbers (1-8) |
82
+ | `showLegalMoves` | `boolean` | required | Show legal move dots on piece selection |
83
+ | `moveMethod` | `'drag' \| 'click' \| 'both'` | required | How the user moves pieces |
84
+ | `onMove` | `(info: { from, to }) => void` | optional | Called after a move gesture completes |
85
+ | `renderPiece` | `(code, size) => ReactElement` | optional | Custom piece renderer |
86
+
87
+ ## Ref API
88
+
89
+ ```ts
90
+ const boardRef = useRef<BoardRef>(null);
91
+
92
+ // Programmatic move (e.g. opponent's move, puzzle auto-play)
93
+ boardRef.current?.move({ from: 'e2', to: 'e4' });
94
+
95
+ // Highlight a square
96
+ boardRef.current?.highlight('e4', 'rgba(255, 255, 0, 0.5)');
97
+
98
+ // Clear all highlights
99
+ boardRef.current?.clearHighlights();
100
+
101
+ // Reset to a new position
102
+ boardRef.current?.resetBoard('rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1');
103
+
104
+ // Undo the last visual move (snap back)
105
+ boardRef.current?.undo();
106
+ ```
107
+
108
+ ## Custom Piece Rendering
109
+
110
+ Use `renderPiece` to provide your own piece images:
111
+
112
+ ```tsx
113
+ import { Image } from 'expo-image';
114
+
115
+ const PIECE_IMAGES = {
116
+ wp: require('./assets/pieces/wp.png'),
117
+ wn: require('./assets/pieces/wn.png'),
118
+ // ... etc
119
+ };
120
+
121
+ <Board
122
+ renderPiece={(code, size) => (
123
+ <Image
124
+ source={PIECE_IMAGES[code]}
125
+ style={{ width: size, height: size }}
126
+ cachePolicy="memory-disk"
127
+ />
128
+ )}
129
+ // ... other props
130
+ />
131
+ ```
132
+
133
+ ## Exports
134
+
135
+ ```ts
136
+ // Component
137
+ export { Board } from 'react-native-chess-kit';
138
+
139
+ // Types
140
+ export type {
141
+ BoardRef,
142
+ BoardProps,
143
+ BoardColors,
144
+ BoardPiece,
145
+ ChessColor,
146
+ MoveMethod,
147
+ GestureState,
148
+ LegalMoveTarget,
149
+ ParsedPiece,
150
+ } from 'react-native-chess-kit';
151
+
152
+ // Utilities (useful for overlay positioning)
153
+ export { squareToXY, xyToSquare } from 'react-native-chess-kit';
154
+ ```
155
+
156
+ ## Architecture
157
+
158
+ The board follows the chess.com / lichess pattern:
159
+
160
+ - **Single gesture handler** at the board level (not per-piece)
161
+ - **Reanimated shared values** for drag state (zero JS thread work during drag)
162
+ - **Stable piece IDs** via smart FEN diffing (pieces survive position changes)
163
+ - **chess.js** for internal legal move validation
164
+ - **Worklet-only animation** using transform + opacity (Reanimated fast path)
165
+
166
+ ## License
167
+
168
+ MIT
@@ -18,11 +18,11 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
18
18
  // Annotations layer
19
19
  // ---------------------------------------------------------------------------
20
20
 
21
- /**
22
- * Text annotation badges on chess squares (!, ?, !!, ??, etc.).
23
- *
24
- * Each annotation appears as a small colored badge at the top-right
25
- * corner of the target square. Positioned absolutely, pointer-events none.
21
+ /**
22
+ * Text annotation badges on chess squares (!, ?, !!, ??, etc.).
23
+ *
24
+ * Each annotation appears as a small colored badge at the top-right
25
+ * corner of the target square. Positioned absolutely, pointer-events none.
26
26
  */
27
27
  const BoardAnnotations = exports.BoardAnnotations = /*#__PURE__*/_react.default.memo(function BoardAnnotations({
28
28
  boardSize,
@@ -81,9 +81,9 @@ const BoardAnnotations = exports.BoardAnnotations = /*#__PURE__*/_react.default.
81
81
  // Standalone export for advanced consumers
82
82
  // ---------------------------------------------------------------------------
83
83
 
84
- /**
85
- * Single annotation badge component.
86
- * Exported for consumers who build their own overlay layers.
84
+ /**
85
+ * Single annotation badge component.
86
+ * Exported for consumers who build their own overlay layers.
87
87
  */
88
88
  const Annotation = exports.Annotation = /*#__PURE__*/_react.default.memo(function Annotation({
89
89
  square,
@@ -52,13 +52,13 @@ function calculateArrowPath(from, to, shortenBy) {
52
52
  // Combined arrows + shapes SVG layer
53
53
  // ---------------------------------------------------------------------------
54
54
 
55
- /**
56
- * SVG overlay for arrows and shapes drawn on the board.
57
- *
58
- * Uses a percentage-based 100x100 viewBox so coordinates map cleanly
59
- * to the 8x8 grid (each square = 12.5 x 12.5 units).
60
- *
61
- * Renders above the pieces layer so arrows are always visible.
55
+ /**
56
+ * SVG overlay for arrows and shapes drawn on the board.
57
+ *
58
+ * Uses a percentage-based 100x100 viewBox so coordinates map cleanly
59
+ * to the 8x8 grid (each square = 12.5 x 12.5 units).
60
+ *
61
+ * Renders above the pieces layer so arrows are always visible.
62
62
  */
63
63
  const BoardArrows = exports.BoardArrows = /*#__PURE__*/_react.default.memo(function BoardArrows({
64
64
  boardSize,
@@ -8,11 +8,11 @@ var _react = _interopRequireDefault(require("react"));
8
8
  var _reactNative = require("react-native");
9
9
  var _jsxRuntime = require("react/jsx-runtime");
10
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
- /**
12
- * 64 static colored squares forming the chess board grid.
13
- *
14
- * These are plain Views with backgroundColor — no animations, no gesture
15
- * handlers. They never re-render after mount unless the board theme changes.
11
+ /**
12
+ * 64 static colored squares forming the chess board grid.
13
+ *
14
+ * These are plain Views with backgroundColor — no animations, no gesture
15
+ * handlers. They never re-render after mount unless the board theme changes.
16
16
  */
17
17
  const BoardBackground = exports.BoardBackground = /*#__PURE__*/_react.default.memo(function BoardBackground({
18
18
  boardSize,
@@ -13,14 +13,14 @@ const FILES_BLACK = ['h', 'g', 'f', 'e', 'd', 'c', 'b', 'a'];
13
13
  const RANKS_WHITE = ['8', '7', '6', '5', '4', '3', '2', '1'];
14
14
  const RANKS_BLACK = ['1', '2', '3', '4', '5', '6', '7', '8'];
15
15
 
16
- /**
17
- * File letters (a-h) and rank numbers (1-8) drawn on or around the board.
18
- *
19
- * Two modes:
20
- * - **inside** (default): absolute-positioned inside each edge square, colors
21
- * alternate to contrast with the square behind them.
22
- * - **outside**: rendered in a gutter area around the board. Rank numbers to
23
- * the left, file letters along the bottom. Uses the dark square color.
16
+ /**
17
+ * File letters (a-h) and rank numbers (1-8) drawn on or around the board.
18
+ *
19
+ * Two modes:
20
+ * - **inside** (default): absolute-positioned inside each edge square, colors
21
+ * alternate to contrast with the square behind them.
22
+ * - **outside**: rendered in a gutter area around the board. Rank numbers to
23
+ * the left, file letters along the bottom. Uses the dark square color.
24
24
  */
25
25
  const BoardCoordinates = exports.BoardCoordinates = /*#__PURE__*/_react.default.memo(function BoardCoordinates({
26
26
  boardSize,
@@ -9,12 +9,12 @@ var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reani
9
9
  var _jsxRuntime = require("react/jsx-runtime");
10
10
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
11
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
- /**
13
- * Floating piece that follows the user's finger during drag.
14
- *
15
- * Only ONE instance exists — not one per piece. It reads drag position
16
- * from shared values on the UI thread, so zero JS bridge calls and
17
- * zero re-renders while dragging.
12
+ /**
13
+ * Floating piece that follows the user's finger during drag.
14
+ *
15
+ * Only ONE instance exists — not one per piece. It reads drag position
16
+ * from shared values on the UI thread, so zero JS bridge calls and
17
+ * zero re-renders while dragging.
18
18
  */
19
19
  const BoardDragGhost = exports.BoardDragGhost = /*#__PURE__*/_react.default.memo(function BoardDragGhost({
20
20
  squareSize,
@@ -63,10 +63,10 @@ const BoardDragGhost = exports.BoardDragGhost = /*#__PURE__*/_react.default.memo
63
63
  });
64
64
  });
65
65
 
66
- /**
67
- * Inner content that renders the actual piece image.
68
- * Separate component so the Animated.View wrapper doesn't need
69
- * to re-render when the piece code changes — it uses shared value.
66
+ /**
67
+ * Inner content that renders the actual piece image.
68
+ * Separate component so the Animated.View wrapper doesn't need
69
+ * to re-render when the piece code changes — it uses shared value.
70
70
  */
71
71
  const DragGhostContent = /*#__PURE__*/_react.default.memo(function DragGhostContent({
72
72
  renderPiece,
@@ -19,15 +19,15 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
19
19
  // Static highlights (View-based, no animation needed)
20
20
  // ---------------------------------------------------------------------------
21
21
 
22
- /**
23
- * Renders all board square highlights as a single layer.
24
- *
25
- * Combines multiple highlight sources (last move, check, selected piece,
26
- * premoves, custom, and imperative) into one flat list of colored rectangles.
27
- * Rendered between the background and pieces layers.
28
- *
29
- * Uses plain Views (not Animated) because highlights change discretely
30
- * on move events, not during animation frames.
22
+ /**
23
+ * Renders all board square highlights as a single layer.
24
+ *
25
+ * Combines multiple highlight sources (last move, check, selected piece,
26
+ * premoves, custom, and imperative) into one flat list of colored rectangles.
27
+ * Rendered between the background and pieces layers.
28
+ *
29
+ * Uses plain Views (not Animated) because highlights change discretely
30
+ * on move events, not during animation frames.
31
31
  */
32
32
  const BoardHighlights = exports.BoardHighlights = /*#__PURE__*/_react.default.memo(function BoardHighlights({
33
33
  boardSize,
@@ -131,9 +131,9 @@ const BoardHighlights = exports.BoardHighlights = /*#__PURE__*/_react.default.me
131
131
  // Drag target highlight (Animated, updates on UI thread during drag)
132
132
  // ---------------------------------------------------------------------------
133
133
 
134
- /**
135
- * Highlight on the square currently under the dragged piece.
136
- * Uses Reanimated shared values for zero-JS-bridge updates during drag.
134
+ /**
135
+ * Highlight on the square currently under the dragged piece.
136
+ * Uses Reanimated shared values for zero-JS-bridge updates during drag.
137
137
  */
138
138
  const DragTargetHighlight = exports.DragTargetHighlight = /*#__PURE__*/_react.default.memo(function DragTargetHighlight({
139
139
  squareSize,
@@ -183,9 +183,9 @@ const DragTargetHighlight = exports.DragTargetHighlight = /*#__PURE__*/_react.de
183
183
  // Standalone SquareHighlight (exported for advanced consumers)
184
184
  // ---------------------------------------------------------------------------
185
185
 
186
- /**
187
- * Single square highlight component.
188
- * Exported for consumers who build their own overlay layers.
186
+ /**
187
+ * Single square highlight component.
188
+ * Exported for consumers who build their own overlay layers.
189
189
  */
190
190
  const SquareHighlight = exports.SquareHighlight = /*#__PURE__*/_react.default.memo(function SquareHighlight({
191
191
  square,
@@ -9,11 +9,11 @@ var _reactNative = require("react-native");
9
9
  var _useBoardPieces = require("./use-board-pieces");
10
10
  var _jsxRuntime = require("react/jsx-runtime");
11
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
- /**
13
- * Legal move indicator dots, rendered only when a piece is selected.
14
- *
15
- * Dots are CONDITIONALLY rendered (only for actual legal move squares,
16
- * typically 5-15) instead of always mounting 64 invisible dot views.
12
+ /**
13
+ * Legal move indicator dots, rendered only when a piece is selected.
14
+ *
15
+ * Dots are CONDITIONALLY rendered (only for actual legal move squares,
16
+ * typically 5-15) instead of always mounting 64 invisible dot views.
17
17
  */
18
18
  const BoardLegalDots = exports.BoardLegalDots = /*#__PURE__*/_react.default.memo(function BoardLegalDots({
19
19
  legalMoves,
@@ -9,9 +9,9 @@ var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reani
9
9
  var _constants = require("./constants");
10
10
  var _jsxRuntime = require("react/jsx-runtime");
11
11
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
12
- /**
13
- * Animate a shared value using the provided AnimationConfig.
14
- * Falls back to withTiming with moveDuration for backwards compatibility.
12
+ /**
13
+ * Animate a shared value using the provided AnimationConfig.
14
+ * Falls back to withTiming with moveDuration for backwards compatibility.
15
15
  */
16
16
  function animateValue(target, config, moveDuration) {
17
17
  if (config) {
@@ -34,28 +34,28 @@ function animateValue(target, config, moveDuration) {
34
34
  });
35
35
  }
36
36
 
37
- /**
38
- * A single animated chess piece.
39
- *
40
- * Uses two nested Animated.Views to avoid the Reanimated warning
41
- * "Property opacity may be overwritten by a layout animation":
42
- *
43
- * Outer view: position (transform) + exiting layout animation (FadeOut)
44
- * Inner view: drag-hide opacity
45
- *
46
- * Only `transform` and `opacity` are animated — Reanimated's fast path
47
- * on Android. No layout properties (top/left/width/height), avoiding
48
- * costly layout recalculations on low-end devices.
49
- *
50
- * During drag:
51
- * - Inner view hides (opacity: 0) — the drag ghost shows instead
52
- *
53
- * After a move:
54
- * - Outer view snaps to new position via withTiming/withSpring
55
- *
56
- * On capture (unmount):
57
- * - Outer view plays the exitingAnimation (default: FadeOut, no conflict with inner opacity)
58
- * - Pass exitingAnimation={undefined} to disable (instant disappear on full board remount)
37
+ /**
38
+ * A single animated chess piece.
39
+ *
40
+ * Uses two nested Animated.Views to avoid the Reanimated warning
41
+ * "Property opacity may be overwritten by a layout animation":
42
+ *
43
+ * Outer view: position (transform) + exiting layout animation (FadeOut)
44
+ * Inner view: drag-hide opacity
45
+ *
46
+ * Only `transform` and `opacity` are animated — Reanimated's fast path
47
+ * on Android. No layout properties (top/left/width/height), avoiding
48
+ * costly layout recalculations on low-end devices.
49
+ *
50
+ * During drag:
51
+ * - Inner view hides (opacity: 0) — the drag ghost shows instead
52
+ *
53
+ * After a move:
54
+ * - Outer view snaps to new position via withTiming/withSpring
55
+ *
56
+ * On capture (unmount):
57
+ * - Outer view plays the exitingAnimation (default: FadeOut, no conflict with inner opacity)
58
+ * - Pass exitingAnimation={undefined} to disable (instant disappear on full board remount)
59
59
  */
60
60
  const BoardPieceView = exports.BoardPieceView = /*#__PURE__*/_react.default.memo(function BoardPieceView({
61
61
  targetX,