react-native-chess-kit 0.5.0 → 0.5.2
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/LICENSE +21 -21
- package/README.md +168 -168
- package/lib/commonjs/board-annotations.js +8 -8
- package/lib/commonjs/board-arrows.js +2 -2
- package/lib/commonjs/board-arrows.js.map +1 -1
- package/lib/commonjs/board-background.js +5 -5
- package/lib/commonjs/board-coordinates.js +8 -8
- package/lib/commonjs/board-drag-ghost.js +10 -10
- package/lib/commonjs/board-highlights.js +15 -15
- package/lib/commonjs/board-legal-dots.js +5 -5
- package/lib/commonjs/board-piece.js +25 -25
- package/lib/commonjs/board-pieces.js +6 -6
- package/lib/commonjs/board.js +24 -24
- package/lib/commonjs/promotion-picker.js +8 -8
- package/lib/commonjs/static-board.js +7 -7
- package/lib/commonjs/use-board-gesture.js +52 -33
- package/lib/commonjs/use-board-gesture.js.map +1 -1
- package/lib/commonjs/use-board-pieces.js +15 -15
- package/lib/commonjs/use-board-state.js +8 -8
- package/lib/commonjs/use-premove.js +12 -12
- package/lib/module/board-annotations.js +8 -8
- package/lib/module/board-arrows.js +2 -2
- package/lib/module/board-arrows.js.map +1 -1
- package/lib/module/board-background.js +5 -5
- package/lib/module/board-coordinates.js +8 -8
- package/lib/module/board-drag-ghost.js +10 -10
- package/lib/module/board-highlights.js +15 -15
- package/lib/module/board-legal-dots.js +5 -5
- package/lib/module/board-piece.js +25 -25
- package/lib/module/board-pieces.js +6 -6
- package/lib/module/board.js +24 -24
- package/lib/module/promotion-picker.js +8 -8
- package/lib/module/static-board.js +7 -7
- package/lib/module/use-board-gesture.js +52 -33
- package/lib/module/use-board-gesture.js.map +1 -1
- package/lib/module/use-board-pieces.js +15 -15
- package/lib/module/use-board-state.js +8 -8
- package/lib/module/use-premove.js +12 -12
- package/lib/typescript/use-board-gesture.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/board-annotations.tsx +147 -147
- package/src/board-arrows.tsx +2 -2
- package/src/board-background.tsx +46 -46
- package/src/board-coordinates.tsx +192 -192
- package/src/board-drag-ghost.tsx +132 -132
- package/src/board-highlights.tsx +226 -226
- package/src/board-legal-dots.tsx +73 -73
- package/src/board-piece.tsx +160 -160
- package/src/board-pieces.tsx +63 -63
- package/src/board.tsx +685 -685
- package/src/constants.ts +103 -103
- package/src/index.ts +101 -101
- package/src/pieces/default-pieces.tsx +383 -383
- package/src/pieces/index.ts +1 -1
- package/src/promotion-picker.tsx +147 -147
- package/src/static-board.tsx +187 -187
- package/src/themes.ts +129 -129
- package/src/types.ts +373 -373
- package/src/use-board-gesture.ts +429 -412
- package/src/use-board-pieces.ts +158 -158
- package/src/use-board-state.ts +111 -111
- package/src/use-premove.ts +59 -59
package/src/themes.ts
CHANGED
|
@@ -1,129 +1,129 @@
|
|
|
1
|
-
import type { BoardTheme, BoardColors } from './types';
|
|
2
|
-
|
|
3
|
-
// ---------------------------------------------------------------------------
|
|
4
|
-
// Board color presets (matching popular chess platforms)
|
|
5
|
-
// ---------------------------------------------------------------------------
|
|
6
|
-
|
|
7
|
-
const greenTheme: BoardTheme = {
|
|
8
|
-
name: 'Green',
|
|
9
|
-
board: { light: '#eeeed2', dark: '#769656' },
|
|
10
|
-
lastMove: 'rgba(255, 255, 0, 0.4)',
|
|
11
|
-
check: 'rgba(235, 97, 80, 0.8)',
|
|
12
|
-
selected: 'rgba(20, 85, 200, 0.5)',
|
|
13
|
-
legalDot: 'rgba(0, 0, 0, 0.25)',
|
|
14
|
-
premove: 'rgba(20, 85, 200, 0.3)',
|
|
15
|
-
arrow: 'rgba(243, 166, 50, 0.85)',
|
|
16
|
-
coordinates: { light: '#769656', dark: '#eeeed2' },
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const brownTheme: BoardTheme = {
|
|
20
|
-
name: 'Brown',
|
|
21
|
-
board: { light: '#f0d9b5', dark: '#b58863' },
|
|
22
|
-
lastMove: 'rgba(255, 255, 0, 0.4)',
|
|
23
|
-
check: 'rgba(235, 97, 80, 0.8)',
|
|
24
|
-
selected: 'rgba(20, 85, 200, 0.5)',
|
|
25
|
-
legalDot: 'rgba(0, 0, 0, 0.25)',
|
|
26
|
-
premove: 'rgba(20, 85, 200, 0.3)',
|
|
27
|
-
arrow: 'rgba(243, 166, 50, 0.85)',
|
|
28
|
-
coordinates: { light: '#b58863', dark: '#f0d9b5' },
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const blueTheme: BoardTheme = {
|
|
32
|
-
name: 'Blue',
|
|
33
|
-
board: { light: '#dee3e6', dark: '#8ca2ad' },
|
|
34
|
-
lastMove: 'rgba(255, 255, 0, 0.4)',
|
|
35
|
-
check: 'rgba(235, 97, 80, 0.8)',
|
|
36
|
-
selected: 'rgba(20, 85, 200, 0.5)',
|
|
37
|
-
legalDot: 'rgba(0, 0, 0, 0.25)',
|
|
38
|
-
premove: 'rgba(20, 85, 200, 0.3)',
|
|
39
|
-
arrow: 'rgba(243, 166, 50, 0.85)',
|
|
40
|
-
coordinates: { light: '#8ca2ad', dark: '#dee3e6' },
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const purpleTheme: BoardTheme = {
|
|
44
|
-
name: 'Purple',
|
|
45
|
-
board: { light: '#e8daf0', dark: '#9b72b0' },
|
|
46
|
-
lastMove: 'rgba(255, 255, 0, 0.4)',
|
|
47
|
-
check: 'rgba(235, 97, 80, 0.8)',
|
|
48
|
-
selected: 'rgba(20, 85, 200, 0.5)',
|
|
49
|
-
legalDot: 'rgba(0, 0, 0, 0.25)',
|
|
50
|
-
premove: 'rgba(20, 85, 200, 0.3)',
|
|
51
|
-
arrow: 'rgba(243, 166, 50, 0.85)',
|
|
52
|
-
coordinates: { light: '#9b72b0', dark: '#e8daf0' },
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const grayTheme: BoardTheme = {
|
|
56
|
-
name: 'Gray',
|
|
57
|
-
board: { light: '#e0e0e0', dark: '#888888' },
|
|
58
|
-
lastMove: 'rgba(255, 255, 0, 0.4)',
|
|
59
|
-
check: 'rgba(235, 97, 80, 0.8)',
|
|
60
|
-
selected: 'rgba(20, 85, 200, 0.5)',
|
|
61
|
-
legalDot: 'rgba(0, 0, 0, 0.25)',
|
|
62
|
-
premove: 'rgba(20, 85, 200, 0.3)',
|
|
63
|
-
arrow: 'rgba(243, 166, 50, 0.85)',
|
|
64
|
-
coordinates: { light: '#888888', dark: '#e0e0e0' },
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
const woodTheme: BoardTheme = {
|
|
68
|
-
name: 'Wood',
|
|
69
|
-
board: { light: '#e6c88c', dark: '#a67c52' },
|
|
70
|
-
lastMove: 'rgba(255, 255, 0, 0.35)',
|
|
71
|
-
check: 'rgba(235, 97, 80, 0.8)',
|
|
72
|
-
selected: 'rgba(20, 85, 200, 0.5)',
|
|
73
|
-
legalDot: 'rgba(0, 0, 0, 0.2)',
|
|
74
|
-
premove: 'rgba(20, 85, 200, 0.3)',
|
|
75
|
-
arrow: 'rgba(243, 166, 50, 0.85)',
|
|
76
|
-
coordinates: { light: '#a67c52', dark: '#e6c88c' },
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
const iceTheme: BoardTheme = {
|
|
80
|
-
name: 'Ice',
|
|
81
|
-
board: { light: '#e8f0f8', dark: '#7ba0c4' },
|
|
82
|
-
lastMove: 'rgba(255, 255, 0, 0.35)',
|
|
83
|
-
check: 'rgba(235, 97, 80, 0.8)',
|
|
84
|
-
selected: 'rgba(20, 85, 200, 0.5)',
|
|
85
|
-
legalDot: 'rgba(0, 0, 0, 0.25)',
|
|
86
|
-
premove: 'rgba(20, 85, 200, 0.3)',
|
|
87
|
-
arrow: 'rgba(243, 166, 50, 0.85)',
|
|
88
|
-
coordinates: { light: '#7ba0c4', dark: '#e8f0f8' },
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
const tournamentTheme: BoardTheme = {
|
|
92
|
-
name: 'Tournament',
|
|
93
|
-
board: { light: '#fffff0', dark: '#3d945e' },
|
|
94
|
-
lastMove: 'rgba(255, 255, 0, 0.4)',
|
|
95
|
-
check: 'rgba(235, 97, 80, 0.8)',
|
|
96
|
-
selected: 'rgba(20, 85, 200, 0.5)',
|
|
97
|
-
legalDot: 'rgba(0, 0, 0, 0.25)',
|
|
98
|
-
premove: 'rgba(20, 85, 200, 0.3)',
|
|
99
|
-
arrow: 'rgba(243, 166, 50, 0.85)',
|
|
100
|
-
coordinates: { light: '#3d945e', dark: '#fffff0' },
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
// ---------------------------------------------------------------------------
|
|
104
|
-
// Exports
|
|
105
|
-
// ---------------------------------------------------------------------------
|
|
106
|
-
|
|
107
|
-
/** All built-in board themes */
|
|
108
|
-
export const BOARD_THEMES = {
|
|
109
|
-
green: greenTheme,
|
|
110
|
-
brown: brownTheme,
|
|
111
|
-
blue: blueTheme,
|
|
112
|
-
purple: purpleTheme,
|
|
113
|
-
gray: grayTheme,
|
|
114
|
-
wood: woodTheme,
|
|
115
|
-
ice: iceTheme,
|
|
116
|
-
tournament: tournamentTheme,
|
|
117
|
-
} as const;
|
|
118
|
-
|
|
119
|
-
/** Shorthand board color presets (just light/dark, no overlay colors) */
|
|
120
|
-
export const BOARD_COLORS: Record<keyof typeof BOARD_THEMES, BoardColors> = {
|
|
121
|
-
green: greenTheme.board,
|
|
122
|
-
brown: brownTheme.board,
|
|
123
|
-
blue: blueTheme.board,
|
|
124
|
-
purple: purpleTheme.board,
|
|
125
|
-
gray: grayTheme.board,
|
|
126
|
-
wood: woodTheme.board,
|
|
127
|
-
ice: iceTheme.board,
|
|
128
|
-
tournament: tournamentTheme.board,
|
|
129
|
-
};
|
|
1
|
+
import type { BoardTheme, BoardColors } from './types';
|
|
2
|
+
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
// Board color presets (matching popular chess platforms)
|
|
5
|
+
// ---------------------------------------------------------------------------
|
|
6
|
+
|
|
7
|
+
const greenTheme: BoardTheme = {
|
|
8
|
+
name: 'Green',
|
|
9
|
+
board: { light: '#eeeed2', dark: '#769656' },
|
|
10
|
+
lastMove: 'rgba(255, 255, 0, 0.4)',
|
|
11
|
+
check: 'rgba(235, 97, 80, 0.8)',
|
|
12
|
+
selected: 'rgba(20, 85, 200, 0.5)',
|
|
13
|
+
legalDot: 'rgba(0, 0, 0, 0.25)',
|
|
14
|
+
premove: 'rgba(20, 85, 200, 0.3)',
|
|
15
|
+
arrow: 'rgba(243, 166, 50, 0.85)',
|
|
16
|
+
coordinates: { light: '#769656', dark: '#eeeed2' },
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const brownTheme: BoardTheme = {
|
|
20
|
+
name: 'Brown',
|
|
21
|
+
board: { light: '#f0d9b5', dark: '#b58863' },
|
|
22
|
+
lastMove: 'rgba(255, 255, 0, 0.4)',
|
|
23
|
+
check: 'rgba(235, 97, 80, 0.8)',
|
|
24
|
+
selected: 'rgba(20, 85, 200, 0.5)',
|
|
25
|
+
legalDot: 'rgba(0, 0, 0, 0.25)',
|
|
26
|
+
premove: 'rgba(20, 85, 200, 0.3)',
|
|
27
|
+
arrow: 'rgba(243, 166, 50, 0.85)',
|
|
28
|
+
coordinates: { light: '#b58863', dark: '#f0d9b5' },
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const blueTheme: BoardTheme = {
|
|
32
|
+
name: 'Blue',
|
|
33
|
+
board: { light: '#dee3e6', dark: '#8ca2ad' },
|
|
34
|
+
lastMove: 'rgba(255, 255, 0, 0.4)',
|
|
35
|
+
check: 'rgba(235, 97, 80, 0.8)',
|
|
36
|
+
selected: 'rgba(20, 85, 200, 0.5)',
|
|
37
|
+
legalDot: 'rgba(0, 0, 0, 0.25)',
|
|
38
|
+
premove: 'rgba(20, 85, 200, 0.3)',
|
|
39
|
+
arrow: 'rgba(243, 166, 50, 0.85)',
|
|
40
|
+
coordinates: { light: '#8ca2ad', dark: '#dee3e6' },
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const purpleTheme: BoardTheme = {
|
|
44
|
+
name: 'Purple',
|
|
45
|
+
board: { light: '#e8daf0', dark: '#9b72b0' },
|
|
46
|
+
lastMove: 'rgba(255, 255, 0, 0.4)',
|
|
47
|
+
check: 'rgba(235, 97, 80, 0.8)',
|
|
48
|
+
selected: 'rgba(20, 85, 200, 0.5)',
|
|
49
|
+
legalDot: 'rgba(0, 0, 0, 0.25)',
|
|
50
|
+
premove: 'rgba(20, 85, 200, 0.3)',
|
|
51
|
+
arrow: 'rgba(243, 166, 50, 0.85)',
|
|
52
|
+
coordinates: { light: '#9b72b0', dark: '#e8daf0' },
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const grayTheme: BoardTheme = {
|
|
56
|
+
name: 'Gray',
|
|
57
|
+
board: { light: '#e0e0e0', dark: '#888888' },
|
|
58
|
+
lastMove: 'rgba(255, 255, 0, 0.4)',
|
|
59
|
+
check: 'rgba(235, 97, 80, 0.8)',
|
|
60
|
+
selected: 'rgba(20, 85, 200, 0.5)',
|
|
61
|
+
legalDot: 'rgba(0, 0, 0, 0.25)',
|
|
62
|
+
premove: 'rgba(20, 85, 200, 0.3)',
|
|
63
|
+
arrow: 'rgba(243, 166, 50, 0.85)',
|
|
64
|
+
coordinates: { light: '#888888', dark: '#e0e0e0' },
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const woodTheme: BoardTheme = {
|
|
68
|
+
name: 'Wood',
|
|
69
|
+
board: { light: '#e6c88c', dark: '#a67c52' },
|
|
70
|
+
lastMove: 'rgba(255, 255, 0, 0.35)',
|
|
71
|
+
check: 'rgba(235, 97, 80, 0.8)',
|
|
72
|
+
selected: 'rgba(20, 85, 200, 0.5)',
|
|
73
|
+
legalDot: 'rgba(0, 0, 0, 0.2)',
|
|
74
|
+
premove: 'rgba(20, 85, 200, 0.3)',
|
|
75
|
+
arrow: 'rgba(243, 166, 50, 0.85)',
|
|
76
|
+
coordinates: { light: '#a67c52', dark: '#e6c88c' },
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const iceTheme: BoardTheme = {
|
|
80
|
+
name: 'Ice',
|
|
81
|
+
board: { light: '#e8f0f8', dark: '#7ba0c4' },
|
|
82
|
+
lastMove: 'rgba(255, 255, 0, 0.35)',
|
|
83
|
+
check: 'rgba(235, 97, 80, 0.8)',
|
|
84
|
+
selected: 'rgba(20, 85, 200, 0.5)',
|
|
85
|
+
legalDot: 'rgba(0, 0, 0, 0.25)',
|
|
86
|
+
premove: 'rgba(20, 85, 200, 0.3)',
|
|
87
|
+
arrow: 'rgba(243, 166, 50, 0.85)',
|
|
88
|
+
coordinates: { light: '#7ba0c4', dark: '#e8f0f8' },
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const tournamentTheme: BoardTheme = {
|
|
92
|
+
name: 'Tournament',
|
|
93
|
+
board: { light: '#fffff0', dark: '#3d945e' },
|
|
94
|
+
lastMove: 'rgba(255, 255, 0, 0.4)',
|
|
95
|
+
check: 'rgba(235, 97, 80, 0.8)',
|
|
96
|
+
selected: 'rgba(20, 85, 200, 0.5)',
|
|
97
|
+
legalDot: 'rgba(0, 0, 0, 0.25)',
|
|
98
|
+
premove: 'rgba(20, 85, 200, 0.3)',
|
|
99
|
+
arrow: 'rgba(243, 166, 50, 0.85)',
|
|
100
|
+
coordinates: { light: '#3d945e', dark: '#fffff0' },
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
// ---------------------------------------------------------------------------
|
|
104
|
+
// Exports
|
|
105
|
+
// ---------------------------------------------------------------------------
|
|
106
|
+
|
|
107
|
+
/** All built-in board themes */
|
|
108
|
+
export const BOARD_THEMES = {
|
|
109
|
+
green: greenTheme,
|
|
110
|
+
brown: brownTheme,
|
|
111
|
+
blue: blueTheme,
|
|
112
|
+
purple: purpleTheme,
|
|
113
|
+
gray: grayTheme,
|
|
114
|
+
wood: woodTheme,
|
|
115
|
+
ice: iceTheme,
|
|
116
|
+
tournament: tournamentTheme,
|
|
117
|
+
} as const;
|
|
118
|
+
|
|
119
|
+
/** Shorthand board color presets (just light/dark, no overlay colors) */
|
|
120
|
+
export const BOARD_COLORS: Record<keyof typeof BOARD_THEMES, BoardColors> = {
|
|
121
|
+
green: greenTheme.board,
|
|
122
|
+
brown: brownTheme.board,
|
|
123
|
+
blue: blueTheme.board,
|
|
124
|
+
purple: purpleTheme.board,
|
|
125
|
+
gray: grayTheme.board,
|
|
126
|
+
wood: woodTheme.board,
|
|
127
|
+
ice: iceTheme.board,
|
|
128
|
+
tournament: tournamentTheme.board,
|
|
129
|
+
};
|