@dxos/plugin-chess 0.8.4-main.bc674ce → 0.8.4-main.bcb3aa67d6
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/blueprints/index.mjs +9 -6
- package/dist/lib/browser/{chunk-66H3V2YV.mjs → chunk-2TJN26DN.mjs} +9 -6
- 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-JKW2ZYHP.mjs +28 -0
- package/dist/lib/browser/chunk-JKW2ZYHP.mjs.map +7 -0
- package/dist/lib/browser/chunk-MC7L6JNC.mjs +36 -0
- package/dist/lib/browser/chunk-MC7L6JNC.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +21 -15
- package/dist/lib/browser/cli/index.mjs.map +3 -3
- 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 +351 -61
- 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/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/types/index.mjs +1 -1
- package/dist/lib/node-esm/blueprints/index.mjs +9 -6
- package/dist/lib/node-esm/chunk-4HZWCKMR.mjs +38 -0
- package/dist/lib/node-esm/chunk-4HZWCKMR.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-LPVPGURE.mjs +111 -0
- package/dist/lib/node-esm/chunk-LPVPGURE.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-OUNGNJFP.mjs → chunk-OIRJVY2R.mjs} +9 -6
- package/dist/lib/node-esm/chunk-OIRJVY2R.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +21 -15
- package/dist/lib/node-esm/cli/index.mjs.map +3 -3
- 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 +351 -61
- 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/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/types/index.mjs +1 -1
- package/dist/types/src/ChessPlugin.d.ts.map +1 -1
- package/dist/types/src/blueprints/chess-blueprint.d.ts +3 -20
- package/dist/types/src/blueprints/chess-blueprint.d.ts.map +1 -1
- package/dist/types/src/blueprints/index.d.ts +2 -2
- package/dist/types/src/blueprints/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/{artifact-definition/artifact-definition.d.ts → artifact-definition.d.ts} +1 -1
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +1 -0
- 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/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/capabilities/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/cli/plugin.d.ts.map +1 -1
- package/dist/types/src/components/{Chessboard.d.ts → Chessboard/Chessboard.d.ts} +4 -9
- package/dist/types/src/components/Chessboard/Chessboard.d.ts.map +1 -0
- package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts +48 -0
- package/dist/types/src/components/Chessboard/Chessboard.stories.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/containers/ChessArticle/ChessArticle.stories.d.ts +47 -0
- 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} +1 -1
- 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 +1 -2
- package/dist/types/src/index.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 +21 -20
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Chess.d.ts +1 -1
- package/dist/types/src/types/Chess.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +51 -35
- package/src/ChessPlugin.tsx +30 -15
- package/src/blueprints/chess-blueprint.ts +14 -7
- package/src/blueprints/index.ts +2 -2
- package/src/capabilities/{artifact-definition/artifact-definition.ts → artifact-definition.ts} +5 -5
- package/src/capabilities/blueprint-definition.ts +17 -0
- package/src/capabilities/index.ts +9 -2
- package/src/capabilities/operation-handler.ts +14 -0
- package/src/capabilities/react-surface.tsx +33 -0
- package/src/cli/plugin.ts +18 -7
- package/src/components/Chessboard/Chessboard.stories.tsx +94 -0
- package/src/components/{Chessboard.tsx → Chessboard/Chessboard.tsx} +22 -30
- package/src/components/{Info.tsx → Chessboard/Info.tsx} +26 -17
- 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/{components/Chessboard.stories.tsx → containers/ChessArticle/ChessArticle.stories.tsx} +9 -9
- package/src/containers/ChessArticle/ChessArticle.tsx +73 -0
- package/src/containers/ChessArticle/index.ts +7 -0
- package/src/{components/Card.stories.tsx → containers/ChessCard/ChessCard.stories.tsx} +9 -14
- 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 +1 -2
- package/src/meta.ts +1 -1
- 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 +21 -20
- package/src/types/Chess.ts +7 -3
- package/dist/lib/browser/ChessboardContainer-JZ4ANG4O.mjs +0 -81
- package/dist/lib/browser/ChessboardContainer-JZ4ANG4O.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-P7TYXWMF.mjs +0 -18
- package/dist/lib/browser/blueprint-definition-P7TYXWMF.mjs.map +0 -7
- package/dist/lib/browser/chunk-66H3V2YV.mjs.map +0 -7
- package/dist/lib/browser/chunk-73BDP7UV.mjs +0 -275
- package/dist/lib/browser/chunk-73BDP7UV.mjs.map +0 -7
- package/dist/lib/browser/chunk-FO4ZNFN6.mjs +0 -229
- package/dist/lib/browser/chunk-FO4ZNFN6.mjs.map +0 -7
- package/dist/lib/browser/chunk-H3NUMCQ6.mjs +0 -21
- package/dist/lib/browser/chunk-H3NUMCQ6.mjs.map +0 -7
- package/dist/lib/browser/chunk-OW6S2SRG.mjs +0 -8
- package/dist/lib/browser/chunk-OW6S2SRG.mjs.map +0 -7
- package/dist/lib/browser/react-surface-VNOWFKC6.mjs +0 -37
- package/dist/lib/browser/react-surface-VNOWFKC6.mjs.map +0 -7
- package/dist/lib/node-esm/ChessboardContainer-7ONFYN7L.mjs +0 -82
- package/dist/lib/node-esm/ChessboardContainer-7ONFYN7L.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-SL4LBVV5.mjs +0 -19
- package/dist/lib/node-esm/blueprint-definition-SL4LBVV5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-24GJHLHM.mjs +0 -10
- package/dist/lib/node-esm/chunk-24GJHLHM.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-C7IWIXCJ.mjs +0 -230
- package/dist/lib/node-esm/chunk-C7IWIXCJ.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-OUNGNJFP.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-WXEPWOHT.mjs +0 -276
- package/dist/lib/node-esm/chunk-WXEPWOHT.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-HSHCIOAS.mjs +0 -38
- package/dist/lib/node-esm/react-surface-HSHCIOAS.mjs.map +0 -7
- 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 -5
- package/dist/types/src/blueprints/functions/index.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/move.d.ts +0 -8
- package/dist/types/src/blueprints/functions/move.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/play.d.ts +0 -9
- 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.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 -9
- 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/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 +0 -46
- package/dist/types/src/components/Chessboard.stories.d.ts.map +0 -1
- package/dist/types/src/components/ChessboardArticle.d.ts +0 -6
- package/dist/types/src/components/ChessboardArticle.d.ts.map +0 -1
- package/dist/types/src/components/ChessboardContainer.d.ts +0 -7
- package/dist/types/src/components/ChessboardContainer.d.ts.map +0 -1
- package/dist/types/src/components/Info.d.ts.map +0 -1
- package/src/blueprints/functions/create.ts +0 -38
- package/src/blueprints/functions/index.ts +0 -8
- package/src/blueprints/functions/move.ts +0 -49
- package/src/blueprints/functions/play.ts +0 -59
- package/src/blueprints/functions/print.ts +0 -42
- package/src/capabilities/artifact-definition/index.ts +0 -7
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +0 -23
- 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 -27
- package/src/components/ChessboardArticle.tsx +0 -71
- package/src/components/ChessboardContainer.tsx +0 -40
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.bcb3aa67d6",
|
|
4
4
|
"description": "Chess for new plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -12,6 +12,15 @@
|
|
|
12
12
|
"author": "DXOS.org",
|
|
13
13
|
"sideEffects": true,
|
|
14
14
|
"type": "module",
|
|
15
|
+
"imports": {
|
|
16
|
+
"#blueprints": "./src/blueprints/index.ts",
|
|
17
|
+
"#capabilities": "./src/capabilities/index.ts",
|
|
18
|
+
"#components": "./src/components/index.ts",
|
|
19
|
+
"#containers": "./src/containers/index.ts",
|
|
20
|
+
"#meta": "./src/meta.ts",
|
|
21
|
+
"#operations": "./src/operations/index.ts",
|
|
22
|
+
"#types": "./src/types/index.ts"
|
|
23
|
+
},
|
|
15
24
|
"exports": {
|
|
16
25
|
".": {
|
|
17
26
|
"source": "./src/index.ts",
|
|
@@ -31,6 +40,12 @@
|
|
|
31
40
|
"browser": "./dist/lib/browser/cli/index.mjs",
|
|
32
41
|
"node": "./dist/lib/node-esm/cli/index.mjs"
|
|
33
42
|
},
|
|
43
|
+
"./operations": {
|
|
44
|
+
"source": "./src/operations/index.ts",
|
|
45
|
+
"types": "./dist/types/src/operations/index.d.ts",
|
|
46
|
+
"browser": "./dist/lib/browser/operations/index.mjs",
|
|
47
|
+
"node": "./dist/lib/node-esm/operations/index.mjs"
|
|
48
|
+
},
|
|
34
49
|
"./types": {
|
|
35
50
|
"source": "./src/types/index.ts",
|
|
36
51
|
"types": "./dist/types/src/types/index.d.ts",
|
|
@@ -52,51 +67,52 @@
|
|
|
52
67
|
],
|
|
53
68
|
"dependencies": {
|
|
54
69
|
"@automerge/automerge": "3.2.3",
|
|
55
|
-
"@effect-atom/atom-react": "^0.
|
|
70
|
+
"@effect-atom/atom-react": "^0.5.0",
|
|
56
71
|
"chess.js": "^1.0.0",
|
|
57
|
-
"effect": "3.
|
|
58
|
-
"@dxos/
|
|
59
|
-
"@dxos/app-
|
|
60
|
-
"@dxos/
|
|
61
|
-
"@dxos/
|
|
62
|
-
"@dxos/
|
|
63
|
-
"@dxos/
|
|
64
|
-
"@dxos/
|
|
65
|
-
"@dxos/echo
|
|
66
|
-
"@dxos/
|
|
67
|
-
"@dxos/
|
|
68
|
-
"@dxos/
|
|
69
|
-
"@dxos/
|
|
70
|
-
"@dxos/
|
|
71
|
-
"@dxos/operation": "0.8.4-main.
|
|
72
|
-
"@dxos/plugin-
|
|
73
|
-
"@dxos/plugin-
|
|
74
|
-
"@dxos/
|
|
75
|
-
"@dxos/plugin-space": "0.8.4-main.
|
|
76
|
-
"@dxos/react-
|
|
77
|
-
"@dxos/react-ui-
|
|
78
|
-
"@dxos/react-ui-
|
|
79
|
-
"@dxos/
|
|
80
|
-
"@dxos/
|
|
81
|
-
"@dxos/
|
|
82
|
-
"@dxos/
|
|
72
|
+
"effect": "3.20.0",
|
|
73
|
+
"@dxos/app-framework": "0.8.4-main.bcb3aa67d6",
|
|
74
|
+
"@dxos/app-toolkit": "0.8.4-main.bcb3aa67d6",
|
|
75
|
+
"@dxos/ai": "0.8.4-main.bcb3aa67d6",
|
|
76
|
+
"@dxos/assistant": "0.8.4-main.bcb3aa67d6",
|
|
77
|
+
"@dxos/async": "0.8.4-main.bcb3aa67d6",
|
|
78
|
+
"@dxos/blueprints": "0.8.4-main.bcb3aa67d6",
|
|
79
|
+
"@dxos/display-name": "0.8.4-main.bcb3aa67d6",
|
|
80
|
+
"@dxos/echo": "0.8.4-main.bcb3aa67d6",
|
|
81
|
+
"@dxos/echo-db": "0.8.4-main.bcb3aa67d6",
|
|
82
|
+
"@dxos/functions": "0.8.4-main.bcb3aa67d6",
|
|
83
|
+
"@dxos/log": "0.8.4-main.bcb3aa67d6",
|
|
84
|
+
"@dxos/invariant": "0.8.4-main.bcb3aa67d6",
|
|
85
|
+
"@dxos/echo-react": "0.8.4-main.bcb3aa67d6",
|
|
86
|
+
"@dxos/operation": "0.8.4-main.bcb3aa67d6",
|
|
87
|
+
"@dxos/plugin-client": "0.8.4-main.bcb3aa67d6",
|
|
88
|
+
"@dxos/plugin-markdown": "0.8.4-main.bcb3aa67d6",
|
|
89
|
+
"@dxos/plugin-graph": "0.8.4-main.bcb3aa67d6",
|
|
90
|
+
"@dxos/plugin-space": "0.8.4-main.bcb3aa67d6",
|
|
91
|
+
"@dxos/react-client": "0.8.4-main.bcb3aa67d6",
|
|
92
|
+
"@dxos/react-ui-gameboard": "0.8.4-main.bcb3aa67d6",
|
|
93
|
+
"@dxos/react-ui-mosaic": "0.8.4-main.bcb3aa67d6",
|
|
94
|
+
"@dxos/schema": "0.8.4-main.bcb3aa67d6",
|
|
95
|
+
"@dxos/util": "0.8.4-main.bcb3aa67d6",
|
|
96
|
+
"@dxos/types": "0.8.4-main.bcb3aa67d6",
|
|
97
|
+
"@dxos/react-ui-sfx": "0.8.4-main.bcb3aa67d6",
|
|
98
|
+
"@dxos/react-ui-stack": "0.8.4-main.bcb3aa67d6"
|
|
83
99
|
},
|
|
84
100
|
"devDependencies": {
|
|
85
101
|
"@types/react": "~19.2.7",
|
|
86
102
|
"@types/react-dom": "~19.2.3",
|
|
87
103
|
"react": "~19.2.3",
|
|
88
104
|
"react-dom": "~19.2.3",
|
|
89
|
-
"vite": "7.1.
|
|
90
|
-
"@dxos/
|
|
91
|
-
"@dxos/
|
|
92
|
-
"@dxos/storybook-utils": "0.8.4-main.
|
|
93
|
-
"@dxos/ui-theme": "0.8.4-main.
|
|
105
|
+
"vite": "^7.1.11",
|
|
106
|
+
"@dxos/react-ui": "0.8.4-main.bcb3aa67d6",
|
|
107
|
+
"@dxos/plugin-theme": "0.8.4-main.bcb3aa67d6",
|
|
108
|
+
"@dxos/storybook-utils": "0.8.4-main.bcb3aa67d6",
|
|
109
|
+
"@dxos/ui-theme": "0.8.4-main.bcb3aa67d6"
|
|
94
110
|
},
|
|
95
111
|
"peerDependencies": {
|
|
96
112
|
"react": "~19.2.3",
|
|
97
113
|
"react-dom": "~19.2.3",
|
|
98
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
99
|
-
"@dxos/ui-theme": "0.8.4-main.
|
|
114
|
+
"@dxos/react-ui": "0.8.4-main.bcb3aa67d6",
|
|
115
|
+
"@dxos/ui-theme": "0.8.4-main.bcb3aa67d6"
|
|
100
116
|
},
|
|
101
117
|
"publishConfig": {
|
|
102
118
|
"access": "public"
|
package/src/ChessPlugin.tsx
CHANGED
|
@@ -3,32 +3,47 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Option from 'effect/Option';
|
|
6
7
|
|
|
7
|
-
import {
|
|
8
|
+
import { Plugin } from '@dxos/app-framework';
|
|
9
|
+
import { AppPlugin } from '@dxos/app-toolkit';
|
|
10
|
+
import { Annotation } from '@dxos/echo';
|
|
11
|
+
import { Operation } from '@dxos/operation';
|
|
8
12
|
import { type CreateObject } from '@dxos/plugin-space/types';
|
|
13
|
+
import { SpaceOperation } from '@dxos/plugin-space/operations';
|
|
9
14
|
|
|
10
|
-
import { ChessBlueprint } from '
|
|
11
|
-
import {
|
|
12
|
-
import { meta } from './meta';
|
|
15
|
+
import { ChessBlueprint } from '#blueprints';
|
|
16
|
+
import { meta } from '#meta';
|
|
13
17
|
import { translations } from './translations';
|
|
14
|
-
import { Chess } from '
|
|
18
|
+
import { Chess } from '#types';
|
|
19
|
+
|
|
20
|
+
import { BlueprintDefinition, OperationHandler, ReactSurface } from '#capabilities';
|
|
15
21
|
|
|
16
22
|
export const ChessPlugin = Plugin.define(meta).pipe(
|
|
17
|
-
|
|
18
|
-
|
|
23
|
+
AppPlugin.addBlueprintDefinitionModule({ activate: BlueprintDefinition }),
|
|
24
|
+
AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),
|
|
25
|
+
AppPlugin.addMetadataModule({
|
|
19
26
|
metadata: {
|
|
20
27
|
id: Chess.Game.typename,
|
|
21
28
|
metadata: {
|
|
22
|
-
icon:
|
|
23
|
-
iconHue: '
|
|
24
|
-
blueprints: [ChessBlueprint.
|
|
25
|
-
createObject: ((props
|
|
26
|
-
|
|
29
|
+
icon: Annotation.IconAnnotation.get(Chess.Game).pipe(Option.getOrThrow).icon,
|
|
30
|
+
iconHue: Annotation.IconAnnotation.get(Chess.Game).pipe(Option.getOrThrow).hue ?? 'white',
|
|
31
|
+
blueprints: [ChessBlueprint.key],
|
|
32
|
+
createObject: ((props, options) =>
|
|
33
|
+
Effect.gen(function* () {
|
|
34
|
+
const object = Chess.make(props);
|
|
35
|
+
return yield* Operation.invoke(SpaceOperation.AddObject, {
|
|
36
|
+
object,
|
|
37
|
+
target: options.target,
|
|
38
|
+
hidden: true,
|
|
39
|
+
targetNodeId: options.targetNodeId,
|
|
40
|
+
});
|
|
41
|
+
})) satisfies CreateObject,
|
|
27
42
|
},
|
|
28
43
|
},
|
|
29
44
|
}),
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
45
|
+
AppPlugin.addSchemaModule({ schema: [Chess.Game] }),
|
|
46
|
+
AppPlugin.addSurfaceModule({ activate: ReactSurface }),
|
|
47
|
+
AppPlugin.addTranslationsModule({ translations }),
|
|
33
48
|
Plugin.make,
|
|
34
49
|
);
|
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { type AppCapabilities } from '@dxos/app-toolkit';
|
|
5
6
|
import { Blueprint, Template } from '@dxos/blueprints';
|
|
6
|
-
import { type FunctionDefinition } from '@dxos/functions';
|
|
7
7
|
import { trim } from '@dxos/util';
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { Create, Move, Play, Print } from '#operations';
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
const BLUEPRINT_KEY = 'org.dxos.blueprint.chess';
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
const operations = [Create, Move, Play, Print];
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
const make = () =>
|
|
16
16
|
Blueprint.make({
|
|
17
|
-
key:
|
|
17
|
+
key: BLUEPRINT_KEY,
|
|
18
18
|
name: 'Chess',
|
|
19
|
-
tools: Blueprint.toolDefinitions({
|
|
19
|
+
tools: Blueprint.toolDefinitions({ operations }),
|
|
20
20
|
instructions: Template.make({
|
|
21
21
|
source: trim`
|
|
22
22
|
You are an expert chess player.
|
|
@@ -26,3 +26,10 @@ export const make = () =>
|
|
|
26
26
|
`,
|
|
27
27
|
}),
|
|
28
28
|
});
|
|
29
|
+
|
|
30
|
+
const blueprint: AppCapabilities.BlueprintDefinition = {
|
|
31
|
+
key: BLUEPRINT_KEY,
|
|
32
|
+
make,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default blueprint;
|
package/src/blueprints/index.ts
CHANGED
package/src/capabilities/{artifact-definition/artifact-definition.ts → artifact-definition.ts}
RENAMED
|
@@ -15,12 +15,12 @@ import { ArtifactId, VersionPin, createArtifactElement } from '@dxos/assistant';
|
|
|
15
15
|
import { defineArtifact } from '@dxos/blueprints';
|
|
16
16
|
import { Obj } from '@dxos/echo';
|
|
17
17
|
import { invariant } from '@dxos/invariant';
|
|
18
|
-
import { SpaceOperation } from '@dxos/plugin-space/
|
|
18
|
+
import { SpaceOperation } from '@dxos/plugin-space/operations';
|
|
19
19
|
import { Filter, type Space } from '@dxos/react-client/echo';
|
|
20
20
|
import { trim } from '@dxos/util';
|
|
21
21
|
|
|
22
|
-
import { meta } from '
|
|
23
|
-
import { Chess } from '
|
|
22
|
+
import { meta } from '#meta';
|
|
23
|
+
import { Chess } from '#types';
|
|
24
24
|
|
|
25
25
|
// TODO(burdon): Factor out.
|
|
26
26
|
declare global {
|
|
@@ -121,8 +121,8 @@ export default Capability.makeModule(() =>
|
|
|
121
121
|
return ToolResult.Error(error.message);
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
Obj.change(game, (
|
|
125
|
-
|
|
124
|
+
Obj.change(game, (obj) => {
|
|
125
|
+
obj.pgn = chess.pgn();
|
|
126
126
|
});
|
|
127
127
|
return ToolResult.Success(game.pgn);
|
|
128
128
|
},
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
9
|
+
|
|
10
|
+
import { ChessBlueprint } from '#blueprints';
|
|
11
|
+
|
|
12
|
+
const blueprintDefinition = Capability.makeModule<
|
|
13
|
+
[],
|
|
14
|
+
Capability.Capability<typeof AppCapabilities.BlueprintDefinition>[]
|
|
15
|
+
>(() => Effect.succeed([Capability.contributes(AppCapabilities.BlueprintDefinition, ChessBlueprint)]));
|
|
16
|
+
|
|
17
|
+
export default blueprintDefinition;
|
|
@@ -2,5 +2,12 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import { Capability } from '@dxos/app-framework';
|
|
6
|
+
import { OperationHandlerSet } from '@dxos/operation';
|
|
7
|
+
|
|
8
|
+
export const BlueprintDefinition = Capability.lazy('BlueprintDefinition', () => import('./blueprint-definition'));
|
|
9
|
+
export const OperationHandler = Capability.lazy<OperationHandlerSet.OperationHandlerSet>(
|
|
10
|
+
'OperationHandler',
|
|
11
|
+
() => import('./operation-handler'),
|
|
12
|
+
);
|
|
13
|
+
export const ReactSurface = Capability.lazy('ReactSurface', () => import('./react-surface'));
|
|
@@ -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/operation';
|
|
7
|
+
|
|
8
|
+
import { ChessHandlers } from '#operations';
|
|
9
|
+
|
|
10
|
+
export default Capability.makeModule<OperationHandlerSet.OperationHandlerSet>(
|
|
11
|
+
Effect.fnUntraced(function* () {
|
|
12
|
+
return Capability.contributes(Capabilities.OperationHandler, ChessHandlers);
|
|
13
|
+
}),
|
|
14
|
+
);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
|
+
import { Surface } from '@dxos/app-framework/ui';
|
|
10
|
+
import { Obj } from '@dxos/echo';
|
|
11
|
+
|
|
12
|
+
import { ChessArticle, ChessCard } from '#containers';
|
|
13
|
+
import { meta } from '#meta';
|
|
14
|
+
import { Chess } from '#types';
|
|
15
|
+
|
|
16
|
+
export default Capability.makeModule(() =>
|
|
17
|
+
Effect.succeed(
|
|
18
|
+
Capability.contributes(Capabilities.ReactSurface, [
|
|
19
|
+
Surface.create({
|
|
20
|
+
id: meta.id,
|
|
21
|
+
role: ['article', 'section'],
|
|
22
|
+
filter: (data): data is { subject: Chess.Game } => Obj.instanceOf(Chess.Game, data.subject),
|
|
23
|
+
component: ({ data, role }) => <ChessArticle role={role} subject={data.subject} />,
|
|
24
|
+
}),
|
|
25
|
+
Surface.create({
|
|
26
|
+
id: meta.id,
|
|
27
|
+
role: ['card--content'],
|
|
28
|
+
filter: (data): data is { subject: Chess.Game } => Obj.instanceOf(Chess.Game, data.subject),
|
|
29
|
+
component: ({ data, role }) => <ChessCard role={role} subject={data.subject} />,
|
|
30
|
+
}),
|
|
31
|
+
]),
|
|
32
|
+
),
|
|
33
|
+
);
|
package/src/cli/plugin.ts
CHANGED
|
@@ -4,23 +4,34 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Plugin } from '@dxos/app-framework';
|
|
8
|
+
import { AppPlugin } from '@dxos/app-toolkit';
|
|
9
|
+
import { Operation } from '@dxos/operation';
|
|
8
10
|
import { type CreateObject } from '@dxos/plugin-space/types';
|
|
11
|
+
import { SpaceOperation } from '@dxos/plugin-space/operations';
|
|
9
12
|
|
|
10
|
-
import { meta } from '
|
|
11
|
-
import { Chess } from '
|
|
13
|
+
import { meta } from '#meta';
|
|
14
|
+
import { Chess } from '#types';
|
|
12
15
|
|
|
13
16
|
// TODO(wittjosiah): Factor out shared modules.
|
|
14
17
|
export const ChessPlugin = Plugin.define(meta).pipe(
|
|
15
|
-
|
|
16
|
-
Common.Plugin.addMetadataModule({
|
|
18
|
+
AppPlugin.addMetadataModule({
|
|
17
19
|
metadata: {
|
|
18
20
|
id: Chess.Game.typename,
|
|
19
21
|
metadata: {
|
|
20
|
-
createObject: ((props
|
|
21
|
-
|
|
22
|
+
createObject: ((props, options) =>
|
|
23
|
+
Effect.gen(function* () {
|
|
24
|
+
const object = Chess.make(props);
|
|
25
|
+
return yield* Operation.invoke(SpaceOperation.AddObject, {
|
|
26
|
+
object,
|
|
27
|
+
target: options.target,
|
|
28
|
+
hidden: true,
|
|
29
|
+
targetNodeId: options.targetNodeId,
|
|
30
|
+
});
|
|
31
|
+
})) satisfies CreateObject,
|
|
22
32
|
},
|
|
23
33
|
},
|
|
24
34
|
}),
|
|
35
|
+
AppPlugin.addSchemaModule({ schema: [Chess.Game] }),
|
|
25
36
|
Plugin.make,
|
|
26
37
|
);
|
|
@@ -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 { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
10
|
+
import { type Player } from '@dxos/react-ui-gameboard';
|
|
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 game = 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 game={game} 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
|
+
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { RegistryContext } from '@effect-atom/atom-react';
|
|
6
6
|
import React, {
|
|
7
7
|
type PropsWithChildren,
|
|
8
8
|
forwardRef,
|
|
@@ -15,10 +15,10 @@ import React, {
|
|
|
15
15
|
} from 'react';
|
|
16
16
|
|
|
17
17
|
import { addEventListener } from '@dxos/async';
|
|
18
|
-
import {
|
|
18
|
+
import { useObject } from '@dxos/echo-react';
|
|
19
19
|
import { type ThemedClassName } from '@dxos/react-ui';
|
|
20
20
|
import {
|
|
21
|
-
ChessModel,
|
|
21
|
+
type ChessModel,
|
|
22
22
|
Gameboard,
|
|
23
23
|
type GameboardRootProps,
|
|
24
24
|
Chessboard as NaturalChessboard,
|
|
@@ -27,25 +27,16 @@ 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';
|
|
34
|
+
import { ExtendedChessModel } from './types';
|
|
35
35
|
|
|
36
36
|
export interface ChessboardController {
|
|
37
37
|
setMoveNumber(index: number): void;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
export class ExtendedChessModel extends ChessModel {
|
|
41
|
-
constructor(
|
|
42
|
-
registry: Registry.Registry,
|
|
43
|
-
readonly object: Chess.Game,
|
|
44
|
-
) {
|
|
45
|
-
super(registry);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
40
|
//
|
|
50
41
|
// Root
|
|
51
42
|
//
|
|
@@ -58,6 +49,7 @@ const Root = forwardRef<ChessboardController, RootProps>(({ game, children }, fo
|
|
|
58
49
|
const registry = useContext(RegistryContext);
|
|
59
50
|
const model = useMemo(() => new ExtendedChessModel(registry, game), [registry]);
|
|
60
51
|
const click = useSoundEffect('Click');
|
|
52
|
+
const [pgn, updatePgn] = useObject(game, 'pgn');
|
|
61
53
|
|
|
62
54
|
// Controller.
|
|
63
55
|
useImperativeHandle(forwardedRef, () => {
|
|
@@ -66,17 +58,21 @@ const Root = forwardRef<ChessboardController, RootProps>(({ game, children }, fo
|
|
|
66
58
|
};
|
|
67
59
|
}, [model]);
|
|
68
60
|
|
|
61
|
+
// TODO(wittjosiah): Rather than useEffect to sync ECHO object to model, create an alternative model implementation.
|
|
62
|
+
// This model would take the ECHO object and derive game state directly from that.
|
|
63
|
+
// Mutation methods would mutate the ECHO object and other state would be derived from that.
|
|
64
|
+
|
|
69
65
|
// External change.
|
|
70
66
|
// NOTE: Warning if user has not interacted with the board.
|
|
71
67
|
useEffect(() => {
|
|
72
|
-
if (model.pgn !== getRawPgn(
|
|
68
|
+
if (model.pgn !== getRawPgn(pgn ?? '')) {
|
|
73
69
|
const silent = model.pgn === '*';
|
|
74
|
-
model.update(
|
|
70
|
+
model.update(pgn);
|
|
75
71
|
if (!silent) {
|
|
76
72
|
void click.play();
|
|
77
73
|
}
|
|
78
74
|
}
|
|
79
|
-
}, [
|
|
75
|
+
}, [pgn]);
|
|
80
76
|
|
|
81
77
|
// Move.
|
|
82
78
|
const handleDrop = useCallback<NonNullable<GameboardRootProps<ChessModel>['onDrop']>>(
|
|
@@ -86,9 +82,7 @@ const Root = forwardRef<ChessboardController, RootProps>(({ game, children }, fo
|
|
|
86
82
|
}
|
|
87
83
|
|
|
88
84
|
void click.play();
|
|
89
|
-
|
|
90
|
-
g.pgn = model.pgn;
|
|
91
|
-
});
|
|
85
|
+
updatePgn(() => model.pgn);
|
|
92
86
|
return true;
|
|
93
87
|
},
|
|
94
88
|
[model],
|
|
@@ -105,17 +99,13 @@ const Root = forwardRef<ChessboardController, RootProps>(({ game, children }, fo
|
|
|
105
99
|
// Content
|
|
106
100
|
//
|
|
107
101
|
|
|
108
|
-
type Role = 'card--
|
|
102
|
+
type Role = 'card--content';
|
|
109
103
|
|
|
110
104
|
type ContentProps = ThemedClassName<PropsWithChildren<{ role?: Role }>>;
|
|
111
105
|
|
|
112
|
-
const Content = ({ classNames, children
|
|
106
|
+
const Content = ({ classNames, children }: ContentProps) => {
|
|
113
107
|
return (
|
|
114
|
-
<Gameboard.Content
|
|
115
|
-
classNames={mx(classNames, role === 'card--popover' && 'size-container popover-square')}
|
|
116
|
-
grow={!role || role === 'card--extrinsic'}
|
|
117
|
-
contain={!role || role === 'card--extrinsic' || role === 'card--popover'}
|
|
118
|
-
>
|
|
108
|
+
<Gameboard.Content grow contain classNames={classNames}>
|
|
119
109
|
{children}
|
|
120
110
|
</Gameboard.Content>
|
|
121
111
|
);
|
|
@@ -125,11 +115,13 @@ const Content = ({ classNames, children, role }: ContentProps) => {
|
|
|
125
115
|
// Board
|
|
126
116
|
//
|
|
127
117
|
|
|
118
|
+
const BOARD_NAME = 'Chessboard.Board';
|
|
119
|
+
|
|
128
120
|
type BoardProps = NaturalChessboardProps;
|
|
129
121
|
|
|
130
122
|
const Board = (props: BoardProps) => {
|
|
131
123
|
const registry = useContext(RegistryContext);
|
|
132
|
-
const { model } = useGameboardContext<ChessModel>(
|
|
124
|
+
const { model } = useGameboardContext<ChessModel>(BOARD_NAME);
|
|
133
125
|
|
|
134
126
|
// Keyboard navigation.
|
|
135
127
|
const ref = useRef<HTMLDivElement>(null);
|
|
@@ -164,10 +156,10 @@ const Board = (props: BoardProps) => {
|
|
|
164
156
|
});
|
|
165
157
|
}, [registry, model]);
|
|
166
158
|
|
|
167
|
-
return <NaturalChessboard ref={ref}
|
|
159
|
+
return <NaturalChessboard {...props} ref={ref} />;
|
|
168
160
|
};
|
|
169
161
|
|
|
170
|
-
Board.displayName =
|
|
162
|
+
Board.displayName = BOARD_NAME;
|
|
171
163
|
|
|
172
164
|
//
|
|
173
165
|
// Chessboard
|