react-chess-puzzle-kit 1.0.0
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 -0
- package/README.md +331 -0
- package/dist/features/analysis/AnalysisBoard.d.ts +18 -0
- package/dist/features/analysis/AnalysisBoardCore.d.ts +28 -0
- package/dist/features/analysis/AnalysisBoardLayout.d.ts +12 -0
- package/dist/features/analysis/AnalysisChessboardView.d.ts +5 -0
- package/dist/features/analysis/AnalysisPosition.d.ts +53 -0
- package/dist/features/analysis/AnalysisTrigger.d.ts +6 -0
- package/dist/features/analysis/DefaultAnalysisContainer.d.ts +3 -0
- package/dist/features/analysis/DefaultAnalysisSidebar.d.ts +2 -0
- package/dist/features/analysis/analysisBoardHighlightColors.d.ts +12 -0
- package/dist/features/analysis/analysisContext.d.ts +8 -0
- package/dist/features/analysis/analysisLayout.d.ts +5 -0
- package/dist/features/analysis/core/AnalysisBoardCore.d.ts +28 -0
- package/dist/features/analysis/core/AnalysisChessboardView.d.ts +5 -0
- package/dist/features/analysis/core/AnalysisErrorBoundary.d.ts +14 -0
- package/dist/features/analysis/core/AnalysisPosition.d.ts +54 -0
- package/dist/features/analysis/core/analysisContext.d.ts +13 -0
- package/dist/features/analysis/core/analysisLayout.d.ts +5 -0
- package/dist/features/analysis/core/analysisLayoutConfig.d.ts +6 -0
- package/dist/features/analysis/core/index.d.ts +9 -0
- package/dist/features/analysis/core/renderProps.d.ts +39 -0
- package/dist/features/analysis/core/useAnalysisBoardModel.d.ts +36 -0
- package/dist/features/analysis/core/usePuzzleAnalysis.d.ts +10 -0
- package/dist/features/analysis/defaults/AnalysisBoard.d.ts +16 -0
- package/dist/features/analysis/defaults/AnalysisBoardLayout.d.ts +14 -0
- package/dist/features/analysis/defaults/DefaultAnalysisContainer.d.ts +4 -0
- package/dist/features/analysis/defaults/DefaultAnalysisSidebar.d.ts +3 -0
- package/dist/features/analysis/defaults/analysisLayout.d.ts +3 -0
- package/dist/features/analysis/defaults/analysisModalStyles.d.ts +7 -0
- package/dist/features/analysis/defaults/analysisSidebarColors.d.ts +37 -0
- package/dist/features/analysis/defaults/analysisSidebarRowStyle.d.ts +8 -0
- package/dist/features/analysis/defaults/index.d.ts +8 -0
- package/dist/features/analysis/index.d.ts +3 -0
- package/dist/features/analysis/renderProps.d.ts +39 -0
- package/dist/features/analysis/useAnalysisBoardModel.d.ts +33 -0
- package/dist/features/analysis/usePuzzleAnalysis.d.ts +10 -0
- package/dist/features/board/BlankPuzzleBoard.d.ts +5 -0
- package/dist/features/board/HighlightChessboard.d.ts +2 -0
- package/dist/features/board/LineBoard.d.ts +15 -0
- package/dist/features/board/LineBoardWithControls.d.ts +50 -0
- package/dist/features/board/PuzzleBoard.d.ts +10 -0
- package/dist/features/board/PuzzleBoardWithControls.d.ts +51 -0
- package/dist/features/board/PuzzlePlaySurface.d.ts +25 -0
- package/dist/features/board/boardSquareHighlightColors.d.ts +1 -0
- package/dist/features/board/chessboardTheme.d.ts +2 -0
- package/dist/features/board/defaults/DefaultLineControls.d.ts +5 -0
- package/dist/features/board/defaults/DefaultPuzzleControls.d.ts +18 -0
- package/dist/features/board/defaults/index.d.ts +1 -0
- package/dist/features/board/puzzleBoardLayout.d.ts +8 -0
- package/dist/features/engine/EngineEvaluationPanel.d.ts +8 -0
- package/dist/features/engine/StockfishBrowserEngine.d.ts +1 -0
- package/dist/features/engine/formatEvaluation.d.ts +1 -0
- package/dist/features/engine/index.d.ts +1 -0
- package/dist/features/engine/isAnalyzableFen.d.ts +1 -0
- package/dist/features/engine/parseUciInfo.d.ts +1 -0
- package/dist/features/engine/stockfishUrls.d.ts +1 -0
- package/dist/features/engine/types.d.ts +1 -0
- package/dist/features/engine/useAnalysisEngine.d.ts +1 -0
- package/dist/features/position/Position.d.ts +67 -0
- package/dist/features/position/Position.test.d.ts +1 -0
- package/dist/features/position/Traversable.d.ts +4 -0
- package/dist/features/position/moveHistory.d.ts +7 -0
- package/dist/features/theme/ThemeContext.d.ts +26 -0
- package/dist/features/theme/ThemeProvider.d.ts +7 -0
- package/dist/features/theme/squareHighlightColors.d.ts +50 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.esm.js +861 -0
- package/dist/index.js +885 -0
- package/dist/stories/AnalysisBoard.stories.d.ts +9 -0
- package/dist/stories/HighlightChessboard.stories.d.ts +9 -0
- package/dist/stories/PuzzleBoard.stories.d.ts +6 -0
- package/dist/stories/PuzzleBoardWithControls.stories.d.ts +9 -0
- package/dist/stories/analysisFixtures.d.ts +4 -0
- package/dist/stories/regressions/PuzzleRegressions.stories.d.ts +7 -0
- package/dist/stories/regressions/StockfishAnalysisRegressions.stories.d.ts +7 -0
- package/dist/stories/regressions/fixtures.d.ts +18 -0
- package/dist/stories/regressions/regressionAnalysisContext.d.ts +5 -0
- package/dist/stories/storybookLayout.d.ts +4 -0
- package/dist/stories/withChessboardDnD.d.ts +4 -0
- package/dist/stories/withDefaultPuzzleControls.d.ts +7 -0
- package/dist/stories/withThemeProvider.d.ts +3 -0
- package/package.json +87 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { AnalysisBoard } from '../features/analysis/defaults/AnalysisBoard';
|
|
3
|
+
declare const meta: Meta<typeof AnalysisBoard>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof AnalysisBoard>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const LightTheme: Story;
|
|
8
|
+
/** Requires `npm run copy:stockfish` so WASM is served from `public/stockfish/`. */
|
|
9
|
+
export declare const WithStockfishEngine: Story;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { HighlightChessboard } from 'react-chess-core';
|
|
3
|
+
declare const meta: Meta<typeof HighlightChessboard>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof HighlightChessboard>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const KingInCheck: Story;
|
|
8
|
+
export declare const WithHint: Story;
|
|
9
|
+
export declare const IncorrectMove: Story;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { PuzzleBoardWithControls } from '../features/board/PuzzleBoardWithControls';
|
|
3
|
+
declare const meta: Meta<typeof PuzzleBoardWithControls>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof PuzzleBoardWithControls>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const MultiplePuzzles: Story;
|
|
8
|
+
/** Default controls + default analysis modal, sidebar, and engine panel. */
|
|
9
|
+
export declare const AllLibraryDefaults: Story;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const samplePuzzleFen = "r6k/pp2r2p/4Rp1Q/3p4/8/1N1P2R1/PqP2bPP/7K b - - 0 24";
|
|
2
|
+
export declare const samplePuzzleMoves: string[];
|
|
3
|
+
/** Completed puzzle snapshot for analysis stories. */
|
|
4
|
+
export declare const createSampleAnalysisContext: () => import("../features/analysis/core/analysisContext").PuzzleAnalysisContext;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { PuzzleBoardWithControls, PuzzleBoardWithControlsProps } from '../../features/board/PuzzleBoardWithControls';
|
|
3
|
+
declare const meta: Meta<typeof PuzzleBoardWithControls>;
|
|
4
|
+
export default meta;
|
|
5
|
+
export declare const WrongLegalCaptureShouldFail: import("@storybook/csf").StoryAnnotations<import("@storybook/react").ReactRenderer, PuzzleBoardWithControlsProps>;
|
|
6
|
+
export declare const DualCheckmateAccepted: import("@storybook/csf").StoryAnnotations<import("@storybook/react").ReactRenderer, PuzzleBoardWithControlsProps>;
|
|
7
|
+
export declare const WrongCaptureWhileInCheckShouldFail: import("@storybook/csf").StoryAnnotations<import("@storybook/react").ReactRenderer, PuzzleBoardWithControlsProps>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { AnalysisBoard } from '../../features/analysis/defaults/AnalysisBoard';
|
|
3
|
+
declare const meta: Meta<typeof AnalysisBoard>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof AnalysisBoard>;
|
|
6
|
+
/** Puzzle 66abad1bcb8d6163fd6e172a — rapid clicks through every main-line move. */
|
|
7
|
+
export declare const Move3Ke6DuringAnalysis: Story;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface PuzzleRegression {
|
|
2
|
+
/** Story name shown in Storybook. */
|
|
3
|
+
name: string;
|
|
4
|
+
/** The edge case and the expected behavior, for the story docs. */
|
|
5
|
+
description: string;
|
|
6
|
+
/** Source puzzle id (endchess) for traceability. */
|
|
7
|
+
sourceId: string;
|
|
8
|
+
/** Starting FEN as stored for the puzzle. */
|
|
9
|
+
fen: string;
|
|
10
|
+
/** Space-separated UCI solution moves (first move is played automatically). */
|
|
11
|
+
moves: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Real puzzles that previously exposed bugs, captured so the scenarios can be
|
|
15
|
+
* reproduced in Storybook. Add an entry here and a matching story export in
|
|
16
|
+
* `PuzzleRegressions.stories.tsx`.
|
|
17
|
+
*/
|
|
18
|
+
export declare const PUZZLE_REGRESSIONS: Record<string, PuzzleRegression>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { PuzzleRegression } from './fixtures';
|
|
2
|
+
/** Main-line sidebar labels (`Start`, `1. e4`, …) for a regression puzzle. */
|
|
3
|
+
export declare const getRegressionMainLineLabels: (regression: PuzzleRegression) => string[];
|
|
4
|
+
/** Completed puzzle snapshot for analysis regression stories. */
|
|
5
|
+
export declare const createRegressionAnalysisContext: (regression: PuzzleRegression) => import("../../features/analysis/core/analysisContext").PuzzleAnalysisContext;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Decorator } from '@storybook/react';
|
|
2
|
+
/**
|
|
3
|
+
* Supplies {@link defaultRenderControls} when a story omits `renderControls`.
|
|
4
|
+
* Use on `PuzzleBoardWithControls` stories for the library default button row.
|
|
5
|
+
*/
|
|
6
|
+
export declare const withDefaultPuzzleControls: Decorator;
|
|
7
|
+
export default withDefaultPuzzleControls;
|
package/package.json
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-chess-puzzle-kit",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "React chess puzzle kit: play, controls, analysis, and browser Stockfish for endchess.training and other apps",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Robert Blackwell",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"module": "dist/index.esm.js",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/reblackwell3/react-chess-puzzle-kit.git"
|
|
13
|
+
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/reblackwell3/react-chess-puzzle-kit/issues"
|
|
16
|
+
},
|
|
17
|
+
"homepage": "https://github.com/reblackwell3/react-chess-puzzle-kit#readme",
|
|
18
|
+
"keywords": [
|
|
19
|
+
"react",
|
|
20
|
+
"chess",
|
|
21
|
+
"chess.js",
|
|
22
|
+
"chess puzzle",
|
|
23
|
+
"puzzle",
|
|
24
|
+
"analysis",
|
|
25
|
+
"stockfish",
|
|
26
|
+
"react-chessboard",
|
|
27
|
+
"chessboard",
|
|
28
|
+
"drag and drop"
|
|
29
|
+
],
|
|
30
|
+
"files": [
|
|
31
|
+
"dist"
|
|
32
|
+
],
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "rollup -c",
|
|
35
|
+
"copy:stockfish": "node scripts/copy-stockfish.mjs",
|
|
36
|
+
"prepare": "rollup -c",
|
|
37
|
+
"prestorybook": "npm run copy:stockfish",
|
|
38
|
+
"test": "jest --config jest.config.cjs",
|
|
39
|
+
"storybook": "storybook dev -p 6006",
|
|
40
|
+
"build-storybook": "storybook build",
|
|
41
|
+
"serve-storybook": "serve storybook-static",
|
|
42
|
+
"prepublishOnly": "npm run build"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"chess.js": "^1.0.0-beta.8",
|
|
46
|
+
"rollup": "^4.22.2",
|
|
47
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
48
|
+
"rollup-plugin-typescript2": "^0.36.0",
|
|
49
|
+
"typescript": "^5.6.2"
|
|
50
|
+
},
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"chess.js": "^1.0.0-beta.8",
|
|
53
|
+
"react": "^18.3.1",
|
|
54
|
+
"react-chess-core": "^0.1.0",
|
|
55
|
+
"react-chessboard": "^4.7.1"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@chromatic-com/storybook": "^1.9.0",
|
|
59
|
+
"@rollup/plugin-commonjs": "^26.0.1",
|
|
60
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
61
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
62
|
+
"@storybook/addon-essentials": "^8.2.9",
|
|
63
|
+
"@storybook/addon-interactions": "^8.2.9",
|
|
64
|
+
"@storybook/addon-links": "^8.2.9",
|
|
65
|
+
"@storybook/addon-onboarding": "^8.2.9",
|
|
66
|
+
"@storybook/blocks": "^8.2.9",
|
|
67
|
+
"@storybook/preset-typescript": "^3.0.0",
|
|
68
|
+
"@storybook/react": "^8.2.9",
|
|
69
|
+
"@storybook/react-vite": "^8.2.9",
|
|
70
|
+
"@storybook/test": "^8.2.9",
|
|
71
|
+
"@types/jest": "^29.5.12",
|
|
72
|
+
"@types/react": "^18.3.12",
|
|
73
|
+
"@types/react-dom": "^18.3.1",
|
|
74
|
+
"chess.js": "^1.0.0-beta.8",
|
|
75
|
+
"jest": "^29.7.0",
|
|
76
|
+
"react": "^18.3.1",
|
|
77
|
+
"react-chess-core": "^0.1.0",
|
|
78
|
+
"react-chessboard": "^4.7.1",
|
|
79
|
+
"storybook": "^8.2.9",
|
|
80
|
+
"ts-jest": "^29.2.4",
|
|
81
|
+
"vite": "^5.4.11",
|
|
82
|
+
"vite-tsconfig-paths": "^5.0.1"
|
|
83
|
+
},
|
|
84
|
+
"optionalDependencies": {
|
|
85
|
+
"stockfish": "^18.0.7"
|
|
86
|
+
}
|
|
87
|
+
}
|