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.
Files changed (83) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +331 -0
  3. package/dist/features/analysis/AnalysisBoard.d.ts +18 -0
  4. package/dist/features/analysis/AnalysisBoardCore.d.ts +28 -0
  5. package/dist/features/analysis/AnalysisBoardLayout.d.ts +12 -0
  6. package/dist/features/analysis/AnalysisChessboardView.d.ts +5 -0
  7. package/dist/features/analysis/AnalysisPosition.d.ts +53 -0
  8. package/dist/features/analysis/AnalysisTrigger.d.ts +6 -0
  9. package/dist/features/analysis/DefaultAnalysisContainer.d.ts +3 -0
  10. package/dist/features/analysis/DefaultAnalysisSidebar.d.ts +2 -0
  11. package/dist/features/analysis/analysisBoardHighlightColors.d.ts +12 -0
  12. package/dist/features/analysis/analysisContext.d.ts +8 -0
  13. package/dist/features/analysis/analysisLayout.d.ts +5 -0
  14. package/dist/features/analysis/core/AnalysisBoardCore.d.ts +28 -0
  15. package/dist/features/analysis/core/AnalysisChessboardView.d.ts +5 -0
  16. package/dist/features/analysis/core/AnalysisErrorBoundary.d.ts +14 -0
  17. package/dist/features/analysis/core/AnalysisPosition.d.ts +54 -0
  18. package/dist/features/analysis/core/analysisContext.d.ts +13 -0
  19. package/dist/features/analysis/core/analysisLayout.d.ts +5 -0
  20. package/dist/features/analysis/core/analysisLayoutConfig.d.ts +6 -0
  21. package/dist/features/analysis/core/index.d.ts +9 -0
  22. package/dist/features/analysis/core/renderProps.d.ts +39 -0
  23. package/dist/features/analysis/core/useAnalysisBoardModel.d.ts +36 -0
  24. package/dist/features/analysis/core/usePuzzleAnalysis.d.ts +10 -0
  25. package/dist/features/analysis/defaults/AnalysisBoard.d.ts +16 -0
  26. package/dist/features/analysis/defaults/AnalysisBoardLayout.d.ts +14 -0
  27. package/dist/features/analysis/defaults/DefaultAnalysisContainer.d.ts +4 -0
  28. package/dist/features/analysis/defaults/DefaultAnalysisSidebar.d.ts +3 -0
  29. package/dist/features/analysis/defaults/analysisLayout.d.ts +3 -0
  30. package/dist/features/analysis/defaults/analysisModalStyles.d.ts +7 -0
  31. package/dist/features/analysis/defaults/analysisSidebarColors.d.ts +37 -0
  32. package/dist/features/analysis/defaults/analysisSidebarRowStyle.d.ts +8 -0
  33. package/dist/features/analysis/defaults/index.d.ts +8 -0
  34. package/dist/features/analysis/index.d.ts +3 -0
  35. package/dist/features/analysis/renderProps.d.ts +39 -0
  36. package/dist/features/analysis/useAnalysisBoardModel.d.ts +33 -0
  37. package/dist/features/analysis/usePuzzleAnalysis.d.ts +10 -0
  38. package/dist/features/board/BlankPuzzleBoard.d.ts +5 -0
  39. package/dist/features/board/HighlightChessboard.d.ts +2 -0
  40. package/dist/features/board/LineBoard.d.ts +15 -0
  41. package/dist/features/board/LineBoardWithControls.d.ts +50 -0
  42. package/dist/features/board/PuzzleBoard.d.ts +10 -0
  43. package/dist/features/board/PuzzleBoardWithControls.d.ts +51 -0
  44. package/dist/features/board/PuzzlePlaySurface.d.ts +25 -0
  45. package/dist/features/board/boardSquareHighlightColors.d.ts +1 -0
  46. package/dist/features/board/chessboardTheme.d.ts +2 -0
  47. package/dist/features/board/defaults/DefaultLineControls.d.ts +5 -0
  48. package/dist/features/board/defaults/DefaultPuzzleControls.d.ts +18 -0
  49. package/dist/features/board/defaults/index.d.ts +1 -0
  50. package/dist/features/board/puzzleBoardLayout.d.ts +8 -0
  51. package/dist/features/engine/EngineEvaluationPanel.d.ts +8 -0
  52. package/dist/features/engine/StockfishBrowserEngine.d.ts +1 -0
  53. package/dist/features/engine/formatEvaluation.d.ts +1 -0
  54. package/dist/features/engine/index.d.ts +1 -0
  55. package/dist/features/engine/isAnalyzableFen.d.ts +1 -0
  56. package/dist/features/engine/parseUciInfo.d.ts +1 -0
  57. package/dist/features/engine/stockfishUrls.d.ts +1 -0
  58. package/dist/features/engine/types.d.ts +1 -0
  59. package/dist/features/engine/useAnalysisEngine.d.ts +1 -0
  60. package/dist/features/position/Position.d.ts +67 -0
  61. package/dist/features/position/Position.test.d.ts +1 -0
  62. package/dist/features/position/Traversable.d.ts +4 -0
  63. package/dist/features/position/moveHistory.d.ts +7 -0
  64. package/dist/features/theme/ThemeContext.d.ts +26 -0
  65. package/dist/features/theme/ThemeProvider.d.ts +7 -0
  66. package/dist/features/theme/squareHighlightColors.d.ts +50 -0
  67. package/dist/index.d.ts +26 -0
  68. package/dist/index.esm.js +861 -0
  69. package/dist/index.js +885 -0
  70. package/dist/stories/AnalysisBoard.stories.d.ts +9 -0
  71. package/dist/stories/HighlightChessboard.stories.d.ts +9 -0
  72. package/dist/stories/PuzzleBoard.stories.d.ts +6 -0
  73. package/dist/stories/PuzzleBoardWithControls.stories.d.ts +9 -0
  74. package/dist/stories/analysisFixtures.d.ts +4 -0
  75. package/dist/stories/regressions/PuzzleRegressions.stories.d.ts +7 -0
  76. package/dist/stories/regressions/StockfishAnalysisRegressions.stories.d.ts +7 -0
  77. package/dist/stories/regressions/fixtures.d.ts +18 -0
  78. package/dist/stories/regressions/regressionAnalysisContext.d.ts +5 -0
  79. package/dist/stories/storybookLayout.d.ts +4 -0
  80. package/dist/stories/withChessboardDnD.d.ts +4 -0
  81. package/dist/stories/withDefaultPuzzleControls.d.ts +7 -0
  82. package/dist/stories/withThemeProvider.d.ts +3 -0
  83. package/package.json +87 -0
