@dxos/plugin-chess 0.8.4-main.fffef41 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. package/LICENSE +102 -5
  2. package/PLUGIN.mdl +526 -0
  3. package/README.md +1 -1
  4. package/dist/lib/neutral/ChessArticle-JHI5OXYR.mjs +88 -0
  5. package/dist/lib/neutral/ChessArticle-JHI5OXYR.mjs.map +7 -0
  6. package/dist/lib/neutral/ChessCard-4TUTIFB6.mjs +19 -0
  7. package/dist/lib/neutral/ChessCard-4TUTIFB6.mjs.map +7 -0
  8. package/dist/lib/neutral/ChessPlugin.mjs +10 -0
  9. package/dist/lib/neutral/ChessPlugin.node.mjs +23 -0
  10. package/dist/lib/neutral/ChessPlugin.node.mjs.map +7 -0
  11. package/dist/lib/neutral/ChessPlugin.workerd.mjs +21 -0
  12. package/dist/lib/neutral/ChessPlugin.workerd.mjs.map +7 -0
  13. package/dist/lib/neutral/blueprint-definition-4MOWVVWD.mjs +15 -0
  14. package/dist/lib/neutral/blueprint-definition-4MOWVVWD.mjs.map +7 -0
  15. package/dist/lib/neutral/blueprints/index.mjs +8 -0
  16. package/dist/lib/neutral/capabilities/index.mjs +13 -0
  17. package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
  18. package/dist/lib/{browser/chunk-DUO4WTAM.mjs → neutral/chunk-7XZ4CRDL.mjs} +15 -11
  19. package/dist/lib/neutral/chunk-7XZ4CRDL.mjs.map +7 -0
  20. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
  21. package/dist/lib/neutral/chunk-OYWDKJ5B.mjs +148 -0
  22. package/dist/lib/neutral/chunk-OYWDKJ5B.mjs.map +7 -0
  23. package/dist/lib/neutral/chunk-PJOAFP6S.mjs +41 -0
  24. package/dist/lib/neutral/chunk-PJOAFP6S.mjs.map +7 -0
  25. package/dist/lib/neutral/chunk-XWKNXG62.mjs +34 -0
  26. package/dist/lib/neutral/chunk-XWKNXG62.mjs.map +7 -0
  27. package/dist/lib/neutral/chunk-YB6WZOZI.mjs +8 -0
  28. package/dist/lib/neutral/chunk-YB6WZOZI.mjs.map +7 -0
  29. package/dist/lib/neutral/components/index.mjs +239 -0
  30. package/dist/lib/neutral/components/index.mjs.map +7 -0
  31. package/dist/lib/neutral/containers/index.mjs +11 -0
  32. package/dist/lib/neutral/containers/index.mjs.map +7 -0
  33. package/dist/lib/neutral/game-variant-ZLPEN2QK.mjs +41 -0
  34. package/dist/lib/neutral/game-variant-ZLPEN2QK.mjs.map +7 -0
  35. package/dist/lib/neutral/index.mjs +18 -0
  36. package/dist/lib/neutral/meta.json +1 -0
  37. package/dist/lib/neutral/meta.mjs +8 -0
  38. package/dist/lib/neutral/meta.mjs.map +7 -0
  39. package/dist/lib/neutral/move-6NCMKKWD.mjs +37 -0
  40. package/dist/lib/neutral/move-6NCMKKWD.mjs.map +7 -0
  41. package/dist/lib/neutral/operation-handler-EKZKFQUG.mjs +13 -0
  42. package/dist/lib/neutral/operation-handler-EKZKFQUG.mjs.map +7 -0
  43. package/dist/lib/neutral/operations/index.mjs +8 -0
  44. package/dist/lib/neutral/operations/index.mjs.map +7 -0
  45. package/dist/lib/neutral/play-F5L5LFLW.mjs +46 -0
  46. package/dist/lib/neutral/play-F5L5LFLW.mjs.map +7 -0
  47. package/dist/lib/neutral/plugin.mjs +16 -0
  48. package/dist/lib/neutral/plugin.mjs.map +7 -0
  49. package/dist/lib/neutral/print-GMSNKAS2.mjs +29 -0
  50. package/dist/lib/neutral/print-GMSNKAS2.mjs.map +7 -0
  51. package/dist/lib/neutral/testing.mjs +8 -0
  52. package/dist/lib/neutral/testing.mjs.map +7 -0
  53. package/dist/lib/neutral/translations.mjs +39 -0
  54. package/dist/lib/neutral/translations.mjs.map +7 -0
  55. package/dist/lib/neutral/types/index.mjs +10 -0
  56. package/dist/lib/neutral/types/index.mjs.map +7 -0
  57. package/dist/types/src/ChessPlugin.d.ts +3 -1
  58. package/dist/types/src/ChessPlugin.d.ts.map +1 -1
  59. package/dist/types/src/ChessPlugin.node.d.ts +8 -0
  60. package/dist/types/src/ChessPlugin.node.d.ts.map +1 -0
  61. package/dist/types/src/ChessPlugin.test.d.ts +2 -0
  62. package/dist/types/src/ChessPlugin.test.d.ts.map +1 -0
  63. package/dist/types/src/ChessPlugin.workerd.d.ts +4 -0
  64. package/dist/types/src/ChessPlugin.workerd.d.ts.map +1 -0
  65. package/dist/types/src/blueprints/chess-blueprint.d.ts +4 -0
  66. package/dist/types/src/blueprints/chess-blueprint.d.ts.map +1 -0
  67. package/dist/types/src/blueprints/index.d.ts +2 -0
  68. package/dist/types/src/blueprints/index.d.ts.map +1 -0
  69. package/dist/types/src/capabilities/blueprint-definition.d.ts +5 -5
  70. package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
  71. package/dist/types/src/capabilities/game-variant.d.ts +6 -0
  72. package/dist/types/src/capabilities/game-variant.d.ts.map +1 -0
  73. package/dist/types/src/capabilities/index.d.ts +6 -4
  74. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  75. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  76. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  77. package/dist/types/src/components/{Chessboard.d.ts → Chessboard/Chessboard.d.ts} +10 -10
  78. package/dist/types/src/components/Chessboard/Chessboard.d.ts.map +1 -0
  79. package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts +65 -0
  80. package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts.map +1 -0
  81. package/dist/types/src/components/{Info.d.ts → Chessboard/Info.d.ts} +5 -6
  82. package/dist/types/src/components/Chessboard/Info.d.ts.map +1 -0
  83. package/dist/types/src/components/Chessboard/index.d.ts +2 -0
  84. package/dist/types/src/components/Chessboard/index.d.ts.map +1 -0
  85. package/dist/types/src/components/Chessboard/types.d.ts +8 -0
  86. package/dist/types/src/components/Chessboard/types.d.ts.map +1 -0
  87. package/dist/types/src/components/index.d.ts +0 -1
  88. package/dist/types/src/components/index.d.ts.map +1 -1
  89. package/dist/types/src/containers/ChessArticle/ChessArticle.d.ts +5 -0
  90. package/dist/types/src/containers/ChessArticle/ChessArticle.d.ts.map +1 -0
  91. package/dist/types/src/containers/ChessArticle/ChessArticle.stories.d.ts +64 -0
  92. package/dist/types/src/containers/ChessArticle/ChessArticle.stories.d.ts.map +1 -0
  93. package/dist/types/src/containers/ChessArticle/index.d.ts +2 -0
  94. package/dist/types/src/containers/ChessArticle/index.d.ts.map +1 -0
  95. package/dist/types/src/containers/ChessCard/ChessCard.d.ts +5 -0
  96. package/dist/types/src/containers/ChessCard/ChessCard.d.ts.map +1 -0
  97. package/dist/types/src/{components/Card.stories.d.ts → containers/ChessCard/ChessCard.stories.d.ts} +2 -9
  98. package/dist/types/src/containers/ChessCard/ChessCard.stories.d.ts.map +1 -0
  99. package/dist/types/src/containers/ChessCard/index.d.ts +2 -0
  100. package/dist/types/src/containers/ChessCard/index.d.ts.map +1 -0
  101. package/dist/types/src/containers/index.d.ts +4 -0
  102. package/dist/types/src/containers/index.d.ts.map +1 -0
  103. package/dist/types/src/index.d.ts +1 -4
  104. package/dist/types/src/index.d.ts.map +1 -1
  105. package/dist/types/src/meta.d.ts +2 -2
  106. package/dist/types/src/meta.d.ts.map +1 -1
  107. package/dist/types/src/operations/index.d.ts +3 -0
  108. package/dist/types/src/operations/index.d.ts.map +1 -0
  109. package/dist/types/src/operations/move.d.ts +5 -0
  110. package/dist/types/src/operations/move.d.ts.map +1 -0
  111. package/dist/types/src/operations/play.d.ts +5 -0
  112. package/dist/types/src/operations/play.d.ts.map +1 -0
  113. package/dist/types/src/operations/print.d.ts +5 -0
  114. package/dist/types/src/operations/print.d.ts.map +1 -0
  115. package/dist/types/src/plugin.d.ts +4 -0
  116. package/dist/types/src/plugin.d.ts.map +1 -0
  117. package/dist/types/src/testing.d.ts +2 -0
  118. package/dist/types/src/testing.d.ts.map +1 -0
  119. package/dist/types/src/translations.d.ts +40 -22
  120. package/dist/types/src/translations.d.ts.map +1 -1
  121. package/dist/types/src/types/Chess.d.ts +12 -22
  122. package/dist/types/src/types/Chess.d.ts.map +1 -1
  123. package/dist/types/src/types/ChessOperation.d.ts +29 -0
  124. package/dist/types/src/types/ChessOperation.d.ts.map +1 -0
  125. package/dist/types/src/types/index.d.ts +1 -1
  126. package/dist/types/src/types/index.d.ts.map +1 -1
  127. package/dist/types/tsconfig.tsbuildinfo +1 -1
  128. package/package.json +116 -56
  129. package/src/ChessPlugin.node.ts +23 -0
  130. package/src/ChessPlugin.test.ts +50 -0
  131. package/src/ChessPlugin.tsx +24 -53
  132. package/src/ChessPlugin.workerd.ts +18 -0
  133. package/src/blueprints/chess-blueprint.ts +32 -0
  134. package/src/blueprints/index.ts +5 -0
  135. package/src/capabilities/blueprint-definition.ts +11 -28
  136. package/src/capabilities/game-variant.ts +45 -0
  137. package/src/capabilities/index.ts +14 -6
  138. package/src/capabilities/operation-handler.ts +14 -0
  139. package/src/components/Chessboard/Chessboard.stories.tsx +94 -0
  140. package/src/components/{Chessboard.tsx → Chessboard/Chessboard.tsx} +35 -32
  141. package/src/components/{Info.tsx → Chessboard/Info.tsx} +33 -76
  142. package/src/components/Chessboard/index.ts +5 -0
  143. package/src/components/Chessboard/types.ts +18 -0
  144. package/src/components/index.ts +1 -5
  145. package/src/containers/ChessArticle/ChessArticle.stories.tsx +59 -0
  146. package/src/containers/ChessArticle/ChessArticle.tsx +108 -0
  147. package/src/containers/ChessArticle/index.ts +5 -0
  148. package/src/containers/ChessCard/ChessCard.stories.tsx +47 -0
  149. package/src/containers/ChessCard/ChessCard.tsx +27 -0
  150. package/src/containers/ChessCard/index.ts +5 -0
  151. package/src/containers/index.ts +8 -0
  152. package/src/index.ts +1 -5
  153. package/src/meta.ts +10 -4
  154. package/src/operations/index.ts +11 -0
  155. package/src/operations/move.ts +36 -0
  156. package/src/operations/play.ts +45 -0
  157. package/src/operations/print.ts +28 -0
  158. package/src/plugin.ts +11 -0
  159. package/src/testing.ts +7 -0
  160. package/src/translations.ts +23 -20
  161. package/src/types/Chess.ts +23 -30
  162. package/src/types/ChessOperation.ts +88 -0
  163. package/src/types/index.ts +1 -1
  164. package/src/vite-env.d.ts +10 -0
  165. package/dist/lib/browser/ChessboardContainer-5YXEM4VR.mjs +0 -96
  166. package/dist/lib/browser/ChessboardContainer-5YXEM4VR.mjs.map +0 -7
  167. package/dist/lib/browser/blueprint-definition-FD4TL5EE.mjs +0 -11
  168. package/dist/lib/browser/chunk-5DOZV3PW.mjs +0 -294
  169. package/dist/lib/browser/chunk-5DOZV3PW.mjs.map +0 -7
  170. package/dist/lib/browser/chunk-DUO4WTAM.mjs.map +0 -7
  171. package/dist/lib/browser/chunk-FBLAVAMY.mjs +0 -84
  172. package/dist/lib/browser/chunk-FBLAVAMY.mjs.map +0 -7
  173. package/dist/lib/browser/chunk-Q5TZCIH7.mjs +0 -8
  174. package/dist/lib/browser/chunk-Q5TZCIH7.mjs.map +0 -7
  175. package/dist/lib/browser/chunk-TIIGNOGK.mjs +0 -169
  176. package/dist/lib/browser/chunk-TIIGNOGK.mjs.map +0 -7
  177. package/dist/lib/browser/index.mjs +0 -124
  178. package/dist/lib/browser/index.mjs.map +0 -7
  179. package/dist/lib/browser/intent-resolver-GXZN2EBT.mjs +0 -25
  180. package/dist/lib/browser/intent-resolver-GXZN2EBT.mjs.map +0 -7
  181. package/dist/lib/browser/meta.json +0 -1
  182. package/dist/lib/browser/react-surface-KTTAUHAA.mjs +0 -38
  183. package/dist/lib/browser/react-surface-KTTAUHAA.mjs.map +0 -7
  184. package/dist/lib/browser/types/index.mjs +0 -10
  185. package/dist/lib/node-esm/ChessboardContainer-7OQ6TOKB.mjs +0 -97
  186. package/dist/lib/node-esm/ChessboardContainer-7OQ6TOKB.mjs.map +0 -7
  187. package/dist/lib/node-esm/blueprint-definition-O7ZM3HUF.mjs +0 -12
  188. package/dist/lib/node-esm/chunk-F4C2HVZL.mjs +0 -295
  189. package/dist/lib/node-esm/chunk-F4C2HVZL.mjs.map +0 -7
  190. package/dist/lib/node-esm/chunk-KNOOJFIR.mjs +0 -29
  191. package/dist/lib/node-esm/chunk-KNOOJFIR.mjs.map +0 -7
  192. package/dist/lib/node-esm/chunk-MP3A3AGA.mjs +0 -85
  193. package/dist/lib/node-esm/chunk-MP3A3AGA.mjs.map +0 -7
  194. package/dist/lib/node-esm/chunk-RTCAAOLF.mjs +0 -170
  195. package/dist/lib/node-esm/chunk-RTCAAOLF.mjs.map +0 -7
  196. package/dist/lib/node-esm/chunk-VVXTAVIS.mjs +0 -10
  197. package/dist/lib/node-esm/chunk-VVXTAVIS.mjs.map +0 -7
  198. package/dist/lib/node-esm/index.mjs +0 -125
  199. package/dist/lib/node-esm/index.mjs.map +0 -7
  200. package/dist/lib/node-esm/intent-resolver-HK5L6P6Z.mjs +0 -26
  201. package/dist/lib/node-esm/intent-resolver-HK5L6P6Z.mjs.map +0 -7
  202. package/dist/lib/node-esm/meta.json +0 -1
  203. package/dist/lib/node-esm/react-surface-VO4PSY6O.mjs +0 -39
  204. package/dist/lib/node-esm/react-surface-VO4PSY6O.mjs.map +0 -7
  205. package/dist/lib/node-esm/types/index.mjs +0 -11
  206. package/dist/types/src/capabilities/artifact-definition.d.ts +0 -11
  207. package/dist/types/src/capabilities/artifact-definition.d.ts.map +0 -1
  208. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  209. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  210. package/dist/types/src/capabilities/react-surface.d.ts +0 -4
  211. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  212. package/dist/types/src/components/Card.stories.d.ts.map +0 -1
  213. package/dist/types/src/components/Chessboard.d.ts.map +0 -1
  214. package/dist/types/src/components/Chessboard.stories.d.ts +0 -44
  215. package/dist/types/src/components/Chessboard.stories.d.ts.map +0 -1
  216. package/dist/types/src/components/ChessboardArticle.d.ts +0 -7
  217. package/dist/types/src/components/ChessboardArticle.d.ts.map +0 -1
  218. package/dist/types/src/components/ChessboardContainer.d.ts +0 -9
  219. package/dist/types/src/components/ChessboardContainer.d.ts.map +0 -1
  220. package/dist/types/src/components/Info.d.ts.map +0 -1
  221. package/dist/types/src/functions/create.d.ts +0 -14
  222. package/dist/types/src/functions/create.d.ts.map +0 -1
  223. package/dist/types/src/functions/index.d.ts +0 -4
  224. package/dist/types/src/functions/index.d.ts.map +0 -1
  225. package/dist/types/src/functions/move.d.ts +0 -8
  226. package/dist/types/src/functions/move.d.ts.map +0 -1
  227. package/dist/types/src/functions/play.d.ts +0 -9
  228. package/dist/types/src/functions/play.d.ts.map +0 -1
  229. package/dist/types/src/types/ChessAction.d.ts +0 -24
  230. package/dist/types/src/types/ChessAction.d.ts.map +0 -1
  231. package/src/capabilities/artifact-definition.ts +0 -129
  232. package/src/capabilities/intent-resolver.ts +0 -22
  233. package/src/capabilities/react-surface.tsx +0 -23
  234. package/src/components/Card.stories.tsx +0 -66
  235. package/src/components/Chessboard.stories.tsx +0 -49
  236. package/src/components/ChessboardArticle.tsx +0 -68
  237. package/src/components/ChessboardContainer.tsx +0 -44
  238. package/src/functions/create.ts +0 -32
  239. package/src/functions/index.ts +0 -7
  240. package/src/functions/move.ts +0 -45
  241. package/src/functions/play.ts +0 -55
  242. package/src/types/ChessAction.ts +0 -19
  243. /package/dist/lib/{browser/blueprint-definition-FD4TL5EE.mjs.map → neutral/ChessPlugin.mjs.map} +0 -0
  244. /package/dist/lib/{browser/types → neutral/blueprints}/index.mjs.map +0 -0
  245. /package/dist/lib/{node-esm/blueprint-definition-O7ZM3HUF.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
  246. /package/dist/lib/{node-esm/types → neutral}/index.mjs.map +0 -0
package/LICENSE CHANGED
@@ -1,8 +1,105 @@
1
- MIT License
2
- Copyright (c) 2022 DXOS
1
+ # Functional Source License, Version 1.1, ALv2 Future License
3
2
 
4
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
3
+ ## Abbreviation
5
4
 
6
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
5
+ FSL-1.1-Apache-2.0
7
6
 
8
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
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: [MIT](./LICENSE) Copyright 2023 © DXOS
15
+ License: [FSL-1.1-Apache-2.0](./LICENSE) Copyright 2023 © DXOS