@dxos/plugin-chess 0.8.4-main.72ec0f3 → 0.8.4-main.7996785055
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/dist/lib/browser/ChessArticle-JTNMZK6P.mjs +59 -0
- package/dist/lib/browser/ChessArticle-JTNMZK6P.mjs.map +7 -0
- package/dist/lib/browser/ChessCard-HVD4LK2C.mjs +21 -0
- package/dist/lib/browser/ChessCard-HVD4LK2C.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-SH2HLKBU.mjs +20 -0
- package/dist/lib/browser/blueprint-definition-SH2HLKBU.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +14 -0
- package/dist/lib/browser/chunk-2TJN26DN.mjs +67 -0
- package/dist/lib/browser/chunk-2TJN26DN.mjs.map +7 -0
- package/dist/lib/browser/chunk-GPFHUDFY.mjs +110 -0
- package/dist/lib/browser/chunk-GPFHUDFY.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-JKW2ZYHP.mjs +28 -0
- package/dist/lib/browser/chunk-JKW2ZYHP.mjs.map +7 -0
- package/dist/lib/browser/chunk-OT2LMRRV.mjs +42 -0
- package/dist/lib/browser/chunk-OT2LMRRV.mjs.map +7 -0
- package/dist/lib/browser/chunk-OUFKVTXQ.mjs +278 -0
- package/dist/lib/browser/chunk-OUFKVTXQ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-DUO4WTAM.mjs → chunk-RGHZ5CDO.mjs} +2 -9
- package/dist/lib/browser/chunk-RGHZ5CDO.mjs.map +7 -0
- package/dist/lib/browser/chunk-WYUTI2K4.mjs +1 -0
- package/dist/lib/browser/chunk-WYUTI2K4.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +38 -0
- package/dist/lib/browser/cli/index.mjs.map +7 -0
- package/dist/lib/browser/create-UJ656WLM.mjs +24 -0
- package/dist/lib/browser/create-UJ656WLM.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +70 -78
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/move-QCJSXFHW.mjs +36 -0
- package/dist/lib/browser/move-QCJSXFHW.mjs.map +7 -0
- package/dist/lib/browser/operation-handler-NKF7GNU2.mjs +17 -0
- package/dist/lib/browser/operation-handler-NKF7GNU2.mjs.map +7 -0
- package/dist/lib/browser/operations/index.mjs +19 -0
- package/dist/lib/browser/operations/index.mjs.map +7 -0
- package/dist/lib/browser/play-YEOTE6KO.mjs +45 -0
- package/dist/lib/browser/play-YEOTE6KO.mjs.map +7 -0
- package/dist/lib/browser/print-LUCG4CIR.mjs +30 -0
- package/dist/lib/browser/print-LUCG4CIR.mjs.map +7 -0
- package/dist/lib/browser/react-surface-2VBZOUX2.mjs +50 -0
- package/dist/lib/browser/react-surface-2VBZOUX2.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +3 -5
- package/dist/lib/node-esm/ChessArticle-677BPBLL.mjs +60 -0
- package/dist/lib/node-esm/ChessArticle-677BPBLL.mjs.map +7 -0
- package/dist/lib/node-esm/ChessCard-4WOJ225W.mjs +22 -0
- package/dist/lib/node-esm/ChessCard-4WOJ225W.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-5UIG6VEF.mjs +21 -0
- package/dist/lib/node-esm/blueprint-definition-5UIG6VEF.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +15 -0
- package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-7XDEO6IJ.mjs +2 -0
- package/dist/lib/node-esm/chunk-7XDEO6IJ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-D72ZBXX6.mjs +29 -0
- package/dist/lib/node-esm/chunk-D72ZBXX6.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-KNOOJFIR.mjs → chunk-FYPVCMP4.mjs} +2 -8
- package/dist/lib/node-esm/chunk-FYPVCMP4.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSVQ3553.mjs +43 -0
- package/dist/lib/node-esm/chunk-HSVQ3553.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-LPVPGURE.mjs +111 -0
- package/dist/lib/node-esm/chunk-LPVPGURE.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-MP3A3AGA.mjs → chunk-OIRJVY2R.mjs} +21 -38
- package/dist/lib/node-esm/chunk-OIRJVY2R.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-S22QSSUJ.mjs +279 -0
- package/dist/lib/node-esm/chunk-S22QSSUJ.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +39 -0
- package/dist/lib/node-esm/cli/index.mjs.map +7 -0
- package/dist/lib/node-esm/create-KINGWZOM.mjs +25 -0
- package/dist/lib/node-esm/create-KINGWZOM.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +70 -78
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/move-JDR3KQ5G.mjs +37 -0
- package/dist/lib/node-esm/move-JDR3KQ5G.mjs.map +7 -0
- package/dist/lib/node-esm/operation-handler-U7XD2D3B.mjs +18 -0
- package/dist/lib/node-esm/operation-handler-U7XD2D3B.mjs.map +7 -0
- package/dist/lib/node-esm/operations/index.mjs +20 -0
- package/dist/lib/node-esm/operations/index.mjs.map +7 -0
- package/dist/lib/node-esm/play-KIWAE5LA.mjs +46 -0
- package/dist/lib/node-esm/play-KIWAE5LA.mjs.map +7 -0
- package/dist/lib/node-esm/print-QHFZDMWC.mjs +31 -0
- package/dist/lib/node-esm/print-QHFZDMWC.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-2HD5V4SH.mjs +51 -0
- package/dist/lib/node-esm/react-surface-2HD5V4SH.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +3 -5
- package/dist/types/src/ChessPlugin.d.ts +2 -1
- package/dist/types/src/ChessPlugin.d.ts.map +1 -1
- package/dist/types/src/blueprints/chess-blueprint.d.ts +4 -0
- package/dist/types/src/blueprints/chess-blueprint.d.ts.map +1 -0
- package/dist/types/src/blueprints/index.d.ts +3 -0
- package/dist/types/src/blueprints/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts +12 -0
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/artifact-definition/index.d.ts +3 -0
- package/dist/types/src/capabilities/artifact-definition/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +6 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +3 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +2 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-handler/index.d.ts +4 -0
- package/dist/types/src/capabilities/operation-handler/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/cli/index.d.ts +2 -0
- package/dist/types/src/cli/index.d.ts.map +1 -0
- package/dist/types/src/cli/plugin.d.ts +3 -0
- package/dist/types/src/cli/plugin.d.ts.map +1 -0
- package/dist/types/src/components/{Chessboard.d.ts → Chessboard/Chessboard.d.ts} +4 -8
- package/dist/types/src/components/Chessboard/Chessboard.d.ts.map +1 -0
- package/dist/types/src/components/{Info.d.ts → Chessboard/Info.d.ts} +1 -1
- package/dist/types/src/components/Chessboard/Info.d.ts.map +1 -0
- package/dist/types/src/components/Chessboard/index.d.ts +2 -0
- package/dist/types/src/components/Chessboard/index.d.ts.map +1 -0
- package/dist/types/src/components/Chessboard/types.d.ts +8 -0
- package/dist/types/src/components/Chessboard/types.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +0 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/ChessArticle/ChessArticle.d.ts +6 -0
- package/dist/types/src/containers/ChessArticle/ChessArticle.d.ts.map +1 -0
- package/dist/types/src/{components/Chessboard.stories.d.ts → containers/ChessArticle/ChessArticle.stories.d.ts} +9 -6
- package/dist/types/src/containers/ChessArticle/ChessArticle.stories.d.ts.map +1 -0
- package/dist/types/src/containers/ChessArticle/index.d.ts +3 -0
- package/dist/types/src/containers/ChessArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/ChessCard/ChessCard.d.ts +6 -0
- package/dist/types/src/containers/ChessCard/ChessCard.d.ts.map +1 -0
- package/dist/types/src/{components/Card.stories.d.ts → containers/ChessCard/ChessCard.stories.d.ts} +2 -9
- package/dist/types/src/containers/ChessCard/ChessCard.stories.d.ts.map +1 -0
- package/dist/types/src/containers/ChessCard/index.d.ts +3 -0
- package/dist/types/src/containers/ChessCard/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +4 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +2 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/create.d.ts +5 -0
- package/dist/types/src/operations/create.d.ts.map +1 -0
- package/dist/types/src/operations/definitions.d.ts +51 -0
- package/dist/types/src/operations/definitions.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +4 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/operations/move.d.ts +5 -0
- package/dist/types/src/operations/move.d.ts.map +1 -0
- package/dist/types/src/operations/play.d.ts +5 -0
- package/dist/types/src/operations/play.d.ts.map +1 -0
- package/dist/types/src/operations/print.d.ts +5 -0
- package/dist/types/src/operations/print.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +2 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Chess.d.ts +18 -18
- package/dist/types/src/types/Chess.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +0 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +65 -43
- package/src/ChessPlugin.tsx +39 -52
- package/src/blueprints/chess-blueprint.ts +35 -0
- package/src/blueprints/index.ts +6 -0
- package/src/capabilities/artifact-definition/artifact-definition.ts +135 -0
- package/src/capabilities/artifact-definition/index.ts +7 -0
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +17 -0
- package/src/capabilities/blueprint-definition/index.ts +7 -0
- package/src/capabilities/index.ts +2 -6
- package/src/capabilities/operation-handler/index.ts +9 -0
- package/src/capabilities/operation-handler/operation-handler.ts +14 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +33 -0
- package/src/cli/index.ts +5 -0
- package/src/cli/plugin.ts +37 -0
- package/src/components/{Chessboard.tsx → Chessboard/Chessboard.tsx} +32 -29
- package/src/components/{Info.tsx → Chessboard/Info.tsx} +35 -18
- package/src/components/Chessboard/index.ts +5 -0
- package/src/components/Chessboard/types.ts +18 -0
- package/src/components/index.ts +1 -5
- package/src/containers/ChessArticle/ChessArticle.stories.tsx +53 -0
- package/src/containers/ChessArticle/ChessArticle.tsx +73 -0
- package/src/containers/ChessArticle/index.ts +7 -0
- package/src/containers/ChessCard/ChessCard.stories.tsx +42 -0
- package/src/containers/ChessCard/ChessCard.tsx +22 -0
- package/src/containers/ChessCard/index.ts +7 -0
- package/src/containers/index.ts +8 -0
- package/src/index.ts +2 -2
- package/src/meta.ts +3 -3
- package/src/operations/create.ts +22 -0
- package/src/operations/definitions.ts +109 -0
- package/src/operations/index.ts +16 -0
- package/src/operations/move.ts +37 -0
- package/src/operations/play.ts +46 -0
- package/src/operations/print.ts +28 -0
- package/src/translations.ts +2 -0
- package/src/types/Chess.ts +14 -12
- package/src/types/index.ts +0 -1
- package/dist/lib/browser/ChessboardContainer-5YXEM4VR.mjs +0 -96
- package/dist/lib/browser/ChessboardContainer-5YXEM4VR.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-FD4TL5EE.mjs +0 -11
- package/dist/lib/browser/chunk-5DOZV3PW.mjs +0 -294
- package/dist/lib/browser/chunk-5DOZV3PW.mjs.map +0 -7
- package/dist/lib/browser/chunk-DUO4WTAM.mjs.map +0 -7
- package/dist/lib/browser/chunk-FBLAVAMY.mjs +0 -84
- package/dist/lib/browser/chunk-FBLAVAMY.mjs.map +0 -7
- package/dist/lib/browser/chunk-Q5TZCIH7.mjs +0 -8
- package/dist/lib/browser/chunk-Q5TZCIH7.mjs.map +0 -7
- package/dist/lib/browser/chunk-TIIGNOGK.mjs +0 -169
- package/dist/lib/browser/chunk-TIIGNOGK.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-GXZN2EBT.mjs +0 -25
- package/dist/lib/browser/intent-resolver-GXZN2EBT.mjs.map +0 -7
- package/dist/lib/browser/react-surface-KTTAUHAA.mjs +0 -38
- package/dist/lib/browser/react-surface-KTTAUHAA.mjs.map +0 -7
- package/dist/lib/node-esm/ChessboardContainer-7OQ6TOKB.mjs +0 -97
- package/dist/lib/node-esm/ChessboardContainer-7OQ6TOKB.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-O7ZM3HUF.mjs +0 -12
- package/dist/lib/node-esm/chunk-F4C2HVZL.mjs +0 -295
- package/dist/lib/node-esm/chunk-F4C2HVZL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-KNOOJFIR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MP3A3AGA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RTCAAOLF.mjs +0 -170
- package/dist/lib/node-esm/chunk-RTCAAOLF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VVXTAVIS.mjs +0 -10
- package/dist/lib/node-esm/chunk-VVXTAVIS.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-HK5L6P6Z.mjs +0 -26
- package/dist/lib/node-esm/intent-resolver-HK5L6P6Z.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-VO4PSY6O.mjs +0 -39
- package/dist/lib/node-esm/react-surface-VO4PSY6O.mjs.map +0 -7
- package/dist/types/src/capabilities/artifact-definition.d.ts +0 -11
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +0 -6
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/components/Card.stories.d.ts.map +0 -1
- package/dist/types/src/components/Chessboard.d.ts.map +0 -1
- package/dist/types/src/components/Chessboard.stories.d.ts.map +0 -1
- package/dist/types/src/components/ChessboardArticle.d.ts +0 -7
- package/dist/types/src/components/ChessboardArticle.d.ts.map +0 -1
- package/dist/types/src/components/ChessboardContainer.d.ts +0 -9
- package/dist/types/src/components/ChessboardContainer.d.ts.map +0 -1
- package/dist/types/src/components/Info.d.ts.map +0 -1
- package/dist/types/src/functions/create.d.ts +0 -14
- package/dist/types/src/functions/create.d.ts.map +0 -1
- package/dist/types/src/functions/index.d.ts +0 -4
- package/dist/types/src/functions/index.d.ts.map +0 -1
- package/dist/types/src/functions/move.d.ts +0 -8
- package/dist/types/src/functions/move.d.ts.map +0 -1
- package/dist/types/src/functions/play.d.ts +0 -9
- package/dist/types/src/functions/play.d.ts.map +0 -1
- package/dist/types/src/types/ChessAction.d.ts +0 -24
- package/dist/types/src/types/ChessAction.d.ts.map +0 -1
- package/src/capabilities/artifact-definition.ts +0 -129
- package/src/capabilities/blueprint-definition.ts +0 -36
- package/src/capabilities/intent-resolver.ts +0 -22
- package/src/capabilities/react-surface.tsx +0 -23
- package/src/components/Card.stories.tsx +0 -66
- package/src/components/Chessboard.stories.tsx +0 -49
- package/src/components/ChessboardArticle.tsx +0 -68
- package/src/components/ChessboardContainer.tsx +0 -44
- package/src/functions/create.ts +0 -32
- package/src/functions/index.ts +0 -7
- package/src/functions/move.ts +0 -45
- package/src/functions/play.ts +0 -55
- package/src/types/ChessAction.ts +0 -19
- /package/dist/lib/browser/{blueprint-definition-FD4TL5EE.mjs.map → blueprints/index.mjs.map} +0 -0
- /package/dist/lib/{node-esm/blueprint-definition-O7ZM3HUF.mjs.map → browser/chunk-J5LGTIGS.mjs.map} +0 -0
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Capabilities, contributes } from '@dxos/app-framework';
|
|
6
|
-
import { Blueprint, Template } from '@dxos/blueprints';
|
|
7
|
-
import { type FunctionDefinition } from '@dxos/functions';
|
|
8
|
-
import { trim } from '@dxos/util';
|
|
9
|
-
|
|
10
|
-
import { create, move, play } from '../functions';
|
|
11
|
-
|
|
12
|
-
const functions: FunctionDefinition[] = [create, move, play];
|
|
13
|
-
|
|
14
|
-
export const CHESS_BLUEPRINT_KEY = 'dxos.org/blueprint/chess';
|
|
15
|
-
|
|
16
|
-
export default () => {
|
|
17
|
-
return [
|
|
18
|
-
contributes(Capabilities.Functions, functions),
|
|
19
|
-
contributes(
|
|
20
|
-
Capabilities.BlueprintDefinition,
|
|
21
|
-
Blueprint.make({
|
|
22
|
-
key: CHESS_BLUEPRINT_KEY,
|
|
23
|
-
name: 'Chess',
|
|
24
|
-
tools: Blueprint.toolDefinitions({ functions }),
|
|
25
|
-
instructions: Template.make({
|
|
26
|
-
source: trim`
|
|
27
|
-
You are an expert chess player.
|
|
28
|
-
To analyze a game you can access the "pgn" property by loading the context object that represents the current game.
|
|
29
|
-
You could suggest a good next move or offer to play a move.
|
|
30
|
-
Don't actually make a move unless you are asked to.
|
|
31
|
-
`,
|
|
32
|
-
}),
|
|
33
|
-
}),
|
|
34
|
-
),
|
|
35
|
-
];
|
|
36
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Capabilities, contributes, createResolver } from '@dxos/app-framework';
|
|
6
|
-
|
|
7
|
-
import { Chess, ChessAction } from '../types';
|
|
8
|
-
|
|
9
|
-
export default () =>
|
|
10
|
-
contributes(
|
|
11
|
-
Capabilities.IntentResolver,
|
|
12
|
-
createResolver({
|
|
13
|
-
intent: ChessAction.Create,
|
|
14
|
-
resolve: ({ name, pgn }) => {
|
|
15
|
-
return {
|
|
16
|
-
data: {
|
|
17
|
-
object: Chess.makeGame({ name, pgn }),
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
},
|
|
21
|
-
}),
|
|
22
|
-
);
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
import { Capabilities, contributes, createSurface } from '@dxos/app-framework';
|
|
8
|
-
import { Obj } from '@dxos/echo';
|
|
9
|
-
|
|
10
|
-
import { ChessboardContainer } from '../components';
|
|
11
|
-
import { meta } from '../meta';
|
|
12
|
-
import { Chess } from '../types';
|
|
13
|
-
|
|
14
|
-
export default () =>
|
|
15
|
-
contributes(Capabilities.ReactSurface, [
|
|
16
|
-
createSurface({
|
|
17
|
-
id: meta.id,
|
|
18
|
-
role: ['article', 'section', 'card--intrinsic', 'card--extrinsic', 'card--popover', 'card--transclusion'],
|
|
19
|
-
// TODO(burdon): Could this be standardized so that we don't require a subject property.
|
|
20
|
-
filter: (data): data is { subject: Chess.Game } => Obj.instanceOf(Chess.Game, data.subject),
|
|
21
|
-
component: ({ data, role }) => <ChessboardContainer game={data.subject} role={role} />,
|
|
22
|
-
}),
|
|
23
|
-
]);
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
-
import React from 'react';
|
|
7
|
-
|
|
8
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
9
|
-
import { CardContainer } from '@dxos/react-ui-stack/testing';
|
|
10
|
-
|
|
11
|
-
import { meta as pluginMeta } from '../meta';
|
|
12
|
-
import { Chess } from '../types';
|
|
13
|
-
|
|
14
|
-
import { Chessboard } from './Chessboard';
|
|
15
|
-
|
|
16
|
-
type DefaultStoryProps = {
|
|
17
|
-
role: 'card--popover' | 'card--intrinsic' | 'card--extrinsic';
|
|
18
|
-
game: Chess.Game;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const meta = {
|
|
22
|
-
title: 'plugins/plugin-chess/Card',
|
|
23
|
-
render: ({ role, game }) => (
|
|
24
|
-
<CardContainer icon={pluginMeta.icon} role={role}>
|
|
25
|
-
<Chessboard.Root game={game}>
|
|
26
|
-
<Chessboard.Content role={role}>
|
|
27
|
-
<Chessboard.Board />
|
|
28
|
-
</Chessboard.Content>
|
|
29
|
-
</Chessboard.Root>
|
|
30
|
-
</CardContainer>
|
|
31
|
-
),
|
|
32
|
-
decorators: [withTheme],
|
|
33
|
-
parameters: {
|
|
34
|
-
layout: 'centered',
|
|
35
|
-
},
|
|
36
|
-
tags: ['cards'],
|
|
37
|
-
} satisfies Meta<DefaultStoryProps>;
|
|
38
|
-
|
|
39
|
-
export default meta;
|
|
40
|
-
|
|
41
|
-
const game = Chess.makeGame({
|
|
42
|
-
pgn: '1. e4 e5 2. Nf3 Nc6 3. Bc4 Bc5 4. c3 Nf6 5. d4 exd4 6. cxd4 Bb4+ 7. Nc3 d5 8. exd5 Nxd5 9. O-O Be6 10. Qb3 Na5 11. Qa4+ c6 12. Bxd5 Bxc3 13. Bxe6 fxe6 14. d5 Qg5 15. dxe6 Qg4 16. e7 Kf7 17. bxc3 Kg6 *',
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
type Story = StoryObj<typeof meta>;
|
|
46
|
-
|
|
47
|
-
export const Popover: Story = {
|
|
48
|
-
args: {
|
|
49
|
-
role: 'card--popover',
|
|
50
|
-
game: game,
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export const Intrinsic: Story = {
|
|
55
|
-
args: {
|
|
56
|
-
role: 'card--intrinsic',
|
|
57
|
-
game: game,
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export const Extrinsic: Story = {
|
|
62
|
-
args: {
|
|
63
|
-
role: 'card--extrinsic',
|
|
64
|
-
game: game,
|
|
65
|
-
},
|
|
66
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
-
|
|
7
|
-
import { withClientProvider } from '@dxos/react-client/testing';
|
|
8
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
9
|
-
|
|
10
|
-
import { translations } from '../translations';
|
|
11
|
-
import { Chess } from '../types';
|
|
12
|
-
|
|
13
|
-
import { ChessboardArticle } from './ChessboardArticle';
|
|
14
|
-
|
|
15
|
-
const meta = {
|
|
16
|
-
title: 'plugins/plugin-chess/Chessboard',
|
|
17
|
-
component: ChessboardArticle,
|
|
18
|
-
decorators: [withTheme, withClientProvider({ createIdentity: true })],
|
|
19
|
-
parameters: {
|
|
20
|
-
layout: 'fullscreen',
|
|
21
|
-
translations,
|
|
22
|
-
},
|
|
23
|
-
} satisfies Meta<typeof ChessboardArticle>;
|
|
24
|
-
|
|
25
|
-
export default meta;
|
|
26
|
-
|
|
27
|
-
type Story = StoryObj<typeof meta>;
|
|
28
|
-
|
|
29
|
-
export const Default: Story = {
|
|
30
|
-
args: {
|
|
31
|
-
game: Chess.makeGame(),
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export const EndGame: Story = {
|
|
36
|
-
args: {
|
|
37
|
-
game: Chess.makeGame({
|
|
38
|
-
pgn: '1. e4 e5 2. Nf3 Nc6 3. Bc4 Bc5 4. c3 Nf6 5. d4 exd4 6. cxd4 Bb4+ 7. Nc3 d5 8. exd5 Nxd5 9. O-O Be6 10. Qb3 Na5 11. Qa4+ c6 12. Bxd5 Bxc3 13. Bxe6 fxe6 *',
|
|
39
|
-
}),
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export const Promption: Story = {
|
|
44
|
-
args: {
|
|
45
|
-
game: Chess.makeGame({
|
|
46
|
-
pgn: '1. e4 e5 2. Nf3 Nc6 3. Bc4 Bc5 4. c3 Nf6 5. d4 exd4 6. cxd4 Bb4+ 7. Nc3 d5 8. exd5 Nxd5 9. O-O Be6 10. Qb3 Na5 11. Qa4+ c6 12. Bxd5 Bxc3 13. Bxe6 fxe6 14. d5 Qg5 15. dxe6 Qg4 16. e7 Kf7 17. bxc3 Kg6 *',
|
|
47
|
-
}),
|
|
48
|
-
},
|
|
49
|
-
};
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { useCallback, useRef, useState } from 'react';
|
|
6
|
-
|
|
7
|
-
import { Toolbar, useTranslation } from '@dxos/react-ui';
|
|
8
|
-
import { type Player } from '@dxos/react-ui-gameboard';
|
|
9
|
-
import { StackItem } from '@dxos/react-ui-stack';
|
|
10
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
11
|
-
|
|
12
|
-
import { meta } from '../meta';
|
|
13
|
-
import { type Chess } from '../types';
|
|
14
|
-
|
|
15
|
-
import { Chessboard, type ChessboardController, type ChessboardInfoProps } from './Chessboard';
|
|
16
|
-
|
|
17
|
-
export const ChessboardArticle = ({ game, role }: { game: Chess.Game; role?: string }) => {
|
|
18
|
-
const { t } = useTranslation(meta.id);
|
|
19
|
-
const [orientation, setOrientation] = useState<Player>('white');
|
|
20
|
-
const [open, setOpen] = useState(true);
|
|
21
|
-
const controller = useRef<ChessboardController>(null);
|
|
22
|
-
|
|
23
|
-
// TODO(burdon): Keyboard handler.
|
|
24
|
-
const handleSelect = useCallback<NonNullable<ChessboardInfoProps['onSelect']>>((index) => {
|
|
25
|
-
controller.current?.setMoveNumber(index);
|
|
26
|
-
}, []);
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<StackItem.Content toolbar classNames='@container'>
|
|
30
|
-
<Chessboard.Root game={game} ref={controller}>
|
|
31
|
-
<Toolbar.Root>
|
|
32
|
-
<Toolbar.IconButton
|
|
33
|
-
icon='ph--info--regular'
|
|
34
|
-
iconOnly
|
|
35
|
-
label={t('toggle info button')}
|
|
36
|
-
disabled={open}
|
|
37
|
-
classNames={mx('invisible @3xl:visible')}
|
|
38
|
-
onClick={() => setOpen((open) => !open)}
|
|
39
|
-
/>
|
|
40
|
-
</Toolbar.Root>
|
|
41
|
-
<div
|
|
42
|
-
className={mx(
|
|
43
|
-
'grid bs-full is-full gap-2',
|
|
44
|
-
open && '@3xl:grid-cols-[1fr_320px]',
|
|
45
|
-
role === 'section' && 'aspect-square',
|
|
46
|
-
role === 'section' && open && '@3xl:aspect-auto',
|
|
47
|
-
)}
|
|
48
|
-
>
|
|
49
|
-
<Chessboard.Content>
|
|
50
|
-
<Chessboard.Board classNames='m-4 rounded-sm overflow-hidden' orientation={orientation} />
|
|
51
|
-
</Chessboard.Content>
|
|
52
|
-
{open && (
|
|
53
|
-
<div className='hidden @3xl:flex flex-col p-8 justify-center items-center overflow-hidden'>
|
|
54
|
-
<Chessboard.Info
|
|
55
|
-
orientation={orientation}
|
|
56
|
-
min={8}
|
|
57
|
-
max={8}
|
|
58
|
-
onOrientationChange={setOrientation}
|
|
59
|
-
onClose={() => setOpen(false)}
|
|
60
|
-
onSelect={handleSelect}
|
|
61
|
-
/>
|
|
62
|
-
</div>
|
|
63
|
-
)}
|
|
64
|
-
</div>
|
|
65
|
-
</Chessboard.Root>
|
|
66
|
-
</StackItem.Content>
|
|
67
|
-
);
|
|
68
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
import { getSpace } from '@dxos/react-client/echo';
|
|
8
|
-
|
|
9
|
-
import { type Chess } from '../types';
|
|
10
|
-
|
|
11
|
-
import { Chessboard } from './Chessboard';
|
|
12
|
-
import { ChessboardArticle } from './ChessboardArticle';
|
|
13
|
-
|
|
14
|
-
export type ChessboardContainerProps = {
|
|
15
|
-
game: Chess.Game;
|
|
16
|
-
role?: string;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export const ChessboardContainer = ({ game, role }: ChessboardContainerProps) => {
|
|
20
|
-
const space = getSpace(game);
|
|
21
|
-
if (!space) {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
switch (role) {
|
|
26
|
-
case 'card--popover':
|
|
27
|
-
case 'card--intrinsic':
|
|
28
|
-
case 'card--extrinsic': {
|
|
29
|
-
return (
|
|
30
|
-
<Chessboard.Root game={game}>
|
|
31
|
-
<Chessboard.Content role={role}>
|
|
32
|
-
<Chessboard.Board />
|
|
33
|
-
</Chessboard.Content>
|
|
34
|
-
</Chessboard.Root>
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
default: {
|
|
39
|
-
return <ChessboardArticle game={game} role={role} />;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export default ChessboardContainer;
|
package/src/functions/create.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Effect from 'effect/Effect';
|
|
6
|
-
import * as Schema from 'effect/Schema';
|
|
7
|
-
|
|
8
|
-
import { DatabaseService, defineFunction } from '@dxos/functions';
|
|
9
|
-
|
|
10
|
-
import { Chess } from '../types';
|
|
11
|
-
|
|
12
|
-
export default defineFunction({
|
|
13
|
-
key: 'dxos.org/function/chess/create',
|
|
14
|
-
name: 'Create Chess',
|
|
15
|
-
description: 'Creates a new chess game.',
|
|
16
|
-
inputSchema: Schema.Struct({
|
|
17
|
-
pgn: Schema.optional(
|
|
18
|
-
Schema.String.annotations({
|
|
19
|
-
description: 'Portable Game Notation.',
|
|
20
|
-
}),
|
|
21
|
-
),
|
|
22
|
-
fen: Schema.optional(
|
|
23
|
-
Schema.String.annotations({
|
|
24
|
-
description: 'Forsyth-Edwards Notation.',
|
|
25
|
-
}),
|
|
26
|
-
),
|
|
27
|
-
}),
|
|
28
|
-
outputSchema: Chess.Game,
|
|
29
|
-
handler: Effect.fn(function* ({ data: { pgn, fen } }) {
|
|
30
|
-
return yield* DatabaseService.add(Chess.makeGame({ pgn, fen }));
|
|
31
|
-
}),
|
|
32
|
-
});
|
package/src/functions/index.ts
DELETED
package/src/functions/move.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Chess as ChessJS } from 'chess.js';
|
|
6
|
-
import * as Effect from 'effect/Effect';
|
|
7
|
-
import * as Schema from 'effect/Schema';
|
|
8
|
-
|
|
9
|
-
import { ArtifactId } from '@dxos/assistant';
|
|
10
|
-
import { DatabaseService, defineFunction } from '@dxos/functions';
|
|
11
|
-
|
|
12
|
-
import { Chess } from '../types';
|
|
13
|
-
|
|
14
|
-
export default defineFunction({
|
|
15
|
-
key: 'dxos.org/function/chess/move',
|
|
16
|
-
name: 'Move',
|
|
17
|
-
description: 'Makes a move in the given chess game.',
|
|
18
|
-
inputSchema: Schema.Struct({
|
|
19
|
-
id: ArtifactId.annotations({
|
|
20
|
-
description: 'The ID of the chess object.',
|
|
21
|
-
}),
|
|
22
|
-
move: Schema.String.annotations({
|
|
23
|
-
description: 'The move to make in the chess game.',
|
|
24
|
-
examples: ['e4', 'Bf3'],
|
|
25
|
-
}),
|
|
26
|
-
}),
|
|
27
|
-
outputSchema: Schema.Struct({
|
|
28
|
-
pgn: Schema.String.annotations({
|
|
29
|
-
description: 'The PGN of the game after the move was played.',
|
|
30
|
-
}),
|
|
31
|
-
}),
|
|
32
|
-
handler: Effect.fn(function* ({ data: { id, move } }) {
|
|
33
|
-
const object = yield* DatabaseService.resolve(ArtifactId.toDXN(id), Chess.Game);
|
|
34
|
-
const chess = new ChessJS();
|
|
35
|
-
if (object.pgn) {
|
|
36
|
-
chess.loadPgn(object.pgn);
|
|
37
|
-
} else if (object.fen) {
|
|
38
|
-
chess.load(object.fen);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
chess.move(move, { strict: false });
|
|
42
|
-
object.pgn = chess.pgn();
|
|
43
|
-
return { pgn: object.pgn };
|
|
44
|
-
}),
|
|
45
|
-
});
|
package/src/functions/play.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Chess as ChessJS } from 'chess.js';
|
|
6
|
-
import * as Effect from 'effect/Effect';
|
|
7
|
-
import * as Schema from 'effect/Schema';
|
|
8
|
-
|
|
9
|
-
import { ArtifactId } from '@dxos/assistant';
|
|
10
|
-
import { DatabaseService, defineFunction } from '@dxos/functions';
|
|
11
|
-
|
|
12
|
-
import { Chess } from '../types';
|
|
13
|
-
|
|
14
|
-
export default defineFunction({
|
|
15
|
-
key: 'dxos.org/function/chess/play',
|
|
16
|
-
name: 'Play',
|
|
17
|
-
description: 'Uses the chess engine to play the next move.',
|
|
18
|
-
inputSchema: Schema.Struct({
|
|
19
|
-
id: ArtifactId.annotations({
|
|
20
|
-
description: 'The ID of the chess object.',
|
|
21
|
-
}),
|
|
22
|
-
side: Schema.optional(Schema.Literal('white', 'black', 'any')).annotations({
|
|
23
|
-
description: 'The side to play.',
|
|
24
|
-
defaultValue: 'any',
|
|
25
|
-
}),
|
|
26
|
-
}),
|
|
27
|
-
outputSchema: Schema.Struct({
|
|
28
|
-
pgn: Schema.String.annotations({
|
|
29
|
-
description: 'The PGN of the game after the move was played.',
|
|
30
|
-
}),
|
|
31
|
-
move: Schema.optional(Schema.String).annotations({
|
|
32
|
-
description: 'The move that was played.',
|
|
33
|
-
}),
|
|
34
|
-
}),
|
|
35
|
-
handler: Effect.fn(function* ({ data: { id, side = 'any' } }) {
|
|
36
|
-
const object = yield* DatabaseService.resolve(ArtifactId.toDXN(id), Chess.Game);
|
|
37
|
-
const chess = new ChessJS();
|
|
38
|
-
if (object.pgn) {
|
|
39
|
-
chess.loadPgn(object.pgn);
|
|
40
|
-
} else if (object.fen) {
|
|
41
|
-
chess.load(object.fen);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (!(side === 'any' || (chess.turn() === 'w' && side === 'white') || (chess.turn() === 'b' && side === 'black'))) {
|
|
45
|
-
return { move: undefined, pgn: object.pgn! };
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const moves = chess.moves();
|
|
49
|
-
const move = moves[Math.floor(Math.random() * moves.length)];
|
|
50
|
-
|
|
51
|
-
chess.move(move, { strict: false });
|
|
52
|
-
object.pgn = chess.pgn();
|
|
53
|
-
return { move, pgn: object.pgn };
|
|
54
|
-
}),
|
|
55
|
-
});
|
package/src/types/ChessAction.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Schema from 'effect/Schema';
|
|
6
|
-
|
|
7
|
-
import { meta } from '../meta';
|
|
8
|
-
|
|
9
|
-
import { Game } from './Chess';
|
|
10
|
-
|
|
11
|
-
export class Create extends Schema.TaggedClass<Create>()(`${meta.id}/action/create`, {
|
|
12
|
-
input: Schema.Struct({
|
|
13
|
-
name: Schema.optional(Schema.String),
|
|
14
|
-
pgn: Schema.optional(Schema.String),
|
|
15
|
-
}),
|
|
16
|
-
output: Schema.Struct({
|
|
17
|
-
object: Game,
|
|
18
|
-
}),
|
|
19
|
-
}) {}
|
/package/dist/lib/browser/{blueprint-definition-FD4TL5EE.mjs.map → blueprints/index.mjs.map}
RENAMED
|
File without changes
|
/package/dist/lib/{node-esm/blueprint-definition-O7ZM3HUF.mjs.map → browser/chunk-J5LGTIGS.mjs.map}
RENAMED
|
File without changes
|