react-native-chess-kit 0.1.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.
Files changed (109) hide show
  1. package/lib/commonjs/board-annotations.js +131 -0
  2. package/lib/commonjs/board-annotations.js.map +1 -0
  3. package/lib/commonjs/board-arrows.js +164 -0
  4. package/lib/commonjs/board-arrows.js.map +1 -0
  5. package/lib/commonjs/board-highlights.js +212 -0
  6. package/lib/commonjs/board-highlights.js.map +1 -0
  7. package/lib/commonjs/board-piece.js +71 -25
  8. package/lib/commonjs/board-piece.js.map +1 -1
  9. package/lib/commonjs/board-pieces.js +2 -0
  10. package/lib/commonjs/board-pieces.js.map +1 -1
  11. package/lib/commonjs/board.js +392 -42
  12. package/lib/commonjs/board.js.map +1 -1
  13. package/lib/commonjs/constants.js +104 -0
  14. package/lib/commonjs/constants.js.map +1 -0
  15. package/lib/commonjs/index.js +128 -0
  16. package/lib/commonjs/index.js.map +1 -1
  17. package/lib/commonjs/pieces/default-pieces.js +536 -0
  18. package/lib/commonjs/pieces/default-pieces.js.map +1 -0
  19. package/lib/commonjs/pieces/index.js +13 -0
  20. package/lib/commonjs/pieces/index.js.map +1 -0
  21. package/lib/commonjs/promotion-picker.js +129 -0
  22. package/lib/commonjs/promotion-picker.js.map +1 -0
  23. package/lib/commonjs/static-board.js +150 -0
  24. package/lib/commonjs/static-board.js.map +1 -0
  25. package/lib/commonjs/themes.js +175 -0
  26. package/lib/commonjs/themes.js.map +1 -0
  27. package/lib/commonjs/use-board-gesture.js +184 -11
  28. package/lib/commonjs/use-board-gesture.js.map +1 -1
  29. package/lib/commonjs/use-premove.js +44 -0
  30. package/lib/commonjs/use-premove.js.map +1 -0
  31. package/lib/module/board-annotations.js +126 -0
  32. package/lib/module/board-annotations.js.map +1 -0
  33. package/lib/module/board-arrows.js +161 -0
  34. package/lib/module/board-arrows.js.map +1 -0
  35. package/lib/module/board-highlights.js +206 -0
  36. package/lib/module/board-highlights.js.map +1 -0
  37. package/lib/module/board-piece.js +72 -26
  38. package/lib/module/board-piece.js.map +1 -1
  39. package/lib/module/board-pieces.js +2 -0
  40. package/lib/module/board-pieces.js.map +1 -1
  41. package/lib/module/board.js +395 -44
  42. package/lib/module/board.js.map +1 -1
  43. package/lib/module/constants.js +100 -0
  44. package/lib/module/constants.js.map +1 -0
  45. package/lib/module/index.js +29 -1
  46. package/lib/module/index.js.map +1 -1
  47. package/lib/module/pieces/default-pieces.js +530 -0
  48. package/lib/module/pieces/default-pieces.js.map +1 -0
  49. package/lib/module/pieces/index.js +4 -0
  50. package/lib/module/pieces/index.js.map +1 -0
  51. package/lib/module/promotion-picker.js +124 -0
  52. package/lib/module/promotion-picker.js.map +1 -0
  53. package/lib/module/static-board.js +146 -0
  54. package/lib/module/static-board.js.map +1 -0
  55. package/lib/module/themes.js +171 -0
  56. package/lib/module/themes.js.map +1 -0
  57. package/lib/module/use-board-gesture.js +185 -11
  58. package/lib/module/use-board-gesture.js.map +1 -1
  59. package/lib/module/use-premove.js +40 -0
  60. package/lib/module/use-premove.js.map +1 -0
  61. package/lib/typescript/board-annotations.d.ts +30 -0
  62. package/lib/typescript/board-annotations.d.ts.map +1 -0
  63. package/lib/typescript/board-arrows.d.ts +27 -0
  64. package/lib/typescript/board-arrows.d.ts.map +1 -0
  65. package/lib/typescript/board-highlights.d.ts +65 -0
  66. package/lib/typescript/board-highlights.d.ts.map +1 -0
  67. package/lib/typescript/board-piece.d.ts +19 -9
  68. package/lib/typescript/board-piece.d.ts.map +1 -1
  69. package/lib/typescript/board-pieces.d.ts +2 -1
  70. package/lib/typescript/board-pieces.d.ts.map +1 -1
  71. package/lib/typescript/board.d.ts +11 -2
  72. package/lib/typescript/board.d.ts.map +1 -1
  73. package/lib/typescript/constants.d.ts +54 -0
  74. package/lib/typescript/constants.d.ts.map +1 -0
  75. package/lib/typescript/index.d.ts +9 -1
  76. package/lib/typescript/index.d.ts.map +1 -1
  77. package/lib/typescript/pieces/default-pieces.d.ts +3 -0
  78. package/lib/typescript/pieces/default-pieces.d.ts.map +1 -0
  79. package/lib/typescript/pieces/index.d.ts +2 -0
  80. package/lib/typescript/pieces/index.d.ts.map +1 -0
  81. package/lib/typescript/promotion-picker.d.ts +30 -0
  82. package/lib/typescript/promotion-picker.d.ts.map +1 -0
  83. package/lib/typescript/static-board.d.ts +12 -0
  84. package/lib/typescript/static-board.d.ts.map +1 -0
  85. package/lib/typescript/themes.d.ts +15 -0
  86. package/lib/typescript/themes.d.ts.map +1 -0
  87. package/lib/typescript/types.d.ts +194 -24
  88. package/lib/typescript/types.d.ts.map +1 -1
  89. package/lib/typescript/use-board-gesture.d.ts +28 -2
  90. package/lib/typescript/use-board-gesture.d.ts.map +1 -1
  91. package/lib/typescript/use-premove.d.ts +31 -0
  92. package/lib/typescript/use-premove.d.ts.map +1 -0
  93. package/package.json +4 -2
  94. package/src/board-annotations.tsx +147 -0
  95. package/src/board-arrows.tsx +197 -0
  96. package/src/board-highlights.tsx +226 -0
  97. package/src/board-piece.tsx +77 -29
  98. package/src/board-pieces.tsx +4 -1
  99. package/src/board.tsx +462 -46
  100. package/src/constants.ts +100 -0
  101. package/src/index.ts +62 -1
  102. package/src/pieces/default-pieces.tsx +383 -0
  103. package/src/pieces/index.ts +1 -0
  104. package/src/promotion-picker.tsx +147 -0
  105. package/src/static-board.tsx +150 -0
  106. package/src/themes.ts +129 -0
  107. package/src/types.ts +251 -25
  108. package/src/use-board-gesture.ts +219 -8
  109. package/src/use-premove.ts +59 -0
