gigaboard 1.4.2 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/{board-model-BMtkLQvL.d.cts → board-model-BIVxSCWC.d.cts} +73 -2
  2. package/dist/{board-model-BMtkLQvL.d.ts → board-model-BIVxSCWC.d.ts} +73 -2
  3. package/dist/{chunk-EJUGH25P.js → chunk-53XWDREK.js} +4 -3
  4. package/dist/chunk-53XWDREK.js.map +1 -0
  5. package/dist/{chunk-SO6AOEFF.js → chunk-6F3FZAG7.js} +116 -18
  6. package/dist/chunk-6F3FZAG7.js.map +1 -0
  7. package/dist/{chunk-UBD62NOI.cjs → chunk-FUP2LDMO.cjs} +121 -16
  8. package/dist/chunk-FUP2LDMO.cjs.map +1 -0
  9. package/dist/{chunk-D45G3J5E.cjs → chunk-N4WTPXFC.cjs} +4 -2
  10. package/dist/chunk-N4WTPXFC.cjs.map +1 -0
  11. package/dist/core.cjs +72 -44
  12. package/dist/core.d.cts +17 -12
  13. package/dist/core.d.ts +17 -12
  14. package/dist/core.js +1 -1
  15. package/dist/{gigachess-C08uAeFw.d.ts → gigachess-DN-ncmAU.d.ts} +1 -1
  16. package/dist/{gigachess-Dr5gCN68.d.cts → gigachess-XpNGPM2m.d.cts} +1 -1
  17. package/dist/index.cjs +911 -250
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +61 -8
  20. package/dist/index.d.ts +61 -8
  21. package/dist/index.js +818 -189
  22. package/dist/index.js.map +1 -1
  23. package/dist/server.cjs +11 -11
  24. package/dist/server.d.cts +2 -2
  25. package/dist/server.d.ts +2 -2
  26. package/dist/server.js +1 -1
  27. package/dist/{types-CcOgT5ov.d.ts → types-4W8ULiE2.d.ts} +1 -1
  28. package/dist/{types-DfqRXtbD.d.cts → types-Dox7oLof.d.cts} +1 -1
  29. package/package.json +2 -2
  30. package/dist/chunk-D45G3J5E.cjs.map +0 -1
  31. package/dist/chunk-EJUGH25P.js.map +0 -1
  32. package/dist/chunk-SO6AOEFF.js.map +0 -1
  33. package/dist/chunk-UBD62NOI.cjs.map +0 -1
