react-chess-puzzle-kit 1.0.0 → 1.0.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.
Files changed (65) hide show
  1. package/README.md +1 -1
  2. package/dist/features/analysis/analysisContext.d.ts +1 -1
  3. package/dist/features/board/LineBoardWithControls.d.ts +3 -1
  4. package/dist/features/board/PuzzleBoard.d.ts +6 -1
  5. package/dist/features/board/PuzzleBoardWithControls.d.ts +63 -6
  6. package/dist/features/board/PuzzlePlaySurface.d.ts +27 -3
  7. package/dist/features/board/puzzleBoardLayout.d.ts +17 -4
  8. package/dist/features/board/useStackPuzzleControlsBelow.d.ts +2 -0
  9. package/dist/features/position/Position.d.ts +18 -2
  10. package/dist/index.d.ts +1 -1
  11. package/dist/index.esm.js +432 -100
  12. package/dist/index.js +432 -98
  13. package/package.json +3 -3
  14. package/dist/features/analysis/AnalysisBoard.d.ts +0 -18
  15. package/dist/features/analysis/AnalysisBoardCore.d.ts +0 -28
  16. package/dist/features/analysis/AnalysisBoardLayout.d.ts +0 -12
  17. package/dist/features/analysis/AnalysisChessboardView.d.ts +0 -5
  18. package/dist/features/analysis/AnalysisPosition.d.ts +0 -53
  19. package/dist/features/analysis/AnalysisTrigger.d.ts +0 -6
  20. package/dist/features/analysis/DefaultAnalysisContainer.d.ts +0 -3
  21. package/dist/features/analysis/DefaultAnalysisSidebar.d.ts +0 -2
  22. package/dist/features/analysis/analysisBoardHighlightColors.d.ts +0 -12
  23. package/dist/features/analysis/analysisLayout.d.ts +0 -5
  24. package/dist/features/analysis/core/AnalysisBoardCore.d.ts +0 -28
  25. package/dist/features/analysis/core/AnalysisChessboardView.d.ts +0 -5
  26. package/dist/features/analysis/core/AnalysisErrorBoundary.d.ts +0 -14
  27. package/dist/features/analysis/core/AnalysisPosition.d.ts +0 -54
  28. package/dist/features/analysis/core/analysisContext.d.ts +0 -13
  29. package/dist/features/analysis/core/analysisLayout.d.ts +0 -5
  30. package/dist/features/analysis/core/analysisLayoutConfig.d.ts +0 -6
  31. package/dist/features/analysis/core/index.d.ts +0 -9
  32. package/dist/features/analysis/core/renderProps.d.ts +0 -39
  33. package/dist/features/analysis/core/useAnalysisBoardModel.d.ts +0 -36
  34. package/dist/features/analysis/core/usePuzzleAnalysis.d.ts +0 -10
  35. package/dist/features/analysis/defaults/AnalysisBoard.d.ts +0 -16
  36. package/dist/features/analysis/defaults/AnalysisBoardLayout.d.ts +0 -14
  37. package/dist/features/analysis/defaults/DefaultAnalysisContainer.d.ts +0 -4
  38. package/dist/features/analysis/defaults/DefaultAnalysisSidebar.d.ts +0 -3
  39. package/dist/features/analysis/defaults/analysisLayout.d.ts +0 -3
  40. package/dist/features/analysis/defaults/analysisModalStyles.d.ts +0 -7
  41. package/dist/features/analysis/defaults/analysisSidebarColors.d.ts +0 -37
  42. package/dist/features/analysis/defaults/analysisSidebarRowStyle.d.ts +0 -8
  43. package/dist/features/analysis/defaults/index.d.ts +0 -8
  44. package/dist/features/analysis/renderProps.d.ts +0 -39
  45. package/dist/features/analysis/useAnalysisBoardModel.d.ts +0 -33
  46. package/dist/features/board/HighlightChessboard.d.ts +0 -2
  47. package/dist/features/board/boardSquareHighlightColors.d.ts +0 -1
  48. package/dist/features/board/chessboardTheme.d.ts +0 -2
  49. package/dist/features/engine/EngineEvaluationPanel.d.ts +0 -8
  50. package/dist/features/engine/StockfishBrowserEngine.d.ts +0 -1
  51. package/dist/features/engine/formatEvaluation.d.ts +0 -1
  52. package/dist/features/engine/index.d.ts +0 -1
  53. package/dist/features/engine/isAnalyzableFen.d.ts +0 -1
  54. package/dist/features/engine/parseUciInfo.d.ts +0 -1
  55. package/dist/features/engine/stockfishUrls.d.ts +0 -1
  56. package/dist/features/engine/types.d.ts +0 -1
  57. package/dist/features/engine/useAnalysisEngine.d.ts +0 -1
  58. package/dist/features/theme/ThemeContext.d.ts +0 -26
  59. package/dist/features/theme/ThemeProvider.d.ts +0 -7
  60. package/dist/features/theme/squareHighlightColors.d.ts +0 -50
  61. package/dist/stories/AnalysisBoard.stories.d.ts +0 -9
  62. package/dist/stories/HighlightChessboard.stories.d.ts +0 -9
  63. package/dist/stories/analysisFixtures.d.ts +0 -4
  64. package/dist/stories/regressions/StockfishAnalysisRegressions.stories.d.ts +0 -7
  65. package/dist/stories/regressions/regressionAnalysisContext.d.ts +0 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-chess-puzzle-kit",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "React chess puzzle kit: play, controls, analysis, and browser Stockfish for endchess.training and other apps",