@@ -4,6 +4,37 @@ import { useMemo, useCallback, useRef } from 'react';
4
4
  import { Gesture } from 'react-native-gesture-handler';
5
5
  import { useSharedValue, runOnJS } from 'react-native-reanimated';
6
6
  import { xyToSquare } from './use-board-pieces';
7
+
8
+ // ---------------------------------------------------------------------------
9
+ // Callback types
10
+ // ---------------------------------------------------------------------------
11
+
12
+ /** Rich callbacks exposed to consumers (all optional) */
13
+
14
+ /** Premove-related callbacks from board.tsx */
15
+
16
+ // ---------------------------------------------------------------------------
17
+ // Params
18
+ // ---------------------------------------------------------------------------
19
+
20
+ // ---------------------------------------------------------------------------
21
+ // Helpers
22
+ // ---------------------------------------------------------------------------
23
+
24
+ /** Check if a piece color matches the current player turn */
25
+ function isPieceTurn(pieceColor, currentTurn) {
26
+ return pieceColor === currentTurn;
27
+ }
28
+
29
+ /** Map piece color char to player ChessColor */
30
+ function pieceColorToPlayer(color) {
31
+ return color === 'w' ? 'white' : 'black';
32
+ }
33
+
34
+ // ---------------------------------------------------------------------------
35
+ // Hook
36
+ // ---------------------------------------------------------------------------
37
+
7
38
  /**
8
39
  * Single centralized gesture handler for the entire board.
9
40
  *
@@ -22,6 +53,13 @@ import { xyToSquare } from './use-board-pieces';
22
53
  * gestureEnabled, player, or moveMethod change). Frequently-changing data
23
54
  * (pieces, selectedSquare, legalMoves) is read from refs via runOnJS bridge
24
55
  * functions, avoiding costly gesture teardown/rebuild on every move.
56
+ *
57
+ * v0.2.0 additions:
58
+ * - Rich callbacks (onPieceClick, onSquareClick, onPieceDragBegin, onPieceDragEnd)
59
+ * - Drag target square tracking (shared value for DragTargetHighlight)
60
+ * - Premove support (queue move when not your turn)
61
+ * - Haptic feedback via callback
62
+ * - Long press detection for onSquareLongPress
25
63
  */
