@dxos/plugin-chess 0.8.4-main.422d1c7879 → 0.8.4-main.43cb759274
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +102 -5
- package/PLUGIN.mdl +526 -0
- package/README.md +1 -1
- 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 +10 -0
- package/dist/lib/neutral/ChessPlugin.node.mjs +23 -0
- package/dist/lib/neutral/ChessPlugin.node.mjs.map +7 -0
- package/dist/lib/neutral/ChessPlugin.workerd.mjs +21 -0
- package/dist/lib/neutral/ChessPlugin.workerd.mjs.map +7 -0
- package/dist/lib/neutral/blueprint-definition-PZXHAYLD.mjs +15 -0
- 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-7XZ4CRDL.mjs +32 -0
- package/dist/lib/neutral/chunk-7XZ4CRDL.mjs.map +7 -0
- package/dist/lib/neutral/chunk-KMHQCP7J.mjs +148 -0
- package/dist/lib/neutral/chunk-KMHQCP7J.mjs.map +7 -0
- package/dist/lib/neutral/chunk-PJOAFP6S.mjs +41 -0
- package/dist/lib/neutral/chunk-PJOAFP6S.mjs.map +7 -0
- package/dist/lib/neutral/chunk-W2JSKHJK.mjs +8 -0
- package/dist/lib/neutral/chunk-W2JSKHJK.mjs.map +7 -0
- package/dist/lib/{browser/chunk-MC7L6JNC.mjs → neutral/chunk-XWKNXG62.mjs} +8 -10
- package/dist/lib/neutral/chunk-XWKNXG62.mjs.map +7 -0
- package/dist/lib/{browser → neutral/components}/index.mjs +8 -158
- 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-UMYAK7LT.mjs +41 -0
- package/dist/lib/neutral/game-variant-UMYAK7LT.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-ORBNYB2H.mjs +37 -0
- package/dist/lib/neutral/move-ORBNYB2H.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-QJCLEC27.mjs +46 -0
- package/dist/lib/neutral/play-QJCLEC27.mjs.map +7 -0
- package/dist/lib/neutral/plugin.mjs +16 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/{browser/print-EW7LPW4D.mjs → neutral/print-ILCRJUYI.mjs} +5 -6
- package/dist/lib/neutral/print-ILCRJUYI.mjs.map +7 -0
- package/dist/lib/neutral/testing.mjs +8 -0
- package/dist/lib/neutral/translations.mjs +35 -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/{cli/plugin.d.ts → ChessPlugin.workerd.d.ts} +2 -1
- package/dist/types/src/ChessPlugin.workerd.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 +2 -2
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
- 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 +3 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -1
- package/dist/types/src/components/Chessboard/Chessboard.d.ts +6 -2
- package/dist/types/src/components/Chessboard/Chessboard.d.ts.map +1 -1
- package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts +32 -23
- package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts.map +1 -1
- 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 +2 -2
- 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 +32 -23
- package/dist/types/src/containers/ChessArticle/ChessArticle.stories.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/index.d.ts +0 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/index.d.ts +2 -3
- package/dist/types/src/operations/index.d.ts.map +1 -1
- package/dist/types/src/operations/move.d.ts +3 -3
- package/dist/types/src/operations/move.d.ts.map +1 -1
- package/dist/types/src/operations/play.d.ts +3 -3
- package/dist/types/src/operations/play.d.ts.map +1 -1
- package/dist/types/src/operations/print.d.ts +3 -3
- package/dist/types/src/operations/print.d.ts.map +1 -1
- package/dist/types/src/plugin.d.ts +4 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/testing.d.ts +2 -0
- package/dist/types/src/testing.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +32 -24
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Chess.d.ts +10 -20
- package/dist/types/src/types/Chess.d.ts.map +1 -1
- package/dist/types/src/types/ChessOperation.d.ts +29 -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 +97 -62
- package/src/ChessPlugin.node.ts +23 -0
- package/src/ChessPlugin.test.ts +14 -15
- package/src/ChessPlugin.tsx +15 -32
- package/src/ChessPlugin.workerd.ts +18 -0
- package/src/blueprints/chess-blueprint.ts +6 -9
- package/src/blueprints/index.ts +0 -1
- package/src/capabilities/blueprint-definition.ts +2 -0
- package/src/capabilities/game-variant.ts +43 -0
- package/src/capabilities/index.ts +3 -2
- package/src/capabilities/operation-handler.ts +3 -3
- package/src/components/Chessboard/Chessboard.stories.tsx +3 -3
- package/src/components/Chessboard/Chessboard.tsx +4 -4
- package/src/components/Chessboard/Info.tsx +3 -63
- package/src/components/Chessboard/types.ts +1 -1
- package/src/containers/ChessArticle/ChessArticle.stories.tsx +9 -3
- package/src/containers/ChessArticle/ChessArticle.tsx +45 -10
- package/src/containers/ChessCard/ChessCard.stories.tsx +7 -2
- package/src/containers/ChessCard/ChessCard.tsx +10 -5
- package/src/index.ts +0 -3
- package/src/meta.ts +10 -4
- package/src/operations/index.ts +2 -7
- package/src/operations/move.ts +13 -13
- package/src/operations/play.ts +14 -14
- package/src/operations/print.ts +3 -3
- package/src/plugin.ts +11 -0
- package/src/testing.ts +7 -0
- package/src/translations.ts +7 -10
- package/src/types/Chess.ts +21 -30
- package/src/{operations/definitions.ts → types/ChessOperation.ts} +16 -37
- package/src/types/index.ts +1 -0
- package/src/vite-env.d.ts +10 -0
- package/dist/lib/browser/blueprints/index.mjs +0 -14
- package/dist/lib/browser/chunk-2TJN26DN.mjs +0 -67
- package/dist/lib/browser/chunk-2TJN26DN.mjs.map +0 -7
- package/dist/lib/browser/chunk-JZMN24DY.mjs +0 -28
- package/dist/lib/browser/chunk-JZMN24DY.mjs.map +0 -7
- package/dist/lib/browser/chunk-MC7L6JNC.mjs.map +0 -7
- package/dist/lib/browser/chunk-XAJZK6Z2.mjs +0 -110
- package/dist/lib/browser/chunk-XAJZK6Z2.mjs.map +0 -7
- package/dist/lib/browser/cli/index.mjs +0 -34
- package/dist/lib/browser/cli/index.mjs.map +0 -7
- package/dist/lib/browser/create-AJHN4QT4.mjs +0 -24
- package/dist/lib/browser/create-AJHN4QT4.mjs.map +0 -7
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/move-T2NLRBR4.mjs +0 -36
- package/dist/lib/browser/move-T2NLRBR4.mjs.map +0 -7
- package/dist/lib/browser/operations/index.mjs +0 -19
- package/dist/lib/browser/play-7VTMD3SJ.mjs +0 -45
- package/dist/lib/browser/play-7VTMD3SJ.mjs.map +0 -7
- package/dist/lib/browser/print-EW7LPW4D.mjs.map +0 -7
- package/dist/lib/node-esm/blueprints/index.mjs +0 -15
- package/dist/lib/node-esm/chunk-4HZWCKMR.mjs +0 -38
- package/dist/lib/node-esm/chunk-4HZWCKMR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
- package/dist/lib/node-esm/chunk-LQEDIKCV.mjs +0 -29
- package/dist/lib/node-esm/chunk-LQEDIKCV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-NYU5JVXP.mjs +0 -111
- package/dist/lib/node-esm/chunk-NYU5JVXP.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-OIRJVY2R.mjs +0 -68
- package/dist/lib/node-esm/chunk-OIRJVY2R.mjs.map +0 -7
- package/dist/lib/node-esm/cli/index.mjs +0 -35
- package/dist/lib/node-esm/cli/index.mjs.map +0 -7
- package/dist/lib/node-esm/create-QSETDT4N.mjs +0 -25
- package/dist/lib/node-esm/create-QSETDT4N.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -390
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/move-5F2ANDTE.mjs +0 -37
- package/dist/lib/node-esm/move-5F2ANDTE.mjs.map +0 -7
- package/dist/lib/node-esm/operations/index.mjs +0 -20
- package/dist/lib/node-esm/play-W4DQCQRX.mjs +0 -46
- package/dist/lib/node-esm/play-W4DQCQRX.mjs.map +0 -7
- package/dist/lib/node-esm/print-UJHXAXMS.mjs +0 -31
- package/dist/lib/node-esm/print-UJHXAXMS.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -9
- package/dist/types/src/capabilities/artifact-definition.d.ts +0 -12
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -5
- package/dist/types/src/capabilities/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/dist/types/src/operations/create.d.ts +0 -5
- package/dist/types/src/operations/create.d.ts.map +0 -1
- package/dist/types/src/operations/definitions.d.ts +0 -51
- package/dist/types/src/operations/definitions.d.ts.map +0 -1
- package/src/capabilities/artifact-definition.ts +0 -135
- package/src/capabilities/react-surface.tsx +0 -35
- package/src/cli/index.ts +0 -5
- package/src/cli/plugin.ts +0 -37
- package/src/operations/create.ts +0 -21
- /package/dist/lib/{browser/blueprints/index.mjs.map → neutral/ChessPlugin.mjs.map} +0 -0
- /package/dist/lib/{browser/operations → 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/{node-esm/blueprints/index.mjs.map → neutral/meta.mjs.map} +0 -0
- /package/dist/lib/{node-esm → neutral}/operations/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/chunk-HSLMI22Q.mjs.map → neutral/testing.mjs.map} +0 -0
- /package/dist/lib/{node-esm → neutral}/types/index.mjs.map +0 -0
package/LICENSE
CHANGED
|
@@ -1,8 +1,105 @@
|
|
|
1
|
-
|
|
2
|
-
Copyright (c) 2022 DXOS
|
|
1
|
+
# Functional Source License, Version 1.1, ALv2 Future License
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
## Abbreviation
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
FSL-1.1-Apache-2.0
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2026 DXOS
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
+
means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Grant of Future License
|
|
88
|
+
|
|
89
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
+
the Apache License, Version 2.0 that is effective on the second anniversary of
|
|
91
|
+
the date we make the Software available. On or after that date, you may use the
|
|
92
|
+
Software under the Apache License, Version 2.0, in which case the following
|
|
93
|
+
will apply:
|
|
94
|
+
|
|
95
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
96
|
+
this file except in compliance with the License.
|
|
97
|
+
|
|
98
|
+
You may obtain a copy of the License at
|
|
99
|
+
|
|
100
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
101
|
+
|
|
102
|
+
Unless required by applicable law or agreed to in writing, software distributed
|
|
103
|
+
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
104
|
+
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
105
|
+
specific language governing permissions and limitations under the License.
|
package/PLUGIN.mdl
ADDED
|
@@ -0,0 +1,526 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: org.dxos.plugin.chess
|
|
3
|
+
name: ChessPlugin
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
A two-player chess game plugin for `DXOS` Composer.
|
|
8
|
+
|
|
9
|
+
## Extensions
|
|
10
|
+
|
|
11
|
+
The following extension dialects are used in this document.
|
|
12
|
+
Each extension is defined in the Appendix or resolved via its URI.
|
|
13
|
+
|
|
14
|
+
| Term | URI |
|
|
15
|
+
|-------------|--------------------------------|
|
|
16
|
+
| `type` | `org.dxos.mdl.type@1.0` |
|
|
17
|
+
| `feat` | `org.dxos.mdl.feat@1.0` |
|
|
18
|
+
| `test` | `org.dxos.mdl.test@1.0` |
|
|
19
|
+
| `component` | `org.dxos.mdl.component@1.0` |
|
|
20
|
+
| `op` | `org.dxos.mdl.op@1.0` |
|
|
21
|
+
| `service` | `org.dxos.mdl.service@1.0` |
|
|
22
|
+
|
|
23
|
+
## Types
|
|
24
|
+
|
|
25
|
+
```mdl
|
|
26
|
+
type Color
|
|
27
|
+
literals: white | black
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
```mdl
|
|
31
|
+
type PieceKind
|
|
32
|
+
literals: pawn | rook | knight | bishop | queen | king
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
```mdl
|
|
36
|
+
type Piece
|
|
37
|
+
fields:
|
|
38
|
+
kind: PieceKind
|
|
39
|
+
color: Color
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
```mdl
|
|
43
|
+
type Square
|
|
44
|
+
fields:
|
|
45
|
+
file: a | b | c | d | e | f | g | h
|
|
46
|
+
rank: 1..8
|
|
47
|
+
piece?: Piece
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
```mdl
|
|
51
|
+
type Move
|
|
52
|
+
fields:
|
|
53
|
+
from: Square
|
|
54
|
+
to: Square
|
|
55
|
+
promotion?: PieceKind # only valid for pawn reaching back rank
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
```mdl
|
|
59
|
+
type Board
|
|
60
|
+
fields:
|
|
61
|
+
squares: Square[8][8]
|
|
62
|
+
turn: Color
|
|
63
|
+
status: playing | check | checkmate | stalemate
|
|
64
|
+
moves: Move[] # full move history
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
```mdl
|
|
68
|
+
type Player
|
|
69
|
+
fields:
|
|
70
|
+
id: string
|
|
71
|
+
name: string
|
|
72
|
+
color: Color
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
```mdl
|
|
76
|
+
type GameStatus
|
|
77
|
+
literals: waiting | active | finished
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
```mdl
|
|
81
|
+
type Game
|
|
82
|
+
fields:
|
|
83
|
+
id: string
|
|
84
|
+
players: Player[2]
|
|
85
|
+
board: Board
|
|
86
|
+
status: GameStatus
|
|
87
|
+
winner?: Player
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Components
|
|
91
|
+
|
|
92
|
+
```mdl
|
|
93
|
+
component Lobby
|
|
94
|
+
desc: Entry point where players create or join a game.
|
|
95
|
+
props:
|
|
96
|
+
playerId: string
|
|
97
|
+
state:
|
|
98
|
+
games: Game[] # list of open/active games
|
|
99
|
+
selected?: Game
|
|
100
|
+
slots:
|
|
101
|
+
header?: ReactNode
|
|
102
|
+
empty?: ReactNode # shown when games list is empty
|
|
103
|
+
actions:
|
|
104
|
+
createGame() → Game
|
|
105
|
+
joinGame(game: Game) → Game
|
|
106
|
+
spectate(game: Game)
|
|
107
|
+
emits:
|
|
108
|
+
onJoin(game: Game)
|
|
109
|
+
layout: |
|
|
110
|
+
┌─────────────────────────┐
|
|
111
|
+
│ [header slot] │
|
|
112
|
+
├─────────────────────────┤
|
|
113
|
+
│ Game list │
|
|
114
|
+
│ ┌───────────────────┐ │
|
|
115
|
+
│ │ game row │ │
|
|
116
|
+
│ └───────────────────┘ │
|
|
117
|
+
│ [empty slot] │
|
|
118
|
+
├─────────────────────────┤
|
|
119
|
+
│ [Create Game] │
|
|
120
|
+
└─────────────────────────┘
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
```mdl
|
|
124
|
+
component Gameboard
|
|
125
|
+
desc: Interactive chess board for an active game.
|
|
126
|
+
props:
|
|
127
|
+
game: Game
|
|
128
|
+
playerId: string # identifies which side the viewer plays
|
|
129
|
+
state:
|
|
130
|
+
selected?: Square # currently selected square
|
|
131
|
+
highlights: Square[] # legal move targets for selected piece
|
|
132
|
+
perspective: Color # which side is at the bottom (default: player's color)
|
|
133
|
+
slots:
|
|
134
|
+
toolbar?: ReactNode
|
|
135
|
+
sidebar?: ReactNode
|
|
136
|
+
overlay?: ReactNode # e.g. checkmate / promotion dialogs
|
|
137
|
+
actions:
|
|
138
|
+
selectSquare(square: Square)
|
|
139
|
+
submitMove(move: Move)
|
|
140
|
+
flipBoard()
|
|
141
|
+
emits:
|
|
142
|
+
onMove(move: Move)
|
|
143
|
+
onResign()
|
|
144
|
+
layout: |
|
|
145
|
+
┌─────────────────────────┐
|
|
146
|
+
│ [toolbar slot] │
|
|
147
|
+
├──────────┬──────────────┤
|
|
148
|
+
│ │ [sidebar] │
|
|
149
|
+
│ 8×8 │ │
|
|
150
|
+
│ board │ move history │
|
|
151
|
+
│ │ │
|
|
152
|
+
├──────────┴──────────────┤
|
|
153
|
+
│ [overlay slot] │
|
|
154
|
+
└─────────────────────────┘
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Services
|
|
158
|
+
|
|
159
|
+
```mdl
|
|
160
|
+
service ChessEngine
|
|
161
|
+
desc: Validates moves and computes game state. May be local (WASM) or remote.
|
|
162
|
+
loading: lazy
|
|
163
|
+
ops:
|
|
164
|
+
validate(board: Board, move: Move) → Move
|
|
165
|
+
legalMoves(board: Board, square: Square) → Square[]
|
|
166
|
+
applyMove(board: Board, move: Move) → Board
|
|
167
|
+
errors:
|
|
168
|
+
EngineNotReady: engine has not finished loading
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
```mdl
|
|
172
|
+
service GameStore
|
|
173
|
+
desc: Persists and replicates Game state via ECHO.
|
|
174
|
+
ops:
|
|
175
|
+
create(white: Player, black: Player) → Game
|
|
176
|
+
load(id: string) → Game
|
|
177
|
+
save(game: Game) → Game
|
|
178
|
+
list() → Game[]
|
|
179
|
+
effects: [echo:write, echo:read]
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Operations
|
|
183
|
+
|
|
184
|
+
Pure operations (no effects, no service dependencies) — safe to call anywhere.
|
|
185
|
+
|
|
186
|
+
```mdl
|
|
187
|
+
op getLegalMoves
|
|
188
|
+
desc: Returns legal target squares for the piece on the given square.
|
|
189
|
+
input:
|
|
190
|
+
board: Board
|
|
191
|
+
square: Square
|
|
192
|
+
output: Square[]
|
|
193
|
+
errors:
|
|
194
|
+
EmptySquare: no piece on square
|
|
195
|
+
WrongSide: piece does not belong to the active side
|
|
196
|
+
requires: [ChessEngine]
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
```mdl
|
|
200
|
+
op validateMove
|
|
201
|
+
desc: Checks a move against chess rules without mutating state.
|
|
202
|
+
input:
|
|
203
|
+
board: Board
|
|
204
|
+
move: Move
|
|
205
|
+
output: Move
|
|
206
|
+
errors:
|
|
207
|
+
IllegalMove: move violates chess rules
|
|
208
|
+
WrongTurn: piece does not belong to the active side
|
|
209
|
+
GameOver: game has already ended
|
|
210
|
+
requires: [ChessEngine]
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
```mdl
|
|
214
|
+
op applyMove
|
|
215
|
+
desc: Applies a validated move and returns the next board state.
|
|
216
|
+
input:
|
|
217
|
+
board: Board
|
|
218
|
+
move: Move # must be pre-validated
|
|
219
|
+
output: Board
|
|
220
|
+
requires: [ChessEngine]
|
|
221
|
+
note: does not persist; use submitMove for the full transactional flow
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
Effectful operations — mutate persistent state.
|
|
225
|
+
|
|
226
|
+
```mdl
|
|
227
|
+
op startGame
|
|
228
|
+
desc: Creates a new Game with two players and an initial Board.
|
|
229
|
+
input:
|
|
230
|
+
white: Player
|
|
231
|
+
black: Player
|
|
232
|
+
output: Game
|
|
233
|
+
effects: [echo:write]
|
|
234
|
+
requires: [GameStore]
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
```mdl
|
|
238
|
+
op submitMove
|
|
239
|
+
desc: Validates and applies a move, then persists the updated Game.
|
|
240
|
+
input:
|
|
241
|
+
game: Game
|
|
242
|
+
player: Player
|
|
243
|
+
move: Move
|
|
244
|
+
output: Game
|
|
245
|
+
errors:
|
|
246
|
+
WrongTurn: player is not the active side
|
|
247
|
+
IllegalMove: move violates chess rules
|
|
248
|
+
GameOver: game has already ended
|
|
249
|
+
effects: [echo:write]
|
|
250
|
+
requires: [ChessEngine, GameStore]
|
|
251
|
+
note: |
|
|
252
|
+
Composes validateMove → applyMove → GameStore.save.
|
|
253
|
+
Atomic: Game is not persisted if validation fails.
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
```mdl
|
|
257
|
+
op resignGame
|
|
258
|
+
desc: Player forfeits; opponent wins.
|
|
259
|
+
input:
|
|
260
|
+
game: Game
|
|
261
|
+
player: Player
|
|
262
|
+
output: Game # Game.status === finished, Game.winner set
|
|
263
|
+
errors:
|
|
264
|
+
GameOver: game has already ended
|
|
265
|
+
effects: [echo:write]
|
|
266
|
+
requires: [GameStore]
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
## Features
|
|
270
|
+
|
|
271
|
+
```mdl
|
|
272
|
+
feat F-1: Start Game
|
|
273
|
+
|
|
274
|
+
req F-1.1: New Board created with pieces in standard starting positions.
|
|
275
|
+
req F-1.2: White moves first.
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
```mdl
|
|
279
|
+
feat F-2: Make Move
|
|
280
|
+
|
|
281
|
+
req F-2.1:
|
|
282
|
+
when: player submits a Move on their turn
|
|
283
|
+
then: Move validated against chess rules
|
|
284
|
+
errors: [InvalidMove, WrongTurn, GameOver]
|
|
285
|
+
|
|
286
|
+
req F-2.2:
|
|
287
|
+
when: Move is valid
|
|
288
|
+
then: Board updated; turn advances to opponent
|
|
289
|
+
|
|
290
|
+
req F-2.3:
|
|
291
|
+
when: resulting position leaves opponent's king in check
|
|
292
|
+
then: Board.status set to check
|
|
293
|
+
|
|
294
|
+
req F-2.4:
|
|
295
|
+
when: no legal moves remain for the side to move
|
|
296
|
+
then: Board.status set to checkmate (if in check) or stalemate
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
```mdl
|
|
300
|
+
feat F-3: Lobby
|
|
301
|
+
|
|
302
|
+
req F-3.1: Player sees list of open games on entering the Lobby.
|
|
303
|
+
req F-3.2:
|
|
304
|
+
when: player creates a game
|
|
305
|
+
then: new Game created with status waiting; player assigned white
|
|
306
|
+
|
|
307
|
+
req F-3.3:
|
|
308
|
+
when: second player joins an open game
|
|
309
|
+
then: Game.status transitions to active; joining player assigned black
|
|
310
|
+
|
|
311
|
+
req F-3.4:
|
|
312
|
+
when: Game.status becomes active
|
|
313
|
+
then: both players navigated to Gameboard
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
```mdl
|
|
317
|
+
feat F-4: Gameboard
|
|
318
|
+
|
|
319
|
+
req F-4.1:
|
|
320
|
+
when: player selects a square containing their piece
|
|
321
|
+
then: legal move targets highlighted on board
|
|
322
|
+
|
|
323
|
+
req F-4.2:
|
|
324
|
+
when: player selects a highlighted target square
|
|
325
|
+
then: Move submitted via submitMove(); board updated on success
|
|
326
|
+
|
|
327
|
+
req F-4.3:
|
|
328
|
+
when: pawn reaches the back rank
|
|
329
|
+
then: promotion dialog shown via overlay slot; player selects piece kind
|
|
330
|
+
|
|
331
|
+
req F-4.4:
|
|
332
|
+
when: Game.status is finished
|
|
333
|
+
then: result overlay shown (winner or draw); further moves disabled
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
```mdl
|
|
337
|
+
feat F-5: Move Validation
|
|
338
|
+
|
|
339
|
+
req F-5.1:
|
|
340
|
+
when: Gameboard calls submitMove
|
|
341
|
+
then: op:validateMove runs before any state change
|
|
342
|
+
|
|
343
|
+
req F-5.2:
|
|
344
|
+
when: validation fails
|
|
345
|
+
then: error returned to caller; Game state unchanged
|
|
346
|
+
|
|
347
|
+
req F-5.3:
|
|
348
|
+
when: square is selected on Gameboard
|
|
349
|
+
then: op:getLegalMoves called; results drive component:Gameboard.highlights
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
```mdl
|
|
353
|
+
feat F-6: Game Persistence
|
|
354
|
+
|
|
355
|
+
req F-6.1:
|
|
356
|
+
when: op:startGame completes
|
|
357
|
+
then: Game written to ECHO and visible in component:Lobby game list
|
|
358
|
+
|
|
359
|
+
req F-6.2:
|
|
360
|
+
when: op:submitMove completes
|
|
361
|
+
then: updated Game replicated to all peers via ECHO
|
|
362
|
+
|
|
363
|
+
req F-6.3:
|
|
364
|
+
when: peer receives a Game update
|
|
365
|
+
then: component:Gameboard re-renders with new Board state
|
|
366
|
+
tags: [collaborative]
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
## Acceptance
|
|
370
|
+
|
|
371
|
+
```mdl
|
|
372
|
+
test T-1: New game starting position
|
|
373
|
+
given: a new game is started
|
|
374
|
+
then:
|
|
375
|
+
- Board.turn === white
|
|
376
|
+
- Board.status === playing
|
|
377
|
+
- each player has 16 pieces in standard positions
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
```mdl
|
|
381
|
+
test T-2: Illegal move rejected
|
|
382
|
+
given: it is white's turn
|
|
383
|
+
when: white attempts to move a black piece
|
|
384
|
+
then: WrongTurn error; Board unchanged
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
```mdl
|
|
388
|
+
test T-3: Create and join game
|
|
389
|
+
given: two players are in the Lobby
|
|
390
|
+
when: player A creates a game, player B joins it
|
|
391
|
+
then:
|
|
392
|
+
- Game.status === active
|
|
393
|
+
- Game.players[0].color === white # creator
|
|
394
|
+
- Game.players[1].color === black # joiner
|
|
395
|
+
- both players see the Gameboard
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
```mdl
|
|
399
|
+
test T-4: Legal move highlight
|
|
400
|
+
given: Gameboard is shown, it is white's turn
|
|
401
|
+
when: white selects the e2 pawn
|
|
402
|
+
then:
|
|
403
|
+
- squares e3 and e4 are highlighted
|
|
404
|
+
- no other squares are highlighted
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
```mdl
|
|
408
|
+
test T-5: Pawn promotion
|
|
409
|
+
given: white pawn is on e7, it is white's turn
|
|
410
|
+
when: white moves pawn to e8
|
|
411
|
+
then:
|
|
412
|
+
- promotion overlay appears
|
|
413
|
+
- after player selects queen, Move recorded with promotion: queen
|
|
414
|
+
- board shows white queen on e8
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
```mdl
|
|
418
|
+
test T-6: Submit valid move
|
|
419
|
+
given: active game, white's turn, white player logged in
|
|
420
|
+
when: white submits pawn e2→e4
|
|
421
|
+
then:
|
|
422
|
+
- op:validateMove returns move without error
|
|
423
|
+
- Board updated: e4 occupied by white pawn, e2 empty
|
|
424
|
+
- Game.board.turn === black
|
|
425
|
+
- Game persisted to ECHO
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
```mdl
|
|
429
|
+
test T-7: Submit invalid move rejected atomically
|
|
430
|
+
given: active game, white's turn
|
|
431
|
+
when: white submits an illegal move (e2→e5)
|
|
432
|
+
then:
|
|
433
|
+
- IllegalMove error returned
|
|
434
|
+
- Game.board unchanged
|
|
435
|
+
- no ECHO write occurs
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
```mdl
|
|
439
|
+
test T-8: Legal moves highlighted
|
|
440
|
+
given: new game, white's turn, Gameboard shown
|
|
441
|
+
when: player selects e2
|
|
442
|
+
then:
|
|
443
|
+
- op:getLegalMoves returns [e3, e4]
|
|
444
|
+
- Gameboard.highlights === [e3, e4]
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
---
|
|
448
|
+
|
|
449
|
+
## Appendix: Extension Definitions
|
|
450
|
+
|
|
451
|
+
Extension block types used in this document are defined below using
|
|
452
|
+
the core `ext` primitive — the only construct the base language provides.
|
|
453
|
+
|
|
454
|
+
```mdl
|
|
455
|
+
ext type
|
|
456
|
+
uri: dxos.spec/ext/type@1.0
|
|
457
|
+
desc: A named data structure with typed fields and optional literals.
|
|
458
|
+
fields:
|
|
459
|
+
desc?: Prose
|
|
460
|
+
fields?: FieldMap # name[?]: TypeExpr (# inline comment)
|
|
461
|
+
literals?: UnionList # a | b | c
|
|
462
|
+
extends?: TypeRef[]
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
```mdl
|
|
466
|
+
ext feat
|
|
467
|
+
uri: dxos.spec/ext/feat@1.0
|
|
468
|
+
desc: A named feature grouping one or more requirements.
|
|
469
|
+
fields:
|
|
470
|
+
desc?: Prose
|
|
471
|
+
req: RequirementList
|
|
472
|
+
nesting: self # feat blocks may contain feat blocks
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
```mdl
|
|
476
|
+
ext test
|
|
477
|
+
uri: dxos.spec/ext/test@1.0
|
|
478
|
+
desc: An acceptance scenario expressed as given / when / then steps.
|
|
479
|
+
fields:
|
|
480
|
+
given?: Step | Step[]
|
|
481
|
+
when?: Step | Step[]
|
|
482
|
+
then: Step | Step[]
|
|
483
|
+
tags?: TagList
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
```mdl
|
|
487
|
+
ext component
|
|
488
|
+
uri: org.dxos.mdl.component@1.0
|
|
489
|
+
desc: A UI component with props, internal state, slots, actions, and events.
|
|
490
|
+
fields:
|
|
491
|
+
desc?: Prose
|
|
492
|
+
props?: FieldMap # external inputs (immutable inside component)
|
|
493
|
+
state?: FieldMap # internal reactive state
|
|
494
|
+
slots?: FieldMap # named ReactNode injection points
|
|
495
|
+
actions?: ActionMap # methods the component exposes or handles
|
|
496
|
+
emits?: EventMap # events the component raises to its parent
|
|
497
|
+
layout?: CodeBlock # ASCII sketch of visual structure (non-normative)
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
```mdl
|
|
501
|
+
ext op
|
|
502
|
+
uri: org.dxos.mdl.op@1.0
|
|
503
|
+
desc: |
|
|
504
|
+
A named operation with typed inputs, outputs, and declared errors.
|
|
505
|
+
Pure ops have no effects or requires. Effectful ops declare both.
|
|
506
|
+
fields:
|
|
507
|
+
desc?: Prose
|
|
508
|
+
input?: FieldMap # named input parameters
|
|
509
|
+
output?: TypeExpr # return type
|
|
510
|
+
errors?: ErrorMap # name: Prose (when this error occurs)
|
|
511
|
+
effects?: EffectList # echo:read | echo:write | http | fs | ...
|
|
512
|
+
requires?: ServiceList # injected service dependencies
|
|
513
|
+
note?: Prose # implementation guidance (non-normative)
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
```mdl
|
|
517
|
+
ext service
|
|
518
|
+
uri: org.dxos.mdl.service@1.0
|
|
519
|
+
desc: An external or system-level dependency providing named operations.
|
|
520
|
+
fields:
|
|
521
|
+
desc?: Prose
|
|
522
|
+
loading?: eager | lazy
|
|
523
|
+
ops?: OpMap # name(params) → ReturnType
|
|
524
|
+
errors?: ErrorMap
|
|
525
|
+
note?: Prose
|
|
526
|
+
```
|
package/README.md
CHANGED
|
@@ -12,4 +12,4 @@ Surface plugin for Stack entities.
|
|
|
12
12
|
|
|
13
13
|
Your ideas, issues, and code are most welcome. Please take a look at our [community code of conduct](https://github.com/dxos/dxos/blob/main/CODE_OF_CONDUCT.md), the [issue guide](https://github.com/dxos/dxos/blob/main/CONTRIBUTING.md#submitting-issues), and the [PR contribution guide](https://github.com/dxos/dxos/blob/main/CONTRIBUTING.md#submitting-prs).
|
|
14
14
|
|
|
15
|
-
License: [
|
|
15
|
+
License: [FSL-1.1-Apache-2.0](./LICENSE) Copyright 2023 © DXOS
|