package/dist/index.d.cts CHANGED
@@ -1,12 +1,61 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { C as ChessboardProps, T as Theme, O as Orientation, A as AnimationOptions, R as ResolvedArrowPalette, U as UseChessGameOptions, P as PieceRenderer } from './types-DfqRXtbD.cjs';
3
- export { a as ArrowColors, D as DEFAULT_MOVE_HAPTIC_PATTERNS, b as DEFAULT_MOVE_SOUND_SOURCES, H as HapticFeedbackOptions, L as LegalTargetStyle, M as MoveFeedbackKey, c as MoveHapticKey, d as MoveHapticOptions, e as MoveHapticPatterns, f as MoveSoundKey, g as MoveSoundOptions, h as MoveSoundSources, i as PositionTransition, j as PromotionContext, k as RanksPosition, S as SquareContext, l as TriggerMoveHaptic, m as TriggerMoveSound, n as classifyMoveFeedback, t as triggerHaptic, o as triggerMoveHaptic, u as useMoveHaptics, p as useMoveSound, w as warmupHaptics } from './types-DfqRXtbD.cjs';
4
- export { c as createGigachessAdapter, p as preloadGigachessAdapter } from './gigachess-Dr5gCN68.cjs';
5
- import { v as BoardModel, x as BoardSnapshot, S as SquareIndex, w as BoardModelOptions, P as PackedMove, u as BoardCell } from './board-model-BMtkLQvL.cjs';
6
- export { D as Color, E as EngineAdapter, a as PieceType, Z as ZobristKey, _ as createBoardModel, a5 as packMove, a7 as unpackMove } from './board-model-BMtkLQvL.cjs';
7
- import { RefObject, ReactNode } from 'react';
2
+ import react, { CSSProperties, RefObject, ReactNode } from 'react';
3
+ import { S as SquareIndex, u as BoardCell, v as BoardModel, x as BoardSnapshot, w as BoardModelOptions, P as PackedMove } from './board-model-BIVxSCWC.cjs';
4
+ export { D as Color, E as EngineAdapter, W as NULL_MOVE_SAN, X as NULL_MOVE_SANS, Y as NULL_MOVE_UCI, Z as NULL_MOVE_WORD, a as PieceType, a1 as ZobristKey, a2 as createBoardModel, a8 as isNullMove, a9 as isNullMoveSan, aa as isNullMoveUci, ac as packMove, ae as unpackMove } from './board-model-BIVxSCWC.cjs';
5
+ import { O as Orientation, T as Theme, P as PieceRenderer, C as ChessboardProps, A as AnimationOptions, R as ResolvedArrowPalette, U as UseChessGameOptions } from './types-Dox7oLof.cjs';
6
+ export { a as ArrowColors, D as DEFAULT_MOVE_HAPTIC_PATTERNS, b as DEFAULT_MOVE_SOUND_SOURCES, H as HapticFeedbackOptions, L as LegalTargetStyle, M as MoveFeedbackKey, c as MoveHapticKey, d as MoveHapticOptions, e as MoveHapticPatterns, f as MoveSoundKey, g as MoveSoundOptions, h as MoveSoundSources, i as PositionTransition, j as PromotionContext, k as RanksPosition, S as SquareContext, l as TriggerMoveHaptic, m as TriggerMoveSound, n as classifyMoveFeedback, t as triggerHaptic, o as triggerMoveHaptic, u as useMoveHaptics, p as useMoveSound, w as warmupHaptics } from './types-Dox7oLof.cjs';
7
+ export { c as createGigachessAdapter, p as preloadGigachessAdapter } from './gigachess-XpNGPM2m.cjs';
8
8
  export { HapticInput, TriggerOptions } from 'web-haptics';
9
9
 
10
+ declare function formatFenPlacement(board: Uint8Array): string;
11
+ interface BoardEditorProps {
12
+ /** Current FEN or placement string. */
13
+ fen?: string;
14
+ /** Called whenever the board placement changes. */
15
+ onChange?: (fen: string) => void;
16
+ /** Called when a specific square piece changes. */
17
+ onPieceChange?: (square: SquareIndex, cell: BoardCell, algebraic: string) => void;
18
+ /** Currently selected piece for placement (e.g. "wP", "bP", "wK", or null for eraser). */
19
+ selectedPiece?: string | null;
20
+ /** Callback when shortcut piece is chosen. */
21
+ onSelectPiece?: (piece: string | null) => void;
22
+ /** Board orientation (default "white"). */
23
+ orientation?: Orientation;
24
+ /** Board visual theme. */
25
+ theme?: Theme;
26
+ /** Piece renderer. */
27
+ pieces?: PieceRenderer;
28
+ /** Whether algebraic coordinates are shown. */
29
+ showCoordinates?: boolean;
30
+ /** Container style overrides. */
31
+ style?: CSSProperties;
32
+ /** Container class name. */
33
+ className?: string;
34
+ /** Accessible label. */
35
+ ariaLabel?: string;
36
+ /** Announce feedback callback (e.g. forward to useAriaLive). */
37
+ onAnnounce?: (message: string) => void;
38
+ /** Custom generator for square speech labels. */
39
+ getSquareAriaLabel?: (square: SquareIndex, cell: BoardCell, algebraic: string) => string;
40
+ /** Current focused square (controlled). */
41
+ focusedSquare?: SquareIndex;
42
+ /** Square focus callback. */
43
+ onSquareFocus?: (square: SquareIndex, cell: BoardCell, algebraic: string) => void;
44
+ /** Optional container element id. */
45
+ id?: string;
46
+ /** Clear board callback. */
47
+ onClear?: () => void;
48
+ /** Set starting position callback. */
49
+ onSetStartingPosition?: () => void;
50
+ /** Toggle side to move callback. */
51
+ onToggleSideToMove?: () => void;
52
+ /** Callback when editor receives container focus. */
53
+ onFocus?: (e: react.FocusEvent<HTMLDivElement>) => void;
54
+ /** Callback when editor loses container focus. */
55
+ onBlur?: (e: react.FocusEvent<HTMLDivElement>) => void;
56
+ }
57
+ declare function BoardEditor({ fen, onChange, onPieceChange, selectedPiece, onSelectPiece, orientation, theme, pieces, showCoordinates, style, className, ariaLabel, onAnnounce, getSquareAriaLabel, focusedSquare: propFocusedSquare, onSquareFocus, id, onClear, onSetStartingPosition, onToggleSideToMove, onFocus, onBlur, }: BoardEditorProps): react_jsx_runtime.JSX.Element;
58
+
10
59
  /**
11
60
  * Interactive chess board.
12
61
  *
@@ -423,6 +472,10 @@ declare function getPointAtSquareCentre(container: HTMLElement, square: SquareIn
423
472
  readonly x: number;
424
473
  readonly y: number;
425
474
  };
475
+ /** Algebraic name (`"a1"`, `"h8"`, …) for a square index. */
476
+ declare function algebraicOf(square: SquareIndex): string;
477
+ /** Square index for an algebraic name (`"a1"`, `"h8"`, …), or `null` if invalid. */
478
+ declare function squareOf(algebraic: string): SquareIndex | null;
426
479
 
