gigaboard 1.2.3
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 -0
- package/README.md +27 -0
- package/dist/board-model-BvJOtwQ3.d.cts +675 -0
- package/dist/board-model-BvJOtwQ3.d.ts +675 -0
- package/dist/canvas.cjs +8 -0
- package/dist/canvas.cjs.map +1 -0
- package/dist/canvas.d.cts +14 -0
- package/dist/canvas.d.ts +14 -0
- package/dist/canvas.js +6 -0
- package/dist/canvas.js.map +1 -0
- package/dist/chunk-3HNIF4ZE.js +3 -0
- package/dist/chunk-3HNIF4ZE.js.map +1 -0
- package/dist/chunk-44YKPXXT.js +63 -0
- package/dist/chunk-44YKPXXT.js.map +1 -0
- package/dist/chunk-5WAOEWKS.js +16 -0
- package/dist/chunk-5WAOEWKS.js.map +1 -0
- package/dist/chunk-AYVQCHSG.cjs +10 -0
- package/dist/chunk-AYVQCHSG.cjs.map +1 -0
- package/dist/chunk-B26QLI2K.cjs +18 -0
- package/dist/chunk-B26QLI2K.cjs.map +1 -0
- package/dist/chunk-B2TBDDJN.cjs +10 -0
- package/dist/chunk-B2TBDDJN.cjs.map +1 -0
- package/dist/chunk-BFN5JI3T.js +8 -0
- package/dist/chunk-BFN5JI3T.js.map +1 -0
- package/dist/chunk-BWNBPN3P.cjs +10 -0
- package/dist/chunk-BWNBPN3P.cjs.map +1 -0
- package/dist/chunk-CXDGJMYL.js +105 -0
- package/dist/chunk-CXDGJMYL.js.map +1 -0
- package/dist/chunk-EOSX5UX3.js +8 -0
- package/dist/chunk-EOSX5UX3.js.map +1 -0
- package/dist/chunk-FNRS6YJI.cjs +67 -0
- package/dist/chunk-FNRS6YJI.cjs.map +1 -0
- package/dist/chunk-G6ZFOJZR.cjs +18 -0
- package/dist/chunk-G6ZFOJZR.cjs.map +1 -0
- package/dist/chunk-HSMILJKQ.cjs +18 -0
- package/dist/chunk-HSMILJKQ.cjs.map +1 -0
- package/dist/chunk-I4BQGFP5.cjs +113 -0
- package/dist/chunk-I4BQGFP5.cjs.map +1 -0
- package/dist/chunk-J6GGNP5S.js +1104 -0
- package/dist/chunk-J6GGNP5S.js.map +1 -0
- package/dist/chunk-JQSBAWIZ.cjs +4 -0
- package/dist/chunk-JQSBAWIZ.cjs.map +1 -0
- package/dist/chunk-KW56FEBY.js +8 -0
- package/dist/chunk-KW56FEBY.js.map +1 -0
- package/dist/chunk-N7ED2MZS.cjs +10 -0
- package/dist/chunk-N7ED2MZS.cjs.map +1 -0
- package/dist/chunk-NAA5O4BT.js +16 -0
- package/dist/chunk-NAA5O4BT.js.map +1 -0
- package/dist/chunk-OQLY5GJF.js +16 -0
- package/dist/chunk-OQLY5GJF.js.map +1 -0
- package/dist/chunk-P72B3YTG.js +16 -0
- package/dist/chunk-P72B3YTG.js.map +1 -0
- package/dist/chunk-U6WAD322.js +8 -0
- package/dist/chunk-U6WAD322.js.map +1 -0
- package/dist/chunk-UUTEFNFO.cjs +1148 -0
- package/dist/chunk-UUTEFNFO.cjs.map +1 -0
- package/dist/chunk-VYSVIIZA.cjs +18 -0
- package/dist/chunk-VYSVIIZA.cjs.map +1 -0
- package/dist/core.cjs +180 -0
- package/dist/core.cjs.map +1 -0
- package/dist/core.d.cts +164 -0
- package/dist/core.d.ts +164 -0
- package/dist/core.js +3 -0
- package/dist/core.js.map +1 -0
- package/dist/create-image-piece-set-BcmRKGql.d.cts +100 -0
- package/dist/create-image-piece-set-BcmRKGql.d.ts +100 -0
- package/dist/gigachess-3BDD--yT.d.cts +22 -0
- package/dist/gigachess-DolQlR82.d.ts +22 -0
- package/dist/index.cjs +2972 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +435 -0
- package/dist/index.d.ts +435 -0
- package/dist/index.js +2898 -0
- package/dist/index.js.map +1 -0
- package/dist/pieces/alpha.cjs +13 -0
- package/dist/pieces/alpha.cjs.map +1 -0
- package/dist/pieces/alpha.d.cts +17 -0
- package/dist/pieces/alpha.d.ts +17 -0
- package/dist/pieces/alpha.js +4 -0
- package/dist/pieces/alpha.js.map +1 -0
- package/dist/pieces/cburnett.cjs +13 -0
- package/dist/pieces/cburnett.cjs.map +1 -0
- package/dist/pieces/cburnett.d.cts +19 -0
- package/dist/pieces/cburnett.d.ts +19 -0
- package/dist/pieces/cburnett.js +4 -0
- package/dist/pieces/cburnett.js.map +1 -0
- package/dist/pieces/chesscom.cjs +14 -0
- package/dist/pieces/chesscom.cjs.map +1 -0
- package/dist/pieces/chesscom.d.cts +3 -0
- package/dist/pieces/chesscom.d.ts +3 -0
- package/dist/pieces/chesscom.js +5 -0
- package/dist/pieces/chesscom.js.map +1 -0
- package/dist/pieces/merida.cjs +13 -0
- package/dist/pieces/merida.cjs.map +1 -0
- package/dist/pieces/merida.d.cts +17 -0
- package/dist/pieces/merida.d.ts +17 -0
- package/dist/pieces/merida.js +4 -0
- package/dist/pieces/merida.js.map +1 -0
- package/dist/pieces/neo.cjs +13 -0
- package/dist/pieces/neo.cjs.map +1 -0
- package/dist/pieces/neo.d.cts +18 -0
- package/dist/pieces/neo.d.ts +18 -0
- package/dist/pieces/neo.js +4 -0
- package/dist/pieces/neo.js.map +1 -0
- package/dist/pieces.cjs +55 -0
- package/dist/pieces.cjs.map +1 -0
- package/dist/pieces.d.cts +21 -0
- package/dist/pieces.d.ts +21 -0
- package/dist/pieces.js +24 -0
- package/dist/pieces.js.map +1 -0
- package/dist/server.cjs +207 -0
- package/dist/server.cjs.map +1 -0
- package/dist/server.d.cts +60 -0
- package/dist/server.d.ts +60 -0
- package/dist/server.js +205 -0
- package/dist/server.js.map +1 -0
- package/dist/sounds/capture.mp3 +0 -0
- package/dist/sounds/castle.mp3 +0 -0
- package/dist/sounds/game-end.mp3 +0 -0
- package/dist/sounds/move-check.mp3 +0 -0
- package/dist/sounds/move-opponent.mp3 +0 -0
- package/dist/sounds/move-self.mp3 +0 -0
- package/dist/sounds/promote.mp3 +0 -0
- package/dist/themes/blue.cjs +12 -0
- package/dist/themes/blue.cjs.map +1 -0
- package/dist/themes/blue.d.cts +102 -0
- package/dist/themes/blue.d.ts +102 -0
- package/dist/themes/blue.js +3 -0
- package/dist/themes/blue.js.map +1 -0
- package/dist/themes/brown.cjs +12 -0
- package/dist/themes/brown.cjs.map +1 -0
- package/dist/themes/brown.d.cts +1 -0
- package/dist/themes/brown.d.ts +1 -0
- package/dist/themes/brown.js +3 -0
- package/dist/themes/brown.js.map +1 -0
- package/dist/themes/green.cjs +12 -0
- package/dist/themes/green.cjs.map +1 -0
- package/dist/themes/green.d.cts +1 -0
- package/dist/themes/green.d.ts +1 -0
- package/dist/themes/green.js +3 -0
- package/dist/themes/green.js.map +1 -0
- package/dist/themes/wood.cjs +12 -0
- package/dist/themes/wood.cjs.map +1 -0
- package/dist/themes/wood.d.cts +1 -0
- package/dist/themes/wood.d.ts +1 -0
- package/dist/themes/wood.js +3 -0
- package/dist/themes/wood.js.map +1 -0
- package/dist/themes.cjs +36 -0
- package/dist/themes.cjs.map +1 -0
- package/dist/themes.d.cts +1 -0
- package/dist/themes.d.ts +1 -0
- package/dist/themes.js +21 -0
- package/dist/themes.js.map +1 -0
- package/dist/types-Bg2xiUHE.d.cts +501 -0
- package/dist/types-D5eBJGzj.d.ts +501 -0
- package/package.json +210 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"brown.js"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkG6ZFOJZR_cjs = require('../chunk-G6ZFOJZR.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "green", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () { return chunkG6ZFOJZR_cjs.green; }
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=green.cjs.map
|
|
12
|
+
//# sourceMappingURL=green.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"green.cjs"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { g as green } from './blue.cjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { g as green } from './blue.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"green.js"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkVYSVIIZA_cjs = require('../chunk-VYSVIIZA.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "wood", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () { return chunkVYSVIIZA_cjs.wood; }
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=wood.cjs.map
|
|
12
|
+
//# sourceMappingURL=wood.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"wood.cjs"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { w as wood } from './blue.cjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { w as wood } from './blue.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"wood.js"}
|
package/dist/themes.cjs
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkHSMILJKQ_cjs = require('./chunk-HSMILJKQ.cjs');
|
|
4
|
+
var chunkB26QLI2K_cjs = require('./chunk-B26QLI2K.cjs');
|
|
5
|
+
var chunkVYSVIIZA_cjs = require('./chunk-VYSVIIZA.cjs');
|
|
6
|
+
var chunkG6ZFOJZR_cjs = require('./chunk-G6ZFOJZR.cjs');
|
|
7
|
+
|
|
8
|
+
// src/themes/index.ts
|
|
9
|
+
var themes = Object.freeze({
|
|
10
|
+
brown: chunkHSMILJKQ_cjs.brown,
|
|
11
|
+
blue: chunkB26QLI2K_cjs.blue,
|
|
12
|
+
green: chunkG6ZFOJZR_cjs.green,
|
|
13
|
+
wood: chunkVYSVIIZA_cjs.wood
|
|
14
|
+
});
|
|
15
|
+
var PACKAGE_VERSION = "0.1.0-alpha";
|
|
16
|
+
|
|
17
|
+
Object.defineProperty(exports, "brown", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return chunkHSMILJKQ_cjs.brown; }
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(exports, "blue", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () { return chunkB26QLI2K_cjs.blue; }
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(exports, "wood", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () { return chunkVYSVIIZA_cjs.wood; }
|
|
28
|
+
});
|
|
29
|
+
Object.defineProperty(exports, "green", {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function () { return chunkG6ZFOJZR_cjs.green; }
|
|
32
|
+
});
|
|
33
|
+
exports.PACKAGE_VERSION = PACKAGE_VERSION;
|
|
34
|
+
exports.themes = themes;
|
|
35
|
+
//# sourceMappingURL=themes.cjs.map
|
|
36
|
+
//# sourceMappingURL=themes.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/themes/index.ts"],"names":["brown","blue","green","wood"],"mappings":";;;;;;;;AAoCO,IAAM,MAAA,GAAS,OAAO,MAAA,CAAO;AAAA,SAClCA,uBAAA;AAAA,QACAC,sBAAA;AAAA,SACAC,uBAAA;AAAA,QACAC;AACF,CAAC;AAKM,IAAM,eAAA,GAAkB","file":"themes.cjs","sourcesContent":["/**\n * `gigaboard/themes` — CSS-variable-only board themes.\n *\n * Each theme ships as a frozen record of CSS custom-property pairs that the\n * React layer writes inline on the board container at first paint. Themes\n * are CSS-only and carry zero runtime cost beyond the one-time variable\n * assignment.\n *\n * Import sub-paths to keep bundles minimal:\n *\n * ```tsx\n * import { brown } from \"gigaboard/themes/brown\";\n * import { green } from \"gigaboard/themes/green\"; // chess.com default\n * import { blue } from \"gigaboard/themes/blue\";\n * import { wood } from \"gigaboard/themes/wood\";\n * ```\n *\n * Or pull the full set from the package root (convenient for theme pickers,\n * at a marginally larger bundle cost):\n *\n * ```tsx\n * import { brown, green, blue, wood } from \"gigaboard/themes\";\n * ```\n */\n\nimport { blue } from \"./blue.js\";\nimport { brown } from \"./brown.js\";\nimport { green } from \"./green.js\";\nimport { wood } from \"./wood.js\";\n\n/** Shape of a board theme: CSS custom-property pairs. */\nexport type Theme = Readonly<Record<string, string>>;\n\nexport { blue, brown, green, wood };\n\n/** Registry mapping a theme name to its theme object. */\nexport const themes = Object.freeze({\n brown,\n blue,\n green,\n wood,\n}) satisfies Readonly<Record<string, Theme>>;\n\n/** Union of the built-in theme names. */\nexport type ThemeName = keyof typeof themes;\n\nexport const PACKAGE_VERSION = \"0.1.0-alpha\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { P as PACKAGE_VERSION, T as Theme, a as ThemeName, blue, b as brown, g as green, t as themes, w as wood } from './themes/blue.cjs';
|
package/dist/themes.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { P as PACKAGE_VERSION, T as Theme, a as ThemeName, blue, b as brown, g as green, t as themes, w as wood } from './themes/blue.js';
|
package/dist/themes.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { brown } from './chunk-5WAOEWKS.js';
|
|
2
|
+
export { brown } from './chunk-5WAOEWKS.js';
|
|
3
|
+
import { blue } from './chunk-P72B3YTG.js';
|
|
4
|
+
export { blue } from './chunk-P72B3YTG.js';
|
|
5
|
+
import { wood } from './chunk-NAA5O4BT.js';
|
|
6
|
+
export { wood } from './chunk-NAA5O4BT.js';
|
|
7
|
+
import { green } from './chunk-OQLY5GJF.js';
|
|
8
|
+
export { green } from './chunk-OQLY5GJF.js';
|
|
9
|
+
|
|
10
|
+
// src/themes/index.ts
|
|
11
|
+
var themes = Object.freeze({
|
|
12
|
+
brown,
|
|
13
|
+
blue,
|
|
14
|
+
green,
|
|
15
|
+
wood
|
|
16
|
+
});
|
|
17
|
+
var PACKAGE_VERSION = "0.1.0-alpha";
|
|
18
|
+
|
|
19
|
+
export { PACKAGE_VERSION, themes };
|
|
20
|
+
//# sourceMappingURL=themes.js.map
|
|
21
|
+
//# sourceMappingURL=themes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/themes/index.ts"],"names":[],"mappings":";;;;;;;;;;AAoCO,IAAM,MAAA,GAAS,OAAO,MAAA,CAAO;AAAA,EAClC,KAAA;AAAA,EACA,IAAA;AAAA,EACA,KAAA;AAAA,EACA;AACF,CAAC;AAKM,IAAM,eAAA,GAAkB","file":"themes.js","sourcesContent":["/**\n * `gigaboard/themes` — CSS-variable-only board themes.\n *\n * Each theme ships as a frozen record of CSS custom-property pairs that the\n * React layer writes inline on the board container at first paint. Themes\n * are CSS-only and carry zero runtime cost beyond the one-time variable\n * assignment.\n *\n * Import sub-paths to keep bundles minimal:\n *\n * ```tsx\n * import { brown } from \"gigaboard/themes/brown\";\n * import { green } from \"gigaboard/themes/green\"; // chess.com default\n * import { blue } from \"gigaboard/themes/blue\";\n * import { wood } from \"gigaboard/themes/wood\";\n * ```\n *\n * Or pull the full set from the package root (convenient for theme pickers,\n * at a marginally larger bundle cost):\n *\n * ```tsx\n * import { brown, green, blue, wood } from \"gigaboard/themes\";\n * ```\n */\n\nimport { blue } from \"./blue.js\";\nimport { brown } from \"./brown.js\";\nimport { green } from \"./green.js\";\nimport { wood } from \"./wood.js\";\n\n/** Shape of a board theme: CSS custom-property pairs. */\nexport type Theme = Readonly<Record<string, string>>;\n\nexport { blue, brown, green, wood };\n\n/** Registry mapping a theme name to its theme object. */\nexport const themes = Object.freeze({\n brown,\n blue,\n green,\n wood,\n}) satisfies Readonly<Record<string, Theme>>;\n\n/** Union of the built-in theme names. */\nexport type ThemeName = keyof typeof themes;\n\nexport const PACKAGE_VERSION = \"0.1.0-alpha\";\n"]}
|
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
import { ReactNode, CSSProperties } from 'react';
|
|
2
|
+
import { u as BoardModel, b as Arrow, t as BoardCell, S as SquareIndex, P as PackedMove, a as PieceType, z as Color } from './board-model-BvJOtwQ3.cjs';
|
|
3
|
+
import { TriggerOptions, HapticInput } from 'web-haptics';
|
|
4
|
+
|
|
5
|
+
interface HapticFeedbackOptions extends TriggerOptions {
|
|
6
|
+
/** Master switch. Default `true`. */
|
|
7
|
+
readonly enabled?: boolean;
|
|
8
|
+
/** Restrict haptics to coarse-pointer/mobile-like devices. Default `true`. */
|
|
9
|
+
readonly mobileOnly?: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare function triggerHaptic(input?: HapticInput, options?: HapticFeedbackOptions): void;
|
|
12
|
+
declare function warmupHaptics(options?: HapticFeedbackOptions): void;
|
|
13
|
+
|
|
14
|
+
/** The shared move-feedback cue categories. */
|
|
15
|
+
type MoveFeedbackKey = "moveSelf" | "moveOpponent" | "capture" | "castle" | "moveCheck" | "promote" | "gameEnd";
|
|
16
|
+
/** Default haptic pattern per move-feedback cue. */
|
|
17
|
+
declare const DEFAULT_MOVE_HAPTIC_PATTERNS: Readonly<Record<MoveFeedbackKey, HapticInput>>;
|
|
18
|
+
/**
|
|
19
|
+
* Classify the feedback cue that should fire for the given committed move.
|
|
20
|
+
*
|
|
21
|
+
* Priority (highest wins):
|
|
22
|
+
* 1. `gameEnd` if the engine reports `isGameOver`.
|
|
23
|
+
* 2. `promote` / `castle` because structural moves get their own cue.
|
|
24
|
+
* 3. `moveCheck` if the side-to-move is now in check.
|
|
25
|
+
* 4. `capture` if any descriptor is a capture.
|
|
26
|
+
* 5. `moveSelf` / `moveOpponent` otherwise.
|
|
27
|
+
*/
|
|
28
|
+
declare function classifyMoveFeedback(animations: ReadonlyArray<{
|
|
29
|
+
readonly kind: string;
|
|
30
|
+
}>, snapshot: {
|
|
31
|
+
readonly isGameOver: boolean;
|
|
32
|
+
readonly inCheck: boolean;
|
|
33
|
+
readonly turn: 0 | 1;
|
|
34
|
+
}, perspective: 0 | 1 | undefined): MoveFeedbackKey;
|
|
35
|
+
|
|
36
|
+
type MoveHapticKey = MoveFeedbackKey;
|
|
37
|
+
type MoveHapticPatterns = Partial<Readonly<Record<MoveHapticKey, HapticInput>>>;
|
|
38
|
+
type TriggerMoveHaptic = (key: MoveHapticKey) => void;
|
|
39
|
+
interface MoveHapticOptions {
|
|
40
|
+
/** Master switch. Default `true`. */
|
|
41
|
+
readonly enabled?: boolean;
|
|
42
|
+
/** Per-key haptic overrides. Missing keys fall back to the built-in pattern map. */
|
|
43
|
+
readonly patterns?: MoveHapticPatterns;
|
|
44
|
+
/**
|
|
45
|
+
* Viewer perspective. When set, moves played by this colour use `moveSelf`
|
|
46
|
+
* and moves played by the opponent use `moveOpponent`.
|
|
47
|
+
*/
|
|
48
|
+
readonly perspective?: 0 | 1;
|
|
49
|
+
/** Restrict haptics to coarse-pointer/mobile-like devices. Default `true`. */
|
|
50
|
+
readonly mobileOnly?: boolean;
|
|
51
|
+
/** Minimum gap between emitted haptic events. Default `14ms`. */
|
|
52
|
+
readonly minIntervalMs?: number;
|
|
53
|
+
/** Warm the haptic backend on the first user gesture. Default `true`. */
|
|
54
|
+
readonly warmupOnFirstInteraction?: boolean;
|
|
55
|
+
/** Forwarded to `web-haptics` trigger intensity. */
|
|
56
|
+
readonly intensity?: HapticFeedbackOptions["intensity"];
|
|
57
|
+
}
|
|
58
|
+
declare function triggerMoveHaptic(key: MoveHapticKey, { enabled, patterns, mobileOnly, intensity, }?: Pick<MoveHapticOptions, "enabled" | "patterns" | "mobileOnly" | "intensity">): void;
|
|
59
|
+
declare function useMoveHaptics(model: BoardModel | null, options?: MoveHapticOptions): TriggerMoveHaptic;
|
|
60
|
+
|
|
61
|
+
/** The seven categories of move cue, mirroring chess.com's default set. */
|
|
62
|
+
type MoveSoundKey = MoveFeedbackKey;
|
|
63
|
+
/** Sparse URL map — any key omitted falls back to the built-in local asset. */
|
|
64
|
+
type MoveSoundSources = Partial<Readonly<Record<MoveSoundKey, string>>>;
|
|
65
|
+
type TriggerMoveSound = (key: MoveSoundKey) => void;
|
|
66
|
+
/**
|
|
67
|
+
* Default URL map. Points at the MP3 files shipped with this package; the
|
|
68
|
+
* package build copies them next to the emitted JS under `dist/sounds/`.
|
|
69
|
+
* Keeping these as static `new URL(..., import.meta.url)` expressions lets
|
|
70
|
+
* consumer bundlers such as Vite and Next.js rebase/copy the files correctly.
|
|
71
|
+
*
|
|
72
|
+
* The `typeof import.meta.url` guard keeps the CommonJS build importable in
|
|
73
|
+
* Node; browser ESM consumers get the fully resolved asset URLs.
|
|
74
|
+
*/
|
|
75
|
+
declare const DEFAULT_MOVE_SOUND_SOURCES: Readonly<Record<MoveSoundKey, string>>;
|
|
76
|
+
/** Public configuration for the hook (and the `<Chessboard sound/>` prop). */
|
|
77
|
+
interface MoveSoundOptions {
|
|
78
|
+
/** Master switch. Default `true`. */
|
|
79
|
+
readonly enabled?: boolean;
|
|
80
|
+
/** Output volume, `0`–`1`. Default `1`. */
|
|
81
|
+
readonly volume?: number;
|
|
82
|
+
/** Audio preload mode used when the lazy pool is first created. Default `"none"`. */
|
|
83
|
+
readonly preload?: "none" | "metadata" | "auto";
|
|
84
|
+
/** Per-key URL overrides. Missing keys fall back to {@link DEFAULT_MOVE_SOUND_SOURCES}. */
|
|
85
|
+
readonly sources?: MoveSoundSources;
|
|
86
|
+
/**
|
|
87
|
+
* Viewer perspective. When set, moves played *by* this colour use the
|
|
88
|
+
* `moveSelf` cue and moves played by the opponent use `moveOpponent`. When
|
|
89
|
+
* omitted (the default), every non-special move uses `moveSelf`.
|
|
90
|
+
*/
|
|
91
|
+
readonly perspective?: 0 | 1;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Drop-in hook. Mount inside a React tree that has a `BoardModel`. Pass
|
|
95
|
+
* `null` while the engine is still loading — the hook no-ops until the
|
|
96
|
+
* model is available.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```tsx
|
|
100
|
+
* useMoveSound(game, { enabled: soundOn, volume: 0.6 });
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
declare function useMoveSound(model: BoardModel | null, options?: MoveSoundOptions): TriggerMoveSound;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Public types for `gigaboard`.
|
|
107
|
+
*
|
|
108
|
+
* These describe the prop surface a consumer sees when they import
|
|
109
|
+
* `<Chessboard/>` or any of the exposed hooks. Runtime helpers live with
|
|
110
|
+
* their respective modules; this file is types-only.
|
|
111
|
+
*/
|
|
112
|
+
|
|
113
|
+
/** Which way the board is facing. */
|
|
114
|
+
type Orientation = "white" | "black";
|
|
115
|
+
/** CSS custom-property record (e.g. `{ "--gb-sq-light": "#f0d9b5" }`). */
|
|
116
|
+
type Theme = Readonly<Record<string, string>>;
|
|
117
|
+
/** How legal-target squares are visualised when a piece is selected. */
|
|
118
|
+
type LegalTargetStyle = "rings" | "dots" | false;
|
|
119
|
+
/**
|
|
120
|
+
* Edge the rank labels (1–8) are rendered against. `"left"` matches
|
|
121
|
+
* lichess and our historic default; `"right"` matches chess.com.
|
|
122
|
+
*/
|
|
123
|
+
type RanksPosition = "left" | "right";
|
|
124
|
+
/**
|
|
125
|
+
* Renderer for a single piece. Given the packed board cell and its square,
|
|
126
|
+
* return a React node positioned inside a 12.5% × 12.5% slot of the board.
|
|
127
|
+
*
|
|
128
|
+
* @remarks
|
|
129
|
+
* Renderers must be pure and referentially stable — returning a new element
|
|
130
|
+
* tree on every call forces per-commit re-rendering. Prefer memoised results
|
|
131
|
+
* or stateless SVG/Unicode glyphs.
|
|
132
|
+
*/
|
|
133
|
+
type PieceRenderer = (args: {
|
|
134
|
+
readonly cell: BoardCell;
|
|
135
|
+
readonly square: SquareIndex;
|
|
136
|
+
}) => ReactNode;
|
|
137
|
+
/** Context passed to a user-supplied `renderSquare` override. */
|
|
138
|
+
interface SquareContext {
|
|
139
|
+
readonly index: SquareIndex;
|
|
140
|
+
readonly isLight: boolean;
|
|
141
|
+
readonly label: string;
|
|
142
|
+
}
|
|
143
|
+
/** Context passed to a user-supplied `onPromote` callback. */
|
|
144
|
+
interface PromotionContext {
|
|
145
|
+
readonly from: SquareIndex;
|
|
146
|
+
readonly to: SquareIndex;
|
|
147
|
+
/** Colour of the promoting pawn (0 = white, 1 = black). */
|
|
148
|
+
readonly color: 0 | 1;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Configuration for the piece-glide animations played after every move.
|
|
152
|
+
*
|
|
153
|
+
* Animations run entirely on the compositor via the Web Animations API —
|
|
154
|
+
* they never re-enter React. Honours `prefers-reduced-motion: reduce` by
|
|
155
|
+
* collapsing the duration to zero regardless of the configured value.
|
|
156
|
+
*/
|
|
157
|
+
interface AnimationOptions {
|
|
158
|
+
/** Glide duration in ms. Default `60`. Set to `0` to disable. */
|
|
159
|
+
readonly durationMs?: number;
|
|
160
|
+
/** CSS easing curve. Default `cubic-bezier(0.22, 0.61, 0.36, 1)` (ease-out). */
|
|
161
|
+
readonly easing?: string;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Hint for animating an externally-controlled FEN change.
|
|
165
|
+
*
|
|
166
|
+
* `uci` is the move that connects the old and new positions. `direction`
|
|
167
|
+
* says whether the board is replaying that move or rewinding it. `key`
|
|
168
|
+
* can be supplied by callers that replay the same UCI more than once in a
|
|
169
|
+
* line; when omitted, the current `positionFen` still participates in the
|
|
170
|
+
* effect identity.
|
|
171
|
+
*/
|
|
172
|
+
interface PositionTransition {
|
|
173
|
+
/** UCI move such as `"e2e4"`, `"e7e8q"`, or castling as `"e1g1"`. */
|
|
174
|
+
readonly uci: string;
|
|
175
|
+
/** Direction of travel for replay controls. */
|
|
176
|
+
readonly direction: "forward" | "backward";
|
|
177
|
+
/** Optional stable identity for this specific transition. */
|
|
178
|
+
readonly key?: string;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* CSS colour strings for the four stock right-click-arrow channels
|
|
182
|
+
* plus any number of user-defined brushes. Modifier keys still map to
|
|
183
|
+
* the built-in channels at draw time:
|
|
184
|
+
*
|
|
185
|
+
* (no modifier) → `default`
|
|
186
|
+
* Shift → `shift`
|
|
187
|
+
* Alt → `alt`
|
|
188
|
+
* Ctrl / Meta → `ctrl`
|
|
189
|
+
*
|
|
190
|
+
* Programmatic arrows (engine annotations via `model.setArrows`, for
|
|
191
|
+
* instance) can set `arrow.brush = "<key>"` to resolve against any
|
|
192
|
+
* other key in the palette. Unknown keys fall through to `default`.
|
|
193
|
+
*/
|
|
194
|
+
interface ArrowColors {
|
|
195
|
+
readonly default?: string;
|
|
196
|
+
readonly shift?: string;
|
|
197
|
+
readonly alt?: string;
|
|
198
|
+
readonly ctrl?: string;
|
|
199
|
+
/** Any additional palette entry — keyed by the arrow's `brush` field. */
|
|
200
|
+
readonly [brush: string]: string | undefined;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Fully-resolved palette consumed by the arrow renderer. The four
|
|
204
|
+
* modifier channels are guaranteed (defaults applied); user-defined
|
|
205
|
+
* brushes live alongside with whatever keys the caller supplied.
|
|
206
|
+
*/
|
|
207
|
+
interface ResolvedArrowPalette {
|
|
208
|
+
readonly default: string;
|
|
209
|
+
readonly shift: string;
|
|
210
|
+
readonly alt: string;
|
|
211
|
+
readonly ctrl: string;
|
|
212
|
+
readonly [brush: string]: string;
|
|
213
|
+
}
|
|
214
|
+
/** Props accepted by the top-level `<Chessboard/>` component. */
|
|
215
|
+
interface ChessboardProps {
|
|
216
|
+
/**
|
|
217
|
+
* The board model produced by {@link useChessGame}. Pass `null` during
|
|
218
|
+
* initial async engine load — the board renders a visually-identical but
|
|
219
|
+
* pieceless placeholder. Provide {@link fallbackFen} in addition to
|
|
220
|
+
* render pieces from that FEN until the real engine arrives.
|
|
221
|
+
*/
|
|
222
|
+
readonly game: BoardModel | null;
|
|
223
|
+
/**
|
|
224
|
+
* Starting-position FEN to render as a static fallback while `game`
|
|
225
|
+
* is `null`. When supplied, the board paints pieces from this FEN on
|
|
226
|
+
* the very first commit — no wait for a `useEffect`, no engine
|
|
227
|
+
* dependency. Once the real `game` resolves the interactive piece
|
|
228
|
+
* layer takes over without a layout shift (identical DOM shape).
|
|
229
|
+
*
|
|
230
|
+
* Only the placement field of the FEN is consumed; side-to-move,
|
|
231
|
+
* castling flags, and clocks are ignored (they have no visual
|
|
232
|
+
* effect). Defaults to `undefined`, in which case a `null` `game`
|
|
233
|
+
* renders a pieceless board.
|
|
234
|
+
*
|
|
235
|
+
* Useful for avoiding the "flash of empty board" on cold mount when
|
|
236
|
+
* the engine is loaded asynchronously (e.g. dynamic-import + WASM
|
|
237
|
+
* streaming compile).
|
|
238
|
+
*/
|
|
239
|
+
readonly fallbackFen?: string;
|
|
240
|
+
/**
|
|
241
|
+
* Declarative FEN for controlled boards and replay/analysis viewers.
|
|
242
|
+
*
|
|
243
|
+
* When supplied, `<Chessboard/>` keeps the provided {@link game} synced
|
|
244
|
+
* to this FEN by calling `game.load(positionFen)` internally. This is a
|
|
245
|
+
* programmatic position sync, so it does not call {@link onMove}; user
|
|
246
|
+
* moves still go through `tryMove` and fire `onMove` normally.
|
|
247
|
+
*
|
|
248
|
+
* For adjacent replay steps, pass {@link positionTransition} so the board
|
|
249
|
+
* can glide the moved piece instead of snapping between FENs.
|
|
250
|
+
*/
|
|
251
|
+
readonly positionFen?: string;
|
|
252
|
+
/**
|
|
253
|
+
* Optional move hint used to animate a `positionFen` sync. Consumers should
|
|
254
|
+
* pass this for previous/next buttons, PGN scrubbing, and analysis-line
|
|
255
|
+
* replay where the model is being loaded from external FEN snapshots.
|
|
256
|
+
*/
|
|
257
|
+
readonly positionTransition?: PositionTransition | null;
|
|
258
|
+
/**
|
|
259
|
+
* Application-owned arrows to sync with {@link positionFen}. When supplied,
|
|
260
|
+
* the board applies the FEN and these managed arrows in one model commit,
|
|
261
|
+
* avoiding an intermediate "position loaded, arrows cleared" frame.
|
|
262
|
+
*
|
|
263
|
+
* Pass `[]` to explicitly clear managed arrows for the current position.
|
|
264
|
+
* User-drawn arrows remain governed by
|
|
265
|
+
* {@link preserveUserArrowsOnPositionSync}.
|
|
266
|
+
*/
|
|
267
|
+
readonly managedArrows?: readonly Arrow[];
|
|
268
|
+
/**
|
|
269
|
+
* Preserve user-drawn arrows when a controlled {@link positionFen} changes.
|
|
270
|
+
* Defaults to `false`, matching the existing `load(fen)` behaviour.
|
|
271
|
+
*/
|
|
272
|
+
readonly preserveUserArrowsOnPositionSync?: boolean;
|
|
273
|
+
/** Board orientation (defaults to `"white"`). */
|
|
274
|
+
readonly orientation?: Orientation;
|
|
275
|
+
/**
|
|
276
|
+
* Theme as a CSS custom-property record. Import from `gigaboard/themes/*`.
|
|
277
|
+
* When omitted the default green theme from `gigaboard/themes` is applied.
|
|
278
|
+
*/
|
|
279
|
+
readonly theme?: Theme;
|
|
280
|
+
/**
|
|
281
|
+
* Piece renderer. Defaults to the `neo` set from `gigaboard/pieces`.
|
|
282
|
+
*/
|
|
283
|
+
readonly pieces?: PieceRenderer;
|
|
284
|
+
/** Show algebraic coordinate labels on the edges. Default `true`. */
|
|
285
|
+
readonly showCoordinates?: boolean;
|
|
286
|
+
/**
|
|
287
|
+
* Edge against which rank labels (1–8) are rendered. Default `"left"`
|
|
288
|
+
* (lichess convention); switch to `"right"` to match chess.com. The
|
|
289
|
+
* file labels (a–h) always sit on the bottom edge; this prop doesn't
|
|
290
|
+
* affect them.
|
|
291
|
+
*/
|
|
292
|
+
readonly ranksPosition?: RanksPosition;
|
|
293
|
+
/** Style for legal-target square highlights. Default `"rings"`. */
|
|
294
|
+
readonly showLegalTargets?: LegalTargetStyle;
|
|
295
|
+
/** Highlight the from / to squares of the most recent move. Default `true`. */
|
|
296
|
+
readonly highlightLastMove?: boolean;
|
|
297
|
+
/** Called after every successful move; receives the packed `Move`. */
|
|
298
|
+
readonly onMove?: (move: PackedMove) => void;
|
|
299
|
+
/**
|
|
300
|
+
* Called when a pawn needs to promote. Return (or resolve) the chosen
|
|
301
|
+
* {@link PieceType}. If omitted, the built-in promotion overlay is shown.
|
|
302
|
+
*
|
|
303
|
+
* The returned promise may be rejected (e.g. user clicks outside the
|
|
304
|
+
* dialog) — in that case the move is abandoned and the board returns to
|
|
305
|
+
* the pre-drag state.
|
|
306
|
+
*/
|
|
307
|
+
readonly onPromote?: (ctx: PromotionContext) => PieceType | Promise<PieceType>;
|
|
308
|
+
/** Animation configuration. Passes through to the WAAPI glide runner. */
|
|
309
|
+
readonly animation?: AnimationOptions;
|
|
310
|
+
/**
|
|
311
|
+
* Whether drag-and-drop is enabled. When `false`, click-to-move still
|
|
312
|
+
* works but the board ignores pointer-down initiated drags. Default `true`.
|
|
313
|
+
*/
|
|
314
|
+
readonly allowDrag?: boolean;
|
|
315
|
+
/**
|
|
316
|
+
* Fine-grained predicate consulted at the drag-activation boundary —
|
|
317
|
+
* returning `false` aborts the drag before the ghost appears. Use this
|
|
318
|
+
* for per-piece gating that can't be modelled by `allowDrag` or the
|
|
319
|
+
* turn-to-move check: tutorial boards ("you can only move white"),
|
|
320
|
+
* locked pieces in puzzle trainers, or rating-gated moves in online
|
|
321
|
+
* play.
|
|
322
|
+
*
|
|
323
|
+
* @remarks
|
|
324
|
+
* Fires once per drag attempt, not per pointer sample — the check
|
|
325
|
+
* sits on the cold drag-start path. Click-to-move is unaffected;
|
|
326
|
+
* gate that at the `onMove` callback if the same policy should apply.
|
|
327
|
+
*/
|
|
328
|
+
readonly canDragPiece?: (ctx: {
|
|
329
|
+
readonly square: SquareIndex;
|
|
330
|
+
readonly cell: BoardCell;
|
|
331
|
+
}) => boolean;
|
|
332
|
+
/**
|
|
333
|
+
* Fired when the pointer enters a new square. Fires at most once per
|
|
334
|
+
* square transition — moving across the board yields `leave(old)`
|
|
335
|
+
* followed by `enter(new)`. Pointer events so both mouse and touch
|
|
336
|
+
* report consistently.
|
|
337
|
+
*/
|
|
338
|
+
readonly onSquareMouseEnter?: (ctx: {
|
|
339
|
+
readonly square: SquareIndex;
|
|
340
|
+
readonly cell: BoardCell;
|
|
341
|
+
}) => void;
|
|
342
|
+
/**
|
|
343
|
+
* Fired when the pointer leaves a square — either crossing into a
|
|
344
|
+
* sibling square or exiting the board rect. Pairs with
|
|
345
|
+
* {@link onSquareMouseEnter} transition-for-transition.
|
|
346
|
+
*/
|
|
347
|
+
readonly onSquareMouseLeave?: (ctx: {
|
|
348
|
+
readonly square: SquareIndex;
|
|
349
|
+
readonly cell: BoardCell;
|
|
350
|
+
}) => void;
|
|
351
|
+
/**
|
|
352
|
+
* Enable drawing arrows via right-click drag. Default `true`.
|
|
353
|
+
* Modifier keys select colour channels (see {@link ArrowColors}).
|
|
354
|
+
*/
|
|
355
|
+
readonly allowDrawingArrows?: boolean;
|
|
356
|
+
/**
|
|
357
|
+
* Clear every drawn arrow when the engine accepts a new move. Default
|
|
358
|
+
* `true` — matches the lichess / chess.com convention.
|
|
359
|
+
*/
|
|
360
|
+
readonly clearArrowsOnMove?: boolean;
|
|
361
|
+
/**
|
|
362
|
+
* Clear every drawn arrow when the user makes any left-pointer
|
|
363
|
+
* interaction with the board (click or drag start) or presses Escape.
|
|
364
|
+
* Default `true`. This is how lichess and react-chessboard behave: the
|
|
365
|
+
* user's next action is treated as "moving on" from any annotations.
|
|
366
|
+
*/
|
|
367
|
+
readonly clearArrowsOnClick?: boolean;
|
|
368
|
+
/** Per-channel arrow colour overrides. */
|
|
369
|
+
readonly arrowColors?: ArrowColors;
|
|
370
|
+
/**
|
|
371
|
+
* When drawing arrows by right-click drag, snap the endpoint to the
|
|
372
|
+
* nearest legal move target from the origin square. Useful for
|
|
373
|
+
* analysis boards and tutorial UIs where annotations should line up
|
|
374
|
+
* with real moves. Default `false`.
|
|
375
|
+
*
|
|
376
|
+
* @remarks
|
|
377
|
+
* Same-square marks (circles) are never snapped. When the origin
|
|
378
|
+
* has no legal moves (empty square, or pinned piece), the endpoint
|
|
379
|
+
* is left as-is.
|
|
380
|
+
*/
|
|
381
|
+
readonly snapArrowsToValidMove?: boolean;
|
|
382
|
+
/**
|
|
383
|
+
* Queue moves attempted when it's not your turn as premoves instead of
|
|
384
|
+
* rejecting them. **Default `false`** — premoves are an online-play
|
|
385
|
+
* affordance, and in local / analysis / tutorial boards the ghost-piece
|
|
386
|
+
* overlay is more confusing than helpful (looks like the board accepted
|
|
387
|
+
* a move it shouldn't have).
|
|
388
|
+
*
|
|
389
|
+
* Enable explicitly in networked UIs where the opponent's move is
|
|
390
|
+
* pending. When disabled (default), out-of-turn drags flash red via
|
|
391
|
+
* {@link showIllegalFlash} the same way any other illegal move does.
|
|
392
|
+
*/
|
|
393
|
+
readonly allowPremove?: boolean;
|
|
394
|
+
/**
|
|
395
|
+
* Paint a red glow under the king when the side-to-move is in check.
|
|
396
|
+
* Default `true`.
|
|
397
|
+
*/
|
|
398
|
+
readonly showCheckHighlight?: boolean;
|
|
399
|
+
/**
|
|
400
|
+
* Suppress the browser's right-click context menu over the board.
|
|
401
|
+
* Default `true` — the right-click gesture is reserved for drawing
|
|
402
|
+
* arrows (see {@link allowDrawingArrows}) and the OS menu would
|
|
403
|
+
* steal the trailing `pointerup`. Set to `false` only if you need
|
|
404
|
+
* the browser menu for a custom interaction.
|
|
405
|
+
*
|
|
406
|
+
* @remarks
|
|
407
|
+
* The listener is installed on the board container only; right-clicks
|
|
408
|
+
* outside the board behave normally. Works independently of
|
|
409
|
+
* `allowDrawingArrows` so consumers can disable arrows but still block
|
|
410
|
+
* the OS menu.
|
|
411
|
+
*/
|
|
412
|
+
readonly disableContextMenu?: boolean;
|
|
413
|
+
/**
|
|
414
|
+
* Briefly flash the origin square red when the engine rejects a user
|
|
415
|
+
* move. Default `true`. Respects `prefers-reduced-motion`.
|
|
416
|
+
*/
|
|
417
|
+
readonly showIllegalFlash?: boolean;
|
|
418
|
+
/**
|
|
419
|
+
* Escape hatch for custom per-square overlays. The callback receives the
|
|
420
|
+
* square's coordinate and colour and must return a React node that will
|
|
421
|
+
* render inside the square (absolute-positioned, covering 100% × 100%).
|
|
422
|
+
*/
|
|
423
|
+
readonly renderSquare?: (ctx: SquareContext) => ReactNode;
|
|
424
|
+
/**
|
|
425
|
+
* Optional container style overrides. Applied to the outermost board
|
|
426
|
+
* element; CSS variables injected by the theme are written on the same
|
|
427
|
+
* element so inline styles declared here can reference them.
|
|
428
|
+
*/
|
|
429
|
+
readonly style?: CSSProperties;
|
|
430
|
+
/** Optional class name on the outer container. */
|
|
431
|
+
readonly className?: string;
|
|
432
|
+
/** Accessible label for the board (`aria-label`). Default "Chess board". */
|
|
433
|
+
readonly ariaLabel?: string;
|
|
434
|
+
/**
|
|
435
|
+
* Read-only board. Disables every user-input subsystem at once —
|
|
436
|
+
* drag, click-to-move, keyboard navigation, arrow drawing — while
|
|
437
|
+
* preserving the accessible live region, highlights, animations,
|
|
438
|
+
* coordinates, and check glow. Use this for PGN viewers, position
|
|
439
|
+
* diagrams, and any surface where the board is purely declarative.
|
|
440
|
+
*
|
|
441
|
+
* Equivalent to setting `allowDrag={false}`, `allowDrawingArrows=
|
|
442
|
+
* {false}`, and wiring a no-op click handler, collapsed into a single
|
|
443
|
+
* switch that also removes the board from the keyboard tab order.
|
|
444
|
+
* Default `false`.
|
|
445
|
+
*
|
|
446
|
+
* @remarks
|
|
447
|
+
* The roving-tabindex seed is suppressed while `viewOnly` is true, so
|
|
448
|
+
* no square receives `tabindex=0` and the grid is skipped entirely by
|
|
449
|
+
* the browser's focus ring. Programmatic arrow placement (e.g. engine
|
|
450
|
+
* annotations via `model.addArrow`) continues to paint normally.
|
|
451
|
+
*/
|
|
452
|
+
readonly viewOnly?: boolean;
|
|
453
|
+
/**
|
|
454
|
+
* Move-sound effects. Pass `true` (default) to enable the built-in
|
|
455
|
+
* chess.com-style cue set, `false` to disable, or a {@link MoveSoundOptions}
|
|
456
|
+
* object to configure volume, per-key URL overrides, or viewer perspective.
|
|
457
|
+
*
|
|
458
|
+
* The seven cues ship as local MP3 assets inside this package; no runtime
|
|
459
|
+
* CDN dependency. Autoplay policies apply on every major browser — the
|
|
460
|
+
* first cue may be silent until the user has interacted with the page,
|
|
461
|
+
* after which playback is immediate.
|
|
462
|
+
*/
|
|
463
|
+
readonly sound?: boolean | MoveSoundOptions;
|
|
464
|
+
/**
|
|
465
|
+
* Move haptic feedback. Pass `true` to enable mobile-only haptics, `false`
|
|
466
|
+
* (default) to disable, or a {@link MoveHapticOptions} object to configure
|
|
467
|
+
* per-cue patterns, intensity, viewer perspective, and mobile-only gating.
|
|
468
|
+
*
|
|
469
|
+
* Haptics are independent from sound, so consumers can keep `sound={false}`
|
|
470
|
+
* while still providing tactile feedback on mobile devices.
|
|
471
|
+
*/
|
|
472
|
+
readonly haptics?: boolean | MoveHapticOptions;
|
|
473
|
+
/**
|
|
474
|
+
* Custom accessible label generator for squares.
|
|
475
|
+
* Allows consumers (e.g. BlindBase) to supply localized, piece-aware
|
|
476
|
+
* speech descriptions for screen readers.
|
|
477
|
+
*/
|
|
478
|
+
readonly getSquareAriaLabel?: (square: SquareIndex, cell: BoardCell) => string;
|
|
479
|
+
/**
|
|
480
|
+
* Fired when a board square receives keyboard or programmatic focus.
|
|
481
|
+
* Can be used to pipe focus events into external speech queues.
|
|
482
|
+
*/
|
|
483
|
+
readonly onSquareFocus?: (square: SquareIndex, cell: BoardCell) => void;
|
|
484
|
+
/**
|
|
485
|
+
* Custom accessible label generator for promotion overlay pieces.
|
|
486
|
+
* Supports multi-language (Russian, Hebrew, English, etc.) screen-reader announcements.
|
|
487
|
+
*/
|
|
488
|
+
readonly getPromotionPieceAriaLabel?: (piece: PieceType, color: Color) => string;
|
|
489
|
+
}
|
|
490
|
+
/** Options forwarded to {@link useChessGame} on first mount. */
|
|
491
|
+
interface UseChessGameOptions {
|
|
492
|
+
/**
|
|
493
|
+
* Initial engine FEN. Defaults to `gigachess`'s standard starting
|
|
494
|
+
* position. This is a lifecycle input: changing it disposes the current
|
|
495
|
+
* model and creates a fresh one. For replay/analysis viewers, keep the
|
|
496
|
+
* model stable and drive `<Chessboard positionFen={...} />` instead.
|
|
497
|
+
*/
|
|
498
|
+
readonly fen?: string;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
export { type AnimationOptions as A, type ChessboardProps as C, DEFAULT_MOVE_HAPTIC_PATTERNS as D, type HapticFeedbackOptions as H, type LegalTargetStyle as L, type MoveFeedbackKey as M, type Orientation as O, type PieceRenderer as P, type ResolvedArrowPalette as R, type SquareContext as S, type Theme as T, type UseChessGameOptions as U, type ArrowColors as a, DEFAULT_MOVE_SOUND_SOURCES as b, type MoveHapticKey as c, type MoveHapticOptions as d, type MoveHapticPatterns as e, type MoveSoundKey as f, type MoveSoundOptions as g, type MoveSoundSources as h, type PositionTransition as i, type PromotionContext as j, type RanksPosition as k, type TriggerMoveHaptic as l, type TriggerMoveSound as m, classifyMoveFeedback as n, triggerMoveHaptic as o, useMoveSound as p, triggerHaptic as t, useMoveHaptics as u, warmupHaptics as w };
|