@mirasen/chessboard 0.1.1 → 1.0.0-rc.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/CHANGELOG.md +10 -0
- package/README.md +224 -47
- package/dist/animation/planner.d.ts +11 -6
- package/dist/animation/planner.js +164 -45
- package/dist/animation/render/fade.d.ts +2 -2
- package/dist/animation/render/fade.js +3 -3
- package/dist/animation/render/move.d.ts +3 -3
- package/dist/animation/render/move.js +5 -5
- package/dist/animation/render/plan.d.ts +3 -3
- package/dist/animation/render/static.d.ts +2 -2
- package/dist/animation/render/static.js +3 -3
- package/dist/animation/types.d.ts +14 -15
- package/dist/animation/types.js +1 -6
- package/dist/extensions/factory/main.js +23 -2
- package/dist/extensions/factory/runtime.d.ts +2 -1
- package/dist/extensions/factory/runtime.js +48 -4
- package/dist/extensions/first-party/active-target/factory.js +5 -5
- package/dist/extensions/first-party/auto-promote/factory.d.ts +2 -0
- package/dist/extensions/first-party/auto-promote/factory.js +51 -0
- package/dist/extensions/first-party/auto-promote/types.d.ts +14 -0
- package/dist/extensions/first-party/auto-promote/types.js +2 -0
- package/dist/extensions/first-party/board-events/factory.js +1 -16
- package/dist/extensions/first-party/board-events/types.d.ts +1 -2
- package/dist/extensions/first-party/last-move/factory.js +6 -6
- package/dist/extensions/first-party/legal-moves/factory.js +1 -1
- package/dist/extensions/first-party/main-renderer/animation/render.js +1 -2
- package/dist/extensions/first-party/main-renderer/animation/update.js +9 -23
- package/dist/extensions/first-party/main-renderer/board/render.js +3 -3
- package/dist/extensions/first-party/main-renderer/board/update.js +5 -3
- package/dist/extensions/first-party/main-renderer/coordinates/render.js +4 -4
- package/dist/extensions/first-party/main-renderer/drag/render.js +1 -1
- package/dist/extensions/first-party/main-renderer/normalize.d.ts +2 -3
- package/dist/extensions/first-party/main-renderer/normalize.js +1 -1
- package/dist/extensions/first-party/main-renderer/pieces/render.js +5 -5
- package/dist/extensions/first-party/main-renderer/pieces/suppress.js +7 -2
- package/dist/extensions/first-party/main-renderer/types/extension.d.ts +1 -1
- package/dist/extensions/first-party/main-renderer/types/extension.js +1 -1
- package/dist/extensions/first-party/promotion/factory.d.ts +3 -0
- package/dist/extensions/first-party/promotion/factory.js +219 -0
- package/dist/extensions/first-party/promotion/normalize.d.ts +3 -0
- package/dist/extensions/first-party/promotion/normalize.js +37 -0
- package/dist/extensions/first-party/promotion/types/input.d.ts +10 -0
- package/dist/extensions/first-party/promotion/types/internal.d.ts +12 -0
- package/dist/extensions/first-party/promotion/types/internal.js +22 -0
- package/dist/extensions/first-party/promotion/types/main.d.ts +24 -0
- package/dist/extensions/first-party/promotion/types/main.js +2 -0
- package/dist/extensions/first-party/selected-square/factory.js +3 -3
- package/dist/extensions/index.d.ts +1 -1
- package/dist/extensions/types/basic/events.d.ts +8 -31
- package/dist/extensions/types/basic/events.js +9 -5
- package/dist/extensions/types/basic/interaction.d.ts +21 -0
- package/dist/extensions/types/basic/transient-visuals.d.ts +2 -1
- package/dist/extensions/types/context/events.d.ts +5 -0
- package/dist/extensions/types/context/events.js +1 -0
- package/dist/extensions/types/context/ui-move.d.ts +3 -15
- package/dist/extensions/types/extension.d.ts +10 -8
- package/dist/extensions/types/main.d.ts +11 -6
- package/dist/extensions/types/surface/commands.d.ts +9 -0
- package/dist/extensions/types/surface/events.d.ts +2 -3
- package/dist/extensions/types/wrapper.d.ts +23 -22
- package/dist/extensions/types/wrapper.js +34 -6
- package/dist/extensions/update.d.ts +2 -2
- package/dist/extensions/update.js +1 -1
- package/dist/layout/factory.js +3 -3
- package/dist/layout/geometry/factory.d.ts +2 -11
- package/dist/layout/geometry/factory.js +16 -17
- package/dist/layout/geometry/helpers.d.ts +5 -0
- package/dist/layout/geometry/helpers.js +33 -0
- package/dist/layout/geometry/types.d.ts +13 -12
- package/dist/layout/helpers.d.ts +3 -4
- package/dist/layout/helpers.js +5 -5
- package/dist/layout/reducers.js +9 -8
- package/dist/layout/types.d.ts +5 -5
- package/dist/render/mount.js +2 -2
- package/dist/render/rendering/state.js +7 -7
- package/dist/runtime/factory/events.d.ts +3 -0
- package/dist/runtime/factory/events.js +18 -0
- package/dist/runtime/factory/helpers.js +12 -12
- package/dist/runtime/factory/input.js +17 -10
- package/dist/runtime/factory/main.js +44 -4
- package/dist/runtime/input/adapter/event.d.ts +3 -0
- package/dist/runtime/input/adapter/event.js +19 -0
- package/dist/runtime/input/adapter/factory.js +19 -38
- package/dist/runtime/input/adapter/helpers.d.ts +3 -5
- package/dist/runtime/input/adapter/helpers.js +60 -12
- package/dist/runtime/input/adapter/pointer.d.ts +6 -10
- package/dist/runtime/input/adapter/pointer.js +37 -70
- package/dist/runtime/input/adapter/types.d.ts +6 -3
- package/dist/runtime/input/adapter/types.js +6 -1
- package/dist/runtime/input/controller/factory.js +12 -11
- package/dist/runtime/input/controller/pointer.d.ts +5 -6
- package/dist/runtime/input/controller/pointer.js +36 -35
- package/dist/runtime/input/controller/transient-visuals.d.ts +2 -2
- package/dist/runtime/input/controller/transient-visuals.js +12 -5
- package/dist/runtime/input/controller/types.d.ts +5 -4
- package/dist/runtime/lifecycle.js +6 -6
- package/dist/runtime/mutation/interaction.js +1 -5
- package/dist/runtime/mutation/types.d.ts +10 -8
- package/dist/runtime/types/main.d.ts +2 -0
- package/dist/state/change/{factory.d.ts → factory/main.d.ts} +1 -1
- package/dist/state/change/{factory.js → factory/main.js} +8 -5
- package/dist/state/change/factory/ui-move.d.ts +4 -0
- package/dist/{runtime → state/change}/factory/ui-move.js +9 -9
- package/dist/state/change/helpers.d.ts +4 -2
- package/dist/state/change/helpers.js +11 -1
- package/dist/state/change/mutation.d.ts +1 -1
- package/dist/state/change/reducers.d.ts +3 -3
- package/dist/state/change/reducers.js +4 -4
- package/dist/state/change/types/main.d.ts +18 -0
- package/dist/state/change/types/main.js +1 -0
- package/dist/state/change/types/ui-move.d.ts +25 -0
- package/dist/state/change/types/ui-move.js +1 -0
- package/dist/state/factory.js +1 -1
- package/dist/state/interaction/factory.js +4 -2
- package/dist/state/interaction/helpers.d.ts +2 -0
- package/dist/state/interaction/helpers.js +3 -0
- package/dist/state/interaction/types/internal.d.ts +9 -1
- package/dist/state/types.d.ts +1 -1
- package/dist/wrapper/factory.js +2 -26
- package/package.json +9 -5
- package/dist/runtime/factory/ui-move.d.ts +0 -4
- package/dist/runtime/types/ui-move.d.ts +0 -9
- package/dist/state/change/types.d.ts +0 -17
- /package/dist/{runtime/types/ui-move.js → extensions/first-party/promotion/types/input.js} +0 -0
- /package/dist/{state/change/types.js → extensions/types/basic/interaction.js} +0 -0
package/dist/wrapper/factory.js
CHANGED
|
@@ -1,36 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createBoardEvents } from '../extensions/first-party/board-events/factory.js';
|
|
3
|
-
import { createLastMove } from '../extensions/first-party/last-move/factory.js';
|
|
4
|
-
import { createLegalMoves } from '../extensions/first-party/legal-moves/factory.js';
|
|
5
|
-
import { createMainRenderer } from '../extensions/first-party/main-renderer/factory.js';
|
|
6
|
-
import { createSelectedSquare } from '../extensions/first-party/selected-square/factory.js';
|
|
7
|
-
import { DefaultBuiltinChessboardExtensions } from '../extensions/types/wrapper.js';
|
|
1
|
+
import { builtInExtensionFactoryMap, DefaultBuiltinChessboardExtensions } from '../extensions/types/wrapper.js';
|
|
8
2
|
import { createRuntime } from '../runtime/factory/main.js';
|
|
9
|
-
function createBuiltInExtensionDefinition(id) {
|
|
10
|
-
switch (id) {
|
|
11
|
-
case 'mainRenderer':
|
|
12
|
-
return createMainRenderer();
|
|
13
|
-
case 'events':
|
|
14
|
-
return createBoardEvents();
|
|
15
|
-
case 'selectedSquare':
|
|
16
|
-
return createSelectedSquare();
|
|
17
|
-
case 'activeTarget':
|
|
18
|
-
return createActiveTarget();
|
|
19
|
-
case 'legalMoves':
|
|
20
|
-
return createLegalMoves();
|
|
21
|
-
case 'lastMove':
|
|
22
|
-
return createLastMove();
|
|
23
|
-
default:
|
|
24
|
-
throw new Error(`Unknown built-in extension id: ${id}`);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
3
|
export function createBoard(options) {
|
|
28
4
|
// prepare init options for runtime
|
|
29
5
|
const extensionsInput = options.extensions ?? DefaultBuiltinChessboardExtensions;
|
|
30
6
|
const extensions = extensionsInput.map((ext) => {
|
|
31
7
|
if (typeof ext === 'string') {
|
|
32
8
|
// built-in extension, convert to definition
|
|
33
|
-
return
|
|
9
|
+
return builtInExtensionFactoryMap[ext]();
|
|
34
10
|
}
|
|
35
11
|
// assume it's already a definition
|
|
36
12
|
return ext;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mirasen/chessboard",
|
|
3
|
-
"description": "
|
|
4
|
-
"version": "0.
|
|
3
|
+
"description": "Framework-agnostic TypeScript chessboard platform with real chess interaction built in.",
|
|
4
|
+
"version": "1.0.0-rc.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Mirasen",
|
|
@@ -10,10 +10,14 @@
|
|
|
10
10
|
"keywords": [
|
|
11
11
|
"mirasen",
|
|
12
12
|
"chessboard",
|
|
13
|
-
"chess-ui",
|
|
14
13
|
"chess",
|
|
14
|
+
"chess-ui",
|
|
15
|
+
"chessboard-ui",
|
|
16
|
+
"typescript",
|
|
17
|
+
"framework-agnostic",
|
|
15
18
|
"svg",
|
|
16
|
-
"
|
|
19
|
+
"extensions",
|
|
20
|
+
"chessboard-platform"
|
|
17
21
|
],
|
|
18
22
|
"homepage": "https://mirasen.io/chessboard",
|
|
19
23
|
"repository": {
|
|
@@ -52,7 +56,7 @@
|
|
|
52
56
|
"test-backup": "npm run check:test && vitest run --run",
|
|
53
57
|
"coverage": "echo 'No tests for now...'",
|
|
54
58
|
"coverage-backup": "vitest run --coverage",
|
|
55
|
-
"changeset:version": "changeset version && npm install && git add --all",
|
|
59
|
+
"changeset:version": "changeset version && npm install && npm run format && git add --all",
|
|
56
60
|
"changeset:publish": "changeset publish"
|
|
57
61
|
},
|
|
58
62
|
"files": [
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { ExtensionUIMoveRequestContext } from '../../extensions/types/context/ui-move.js';
|
|
2
|
-
import { Square } from '../../state/board/types/internal.js';
|
|
3
|
-
import { MoveDestinationSnapshot } from '../../state/interaction/types/internal.js';
|
|
4
|
-
export declare function createUIMoveRequestContext(sourceSquare: Square, destination: MoveDestinationSnapshot): ExtensionUIMoveRequestContext;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ExtensionUIMoveRequestStatus } from '../../extensions/types/context/ui-move.js';
|
|
2
|
-
import { MoveRequest, Square } from '../../state/board/types/internal.js';
|
|
3
|
-
import { MoveDestinationSnapshot } from '../../state/interaction/types/internal.js';
|
|
4
|
-
export interface UIMoveRequestContextInternal {
|
|
5
|
-
readonly sourceSquare: Square;
|
|
6
|
-
readonly destination: MoveDestinationSnapshot;
|
|
7
|
-
status: ExtensionUIMoveRequestStatus;
|
|
8
|
-
resolvedMoveRequest: MoveRequest | null;
|
|
9
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { ReadonlyDeep } from 'type-fest';
|
|
2
|
-
import { ExtensionUIMoveRequestContext, ExtensionUIMoveRequestContextSnapshot } from '../../extensions/types/context/ui-move.js';
|
|
3
|
-
import type { MoveSnapshot } from '../board/types/internal.js';
|
|
4
|
-
import type { ChangeStateMutationSession } from './mutation.js';
|
|
5
|
-
export interface ChangeStateInternal {
|
|
6
|
-
lastMove: MoveSnapshot | null;
|
|
7
|
-
deferredUIMoveRequestContext: ExtensionUIMoveRequestContext | null;
|
|
8
|
-
}
|
|
9
|
-
export type ChangeStateSnapshot = ReadonlyDeep<Omit<ChangeStateInternal, 'deferredUIMoveRequestContext'>> & {
|
|
10
|
-
deferredUIMoveRequestContext: ExtensionUIMoveRequestContextSnapshot | null;
|
|
11
|
-
};
|
|
12
|
-
export interface ChangeState {
|
|
13
|
-
readonly lastMove: MoveSnapshot | null;
|
|
14
|
-
setLastMove(move: MoveSnapshot | null, mutationSession: ChangeStateMutationSession): boolean;
|
|
15
|
-
setDeferredUIMoveRequestContext(context: ExtensionUIMoveRequestContext, mutationSession: ChangeStateMutationSession): boolean;
|
|
16
|
-
getSnapshot(): ChangeStateSnapshot;
|
|
17
|
-
}
|
|
File without changes
|
|
File without changes
|