gigaboard 1.3.0 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,27 +1,260 @@
1
- # gigaboard
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/itshak/gigaboard/main/assets/logo.png" width="220" alt="Gigaboard Logo" />
3
+ </p>
2
4
 
3
- Ultra-fast React chessboard with owned state, byte-scoped subscriptions, refs-only drag, WAAPI piece movement, Canvas arrows, bundled move sounds, optional mobile haptics, SSR static rendering, WAI-ARIA keyboard parity, and a polished default board using `@gigaboard/themes/green` plus `@gigaboard/pieces/neo`. Powered by [`gigachess`](https://github.com/itshak/gigachess) and [`@gigaboard/core`](../core).
5
+ <h1 align="center">Gigaboard</h1>
4
6
 
5
- ## Status
7
+ <p align="center">
8
+ <strong>The fastest, cleanest React chessboard UI on Earth.</strong><br>
9
+ 1:1 Chessground feature parity, zero GPL taint, 120fps GPU compositor glides, 0 drag re-renders, and instant synchronous engine integration.
10
+ </p>
6
11
 
7
- `1.2.x` — interactive board, drag, controlled analysis positions, animations, arrows, premoves, sounds, mobile haptics, themes, piece sets, and SSR static rendering are shipped.
12
+ <p align="center">
13
+ <a href="https://github.com/itshak/gigaboard/actions/workflows/ci.yml"><img src="https://github.com/itshak/gigaboard/actions/workflows/ci.yml/badge.svg" alt="CI Status"></a>
14
+ <a href="https://www.npmjs.com/package/gigaboard"><img src="https://img.shields.io/npm/v/gigaboard?style=flat-square&color=blue" alt="npm version"></a>
15
+ <a href="https://bundlephobia.com/package/gigaboard"><img src="https://img.shields.io/bundlephobia/minzip/gigaboard?style=flat-square&color=emerald" alt="bundle size"></a>
16
+ <a href="https://github.com/itshak/gigaboard/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square" alt="License: MIT"></a>
17
+ <a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-Strict-blue?style=flat-square" alt="TypeScript"></a>
18
+ <a href="https://react.dev/"><img src="https://img.shields.io/badge/React-18%20%2F%2019-61dafb?style=flat-square" alt="React 18/19"></a>
19
+ </p>
8
20
 
9
- ## Move feedback
21
+ ---
10
22
 
11
- - `sound={false}` keeps audio fully disabled.
12
- - `sound` / `useMoveSound` allocate audio pools lazily on the first move cue; bundled MP3 assets are emitted by consumer bundlers instead of fetched from a CDN.
13
- - `haptics` / `useMoveHaptics` provide mobile-only tactile feedback using the same move-cue classifier as sound.
14
- - Controlled `positionFen` changes emit the same feedback after the initial sync, so analysis/replay boards can keep desktop sounds and mobile haptics without a second integration.
23
+ ## ⚡ Highlights
15
24
 
16
- ## Entry points
25
+ * 🏎️ **120fps Butter-Smooth Glides**: GPU-accelerated Web Animations API (WAAPI) compositor animations with zero main-thread jank.
26
+ * 🚀 **1 Commit Per Move & 0 Drag Commits**: Per-byte `Uint8Array(64)` subscription store via `useSyncExternalStore`. Zero React re-renders while dragging pieces.
27
+ * 🛡️ **100% Permissive MIT License**: Engineered from the ground up as a pure React-native replacement for `chessground` without restrictive GPL/AGPL viral licensing.
28
+ * 🎯 **Instant Synchronous Engine**: Backed by `gigachess` (`createGigachessAdapter`) — zero WASM lag, sub-millisecond frame-0 render without blank screen flashes.
29
+ * ♿ **First-Class Accessibility (WAI-ARIA)**: Roving tabindex, full keyboard navigation (arrows, Enter, Space, promotion keys), and screen-reader `LiveRegion` announcements.
30
+ * 🎨 **Modular Themes & Crisp Piece Sets**: Tree-shakable pieces (~660B/set) and zero-runtime CSS variable themes (`--gb-*`, ~205B/theme).
31
+ * 🏹 **Hardware Canvas Arrow Engine**: Imperative high-DPI 2D canvas arrows, freehand gestures, knight L-shapes, and customizable highlight overlays.
32
+ * 📦 **SSR & React Server Components Ready**: `gigaboard/server` renders static HTML chessboards on Node/Next.js with zero hydration mismatch and zero client JS.
17
33
 
18
- - `gigaboard` — interactive board (client component).
19
- - `gigaboard/server` — static SSR board (zero client JS).
20
- - `gigaboard/canvas` — opt-in full-canvas renderer (post-1.0).
34
+ ---
21
35
 
22
- ## Size budget
36
+ > 💡 **Pure TypeScript & Zero WASM Compile Overhead**: Unlike previous engines that mandate WebAssembly compilation, Gigaboard and GigaChess run 100% synchronously. No WASM loaders, no CORS/CSP header friction, and instant SSR support across Next.js, Remix, Node, Bun, and browser workers.
23
37
 
24
- - `gigaboard` < 24 KB gzip.
25
- - `gigaboard/server` < 4 KB gzip.
38
+ ---
26
39
 
27
- Enforced in CI via `size-limit`.
40
+ ## 📦 Installation
41
+
42
+ ```bash
43
+ # npm
44
+ npm install gigaboard
45
+
46
+ # bun
47
+ bun add gigaboard
48
+
49
+ # pnpm
50
+ pnpm add gigaboard
51
+
52
+ # yarn
53
+ yarn add gigaboard
54
+ ```
55
+
56
+ > Single-package distribution — `gigaboard` includes the interactive board (`gigaboard`), headless core (`gigaboard/core`), static SSR board (`gigaboard/server`), piece sets (`gigaboard/pieces/*`), and themes (`gigaboard/themes/*`) via subpath exports. The `gigachess` engine ships as a bundled dependency.
57
+
58
+ ---
59
+
60
+ ## 🚀 Quick Start
61
+
62
+ ### 1. Interactive Game (Zero-Config)
63
+
64
+ Render a fully interactive chessboard with rule enforcement, move generation, and sound in just 5 lines:
65
+
66
+ ```tsx
67
+ import { Chessboard, useChessGame } from "gigaboard";
68
+
69
+ export function App() {
70
+ const game = useChessGame();
71
+ return <Chessboard game={game} />;
72
+ }
73
+ ```
74
+
75
+ ### 2. Controlled Board (Online Matches & Analysis)
76
+
77
+ Hook into moves, broadcast state to your server, or drive the board externally:
78
+
79
+ ```tsx
80
+ import { Chessboard, useChessGame } from "gigaboard";
81
+
82
+ export function OnlineGame({ initialFen, onPlayerMove }) {
83
+ const game = useChessGame({
84
+ fen: initialFen,
85
+ onMove: (move) => {
86
+ console.log(`Played ${move.san} (${move.from} → ${move.to})`);
87
+ onPlayerMove(move);
88
+ },
89
+ });
90
+
91
+ return (
92
+ <Chessboard
93
+ game={game}
94
+ orientation="white"
95
+ sound={true}
96
+ />
97
+ );
98
+ }
99
+ ```
100
+
101
+ ---
102
+
103
+ ## 📊 Comparison: Gigaboard vs Alternatives
104
+
105
+ Measured under Chromium on Apple Silicon (4× CPU throttle, 40-ply Sicilian Najdorf):
106
+
107
+ | Feature / Metric | 🚀 **Gigaboard** | 📦 **`react-chessboard`** | ♟️ **`chessground`** |
108
+ |---|---|---|---|
109
+ | **License** | **100% MIT** | MIT | ⚠️ **GPL-3.0 (Viral)** |
110
+ | **Architecture** | **Native React + Byte Store** | React Component | Vanilla JS Imperative Wrapper |
111
+ | **React Commits per Move** | **1.00 commit** | 2.83 commits | *(None — imperative DOM)* |
112
+ | **React Work during Drag** | **0 work (Refs-only)** | Multiple Re-renders | 0 work |
113
+ | **Engine Initialization** | **Instant Sync (<0.5 ms)** | Slow `chess.js` | Bring-Your-Own Engine |
114
+ | **100-Board Grid Memory** | **45.3 MB Heap** | 120.6 MB Heap (2.7× larger) | 5.7 MB Heap |
115
+ | **100-Board Grid DOM Nodes** | **16,040 nodes** | 53,332 nodes (3.3× more) | 15,939 nodes |
116
+ | **Animation Engine** | **Compositor WAAPI (120fps)** | CSS Transitions / rAF | Imperative Transforms |
117
+ | **Arrow Engine** | **Single 2D Canvas Layer** | SVG Elements | SVG Elements |
118
+ | **WAI-ARIA Accessibility** | **Full (Grid, LiveRegion)** | Minimal | Incomplete |
119
+ | **Keyboard Move Entry** | **Full Keyboard Parity** | Partial | Partial |
120
+ | **SSR / RSC Static Board** | ✅ **Built-in (`gigaboard/server`)** | ❌ None | ❌ None |
121
+
122
+ *See [`BENCH.md`](https://github.com/itshak/gigaboard/blob/main/BENCH.md) for full Playwright traces, long-task observations, and memory audits.*
123
+
124
+ ---
125
+
126
+ ## 💡 Common Recipes
127
+
128
+ ### 1. Themes & Piece Sets
129
+
130
+ Mix and match tree-shakable piece sets and CSS-variable themes without bundle bloat:
131
+
132
+ ```tsx
133
+ import { Chessboard, useChessGame } from "gigaboard";
134
+ import { cburnett } from "gigaboard/pieces/cburnett";
135
+ import { wood } from "gigaboard/themes/wood";
136
+
137
+ export function CustomBoard() {
138
+ const game = useChessGame();
139
+ return <Chessboard game={game} pieces={cburnett} theme={wood} />;
140
+ }
141
+ ```
142
+
143
+ Available piece sets (`gigaboard/pieces/*`):
144
+ * `neo` (default, crisp chess.com vector style)
145
+ * `cburnett` (traditional Lichess silhouette)
146
+ * `merida` (wood-tinted tournament set)
147
+ * `alpha` (minimalist mobile silhouettes)
148
+ * `chesscom` (explicit alias for neo)
149
+
150
+ Available themes (`gigaboard/themes/*`):
151
+ * `green` (default chess.com palette)
152
+ * `brown` (classic tournament wood)
153
+ * `blue` (modern cool contrast)
154
+ * `wood` (warm natural board)
155
+
156
+ ---
157
+
158
+ ### 2. Drawing Arrows & Brush Highlights
159
+
160
+ Support right-click drag arrows and square highlights for streaming and analysis:
161
+
162
+ ```tsx
163
+ import { Chessboard, useChessGame } from "gigaboard";
164
+
165
+ export function AnalysisBoard() {
166
+ const game = useChessGame();
167
+
168
+ return (
169
+ <Chessboard
170
+ game={game}
171
+ drawable={{
172
+ enabled: true,
173
+ arrows: [
174
+ { from: "e2", to: "e4", color: "green" },
175
+ { from: "g1", to: "f3", color: "blue" },
176
+ ],
177
+ highlights: [
178
+ { square: "e4", color: "rgba(255, 170, 0, 0.4)" },
179
+ ],
180
+ }}
181
+ />
182
+ );
183
+ }
184
+ ```
185
+
186
+ ---
187
+
188
+ ### 3. Premoves & Fast Pacing
189
+
190
+ Enable bullet and blitz players to queue premoves smoothly:
191
+
192
+ ```tsx
193
+ <Chessboard
194
+ game={game}
195
+ allowPremove={true}
196
+ sound={true}
197
+ haptics={true} // Optional mobile vibration feedback
198
+ />
199
+ ```
200
+
201
+ ---
202
+
203
+ ### 4. Full Keyboard & Screen Reader Accessibility
204
+
205
+ Gigaboard is built with uncompromising accessibility compliance:
206
+ * **WAI-ARIA 1.2 Grid**: Correct roles (`grid`, `row`, `gridcell`), roving tabindex, and coordinate indexing.
207
+ * **LiveRegion Move Announcer**: Automatically speaks moves in Standard Algebraic Notation (SAN) to screen readers.
208
+ * **Accessible Promotion Dialog**: Keyboard arrow trapping, auto-focus, and screen-reader announcements.
209
+ * **Custom Speech Labels**: Localize square announcements via `getSquareAriaLabel`.
210
+
211
+ ```tsx
212
+ <Chessboard
213
+ game={game}
214
+ getSquareAriaLabel={(square, cell) => `Square ${square}, ${cell ? "occupied" : "empty"}`}
215
+ onSquareFocus={(square, cell) => console.log(`Focused ${square}`)}
216
+ />
217
+ ```
218
+
219
+ ---
220
+
221
+ ### 5. Server-Side Rendering (Next.js & RSC)
222
+
223
+ Render static chessboards on the server with zero client JavaScript and 100% hydration parity:
224
+
225
+ ```tsx
226
+ import { StaticChessboard } from "gigaboard/server";
227
+
228
+ export default function Page() {
229
+ return (
230
+ <main>
231
+ <h1>Puzzle of the Day</h1>
232
+ <StaticChessboard fen="r1bqk2r/pp1n1ppp/2p1pn2/3p4/2PP4/2NBPN2/PP3PPP/R1BQK2R w KQkq - 0 7" />
233
+ </main>
234
+ );
235
+ }
236
+ ```
237
+
238
+ ---
239
+
240
+ ## 📦 Subpath Exports
241
+
242
+ | Subpath | Role | Description |
243
+ |---|---|---|
244
+ | `gigaboard` | Primary UI | High-performance React chessboard component, hooks, WAAPI animations, and canvas arrows. |
245
+ | `gigaboard/core` | Headless State | Zero-DOM `BoardModel`, per-byte `Uint8Array(64)` subscription store, and `gigachess` adapter. No React/DOM. |
246
+ | `gigaboard/server` | Static SSR | Zero-JS `<StaticChessboard />` for RSC with hydration parity. |
247
+ | `gigaboard/pieces/*` | Piece Renderers | Ultra-compact URL-based piece renderers (~660 B/set). |
248
+ | `gigaboard/themes/*` | Visual Themes | Zero-runtime CSS custom-property palettes (`--gb-*`, ~205 B/theme). |
249
+
250
+ ---
251
+
252
+ ## 🤝 Upstream & Credits
253
+
254
+ Gigaboard was created as an MIT-licensed fork of **[`ultrachess-react`](https://github.com/yahorbarkouski/ultrachess-react)** by **Yahor Barkouski** (MIT). We are deeply grateful for Yahor's original pioneering work on per-byte React chessboard subscription architectures.
255
+
256
+ ---
257
+
258
+ ## 📄 License
259
+
260
+ [MIT](https://github.com/itshak/gigaboard/blob/main/LICENSE) © 2026 Itshak & Yahor Barkouski. Completely free for open-source, commercial, and proprietary projects.
@@ -1099,7 +1099,7 @@ function writeBoardCell(out, index, cell) {
1099
1099
  }
1100
1100
 
1101
1101
  // src/core/index.ts
1102
- var PACKAGE_VERSION = "1.3.0";
1102
+ var PACKAGE_VERSION = "1.3.2";
1103
1103
 
1104
1104
  exports.BOARD_CELL_BB = BOARD_CELL_BB;
1105
1105
  exports.BOARD_CELL_BK = BOARD_CELL_BK;
@@ -1144,5 +1144,5 @@ exports.preloadGigachessAdapter = preloadGigachessAdapter;
1144
1144
  exports.toSquareIndex = toSquareIndex;
1145
1145
  exports.unpackMove = unpackMove;
1146
1146
  exports.writeBoardCell = writeBoardCell;
1147
- //# sourceMappingURL=chunk-E7NSAFSC.cjs.map
1148
- //# sourceMappingURL=chunk-E7NSAFSC.cjs.map
1147
+ //# sourceMappingURL=chunk-6VYZY2Y4.cjs.map
1148
+ //# sourceMappingURL=chunk-6VYZY2Y4.cjs.map