5
5
  "license": "MIT",
6
6
  "author": "Robert Blackwell",
@@ -51,7 +51,7 @@
51
51
  "peerDependencies": {
52
52
  "chess.js": "^1.0.0-beta.8",
53
53
  "react": "^18.3.1",
54
- "react-chess-core": "^0.1.0",
54
+ "react-chess-core": "^0.1.1",
55
55
  "react-chessboard": "^4.7.1"
56
56
  },
57
57
  "devDependencies": {
@@ -74,7 +74,7 @@
74
74
  "chess.js": "^1.0.0-beta.8",
75
75
  "jest": "^29.7.0",
76
76
  "react": "^18.3.1",
77
- "react-chess-core": "^0.1.0",
77
+ "react-chess-core": "^0.1.1",
78
78
  "react-chessboard": "^4.7.1",
79
79
  "storybook": "^8.2.9",
80
80
  "ts-jest": "^29.2.4",
@@ -1,18 +0,0 @@
1
- import React from 'react';
2
- import { AnalysisBoardCoreProps } from './AnalysisBoardCore';
3
- import { AnalysisContainerRenderProps, AnalysisMainRenderProps, AnalysisSidebarRenderProps, EngineEvaluationRenderProps } from './renderProps';
4
- export type { AnalysisBoardCoreProps, AnalysisBoardModel } from './AnalysisBoardCore';
5
- export { ANALYSIS_BOARD_WIDTH, ANALYSIS_BODY_GAP, ANALYSIS_SIDEBAR_WIDTH, } from './analysisLayout';
6
- export { AnalysisBoardLayout } from './AnalysisBoardLayout';
7
- export { useAnalysisBoardModel } from './useAnalysisBoardModel';
8
- export interface AnalysisBoardProps extends Omit<AnalysisBoardCoreProps, 'renderContainer' | 'renderMain' | 'renderSidebar' | 'renderEngineEvaluation'> {
9
- renderContainer?: (props: AnalysisContainerRenderProps) => React.ReactNode;
10
- renderMain?: (props: AnalysisMainRenderProps) => React.ReactNode;
11
- renderSidebar?: (props: AnalysisSidebarRenderProps) => React.ReactNode;
12
- renderEngineEvaluation?: (props: EngineEvaluationRenderProps) => React.ReactNode;
13
- }
14
- /**
15
- * Full analysis UI with library defaults: modal shell, grid layout, sidebar, engine panel.
16
- * For host-owned UI only, use {@link AnalysisBoardCore} and pass all render props.
17
- */
18
- export declare const AnalysisBoard: ({ renderContainer, renderMain, renderSidebar, renderEngineEvaluation, engine, ...modelArgs }: AnalysisBoardProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,28 +0,0 @@
1
- import React from 'react';
2
- import { AnalysisContainerRenderProps, AnalysisMainRenderProps, AnalysisSidebarRenderProps, EngineEvaluationRenderProps } from './renderProps';
3
- import { AnalysisEngineOptions } from '../engine/types';
4
- import { AnalysisBoardModel, UseAnalysisBoardModelArgs } from './useAnalysisBoardModel';
5
- export type AnalysisBoardCoreProps = UseAnalysisBoardModelArgs & {
6
- engine?: AnalysisEngineOptions;
7
- /** Host-owned shell (modal, page layout, etc.). */
8
- renderContainer: (props: AnalysisContainerRenderProps) => React.ReactNode;
9
- /** Host-owned grid/placement of board + sidebar (no library default). */
10
- renderMain: (props: AnalysisMainRenderProps) => React.ReactNode;
11
- renderSidebar: (props: AnalysisSidebarRenderProps) => React.ReactNode;
12
- renderEngineEvaluation: (props: EngineEvaluationRenderProps) => React.ReactNode;
13
- };
14
- /**
15
- * Analysis logic + composition only: hook, board node, sidebar/engine slots.
16
- * No layout divs — use {@link renderMain} (e.g. {@link AnalysisBoardLayout} from the host or default {@link AnalysisBoard}).
17
- */
18
- export declare const AnalysisBoardCore: ({ renderContainer, renderMain, renderSidebar, renderEngineEvaluation, ...modelArgs }: AnalysisBoardCoreProps) => import("react/jsx-runtime").JSX.Element;
19
- type AnalysisBoardCoreViewProps = {
20
- model: AnalysisBoardModel;
21
- renderContainer: AnalysisBoardCoreProps['renderContainer'];
22
- renderMain: AnalysisBoardCoreProps['renderMain'];
23
- renderSidebar: AnalysisBoardCoreProps['renderSidebar'];
24
- renderEngineEvaluation: AnalysisBoardCoreProps['renderEngineEvaluation'];
25
- };
26
- /** Pure composition (no layout styles) for testing and reuse. */
27
- export declare const AnalysisBoardCoreView: ({ model, renderContainer, renderMain, renderSidebar, renderEngineEvaluation, }: AnalysisBoardCoreViewProps) => React.ReactNode;
28
- export type { AnalysisBoardModel, UseAnalysisBoardModelArgs };
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- import { AnalysisBoardModel } from './useAnalysisBoardModel';
3
- export type AnalysisBoardLayoutProps = {
4
- model: AnalysisBoardModel;
5
- board: React.ReactNode;
6
- sidebar: React.ReactNode;
7
- };
8
- /**
9
- * Default analysis layout: board column + sidebar column.
10
- * Used by {@link AnalysisBoard}; hosts may reuse via {@link defaultAnalysisMainLayout}.
11
- */
12
- export declare const AnalysisBoardLayout: ({ model, board, sidebar, }: AnalysisBoardLayoutProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +0,0 @@
1
- import { AnalysisBoardModel } from './useAnalysisBoardModel';
2
- /** Draggable analysis board (no surrounding layout chrome). */
3
- export declare const AnalysisChessboardView: ({ model }: {
4
- model: AnalysisBoardModel;
5
- }) => import("react/jsx-runtime").JSX.Element;
@@ -1,53 +0,0 @@
1
- import { PuzzleAnalysisContext } from './analysisContext';
2
- export type SolutionMoveDisplay = {
3
- ply: number;
4
- uci: string;
5
- san: string;
6
- };
7
- export type AnalysisHistoryRow = {
8
- key: string;
9
- label: string;
10
- indent: number;
11
- kind: 'start' | 'main' | 'variation';
12
- mainPly: number;
13
- variationIndex: number;
14
- };
15
- export declare class AnalysisPosition {
16
- private chess;
17
- private readonly initialFen;
18
- private readonly solutionMoves;
19
- private readonly solutionSans;
20
- private mainPly;
21
- private variation;
22
- private variationCursor;
23
- constructor(context: PuzzleAnalysisContext);
24
- private static buildSolutionSans;
25
- private fenAtMainPly;
26
- private rebuildChess;
27
- private findLegalMove;
28
- private uciFromVerboseMove;
29
- private matchesMainMove;
30
- getNavPly(): number;
31
- getMaxNavPly(): number;
32
- /** @deprecated Use getNavPly */
33
- getPly(): number;
34
- /** @deprecated Use getMaxNavPly */
35
- getMaxPly(): number;
36
- getSolutionSans(): SolutionMoveDisplay[];
37
- getHistoryRows(): AnalysisHistoryRow[];
38
- isHistoryRowSelected(row: AnalysisHistoryRow): boolean;
39
- selectHistoryRow(row: AnalysisHistoryRow): void;
40
- selectMainLine(ply: number): void;
41
- /** @deprecated Use selectMainLine or goToNavPly */
42
- goToPly(ply: number): void;
43
- goToNavPly(navPly: number): void;
44
- tryPlayMove(sourceSquare: string, targetSquare: string, piece: string): boolean;
45
- next(): boolean;
46
- prev(): boolean;
47
- getLastMoveSquares(): {
48
- from: string;
49
- to: string;
50
- } | null;
51
- fen(): string;
52
- getCheckSquare(): string;
53
- }
@@ -1,6 +0,0 @@
1
- export interface AnalysisTriggerProps {
2
- visible: boolean;
3
- onClick: () => void;
4
- theme: 'light' | 'dark';
5
- }
6
- export declare const AnalysisTrigger: ({ visible, onClick, theme, }: AnalysisTriggerProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,3 +0,0 @@
1
- import { AnalysisContainerRenderProps } from './renderProps';
2
- /** Default full-screen modal shell for analysis (library preset UI). */
3
- export declare const DefaultAnalysisContainer: ({ theme, onClose, onBackdropMouseDown, children, }: AnalysisContainerRenderProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,2 +0,0 @@
1
- import { AnalysisSidebarRenderProps } from './renderProps';
2
- export declare const DefaultAnalysisSidebar: ({ historyRows, isHistoryRowSelected, onSelectHistoryRow, ply, maxPly, onSelectPly, theme, engineEvaluationPanel, }: AnalysisSidebarRenderProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,12 +0,0 @@
1
- /**
2
- * Square overlay colors for analysis board replay (last move highlight).
3
- */
4
- export declare const analysisBoardHighlightColors: {
5
- readonly lastMove: {
6
- readonly light: "rgba(253, 216, 53, 0.55)";
7
- readonly dark: "rgba(144, 202, 249, 0.5)";
8
- };
9
- };
10
- export declare const getLastMoveSquareStyles: (from: string, to: string, theme: "light" | "dark") => Record<string, {
11
- backgroundColor: string;
12
- }>;
@@ -1,5 +0,0 @@
1
- /** Board column width in analysis grid (matches endchess-frontend sidebar layout). */
2
- export declare const ANALYSIS_BOARD_WIDTH = 480;
3
- /** Sidebar column width (move list + engine). */
4
- export declare const ANALYSIS_SIDEBAR_WIDTH = 500;
5
- export declare const ANALYSIS_BODY_GAP = 16;
@@ -1,28 +0,0 @@
1
- import React from 'react';
2
- import { AnalysisContainerRenderProps, AnalysisMainRenderProps, AnalysisSidebarRenderProps, EngineEvaluationRenderProps } from './renderProps';
3
- import { AnalysisEngineOptions } from 'react-chess-core';
4
- import { AnalysisBoardModel, UseAnalysisBoardModelArgs } from './useAnalysisBoardModel';
5
- export type AnalysisBoardCoreProps = UseAnalysisBoardModelArgs & {
6
- engine?: AnalysisEngineOptions;
7
- /** Host-owned shell (modal, page layout, etc.). */
8
- renderContainer: (props: AnalysisContainerRenderProps) => React.ReactNode;
9
- /** Host-owned grid/placement of board + sidebar (no library default). */
10
- renderMain: (props: AnalysisMainRenderProps) => React.ReactNode;
11
- renderSidebar: (props: AnalysisSidebarRenderProps) => React.ReactNode;
12
- renderEngineEvaluation: (props: EngineEvaluationRenderProps) => React.ReactNode;
13
- };
14
- /**
15
- * Analysis logic + composition only: hook, board node, sidebar/engine slots.
16
- * No layout divs — use {@link renderMain} (e.g. `AnalysisBoardLayout` from `analysis/defaults` or a host layout).
17
- */
18
- export declare const AnalysisBoardCore: ({ renderContainer, renderMain, renderSidebar, renderEngineEvaluation, ...modelArgs }: AnalysisBoardCoreProps) => React.JSX.Element;
19
- type AnalysisBoardCoreViewProps = {
20
- model: AnalysisBoardModel;
21
- renderContainer: AnalysisBoardCoreProps['renderContainer'];
22
- renderMain: AnalysisBoardCoreProps['renderMain'];
23
- renderSidebar: AnalysisBoardCoreProps['renderSidebar'];
24
- renderEngineEvaluation: AnalysisBoardCoreProps['renderEngineEvaluation'];
25
- };
26
- /** Pure composition (no layout styles) for testing and reuse. */
27
- export declare const AnalysisBoardCoreView: ({ model, renderContainer, renderMain, renderSidebar, renderEngineEvaluation, }: AnalysisBoardCoreViewProps) => React.ReactNode;
28
- export type { AnalysisBoardModel, UseAnalysisBoardModelArgs };
@@ -1,5 +0,0 @@
1
- import { AnalysisBoardModel } from './useAnalysisBoardModel';
2
- /** Draggable analysis board (no surrounding layout chrome). */
3
- export declare const AnalysisChessboardView: ({ model }: {
4
- model: AnalysisBoardModel;
5
- }) => import("react").JSX.Element;
@@ -1,14 +0,0 @@
1
- import { Component, ReactNode } from 'react';
2
- type AnalysisErrorBoundaryProps = {
3
- children: ReactNode;
4
- onClose?: () => void;
5
- };
6
- type AnalysisErrorBoundaryState = {
7
- error: Error | null;
8
- };
9
- export declare class AnalysisErrorBoundary extends Component<AnalysisErrorBoundaryProps, AnalysisErrorBoundaryState> {
10
- state: AnalysisErrorBoundaryState;
11
- static getDerivedStateFromError(error: Error): AnalysisErrorBoundaryState;
12
- render(): string | number | boolean | Iterable<ReactNode> | import("react").JSX.Element | null | undefined;
13
- }
14
- export {};
@@ -1,54 +0,0 @@
1
- import { PuzzleAnalysisContext } from './analysisContext';
2
- export type SolutionMoveDisplay = {
3
- ply: number;
4
- uci: string;
5
- san: string;
6
- };
7
- export type AnalysisHistoryRow = {
8
- key: string;
9
- label: string;
10
- indent: number;
11
- kind: 'start' | 'main' | 'variation';
12
- mainPly: number;
13
- variationIndex: number;
14
- };
15
- export declare class AnalysisPosition {
16
- private chess;
17
- private readonly initialFen;
18
- private readonly solutionMoves;
19
- private readonly solutionSans;
20
- private mainPly;
21
- private variation;
22
- private variationCursor;
23
- constructor(context: PuzzleAnalysisContext);
24
- private static buildSolutionSans;
25
- private static applySolutionMove;
26
- private fenAtMainPly;
27
- private rebuildChess;
28
- private findLegalMove;
29
- private uciFromVerboseMove;
30
- private matchesMainMove;
31
- getNavPly(): number;
32
- getMaxNavPly(): number;
33
- /** @deprecated Use getNavPly */
34
- getPly(): number;
35
- /** @deprecated Use getMaxNavPly */
36
- getMaxPly(): number;
37
- getSolutionSans(): SolutionMoveDisplay[];
38
- getHistoryRows(): AnalysisHistoryRow[];
39
- isHistoryRowSelected(row: AnalysisHistoryRow): boolean;
40
- selectHistoryRow(row: AnalysisHistoryRow): void;
41
- selectMainLine(ply: number): void;
42
- /** @deprecated Use selectMainLine or goToNavPly */
43
- goToPly(ply: number): void;
44
- goToNavPly(navPly: number): void;
45
- tryPlayMove(sourceSquare: string, targetSquare: string, piece: string): boolean;
46
- next(): boolean;
47
- prev(): boolean;
48
- getLastMoveSquares(): {
49
- from: string;
50
- to: string;
51
- } | null;
52
- fen(): string;
53
- getCheckSquare(): string;
54
- }
@@ -1,13 +0,0 @@
1
- import { PuzzleMoveRecord } from '../../position/moveHistory';
2
- import { PuzzlePosition } from '../../position/Position';
3
- export type PuzzleResultStatus = 'none' | 'incorrect' | 'complete';
4
- export type PuzzleAnalysisContext = {
5
- initialFen: string;
6
- solutionMoves: string[];
7
- moveHistory: PuzzleMoveRecord[];
8
- currentPly: number;
9
- boardOrientation: 'white' | 'black';
10
- };
11
- export declare const emptyAnalysisContext: () => PuzzleAnalysisContext;
12
- export declare const buildAnalysisContext: (position: PuzzlePosition | null) => PuzzleAnalysisContext;
13
- export declare const isAnalysisAvailable: (position: PuzzlePosition | null, resultStatus: PuzzleResultStatus) => boolean;
@@ -1,5 +0,0 @@
1
- /** Board column width in analysis grid (matches endchess-frontend sidebar layout). */
2
- export declare const ANALYSIS_BOARD_WIDTH = 480;
3
- /** Sidebar column width (move list + engine). */
4
- export declare const ANALYSIS_SIDEBAR_WIDTH = 500;
5
- export declare const ANALYSIS_BODY_GAP = 16;
@@ -1,6 +0,0 @@
1
- /** Host-provided dimensions for analysis board + sidebar grid (defaults package only). */
2
- export type AnalysisLayoutConfig = {
3
- boardWidth: number;
4
- sidebarWidth: number;
5
- columnGap: number;
6
- };
@@ -1,9 +0,0 @@
1
- export * from './AnalysisErrorBoundary';
2
- export * from './analysisContext';
3
- export * from './analysisLayoutConfig';
4
- export * from './AnalysisBoardCore';
5
- export * from './AnalysisChessboardView';
6
- export * from './AnalysisPosition';
7
- export * from './renderProps';
8
- export * from './useAnalysisBoardModel';
9
- export * from './usePuzzleAnalysis';
@@ -1,39 +0,0 @@
1
- import type { ReactNode } from 'react';
2
- import { EngineEvaluation } from 'react-chess-core';
3
- import { AnalysisHistoryRow, SolutionMoveDisplay } from './AnalysisPosition';
4
- import { AnalysisBoardModel } from './useAnalysisBoardModel';
5
- export type AnalysisControls = {
6
- visible: boolean;
7
- openAnalysis: () => void;
8
- };
9
- export type EngineEvaluationRenderProps = {
10
- fen: string;
11
- evaluation: EngineEvaluation;
12
- theme: 'light' | 'dark';
13
- };
14
- export type AnalysisSidebarRenderProps = {
15
- /** Main-line moves (legacy; prefer historyRows). */
16
- moves: SolutionMoveDisplay[];
17
- historyRows: AnalysisHistoryRow[];
18
- isHistoryRowSelected: (row: AnalysisHistoryRow) => boolean;
19
- onSelectHistoryRow: (row: AnalysisHistoryRow) => void;
20
- ply: number;
21
- maxPly: number;
22
- onSelectPly: (ply: number) => void;
23
- theme: 'light' | 'dark';
24
- /** Host-rendered engine UI from `renderEngineEvaluation`. */
25
- engineEvaluationPanel: ReactNode | null;
26
- };
27
- export type AnalysisContainerRenderProps = {
28
- theme: 'light' | 'dark';
29
- onClose: () => void;
30
- children: ReactNode;
31
- /** Used by {@link DefaultAnalysisContainer} for overlay dismiss (ignored by most hosts). */
32
- onBackdropMouseDown?: () => void;
33
- };
34
- /** Place board + sidebar inside the analysis shell (host or default grid). */
35
- export type AnalysisMainRenderProps = {
36
- model: AnalysisBoardModel;
37
- board: ReactNode;
38
- sidebar: ReactNode;
39
- };
@@ -1,36 +0,0 @@
1
- import { AnalysisHistoryRow, SolutionMoveDisplay } from './AnalysisPosition';
2
- import { PuzzleAnalysisContext } from './analysisContext';
3
- import { AnalysisEngineOptions, EngineEvaluation } from 'react-chess-core';
4
- export type UseAnalysisBoardModelArgs = {
5
- analysisContext: PuzzleAnalysisContext;
6
- onClose: () => void;
7
- theme: 'light' | 'dark';
8
- /** Chessboard pixel width (host-controlled). */
9
- boardWidth: number;
10
- engine?: AnalysisEngineOptions;
11
- };
12
- export type AnalysisBoardModel = {
13
- theme: 'light' | 'dark';
14
- boardWidth: number;
15
- analysisContext: PuzzleAnalysisContext;
16
- fen: string;
17
- ply: number;
18
- maxPly: number;
19
- historyRows: AnalysisHistoryRow[];
20
- solutionSans: SolutionMoveDisplay[];
21
- boardOrientation: 'white' | 'black';
22
- engineEvaluation: EngineEvaluation;
23
- engineEnabled: boolean;
24
- lastMove: {
25
- from: string;
26
- to: string;
27
- } | null;
28
- checkSquare: string | null;
29
- onSelectPly: (ply: number) => void;
30
- onSelectHistoryRow: (row: AnalysisHistoryRow) => void;
31
- isHistoryRowSelected: (row: AnalysisHistoryRow) => boolean;
32
- onPieceDrop: (sourceSquare: string, targetSquare: string, piece: string) => boolean;
33
- onBackdropMouseDown: () => void;
34
- onClose: () => void;
35
- };
36
- export declare const useAnalysisBoardModel: ({ analysisContext, onClose, theme, boardWidth, engine, }: UseAnalysisBoardModelArgs) => AnalysisBoardModel;
@@ -1,10 +0,0 @@
1
- import { PuzzlePosition } from '../../position/Position';
2
- import { PuzzleResultStatus } from './analysisContext';
3
- import { PuzzleAnalysisContext } from './analysisContext';
4
- export declare const usePuzzleAnalysis: (position: PuzzlePosition | null, resultStatus: PuzzleResultStatus, puzzleNum: number) => {
5
- canOpen: boolean;
6
- isOpen: boolean;
7
- snapshot: PuzzleAnalysisContext | null;
8
- openAnalysis: () => void;
9
- closeAnalysis: () => void;
10
- };
@@ -1,16 +0,0 @@
1
- import React from 'react';
2
- import { AnalysisBoardCoreProps } from '../core/AnalysisBoardCore';
3
- import { AnalysisLayoutConfig } from '../core/analysisLayoutConfig';
4
- import { AnalysisContainerRenderProps, AnalysisMainRenderProps, AnalysisSidebarRenderProps, EngineEvaluationRenderProps } from '../core/renderProps';
5
- export interface AnalysisBoardProps extends Omit<AnalysisBoardCoreProps, 'renderContainer' | 'renderMain' | 'renderSidebar' | 'renderEngineEvaluation' | 'boardWidth'> {
6
- layout?: AnalysisLayoutConfig;
7
- renderContainer?: (props: AnalysisContainerRenderProps) => React.ReactNode;
8
- renderMain?: (props: AnalysisMainRenderProps) => React.ReactNode;
9
- renderSidebar?: (props: AnalysisSidebarRenderProps) => React.ReactNode;
10
- renderEngineEvaluation?: (props: EngineEvaluationRenderProps) => React.ReactNode;
11
- }
12
- /**
13
- * Full analysis UI with library defaults: modal shell, grid layout, sidebar, engine panel.
14
- * For host-owned UI only, use {@link AnalysisBoardCore} and pass all render props.
15
- */
16
- export declare const AnalysisBoard: ({ layout, renderContainer, renderMain, renderSidebar, renderEngineEvaluation, engine, ...modelArgs }: AnalysisBoardProps) => React.JSX.Element;
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- import { AnalysisLayoutConfig } from '../core/analysisLayoutConfig';
3
- import { AnalysisBoardModel } from '../core/useAnalysisBoardModel';
4
- export type AnalysisBoardLayoutProps = {
5
- layout: AnalysisLayoutConfig;
6
- model: AnalysisBoardModel;
7
- board: React.ReactNode;
8
- sidebar: React.ReactNode;
9
- };
10
- /**
11
- * Optional grid helper: board column + sidebar column.
12
- * Hosts may use this in `renderMain` or supply their own layout.
13
- */
14
- export declare const AnalysisBoardLayout: ({ layout, model, board, sidebar, }: AnalysisBoardLayoutProps) => React.JSX.Element;
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import { AnalysisContainerRenderProps } from '../core/renderProps';
3
- /** Default full-screen modal shell for analysis (library preset UI). */
4
- export declare const DefaultAnalysisContainer: ({ theme, onClose, onBackdropMouseDown, children, }: AnalysisContainerRenderProps) => React.JSX.Element;
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- import { AnalysisSidebarRenderProps } from '../core/renderProps';
3
- export declare const DefaultAnalysisSidebar: ({ historyRows, isHistoryRowSelected, onSelectHistoryRow, ply, maxPly, onSelectPly, theme, engineEvaluationPanel, }: AnalysisSidebarRenderProps) => React.JSX.Element;
@@ -1,3 +0,0 @@
1
- import { AnalysisLayoutConfig } from '../core/analysisLayoutConfig';
2
- /** Library default grid; hosts should pass their own {@link AnalysisLayoutConfig}. */
3
- export declare const DEFAULT_ANALYSIS_LAYOUT: AnalysisLayoutConfig;
@@ -1,7 +0,0 @@
1
- import { CSSProperties } from 'react';
2
- export type AnalysisModalStyles = {
3
- panel: CSSProperties;
4
- title: CSSProperties;
5
- closeButton: CSSProperties;
6
- };
7
- export declare const getAnalysisModalStyles: (theme: "light" | "dark") => AnalysisModalStyles;
@@ -1,37 +0,0 @@
1
- /**
2
- * Move-list colors for the analysis board sidebar.
3
- * Tweak values here when iterating on history row striping.
4
- */
5
- export declare const analysisSidebarColors: {
6
- /** Selected move row */
7
- readonly activeMove: {
8
- readonly light: "rgba(119, 177, 212, 1)";
9
- readonly dark: "rgba(90, 159, 190, 1)";
10
- };
11
- /** Start row */
12
- readonly start: {
13
- readonly light: "#e8e8e8";
14
- readonly dark: "#262626";
15
- };
16
- /** Alternating main-line rows (index 0 = darker, 1 = lighter). */
17
- readonly mainStripe: readonly [{
18
- readonly light: "#c9c9c9";
19
- readonly dark: "#1c1c1c";
20
- }, {
21
- readonly light: "#f2f2f2";
22
- readonly dark: "#383838";
23
- }];
24
- /** Alternating user-variation rows (index 0 = slightly tinted, 1 = lighter). */
25
- readonly variationStripe: readonly [{
26
- readonly light: "#eef5fb";
27
- readonly dark: "#2c3540";
28
- }, {
29
- readonly light: "#f7fbfe";
30
- readonly dark: "#343f4c";
31
- }];
32
- /** Text on variation rows (light backgrounds need dark type). */
33
- readonly variationText: {
34
- readonly light: "rgba(0, 0, 0, 0.87)";
35
- readonly dark: "rgba(0, 0, 0, 0.87)";
36
- };
37
- };
@@ -1,8 +0,0 @@
1
- import { AnalysisHistoryRow } from '../core/AnalysisPosition';
2
- export type SidebarRowBandCounters = {
3
- main: number;
4
- variation: number;
5
- };
6
- export declare const createSidebarRowBandCounters: () => SidebarRowBandCounters;
7
- /** Background for one analysis history row; mutates `bands` while iterating rows in order. */
8
- export declare const getSidebarRowBackground: (theme: "light" | "dark", row: AnalysisHistoryRow, bands: SidebarRowBandCounters) => string;
@@ -1,8 +0,0 @@
1
- export * from './analysisModalStyles';
2
- export * from './analysisSidebarColors';
3
- export * from './analysisSidebarRowStyle';
4
- export * from './analysisLayout';
5
- export * from './AnalysisBoard';
6
- export * from './AnalysisBoardLayout';
7
- export * from './DefaultAnalysisContainer';
8
- export * from './DefaultAnalysisSidebar';
@@ -1,39 +0,0 @@
1
- import type { ReactNode } from 'react';
2
- import { EngineEvaluation } from '../engine/types';
3
- import { AnalysisHistoryRow, SolutionMoveDisplay } from './AnalysisPosition';
4
- import { AnalysisBoardModel } from './useAnalysisBoardModel';
5
- export type AnalysisControls = {
6
- visible: boolean;
7
- openAnalysis: () => void;
8
- };
9
- export type EngineEvaluationRenderProps = {
10
- fen: string;
11
- evaluation: EngineEvaluation;
12
- theme: 'light' | 'dark';
13
- };
14
- export type AnalysisSidebarRenderProps = {
15
- /** Main-line moves (legacy; prefer historyRows). */
16
- moves: SolutionMoveDisplay[];
17
- historyRows: AnalysisHistoryRow[];
18
- isHistoryRowSelected: (row: AnalysisHistoryRow) => boolean;
19
- onSelectHistoryRow: (row: AnalysisHistoryRow) => void;
20
- ply: number;
21
- maxPly: number;
22
- onSelectPly: (ply: number) => void;
23
- theme: 'light' | 'dark';
24
- /** Host-rendered engine UI from `renderEngineEvaluation`. */
25
- engineEvaluationPanel: ReactNode | null;
26
- };
27
- export type AnalysisContainerRenderProps = {
28
- theme: 'light' | 'dark';
29
- onClose: () => void;
30
- children: ReactNode;
31
- /** Used by {@link DefaultAnalysisContainer} for overlay dismiss (ignored by most hosts). */
32
- onBackdropMouseDown?: () => void;
33
- };
34
- /** Place board + sidebar inside the analysis shell (host or default grid). */
35
- export type AnalysisMainRenderProps = {
36
- model: AnalysisBoardModel;
37
- board: ReactNode;
38
- sidebar: ReactNode;
39
- };
@@ -1,33 +0,0 @@
1
- import { AnalysisHistoryRow, SolutionMoveDisplay } from './AnalysisPosition';
2
- import { PuzzleAnalysisContext } from './analysisContext';
3
- import { AnalysisEngineOptions, EngineEvaluation } from '../engine';
4
- export type UseAnalysisBoardModelArgs = {
5
- analysisContext: PuzzleAnalysisContext;
6
- onClose: () => void;
7
- theme: 'light' | 'dark';
8
- engine?: AnalysisEngineOptions;
9
- };
10
- export type AnalysisBoardModel = {
11
- theme: 'light' | 'dark';
12
- analysisContext: PuzzleAnalysisContext;
13
- fen: string;
14
- ply: number;
15
- maxPly: number;
16
- historyRows: AnalysisHistoryRow[];
17
- solutionSans: SolutionMoveDisplay[];
18
- boardOrientation: 'white' | 'black';
19
- engineEvaluation: EngineEvaluation;
20
- engineEnabled: boolean;
21
- lastMove: {
22
- from: string;
23
- to: string;
24
- } | null;
25
- checkSquare: string | null;
26
- onSelectPly: (ply: number) => void;
27
- onSelectHistoryRow: (row: AnalysisHistoryRow) => void;
28
- isHistoryRowSelected: (row: AnalysisHistoryRow) => boolean;
29
- onPieceDrop: (sourceSquare: string, targetSquare: string, piece: string) => boolean;
30
- onBackdropMouseDown: () => void;
31
- onClose: () => void;
32
- };
33
- export declare const useAnalysisBoardModel: ({ analysisContext, onClose, theme, engine, }: UseAnalysisBoardModelArgs) => AnalysisBoardModel;
@@ -1,2 +0,0 @@
1
- export { HighlightChessboard } from 'react-chess-core';
2
- export type { HighlightChessboardProps } from 'react-chess-core';
@@ -1 +0,0 @@
1
- export { boardSquareHighlightColors } from 'react-chess-core';
@@ -1,2 +0,0 @@
1
- export { ChessboardThemeContext, ThemeProvider, getStylesForTheme, useChessboardTheme, useTheme, } from 'react-chess-core';
2
- export type { ThemeProviderProps } from 'react-chess-core';
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- import { type EngineEvaluation } from 'react-chess-core';
3
- export interface EngineEvaluationPanelProps {
4
- fen: string;
5
- evaluation: EngineEvaluation;
6
- theme: 'light' | 'dark';
7
- }
8
- export declare const EngineEvaluationPanel: ({ fen, evaluation, theme, }: EngineEvaluationPanelProps) => React.JSX.Element;
@@ -1 +0,0 @@
1
- export { StockfishBrowserEngine } from 'react-chess-core';
@@ -1 +0,0 @@
1
- export { formatEvaluation, formatPvPreview, normalizeEvalForWhite, uciPvToSan, } from 'react-chess-core';