427
480
  declare const defaultPieces: PieceRenderer;
428
481
 
@@ -436,6 +489,6 @@ declare const defaultPieces: PieceRenderer;
436
489
  */
437
490
 
438
491
  /** Package version — keep in sync with `package.json`. */
439
- declare const PACKAGE_VERSION = "1.3.3";
492
+ declare const PACKAGE_VERSION = "1.5.0";
440
493
 
441
- export { AnimationOptions, AnimationRunner, BoardCell, BoardModel, BoardSnapshot, CSS_VARS, Chessboard, ChessboardProps, DEFAULT_ILLEGAL_FLASH_TINT, DEFAULT_PREMOVE_TINT, type HoverSquareContext, Orientation, PACKAGE_VERSION, PackedMove, PieceRenderer, ResolvedArrowPalette, SquareIndex, Theme, UseChessGameOptions, defaultArrowColors, defaultPieces, defaultTheme, getPointAtSquareCentre, getSquareAtPoint, useArrowGesture, useBoardSlice, useBoardSnapshot, useChessGame, useClickToMove, useDrag, useHoverSquare, useKeyboardNav, useSquareCell };
494
+ export { AnimationOptions, AnimationRunner, BoardCell, BoardEditor, type BoardEditorProps, BoardModel, BoardSnapshot, CSS_VARS, Chessboard, ChessboardProps, DEFAULT_ILLEGAL_FLASH_TINT, DEFAULT_PREMOVE_TINT, type HoverSquareContext, Orientation, PACKAGE_VERSION, PackedMove, PieceRenderer, ResolvedArrowPalette, SquareIndex, Theme, UseChessGameOptions, algebraicOf, defaultArrowColors, defaultPieces, defaultTheme, formatFenPlacement, getPointAtSquareCentre, getSquareAtPoint, squareOf, useArrowGesture, useBoardSlice, useBoardSnapshot, useChessGame, useClickToMove, useDrag, useHoverSquare, useKeyboardNav, useSquareCell };
package/dist/index.d.ts CHANGED
@@ -1,12 +1,61 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { C as ChessboardProps, T as Theme, O as Orientation, A as AnimationOptions, R as ResolvedArrowPalette, U as UseChessGameOptions, P as PieceRenderer } from './types-CcOgT5ov.js';
3
- export { a as ArrowColors, D as DEFAULT_MOVE_HAPTIC_PATTERNS, b as DEFAULT_MOVE_SOUND_SOURCES, H as HapticFeedbackOptions, L as LegalTargetStyle, M as MoveFeedbackKey, c as MoveHapticKey, d as MoveHapticOptions, e as MoveHapticPatterns, f as MoveSoundKey, g as MoveSoundOptions, h as MoveSoundSources, i as PositionTransition, j as PromotionContext, k as RanksPosition, S as SquareContext, l as TriggerMoveHaptic, m as TriggerMoveSound, n as classifyMoveFeedback, t as triggerHaptic, o as triggerMoveHaptic, u as useMoveHaptics, p as useMoveSound, w as warmupHaptics } from './types-CcOgT5ov.js';
4
- export { c as createGigachessAdapter, p as preloadGigachessAdapter } from './gigachess-C08uAeFw.js';
5
- import { v as BoardModel, x as BoardSnapshot, S as SquareIndex, w as BoardModelOptions, P as PackedMove, u as BoardCell } from './board-model-BMtkLQvL.js';
6
- export { D as Color, E as EngineAdapter, a as PieceType, Z as ZobristKey, _ as createBoardModel, a5 as packMove, a7 as unpackMove } from './board-model-BMtkLQvL.js';
7
- import { RefObject, ReactNode } from 'react';
2
+ import react, { CSSProperties, RefObject, ReactNode } from 'react';
3
+ import { S as SquareIndex, u as BoardCell, v as BoardModel, x as BoardSnapshot, w as BoardModelOptions, P as PackedMove } from './board-model-BIVxSCWC.js';
4
+ export { D as Color, E as EngineAdapter, W as NULL_MOVE_SAN, X as NULL_MOVE_SANS, Y as NULL_MOVE_UCI, Z as NULL_MOVE_WORD, a as PieceType, a1 as ZobristKey, a2 as createBoardModel, a8 as isNullMove, a9 as isNullMoveSan, aa as isNullMoveUci, ac as packMove, ae as unpackMove } from './board-model-BIVxSCWC.js';
5
+ import { O as Orientation, T as Theme, P as PieceRenderer, C as ChessboardProps, A as AnimationOptions, R as ResolvedArrowPalette, U as UseChessGameOptions } from './types-4W8ULiE2.js';
6
+ export { a as ArrowColors, D as DEFAULT_MOVE_HAPTIC_PATTERNS, b as DEFAULT_MOVE_SOUND_SOURCES, H as HapticFeedbackOptions, L as LegalTargetStyle, M as MoveFeedbackKey, c as MoveHapticKey, d as MoveHapticOptions, e as MoveHapticPatterns, f as MoveSoundKey, g as MoveSoundOptions, h as MoveSoundSources, i as PositionTransition, j as PromotionContext, k as RanksPosition, S as SquareContext, l as TriggerMoveHaptic, m as TriggerMoveSound, n as classifyMoveFeedback, t as triggerHaptic, o as triggerMoveHaptic, u as useMoveHaptics, p as useMoveSound, w as warmupHaptics } from './types-4W8ULiE2.js';
7
+ export { c as createGigachessAdapter, p as preloadGigachessAdapter } from './gigachess-DN-ncmAU.js';
8
8
  export { HapticInput, TriggerOptions } from 'web-haptics';