@@ -0,0 +1,26 @@
1
+ import { CSSProperties } from 'react';
2
+ interface ThemeContextType {
3
+ customDarkSquareStyle: {
4
+ backgroundColor: string;
5
+ };
6
+ customLightSquareStyle: {
7
+ backgroundColor: string;
8
+ };
9
+ }
10
+ export declare const ThemeContext: import("react").Context<ThemeContextType | undefined>;
11
+ export declare const useTheme: () => ThemeContextType;
12
+ export declare const getStylesForTheme: (theme: "light" | "dark") => {
13
+ customDarkSquareStyle: {
14
+ backgroundColor: string;
15
+ };
16
+ customLightSquareStyle: {
17
+ backgroundColor: string;
18
+ };
19
+ };
20
+ export type AnalysisModalStyles = {
21
+ panel: CSSProperties;
22
+ title: CSSProperties;
23
+ closeButton: CSSProperties;
24
+ };
25
+ export declare const getAnalysisModalStyles: (theme: "light" | "dark") => AnalysisModalStyles;
26
+ export {};
@@ -0,0 +1,7 @@
1
+ import { ReactNode } from 'react';
2
+ interface ThemeProviderProps {
3
+ children?: ReactNode;
4
+ theme: 'light' | 'dark';
5
+ }
6
+ export declare const ThemeProvider: ({ children, theme }: ThemeProviderProps) => import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Square overlay colors for puzzle + analysis boards.
3
+ * Tweak values here when iterating on highlights.
4
+ */
5
+ export declare const squareHighlightColors: {
6
+ /** King in check */
7
+ readonly check: "#e53935";
8
+ /** Hint square (puzzle) */
9
+ readonly hint: "rgba(119, 177, 212, 0.75)";
10
+ /** Wrong guess square (puzzle) */
11
+ readonly incorrect: "rgba(255, 127, 127, 0.8)";
12
+ /** Last move from/to (analysis replay) */
13
+ readonly lastMove: {
14
+ readonly light: "rgba(253, 216, 53, 0.55)";
15
+ readonly dark: "rgba(144, 202, 249, 0.5)";
16
+ };
17
+ /** DefaultAnalysisSidebar selected move chip */
18
+ readonly sidebarActiveMove: {
19
+ readonly light: "rgba(119, 177, 212, 1)";
20
+ readonly dark: "rgba(90, 159, 190, 1)";
21
+ };
22
+ readonly sidebarMove: {
23
+ readonly light: "rgba(240, 240, 240, 1)";
24
+ readonly dark: "rgba(45, 45, 45, 1)";
25
+ };
26
+ /** Analysis sidebar: Start row */
27
+ readonly sidebarStart: {
28
+ readonly light: "#e8e8e8";
29
+ readonly dark: "#262626";
30
+ };
31
+ /** Alternating main-line move rows (index 0 = darker, 1 = lighter). */
32
+ readonly sidebarMainStripe: readonly [{
33
+ readonly light: "#c9c9c9";
34
+ readonly dark: "#1c1c1c";
35
+ }, {
36
+ readonly light: "#f2f2f2";
37
+ readonly dark: "#383838";
38
+ }];
39
+ /** Alternating user-variation rows (index 0 = slightly tinted, 1 = lighter). */
40
+ readonly sidebarVariationStripe: readonly [{
41
+ readonly light: "#eef5fb";
42
+ readonly dark: "#2c3540";
43
+ }, {
44
+ readonly light: "#f7fbfe";
45
+ readonly dark: "#343f4c";
46
+ }];
47
+ };
48
+ export declare const getLastMoveSquareStyles: (from: string, to: string, theme: "light" | "dark") => Record<string, {
49
+ backgroundColor: string;
50
+ }>;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Puzzle-kit public API — puzzle play and post-puzzle analysis glue.
3
+ * Board theme, analysis UI, and Stockfish: import from `react-chess-core`.
4
+ */
5
+ export * from './features/analysis';
6
+ export * from './features/board/PuzzleBoard';
7
+ export * from './features/board/PuzzleBoardWithControls';
8
+ export * from './features/board/LineBoard';
9
+ export * from './features/board/LineBoardWithControls';
10
+ export { DefaultPuzzleControls, defaultRenderControls, } from './features/board/defaults/DefaultPuzzleControls';
11
+ export { DefaultLineControls, defaultRenderLineControls, } from './features/board/defaults/DefaultLineControls';
12
+ export type { PuzzleControlState, PuzzleControlsRenderProps, } from './features/board/defaults/DefaultPuzzleControls';
13
+ export { DEFAULT_PUZZLE_BOARD_WIDTH } from './features/board/puzzleBoardLayout';
14
+ export * from './features/position/moveHistory';
15
+ export * from './features/position/Position';
16
+ export * from './features/position/Traversable';
17
+ /** @deprecated Import {@link boardSquareHighlightColors} and {@link analysisBoardHighlightColors} from `react-chess-core`. */
18
+ export declare const squareHighlightColors: {
19
+ readonly lastMove: {
20
+ readonly light: "rgba(253, 216, 53, 0.55)";
21
+ readonly dark: "rgba(144, 202, 249, 0.5)";
22
+ };
23
+ readonly check: "rgba(255, 127, 127, 0.8)";
24
+ readonly hint: "rgba(119, 177, 212, 0.75)";
25
+ readonly incorrect: "rgba(140, 38, 38, 0.82)";
26
+ };