26
64
  export function useBoardGesture({
27
65
  squareSize,
@@ -31,8 +69,12 @@ export function useBoardGesture({
31
69
  moveMethod,
32
70
  pieces,
33
71
  callbacks,
72
+ richCallbacks,
73
+ premoveCallbacks,
74
+ premovesEnabled = false,
34
75
  selectedSquare,
35
- legalMoves
76
+ legalMoves,
77
+ currentTurn
36
78
  }) {
37
79
  // Shared values for drag tracking — updated on UI thread only
38
80
  const activeSquare = useSharedValue(null);
@@ -40,12 +82,14 @@ export function useBoardGesture({
40
82
  const dragY = useSharedValue(0);
41
83
  const isDragging = useSharedValue(false);
42
84
  const dragPieceCode = useSharedValue(null);
85
+ const dragTargetSquare = useSharedValue(null);
43
86
  const gestureState = {
44
87
  activeSquare,
45
88
  dragX,
46
89
  dragY,
47
90
  isDragging,
48
- dragPieceCode
91
+ dragPieceCode,
92
+ dragTargetSquare
49
93
  };
50
94
 
51
95
  // --- Refs for frequently-changing data (read from JS thread via runOnJS) ---
@@ -58,6 +102,15 @@ export function useBoardGesture({
58
102
  legalMovesRef.current = legalMoves;
59
103
  const callbacksRef = useRef(callbacks);
60
104
  callbacksRef.current = callbacks;
105
+ const richCallbacksRef = useRef(richCallbacks);
106
+ richCallbacksRef.current = richCallbacks;
107
+ const premoveCallbacksRef = useRef(premoveCallbacks);
108
+ premoveCallbacksRef.current = premoveCallbacks;
109
+ const currentTurnRef = useRef(currentTurn);
110
+ currentTurnRef.current = currentTurn;
111
+
112
+ // Track the piece being dragged for rich drag-end callback
113
+ const draggedPieceRef = useRef(null);
61
114
 
62
115
  // --- JS-thread bridge functions called from worklets via runOnJS ---
63
116
  // These read current values from refs, so they always have fresh data.
@@ -68,11 +121,16 @@ export function useBoardGesture({
68
121
  const currentSelected = selectedSquareRef.current;
69
122
  const currentLegalMoves = legalMovesRef.current;
70
123
  const cbs = callbacksRef.current;
124
+ const rich = richCallbacksRef.current;
71
125
  const canClick = moveMethod !== 'drag';
72
126
 
73
127
  // Build lookup for the current touch
74
128
  const piece = currentPieces.find(p => p.square === square);
75
- const isPlayerPiece = piece ? player === 'both' || (piece.color === 'w' ? 'white' : 'black') === player : false;
129
+ const isPlayerPiece = piece ? player === 'both' || pieceColorToPlayer(piece.color) === player : false;
130
+
131
+ // Check if it's this piece's turn (for premove detection)
132
+ const turn = currentTurnRef.current;
133
+ const isOwnTurn = piece && turn ? isPieceTurn(piece.color, turn) : true; // default to true if turn not tracked
76
134
 
77
135
  // Click-to-move: second tap on a legal target square
78
136
  const legalSquares = new Set(currentLegalMoves.map(m => m.square));
@@ -81,38 +139,136 @@ export function useBoardGesture({
81
139
  activeSquare.value = null;
82
140
  isDragging.value = false;
83
141
  dragPieceCode.value = null;
142
+ dragTargetSquare.value = null;
143
+ rich?.onHaptic?.('move');
84
144
  return;
85
145
  }
86
146
  if (isPlayerPiece && piece) {
87
- // Tapped/started dragging a player piece
147
+ // Premove: player piece but not their turn
148
+ if (premovesEnabled && !isOwnTurn) {
149
+ // If there's already a selected square, this tap completes a premove
150
+ if (currentSelected && currentSelected !== square) {
151
+ premoveCallbacksRef.current?.onPremoveSet?.({
152
+ from: currentSelected,
153
+ to: square
154
+ });
155
+ cbs.onSelectionCleared();
156
+ activeSquare.value = null;
157
+ dragPieceCode.value = null;
158
+ dragTargetSquare.value = null;
159
+ return;
160
+ }
161
+ // First tap: select the piece for premove
162
+ activeSquare.value = square;
163
+ dragX.value = touchX;
164
+ dragY.value = touchY;
165
+ dragPieceCode.value = piece.code;
166
+ cbs.onPieceSelected(square);
167
+ rich?.onPieceClick?.(square, piece.code);
168
+ rich?.onHaptic?.('select');
169
+ return;
170
+ }
171
+
172
+ // Normal case: tapped/started dragging a player piece on their turn
88
173
  activeSquare.value = square;
89
174
  dragX.value = touchX;
90
175
  dragY.value = touchY;
91
176
  dragPieceCode.value = piece.code;
177
+ draggedPieceRef.current = {
178
+ square,
179
+ code: piece.code
180
+ };
92
181
  cbs.onPieceSelected(square);
182
+
183
+ // Rich callbacks
184
+ rich?.onPieceClick?.(square, piece.code);
185
+ rich?.onHaptic?.('select');
93
186
  } else {
94
- // Tapped empty square or opponent piece — clear selection
187
+ // Tapped empty square or opponent piece
188
+
189
+ // If premoves enabled and there's a selection, check if this is a premove target
190
+ if (premovesEnabled && currentSelected && !isOwnTurn) {
191
+ premoveCallbacksRef.current?.onPremoveSet?.({
192
+ from: currentSelected,
193
+ to: square
194
+ });
195
+ cbs.onSelectionCleared();
196
+ activeSquare.value = null;
197
+ dragPieceCode.value = null;
198
+ dragTargetSquare.value = null;
199
+ return;
200
+ }
95
201
  activeSquare.value = null;
96
202
  dragPieceCode.value = null;
203
+ dragTargetSquare.value = null;
97
204
  if (currentSelected) {
98
205
  cbs.onSelectionCleared();
99
206
  }
207
+
208
+ // Rich callback: square click (empty square or opponent piece)
209
+ rich?.onSquareClick?.(square);
210
+ }
211
+ }, [squareSize, orientation, player, moveMethod, premovesEnabled, activeSquare, dragX, dragY, isDragging, dragPieceCode, dragTargetSquare]);
212
+ const handleDragStart = useCallback((touchX, touchY) => {
213
+ const rich = richCallbacksRef.current;
214
+ const dragged = draggedPieceRef.current;
215
+ if (dragged) {
216
+ rich?.onPieceDragBegin?.(dragged.square, dragged.code);
100
217
  }
101
- }, [squareSize, orientation, player, moveMethod, activeSquare, dragX, dragY, isDragging, dragPieceCode]);
218
+ // Update drag target to current square
219
+ const square = xyToSquare(touchX, touchY, squareSize, orientation);
220
+ dragTargetSquare.value = square;
221
+ }, [squareSize, orientation, dragTargetSquare]);
222
+ const handleDragUpdate = useCallback((touchX, touchY) => {
223
+ // Update drag target square (for highlight). This runs on JS thread
224
+ // but is called from worklet via runOnJS only when the square changes.
225
+ const square = xyToSquare(touchX, touchY, squareSize, orientation);
226
+ dragTargetSquare.value = square;
227
+ }, [squareSize, orientation, dragTargetSquare]);
102
228
  const handleEnd = useCallback((touchX, touchY) => {
103
229
  const fromSquare = activeSquare.value;
104
230
  if (!fromSquare) return;
105
231
  const toSquare = xyToSquare(touchX, touchY, squareSize, orientation);
106
232
  isDragging.value = false;
233
+ dragTargetSquare.value = null;
234
+ const rich = richCallbacksRef.current;
235
+
236
+ // Fire drag end callback
237
+ const dragged = draggedPieceRef.current;
238
+ if (dragged) {
239
+ rich?.onPieceDragEnd?.(toSquare, dragged.code);
240
+ draggedPieceRef.current = null;
241
+ }
107
242
  if (fromSquare !== toSquare) {
108
- callbacksRef.current.onPieceMoved(fromSquare, toSquare);
243
+ // Check if this is a premove (not your turn)
244
+ const turn = currentTurnRef.current;
245
+ const piece = piecesRef.current.find(p => p.square === fromSquare);
246
+ const isOwnTurn = piece && turn ? isPieceTurn(piece.color, turn) : true;
247
+ if (premovesEnabled && !isOwnTurn) {
248
+ premoveCallbacksRef.current?.onPremoveSet?.({
249
+ from: fromSquare,
250
+ to: toSquare
251
+ });
252
+ } else {
253
+ callbacksRef.current.onPieceMoved(fromSquare, toSquare);
254
+ }
109
255
  }
110
256
  activeSquare.value = null;
111
257
  dragPieceCode.value = null;
112
- }, [squareSize, orientation, activeSquare, isDragging, dragPieceCode]);
258
+ }, [squareSize, orientation, activeSquare, isDragging, dragPieceCode, dragTargetSquare, premovesEnabled]);
259
+
260
+ // Long press handler (separate gesture, composed with pan)
261
+ const handleLongPress = useCallback((touchX, touchY) => {
262
+ const square = xyToSquare(touchX, touchY, squareSize, orientation);
263
+ richCallbacksRef.current?.onSquareLongPress?.(square);
264
+ }, [squareSize, orientation]);
113
265
 
114
266
  // --- Build the gesture (STABLE — only changes on layout/config changes) ---
115
267
  const canDrag = moveMethod !== 'click';
268
+
269
+ // Track the last drag target square to avoid redundant runOnJS calls
270
+ const lastDragTargetCol = useSharedValue(-1);
271
+ const lastDragTargetRow = useSharedValue(-1);
116
272
  const gesture = useMemo(() => {
117
273
  return Gesture.Pan().enabled(gestureEnabled).minDistance(0) // Also detect taps (zero-distance pans)
118
274
  .onBegin(e => {
@@ -120,11 +276,12 @@ export function useBoardGesture({
120
276
 
121
277
  // Bridge to JS for piece lookup + selection logic
122
278
  runOnJS(handleBegin)(e.x, e.y);
123
- }).onStart(() => {
279
+ }).onStart(e => {
124
280
  'worklet';
125
281
 
126
282
  if (!canDrag || !activeSquare.value) return;
127
283
  isDragging.value = true;
284
+ runOnJS(handleDragStart)(e.x, e.y);
128
285
  }).onUpdate(e => {
129
286
  'worklet';
130
287
 
@@ -132,6 +289,15 @@ export function useBoardGesture({
132
289
  // Only 2 shared value writes — no JS bridge, no re-renders
133
290
  dragX.value = e.x;
134
291
  dragY.value = e.y;
292
+
293
+ // Update drag target square (only when square changes to minimize JS bridge calls)
294
+ const col = Math.max(0, Math.min(7, Math.floor(e.x / squareSize)));
295
+ const row = Math.max(0, Math.min(7, Math.floor(e.y / squareSize)));
296
+ if (col !== lastDragTargetCol.value || row !== lastDragTargetRow.value) {
297
+ lastDragTargetCol.value = col;
298
+ lastDragTargetRow.value = row;
299
+ runOnJS(handleDragUpdate)(e.x, e.y);
300
+ }
135
301
  }).onEnd(e => {
136
302
  'worklet';
137
303
 
@@ -142,10 +308,18 @@ export function useBoardGesture({
142
308
 
143
309
  // Safety reset if gesture was interrupted
144
310
  isDragging.value = false;
311
+ dragTargetSquare.value = null;
312
+ lastDragTargetCol.value = -1;
313
+ lastDragTargetRow.value = -1;
145
314
  });
146
- }, [gestureEnabled, canDrag, handleBegin, handleEnd,
315
+ }, [gestureEnabled, canDrag, squareSize, handleBegin, handleDragStart, handleDragUpdate, handleEnd,
147
316
  // Shared values are stable refs — listed for exhaustive-deps but don't cause recreations
148
- activeSquare, dragX, dragY, isDragging]);
317
+ activeSquare, dragX, dragY, isDragging, dragTargetSquare, lastDragTargetCol, lastDragTargetRow]);
318
+
319
+ // Compose with long press if the consumer wants it
320
+ // For now, long press is detected via a separate gesture that runs simultaneously.
321
+ // This is done at the board level if needed — keeping the pan gesture clean here.
322
+
149
323
  return {
150
324
  gesture,
151
325
  gestureState
@@ -1 +1 @@
1
- {"version":3,"names":["useMemo","useCallback","useRef","Gesture","useSharedValue","runOnJS","xyToSquare","useBoardGesture","squareSize","orientation","gestureEnabled","player","moveMethod","pieces","callbacks","selectedSquare","legalMoves","activeSquare","dragX","dragY","isDragging","dragPieceCode","gestureState","piecesRef","current","selectedSquareRef","legalMovesRef","callbacksRef","handleBegin","touchX","touchY","square","currentPieces","currentSelected","currentLegalMoves","cbs","canClick","piece","find","p","isPlayerPiece","color","legalSquares","Set","map","m","has","onPieceMoved","value","code","onPieceSelected","onSelectionCleared","handleEnd","fromSquare","toSquare","canDrag","gesture","Pan","enabled","minDistance","onBegin","e","x","y","onStart","onUpdate","onEnd","onFinalize"],"sourceRoot":"..\\..\\src","sources":["use-board-gesture.ts"],"mappings":";;AAAA,SAASA,OAAO,EAAEC,WAAW,EAAEC,MAAM,QAAQ,OAAO;AACpD,SAASC,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C,CAACE,CAAC,CAAC;IAChC,CAAC,CAAC,CACDC,OAAO,CAAC,MAAM;MACb,SAAS;;MACT,IAAI,CAACT,OAAO,IAAI,CAACtC,YAAY,CAAC+B,KAAK,EAAE;MACrC5B,UAAU,CAAC4B,KAAK,GAAG,IAAI;IACzB,CAAC,CAAC,CACDiB,QAAQ,CAAEJ,CAAC,IAAK;MACf,SAAS;;MACT,IAAI,CAACN,OAAO,IAAI,CAACnC,UAAU,CAAC4B,KAAK,EAAE;MACnC;MACA9B,KAAK,CAAC8B,KAAK,GAAGa,CAAC,CAACC,CAAC;MACjB3C,KAAK,CAAC6B,KAAK,GAAGa,CAAC,CAACE,CAAC;IACnB,CAAC,CAAC,CACDG,KAAK,CAAEL,CAAC,IAAK;MACZ,SAAS;;MACT,IAAI,CAACzC,UAAU,CAAC4B,KAAK,IAAI,CAAC/B,YAAY,CAAC+B,KAAK,EAAE;MAC9C3C,OAAO,CAAC+C,SAAS,CAAC,CAACS,CAAC,CAACC,CAAC,EAAED,CAAC,CAACE,CAAC,CAAC;IAC9B,CAAC,CAAC,CACDI,UAAU,CAAC,MAAM;MAChB,SAAS;;MACT;MACA/C,UAAU,CAAC4B,KAAK,GAAG,KAAK;IAC1B,CAAC,CAAC;EACN,CAAC,EAAE,CACDtC,cAAc,EACd6C,OAAO,EACP3B,WAAW,EACXwB,SAAS;EACT;EACAnC,YAAY,EACZC,KAAK,EACLC,KAAK,EACLC,UAAU,CACX,CAAC;EAEF,OAAO;IAAEoC,OAAO;IAAElC;EAAa,CAAC;AAClC","ignoreList":[]}
1
+ {"version":3,"names":["useMemo","useCallback","useRef","Gesture","useSharedValue","runOnJS","xyToSquare","isPieceTurn","pieceColor","currentTurn","pieceColorToPlayer","color","useBoardGesture","squareSize","orientation","gestureEnabled","player","moveMethod","pieces","callbacks","richCallbacks","premoveCallbacks","premovesEnabled","selectedSquare","legalMoves","activeSquare","dragX","dragY","isDragging","dragPieceCode","dragTargetSquare","gestureState","piecesRef","current","selectedSquareRef","legalMovesRef","callbacksRef","richCallbacksRef","premoveCallbacksRef","currentTurnRef","draggedPieceRef","handleBegin","touchX","touchY","square","currentPieces","currentSelected","currentLegalMoves","cbs","rich","canClick","piece","find","p","isPlayerPiece","turn","isOwnTurn","legalSquares","Set","map","m","has","onPieceMoved","value","onHaptic","onPremoveSet","from","to","onSelectionCleared","code","onPieceSelected","onPieceClick","onSquareClick","handleDragStart","dragged","onPieceDragBegin","handleDragUpdate","handleEnd","fromSquare","toSquare","onPieceDragEnd","handleLongPress","onSquareLongPress","canDrag","lastDragTargetCol","lastDragTargetRow","gesture","Pan","enabled","minDistance","onBegin","e","x","y","onStart","onUpdate","col","Math","max","min","floor","row","onEnd","onFinalize"],"sourceRoot":"..\\..\\src","sources":["use-board-gesture.ts"],"mappings":";;AAAA,SAASA,OAAO,EAAEC,WAAW,EAAEC,MAAM,QAAQ,OAAO;AACpD,SAASC,OAAO,QAAQ,8BAA8B;AACtD,SACEC,cAAc,EACdC,OAAO,QACF,yBAAyB;AAYhC,SAASC,UAAU,QAAQ,oBAAoB;;AAE/C;AACA;AACA;;AAQA;;AAUA;;AAKA;AACA;AACA;;AA2BA;AACA;AACA;;AAEA;AACA,SAASC,WAAWA,CAACC,UAAqB,EAAEC,WAAsB,EAAW;EAC3E,OAAOD,UAAU,KAAKC,WAAW;AACnC;;AAEA;AACA,SAASC,kBAAkBA,CAACC,KAAgB,EAAc;EACxD,OAAOA,KAAK,KAAK,GAAG,GAAG,OAAO,GAAG,OAAO;AAC1C;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAAC;EAC9BC,UAAU;EACVC,WAAW;EACXC,cAAc;EACdC,MAAM;EACNC,UAAU;EACVC,MAAM;EACNC,SAAS;EACTC,aAAa;EACbC,gBAAgB;EAChBC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,KAAKhB,iBAAiB,CAACtB,KAAK,EAAE;QACtEqB,iBAAiB,CAACrB,KAAK,GAAGiC,GAAG;QAC7BX,iBAAiB,CAACtB,KAAK,GAAGsC,GAAG;QAC7BhG,OAAO,CAACuE,gBAAgB,CAAC,CAACe,CAAC,CAACC,CAAC,EAAED,CAAC,CAACE,CAAC,CAAC;MACrC;IACF,CAAC,CAAC,CACDS,KAAK,CAAEX,CAAC,IAAK;MACZ,SAAS;;MACT,IAAI,CAAC/D,UAAU,CAACmC,KAAK,IAAI,CAACtC,YAAY,CAACsC,KAAK,EAAE;MAC9C1D,OAAO,CAACwE,SAAS,CAAC,CAACc,CAAC,CAACC,CAAC,EAAED,CAAC,CAACE,CAAC,CAAC;IAC9B,CAAC,CAAC,CACDU,UAAU,CAAC,MAAM;MAChB,SAAS;;MACT;MACA3E,UAAU,CAACmC,KAAK,GAAG,KAAK;MACxBjC,gBAAgB,CAACiC,KAAK,GAAG,IAAI;MAC7BqB,iBAAiB,CAACrB,KAAK,GAAG,CAAC,CAAC;MAC5BsB,iBAAiB,CAACtB,KAAK,GAAG,CAAC,CAAC;IAC9B,CAAC,CAAC;EACN,CAAC,EAAE,CACDhD,cAAc,EACdoE,OAAO,EACPtE,UAAU,EACV4B,WAAW,EACXgC,eAAe,EACfG,gBAAgB,EAChBC,SAAS;EACT;EACApD,YAAY,EACZC,KAAK,EACLC,KAAK,EACLC,UAAU,EACVE,gBAAgB,EAChBsD,iBAAiB,EACjBC,iBAAiB,CAClB,CAAC;;EAEF;EACA;EACA;;EAEA,OAAO;IAAEC,OAAO;IAAEvD;EAAa,CAAC;AAClC","ignoreList":[]}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ import { useState, useCallback } from 'react';
4
+ /**
5
+ * Manages a single premove queue (one premove at a time).
6
+ *
7
+ * Premoves work like lichess:
8
+ * 1. When it's not your turn, you can drag/click a move — it queues as a premove
9
+ * 2. The premove squares are highlighted with a distinct color
10
+ * 3. When your turn begins (FEN changes and it's now your turn), the premove
11
+ * is automatically attempted via the board's internal chess.js
12
+ * 4. If the premove is legal, it's applied; if not, it's silently discarded
13
+ *
14
+ * The board.tsx orchestrates this: it calls consumePremove() in a useEffect
15
+ * that watches the FEN (turn change), then attempts the move.
16
+ */
17
+ export function usePremove() {
18
+ const [premove, setPremoveState] = useState(null);
19
+ const setPremove = useCallback(pm => {
20
+ setPremoveState(pm);
21
+ }, []);
22
+ const clearPremove = useCallback(() => {
23
+ setPremoveState(null);
24
+ }, []);
25
+ const consumePremove = useCallback(() => {
26
+ let consumed = null;
27
+ setPremoveState(current => {
28
+ consumed = current;
29
+ return null;
30
+ });
31
+ return consumed;
32
+ }, []);
33
+ return {
34
+ premove,
35
+ setPremove,
36
+ clearPremove,
37
+ consumePremove
38
+ };
39
+ }
40
+ //# sourceMappingURL=use-premove.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useState","useCallback","usePremove","premove","setPremoveState","setPremove","pm","clearPremove","consumePremove","consumed","current"],"sourceRoot":"..\\..\\src","sources":["use-premove.ts"],"mappings":";;AAAA,SAASA,QAAQ,EAAEC,WAAW,QAAQ,OAAO;AAmB7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,UAAUA,CAAA,EAAqB;EAC7C,MAAM,CAACC,OAAO,EAAEC,eAAe,CAAC,GAAGJ,QAAQ,CAAqB,IAAI,CAAC;EAErE,MAAMK,UAAU,GAAGJ,WAAW,CAAEK,EAAe,IAAK;IAClDF,eAAe,CAACE,EAAE,CAAC;EACrB,CAAC,EAAE,EAAE,CAAC;EAEN,MAAMC,YAAY,GAAGN,WAAW,CAAC,MAAM;IACrCG,eAAe,CAAC,IAAI,CAAC;EACvB,CAAC,EAAE,EAAE,CAAC;EAEN,MAAMI,cAAc,GAAGP,WAAW,CAAC,MAA0B;IAC3D,IAAIQ,QAA4B,GAAG,IAAI;IACvCL,eAAe,CAAEM,OAAO,IAAK;MAC3BD,QAAQ,GAAGC,OAAO;MAClB,OAAO,IAAI;IACb,CAAC,CAAC;IACF,OAAOD,QAAQ;EACjB,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO;IACLN,OAAO;IACPE,UAAU;IACVE,YAAY;IACZC;EACF,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import type { ChessColor, AnnotationData } from './types';
3
+ type BoardAnnotationsProps = {
4
+ boardSize: number;
5
+ orientation: ChessColor;
6
+ squareSize: number;
7
+ annotations: AnnotationData[];
8
+ };
9
+ /**
10
+ * Text annotation badges on chess squares (!, ?, !!, ??, etc.).
11
+ *
12
+ * Each annotation appears as a small colored badge at the top-right
13
+ * corner of the target square. Positioned absolutely, pointer-events none.
14
+ */
15
+ export declare const BoardAnnotations: React.NamedExoticComponent<BoardAnnotationsProps>;
16
+ type AnnotationBadgeProps = {
17
+ square: string;
18
+ text: string;
19
+ squareSize: number;
20
+ orientation: ChessColor;
21
+ color?: string;
22
+ backgroundColor?: string;
23
+ };
24
+ /**
25
+ * Single annotation badge component.
26
+ * Exported for consumers who build their own overlay layers.
27
+ */
28
+ export declare const Annotation: React.NamedExoticComponent<AnnotationBadgeProps>;
29
+ export {};
30
+ //# sourceMappingURL=board-annotations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"board-annotations.d.ts","sourceRoot":"","sources":["../../src/board-annotations.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAQ1D,KAAK,qBAAqB,GAAG;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,UAAU,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,cAAc,EAAE,CAAC;CAC/B,CAAC;AAMF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,mDAuD3B,CAAC;AAMH,KAAK,oBAAoB,GAAG;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,UAAU,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,UAAU,kDA4CrB,CAAC"}
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import type { ChessColor, ArrowData, ShapeData } from './types';
3
+ type BoardArrowsProps = {
4
+ boardSize: number;
5
+ orientation: ChessColor;
6
+ arrows?: ArrowData[];
7
+ shapes?: ShapeData[];
8
+ };
9
+ /**
10
+ * SVG overlay for arrows and shapes drawn on the board.
11
+ *
12
+ * Uses a percentage-based 100x100 viewBox so coordinates map cleanly
13
+ * to the 8x8 grid (each square = 12.5 x 12.5 units).
14
+ *
15
+ * Renders above the pieces layer so arrows are always visible.
16
+ */
17
+ export declare const BoardArrows: React.NamedExoticComponent<BoardArrowsProps>;
18
+ type ArrowSvgProps = {
19
+ from: string;
20
+ to: string;
21
+ color: string;
22
+ width: number;
23
+ orientation: ChessColor;
24
+ };
25
+ declare const ArrowSvg: React.NamedExoticComponent<ArrowSvgProps>;
26
+ export { ArrowSvg as Arrow };
27
+ //# sourceMappingURL=board-arrows.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"board-arrows.d.ts","sourceRoot":"","sources":["../../src/board-arrows.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAmDhE,KAAK,gBAAgB,GAAG;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,UAAU,CAAC;IACxB,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC;IACrB,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC;CACtB,CAAC;AAMF;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,8CAsDtB,CAAC;AAMH,KAAK,aAAa,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,UAAU,CAAC;CACzB,CAAC;AAEF,QAAA,MAAM,QAAQ,2CAgDZ,CAAC;AAMH,OAAO,EAAE,QAAQ,IAAI,KAAK,EAAE,CAAC"}
@@ -0,0 +1,65 @@
1
+ import React from 'react';
2
+ import { type SharedValue } from 'react-native-reanimated';
3
+ import type { ChessColor, HighlightData } from './types';
4
+ type BoardHighlightsProps = {
5
+ boardSize: number;
6
+ orientation: ChessColor;
7
+ squareSize: number;
8
+ /** Last move squares to highlight */
9
+ lastMove?: {
10
+ from: string;
11
+ to: string;
12
+ } | null;
13
+ lastMoveColor: string;
14
+ /** Check highlight on king square (auto-detected) */
15
+ checkSquare?: string | null;
16
+ checkColor: string;
17
+ /** Selected piece square */
18
+ selectedSquare?: string | null;
19
+ selectedColor: string;
20
+ /** Premove squares */
21
+ premoveSquares?: {
22
+ from: string;
23
+ to: string;
24
+ } | null;
25
+ premoveColor: string;
26
+ /** Custom highlights from consumer */
27
+ highlights?: HighlightData[];
28
+ /** Imperative highlights (from ref.highlight()) */
29
+ imperativeHighlights?: HighlightData[];
30
+ };
31
+ type DragTargetHighlightProps = {
32
+ squareSize: number;
33
+ orientation: ChessColor;
34
+ dragTargetSquare: SharedValue<string | null>;
35
+ color: string;
36
+ };
37
+ /**
38
+ * Renders all board square highlights as a single layer.
39
+ *
40
+ * Combines multiple highlight sources (last move, check, selected piece,
41
+ * premoves, custom, and imperative) into one flat list of colored rectangles.
42
+ * Rendered between the background and pieces layers.
43
+ *
44
+ * Uses plain Views (not Animated) because highlights change discretely
45
+ * on move events, not during animation frames.
46
+ */
47
+ export declare const BoardHighlights: React.NamedExoticComponent<BoardHighlightsProps>;
48
+ /**
49
+ * Highlight on the square currently under the dragged piece.
50
+ * Uses Reanimated shared values for zero-JS-bridge updates during drag.
51
+ */
52
+ export declare const DragTargetHighlight: React.NamedExoticComponent<DragTargetHighlightProps>;
53
+ type SquareHighlightProps = {
54
+ square: string;
55
+ color: string;
56
+ squareSize: number;
57
+ orientation: ChessColor;
58
+ };
59
+ /**
60
+ * Single square highlight component.
61
+ * Exported for consumers who build their own overlay layers.
62
+ */
63
+ export declare const SquareHighlight: React.NamedExoticComponent<SquareHighlightProps>;
64
+ export {};
65
+ //# sourceMappingURL=board-highlights.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"board-highlights.d.ts","sourceRoot":"","sources":["../../src/board-highlights.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAiB,EAEf,KAAK,WAAW,EACjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAOzD,KAAK,oBAAoB,GAAG;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,UAAU,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,qCAAqC;IACrC,QAAQ,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC/C,aAAa,EAAE,MAAM,CAAC;IACtB,qDAAqD;IACrD,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,4BAA4B;IAC5B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,sBAAsB;IACtB,cAAc,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACrD,YAAY,EAAE,MAAM,CAAC;IACrB,sCAAsC;IACtC,UAAU,CAAC,EAAE,aAAa,EAAE,CAAC;IAC7B,mDAAmD;IACnD,oBAAoB,CAAC,EAAE,aAAa,EAAE,CAAC;CACxC,CAAC;AAEF,KAAK,wBAAwB,GAAG;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,UAAU,CAAC;IACxB,gBAAgB,EAAE,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC7C,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAMF;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,kDA+E1B,CAAC;AAMH;;;GAGG;AACH,eAAO,MAAM,mBAAmB,sDAyC9B,CAAC;AAMH,KAAK,oBAAoB,GAAG;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,UAAU,CAAC;CACzB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,kDAqB1B,CAAC"}
@@ -1,13 +1,16 @@
1
1
  import React from 'react';
2
2
  import { type SharedValue } from 'react-native-reanimated';
3
+ import type { AnimationConfig } from './types';
3
4
  type BoardPieceProps = {
4
5
  /** Target pixel position (top-left of destination square) */
5
6
  targetX: number;
6
7
  targetY: number;
7
8
  /** Square size in pixels */
8
9
  squareSize: number;
9
- /** Move animation duration in ms */
10
- moveDuration: number;
10
+ /** Animation config for piece movement (timing or spring) */
11
+ animationConfig?: AnimationConfig;
12
+ /** Fallback move duration if animationConfig not provided */
13
+ moveDuration?: number;
11
14
  /** The piece visual (rendered by parent via renderPiece) */
12
15
  children: React.ReactElement;
13
16
  /** Gesture state: is this piece currently being dragged? */
@@ -19,17 +22,24 @@ type BoardPieceProps = {
19
22
  /**
20
23
  * A single animated chess piece.
21
24
  *
22
- * Animates ONLY `transform` and `opacity` Reanimated's fast path on Android.
23
- * No layout properties (top/left/width/height) are animated, avoiding costly
24
- * layout recalculations on low-end devices.
25
+ * Uses two nested Animated.Views to avoid the Reanimated warning
26
+ * "Property opacity may be overwritten by a layout animation":
27
+ *
28
+ * Outer view: position (transform) + exiting layout animation (FadeOut)
29
+ * Inner view: drag-hide opacity
30
+ *
31
+ * Only `transform` and `opacity` are animated — Reanimated's fast path
32
+ * on Android. No layout properties (top/left/width/height), avoiding
33
+ * costly layout recalculations on low-end devices.
25
34
  *
26
35
  * During drag:
27
- * - Original piece hides (opacity: 0) — the drag ghost shows instead
28
- * - No position changes on the original piece during drag
36
+ * - Inner view hides (opacity: 0) — the drag ghost shows instead
29
37
  *
30
38
  * After a move:
31
- * - Snaps to new position via withTiming on translateX/translateY
32
- * - Duration controlled by user's animation speed setting
39
+ * - Outer view snaps to new position via withTiming/withSpring
40
+ *
41
+ * On capture (unmount):
42
+ * - Outer view fades out via exiting FadeOut (no conflict with inner opacity)
33
43
  */
34
44
  export declare const BoardPieceView: React.NamedExoticComponent<BoardPieceProps>;
35
45
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"board-piece.d.ts","sourceRoot":"","sources":["../../src/board-piece.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AACzC,OAAiB,EAIf,KAAK,WAAW,EACjB,MAAM,yBAAyB,CAAC;AAEjC,KAAK,eAAe,GAAG;IACrB,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,4BAA4B;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,oCAAoC;IACpC,YAAY,EAAE,MAAM,CAAC;IACrB,4DAA4D;IAC5D,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC;IAC7B,4DAA4D;IAC5D,YAAY,EAAE,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACzC,UAAU,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IACjC,kCAAkC;IAClC,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,cAAc,6CA+D1B,CAAC"}
1
+ {"version":3,"file":"board-piece.d.ts","sourceRoot":"","sources":["../../src/board-piece.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AACzC,OAAiB,EAMf,KAAK,WAAW,EACjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG/C,KAAK,eAAe,GAAG;IACrB,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,4BAA4B;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,6DAA6D;IAC7D,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,6DAA6D;IAC7D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4DAA4D;IAC5D,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC;IAC7B,4DAA4D;IAC5D,YAAY,EAAE,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACzC,UAAU,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IACjC,kCAAkC;IAClC,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AA8BF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,cAAc,6CAqE1B,CAAC"}
@@ -1,11 +1,12 @@
1
1
  import React from 'react';
2
2
  import type { SharedValue } from 'react-native-reanimated';
3
- import type { ChessColor, BoardPiece } from './types';
3
+ import type { ChessColor, BoardPiece, AnimationConfig } from './types';
4
4
  type BoardPiecesProps = {
5
5
  pieces: BoardPiece[];
6
6
  squareSize: number;
7
7
  orientation: ChessColor;
8
8
  moveDuration: number;
9
+ animationConfig?: AnimationConfig;
9
10
  renderPiece: (code: string, size: number) => React.ReactElement;
10
11
  activeSquare: SharedValue<string | null>;
11
12
  isDragging: SharedValue<boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"board-pieces.d.ts","sourceRoot":"","sources":["../../src/board-pieces.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAItD,KAAK,gBAAgB,GAAG;IACtB,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,UAAU,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,KAAK,CAAC,YAAY,CAAC;IAChE,YAAY,EAAE,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACzC,UAAU,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CAClC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,8CA+B3B,CAAC"}
1
+ {"version":3,"file":"board-pieces.d.ts","sourceRoot":"","sources":["../../src/board-pieces.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAIvE,KAAK,gBAAgB,GAAG;IACtB,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,UAAU,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,KAAK,CAAC,YAAY,CAAC;IAChE,YAAY,EAAE,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACzC,UAAU,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CAClC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,8CAiC3B,CAAC"}
@@ -10,8 +10,17 @@ import type { BoardRef, BoardProps } from './types';
10
10
  * - 0 React Context providers
11
11
  * - 0 re-renders during drag (pure worklet — only 2 shared value writes per frame)
12
12
  *
13
- * Follows chess.com/lichess pattern: single gesture receiver on the board,
14
- * coordinate math to determine touched piece, shared values for drag state.
13
+ * v0.2.0 layer stack (10 layers):
14
+ * 1. BoardBackground (64 squares)
15
+ * 2. BoardCoordinates (a-h, 1-8)
16
+ * 3. BoardHighlights (last move, check, selected, premove, custom, imperative)
17
+ * 4. DragTargetHighlight (animated, worklet-driven)
18
+ * 5. BoardLegalDots (legal move indicators)
19
+ * 6. BoardPiecesLayer (all pieces)
20
+ * 7. BoardArrows (SVG arrows + circles)
21
+ * 8. BoardAnnotations (text badges)
22
+ * 9. BoardDragGhost (floating piece)
23
+ * 10. PromotionPicker (modal, conditional)
15
24
  */
16
25
  export declare const Board: React.ForwardRefExoticComponent<BoardProps & React.RefAttributes<BoardRef>>;
17
26
  //# sourceMappingURL=board.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"board.d.ts","sourceRoot":"","sources":["../../src/board.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4E,MAAM,OAAO,CAAC;AAIjG,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAmB,MAAM,SAAS,CAAC;AAUrE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,KAAK,6EA+KhB,CAAC"}
1
+ {"version":3,"file":"board.d.ts","sourceRoot":"","sources":["../../src/board.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;AASf,OAAO,KAAK,EACV,QAAQ,EACR,UAAU,EAKX,MAAM,SAAS,CAAC;AAoEjB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,KAAK,6EAwfhB,CAAC"}