9
9
 
10
+ declare function formatFenPlacement(board: Uint8Array): string;
11
+ interface BoardEditorProps {
12
+ /** Current FEN or placement string. */
13
+ fen?: string;
14
+ /** Called whenever the board placement changes. */
15
+ onChange?: (fen: string) => void;
16
+ /** Called when a specific square piece changes. */
17
+ onPieceChange?: (square: SquareIndex, cell: BoardCell, algebraic: string) => void;
18
+ /** Currently selected piece for placement (e.g. "wP", "bP", "wK", or null for eraser). */
19
+ selectedPiece?: string | null;
20
+ /** Callback when shortcut piece is chosen. */
21
+ onSelectPiece?: (piece: string | null) => void;
22
+ /** Board orientation (default "white"). */
23
+ orientation?: Orientation;
24
+ /** Board visual theme. */
25
+ theme?: Theme;
26
+ /** Piece renderer. */
27
+ pieces?: PieceRenderer;
28
+ /** Whether algebraic coordinates are shown. */
29
+ showCoordinates?: boolean;
30
+ /** Container style overrides. */
31
+ style?: CSSProperties;
32
+ /** Container class name. */
33
+ className?: string;
34
+ /** Accessible label. */
35
+ ariaLabel?: string;
36
+ /** Announce feedback callback (e.g. forward to useAriaLive). */
37
+ onAnnounce?: (message: string) => void;
38
+ /** Custom generator for square speech labels. */
39
+ getSquareAriaLabel?: (square: SquareIndex, cell: BoardCell, algebraic: string) => string;
40
+ /** Current focused square (controlled). */
41
+ focusedSquare?: SquareIndex;
42
+ /** Square focus callback. */
43
+ onSquareFocus?: (square: SquareIndex, cell: BoardCell, algebraic: string) => void;
44
+ /** Optional container element id. */
45
+ id?: string;
46
+ /** Clear board callback. */
47
+ onClear?: () => void;
48
+ /** Set starting position callback. */
49
+ onSetStartingPosition?: () => void;
50
+ /** Toggle side to move callback. */
51
+ onToggleSideToMove?: () => void;
52
+ /** Callback when editor receives container focus. */
53
+ onFocus?: (e: react.FocusEvent<HTMLDivElement>) => void;
54
+ /** Callback when editor loses container focus. */
55
+ onBlur?: (e: react.FocusEvent<HTMLDivElement>) => void;
56
+ }
57
+ declare function BoardEditor({ fen, onChange, onPieceChange, selectedPiece, onSelectPiece, orientation, theme, pieces, showCoordinates, style, className, ariaLabel, onAnnounce, getSquareAriaLabel, focusedSquare: propFocusedSquare, onSquareFocus, id, onClear, onSetStartingPosition, onToggleSideToMove, onFocus, onBlur, }: BoardEditorProps): react_jsx_runtime.JSX.Element;
58
+
10
59
  /**
11
60
  * Interactive chess board.
12
61
  *
@@ -423,6 +472,10 @@ declare function getPointAtSquareCentre(container: HTMLElement, square: SquareIn
423
472
  readonly x: number;
424
473
  readonly y: number;
425
474
  };
475
+ /** Algebraic name (`"a1"`, `"h8"`, …) for a square index. */
476
+ declare function algebraicOf(square: SquareIndex): string;
477
+ /** Square index for an algebraic name (`"a1"`, `"h8"`, …), or `null` if invalid. */
478
+ declare function squareOf(algebraic: string): SquareIndex | null;
426
479
 
