gigaboard 1.3.1 → 1.3.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/README.md +28 -8
- package/dist/chunk-35HQL3AK.js +19 -0
- package/dist/chunk-35HQL3AK.js.map +1 -0
- package/dist/chunk-375XPUCQ.js +18 -0
- package/dist/chunk-375XPUCQ.js.map +1 -0
- package/dist/chunk-3DEOTW2M.js +16 -0
- package/dist/chunk-3DEOTW2M.js.map +1 -0
- package/dist/chunk-3UFHYHMR.js +16 -0
- package/dist/chunk-3UFHYHMR.js.map +1 -0
- package/dist/chunk-52DIWDSX.js +18 -0
- package/dist/chunk-52DIWDSX.js.map +1 -0
- package/dist/chunk-5OGPVD4R.cjs +18 -0
- package/dist/chunk-5OGPVD4R.cjs.map +1 -0
- package/dist/chunk-6S6THNZP.js +24 -0
- package/dist/chunk-6S6THNZP.js.map +1 -0
- package/dist/chunk-6ZEPUUY5.cjs +18 -0
- package/dist/chunk-6ZEPUUY5.cjs.map +1 -0
- package/dist/chunk-76PL52EB.cjs +21 -0
- package/dist/chunk-76PL52EB.cjs.map +1 -0
- package/dist/chunk-A3HBH676.cjs +20 -0
- package/dist/chunk-A3HBH676.cjs.map +1 -0
- package/dist/chunk-AWNSXENI.js +18 -0
- package/dist/chunk-AWNSXENI.js.map +1 -0
- package/dist/{chunk-GYVBIZKI.js → chunk-BB54XFHQ.js} +3 -3
- package/dist/{chunk-GYVBIZKI.js.map → chunk-BB54XFHQ.js.map} +1 -1
- package/dist/chunk-CMV3NVR3.cjs +18 -0
- package/dist/chunk-CMV3NVR3.cjs.map +1 -0
- package/dist/{chunk-I4BQGFP5.cjs → chunk-D45G3J5E.cjs} +8 -2
- package/dist/chunk-D45G3J5E.cjs.map +1 -0
- package/dist/{chunk-CXDGJMYL.js → chunk-EJUGH25P.js} +8 -2
- package/dist/chunk-EJUGH25P.js.map +1 -0
- package/dist/{chunk-BFMVMUTU.cjs → chunk-ENYRJ4Q2.cjs} +3 -3
- package/dist/{chunk-BFMVMUTU.cjs.map → chunk-ENYRJ4Q2.cjs.map} +1 -1
- package/dist/chunk-EWAHJSTZ.js +18 -0
- package/dist/chunk-EWAHJSTZ.js.map +1 -0
- package/dist/chunk-F2QTCQXE.cjs +20 -0
- package/dist/chunk-F2QTCQXE.cjs.map +1 -0
- package/dist/chunk-FACLRSNS.js +16 -0
- package/dist/chunk-FACLRSNS.js.map +1 -0
- package/dist/chunk-FICI4AMA.cjs +24 -0
- package/dist/chunk-FICI4AMA.cjs.map +1 -0
- package/dist/chunk-FW54YBHD.cjs +23 -0
- package/dist/chunk-FW54YBHD.cjs.map +1 -0
- package/dist/chunk-HL6YTFI6.js +18 -0
- package/dist/chunk-HL6YTFI6.js.map +1 -0
- package/dist/chunk-JHWYLKFQ.cjs +23 -0
- package/dist/chunk-JHWYLKFQ.cjs.map +1 -0
- package/dist/chunk-KYPCPATQ.js +21 -0
- package/dist/chunk-KYPCPATQ.js.map +1 -0
- package/dist/chunk-LIC3EXRR.cjs +20 -0
- package/dist/chunk-LIC3EXRR.cjs.map +1 -0
- package/dist/chunk-M6NSGIVF.cjs +24 -0
- package/dist/chunk-M6NSGIVF.cjs.map +1 -0
- package/dist/chunk-MDBGFL5S.js +22 -0
- package/dist/chunk-MDBGFL5S.js.map +1 -0
- package/dist/chunk-NB62E57G.js +21 -0
- package/dist/chunk-NB62E57G.js.map +1 -0
- package/dist/chunk-QIIIL4BN.cjs +20 -0
- package/dist/chunk-QIIIL4BN.cjs.map +1 -0
- package/dist/chunk-RNC76LWZ.js +16 -0
- package/dist/chunk-RNC76LWZ.js.map +1 -0
- package/dist/chunk-TUO6GFCZ.cjs +20 -0
- package/dist/chunk-TUO6GFCZ.cjs.map +1 -0
- package/dist/chunk-UERUICKB.cjs +20 -0
- package/dist/chunk-UERUICKB.cjs.map +1 -0
- package/dist/chunk-UF32KQA3.cjs +18 -0
- package/dist/chunk-UF32KQA3.cjs.map +1 -0
- package/dist/chunk-W5WAATJ7.js +22 -0
- package/dist/chunk-W5WAATJ7.js.map +1 -0
- package/dist/chunk-WD7Y2RDG.js +16 -0
- package/dist/chunk-WD7Y2RDG.js.map +1 -0
- package/dist/chunk-WNFJK4HA.js +16 -0
- package/dist/chunk-WNFJK4HA.js.map +1 -0
- package/dist/chunk-XQO7TG53.cjs +18 -0
- package/dist/chunk-XQO7TG53.cjs.map +1 -0
- package/dist/chunk-XQW5XTYT.js +18 -0
- package/dist/chunk-XQW5XTYT.js.map +1 -0
- package/dist/chunk-ZB2G3XMO.cjs +18 -0
- package/dist/chunk-ZB2G3XMO.cjs.map +1 -0
- package/dist/chunk-ZZQ5FPWF.cjs +26 -0
- package/dist/chunk-ZZQ5FPWF.cjs.map +1 -0
- package/dist/core.cjs +44 -44
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/index.cjs +89 -73
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +29 -13
- package/dist/index.js.map +1 -1
- package/dist/pieces.cjs +1 -1
- package/dist/pieces.cjs.map +1 -1
- package/dist/pieces.d.cts +1 -1
- package/dist/pieces.d.ts +1 -1
- package/dist/pieces.js +1 -1
- package/dist/pieces.js.map +1 -1
- package/dist/server.cjs +15 -8
- package/dist/server.cjs.map +1 -1
- package/dist/server.js +10 -3
- package/dist/server.js.map +1 -1
- package/dist/themes/blue.d.cts +255 -3
- package/dist/themes/blue.d.ts +255 -3
- package/dist/themes/cafeCreme.cjs +12 -0
- package/dist/themes/cafeCreme.cjs.map +1 -0
- package/dist/themes/cafeCreme.d.cts +1 -0
- package/dist/themes/cafeCreme.d.ts +1 -0
- package/dist/themes/cafeCreme.js +3 -0
- package/dist/themes/cafeCreme.js.map +1 -0
- package/dist/themes/canvas.cjs +12 -0
- package/dist/themes/canvas.cjs.map +1 -0
- package/dist/themes/canvas.d.cts +1 -0
- package/dist/themes/canvas.d.ts +1 -0
- package/dist/themes/canvas.js +3 -0
- package/dist/themes/canvas.js.map +1 -0
- package/dist/themes/chesscomBlue.cjs +12 -0
- package/dist/themes/chesscomBlue.cjs.map +1 -0
- package/dist/themes/chesscomBlue.d.cts +1 -0
- package/dist/themes/chesscomBlue.d.ts +1 -0
- package/dist/themes/chesscomBlue.js +3 -0
- package/dist/themes/chesscomBlue.js.map +1 -0
- package/dist/themes/chesscomGreen.cjs +12 -0
- package/dist/themes/chesscomGreen.cjs.map +1 -0
- package/dist/themes/chesscomGreen.d.cts +1 -0
- package/dist/themes/chesscomGreen.d.ts +1 -0
- package/dist/themes/chesscomGreen.js +3 -0
- package/dist/themes/chesscomGreen.js.map +1 -0
- package/dist/themes/darkWood.cjs +12 -0
- package/dist/themes/darkWood.cjs.map +1 -0
- package/dist/themes/darkWood.d.cts +1 -0
- package/dist/themes/darkWood.d.ts +1 -0
- package/dist/themes/darkWood.js +3 -0
- package/dist/themes/darkWood.js.map +1 -0
- package/dist/themes/deuteranopia.cjs +12 -0
- package/dist/themes/deuteranopia.cjs.map +1 -0
- package/dist/themes/deuteranopia.d.cts +1 -0
- package/dist/themes/deuteranopia.d.ts +1 -0
- package/dist/themes/deuteranopia.js +3 -0
- package/dist/themes/deuteranopia.js.map +1 -0
- package/dist/themes/espresso.cjs +12 -0
- package/dist/themes/espresso.cjs.map +1 -0
- package/dist/themes/espresso.d.cts +1 -0
- package/dist/themes/espresso.d.ts +1 -0
- package/dist/themes/espresso.js +3 -0
- package/dist/themes/espresso.js.map +1 -0
- package/dist/themes/green.d.cts +1 -1
- package/dist/themes/green.d.ts +1 -1
- package/dist/themes/highContrast.cjs +12 -0
- package/dist/themes/highContrast.cjs.map +1 -0
- package/dist/themes/highContrast.d.cts +1 -0
- package/dist/themes/highContrast.d.ts +1 -0
- package/dist/themes/highContrast.js +3 -0
- package/dist/themes/highContrast.js.map +1 -0
- package/dist/themes/ic.cjs +12 -0
- package/dist/themes/ic.cjs.map +1 -0
- package/dist/themes/ic.d.cts +1 -0
- package/dist/themes/ic.d.ts +1 -0
- package/dist/themes/ic.js +3 -0
- package/dist/themes/ic.js.map +1 -0
- package/dist/themes/leather.cjs +12 -0
- package/dist/themes/leather.cjs.map +1 -0
- package/dist/themes/leather.d.cts +1 -0
- package/dist/themes/leather.d.ts +1 -0
- package/dist/themes/leather.js +3 -0
- package/dist/themes/leather.js.map +1 -0
- package/dist/themes/marble.cjs +12 -0
- package/dist/themes/marble.cjs.map +1 -0
- package/dist/themes/marble.d.cts +1 -0
- package/dist/themes/marble.d.ts +1 -0
- package/dist/themes/marble.js +3 -0
- package/dist/themes/marble.js.map +1 -0
- package/dist/themes/neon.cjs +12 -0
- package/dist/themes/neon.cjs.map +1 -0
- package/dist/themes/neon.d.cts +1 -0
- package/dist/themes/neon.d.ts +1 -0
- package/dist/themes/neon.js +3 -0
- package/dist/themes/neon.js.map +1 -0
- package/dist/themes/newspaper.cjs +12 -0
- package/dist/themes/newspaper.cjs.map +1 -0
- package/dist/themes/newspaper.d.cts +1 -0
- package/dist/themes/newspaper.d.ts +1 -0
- package/dist/themes/newspaper.js +3 -0
- package/dist/themes/newspaper.js.map +1 -0
- package/dist/themes/olive.cjs +12 -0
- package/dist/themes/olive.cjs.map +1 -0
- package/dist/themes/olive.d.cts +1 -0
- package/dist/themes/olive.d.ts +1 -0
- package/dist/themes/olive.js +3 -0
- package/dist/themes/olive.js.map +1 -0
- package/dist/themes/pink.cjs +12 -0
- package/dist/themes/pink.cjs.map +1 -0
- package/dist/themes/pink.d.cts +1 -0
- package/dist/themes/pink.d.ts +1 -0
- package/dist/themes/pink.js +3 -0
- package/dist/themes/pink.js.map +1 -0
- package/dist/themes/purple.cjs +12 -0
- package/dist/themes/purple.cjs.map +1 -0
- package/dist/themes/purple.d.cts +1 -0
- package/dist/themes/purple.d.ts +1 -0
- package/dist/themes/purple.js +3 -0
- package/dist/themes/purple.js.map +1 -0
- package/dist/themes/tritanopia.cjs +12 -0
- package/dist/themes/tritanopia.cjs.map +1 -0
- package/dist/themes/tritanopia.d.cts +1 -0
- package/dist/themes/tritanopia.d.ts +1 -0
- package/dist/themes/tritanopia.js +3 -0
- package/dist/themes/tritanopia.js.map +1 -0
- package/dist/themes/walnut.cjs +12 -0
- package/dist/themes/walnut.cjs.map +1 -0
- package/dist/themes/walnut.d.cts +1 -0
- package/dist/themes/walnut.d.ts +1 -0
- package/dist/themes/walnut.js +3 -0
- package/dist/themes/walnut.js.map +1 -0
- package/dist/themes/wood.d.cts +1 -1
- package/dist/themes/wood.d.ts +1 -1
- package/dist/themes.cjs +116 -8
- package/dist/themes.cjs.map +1 -1
- package/dist/themes.d.cts +1 -1
- package/dist/themes.d.ts +1 -1
- package/dist/themes.js +60 -6
- package/dist/themes.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-CXDGJMYL.js.map +0 -1
- package/dist/chunk-I4BQGFP5.cjs.map +0 -1
package/dist/pieces.cjs
CHANGED
package/dist/pieces.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/pieces/index.ts"],"names":["alpha","cburnett","neo","merida"],"mappings":";;;;;;;;;;AAyDO,IAAM,SAAA,GAAY,OAAO,MAAA,CAAO;AAAA,SACrCA,uBAAA;AAAA,YACAC,0BAAA;AAAA,EACA,QAAA,EAAAC,qBAAA;AAAA,UACAC,wBAAA;AAAA,OACAD;AACF,CAAC;AAKM,IAAM,eAAA,GAAkB","file":"pieces.cjs","sourcesContent":["/**\n * `gigaboard/pieces` — piece renderers for `<Chessboard/>`.\n *\n * Every set is a URL-backed `PieceRenderer` built by\n * {@link createImagePieceSet}. Ships **image** pieces (chess.com's public\n * PNG CDN by default) rather than inline SVG so the JS budget stays under\n * 1 KB per set — the pixels live in the browser's image cache, not in\n * your bundle.\n *\n * ### Tree-shaking\n *\n * Import a specific set from its sub-path to keep your bundle minimal:\n *\n * ```tsx\n * import { neo } from \"gigaboard/pieces/neo\"; // chess.com default\n * import { chesscom } from \"gigaboard/pieces/chesscom\"; // alias of `neo`\n * import { alpha } from \"gigaboard/pieces/alpha\";\n * import { cburnett } from \"gigaboard/pieces/cburnett\";\n * import { merida } from \"gigaboard/pieces/merida\";\n * ```\n *\n * Or bring the whole registry (useful when building a piece-set picker):\n *\n * ```tsx\n * import { pieceSets } from \"gigaboard/pieces\";\n * ```\n *\n * ### Custom chess.com styles\n *\n * chess.com hosts ~25 piece styles — if one of them isn't exported here\n * you can plug its slug into {@link chesscomPieceUrls} and build the\n * renderer yourself:\n *\n * ```tsx\n * import { chesscomPieceUrls, createImagePieceSet } from \"gigaboard/pieces\";\n * const marble = createImagePieceSet(chesscomPieceUrls(\"marble\"));\n * ```\n */\n\nimport { alpha } from \"./sets/alpha.js\";\nimport { cburnett } from \"./sets/cburnett.js\";\nimport { chesscom } from \"./sets/chesscom.js\";\nimport { merida } from \"./sets/merida.js\";\nimport { neo } from \"./sets/neo.js\";\n\nexport type {\n PieceRenderer,\n PieceUrlTable,\n} from \"./create-image-piece-set.js\";\nexport {\n BOARD_CELL_KEY,\n chesscomPieceUrls,\n createImagePieceSet,\n} from \"./create-image-piece-set.js\";\nexport { alpha, cburnett, chesscom, merida, neo };\n\n/** Registry of every built-in set. Handy when building piece-set pickers. */\nexport const pieceSets = Object.freeze({\n alpha,\n cburnett,\n chesscom,\n merida,\n neo,\n});\n\n/** Union of built-in piece-set names. */\nexport type PieceSetName = keyof typeof pieceSets;\n\nexport const PACKAGE_VERSION = \"1.3.
|
|
1
|
+
{"version":3,"sources":["../src/pieces/index.ts"],"names":["alpha","cburnett","neo","merida"],"mappings":";;;;;;;;;;AAyDO,IAAM,SAAA,GAAY,OAAO,MAAA,CAAO;AAAA,SACrCA,uBAAA;AAAA,YACAC,0BAAA;AAAA,EACA,QAAA,EAAAC,qBAAA;AAAA,UACAC,wBAAA;AAAA,OACAD;AACF,CAAC;AAKM,IAAM,eAAA,GAAkB","file":"pieces.cjs","sourcesContent":["/**\n * `gigaboard/pieces` — piece renderers for `<Chessboard/>`.\n *\n * Every set is a URL-backed `PieceRenderer` built by\n * {@link createImagePieceSet}. Ships **image** pieces (chess.com's public\n * PNG CDN by default) rather than inline SVG so the JS budget stays under\n * 1 KB per set — the pixels live in the browser's image cache, not in\n * your bundle.\n *\n * ### Tree-shaking\n *\n * Import a specific set from its sub-path to keep your bundle minimal:\n *\n * ```tsx\n * import { neo } from \"gigaboard/pieces/neo\"; // chess.com default\n * import { chesscom } from \"gigaboard/pieces/chesscom\"; // alias of `neo`\n * import { alpha } from \"gigaboard/pieces/alpha\";\n * import { cburnett } from \"gigaboard/pieces/cburnett\";\n * import { merida } from \"gigaboard/pieces/merida\";\n * ```\n *\n * Or bring the whole registry (useful when building a piece-set picker):\n *\n * ```tsx\n * import { pieceSets } from \"gigaboard/pieces\";\n * ```\n *\n * ### Custom chess.com styles\n *\n * chess.com hosts ~25 piece styles — if one of them isn't exported here\n * you can plug its slug into {@link chesscomPieceUrls} and build the\n * renderer yourself:\n *\n * ```tsx\n * import { chesscomPieceUrls, createImagePieceSet } from \"gigaboard/pieces\";\n * const marble = createImagePieceSet(chesscomPieceUrls(\"marble\"));\n * ```\n */\n\nimport { alpha } from \"./sets/alpha.js\";\nimport { cburnett } from \"./sets/cburnett.js\";\nimport { chesscom } from \"./sets/chesscom.js\";\nimport { merida } from \"./sets/merida.js\";\nimport { neo } from \"./sets/neo.js\";\n\nexport type {\n PieceRenderer,\n PieceUrlTable,\n} from \"./create-image-piece-set.js\";\nexport {\n BOARD_CELL_KEY,\n chesscomPieceUrls,\n createImagePieceSet,\n} from \"./create-image-piece-set.js\";\nexport { alpha, cburnett, chesscom, merida, neo };\n\n/** Registry of every built-in set. Handy when building piece-set pickers. */\nexport const pieceSets = Object.freeze({\n alpha,\n cburnett,\n chesscom,\n merida,\n neo,\n});\n\n/** Union of built-in piece-set names. */\nexport type PieceSetName = keyof typeof pieceSets;\n\nexport const PACKAGE_VERSION = \"1.3.3\";\n"]}
|
package/dist/pieces.d.cts
CHANGED
|
@@ -16,6 +16,6 @@ declare const pieceSets: Readonly<{
|
|
|
16
16
|
}>;
|
|
17
17
|
/** Union of built-in piece-set names. */
|
|
18
18
|
type PieceSetName = keyof typeof pieceSets;
|
|
19
|
-
declare const PACKAGE_VERSION = "1.3.
|
|
19
|
+
declare const PACKAGE_VERSION = "1.3.3";
|
|
20
20
|
|
|
21
21
|
export { PACKAGE_VERSION, PieceRenderer, type PieceSetName, pieceSets };
|
package/dist/pieces.d.ts
CHANGED
|
@@ -16,6 +16,6 @@ declare const pieceSets: Readonly<{
|
|
|
16
16
|
}>;
|
|
17
17
|
/** Union of built-in piece-set names. */
|
|
18
18
|
type PieceSetName = keyof typeof pieceSets;
|
|
19
|
-
declare const PACKAGE_VERSION = "1.3.
|
|
19
|
+
declare const PACKAGE_VERSION = "1.3.3";
|
|
20
20
|
|
|
21
21
|
export { PACKAGE_VERSION, PieceRenderer, type PieceSetName, pieceSets };
|
package/dist/pieces.js
CHANGED
package/dist/pieces.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/pieces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAyDO,IAAM,SAAA,GAAY,OAAO,MAAA,CAAO;AAAA,EACrC,KAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA,EAAA,GAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAC;AAKM,IAAM,eAAA,GAAkB","file":"pieces.js","sourcesContent":["/**\n * `gigaboard/pieces` — piece renderers for `<Chessboard/>`.\n *\n * Every set is a URL-backed `PieceRenderer` built by\n * {@link createImagePieceSet}. Ships **image** pieces (chess.com's public\n * PNG CDN by default) rather than inline SVG so the JS budget stays under\n * 1 KB per set — the pixels live in the browser's image cache, not in\n * your bundle.\n *\n * ### Tree-shaking\n *\n * Import a specific set from its sub-path to keep your bundle minimal:\n *\n * ```tsx\n * import { neo } from \"gigaboard/pieces/neo\"; // chess.com default\n * import { chesscom } from \"gigaboard/pieces/chesscom\"; // alias of `neo`\n * import { alpha } from \"gigaboard/pieces/alpha\";\n * import { cburnett } from \"gigaboard/pieces/cburnett\";\n * import { merida } from \"gigaboard/pieces/merida\";\n * ```\n *\n * Or bring the whole registry (useful when building a piece-set picker):\n *\n * ```tsx\n * import { pieceSets } from \"gigaboard/pieces\";\n * ```\n *\n * ### Custom chess.com styles\n *\n * chess.com hosts ~25 piece styles — if one of them isn't exported here\n * you can plug its slug into {@link chesscomPieceUrls} and build the\n * renderer yourself:\n *\n * ```tsx\n * import { chesscomPieceUrls, createImagePieceSet } from \"gigaboard/pieces\";\n * const marble = createImagePieceSet(chesscomPieceUrls(\"marble\"));\n * ```\n */\n\nimport { alpha } from \"./sets/alpha.js\";\nimport { cburnett } from \"./sets/cburnett.js\";\nimport { chesscom } from \"./sets/chesscom.js\";\nimport { merida } from \"./sets/merida.js\";\nimport { neo } from \"./sets/neo.js\";\n\nexport type {\n PieceRenderer,\n PieceUrlTable,\n} from \"./create-image-piece-set.js\";\nexport {\n BOARD_CELL_KEY,\n chesscomPieceUrls,\n createImagePieceSet,\n} from \"./create-image-piece-set.js\";\nexport { alpha, cburnett, chesscom, merida, neo };\n\n/** Registry of every built-in set. Handy when building piece-set pickers. */\nexport const pieceSets = Object.freeze({\n alpha,\n cburnett,\n chesscom,\n merida,\n neo,\n});\n\n/** Union of built-in piece-set names. */\nexport type PieceSetName = keyof typeof pieceSets;\n\nexport const PACKAGE_VERSION = \"1.3.
|
|
1
|
+
{"version":3,"sources":["../src/pieces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAyDO,IAAM,SAAA,GAAY,OAAO,MAAA,CAAO;AAAA,EACrC,KAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA,EAAA,GAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAC;AAKM,IAAM,eAAA,GAAkB","file":"pieces.js","sourcesContent":["/**\n * `gigaboard/pieces` — piece renderers for `<Chessboard/>`.\n *\n * Every set is a URL-backed `PieceRenderer` built by\n * {@link createImagePieceSet}. Ships **image** pieces (chess.com's public\n * PNG CDN by default) rather than inline SVG so the JS budget stays under\n * 1 KB per set — the pixels live in the browser's image cache, not in\n * your bundle.\n *\n * ### Tree-shaking\n *\n * Import a specific set from its sub-path to keep your bundle minimal:\n *\n * ```tsx\n * import { neo } from \"gigaboard/pieces/neo\"; // chess.com default\n * import { chesscom } from \"gigaboard/pieces/chesscom\"; // alias of `neo`\n * import { alpha } from \"gigaboard/pieces/alpha\";\n * import { cburnett } from \"gigaboard/pieces/cburnett\";\n * import { merida } from \"gigaboard/pieces/merida\";\n * ```\n *\n * Or bring the whole registry (useful when building a piece-set picker):\n *\n * ```tsx\n * import { pieceSets } from \"gigaboard/pieces\";\n * ```\n *\n * ### Custom chess.com styles\n *\n * chess.com hosts ~25 piece styles — if one of them isn't exported here\n * you can plug its slug into {@link chesscomPieceUrls} and build the\n * renderer yourself:\n *\n * ```tsx\n * import { chesscomPieceUrls, createImagePieceSet } from \"gigaboard/pieces\";\n * const marble = createImagePieceSet(chesscomPieceUrls(\"marble\"));\n * ```\n */\n\nimport { alpha } from \"./sets/alpha.js\";\nimport { cburnett } from \"./sets/cburnett.js\";\nimport { chesscom } from \"./sets/chesscom.js\";\nimport { merida } from \"./sets/merida.js\";\nimport { neo } from \"./sets/neo.js\";\n\nexport type {\n PieceRenderer,\n PieceUrlTable,\n} from \"./create-image-piece-set.js\";\nexport {\n BOARD_CELL_KEY,\n chesscomPieceUrls,\n createImagePieceSet,\n} from \"./create-image-piece-set.js\";\nexport { alpha, cburnett, chesscom, merida, neo };\n\n/** Registry of every built-in set. Handy when building piece-set pickers. */\nexport const pieceSets = Object.freeze({\n alpha,\n cburnett,\n chesscom,\n merida,\n neo,\n});\n\n/** Union of built-in piece-set names. */\nexport type PieceSetName = keyof typeof pieceSets;\n\nexport const PACKAGE_VERSION = \"1.3.3\";\n"]}
|
package/dist/server.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkD45G3J5E_cjs = require('./chunk-D45G3J5E.cjs');
|
|
4
4
|
require('./chunk-G6ZFOJZR.cjs');
|
|
5
5
|
require('./chunk-AYVQCHSG.cjs');
|
|
6
6
|
require('./chunk-FNRS6YJI.cjs');
|
|
@@ -22,14 +22,14 @@ function StaticChessboard(props) {
|
|
|
22
22
|
const {
|
|
23
23
|
fen,
|
|
24
24
|
orientation = "white",
|
|
25
|
-
theme =
|
|
26
|
-
pieces =
|
|
25
|
+
theme = chunkD45G3J5E_cjs.defaultTheme,
|
|
26
|
+
pieces = chunkD45G3J5E_cjs.defaultPieces,
|
|
27
27
|
showCoordinates = true,
|
|
28
28
|
style,
|
|
29
29
|
className,
|
|
30
30
|
ariaLabel = "Chess position"
|
|
31
31
|
} = props;
|
|
32
|
-
const board =
|
|
32
|
+
const board = chunkD45G3J5E_cjs.parseFenPlacement(fen);
|
|
33
33
|
const squares = buildSquareOrder(orientation);
|
|
34
34
|
const containerStyle = {
|
|
35
35
|
position: "relative",
|
|
@@ -73,10 +73,16 @@ function StaticChessboard(props) {
|
|
|
73
73
|
"aria-rowindex": rank + 1,
|
|
74
74
|
"aria-colindex": file + 1,
|
|
75
75
|
"data-square": algebraicOf(index),
|
|
76
|
+
"data-gb-square": "",
|
|
76
77
|
"data-light": isLight ? "true" : "false",
|
|
77
78
|
style: {
|
|
78
|
-
|
|
79
|
+
position: "relative",
|
|
80
|
+
backgroundColor: `var(${isLight ? chunkD45G3J5E_cjs.CSS_VARS.SQ_LIGHT : chunkD45G3J5E_cjs.CSS_VARS.SQ_DARK})`,
|
|
81
|
+
backgroundImage: `var(${isLight ? chunkD45G3J5E_cjs.CSS_VARS.SQ_LIGHT_IMAGE : chunkD45G3J5E_cjs.CSS_VARS.SQ_DARK_IMAGE},none)`,
|
|
82
|
+
backgroundSize: `var(${chunkD45G3J5E_cjs.CSS_VARS.SQ_IMAGE_SIZE},cover)`,
|
|
83
|
+
backgroundBlendMode: `var(${chunkD45G3J5E_cjs.CSS_VARS.SQ_BLEND_MODE},normal)`,
|
|
79
84
|
userSelect: "none",
|
|
85
|
+
outline: "none",
|
|
80
86
|
containerType: "size"
|
|
81
87
|
}
|
|
82
88
|
},
|
|
@@ -114,7 +120,8 @@ function StaticChessboard(props) {
|
|
|
114
120
|
display: "flex",
|
|
115
121
|
alignItems: "center",
|
|
116
122
|
justifyContent: "center",
|
|
117
|
-
containerType: "size"
|
|
123
|
+
containerType: "size",
|
|
124
|
+
filter: `var(${cell <= 6 ? chunkD45G3J5E_cjs.CSS_VARS.PIECE_FILTER_WHITE : chunkD45G3J5E_cjs.CSS_VARS.PIECE_FILTER_BLACK}, none)`
|
|
118
125
|
},
|
|
119
126
|
children: pieces({ cell, square: idx })
|
|
120
127
|
},
|
|
@@ -171,7 +178,7 @@ function StaticCoordinates({ orientation }) {
|
|
|
171
178
|
position: "absolute",
|
|
172
179
|
left: `${col * 12.5 + 10}%`,
|
|
173
180
|
bottom: "1%",
|
|
174
|
-
color: `var(${isLightSquare ?
|
|
181
|
+
color: `var(${isLightSquare ? chunkD45G3J5E_cjs.CSS_VARS.COORDINATE_LIGHT : chunkD45G3J5E_cjs.CSS_VARS.COORDINATE_DARK})`
|
|
175
182
|
},
|
|
176
183
|
children: letter
|
|
177
184
|
},
|
|
@@ -190,7 +197,7 @@ function StaticCoordinates({ orientation }) {
|
|
|
190
197
|
position: "absolute",
|
|
191
198
|
top: `${row * 12.5 + 1}%`,
|
|
192
199
|
left: "1%",
|
|
193
|
-
color: `var(${isLightSquare ?
|
|
200
|
+
color: `var(${isLightSquare ? chunkD45G3J5E_cjs.CSS_VARS.COORDINATE_LIGHT : chunkD45G3J5E_cjs.CSS_VARS.COORDINATE_DARK})`
|
|
194
201
|
},
|
|
195
202
|
children: rank + 1
|
|
196
203
|
},
|
package/dist/server.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/server.tsx"],"names":["defaultTheme","defaultPieces","parseFen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AA,CAAiB,QAAA,GAAW,IAAA,IAAQ,CAAA,KAAM,CAAA;AAChD,UAAA,uBACED,cAAA;AAAA,YAAC,MAAA;AAAA,YAAA;AAAA,cAEC,KAAA,EAAO;AAAA,gBACL,QAAA,EAAU,UAAA;AAAA,gBACV,GAAA,EAAK,CAAA,EAAG,GAAA,GAAM,IAAA,GAAO,CAAC,CAAA,CAAA,CAAA;AAAA,gBACtB,IAAA,EAAM,IAAA;AAAA,gBACN,OAAO,CAAA,IAAA,EAAO,aAAA,GAAgBC,0BAAA,CAAS,gBAAA,GAAmBA,2BAAS,eAAe,CAAA,CAAA;AAAA,eACpF;AAAA,cAEC,QAAA,EAAA,IAAA,GAAO;AAAA,aAAA;AAAA,YARH,QAAQ,IAAI,CAAA;AAAA,WASnB;AAAA,QAEJ,CAAC;AAAA;AAAA;AAAA,GACH;AAEJ","file":"server.cjs","sourcesContent":["/**\n * `gigaboard/server` — server-only static board.\n *\n * Ships **zero** client JavaScript. No hooks, no state, no event handlers,\n * no imports of any client module. Imports only:\n *\n * - `default-theme.ts`\n * - `default-pieces.tsx`\n * - `types.ts` (types only)\n *\n * Perfect for PGN viewers, position diagrams in blog posts, shareable\n * board URLs, and anywhere a board doesn't need interaction. Renders\n * produce identical markup between Node and the browser so they hydrate\n * cleanly under an interactive `<Chessboard/>` if you later attach one.\n *\n * @example\n * ```tsx\n * import { StaticChessboard } from \"gigaboard/server\";\n *\n * export default function Page() {\n * return (\n * <StaticChessboard fen=\"rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq - 0 1\" />\n * );\n * }\n * ```\n */\n\nimport type { CSSProperties, ReactNode } from \"react\";\nimport type { BoardCell, SquareIndex } from \"./core/index.js\";\nimport { CSS_VARS, defaultTheme } from \"./default-theme.js\";\nimport { parseFenPlacement } from \"./fen.js\";\nimport { defaultPieces } from \"./pieces/default-pieces.js\";\nimport type { Orientation, PieceRenderer, Theme } from \"./types.js\";\n\n/* ============================================================ geometry */\n\nfunction algebraicOf(index: SquareIndex): string {\n const file = index & 7;\n const rank = index >> 3;\n return `${String.fromCharCode(0x61 + file)}${rank + 1}`;\n}\n\nfunction positionOf(index: SquareIndex, orientation: Orientation): { x: number; y: number } {\n const file = index & 7;\n const rank = index >> 3;\n const col = orientation === \"white\" ? file : 7 - file;\n const row = orientation === \"white\" ? 7 - rank : rank;\n return { x: col * 12.5, y: row * 12.5 };\n}\n\n/* ============================================================ component */\n\n/** Props for {@link StaticChessboard}. */\nexport interface StaticChessboardProps {\n /** Piece-placement FEN (first whitespace-delimited field is enough). */\n readonly fen: string;\n\n /** Board orientation. Defaults to `\"white\"`. */\n readonly orientation?: Orientation;\n\n /** Theme — defaults to the green palette from `gigaboard/themes`. */\n readonly theme?: Theme;\n\n /** Piece renderer — defaults to the `neo` set from `gigaboard/pieces`. */\n readonly pieces?: PieceRenderer;\n\n /** Show algebraic coordinate labels on the edges. Default `true`. */\n readonly showCoordinates?: boolean;\n\n /** Optional container style overrides. */\n readonly style?: CSSProperties;\n\n /** Optional class name on the outer container. */\n readonly className?: string;\n\n /** Accessible label. Default `\"Chess position\"`. */\n readonly ariaLabel?: string;\n}\n\n/**\n * Static board for server rendering. No interactivity; no client JS\n * shipped. Exactly the same visual layout as the interactive\n * `<Chessboard/>`, so a static SSR board can be swapped for an\n * interactive one on hydration without the markup shifting.\n */\nexport function StaticChessboard(props: StaticChessboardProps): ReactNode {\n const {\n fen,\n orientation = \"white\",\n theme = defaultTheme,\n pieces = defaultPieces,\n showCoordinates = true,\n style,\n className,\n ariaLabel = \"Chess position\",\n } = props;\n\n const board = parseFenPlacement(fen);\n const squares = buildSquareOrder(orientation);\n\n const containerStyle: CSSProperties = {\n position: \"relative\",\n aspectRatio: \"1 / 1\",\n width: \"100%\",\n ...(theme as CSSProperties),\n ...style,\n };\n\n return (\n <div\n className={className}\n style={containerStyle}\n data-gb-orientation={orientation}\n data-gb-static=\"true\"\n >\n {/* 8×8 grid of static squares — no event handlers, no tabindex. */}\n <div\n role=\"grid\"\n aria-label={ariaLabel}\n aria-rowcount={8}\n aria-colcount={8}\n aria-readonly=\"true\"\n style={{\n position: \"absolute\",\n inset: 0,\n display: \"grid\",\n gridTemplateColumns: \"repeat(8, 1fr)\",\n gridTemplateRows: \"repeat(8, 1fr)\",\n }}\n >\n {squares.map((index) => {\n const file = index & 7;\n const rank = index >> 3;\n const isLight = (file + rank) % 2 === 1;\n return (\n <div\n key={index}\n role=\"gridcell\"\n aria-label={algebraicOf(index)}\n aria-rowindex={rank + 1}\n aria-colindex={file + 1}\n data-square={algebraicOf(index)}\n data-light={isLight ? \"true\" : \"false\"}\n style={{\n background: `var(${isLight ? CSS_VARS.SQ_LIGHT : CSS_VARS.SQ_DARK})`,\n userSelect: \"none\",\n containerType: \"size\",\n }}\n />\n );\n })}\n </div>\n\n {/* Piece overlay — one div per occupied square. */}\n <div\n aria-hidden=\"true\"\n style={{\n position: \"absolute\",\n inset: 0,\n pointerEvents: \"none\",\n }}\n >\n {Array.from({ length: 64 }, (_, i) => {\n const cell = board[i] as BoardCell;\n if (cell === 0) return null;\n const idx = i as SquareIndex;\n const square = algebraicOf(idx);\n const { x, y } = positionOf(idx, orientation);\n return (\n <div\n key={square}\n data-piece-square={square}\n data-piece-cell={cell}\n style={{\n position: \"absolute\",\n left: `${x}%`,\n top: `${y}%`,\n width: \"12.5%\",\n height: \"12.5%\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n containerType: \"size\",\n }}\n >\n {pieces({ cell, square: idx })}\n </div>\n );\n })}\n </div>\n\n {showCoordinates ? <StaticCoordinates orientation={orientation} /> : null}\n </div>\n );\n}\n\n/* ======================================================== subsidiary helpers */\n\n/** Same rank-first ordering used by the interactive BoardGrid. */\nfunction buildSquareOrder(orientation: Orientation): SquareIndex[] {\n const squares: SquareIndex[] = [];\n if (orientation === \"white\") {\n for (let rank = 7; rank >= 0; rank--) {\n for (let file = 0; file < 8; file++) {\n squares.push((rank * 8 + file) as SquareIndex);\n }\n }\n } else {\n for (let rank = 0; rank < 8; rank++) {\n for (let file = 7; file >= 0; file--) {\n squares.push((rank * 8 + file) as SquareIndex);\n }\n }\n }\n return squares;\n}\n\nconst FILE_LETTERS = [\"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\"] as const;\n\n/** Pure coordinate overlay — identical output to the interactive version. */\nfunction StaticCoordinates({ orientation }: { orientation: Orientation }): ReactNode {\n return (\n <div\n aria-hidden=\"true\"\n style={{\n position: \"absolute\",\n inset: 0,\n pointerEvents: \"none\",\n fontSize: \"min(1.6vmin, 11px)\",\n fontWeight: 600,\n fontFamily: \"system-ui, -apple-system, sans-serif\",\n }}\n >\n {FILE_LETTERS.map((letter, idx) => {\n const col = orientation === \"white\" ? idx : 7 - idx;\n const bottomRank = orientation === \"white\" ? 0 : 7;\n const isLightSquare = (col + bottomRank) % 2 === 1;\n return (\n <span\n key={`file-${letter}`}\n style={{\n position: \"absolute\",\n left: `${col * 12.5 + 10}%`,\n bottom: \"1%\",\n color: `var(${isLightSquare ? CSS_VARS.COORDINATE_LIGHT : CSS_VARS.COORDINATE_DARK})`,\n }}\n >\n {letter}\n </span>\n );\n })}\n {FILE_LETTERS.map((_, idx) => {\n const rank = idx;\n const row = orientation === \"white\" ? 7 - rank : rank;\n const leftFile = orientation === \"white\" ? 0 : 7;\n const isLightSquare = (leftFile + rank) % 2 === 1;\n return (\n <span\n key={`rank-${rank}`}\n style={{\n position: \"absolute\",\n top: `${row * 12.5 + 1}%`,\n left: \"1%\",\n color: `var(${isLightSquare ? CSS_VARS.COORDINATE_LIGHT : CSS_VARS.COORDINATE_DARK})`,\n }}\n >\n {rank + 1}\n </span>\n );\n })}\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/server.tsx"],"names":["defaultTheme","defaultPieces","parseFenPlacement","jsxs","jsx","CSS_VARS"],"mappings":";;;;;;;;AAoCA,SAAS,YAAY,KAAA,EAA4B;AAC/C,EAAA,MAAM,OAA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,eACpF;AAAA,cAEC,QAAA,EAAA;AAAA,aAAA;AAAA,YARI,QAAQ,MAAM,CAAA;AAAA,WASrB;AAAA,QAEJ,CAAC,CAAA;AAAA,QACA,YAAA,CAAa,GAAA,CAAI,CAAC,CAAA,EAAG,GAAA,KAAQ;AAC5B,UAAA,MAAM,IAAA,GAAO,GAAA;AACb,UAAA,MAAM,GAAA,GAAM,WAAA,KAAgB,OAAA,GAAU,CAAA,GAAI,IAAA,GAAO,IAAA;AACjD,UAAA,MAAM,QAAA,GAAW,WAAA,KAAgB,OAAA,GAAU,CAAA,GAAI,CAAA;AAC/C,UAAA,MAAM,aAAA,GAAA,CAAiB,QAAA,GAAW,IAAA,IAAQ,CAAA,KAAM,CAAA;AAChD,UAAA,uBACED,cAAA;AAAA,YAAC,MAAA;AAAA,YAAA;AAAA,cAEC,KAAA,EAAO;AAAA,gBACL,QAAA,EAAU,UAAA;AAAA,gBACV,GAAA,EAAK,CAAA,EAAG,GAAA,GAAM,IAAA,GAAO,CAAC,CAAA,CAAA,CAAA;AAAA,gBACtB,IAAA,EAAM,IAAA;AAAA,gBACN,OAAO,CAAA,IAAA,EAAO,aAAA,GAAgBC,0BAAA,CAAS,gBAAA,GAAmBA,2BAAS,eAAe,CAAA,CAAA;AAAA,eACpF;AAAA,cAEC,QAAA,EAAA,IAAA,GAAO;AAAA,aAAA;AAAA,YARH,QAAQ,IAAI,CAAA;AAAA,WASnB;AAAA,QAEJ,CAAC;AAAA;AAAA;AAAA,GACH;AAEJ","file":"server.cjs","sourcesContent":["/**\n * `gigaboard/server` — server-only static board.\n *\n * Ships **zero** client JavaScript. No hooks, no state, no event handlers,\n * no imports of any client module. Imports only:\n *\n * - `default-theme.ts`\n * - `default-pieces.tsx`\n * - `types.ts` (types only)\n *\n * Perfect for PGN viewers, position diagrams in blog posts, shareable\n * board URLs, and anywhere a board doesn't need interaction. Renders\n * produce identical markup between Node and the browser so they hydrate\n * cleanly under an interactive `<Chessboard/>` if you later attach one.\n *\n * @example\n * ```tsx\n * import { StaticChessboard } from \"gigaboard/server\";\n *\n * export default function Page() {\n * return (\n * <StaticChessboard fen=\"rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq - 0 1\" />\n * );\n * }\n * ```\n */\n\nimport type { CSSProperties, ReactNode } from \"react\";\nimport type { BoardCell, SquareIndex } from \"./core/index.js\";\nimport { CSS_VARS, defaultTheme } from \"./default-theme.js\";\nimport { parseFenPlacement } from \"./fen.js\";\nimport { defaultPieces } from \"./pieces/default-pieces.js\";\nimport type { Orientation, PieceRenderer, Theme } from \"./types.js\";\n\n/* ============================================================ geometry */\n\nfunction algebraicOf(index: SquareIndex): string {\n const file = index & 7;\n const rank = index >> 3;\n return `${String.fromCharCode(0x61 + file)}${rank + 1}`;\n}\n\nfunction positionOf(index: SquareIndex, orientation: Orientation): { x: number; y: number } {\n const file = index & 7;\n const rank = index >> 3;\n const col = orientation === \"white\" ? file : 7 - file;\n const row = orientation === \"white\" ? 7 - rank : rank;\n return { x: col * 12.5, y: row * 12.5 };\n}\n\n/* ============================================================ component */\n\n/** Props for {@link StaticChessboard}. */\nexport interface StaticChessboardProps {\n /** Piece-placement FEN (first whitespace-delimited field is enough). */\n readonly fen: string;\n\n /** Board orientation. Defaults to `\"white\"`. */\n readonly orientation?: Orientation;\n\n /** Theme — defaults to the green palette from `gigaboard/themes`. */\n readonly theme?: Theme;\n\n /** Piece renderer — defaults to the `neo` set from `gigaboard/pieces`. */\n readonly pieces?: PieceRenderer;\n\n /** Show algebraic coordinate labels on the edges. Default `true`. */\n readonly showCoordinates?: boolean;\n\n /** Optional container style overrides. */\n readonly style?: CSSProperties;\n\n /** Optional class name on the outer container. */\n readonly className?: string;\n\n /** Accessible label. Default `\"Chess position\"`. */\n readonly ariaLabel?: string;\n}\n\n/**\n * Static board for server rendering. No interactivity; no client JS\n * shipped. Exactly the same visual layout as the interactive\n * `<Chessboard/>`, so a static SSR board can be swapped for an\n * interactive one on hydration without the markup shifting.\n */\nexport function StaticChessboard(props: StaticChessboardProps): ReactNode {\n const {\n fen,\n orientation = \"white\",\n theme = defaultTheme,\n pieces = defaultPieces,\n showCoordinates = true,\n style,\n className,\n ariaLabel = \"Chess position\",\n } = props;\n\n const board = parseFenPlacement(fen);\n const squares = buildSquareOrder(orientation);\n\n const containerStyle: CSSProperties = {\n position: \"relative\",\n aspectRatio: \"1 / 1\",\n width: \"100%\",\n ...(theme as CSSProperties),\n ...style,\n };\n\n return (\n <div\n className={className}\n style={containerStyle}\n data-gb-orientation={orientation}\n data-gb-static=\"true\"\n >\n {/* 8×8 grid of static squares — no event handlers, no tabindex. */}\n <div\n role=\"grid\"\n aria-label={ariaLabel}\n aria-rowcount={8}\n aria-colcount={8}\n aria-readonly=\"true\"\n style={{\n position: \"absolute\",\n inset: 0,\n display: \"grid\",\n gridTemplateColumns: \"repeat(8, 1fr)\",\n gridTemplateRows: \"repeat(8, 1fr)\",\n }}\n >\n {squares.map((index) => {\n const file = index & 7;\n const rank = index >> 3;\n const isLight = (file + rank) % 2 === 1;\n return (\n <div\n key={index}\n role=\"gridcell\"\n aria-label={algebraicOf(index)}\n aria-rowindex={rank + 1}\n aria-colindex={file + 1}\n data-square={algebraicOf(index)}\n data-gb-square=\"\"\n data-light={isLight ? \"true\" : \"false\"}\n style={{\n position: \"relative\",\n backgroundColor: `var(${isLight ? CSS_VARS.SQ_LIGHT : CSS_VARS.SQ_DARK})`,\n backgroundImage: `var(${isLight ? CSS_VARS.SQ_LIGHT_IMAGE : CSS_VARS.SQ_DARK_IMAGE},none)`,\n backgroundSize: `var(${CSS_VARS.SQ_IMAGE_SIZE},cover)`,\n backgroundBlendMode: `var(${CSS_VARS.SQ_BLEND_MODE},normal)`,\n userSelect: \"none\",\n outline: \"none\",\n containerType: \"size\",\n }}\n />\n );\n })}\n </div>\n\n {/* Piece overlay — one div per occupied square. */}\n <div\n aria-hidden=\"true\"\n style={{\n position: \"absolute\",\n inset: 0,\n pointerEvents: \"none\",\n }}\n >\n {Array.from({ length: 64 }, (_, i) => {\n const cell = board[i] as BoardCell;\n if (cell === 0) return null;\n const idx = i as SquareIndex;\n const square = algebraicOf(idx);\n const { x, y } = positionOf(idx, orientation);\n return (\n <div\n key={square}\n data-piece-square={square}\n data-piece-cell={cell}\n style={{\n position: \"absolute\",\n left: `${x}%`,\n top: `${y}%`,\n width: \"12.5%\",\n height: \"12.5%\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n containerType: \"size\",\n filter: `var(${cell <= 6 ? CSS_VARS.PIECE_FILTER_WHITE : CSS_VARS.PIECE_FILTER_BLACK}, none)`,\n }}\n >\n {pieces({ cell, square: idx })}\n </div>\n );\n })}\n </div>\n\n {showCoordinates ? <StaticCoordinates orientation={orientation} /> : null}\n </div>\n );\n}\n\n/* ======================================================== subsidiary helpers */\n\n/** Same rank-first ordering used by the interactive BoardGrid. */\nfunction buildSquareOrder(orientation: Orientation): SquareIndex[] {\n const squares: SquareIndex[] = [];\n if (orientation === \"white\") {\n for (let rank = 7; rank >= 0; rank--) {\n for (let file = 0; file < 8; file++) {\n squares.push((rank * 8 + file) as SquareIndex);\n }\n }\n } else {\n for (let rank = 0; rank < 8; rank++) {\n for (let file = 7; file >= 0; file--) {\n squares.push((rank * 8 + file) as SquareIndex);\n }\n }\n }\n return squares;\n}\n\nconst FILE_LETTERS = [\"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\"] as const;\n\n/** Pure coordinate overlay — identical output to the interactive version. */\nfunction StaticCoordinates({ orientation }: { orientation: Orientation }): ReactNode {\n return (\n <div\n aria-hidden=\"true\"\n style={{\n position: \"absolute\",\n inset: 0,\n pointerEvents: \"none\",\n fontSize: \"min(1.6vmin, 11px)\",\n fontWeight: 600,\n fontFamily: \"system-ui, -apple-system, sans-serif\",\n }}\n >\n {FILE_LETTERS.map((letter, idx) => {\n const col = orientation === \"white\" ? idx : 7 - idx;\n const bottomRank = orientation === \"white\" ? 0 : 7;\n const isLightSquare = (col + bottomRank) % 2 === 1;\n return (\n <span\n key={`file-${letter}`}\n style={{\n position: \"absolute\",\n left: `${col * 12.5 + 10}%`,\n bottom: \"1%\",\n color: `var(${isLightSquare ? CSS_VARS.COORDINATE_LIGHT : CSS_VARS.COORDINATE_DARK})`,\n }}\n >\n {letter}\n </span>\n );\n })}\n {FILE_LETTERS.map((_, idx) => {\n const rank = idx;\n const row = orientation === \"white\" ? 7 - rank : rank;\n const leftFile = orientation === \"white\" ? 0 : 7;\n const isLightSquare = (leftFile + rank) % 2 === 1;\n return (\n <span\n key={`rank-${rank}`}\n style={{\n position: \"absolute\",\n top: `${row * 12.5 + 1}%`,\n left: \"1%\",\n color: `var(${isLightSquare ? CSS_VARS.COORDINATE_LIGHT : CSS_VARS.COORDINATE_DARK})`,\n }}\n >\n {rank + 1}\n </span>\n );\n })}\n </div>\n );\n}\n"]}
|
package/dist/server.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defaultTheme, defaultPieces, parseFenPlacement, CSS_VARS } from './chunk-
|
|
1
|
+
import { defaultTheme, defaultPieces, parseFenPlacement, CSS_VARS } from './chunk-EJUGH25P.js';
|
|
2
2
|
import './chunk-OQLY5GJF.js';
|
|
3
3
|
import './chunk-U6WAD322.js';
|
|
4
4
|
import './chunk-44YKPXXT.js';
|
|
@@ -71,10 +71,16 @@ function StaticChessboard(props) {
|
|
|
71
71
|
"aria-rowindex": rank + 1,
|
|
72
72
|
"aria-colindex": file + 1,
|
|
73
73
|
"data-square": algebraicOf(index),
|
|
74
|
+
"data-gb-square": "",
|
|
74
75
|
"data-light": isLight ? "true" : "false",
|
|
75
76
|
style: {
|
|
76
|
-
|
|
77
|
+
position: "relative",
|
|
78
|
+
backgroundColor: `var(${isLight ? CSS_VARS.SQ_LIGHT : CSS_VARS.SQ_DARK})`,
|
|
79
|
+
backgroundImage: `var(${isLight ? CSS_VARS.SQ_LIGHT_IMAGE : CSS_VARS.SQ_DARK_IMAGE},none)`,
|
|
80
|
+
backgroundSize: `var(${CSS_VARS.SQ_IMAGE_SIZE},cover)`,
|
|
81
|
+
backgroundBlendMode: `var(${CSS_VARS.SQ_BLEND_MODE},normal)`,
|
|
77
82
|
userSelect: "none",
|
|
83
|
+
outline: "none",
|
|
78
84
|
containerType: "size"
|
|
79
85
|
}
|
|
80
86
|
},
|
|
@@ -112,7 +118,8 @@ function StaticChessboard(props) {
|
|
|
112
118
|
display: "flex",
|
|
113
119
|
alignItems: "center",
|
|
114
120
|
justifyContent: "center",
|
|
115
|
-
containerType: "size"
|
|
121
|
+
containerType: "size",
|
|
122
|
+
filter: `var(${cell <= 6 ? CSS_VARS.PIECE_FILTER_WHITE : CSS_VARS.PIECE_FILTER_BLACK}, none)`
|
|
116
123
|
},
|
|
117
124
|
children: pieces({ cell, square: idx })
|
|
118
125
|
},
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/server.tsx"],"names":[],"mappings":";;;;;;AAoCA,SAAS,YAAY,KAAA,EAA4B;AAC/C,EAAA,MAAM,OAAO,KAAA,GAAQ,CAAA;AACrB,EAAA,MAAM,OAAO,KAAA,IAAS,CAAA;AACtB,EAAA,OAAO,CAAA,EAAG,OAAO,YAAA,CAAa,EAAA,GAAO,IAAI,CAAC,CAAA,EAAG,OAAO,CAAC,CAAA,CAAA;AACvD;AAEA,SAAS,UAAA,CAAW,OAAoB,WAAA,EAAoD;AAC1F,EAAA,MAAM,OAAO,KAAA,GAAQ,CAAA;AACrB,EAAA,MAAM,OAAO,KAAA,IAAS,CAAA;AACtB,EAAA,MAAM,GAAA,GAAM,WAAA,KAAgB,OAAA,GAAU,IAAA,GAAO,CAAA,GAAI,IAAA;AACjD,EAAA,MAAM,GAAA,GAAM,WAAA,KAAgB,OAAA,GAAU,CAAA,GAAI,IAAA,GAAO,IAAA;AACjD,EAAA,OAAO,EAAE,CAAA,EAAG,GAAA,GAAM,IAAA,EAAM,CAAA,EAAG,MAAM,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CAAA,CAAA,CAAA;AAAA,gBACxB,MAAA,EAAQ,IAAA;AAAA,gBACR,OAAO,CAAA,IAAA,EAAO,aAAA,GAAgB,QAAA,CAAS,gBAAA,GAAmB,SAAS,eAAe,CAAA,CAAA;AAAA,eACpF;AAAA,cAEC,QAAA,EAAA;AAAA,aAAA;AAAA,YARI,QAAQ,MAAM,CAAA;AAAA,WASrB;AAAA,QAEJ,CAAC,CAAA;AAAA,QACA,YAAA,CAAa,GAAA,CAAI,CAAC,CAAA,EAAG,GAAA,KAAQ;AAC5B,UAAA,MAAM,IAAA,GAAO,GAAA;AACb,UAAA,MAAM,GAAA,GAAM,WAAA,KAAgB,OAAA,GAAU,CAAA,GAAI,IAAA,GAAO,IAAA;AACjD,UAAA,MAAM,QAAA,GAAW,WAAA,KAAgB,OAAA,GAAU,CAAA,GAAI,CAAA;AAC/C,UAAA,MAAM,aAAA,GAAA,CAAiB,QAAA,GAAW,IAAA,IAAQ,CAAA,KAAM,CAAA;AAChD,UAAA,uBACE,GAAA;AAAA,YAAC,MAAA;AAAA,YAAA;AAAA,cAEC,KAAA,EAAO;AAAA,gBACL,QAAA,EAAU,UAAA;AAAA,gBACV,GAAA,EAAK,CAAA,EAAG,GAAA,GAAM,IAAA,GAAO,CAAC,CAAA,CAAA,CAAA;AAAA,gBACtB,IAAA,EAAM,IAAA;AAAA,gBACN,OAAO,CAAA,IAAA,EAAO,aAAA,GAAgB,QAAA,CAAS,gBAAA,GAAmB,SAAS,eAAe,CAAA,CAAA;AAAA,eACpF;AAAA,cAEC,QAAA,EAAA,IAAA,GAAO;AAAA,aAAA;AAAA,YARH,QAAQ,IAAI,CAAA;AAAA,WASnB;AAAA,QAEJ,CAAC;AAAA;AAAA;AAAA,GACH;AAEJ","file":"server.js","sourcesContent":["/**\n * `gigaboard/server` — server-only static board.\n *\n * Ships **zero** client JavaScript. No hooks, no state, no event handlers,\n * no imports of any client module. Imports only:\n *\n * - `default-theme.ts`\n * - `default-pieces.tsx`\n * - `types.ts` (types only)\n *\n * Perfect for PGN viewers, position diagrams in blog posts, shareable\n * board URLs, and anywhere a board doesn't need interaction. Renders\n * produce identical markup between Node and the browser so they hydrate\n * cleanly under an interactive `<Chessboard/>` if you later attach one.\n *\n * @example\n * ```tsx\n * import { StaticChessboard } from \"gigaboard/server\";\n *\n * export default function Page() {\n * return (\n * <StaticChessboard fen=\"rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq - 0 1\" />\n * );\n * }\n * ```\n */\n\nimport type { CSSProperties, ReactNode } from \"react\";\nimport type { BoardCell, SquareIndex } from \"./core/index.js\";\nimport { CSS_VARS, defaultTheme } from \"./default-theme.js\";\nimport { parseFenPlacement } from \"./fen.js\";\nimport { defaultPieces } from \"./pieces/default-pieces.js\";\nimport type { Orientation, PieceRenderer, Theme } from \"./types.js\";\n\n/* ============================================================ geometry */\n\nfunction algebraicOf(index: SquareIndex): string {\n const file = index & 7;\n const rank = index >> 3;\n return `${String.fromCharCode(0x61 + file)}${rank + 1}`;\n}\n\nfunction positionOf(index: SquareIndex, orientation: Orientation): { x: number; y: number } {\n const file = index & 7;\n const rank = index >> 3;\n const col = orientation === \"white\" ? file : 7 - file;\n const row = orientation === \"white\" ? 7 - rank : rank;\n return { x: col * 12.5, y: row * 12.5 };\n}\n\n/* ============================================================ component */\n\n/** Props for {@link StaticChessboard}. */\nexport interface StaticChessboardProps {\n /** Piece-placement FEN (first whitespace-delimited field is enough). */\n readonly fen: string;\n\n /** Board orientation. Defaults to `\"white\"`. */\n readonly orientation?: Orientation;\n\n /** Theme — defaults to the green palette from `gigaboard/themes`. */\n readonly theme?: Theme;\n\n /** Piece renderer — defaults to the `neo` set from `gigaboard/pieces`. */\n readonly pieces?: PieceRenderer;\n\n /** Show algebraic coordinate labels on the edges. Default `true`. */\n readonly showCoordinates?: boolean;\n\n /** Optional container style overrides. */\n readonly style?: CSSProperties;\n\n /** Optional class name on the outer container. */\n readonly className?: string;\n\n /** Accessible label. Default `\"Chess position\"`. */\n readonly ariaLabel?: string;\n}\n\n/**\n * Static board for server rendering. No interactivity; no client JS\n * shipped. Exactly the same visual layout as the interactive\n * `<Chessboard/>`, so a static SSR board can be swapped for an\n * interactive one on hydration without the markup shifting.\n */\nexport function StaticChessboard(props: StaticChessboardProps): ReactNode {\n const {\n fen,\n orientation = \"white\",\n theme = defaultTheme,\n pieces = defaultPieces,\n showCoordinates = true,\n style,\n className,\n ariaLabel = \"Chess position\",\n } = props;\n\n const board = parseFenPlacement(fen);\n const squares = buildSquareOrder(orientation);\n\n const containerStyle: CSSProperties = {\n position: \"relative\",\n aspectRatio: \"1 / 1\",\n width: \"100%\",\n ...(theme as CSSProperties),\n ...style,\n };\n\n return (\n <div\n className={className}\n style={containerStyle}\n data-gb-orientation={orientation}\n data-gb-static=\"true\"\n >\n {/* 8×8 grid of static squares — no event handlers, no tabindex. */}\n <div\n role=\"grid\"\n aria-label={ariaLabel}\n aria-rowcount={8}\n aria-colcount={8}\n aria-readonly=\"true\"\n style={{\n position: \"absolute\",\n inset: 0,\n display: \"grid\",\n gridTemplateColumns: \"repeat(8, 1fr)\",\n gridTemplateRows: \"repeat(8, 1fr)\",\n }}\n >\n {squares.map((index) => {\n const file = index & 7;\n const rank = index >> 3;\n const isLight = (file + rank) % 2 === 1;\n return (\n <div\n key={index}\n role=\"gridcell\"\n aria-label={algebraicOf(index)}\n aria-rowindex={rank + 1}\n aria-colindex={file + 1}\n data-square={algebraicOf(index)}\n data-light={isLight ? \"true\" : \"false\"}\n style={{\n background: `var(${isLight ? CSS_VARS.SQ_LIGHT : CSS_VARS.SQ_DARK})`,\n userSelect: \"none\",\n containerType: \"size\",\n }}\n />\n );\n })}\n </div>\n\n {/* Piece overlay — one div per occupied square. */}\n <div\n aria-hidden=\"true\"\n style={{\n position: \"absolute\",\n inset: 0,\n pointerEvents: \"none\",\n }}\n >\n {Array.from({ length: 64 }, (_, i) => {\n const cell = board[i] as BoardCell;\n if (cell === 0) return null;\n const idx = i as SquareIndex;\n const square = algebraicOf(idx);\n const { x, y } = positionOf(idx, orientation);\n return (\n <div\n key={square}\n data-piece-square={square}\n data-piece-cell={cell}\n style={{\n position: \"absolute\",\n left: `${x}%`,\n top: `${y}%`,\n width: \"12.5%\",\n height: \"12.5%\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n containerType: \"size\",\n }}\n >\n {pieces({ cell, square: idx })}\n </div>\n );\n })}\n </div>\n\n {showCoordinates ? <StaticCoordinates orientation={orientation} /> : null}\n </div>\n );\n}\n\n/* ======================================================== subsidiary helpers */\n\n/** Same rank-first ordering used by the interactive BoardGrid. */\nfunction buildSquareOrder(orientation: Orientation): SquareIndex[] {\n const squares: SquareIndex[] = [];\n if (orientation === \"white\") {\n for (let rank = 7; rank >= 0; rank--) {\n for (let file = 0; file < 8; file++) {\n squares.push((rank * 8 + file) as SquareIndex);\n }\n }\n } else {\n for (let rank = 0; rank < 8; rank++) {\n for (let file = 7; file >= 0; file--) {\n squares.push((rank * 8 + file) as SquareIndex);\n }\n }\n }\n return squares;\n}\n\nconst FILE_LETTERS = [\"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\"] as const;\n\n/** Pure coordinate overlay — identical output to the interactive version. */\nfunction StaticCoordinates({ orientation }: { orientation: Orientation }): ReactNode {\n return (\n <div\n aria-hidden=\"true\"\n style={{\n position: \"absolute\",\n inset: 0,\n pointerEvents: \"none\",\n fontSize: \"min(1.6vmin, 11px)\",\n fontWeight: 600,\n fontFamily: \"system-ui, -apple-system, sans-serif\",\n }}\n >\n {FILE_LETTERS.map((letter, idx) => {\n const col = orientation === \"white\" ? idx : 7 - idx;\n const bottomRank = orientation === \"white\" ? 0 : 7;\n const isLightSquare = (col + bottomRank) % 2 === 1;\n return (\n <span\n key={`file-${letter}`}\n style={{\n position: \"absolute\",\n left: `${col * 12.5 + 10}%`,\n bottom: \"1%\",\n color: `var(${isLightSquare ? CSS_VARS.COORDINATE_LIGHT : CSS_VARS.COORDINATE_DARK})`,\n }}\n >\n {letter}\n </span>\n );\n })}\n {FILE_LETTERS.map((_, idx) => {\n const rank = idx;\n const row = orientation === \"white\" ? 7 - rank : rank;\n const leftFile = orientation === \"white\" ? 0 : 7;\n const isLightSquare = (leftFile + rank) % 2 === 1;\n return (\n <span\n key={`rank-${rank}`}\n style={{\n position: \"absolute\",\n top: `${row * 12.5 + 1}%`,\n left: \"1%\",\n color: `var(${isLightSquare ? CSS_VARS.COORDINATE_LIGHT : CSS_VARS.COORDINATE_DARK})`,\n }}\n >\n {rank + 1}\n </span>\n );\n })}\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/server.tsx"],"names":[],"mappings":";;;;;;AAoCA,SAAS,YAAY,KAAA,EAA4B;AAC/C,EAAA,MAAM,OAAO,KAAA,GAAQ,CAAA;AACrB,EAAA,MAAM,OAAO,KAAA,IAAS,CAAA;AACtB,EAAA,OAAO,CAAA,EAAG,OAAO,YAAA,CAAa,EAAA,GAAO,IAAI,CAAC,CAAA,EAAG,OAAO,CAAC,CAAA,CAAA;AACvD;AAEA,SAAS,UAAA,CAAW,OAAoB,WAAA,EAAoD;AAC1F,EAAA,MAAM,OAAO,KAAA,GAAQ,CAAA;AACrB,EAAA,MAAM,OAAO,KAAA,IAAS,CAAA;AACtB,EAAA,MAAM,GAAA,GAAM,WAAA,KAAgB,OAAA,GAAU,IAAA,GAAO,CAAA,GAAI,IAAA;AACjD,EAAA,MAAM,GAAA,GAAM,WAAA,KAAgB,OAAA,GAAU,CAAA,GAAI,IAAA,GAAO,IAAA;AACjD,EAAA,OAAO,EAAE,CAAA,EAAG,GAAA,GAAM,IAAA,EAAM,CAAA,EAAG,MAAM,IAAA,EAAK;AACxC;AAqCO,SAAS,iBAAiB,KAAA,EAAyC;AACxE,EAAA,MAAM;AAAA,IACJ,GAAA;AAAA,IACA,WAAA,GAAc,OAAA;AAAA,IACd,KAAA,GAAQ,YAAA;AAAA,IACR,MAAA,GAAS,aAAA;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,CAAA;AAAA,eACpF;AAAA,cAEC,QAAA,EAAA,IAAA,GAAO;AAAA,aAAA;AAAA,YARH,QAAQ,IAAI,CAAA;AAAA,WASnB;AAAA,QAEJ,CAAC;AAAA;AAAA;AAAA,GACH;AAEJ","file":"server.js","sourcesContent":["/**\n * `gigaboard/server` — server-only static board.\n *\n * Ships **zero** client JavaScript. No hooks, no state, no event handlers,\n * no imports of any client module. Imports only:\n *\n * - `default-theme.ts`\n * - `default-pieces.tsx`\n * - `types.ts` (types only)\n *\n * Perfect for PGN viewers, position diagrams in blog posts, shareable\n * board URLs, and anywhere a board doesn't need interaction. Renders\n * produce identical markup between Node and the browser so they hydrate\n * cleanly under an interactive `<Chessboard/>` if you later attach one.\n *\n * @example\n * ```tsx\n * import { StaticChessboard } from \"gigaboard/server\";\n *\n * export default function Page() {\n * return (\n * <StaticChessboard fen=\"rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq - 0 1\" />\n * );\n * }\n * ```\n */\n\nimport type { CSSProperties, ReactNode } from \"react\";\nimport type { BoardCell, SquareIndex } from \"./core/index.js\";\nimport { CSS_VARS, defaultTheme } from \"./default-theme.js\";\nimport { parseFenPlacement } from \"./fen.js\";\nimport { defaultPieces } from \"./pieces/default-pieces.js\";\nimport type { Orientation, PieceRenderer, Theme } from \"./types.js\";\n\n/* ============================================================ geometry */\n\nfunction algebraicOf(index: SquareIndex): string {\n const file = index & 7;\n const rank = index >> 3;\n return `${String.fromCharCode(0x61 + file)}${rank + 1}`;\n}\n\nfunction positionOf(index: SquareIndex, orientation: Orientation): { x: number; y: number } {\n const file = index & 7;\n const rank = index >> 3;\n const col = orientation === \"white\" ? file : 7 - file;\n const row = orientation === \"white\" ? 7 - rank : rank;\n return { x: col * 12.5, y: row * 12.5 };\n}\n\n/* ============================================================ component */\n\n/** Props for {@link StaticChessboard}. */\nexport interface StaticChessboardProps {\n /** Piece-placement FEN (first whitespace-delimited field is enough). */\n readonly fen: string;\n\n /** Board orientation. Defaults to `\"white\"`. */\n readonly orientation?: Orientation;\n\n /** Theme — defaults to the green palette from `gigaboard/themes`. */\n readonly theme?: Theme;\n\n /** Piece renderer — defaults to the `neo` set from `gigaboard/pieces`. */\n readonly pieces?: PieceRenderer;\n\n /** Show algebraic coordinate labels on the edges. Default `true`. */\n readonly showCoordinates?: boolean;\n\n /** Optional container style overrides. */\n readonly style?: CSSProperties;\n\n /** Optional class name on the outer container. */\n readonly className?: string;\n\n /** Accessible label. Default `\"Chess position\"`. */\n readonly ariaLabel?: string;\n}\n\n/**\n * Static board for server rendering. No interactivity; no client JS\n * shipped. Exactly the same visual layout as the interactive\n * `<Chessboard/>`, so a static SSR board can be swapped for an\n * interactive one on hydration without the markup shifting.\n */\nexport function StaticChessboard(props: StaticChessboardProps): ReactNode {\n const {\n fen,\n orientation = \"white\",\n theme = defaultTheme,\n pieces = defaultPieces,\n showCoordinates = true,\n style,\n className,\n ariaLabel = \"Chess position\",\n } = props;\n\n const board = parseFenPlacement(fen);\n const squares = buildSquareOrder(orientation);\n\n const containerStyle: CSSProperties = {\n position: \"relative\",\n aspectRatio: \"1 / 1\",\n width: \"100%\",\n ...(theme as CSSProperties),\n ...style,\n };\n\n return (\n <div\n className={className}\n style={containerStyle}\n data-gb-orientation={orientation}\n data-gb-static=\"true\"\n >\n {/* 8×8 grid of static squares — no event handlers, no tabindex. */}\n <div\n role=\"grid\"\n aria-label={ariaLabel}\n aria-rowcount={8}\n aria-colcount={8}\n aria-readonly=\"true\"\n style={{\n position: \"absolute\",\n inset: 0,\n display: \"grid\",\n gridTemplateColumns: \"repeat(8, 1fr)\",\n gridTemplateRows: \"repeat(8, 1fr)\",\n }}\n >\n {squares.map((index) => {\n const file = index & 7;\n const rank = index >> 3;\n const isLight = (file + rank) % 2 === 1;\n return (\n <div\n key={index}\n role=\"gridcell\"\n aria-label={algebraicOf(index)}\n aria-rowindex={rank + 1}\n aria-colindex={file + 1}\n data-square={algebraicOf(index)}\n data-gb-square=\"\"\n data-light={isLight ? \"true\" : \"false\"}\n style={{\n position: \"relative\",\n backgroundColor: `var(${isLight ? CSS_VARS.SQ_LIGHT : CSS_VARS.SQ_DARK})`,\n backgroundImage: `var(${isLight ? CSS_VARS.SQ_LIGHT_IMAGE : CSS_VARS.SQ_DARK_IMAGE},none)`,\n backgroundSize: `var(${CSS_VARS.SQ_IMAGE_SIZE},cover)`,\n backgroundBlendMode: `var(${CSS_VARS.SQ_BLEND_MODE},normal)`,\n userSelect: \"none\",\n outline: \"none\",\n containerType: \"size\",\n }}\n />\n );\n })}\n </div>\n\n {/* Piece overlay — one div per occupied square. */}\n <div\n aria-hidden=\"true\"\n style={{\n position: \"absolute\",\n inset: 0,\n pointerEvents: \"none\",\n }}\n >\n {Array.from({ length: 64 }, (_, i) => {\n const cell = board[i] as BoardCell;\n if (cell === 0) return null;\n const idx = i as SquareIndex;\n const square = algebraicOf(idx);\n const { x, y } = positionOf(idx, orientation);\n return (\n <div\n key={square}\n data-piece-square={square}\n data-piece-cell={cell}\n style={{\n position: \"absolute\",\n left: `${x}%`,\n top: `${y}%`,\n width: \"12.5%\",\n height: \"12.5%\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n containerType: \"size\",\n filter: `var(${cell <= 6 ? CSS_VARS.PIECE_FILTER_WHITE : CSS_VARS.PIECE_FILTER_BLACK}, none)`,\n }}\n >\n {pieces({ cell, square: idx })}\n </div>\n );\n })}\n </div>\n\n {showCoordinates ? <StaticCoordinates orientation={orientation} /> : null}\n </div>\n );\n}\n\n/* ======================================================== subsidiary helpers */\n\n/** Same rank-first ordering used by the interactive BoardGrid. */\nfunction buildSquareOrder(orientation: Orientation): SquareIndex[] {\n const squares: SquareIndex[] = [];\n if (orientation === \"white\") {\n for (let rank = 7; rank >= 0; rank--) {\n for (let file = 0; file < 8; file++) {\n squares.push((rank * 8 + file) as SquareIndex);\n }\n }\n } else {\n for (let rank = 0; rank < 8; rank++) {\n for (let file = 7; file >= 0; file--) {\n squares.push((rank * 8 + file) as SquareIndex);\n }\n }\n }\n return squares;\n}\n\nconst FILE_LETTERS = [\"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\"] as const;\n\n/** Pure coordinate overlay — identical output to the interactive version. */\nfunction StaticCoordinates({ orientation }: { orientation: Orientation }): ReactNode {\n return (\n <div\n aria-hidden=\"true\"\n style={{\n position: \"absolute\",\n inset: 0,\n pointerEvents: \"none\",\n fontSize: \"min(1.6vmin, 11px)\",\n fontWeight: 600,\n fontFamily: \"system-ui, -apple-system, sans-serif\",\n }}\n >\n {FILE_LETTERS.map((letter, idx) => {\n const col = orientation === \"white\" ? idx : 7 - idx;\n const bottomRank = orientation === \"white\" ? 0 : 7;\n const isLightSquare = (col + bottomRank) % 2 === 1;\n return (\n <span\n key={`file-${letter}`}\n style={{\n position: \"absolute\",\n left: `${col * 12.5 + 10}%`,\n bottom: \"1%\",\n color: `var(${isLightSquare ? CSS_VARS.COORDINATE_LIGHT : CSS_VARS.COORDINATE_DARK})`,\n }}\n >\n {letter}\n </span>\n );\n })}\n {FILE_LETTERS.map((_, idx) => {\n const rank = idx;\n const row = orientation === \"white\" ? 7 - rank : rank;\n const leftFile = orientation === \"white\" ? 0 : 7;\n const isLightSquare = (leftFile + rank) % 2 === 1;\n return (\n <span\n key={`rank-${rank}`}\n style={{\n position: \"absolute\",\n top: `${row * 12.5 + 1}%`,\n left: \"1%\",\n color: `var(${isLightSquare ? CSS_VARS.COORDINATE_LIGHT : CSS_VARS.COORDINATE_DARK})`,\n }}\n >\n {rank + 1}\n </span>\n );\n })}\n </div>\n );\n}\n"]}
|
package/dist/themes/blue.d.cts
CHANGED
|
@@ -27,6 +27,94 @@ declare const blue: Theme;
|
|
|
27
27
|
|
|
28
28
|
declare const brown: Theme;
|
|
29
29
|
|
|
30
|
+
/**
|
|
31
|
+
* Café Crème theme — soft latte and roasted almond palette with subtle woven texture.
|
|
32
|
+
*
|
|
33
|
+
* Inspired by classic French café aesthetic.
|
|
34
|
+
*
|
|
35
|
+
* ```tsx
|
|
36
|
+
* import { cafeCreme } from "gigaboard/themes/cafeCreme";
|
|
37
|
+
* <Chessboard game={game} theme={cafeCreme} />
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
declare const cafeCreme: Theme;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Canvas theme — warm textured linen/cloth tone.
|
|
45
|
+
*
|
|
46
|
+
* Tactile fabric feel inspired by canvas chessboards.
|
|
47
|
+
*
|
|
48
|
+
* ```tsx
|
|
49
|
+
* import { canvas } from "gigaboard/themes/canvas";
|
|
50
|
+
* <Chessboard game={game} theme={canvas} />
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
declare const canvas: Theme;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Chess.com Blue theme — exact standard web blue/slate palette.
|
|
58
|
+
*
|
|
59
|
+
* ```tsx
|
|
60
|
+
* import { chesscomBlue } from "gigaboard/themes/chesscomBlue";
|
|
61
|
+
* <Chessboard game={game} theme={chesscomBlue} />
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
|
|
65
|
+
declare const chesscomBlue: Theme;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Chess.com Green theme — exact standard web green/cream palette.
|
|
69
|
+
*
|
|
70
|
+
* ```tsx
|
|
71
|
+
* import { chesscomGreen } from "gigaboard/themes/chesscomGreen";
|
|
72
|
+
* <Chessboard game={game} theme={chesscomGreen} />
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
|
|
76
|
+
declare const chesscomGreen: Theme;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Dark Wood theme — golden-brown teak light squares and deep ebony dark squares.
|
|
80
|
+
*
|
|
81
|
+
* High-contrast dark board with subtle piece filters for readability.
|
|
82
|
+
*
|
|
83
|
+
* ```tsx
|
|
84
|
+
* import { darkWood } from "gigaboard/themes/darkWood";
|
|
85
|
+
* <Chessboard game={game} theme={darkWood} />
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
|
|
89
|
+
declare const darkWood: Theme;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Deuteranopia theme — accessible palette scientifically tuned for red-green color blindness.
|
|
93
|
+
*
|
|
94
|
+
* Replaces red/green cues with high-contrast cobalt blue, warm ivory, and golden-amber
|
|
95
|
+
* highlights to guarantee unambiguous piece and square recognition.
|
|
96
|
+
*
|
|
97
|
+
* ```tsx
|
|
98
|
+
* import { deuteranopia } from "gigaboard/themes/deuteranopia";
|
|
99
|
+
* <Chessboard game={game} theme={deuteranopia} />
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
|
|
103
|
+
declare const deuteranopia: Theme;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Espresso theme — warm cream & deep roast coffee tones with subtle grain texture.
|
|
107
|
+
*
|
|
108
|
+
* Designed for comfortable long-session analysis with rich roasted coffee hues.
|
|
109
|
+
*
|
|
110
|
+
* ```tsx
|
|
111
|
+
* import { espresso } from "gigaboard/themes/espresso";
|
|
112
|
+
* <Chessboard game={game} theme={espresso} />
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
|
|
116
|
+
declare const espresso: Theme;
|
|
117
|
+
|
|
30
118
|
/**
|
|
31
119
|
* Green theme — chess.com's default green/cream board.
|
|
32
120
|
*
|
|
@@ -45,6 +133,152 @@ declare const brown: Theme;
|
|
|
45
133
|
|
|
46
134
|
declare const green: Theme;
|
|
47
135
|
|
|
136
|
+
/**
|
|
137
|
+
* High-Contrast theme — pure black and white with enhanced piece outline filters.
|
|
138
|
+
*
|
|
139
|
+
* Engineered for low-vision accessibility and extreme visibility environments.
|
|
140
|
+
*
|
|
141
|
+
* ```tsx
|
|
142
|
+
* import { highContrast } from "gigaboard/themes/highContrast";
|
|
143
|
+
* <Chessboard game={game} theme={highContrast} />
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
|
|
147
|
+
declare const highContrast: Theme;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* IC theme — icy grey and cold steel blue.
|
|
151
|
+
*
|
|
152
|
+
* Minimalist tournament styling popular in desktop chess GUIs.
|
|
153
|
+
*
|
|
154
|
+
* ```tsx
|
|
155
|
+
* import { ic } from "gigaboard/themes/ic";
|
|
156
|
+
* <Chessboard game={game} theme={ic} />
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
159
|
+
|
|
160
|
+
declare const ic: Theme;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Leather theme — rich tan and distressed saddle leather tones.
|
|
164
|
+
*
|
|
165
|
+
* Warm and tactile, reminiscent of artisan stitched leather boards.
|
|
166
|
+
*
|
|
167
|
+
* ```tsx
|
|
168
|
+
* import { leather } from "gigaboard/themes/leather";
|
|
169
|
+
* <Chessboard game={game} theme={leather} />
|
|
170
|
+
* ```
|
|
171
|
+
*/
|
|
172
|
+
|
|
173
|
+
declare const leather: Theme;
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Marble theme — cool Carrara white stone and veined slate grey.
|
|
177
|
+
*
|
|
178
|
+
* Classic architectural styling with subtle stone gradients.
|
|
179
|
+
*
|
|
180
|
+
* ```tsx
|
|
181
|
+
* import { marble } from "gigaboard/themes/marble";
|
|
182
|
+
* <Chessboard game={game} theme={marble} />
|
|
183
|
+
* ```
|
|
184
|
+
*/
|
|
185
|
+
|
|
186
|
+
declare const marble: Theme;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Neon theme — cyberpunk electric cyan and deep midnight navy.
|
|
190
|
+
*
|
|
191
|
+
* Vivid high-energy palette with glowing piece filter accents.
|
|
192
|
+
*
|
|
193
|
+
* ```tsx
|
|
194
|
+
* import { neon } from "gigaboard/themes/neon";
|
|
195
|
+
* <Chessboard game={game} theme={neon} />
|
|
196
|
+
* ```
|
|
197
|
+
*/
|
|
198
|
+
|
|
199
|
+
declare const neon: Theme;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Newspaper theme — high-contrast monochrome with diagonal hatching pattern.
|
|
203
|
+
*
|
|
204
|
+
* Inspired by Lichess Newspaper. Light squares feature subtle diagonal lines,
|
|
205
|
+
* and dark squares feature dense cross-hatch patterning using an embedded
|
|
206
|
+
* zero-HTTP SVG data URI.
|
|
207
|
+
*
|
|
208
|
+
* ```tsx
|
|
209
|
+
* import { newspaper } from "gigaboard/themes/newspaper";
|
|
210
|
+
* <Chessboard game={game} theme={newspaper} />
|
|
211
|
+
* ```
|
|
212
|
+
*/
|
|
213
|
+
|
|
214
|
+
declare const newspaper: Theme;
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Olive theme — warm sage cream and muted earthy olive.
|
|
218
|
+
*
|
|
219
|
+
* Muted, natural tone that is gentle on the eyes during extended play.
|
|
220
|
+
*
|
|
221
|
+
* ```tsx
|
|
222
|
+
* import { olive } from "gigaboard/themes/olive";
|
|
223
|
+
* <Chessboard game={game} theme={olive} />
|
|
224
|
+
* ```
|
|
225
|
+
*/
|
|
226
|
+
|
|
227
|
+
declare const olive: Theme;
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Pink theme — soft pastel rose and muted crimson.
|
|
231
|
+
*
|
|
232
|
+
* Playful, elegant palette with clear contrast.
|
|
233
|
+
*
|
|
234
|
+
* ```tsx
|
|
235
|
+
* import { pink } from "gigaboard/themes/pink";
|
|
236
|
+
* <Chessboard game={game} theme={pink} />
|
|
237
|
+
* ```
|
|
238
|
+
*/
|
|
239
|
+
|
|
240
|
+
declare const pink: Theme;
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Purple theme — lavender and deep royal violet.
|
|
244
|
+
*
|
|
245
|
+
* Elegant, royal aesthetic with crisp square definition.
|
|
246
|
+
*
|
|
247
|
+
* ```tsx
|
|
248
|
+
* import { purple } from "gigaboard/themes/purple";
|
|
249
|
+
* <Chessboard game={game} theme={purple} />
|
|
250
|
+
* ```
|
|
251
|
+
*/
|
|
252
|
+
|
|
253
|
+
declare const purple: Theme;
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Tritanopia theme — accessible palette scientifically tuned for blue-yellow color blindness.
|
|
257
|
+
*
|
|
258
|
+
* Employs clean seafoam teal and muted salmon tones paired with rich magenta/violet
|
|
259
|
+
* highlights to ensure clarity for blue-yellow color vision deficiency.
|
|
260
|
+
*
|
|
261
|
+
* ```tsx
|
|
262
|
+
* import { tritanopia } from "gigaboard/themes/tritanopia";
|
|
263
|
+
* <Chessboard game={game} theme={tritanopia} />
|
|
264
|
+
* ```
|
|
265
|
+
*/
|
|
266
|
+
|
|
267
|
+
declare const tritanopia: Theme;
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Walnut theme — deep American walnut heartwood with honey sapwood light squares.
|
|
271
|
+
*
|
|
272
|
+
* Rich furniture-grade tournament board aesthetics.
|
|
273
|
+
*
|
|
274
|
+
* ```tsx
|
|
275
|
+
* import { walnut } from "gigaboard/themes/walnut";
|
|
276
|
+
* <Chessboard game={game} theme={walnut} />
|
|
277
|
+
* ```
|
|
278
|
+
*/
|
|
279
|
+
|
|
280
|
+
declare const walnut: Theme;
|
|
281
|
+
|
|
48
282
|
/**
|
|
49
283
|
* Wood theme — a deep, rich wood-grain palette.
|
|
50
284
|
*
|
|
@@ -90,13 +324,31 @@ type Theme = Readonly<Record<string, string>>;
|
|
|
90
324
|
|
|
91
325
|
/** Registry mapping a theme name to its theme object. */
|
|
92
326
|
declare const themes: Readonly<{
|
|
93
|
-
brown: Readonly<Record<string, string>>;
|
|
94
327
|
blue: Readonly<Record<string, string>>;
|
|
328
|
+
brown: Readonly<Record<string, string>>;
|
|
329
|
+
cafeCreme: Readonly<Record<string, string>>;
|
|
330
|
+
canvas: Readonly<Record<string, string>>;
|
|
331
|
+
chesscomBlue: Readonly<Record<string, string>>;
|
|
332
|
+
chesscomGreen: Readonly<Record<string, string>>;
|
|
333
|
+
darkWood: Readonly<Record<string, string>>;
|
|
334
|
+
deuteranopia: Readonly<Record<string, string>>;
|
|
335
|
+
espresso: Readonly<Record<string, string>>;
|
|
95
336
|
green: Readonly<Record<string, string>>;
|
|
337
|
+
highContrast: Readonly<Record<string, string>>;
|
|
338
|
+
ic: Readonly<Record<string, string>>;
|
|
339
|
+
leather: Readonly<Record<string, string>>;
|
|
340
|
+
marble: Readonly<Record<string, string>>;
|
|
341
|
+
neon: Readonly<Record<string, string>>;
|
|
342
|
+
newspaper: Readonly<Record<string, string>>;
|
|
343
|
+
olive: Readonly<Record<string, string>>;
|
|
344
|
+
pink: Readonly<Record<string, string>>;
|
|
345
|
+
purple: Readonly<Record<string, string>>;
|
|
346
|
+
tritanopia: Readonly<Record<string, string>>;
|
|
347
|
+
walnut: Readonly<Record<string, string>>;
|
|
96
348
|
wood: Readonly<Record<string, string>>;
|
|
97
349
|
}>;
|
|
98
350
|
/** Union of the built-in theme names. */
|
|
99
351
|
type ThemeName = keyof typeof themes;
|
|
100
|
-
declare const PACKAGE_VERSION = "1.3.
|
|
352
|
+
declare const PACKAGE_VERSION = "1.3.3";
|
|
101
353
|
|
|
102
|
-
export { PACKAGE_VERSION as P, type Theme as T,
|
|
354
|
+
export { PACKAGE_VERSION as P, type Theme as T, canvas as a, brown as b, blue, cafeCreme as c, chesscomBlue as d, chesscomGreen as e, darkWood as f, deuteranopia as g, espresso as h, green as i, highContrast as j, ic as k, leather as l, marble as m, neon as n, newspaper as o, olive as p, pink as q, purple as r, wood as s, tritanopia as t, type ThemeName as u, themes as v, walnut as w };
|