react-chess-puzzle-kit 1.0.0 → 1.0.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.
- package/LICENSE +21 -21
- package/README.md +331 -331
- package/dist/features/analysis/analysisContext.d.ts +1 -1
- package/dist/features/board/LineBoardWithControls.d.ts +3 -1
- package/dist/features/board/PuzzleBoard.d.ts +6 -1
- package/dist/features/board/PuzzleBoardWithControls.d.ts +63 -6
- package/dist/features/board/PuzzlePlaySurface.d.ts +27 -3
- package/dist/features/board/puzzleBoardLayout.d.ts +17 -4
- package/dist/features/board/useStackPuzzleControlsBelow.d.ts +2 -0
- package/dist/features/position/Position.d.ts +18 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +416 -96
- package/dist/index.js +416 -94
- package/package.json +87 -87
- package/dist/features/analysis/AnalysisBoard.d.ts +0 -18
- package/dist/features/analysis/AnalysisBoardCore.d.ts +0 -28
- package/dist/features/analysis/AnalysisBoardLayout.d.ts +0 -12
- package/dist/features/analysis/AnalysisChessboardView.d.ts +0 -5
- package/dist/features/analysis/AnalysisPosition.d.ts +0 -53
- package/dist/features/analysis/AnalysisTrigger.d.ts +0 -6
- package/dist/features/analysis/DefaultAnalysisContainer.d.ts +0 -3
- package/dist/features/analysis/DefaultAnalysisSidebar.d.ts +0 -2
- package/dist/features/analysis/analysisBoardHighlightColors.d.ts +0 -12
- package/dist/features/analysis/analysisLayout.d.ts +0 -5
- package/dist/features/analysis/core/AnalysisBoardCore.d.ts +0 -28
- package/dist/features/analysis/core/AnalysisChessboardView.d.ts +0 -5
- package/dist/features/analysis/core/AnalysisErrorBoundary.d.ts +0 -14
- package/dist/features/analysis/core/AnalysisPosition.d.ts +0 -54
- package/dist/features/analysis/core/analysisContext.d.ts +0 -13
- package/dist/features/analysis/core/analysisLayout.d.ts +0 -5
- package/dist/features/analysis/core/analysisLayoutConfig.d.ts +0 -6
- package/dist/features/analysis/core/index.d.ts +0 -9
- package/dist/features/analysis/core/renderProps.d.ts +0 -39
- package/dist/features/analysis/core/useAnalysisBoardModel.d.ts +0 -36
- package/dist/features/analysis/core/usePuzzleAnalysis.d.ts +0 -10
- package/dist/features/analysis/defaults/AnalysisBoard.d.ts +0 -16
- package/dist/features/analysis/defaults/AnalysisBoardLayout.d.ts +0 -14
- package/dist/features/analysis/defaults/DefaultAnalysisContainer.d.ts +0 -4
- package/dist/features/analysis/defaults/DefaultAnalysisSidebar.d.ts +0 -3
- package/dist/features/analysis/defaults/analysisLayout.d.ts +0 -3
- package/dist/features/analysis/defaults/analysisModalStyles.d.ts +0 -7
- package/dist/features/analysis/defaults/analysisSidebarColors.d.ts +0 -37
- package/dist/features/analysis/defaults/analysisSidebarRowStyle.d.ts +0 -8
- package/dist/features/analysis/defaults/index.d.ts +0 -8
- package/dist/features/analysis/renderProps.d.ts +0 -39
- package/dist/features/analysis/useAnalysisBoardModel.d.ts +0 -33
- package/dist/features/board/HighlightChessboard.d.ts +0 -2
- package/dist/features/board/boardSquareHighlightColors.d.ts +0 -1
- package/dist/features/board/chessboardTheme.d.ts +0 -2
- package/dist/features/engine/EngineEvaluationPanel.d.ts +0 -8
- package/dist/features/engine/StockfishBrowserEngine.d.ts +0 -1
- package/dist/features/engine/formatEvaluation.d.ts +0 -1
- package/dist/features/engine/index.d.ts +0 -1
- package/dist/features/engine/isAnalyzableFen.d.ts +0 -1
- package/dist/features/engine/parseUciInfo.d.ts +0 -1
- package/dist/features/engine/stockfishUrls.d.ts +0 -1
- package/dist/features/engine/types.d.ts +0 -1
- package/dist/features/engine/useAnalysisEngine.d.ts +0 -1
- package/dist/features/theme/ThemeContext.d.ts +0 -26
- package/dist/features/theme/ThemeProvider.d.ts +0 -7
- package/dist/features/theme/squareHighlightColors.d.ts +0 -50
- package/dist/stories/AnalysisBoard.stories.d.ts +0 -9
- package/dist/stories/HighlightChessboard.stories.d.ts +0 -9
- package/dist/stories/analysisFixtures.d.ts +0 -4
- package/dist/stories/regressions/StockfishAnalysisRegressions.stories.d.ts +0 -7
- package/dist/stories/regressions/regressionAnalysisContext.d.ts +0 -5
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { type BoardThemeId } from 'react-chess-core';
|
|
2
3
|
export type LineTrainSide = 'w' | 'b';
|
|
3
4
|
/** A line to drill: a start position plus the moves to walk, from one side. */
|
|
4
5
|
export interface LineSpec {
|
|
@@ -29,6 +30,7 @@ export interface LineControlsRenderProps {
|
|
|
29
30
|
}
|
|
30
31
|
export interface LineBoardWithControlsProps {
|
|
31
32
|
theme: 'light' | 'dark';
|
|
33
|
+
boardTheme?: BoardThemeId;
|
|
32
34
|
line: LineSpec;
|
|
33
35
|
/** Called once when the whole line has been walked. */
|
|
34
36
|
onComplete: (perMove: LineMoveResult[]) => void;
|
|
@@ -47,4 +49,4 @@ export interface LineBoardWithControlsProps {
|
|
|
47
49
|
* tactical puzzles. Mount one instance per drill (key it by line) so its
|
|
48
50
|
* internal state resets between lines.
|
|
49
51
|
*/
|
|
50
|
-
export declare const LineBoardWithControls: ({ theme, line, onComplete, onMove, renderControls, boardWidth, opponentMoveDelayMs, }: LineBoardWithControlsProps) => React.JSX.Element;
|
|
52
|
+
export declare const LineBoardWithControls: ({ theme, boardTheme, line, onComplete, onMove, renderControls, boardWidth, opponentMoveDelayMs, }: LineBoardWithControlsProps) => React.JSX.Element;
|
|
@@ -6,5 +6,10 @@ export interface PuzzleBoardProps {
|
|
|
6
6
|
boardWidth: number;
|
|
7
7
|
/** After a wrong guess, play the correct move instead of allowing retries. */
|
|
8
8
|
revealAnswerOnIncorrect?: boolean;
|
|
9
|
+
/** After a wrong guess, show an arrow to the correct square. */
|
|
10
|
+
showAnswerArrowOnIncorrect?: boolean;
|
|
11
|
+
/** With {@link showAnswerArrowOnIncorrect}, allow wrong retries after the arrow. When false, only the arrow move is accepted. */
|
|
12
|
+
allowRetryOnIncorrect?: boolean;
|
|
13
|
+
answerArrowColor?: string;
|
|
9
14
|
}
|
|
10
|
-
export declare const PuzzleBoard: ({ position, onFeedback, incInteractionNum, boardWidth, revealAnswerOnIncorrect, }: PuzzleBoardProps) => import("react").JSX.Element;
|
|
15
|
+
export declare const PuzzleBoard: ({ position, onFeedback, incInteractionNum, boardWidth, revealAnswerOnIncorrect, showAnswerArrowOnIncorrect, allowRetryOnIncorrect, answerArrowColor, }: PuzzleBoardProps) => import("react").JSX.Element;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { PuzzleResultStatus } from '../analysis';
|
|
3
|
-
import { AnalysisContainerRenderProps, AnalysisControls, AnalysisEngineOptions, AnalysisLayoutConfig, AnalysisMainRenderProps, AnalysisSidebarRenderProps, EngineEvaluationRenderProps } from 'react-chess-core';
|
|
3
|
+
import { AnalysisContainerRenderProps, AnalysisControls, AnalysisEngineOptions, AnalysisLayoutConfig, AnalysisMainRenderProps, AnalysisSidebarRenderProps, EngineEvaluationRenderProps, type BoardThemeId } from 'react-chess-core';
|
|
4
4
|
import { type PuzzleControlState } from './defaults/DefaultPuzzleControls';
|
|
5
|
+
import { type PuzzleMissFeedback } from './PuzzlePlaySurface';
|
|
5
6
|
export type { PuzzleMoveRecord } from '../position/moveHistory';
|
|
6
7
|
export type { AnalysisContainerRenderProps, AnalysisControls, AnalysisLayoutConfig, AnalysisMainRenderProps, AnalysisSidebarRenderProps, EngineEvaluationRenderProps, } from 'react-chess-core';
|
|
7
8
|
export type { PuzzleAnalysisContext, PuzzleResultStatus } from '../analysis';
|
|
@@ -9,13 +10,52 @@ export { DEFAULT_ANALYSIS_LAYOUT } from 'react-chess-core';
|
|
|
9
10
|
export { DEFAULT_PUZZLE_BOARD_WIDTH } from './puzzleBoardLayout';
|
|
10
11
|
export { DefaultPuzzleControls, defaultRenderControls, } from './defaults/DefaultPuzzleControls';
|
|
11
12
|
export type { PuzzleControlState, PuzzleControlsRenderProps, } from './defaults/DefaultPuzzleControls';
|
|
13
|
+
export type BoardCaptionRenderProps = {
|
|
14
|
+
/** null while the puzzle position is loading */
|
|
15
|
+
sideToMove: 'white' | 'black' | null;
|
|
16
|
+
/** Side the user is solving for; null while loading */
|
|
17
|
+
playerColor: 'white' | 'black' | null;
|
|
18
|
+
/** True after a wrong guess, hint, or solution reveal on the current card. */
|
|
19
|
+
incorrectAttempt?: boolean;
|
|
20
|
+
/** True when the current card is finished. */
|
|
21
|
+
complete?: boolean;
|
|
22
|
+
/** False when the card was finished after a miss, hint, or solution reveal. */
|
|
23
|
+
cleanSolve?: boolean;
|
|
24
|
+
/** Engine refutation SAN while a miss sequence is active. */
|
|
25
|
+
refutationSan?: string | null;
|
|
26
|
+
/** Current miss-sequence phase (wrong → refutation → answer). */
|
|
27
|
+
missPhase?: PuzzleMissFeedback['phase'];
|
|
28
|
+
/** True while the board shows the correct-move answer arrow. */
|
|
29
|
+
answerArrowVisible?: boolean;
|
|
30
|
+
/** True when the card finished after a wrong move, hint, or solution reveal. */
|
|
31
|
+
completedAfterMiss?: boolean;
|
|
32
|
+
};
|
|
33
|
+
export type BoardFeedbackRenderProps = {
|
|
34
|
+
resultStatus: Extract<PuzzleResultStatus, 'complete' | 'incorrect'>;
|
|
35
|
+
/** False when the puzzle was finished after a miss, hint, or solution reveal. */
|
|
36
|
+
cleanSolve: boolean;
|
|
37
|
+
/** Engine refutation SAN while a miss sequence is active. */
|
|
38
|
+
refutationSan?: string | null;
|
|
39
|
+
/** Current miss-sequence phase (wrong → refutation → answer). */
|
|
40
|
+
missPhase?: PuzzleMissFeedback['phase'];
|
|
41
|
+
/** True while the board shows the correct-move answer arrow. */
|
|
42
|
+
answerArrowVisible?: boolean;
|
|
43
|
+
/** True when the card finished after a wrong move, hint, or solution reveal. */
|
|
44
|
+
completedAfterMiss?: boolean;
|
|
45
|
+
};
|
|
46
|
+
export type PuzzleFetchResult = {
|
|
47
|
+
fen: string;
|
|
48
|
+
moves: string[];
|
|
49
|
+
resume?: {
|
|
50
|
+
startIndex: number;
|
|
51
|
+
quizAtIndices: number[];
|
|
52
|
+
};
|
|
53
|
+
};
|
|
12
54
|
export interface PuzzleBoardWithControlsProps {
|
|
13
55
|
theme: 'light' | 'dark';
|
|
56
|
+
boardTheme?: BoardThemeId;
|
|
14
57
|
apiProxy: {
|
|
15
|
-
onFetch: () => Promise<
|
|
16
|
-
fen: string;
|
|
17
|
-
moves: string[];
|
|
18
|
-
}>;
|
|
58
|
+
onFetch: () => Promise<PuzzleFetchResult>;
|
|
19
59
|
/** Called when {@link onFetch} rejects (e.g. network / server down). */
|
|
20
60
|
onFetchError?: (error: unknown) => void;
|
|
21
61
|
onFeedback: (feedbackData: {
|
|
@@ -36,6 +76,10 @@ export interface PuzzleBoardWithControlsProps {
|
|
|
36
76
|
renderAnalysisSidebar?: (props: AnalysisSidebarRenderProps) => React.ReactNode;
|
|
37
77
|
renderAnalysisContainer?: (props: AnalysisContainerRenderProps) => React.ReactNode;
|
|
38
78
|
renderEngineEvaluation?: (props: EngineEvaluationRenderProps) => React.ReactNode;
|
|
79
|
+
/** Optional label below the board (e.g. side to move). */
|
|
80
|
+
renderBoardCaption?: (props: BoardCaptionRenderProps) => React.ReactNode;
|
|
81
|
+
/** Optional result feedback shown at the bottom of the controls column. */
|
|
82
|
+
renderBoardFeedback?: (props: BoardFeedbackRenderProps) => React.ReactNode;
|
|
39
83
|
/** Pixel width of the live puzzle board (separate from analysis). */
|
|
40
84
|
puzzleBoardWidth?: number;
|
|
41
85
|
/** Board + sidebar grid sizes when analysis is open. */
|
|
@@ -45,7 +89,20 @@ export interface PuzzleBoardWithControlsProps {
|
|
|
45
89
|
engine?: AnalysisEngineOptions;
|
|
46
90
|
/** After a clean solve (no wrong move, hint, or solution reveal), load the next card. */
|
|
47
91
|
autoAdvanceOnComplete?: boolean;
|
|
92
|
+
/** With {@link autoAdvanceOnComplete}, also advance after finishing following a miss or hint. */
|
|
93
|
+
autoAdvanceOnCompleteAfterIncorrect?: boolean;
|
|
48
94
|
/** After a wrong guess, play the correct move and wait for the user to advance. */
|
|
49
95
|
revealAnswerOnIncorrect?: boolean;
|
|
96
|
+
/** After a wrong guess, show an arrow to the correct square. */
|
|
97
|
+
showAnswerArrowOnIncorrect?: boolean;
|
|
98
|
+
/** With {@link showAnswerArrowOnIncorrect}, allow wrong retries after the arrow. When false, only the arrow move is accepted. */
|
|
99
|
+
allowRetryOnIncorrect?: boolean;
|
|
100
|
+
/** With {@link showAnswerArrowOnIncorrect}, show wrong move + engine refutation before the answer arrow. */
|
|
101
|
+
showRefutationOnIncorrect?: boolean;
|
|
102
|
+
/** When {@link showRefutationOnIncorrect}, show the wrong move on the board before the refutation. */
|
|
103
|
+
autoShowWrongMoves?: boolean;
|
|
104
|
+
/** Stockfish options for refutation analysis (requires scriptUrl when not using AnalysisEngineProvider). */
|
|
105
|
+
refutationEngine?: AnalysisEngineOptions;
|
|
106
|
+
answerArrowColor?: string;
|
|
50
107
|
}
|
|
51
|
-
export declare const PuzzleBoardWithControls: ({ theme, apiProxy, renderControls, renderAnalysisSidebar, renderAnalysisContainer, renderEngineEvaluation, puzzleBoardWidth, analysisLayout, renderAnalysisMain, engine, autoAdvanceOnComplete, revealAnswerOnIncorrect, }: PuzzleBoardWithControlsProps) => React.JSX.Element;
|
|
108
|
+
export declare const PuzzleBoardWithControls: ({ theme, boardTheme, apiProxy, renderControls, renderAnalysisSidebar, renderAnalysisContainer, renderEngineEvaluation, renderBoardCaption, renderBoardFeedback, puzzleBoardWidth, analysisLayout, renderAnalysisMain, engine, autoAdvanceOnComplete, autoAdvanceOnCompleteAfterIncorrect, revealAnswerOnIncorrect, showAnswerArrowOnIncorrect, allowRetryOnIncorrect, showRefutationOnIncorrect, autoShowWrongMoves, refutationEngine, answerArrowColor, }: PuzzleBoardWithControlsProps) => React.JSX.Element;
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
+
import { type AnalysisEngineOptions, type MissSequencePhase } from 'react-chess-core';
|
|
1
2
|
import { PuzzlePosition } from '../position/Position';
|
|
3
|
+
export type PuzzleMissFeedback = {
|
|
4
|
+
refutationSan: string | null;
|
|
5
|
+
phase: MissSequencePhase | null;
|
|
6
|
+
/** True while the board shows the correct-move answer arrow. */
|
|
7
|
+
answerArrowVisible: boolean;
|
|
8
|
+
};
|
|
2
9
|
export interface PuzzlePlaySurfaceProps {
|
|
3
10
|
position: PuzzlePosition | null;
|
|
4
11
|
onFeedback: (feedbackData: {
|
|
@@ -15,11 +22,28 @@ export interface PuzzlePlaySurfaceProps {
|
|
|
15
22
|
}) => void;
|
|
16
23
|
incInteractionNum: () => void;
|
|
17
24
|
boardWidth: number;
|
|
25
|
+
/** After a correct move in resume review, auto-show intervening plies. */
|
|
26
|
+
onResumeCorrect?: (position: PuzzlePosition) => void;
|
|
18
27
|
/** After a wrong guess, play the correct move instead of allowing retries. */
|
|
19
28
|
revealAnswerOnIncorrect?: boolean;
|
|
29
|
+
/** After a wrong guess, show an arrow to the correct square. */
|
|
30
|
+
showAnswerArrowOnIncorrect?: boolean;
|
|
31
|
+
/** With {@link showAnswerArrowOnIncorrect}, allow wrong retries after the arrow. When false, only the arrow move is accepted. */
|
|
32
|
+
allowRetryOnIncorrect?: boolean;
|
|
33
|
+
/** With {@link showAnswerArrowOnIncorrect}, show wrong move + engine refutation before the answer arrow. */
|
|
34
|
+
showRefutationOnIncorrect?: boolean;
|
|
35
|
+
/** When {@link showRefutationOnIncorrect}, show the wrong move on the board before the refutation. */
|
|
36
|
+
autoShowWrongMoves?: boolean;
|
|
37
|
+
/** Stockfish options for refutation analysis. */
|
|
38
|
+
refutationEngine?: AnalysisEngineOptions;
|
|
39
|
+
answerArrowColor?: string;
|
|
40
|
+
/** While the next card is loading, keep the prior board visible but locked. */
|
|
41
|
+
positionLocked?: boolean;
|
|
42
|
+
/** Fired when refutation miss feedback changes (for host UI). */
|
|
43
|
+
onMissFeedbackChange?: (feedback: PuzzleMissFeedback | null) => void;
|
|
20
44
|
}
|
|
21
45
|
/**
|
|
22
|
-
* Single mounted board for puzzle play.
|
|
23
|
-
* position loads so
|
|
46
|
+
* Single mounted board for puzzle play. Keeps the prior board (and orientation)
|
|
47
|
+
* visible while the next position loads so layout and perspective do not flicker.
|
|
24
48
|
*/
|
|
25
|
-
export declare const PuzzlePlaySurface: ({ position, onFeedback, incInteractionNum, boardWidth, revealAnswerOnIncorrect, }: PuzzlePlaySurfaceProps) => import("react").JSX.Element;
|
|
49
|
+
export declare const PuzzlePlaySurface: ({ position, onFeedback, incInteractionNum, boardWidth, onResumeCorrect, revealAnswerOnIncorrect, showAnswerArrowOnIncorrect, allowRetryOnIncorrect, showRefutationOnIncorrect, autoShowWrongMoves, refutationEngine, answerArrowColor, positionLocked, onMissFeedbackChange, }: PuzzlePlaySurfaceProps) => import("react").JSX.Element;
|
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
2
|
/** Default pixel width for the live puzzle board (analysis uses {@link DEFAULT_ANALYSIS_LAYOUT}). */
|
|
3
3
|
export declare const DEFAULT_PUZZLE_BOARD_WIDTH = 480;
|
|
4
|
-
/**
|
|
5
|
-
export declare const
|
|
6
|
-
|
|
4
|
+
/** Width reserved for the vertical controls column beside the board. */
|
|
5
|
+
export declare const PUZZLE_CONTROLS_COLUMN_WIDTH = 160;
|
|
6
|
+
/** Gap between the board column and controls column. */
|
|
7
|
+
export declare const PUZZLE_BOARD_CONTROLS_GAP = 16;
|
|
8
|
+
/** Viewports at or below this width stack controls under the board (through tablet landscape). */
|
|
9
|
+
export declare const PUZZLE_CONTROLS_STACK_BREAKPOINT_PX = 1365;
|
|
10
|
+
/** Horizontal space taken by the controls column when it sits beside the board. */
|
|
11
|
+
export declare const PUZZLE_CONTROLS_BESIDE_RESERVE_PX: number;
|
|
12
|
+
/** Minimum height reserved below the board so the caption slot does not shift between loads. */
|
|
13
|
+
export declare const PUZZLE_BOARD_CAPTION_MIN_HEIGHT = 24;
|
|
14
|
+
export type PuzzleControlsPlacement = 'beside' | 'below';
|
|
15
|
+
export declare const puzzlePlayRowStyle: (placement?: PuzzleControlsPlacement) => CSSProperties;
|
|
16
|
+
export declare const puzzleBoardColumnStyle: (boardWidth: number, placement?: PuzzleControlsPlacement) => CSSProperties;
|
|
17
|
+
export declare const puzzleBoardCaptionSlotStyle: () => CSSProperties;
|
|
18
|
+
export declare const puzzleBoardSlotWrapperStyle: () => CSSProperties;
|
|
7
19
|
export declare const puzzleBoardSlotStyle: () => CSSProperties;
|
|
8
|
-
export declare const
|
|
20
|
+
export declare const puzzleControlsFeedbackStyle: (placement?: PuzzleControlsPlacement) => CSSProperties;
|
|
21
|
+
export declare const puzzleControlsSlotStyle: (placement?: PuzzleControlsPlacement) => CSSProperties;
|
|
@@ -15,11 +15,16 @@ export declare abstract class Position implements Traversable {
|
|
|
15
15
|
/** True when a correct guess at the current index completes the puzzle. */
|
|
16
16
|
isCompletedByCorrectGuess(): boolean;
|
|
17
17
|
fen(): string;
|
|
18
|
+
getSideToMove(): 'white' | 'black';
|
|
18
19
|
getCheckSquare(): string;
|
|
19
20
|
}
|
|
20
21
|
export declare function getCheckSquareFromChess(chess: Chess): string;
|
|
21
22
|
/** Side to move for the final (user) ply in a puzzle line. */
|
|
22
23
|
export declare function playerColorForSolution(initialFen: string, moves: string[]): 'white' | 'black';
|
|
24
|
+
export type PuzzleResumeConfig = {
|
|
25
|
+
startIndex: number;
|
|
26
|
+
quizAtIndices: number[];
|
|
27
|
+
};
|
|
23
28
|
export declare class PuzzlePosition extends Position {
|
|
24
29
|
protected isCorrect: boolean;
|
|
25
30
|
protected guessedMove: string;
|
|
@@ -29,7 +34,8 @@ export declare class PuzzlePosition extends Position {
|
|
|
29
34
|
protected readonly initialFen: string;
|
|
30
35
|
protected moveHistory: PuzzleMoveRecord[];
|
|
31
36
|
private usedAlternativeCheckmate;
|
|
32
|
-
|
|
37
|
+
private readonly resumeConfig?;
|
|
38
|
+
constructor(initialFEN: string, moves: string[], resumeConfig?: PuzzleResumeConfig);
|
|
33
39
|
next(): boolean;
|
|
34
40
|
getInitialFen(): string;
|
|
35
41
|
getSolutionMoves(): string[];
|
|
@@ -46,7 +52,11 @@ export declare class PuzzlePosition extends Position {
|
|
|
46
52
|
private tryMakeUciMove;
|
|
47
53
|
private isCheckmatingMove;
|
|
48
54
|
private applyCheckmateGuess;
|
|
49
|
-
|
|
55
|
+
/** True when dragging from/to matches the expected move at the current index. */
|
|
56
|
+
isExpectedGuess(sourceSquare: string, targetSquare: string): boolean;
|
|
57
|
+
tryGuess: (sourceSquare: string, targetSquare: string, piece: string, options?: {
|
|
58
|
+
recordIfIncorrect?: boolean;
|
|
59
|
+
}) => {
|
|
50
60
|
accepted: boolean;
|
|
51
61
|
finished: boolean;
|
|
52
62
|
};
|
|
@@ -60,7 +70,13 @@ export declare class PuzzlePosition extends Position {
|
|
|
60
70
|
getHintSquare(): string;
|
|
61
71
|
private hint;
|
|
62
72
|
getIncorrectMoveSquare(): string;
|
|
73
|
+
/** UCI of the move the player should play at the current index. */
|
|
74
|
+
getExpectedMoveUci(): string;
|
|
63
75
|
getPlayerColor(): string;
|
|
76
|
+
hasResumeConfig(): boolean;
|
|
77
|
+
getResumeConfig(): PuzzleResumeConfig | undefined;
|
|
78
|
+
/** True when the user must find the move at the current index. */
|
|
79
|
+
isQuizIndex(): boolean;
|
|
64
80
|
}
|
|
65
81
|
export declare class GamePosition extends Position {
|
|
66
82
|
constructor(PGN: string);
|
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export * from './features/board/LineBoardWithControls';
|
|
|
10
10
|
export { DefaultPuzzleControls, defaultRenderControls, } from './features/board/defaults/DefaultPuzzleControls';
|
|
11
11
|
export { DefaultLineControls, defaultRenderLineControls, } from './features/board/defaults/DefaultLineControls';
|
|
12
12
|
export type { PuzzleControlState, PuzzleControlsRenderProps, } from './features/board/defaults/DefaultPuzzleControls';
|
|
13
|
-
export { DEFAULT_PUZZLE_BOARD_WIDTH } from './features/board/puzzleBoardLayout';
|
|
13
|
+
export { DEFAULT_PUZZLE_BOARD_WIDTH, PUZZLE_CONTROLS_BESIDE_RESERVE_PX, PUZZLE_CONTROLS_STACK_BREAKPOINT_PX, } from './features/board/puzzleBoardLayout';
|
|
14
14
|
export * from './features/position/moveHistory';
|
|
15
15
|
export * from './features/position/Position';
|
|
16
16
|
export * from './features/position/Traversable';
|