427
480
  declare const defaultPieces: PieceRenderer;
428
481
 
@@ -436,6 +489,6 @@ declare const defaultPieces: PieceRenderer;
436
489
  */
437
490
 
438
491
  /** Package version — keep in sync with `package.json`. */
439
- declare const PACKAGE_VERSION = "1.3.3";
492
+ declare const PACKAGE_VERSION = "1.5.0";
440
493
 
441
- export { AnimationOptions, AnimationRunner, BoardCell, BoardModel, BoardSnapshot, CSS_VARS, Chessboard, ChessboardProps, DEFAULT_ILLEGAL_FLASH_TINT, DEFAULT_PREMOVE_TINT, type HoverSquareContext, Orientation, PACKAGE_VERSION, PackedMove, PieceRenderer, ResolvedArrowPalette, SquareIndex, Theme, UseChessGameOptions, defaultArrowColors, defaultPieces, defaultTheme, getPointAtSquareCentre, getSquareAtPoint, useArrowGesture, useBoardSlice, useBoardSnapshot, useChessGame, useClickToMove, useDrag, useHoverSquare, useKeyboardNav, useSquareCell };
494
+ export { AnimationOptions, AnimationRunner, BoardCell, BoardEditor, type BoardEditorProps, BoardModel, BoardSnapshot, CSS_VARS, Chessboard, ChessboardProps, DEFAULT_ILLEGAL_FLASH_TINT, DEFAULT_PREMOVE_TINT, type HoverSquareContext, Orientation, PACKAGE_VERSION, PackedMove, PieceRenderer, ResolvedArrowPalette, SquareIndex, Theme, UseChessGameOptions, algebraicOf, defaultArrowColors, defaultPieces, defaultTheme, formatFenPlacement, getPointAtSquareCentre, getSquareAtPoint, squareOf, useArrowGesture, useBoardSlice, useBoardSnapshot, useChessGame, useClickToMove, useDrag, useHoverSquare, useKeyboardNav, useSquareCell };