@dxos/plugin-chess 0.8.4-main.4a85c3132b → 0.8.4-main.4f23b4e393
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/neutral/ChessArticle-QLLKZGPH.mjs +88 -0
- package/dist/lib/neutral/ChessArticle-QLLKZGPH.mjs.map +7 -0
- package/dist/lib/neutral/ChessCard-I5RSZZIP.mjs +19 -0
- package/dist/lib/neutral/ChessCard-I5RSZZIP.mjs.map +7 -0
- package/dist/lib/neutral/ChessPlugin.mjs +30 -0
- package/dist/lib/neutral/ChessPlugin.mjs.map +7 -0
- package/dist/lib/neutral/ChessPlugin.node.mjs +23 -0
- package/dist/lib/neutral/ChessPlugin.node.mjs.map +7 -0
- package/dist/lib/{browser/blueprint-definition-RLA7PQBB.mjs → neutral/blueprint-definition-PZXHAYLD.mjs} +4 -7
- package/dist/lib/neutral/blueprint-definition-PZXHAYLD.mjs.map +7 -0
- package/dist/lib/neutral/blueprints/index.mjs +8 -0
- package/dist/lib/neutral/capabilities/index.mjs +13 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/chunk-5UOTTW6U.mjs +8 -0
- package/dist/lib/neutral/chunk-5UOTTW6U.mjs.map +7 -0
- package/dist/lib/neutral/chunk-E4LZPHAQ.mjs +148 -0
- package/dist/lib/neutral/chunk-E4LZPHAQ.mjs.map +7 -0
- package/dist/lib/{browser/chunk-H3NUMCQ6.mjs → neutral/chunk-FFXSIHW6.mjs} +2 -2
- package/dist/lib/{browser/chunk-H3NUMCQ6.mjs.map → neutral/chunk-FFXSIHW6.mjs.map} +3 -3
- package/dist/lib/neutral/chunk-XWKNXG62.mjs +34 -0
- package/dist/lib/neutral/chunk-XWKNXG62.mjs.map +7 -0
- package/dist/lib/{browser/chunk-KE4FN77G.mjs → neutral/components/index.mjs} +21 -58
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/containers/index.mjs +11 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/neutral/game-variant-24UKIBRM.mjs +40 -0
- package/dist/lib/neutral/game-variant-24UKIBRM.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +18 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +8 -0
- package/dist/lib/neutral/move-RQZ7BJY3.mjs +37 -0
- package/dist/lib/neutral/move-RQZ7BJY3.mjs.map +7 -0
- package/dist/lib/neutral/operation-handler-EKZKFQUG.mjs +13 -0
- package/dist/lib/neutral/operation-handler-EKZKFQUG.mjs.map +7 -0
- package/dist/lib/{browser/types → neutral/operations}/index.mjs +3 -3
- package/dist/lib/neutral/play-GDGCEPQL.mjs +46 -0
- package/dist/lib/neutral/play-GDGCEPQL.mjs.map +7 -0
- package/dist/lib/neutral/plugin.mjs +16 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/print-ZQA74KZI.mjs +29 -0
- package/dist/lib/neutral/print-ZQA74KZI.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +34 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +10 -0
- package/dist/types/src/ChessPlugin.d.ts +1 -0
- package/dist/types/src/ChessPlugin.d.ts.map +1 -1
- package/dist/types/src/ChessPlugin.node.d.ts +8 -0
- package/dist/types/src/ChessPlugin.node.d.ts.map +1 -0
- package/dist/types/src/ChessPlugin.test.d.ts +2 -0
- package/dist/types/src/ChessPlugin.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/chess-blueprint.d.ts +2 -2
- package/dist/types/src/blueprints/chess-blueprint.d.ts.map +1 -1
- package/dist/types/src/blueprints/index.d.ts +0 -1
- package/dist/types/src/blueprints/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +6 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/game-variant.d.ts +6 -0
- package/dist/types/src/capabilities/game-variant.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +5 -2
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/components/Chessboard/Chessboard.d.ts +8 -4
- package/dist/types/src/components/Chessboard/Chessboard.d.ts.map +1 -1
- package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts +57 -0
- package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts.map +1 -0
- package/dist/types/src/components/Chessboard/Info.d.ts +4 -5
- package/dist/types/src/components/Chessboard/Info.d.ts.map +1 -1
- package/dist/types/src/components/Chessboard/types.d.ts +3 -3
- package/dist/types/src/components/Chessboard/types.d.ts.map +1 -1
- package/dist/types/src/containers/ChessArticle/ChessArticle.d.ts +3 -4
- package/dist/types/src/containers/ChessArticle/ChessArticle.d.ts.map +1 -1
- package/dist/types/src/containers/ChessArticle/ChessArticle.stories.d.ts +34 -24
- package/dist/types/src/containers/ChessArticle/ChessArticle.stories.d.ts.map +1 -1
- package/dist/types/src/containers/ChessArticle/index.d.ts +1 -2
- package/dist/types/src/containers/ChessArticle/index.d.ts.map +1 -1
- package/dist/types/src/containers/ChessCard/ChessCard.d.ts +3 -4
- package/dist/types/src/containers/ChessCard/ChessCard.d.ts.map +1 -1
- package/dist/types/src/containers/ChessCard/ChessCard.stories.d.ts.map +1 -1
- package/dist/types/src/containers/ChessCard/index.d.ts +1 -2
- package/dist/types/src/containers/ChessCard/index.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +0 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/operations/index.d.ts +3 -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/{cli/plugin.d.ts → plugin.d.ts} +1 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +32 -23
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Chess.d.ts +10 -19
- package/dist/types/src/types/Chess.d.ts.map +1 -1
- package/dist/types/src/types/ChessOperation.d.ts +24 -0
- package/dist/types/src/types/ChessOperation.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +1 -0
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +95 -63
- package/src/ChessPlugin.node.ts +23 -0
- package/src/ChessPlugin.test.ts +49 -0
- package/src/ChessPlugin.tsx +14 -23
- package/src/blueprints/chess-blueprint.ts +7 -11
- package/src/blueprints/index.ts +0 -1
- package/src/capabilities/{blueprint-definition/blueprint-definition.ts → blueprint-definition.ts} +3 -1
- package/src/capabilities/game-variant.ts +42 -0
- package/src/capabilities/index.ts +10 -2
- package/src/capabilities/operation-handler.ts +14 -0
- package/src/components/Chessboard/Chessboard.stories.tsx +94 -0
- package/src/components/Chessboard/Chessboard.tsx +7 -13
- package/src/components/Chessboard/Info.tsx +21 -74
- package/src/components/Chessboard/types.ts +2 -2
- package/src/containers/ChessArticle/ChessArticle.stories.tsx +12 -6
- package/src/containers/ChessArticle/ChessArticle.tsx +55 -19
- package/src/containers/ChessArticle/index.ts +1 -3
- package/src/containers/ChessCard/ChessCard.stories.tsx +10 -5
- package/src/containers/ChessCard/ChessCard.tsx +11 -6
- package/src/containers/ChessCard/index.ts +1 -3
- package/src/index.ts +0 -4
- package/src/meta.ts +1 -1
- package/src/operations/index.ts +11 -0
- package/src/operations/move.ts +36 -0
- package/src/operations/play.ts +45 -0
- package/src/operations/print.ts +28 -0
- package/src/plugin.ts +11 -0
- package/src/translations.ts +18 -21
- package/src/types/Chess.ts +25 -24
- package/src/types/ChessOperation.ts +85 -0
- package/src/types/index.ts +1 -0
- package/dist/lib/browser/ChessArticle-RI2DYAO4.mjs +0 -59
- package/dist/lib/browser/ChessArticle-RI2DYAO4.mjs.map +0 -7
- package/dist/lib/browser/ChessCard-AUMESHHE.mjs +0 -21
- package/dist/lib/browser/ChessCard-AUMESHHE.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-RLA7PQBB.mjs.map +0 -7
- package/dist/lib/browser/blueprints/index.mjs +0 -11
- package/dist/lib/browser/chunk-66H3V2YV.mjs +0 -64
- package/dist/lib/browser/chunk-66H3V2YV.mjs.map +0 -7
- package/dist/lib/browser/chunk-AWDLDU43.mjs +0 -231
- package/dist/lib/browser/chunk-AWDLDU43.mjs.map +0 -7
- package/dist/lib/browser/chunk-KE4FN77G.mjs.map +0 -7
- package/dist/lib/browser/chunk-WYUTI2K4.mjs +0 -1
- package/dist/lib/browser/cli/index.mjs +0 -29
- package/dist/lib/browser/cli/index.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -94
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/react-surface-7KUFGD7C.mjs +0 -50
- package/dist/lib/browser/react-surface-7KUFGD7C.mjs.map +0 -7
- package/dist/lib/node-esm/ChessArticle-6QNVYEZV.mjs +0 -60
- package/dist/lib/node-esm/ChessArticle-6QNVYEZV.mjs.map +0 -7
- package/dist/lib/node-esm/ChessCard-QK3ZMYLT.mjs +0 -22
- package/dist/lib/node-esm/ChessCard-QK3ZMYLT.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-A2FFH3Z2.mjs +0 -19
- package/dist/lib/node-esm/blueprint-definition-A2FFH3Z2.mjs.map +0 -7
- package/dist/lib/node-esm/blueprints/index.mjs +0 -12
- package/dist/lib/node-esm/chunk-7XDEO6IJ.mjs +0 -2
- package/dist/lib/node-esm/chunk-7XDEO6IJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-F5OMIM4F.mjs +0 -23
- package/dist/lib/node-esm/chunk-F5OMIM4F.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-OUNGNJFP.mjs +0 -65
- package/dist/lib/node-esm/chunk-OUNGNJFP.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-R7FXSQ2P.mjs +0 -232
- package/dist/lib/node-esm/chunk-R7FXSQ2P.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RNPP75JE.mjs +0 -277
- package/dist/lib/node-esm/chunk-RNPP75JE.mjs.map +0 -7
- package/dist/lib/node-esm/cli/index.mjs +0 -30
- package/dist/lib/node-esm/cli/index.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -95
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/react-surface-U3HGYR5T.mjs +0 -51
- package/dist/lib/node-esm/react-surface-U3HGYR5T.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -9
- package/dist/types/src/blueprints/functions/create.d.ts +0 -15
- package/dist/types/src/blueprints/functions/create.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/index.d.ts +0 -56
- package/dist/types/src/blueprints/functions/index.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/move.d.ts +0 -16
- package/dist/types/src/blueprints/functions/move.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/play.d.ts +0 -17
- package/dist/types/src/blueprints/functions/play.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/print.d.ts +0 -8
- package/dist/types/src/blueprints/functions/print.d.ts.map +0 -1
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts +0 -12
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/artifact-definition/index.d.ts +0 -3
- package/dist/types/src/capabilities/artifact-definition/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +0 -6
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +0 -3
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +0 -5
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/dist/types/src/cli/index.d.ts +0 -2
- package/dist/types/src/cli/index.d.ts.map +0 -1
- package/dist/types/src/cli/plugin.d.ts.map +0 -1
- package/src/blueprints/functions/create.ts +0 -38
- package/src/blueprints/functions/index.ts +0 -17
- package/src/blueprints/functions/move.ts +0 -48
- package/src/blueprints/functions/play.ts +0 -58
- package/src/blueprints/functions/print.ts +0 -42
- package/src/capabilities/artifact-definition/artifact-definition.ts +0 -135
- package/src/capabilities/artifact-definition/index.ts +0 -7
- package/src/capabilities/blueprint-definition/index.ts +0 -7
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/react-surface/react-surface.tsx +0 -33
- package/src/cli/index.ts +0 -5
- package/src/cli/plugin.ts +0 -27
- /package/dist/lib/{browser → neutral}/blueprints/index.mjs.map +0 -0
- /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs +0 -0
- /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs.map +0 -0
- /package/dist/lib/{browser/types → neutral}/index.mjs.map +0 -0
- /package/dist/lib/{browser/chunk-WYUTI2K4.mjs.map → neutral/meta.mjs.map} +0 -0
- /package/dist/lib/{node-esm/blueprints → neutral/operations}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm → neutral}/types/index.mjs.map +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-chess",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.4f23b4e393",
|
|
4
4
|
"description": "Chess for new plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -12,94 +12,126 @@
|
|
|
12
12
|
"author": "DXOS.org",
|
|
13
13
|
"sideEffects": true,
|
|
14
14
|
"type": "module",
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"source": "./src/index.ts",
|
|
18
|
-
"types": "./dist/types/src/index.d.ts",
|
|
19
|
-
"browser": "./dist/lib/browser/index.mjs",
|
|
20
|
-
"node": "./dist/lib/node-esm/index.mjs"
|
|
21
|
-
},
|
|
22
|
-
"./blueprints": {
|
|
15
|
+
"imports": {
|
|
16
|
+
"#blueprints": {
|
|
23
17
|
"source": "./src/blueprints/index.ts",
|
|
24
18
|
"types": "./dist/types/src/blueprints/index.d.ts",
|
|
25
|
-
"
|
|
26
|
-
|
|
19
|
+
"default": "./dist/lib/neutral/blueprints/index.mjs"
|
|
20
|
+
},
|
|
21
|
+
"#capabilities": {
|
|
22
|
+
"source": "./src/capabilities/index.ts",
|
|
23
|
+
"types": "./dist/types/src/capabilities/index.d.ts",
|
|
24
|
+
"default": "./dist/lib/neutral/capabilities/index.mjs"
|
|
25
|
+
},
|
|
26
|
+
"#components": {
|
|
27
|
+
"source": "./src/components/index.ts",
|
|
28
|
+
"types": "./dist/types/src/components/index.d.ts",
|
|
29
|
+
"default": "./dist/lib/neutral/components/index.mjs"
|
|
30
|
+
},
|
|
31
|
+
"#containers": {
|
|
32
|
+
"source": "./src/containers/index.ts",
|
|
33
|
+
"types": "./dist/types/src/containers/index.d.ts",
|
|
34
|
+
"default": "./dist/lib/neutral/containers/index.mjs"
|
|
35
|
+
},
|
|
36
|
+
"#meta": {
|
|
37
|
+
"source": "./src/meta.ts",
|
|
38
|
+
"types": "./dist/types/src/meta.d.ts",
|
|
39
|
+
"default": "./dist/lib/neutral/meta.mjs"
|
|
40
|
+
},
|
|
41
|
+
"#operations": {
|
|
42
|
+
"source": "./src/operations/index.ts",
|
|
43
|
+
"types": "./dist/types/src/operations/index.d.ts",
|
|
44
|
+
"default": "./dist/lib/neutral/operations/index.mjs"
|
|
27
45
|
},
|
|
28
|
-
"
|
|
29
|
-
"source":
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
46
|
+
"#plugin": {
|
|
47
|
+
"source": {
|
|
48
|
+
"node": "./src/ChessPlugin.node.ts",
|
|
49
|
+
"default": "./src/ChessPlugin.tsx"
|
|
50
|
+
},
|
|
51
|
+
"types": "./dist/types/src/ChessPlugin.d.ts",
|
|
52
|
+
"node": "./dist/lib/neutral/ChessPlugin.node.mjs",
|
|
53
|
+
"default": "./dist/lib/neutral/ChessPlugin.mjs"
|
|
33
54
|
},
|
|
34
|
-
"
|
|
55
|
+
"#translations": {
|
|
56
|
+
"source": "./src/translations.ts",
|
|
57
|
+
"types": "./dist/types/src/translations.d.ts",
|
|
58
|
+
"default": "./dist/lib/neutral/translations.mjs"
|
|
59
|
+
},
|
|
60
|
+
"#types": {
|
|
35
61
|
"source": "./src/types/index.ts",
|
|
36
62
|
"types": "./dist/types/src/types/index.d.ts",
|
|
37
|
-
"
|
|
38
|
-
"node": "./dist/lib/node-esm/types/index.mjs"
|
|
63
|
+
"default": "./dist/lib/neutral/types/index.mjs"
|
|
39
64
|
}
|
|
40
65
|
},
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"types":
|
|
45
|
-
|
|
46
|
-
|
|
66
|
+
"exports": {
|
|
67
|
+
".": {
|
|
68
|
+
"source": "./src/index.ts",
|
|
69
|
+
"types": "./dist/types/src/index.d.ts",
|
|
70
|
+
"default": "./dist/lib/neutral/index.mjs"
|
|
71
|
+
},
|
|
72
|
+
"./plugin": {
|
|
73
|
+
"source": "./src/plugin.ts",
|
|
74
|
+
"types": "./dist/types/src/plugin.d.ts",
|
|
75
|
+
"default": "./dist/lib/neutral/plugin.mjs"
|
|
76
|
+
},
|
|
77
|
+
"./translations": {
|
|
78
|
+
"source": "./src/translations.ts",
|
|
79
|
+
"types": "./dist/types/src/translations.d.ts",
|
|
80
|
+
"default": "./dist/lib/neutral/translations.mjs"
|
|
47
81
|
}
|
|
48
82
|
},
|
|
83
|
+
"types": "dist/types/src/index.d.ts",
|
|
49
84
|
"files": [
|
|
50
85
|
"dist",
|
|
51
86
|
"src"
|
|
52
87
|
],
|
|
53
88
|
"dependencies": {
|
|
54
|
-
"@automerge/automerge": "3.2.
|
|
89
|
+
"@automerge/automerge": "3.2.6",
|
|
55
90
|
"@effect-atom/atom-react": "^0.5.0",
|
|
56
91
|
"chess.js": "^1.0.0",
|
|
57
|
-
"effect": "3.
|
|
58
|
-
"@dxos/ai": "0.8.4-main.
|
|
59
|
-
"@dxos/app-toolkit": "0.8.4-main.
|
|
60
|
-
"@dxos/
|
|
61
|
-
"@dxos/
|
|
62
|
-
"@dxos/
|
|
63
|
-
"@dxos/display-name": "0.8.4-main.
|
|
64
|
-
"@dxos/echo": "0.8.4-main.
|
|
65
|
-
"@dxos/echo-db": "0.8.4-main.
|
|
66
|
-
"@dxos/echo-react": "0.8.4-main.
|
|
67
|
-
"@dxos/
|
|
68
|
-
"@dxos/
|
|
69
|
-
"@dxos/
|
|
70
|
-
"@dxos/
|
|
71
|
-
"@dxos/plugin-
|
|
72
|
-
"@dxos/plugin-
|
|
73
|
-
"@dxos/plugin-
|
|
74
|
-
"@dxos/plugin-
|
|
75
|
-
"@dxos/react-client": "0.8.4-main.
|
|
76
|
-
"@dxos/react-ui-
|
|
77
|
-
"@dxos/react-ui-
|
|
78
|
-
"@dxos/
|
|
79
|
-
"@dxos/
|
|
80
|
-
"@dxos/types": "0.8.4-main.
|
|
81
|
-
"@dxos/
|
|
82
|
-
"@dxos/
|
|
83
|
-
"@dxos/util": "0.8.4-main.4a85c3132b"
|
|
92
|
+
"effect": "3.20.0",
|
|
93
|
+
"@dxos/ai": "0.8.4-main.4f23b4e393",
|
|
94
|
+
"@dxos/app-toolkit": "0.8.4-main.4f23b4e393",
|
|
95
|
+
"@dxos/assistant": "0.8.4-main.4f23b4e393",
|
|
96
|
+
"@dxos/async": "0.8.4-main.4f23b4e393",
|
|
97
|
+
"@dxos/compute": "0.8.4-main.4f23b4e393",
|
|
98
|
+
"@dxos/display-name": "0.8.4-main.4f23b4e393",
|
|
99
|
+
"@dxos/echo": "0.8.4-main.4f23b4e393",
|
|
100
|
+
"@dxos/echo-db": "0.8.4-main.4f23b4e393",
|
|
101
|
+
"@dxos/echo-react": "0.8.4-main.4f23b4e393",
|
|
102
|
+
"@dxos/invariant": "0.8.4-main.4f23b4e393",
|
|
103
|
+
"@dxos/log": "0.8.4-main.4f23b4e393",
|
|
104
|
+
"@dxos/app-framework": "0.8.4-main.4f23b4e393",
|
|
105
|
+
"@dxos/plugin-client": "0.8.4-main.4f23b4e393",
|
|
106
|
+
"@dxos/plugin-game": "0.8.4-main.4f23b4e393",
|
|
107
|
+
"@dxos/plugin-graph": "0.8.4-main.4f23b4e393",
|
|
108
|
+
"@dxos/plugin-markdown": "0.8.4-main.4f23b4e393",
|
|
109
|
+
"@dxos/plugin-space": "0.8.4-main.4f23b4e393",
|
|
110
|
+
"@dxos/react-client": "0.8.4-main.4f23b4e393",
|
|
111
|
+
"@dxos/react-ui-gameboard": "0.8.4-main.4f23b4e393",
|
|
112
|
+
"@dxos/react-ui-mosaic": "0.8.4-main.4f23b4e393",
|
|
113
|
+
"@dxos/react-ui-sfx": "0.8.4-main.4f23b4e393",
|
|
114
|
+
"@dxos/schema": "0.8.4-main.4f23b4e393",
|
|
115
|
+
"@dxos/types": "0.8.4-main.4f23b4e393",
|
|
116
|
+
"@dxos/react-ui-stack": "0.8.4-main.4f23b4e393",
|
|
117
|
+
"@dxos/util": "0.8.4-main.4f23b4e393"
|
|
84
118
|
},
|
|
85
119
|
"devDependencies": {
|
|
86
120
|
"@types/react": "~19.2.7",
|
|
87
121
|
"@types/react-dom": "~19.2.3",
|
|
88
122
|
"react": "~19.2.3",
|
|
89
123
|
"react-dom": "~19.2.3",
|
|
90
|
-
"vite": "^
|
|
91
|
-
"@dxos/plugin-
|
|
92
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
93
|
-
"@dxos/
|
|
94
|
-
"@dxos/ui-theme": "0.8.4-main.
|
|
124
|
+
"vite": "^8.0.10",
|
|
125
|
+
"@dxos/plugin-testing": "0.8.4-main.4f23b4e393",
|
|
126
|
+
"@dxos/react-ui": "0.8.4-main.4f23b4e393",
|
|
127
|
+
"@dxos/plugin-theme": "0.8.4-main.4f23b4e393",
|
|
128
|
+
"@dxos/ui-theme": "0.8.4-main.4f23b4e393",
|
|
129
|
+
"@dxos/storybook-utils": "0.8.4-main.4f23b4e393"
|
|
95
130
|
},
|
|
96
131
|
"peerDependencies": {
|
|
97
132
|
"react": "~19.2.3",
|
|
98
133
|
"react-dom": "~19.2.3",
|
|
99
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
100
|
-
"@dxos/ui-theme": "0.8.4-main.
|
|
101
|
-
},
|
|
102
|
-
"publishConfig": {
|
|
103
|
-
"access": "public"
|
|
134
|
+
"@dxos/react-ui": "0.8.4-main.4f23b4e393",
|
|
135
|
+
"@dxos/ui-theme": "0.8.4-main.4f23b4e393"
|
|
104
136
|
}
|
|
105
137
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
import { AppPlugin } from '@dxos/app-toolkit';
|
|
7
|
+
|
|
8
|
+
import { BlueprintDefinition, OperationHandler } from '#capabilities';
|
|
9
|
+
import { meta } from '#meta';
|
|
10
|
+
import { Chess } from '#types';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Headless variant of ChessPlugin (no React surfaces / GameVariant).
|
|
14
|
+
* Used in node contexts (CLI, agents) where rendering is unavailable.
|
|
15
|
+
*/
|
|
16
|
+
export const ChessPlugin = Plugin.define(meta).pipe(
|
|
17
|
+
AppPlugin.addSchemaModule({ schema: [Chess.State] }),
|
|
18
|
+
AppPlugin.addBlueprintDefinitionModule({ activate: BlueprintDefinition }),
|
|
19
|
+
AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),
|
|
20
|
+
Plugin.make,
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
export default ChessPlugin;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { describe, test } from 'vitest';
|
|
6
|
+
|
|
7
|
+
import { ActivationEvents } from '@dxos/app-framework';
|
|
8
|
+
import { AppActivationEvents } from '@dxos/app-toolkit';
|
|
9
|
+
import { ClientPlugin } from '@dxos/plugin-client/plugin';
|
|
10
|
+
import { createComposerTestApp } from '@dxos/plugin-testing/harness';
|
|
11
|
+
|
|
12
|
+
import { ChessPlugin } from '#plugin';
|
|
13
|
+
|
|
14
|
+
import { meta } from './meta';
|
|
15
|
+
import { ChessOperation } from './types';
|
|
16
|
+
|
|
17
|
+
const moduleId = (name: string) => `${meta.id}.module.${name}`;
|
|
18
|
+
|
|
19
|
+
describe('ChessPlugin', () => {
|
|
20
|
+
test('modules activate on the expected events', async ({ expect }) => {
|
|
21
|
+
await using harness = await createComposerTestApp({
|
|
22
|
+
plugins: [ClientPlugin({}), ChessPlugin()],
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// Modules expected to be active after a normal startup (headless/node variant).
|
|
26
|
+
expect(harness.manager.getActive()).toEqual(expect.arrayContaining([moduleId('schema')]));
|
|
27
|
+
|
|
28
|
+
// SetupArtifactDefinition is fired by AssistantPlugin, which can't be included here due to a workspace cycle.
|
|
29
|
+
await harness.fire(AppActivationEvents.SetupArtifactDefinition);
|
|
30
|
+
expect(harness.manager.getActive()).toContain(moduleId('BlueprintDefinition'));
|
|
31
|
+
|
|
32
|
+
// Operation handlers are not loaded on startup — SetupOperationHandler fires lazily when an operation is invoked.
|
|
33
|
+
await harness.fire(ActivationEvents.SetupOperationHandler);
|
|
34
|
+
expect(harness.manager.getActive()).toContain(moduleId('OperationHandler'));
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test('invokes the Print operation via the invoker capability', async ({ expect }) => {
|
|
38
|
+
await using harness = await createComposerTestApp({ plugins: [ChessPlugin()] });
|
|
39
|
+
const result = await harness.invoke(ChessOperation.Print, {});
|
|
40
|
+
// Empty input returns empty ASCII (handler swallows errors for malformed FEN).
|
|
41
|
+
expect(typeof result.ascii).toBe('string');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test('Print renders a PGN to ASCII board', async ({ expect }) => {
|
|
45
|
+
await using harness = await createComposerTestApp({ plugins: [ChessPlugin()] });
|
|
46
|
+
const { ascii } = await harness.invoke(ChessOperation.Print, { pgn: '1. e4 e5' });
|
|
47
|
+
expect(ascii).toContain('a b c d e f g h');
|
|
48
|
+
});
|
|
49
|
+
});
|
package/src/ChessPlugin.tsx
CHANGED
|
@@ -2,34 +2,25 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import * as Effect from 'effect/Effect';
|
|
6
|
-
|
|
7
5
|
import { Plugin } from '@dxos/app-framework';
|
|
8
|
-
import { AppPlugin } from '@dxos/app-toolkit';
|
|
9
|
-
import { type CreateObject } from '@dxos/plugin-space/types';
|
|
6
|
+
import { AppPlugin, AppActivationEvents } from '@dxos/app-toolkit';
|
|
10
7
|
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { Chess } from './types';
|
|
8
|
+
import { BlueprintDefinition, GameVariant, OperationHandler } from '#capabilities';
|
|
9
|
+
import { meta } from '#meta';
|
|
10
|
+
import { translations } from '#translations';
|
|
11
|
+
import { Chess } from '#types';
|
|
16
12
|
|
|
17
13
|
export const ChessPlugin = Plugin.define(meta).pipe(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
metadata: {
|
|
23
|
-
icon: 'ph--shield-chevron--regular',
|
|
24
|
-
iconHue: 'amber',
|
|
25
|
-
blueprints: [ChessBlueprint.key],
|
|
26
|
-
createObject: ((props) => Effect.sync(() => Chess.make(props))) satisfies CreateObject,
|
|
27
|
-
addToCollectionOnCreate: true,
|
|
28
|
-
},
|
|
29
|
-
},
|
|
14
|
+
Plugin.addModule({
|
|
15
|
+
id: 'game-variant',
|
|
16
|
+
activatesOn: AppActivationEvents.SetupSchema,
|
|
17
|
+
activate: GameVariant,
|
|
30
18
|
}),
|
|
31
|
-
AppPlugin.
|
|
32
|
-
AppPlugin.
|
|
19
|
+
AppPlugin.addBlueprintDefinitionModule({ activate: BlueprintDefinition }),
|
|
20
|
+
AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),
|
|
21
|
+
AppPlugin.addSchemaModule({ schema: [Chess.State] }),
|
|
33
22
|
AppPlugin.addTranslationsModule({ translations }),
|
|
34
23
|
Plugin.make,
|
|
35
24
|
);
|
|
25
|
+
|
|
26
|
+
export default ChessPlugin;
|
|
@@ -2,21 +2,18 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import { Blueprint, Template } from '@dxos/blueprints';
|
|
5
|
+
import { Blueprint, Template } from '@dxos/compute';
|
|
7
6
|
import { trim } from '@dxos/util';
|
|
8
7
|
|
|
9
|
-
import {
|
|
8
|
+
import { Chess, ChessOperation } from '#types';
|
|
10
9
|
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
const functions = Object.values(ChessFunctions);
|
|
10
|
+
const operations = [ChessOperation.Move, ChessOperation.Play, ChessOperation.Print];
|
|
14
11
|
|
|
15
12
|
const make = () =>
|
|
16
13
|
Blueprint.make({
|
|
17
|
-
key: BLUEPRINT_KEY,
|
|
14
|
+
key: Chess.BLUEPRINT_KEY,
|
|
18
15
|
name: 'Chess',
|
|
19
|
-
tools: Blueprint.toolDefinitions({
|
|
16
|
+
tools: Blueprint.toolDefinitions({ operations }),
|
|
20
17
|
instructions: Template.make({
|
|
21
18
|
source: trim`
|
|
22
19
|
You are an expert chess player.
|
|
@@ -27,9 +24,8 @@ const make = () =>
|
|
|
27
24
|
}),
|
|
28
25
|
});
|
|
29
26
|
|
|
30
|
-
const blueprint:
|
|
31
|
-
key: BLUEPRINT_KEY,
|
|
32
|
-
functions,
|
|
27
|
+
const blueprint: Blueprint.Definition = {
|
|
28
|
+
key: Chess.BLUEPRINT_KEY,
|
|
33
29
|
make,
|
|
34
30
|
};
|
|
35
31
|
|
package/src/blueprints/index.ts
CHANGED
package/src/capabilities/{blueprint-definition/blueprint-definition.ts → blueprint-definition.ts}
RENAMED
|
@@ -6,8 +6,10 @@ import * as Effect from 'effect/Effect';
|
|
|
6
6
|
|
|
7
7
|
import { Capability } from '@dxos/app-framework';
|
|
8
8
|
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
9
|
+
// eslint-disable-next-line unused-imports/no-unused-imports
|
|
10
|
+
import type { Blueprint } from '@dxos/compute';
|
|
9
11
|
|
|
10
|
-
import { ChessBlueprint } from '
|
|
12
|
+
import { ChessBlueprint } from '#blueprints';
|
|
11
13
|
|
|
12
14
|
const blueprintDefinition = Capability.makeModule<
|
|
13
15
|
[],
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Schema from 'effect/Schema';
|
|
7
|
+
|
|
8
|
+
import { Capability } from '@dxos/app-framework';
|
|
9
|
+
import { GameCapabilities, type GameVariant } from '@dxos/plugin-game';
|
|
10
|
+
|
|
11
|
+
import { ChessArticle, ChessCard } from '#containers';
|
|
12
|
+
import { Chess } from '#types';
|
|
13
|
+
|
|
14
|
+
const CreateChessInput = Schema.Struct({
|
|
15
|
+
name: Schema.optional(
|
|
16
|
+
Schema.String.annotations({
|
|
17
|
+
title: 'Name',
|
|
18
|
+
description: 'Optional name for the game.',
|
|
19
|
+
}),
|
|
20
|
+
),
|
|
21
|
+
pgn: Schema.optional(
|
|
22
|
+
Schema.String.annotations({
|
|
23
|
+
title: 'PGN',
|
|
24
|
+
description: 'Optional Portable Game Notation to start from.',
|
|
25
|
+
}),
|
|
26
|
+
),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const variant: GameVariant = {
|
|
30
|
+
id: Chess.State.typename,
|
|
31
|
+
label: 'Chess',
|
|
32
|
+
icon: 'ph--shield-chevron--regular',
|
|
33
|
+
variantSchema: Chess.State,
|
|
34
|
+
inputSchema: CreateChessInput,
|
|
35
|
+
roles: ['white', 'black'] as const,
|
|
36
|
+
createVariant: (input) =>
|
|
37
|
+
Effect.sync(() => Chess.make({ pgn: typeof input.pgn === 'string' ? input.pgn : undefined })),
|
|
38
|
+
card: ChessCard,
|
|
39
|
+
article: ChessArticle,
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export default Capability.makeModule(() => Effect.succeed(Capability.contributes(GameCapabilities.Variant, variant)));
|
|
@@ -2,5 +2,13 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import { Capability } from '@dxos/app-framework';
|
|
6
|
+
// eslint-disable-next-line unused-imports/no-unused-imports
|
|
7
|
+
import type { Blueprint, OperationHandlerSet } from '@dxos/compute';
|
|
8
|
+
|
|
9
|
+
export const BlueprintDefinition = Capability.lazy('BlueprintDefinition', () => import('./blueprint-definition'));
|
|
10
|
+
export const GameVariant = Capability.lazy('GameVariant', () => import('./game-variant'));
|
|
11
|
+
export const OperationHandler = Capability.lazy<OperationHandlerSet.OperationHandlerSet>(
|
|
12
|
+
'OperationHandler',
|
|
13
|
+
() => import('./operation-handler'),
|
|
14
|
+
);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Copyright 2025 DXOS.org
|
|
2
|
+
|
|
3
|
+
import * as Effect from 'effect/Effect';
|
|
4
|
+
|
|
5
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
6
|
+
import type { OperationHandlerSet } from '@dxos/compute';
|
|
7
|
+
|
|
8
|
+
import { ChessOperationHandlerSet } from '#operations';
|
|
9
|
+
|
|
10
|
+
export default Capability.makeModule<OperationHandlerSet.OperationHandlerSet>(
|
|
11
|
+
Effect.fnUntraced(function* () {
|
|
12
|
+
return Capability.contributes(Capabilities.OperationHandler, ChessOperationHandlerSet);
|
|
13
|
+
}),
|
|
14
|
+
);
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import React, { useCallback, useMemo, useRef, useState } from 'react';
|
|
7
|
+
|
|
8
|
+
import { withClientProvider } from '@dxos/react-client/testing';
|
|
9
|
+
import { type Player } from '@dxos/react-ui-gameboard';
|
|
10
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
11
|
+
|
|
12
|
+
import { translations } from '#translations';
|
|
13
|
+
import { Chess } from '#types';
|
|
14
|
+
|
|
15
|
+
import { Chessboard, type ChessboardController, type ChessboardInfoProps } from './Chessboard';
|
|
16
|
+
|
|
17
|
+
const SAMPLE_PGN =
|
|
18
|
+
'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 *';
|
|
19
|
+
|
|
20
|
+
const PROMOTION_PGN =
|
|
21
|
+
'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 Kf8 16. e7+ Kg8 *';
|
|
22
|
+
|
|
23
|
+
type DefaultStoryProps = {
|
|
24
|
+
pgn?: string;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const DefaultStory = ({ pgn }: DefaultStoryProps) => {
|
|
28
|
+
const state = useMemo(() => Chess.make(pgn ? { pgn } : undefined), [pgn]);
|
|
29
|
+
const [orientation, setOrientation] = useState<Player>('white');
|
|
30
|
+
const [showInfo, setShowInfo] = useState(true);
|
|
31
|
+
const controller = useRef<ChessboardController>(null);
|
|
32
|
+
|
|
33
|
+
const handleSelect = useCallback<NonNullable<ChessboardInfoProps['onSelect']>>((index) => {
|
|
34
|
+
controller.current?.setMoveNumber(index);
|
|
35
|
+
}, []);
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<Chessboard.Root state={state} ref={controller}>
|
|
39
|
+
<div className='flex h-full w-full gap-4 p-4 overflow-hidden'>
|
|
40
|
+
<Chessboard.Content classNames='grow'>
|
|
41
|
+
<Chessboard.Board classNames='border rounded-xs' orientation={orientation} />
|
|
42
|
+
</Chessboard.Content>
|
|
43
|
+
{showInfo && (
|
|
44
|
+
<div className='flex flex-col justify-center items-center overflow-hidden'>
|
|
45
|
+
<Chessboard.Info
|
|
46
|
+
orientation={orientation}
|
|
47
|
+
min={8}
|
|
48
|
+
max={8}
|
|
49
|
+
onOrientationChange={setOrientation}
|
|
50
|
+
onClose={() => setShowInfo(false)}
|
|
51
|
+
onSelect={handleSelect}
|
|
52
|
+
/>
|
|
53
|
+
</div>
|
|
54
|
+
)}
|
|
55
|
+
</div>
|
|
56
|
+
</Chessboard.Root>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const meta = {
|
|
61
|
+
title: 'plugins/plugin-chess/components/Chessboard',
|
|
62
|
+
component: DefaultStory,
|
|
63
|
+
decorators: [withTheme(), withLayout({ layout: 'fullscreen' }), withClientProvider({ createIdentity: true })],
|
|
64
|
+
parameters: {
|
|
65
|
+
layout: 'fullscreen',
|
|
66
|
+
translations,
|
|
67
|
+
},
|
|
68
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
69
|
+
|
|
70
|
+
export default meta;
|
|
71
|
+
|
|
72
|
+
type Story = StoryObj<typeof meta>;
|
|
73
|
+
|
|
74
|
+
export const Default: Story = {
|
|
75
|
+
args: {},
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const WithPgn: Story = {
|
|
79
|
+
args: {
|
|
80
|
+
pgn: SAMPLE_PGN,
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export const Promotion: Story = {
|
|
85
|
+
args: {
|
|
86
|
+
pgn: PROMOTION_PGN,
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export const NewGame: Story = {
|
|
91
|
+
args: {
|
|
92
|
+
pgn: undefined,
|
|
93
|
+
},
|
|
94
|
+
};
|
|
@@ -27,9 +27,8 @@ import {
|
|
|
27
27
|
useGameboardContext,
|
|
28
28
|
} from '@dxos/react-ui-gameboard';
|
|
29
29
|
import { useSoundEffect } from '@dxos/react-ui-sfx';
|
|
30
|
-
import { mx } from '@dxos/ui-theme';
|
|
31
30
|
|
|
32
|
-
import { type Chess } from '
|
|
31
|
+
import { type Chess } from '#types';
|
|
33
32
|
|
|
34
33
|
import { Info, type InfoProps } from './Info';
|
|
35
34
|
import { ExtendedChessModel } from './types';
|
|
@@ -43,14 +42,14 @@ export interface ChessboardController {
|
|
|
43
42
|
//
|
|
44
43
|
|
|
45
44
|
type RootProps = PropsWithChildren<{
|
|
46
|
-
|
|
45
|
+
state: Chess.State;
|
|
47
46
|
}>;
|
|
48
47
|
|
|
49
|
-
const Root = forwardRef<ChessboardController, RootProps>(({
|
|
48
|
+
const Root = forwardRef<ChessboardController, RootProps>(({ state, children }, forwardedRef) => {
|
|
50
49
|
const registry = useContext(RegistryContext);
|
|
51
|
-
const model = useMemo(() => new ExtendedChessModel(registry,
|
|
50
|
+
const model = useMemo(() => new ExtendedChessModel(registry, state), [registry]);
|
|
52
51
|
const click = useSoundEffect('Click');
|
|
53
|
-
const [pgn, updatePgn] = useObject(
|
|
52
|
+
const [pgn, updatePgn] = useObject(state, 'pgn');
|
|
54
53
|
|
|
55
54
|
// Controller.
|
|
56
55
|
useImperativeHandle(forwardedRef, () => {
|
|
@@ -104,14 +103,9 @@ type Role = 'card--content';
|
|
|
104
103
|
|
|
105
104
|
type ContentProps = ThemedClassName<PropsWithChildren<{ role?: Role }>>;
|
|
106
105
|
|
|
107
|
-
const Content = ({ classNames, children
|
|
106
|
+
const Content = ({ classNames, children }: ContentProps) => {
|
|
108
107
|
return (
|
|
109
|
-
<Gameboard.Content
|
|
110
|
-
classNames={mx(
|
|
111
|
-
classNames,
|
|
112
|
-
role === 'card--content' ? 'dx-size-container dx-card-square' : 'flex flex-col justify-center',
|
|
113
|
-
)}
|
|
114
|
-
>
|
|
108
|
+
<Gameboard.Content grow contain classNames={classNames}>
|
|
115
109
|
{children}
|
|
116
110
|
</Gameboard.Content>
|
|
117
111
|
);
|