react-chess-explorer 0.0.1 → 0.0.3
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 +63 -63
- package/dist/features/explorer/components/DefaultBoardNav.d.ts +2 -7
- package/dist/features/explorer/components/PositionGamesPanel.d.ts +5 -10
- package/dist/features/explorer/core/PositionReferenceExplorerCore.d.ts +1 -1
- package/dist/features/explorer/core/renderProps.d.ts +24 -15
- package/dist/features/explorer/defaults/DefaultReferencePanel.d.ts +2 -1
- package/dist/features/explorer/defaults/DefaultVariationsStrip.d.ts +1 -1
- package/dist/features/explorer/explorerSessionCache.d.ts +15 -0
- package/dist/features/explorer/hooks/useExplorerPrefetch.d.ts +11 -0
- package/dist/features/explorer/hooks/usePositionHistory.d.ts +12 -1
- package/dist/features/explorer/hooks/usePositionReferenceData.d.ts +13 -14
- package/dist/features/explorer/hooks/useVariationLines.d.ts +1 -5
- package/dist/features/explorer/index.d.ts +5 -3
- package/dist/features/explorer/mocks.d.ts +2 -2
- package/dist/features/explorer/positionUtils.d.ts +2 -0
- package/dist/features/explorer/seedExplorerStartSession.d.ts +3 -0
- package/dist/features/explorer/types.d.ts +18 -11
- package/dist/features/explorer/variationLines.d.ts +0 -1
- package/dist/index.esm.js +691 -291
- package/dist/index.js +702 -289
- package/dist/stories/PositionReferenceExplorer.stories.d.ts +10 -0
- package/dist/stories/fixtures/nc6MockApi.d.ts +13 -0
- package/dist/stories/fixtures/nc6SampleGames.d.ts +36 -0
- package/package.json +59 -45
- package/dist/features/explorer/components/EloRangeFilter.d.ts +0 -9
- package/dist/features/explorer/components/LineHeader.d.ts +0 -4
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { PositionReferenceExplorer } from "../features/explorer/PositionReferenceExplorer";
|
|
3
|
+
declare const meta: Meta<typeof PositionReferenceExplorer>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof PositionReferenceExplorer>;
|
|
6
|
+
/** 100 sample games after 1.e4 e5 2.Nf3 Nc6 — Open Game / Italian–Spanish tabiya. */
|
|
7
|
+
export declare const Nc6100Games: Story;
|
|
8
|
+
export declare const LightTheme: Story;
|
|
9
|
+
export declare const StartingPosition: Story;
|
|
10
|
+
export declare const WithReplayFetch: Story;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FetchPositionGamesParams, FetchPositionParams, FetchPositionVariationsParams, PositionGamesApiDto, PositionVariationsApiDto } from "../../features/explorer/types";
|
|
2
|
+
import { nc6SampleGames, NC6_TABIYA_FEN } from "./nc6SampleGames";
|
|
3
|
+
export declare function nc6FetchPosition(params: FetchPositionParams): Promise<import("../..").PositionApiDto | null>;
|
|
4
|
+
export declare function nc6FetchPositionGames(params: FetchPositionGamesParams): Promise<PositionGamesApiDto>;
|
|
5
|
+
export declare function nc6FetchPositionVariations(params: FetchPositionVariationsParams): Promise<PositionVariationsApiDto | null>;
|
|
6
|
+
export declare function nc6FetchGame(gameId: string): Promise<(import("../..").ExplorerGameReplayApiDto & {
|
|
7
|
+
avgElo: number;
|
|
8
|
+
occurrences: Map<string, {
|
|
9
|
+
nextSan: string;
|
|
10
|
+
nextUci: string;
|
|
11
|
+
}>;
|
|
12
|
+
}) | null>;
|
|
13
|
+
export { NC6_TABIYA_FEN, nc6SampleGames };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ExplorerGameReplayApiDto, PositionApiDto, PositionGameRowApiDto, PositionMoveApiDto } from "../../features/explorer/types";
|
|
2
|
+
export declare const NC6_OPENING_SANS: readonly ["e4", "e5", "Nf3", "Nc6"];
|
|
3
|
+
export declare const NC6_GAME_COUNT = 100;
|
|
4
|
+
export declare const NC6_GAME_ID_PREFIX = "nc6-sb-";
|
|
5
|
+
type MoveBucket = {
|
|
6
|
+
san: string;
|
|
7
|
+
uci: string;
|
|
8
|
+
games: number;
|
|
9
|
+
whiteWins: number;
|
|
10
|
+
draws: number;
|
|
11
|
+
blackWins: number;
|
|
12
|
+
eloSum: number;
|
|
13
|
+
};
|
|
14
|
+
type PositionBucket = {
|
|
15
|
+
fen: string;
|
|
16
|
+
totalGames: number;
|
|
17
|
+
moves: Map<string, MoveBucket>;
|
|
18
|
+
gameRows: PositionGameRowApiDto[];
|
|
19
|
+
};
|
|
20
|
+
type BuiltGame = ExplorerGameReplayApiDto & {
|
|
21
|
+
avgElo: number;
|
|
22
|
+
occurrences: Map<string, {
|
|
23
|
+
nextSan: string;
|
|
24
|
+
nextUci: string;
|
|
25
|
+
}>;
|
|
26
|
+
};
|
|
27
|
+
export declare const NC6_TABIYA_FEN: string;
|
|
28
|
+
export declare const nc6SampleGames: BuiltGame[];
|
|
29
|
+
export declare const nc6PositionBuckets: Map<string, PositionBucket>;
|
|
30
|
+
export declare function nc6PositionForFen(fen: string): PositionApiDto | null;
|
|
31
|
+
export declare function nc6GamesForPosition(fen: string, options: {
|
|
32
|
+
uci?: string;
|
|
33
|
+
sources?: ("lichess" | "twic")[];
|
|
34
|
+
}): PositionGameRowApiDto[];
|
|
35
|
+
export declare function nc6ScorePercentForMove(move: PositionMoveApiDto): number | null;
|
|
36
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,45 +1,59 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "react-chess-explorer",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "React components for browsing and replaying chess games (depends on react-chess-core only)",
|
|
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-explorer.git"
|
|
13
|
-
},
|
|
14
|
-
"files": [
|
|
15
|
-
"dist"
|
|
16
|
-
],
|
|
17
|
-
"scripts": {
|
|
18
|
-
"build": "rollup -c",
|
|
19
|
-
"prepublishOnly": "npm run build"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
"react
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"@
|
|
36
|
-
"@
|
|
37
|
-
"@
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "react-chess-explorer",
|
|
3
|
+
"version": "0.0.3",
|
|
4
|
+
"description": "React components for browsing and replaying chess games (depends on react-chess-core only)",
|
|
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-explorer.git"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "rollup -c",
|
|
19
|
+
"prepublishOnly": "npm run build",
|
|
20
|
+
"storybook": "storybook dev -p 6008",
|
|
21
|
+
"build-storybook": "storybook build"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"rollup": "^4.22.2",
|
|
25
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
26
|
+
"typescript": "^5.6.2"
|
|
27
|
+
},
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"chess.js": "^1.0.0-beta.8",
|
|
30
|
+
"react": "^18.3.1",
|
|
31
|
+
"react-chess-core": "^0.1.1",
|
|
32
|
+
"react-chessboard": "^4.7.1"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@chromatic-com/storybook": "^1.9.0",
|
|
36
|
+
"@rollup/plugin-commonjs": "^26.0.1",
|
|
37
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
38
|
+
"@rollup/plugin-typescript": "^12.3.0",
|
|
39
|
+
"@storybook/addon-essentials": "^8.2.9",
|
|
40
|
+
"@storybook/addon-interactions": "^8.2.9",
|
|
41
|
+
"@storybook/addon-links": "^8.2.9",
|
|
42
|
+
"@storybook/addon-onboarding": "^8.2.9",
|
|
43
|
+
"@storybook/blocks": "^8.2.9",
|
|
44
|
+
"@storybook/preset-typescript": "^3.0.0",
|
|
45
|
+
"@storybook/react": "^8.2.9",
|
|
46
|
+
"@storybook/react-vite": "^8.2.9",
|
|
47
|
+
"@storybook/test": "^8.2.9",
|
|
48
|
+
"@types/react": "^18.3.12",
|
|
49
|
+
"@types/react-dom": "^18.3.1",
|
|
50
|
+
"@vitejs/plugin-react": "^4.3.1",
|
|
51
|
+
"chess.js": "^1.0.0-beta.8",
|
|
52
|
+
"react": "^18.3.1",
|
|
53
|
+
"react-chess-core": "^0.1.1",
|
|
54
|
+
"react-chessboard": "^4.7.1",
|
|
55
|
+
"react-dom": "^18.3.1",
|
|
56
|
+
"storybook": "^8.2.9",
|
|
57
|
+
"tslib": "^2.8.1"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export type EloRangeFilterProps = {
|
|
2
|
-
minElo: number;
|
|
3
|
-
maxElo: number;
|
|
4
|
-
defaultMinElo: number;
|
|
5
|
-
defaultMaxElo: number;
|
|
6
|
-
onMinEloChange: (value: number) => void;
|
|
7
|
-
onMaxEloChange: (value: number) => void;
|
|
8
|
-
};
|
|
9
|
-
export declare const EloRangeFilter: ({ minElo, maxElo, defaultMinElo, defaultMaxElo, onMinEloChange, onMaxEloChange, }: EloRangeFilterProps) => import("react").JSX.Element;
|