@dxos/plugin-chess 0.8.4-main.b97322e → 0.8.4-main.bc2380dfbc

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 (235) hide show
  1. package/LICENSE +102 -5
  2. package/README.md +1 -1
  3. package/dist/lib/neutral/ChessArticle-QLLKZGPH.mjs +88 -0
  4. package/dist/lib/neutral/ChessArticle-QLLKZGPH.mjs.map +7 -0
  5. package/dist/lib/neutral/ChessCard-I5RSZZIP.mjs +19 -0
  6. package/dist/lib/neutral/ChessCard-I5RSZZIP.mjs.map +7 -0
  7. package/dist/lib/neutral/ChessPlugin.mjs +10 -0
  8. package/dist/lib/neutral/ChessPlugin.node.mjs +23 -0
  9. package/dist/lib/neutral/ChessPlugin.node.mjs.map +7 -0
  10. package/dist/lib/neutral/ChessPlugin.workerd.mjs +21 -0
  11. package/dist/lib/neutral/ChessPlugin.workerd.mjs.map +7 -0
  12. package/dist/lib/neutral/blueprint-definition-PZXHAYLD.mjs +15 -0
  13. package/dist/lib/neutral/blueprint-definition-PZXHAYLD.mjs.map +7 -0
  14. package/dist/lib/neutral/blueprints/index.mjs +8 -0
  15. package/dist/lib/neutral/capabilities/index.mjs +13 -0
  16. package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
  17. package/dist/lib/neutral/chunk-5UOTTW6U.mjs +8 -0
  18. package/dist/lib/neutral/chunk-5UOTTW6U.mjs.map +7 -0
  19. package/dist/lib/neutral/chunk-E4LZPHAQ.mjs +148 -0
  20. package/dist/lib/neutral/chunk-E4LZPHAQ.mjs.map +7 -0
  21. package/dist/lib/neutral/chunk-HVIKFYAW.mjs +29 -0
  22. package/dist/lib/neutral/chunk-HVIKFYAW.mjs.map +7 -0
  23. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
  24. package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
  25. package/dist/lib/neutral/chunk-NYIJLMS3.mjs +25 -0
  26. package/dist/lib/neutral/chunk-NYIJLMS3.mjs.map +7 -0
  27. package/dist/lib/neutral/chunk-XWKNXG62.mjs +34 -0
  28. package/dist/lib/neutral/chunk-XWKNXG62.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-24UKIBRM.mjs +40 -0
  34. package/dist/lib/neutral/game-variant-24UKIBRM.mjs.map +7 -0
  35. package/dist/lib/neutral/index.mjs +18 -0
  36. package/dist/lib/neutral/index.mjs.map +7 -0
  37. package/dist/lib/neutral/meta.json +1 -0
  38. package/dist/lib/neutral/meta.mjs +8 -0
  39. package/dist/lib/neutral/meta.mjs.map +7 -0
  40. package/dist/lib/neutral/move-RQZ7BJY3.mjs +37 -0
  41. package/dist/lib/neutral/move-RQZ7BJY3.mjs.map +7 -0
  42. package/dist/lib/neutral/operation-handler-EKZKFQUG.mjs +13 -0
  43. package/dist/lib/neutral/operation-handler-EKZKFQUG.mjs.map +7 -0
  44. package/dist/lib/neutral/operations/index.mjs +8 -0
  45. package/dist/lib/neutral/operations/index.mjs.map +7 -0
  46. package/dist/lib/neutral/play-GDGCEPQL.mjs +46 -0
  47. package/dist/lib/neutral/play-GDGCEPQL.mjs.map +7 -0
  48. package/dist/lib/neutral/plugin.mjs +16 -0
  49. package/dist/lib/neutral/plugin.mjs.map +7 -0
  50. package/dist/lib/neutral/print-ZQA74KZI.mjs +29 -0
  51. package/dist/lib/neutral/print-ZQA74KZI.mjs.map +7 -0
  52. package/dist/lib/neutral/testing.mjs +8 -0
  53. package/dist/lib/neutral/testing.mjs.map +7 -0
  54. package/dist/lib/neutral/translations.mjs +34 -0
  55. package/dist/lib/neutral/translations.mjs.map +7 -0
  56. package/dist/lib/neutral/types/index.mjs +10 -0
  57. package/dist/lib/neutral/types/index.mjs.map +7 -0
  58. package/dist/types/src/ChessPlugin.d.ts +3 -1
  59. package/dist/types/src/ChessPlugin.d.ts.map +1 -1
  60. package/dist/types/src/ChessPlugin.node.d.ts +8 -0
  61. package/dist/types/src/ChessPlugin.node.d.ts.map +1 -0
  62. package/dist/types/src/ChessPlugin.test.d.ts +2 -0
  63. package/dist/types/src/ChessPlugin.test.d.ts.map +1 -0
  64. package/dist/types/src/ChessPlugin.workerd.d.ts +4 -0
  65. package/dist/types/src/ChessPlugin.workerd.d.ts.map +1 -0
  66. package/dist/types/src/blueprints/chess-blueprint.d.ts +4 -0
  67. package/dist/types/src/blueprints/chess-blueprint.d.ts.map +1 -0
  68. package/dist/types/src/blueprints/index.d.ts +2 -0
  69. package/dist/types/src/blueprints/index.d.ts.map +1 -0
  70. package/dist/types/src/capabilities/blueprint-definition.d.ts +6 -0
  71. package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
  72. package/dist/types/src/capabilities/game-variant.d.ts +6 -0
  73. package/dist/types/src/capabilities/game-variant.d.ts.map +1 -0
  74. package/dist/types/src/capabilities/index.d.ts +5 -3
  75. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  76. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  77. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  78. package/dist/types/src/components/Chessboard/Chessboard.d.ts +38 -0
  79. package/dist/types/src/components/Chessboard/Chessboard.d.ts.map +1 -0
  80. package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts +57 -0
  81. package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts.map +1 -0
  82. package/dist/types/src/components/Chessboard/Info.d.ts +20 -0
  83. package/dist/types/src/components/Chessboard/Info.d.ts.map +1 -0
  84. package/dist/types/src/components/Chessboard/index.d.ts +2 -0
  85. package/dist/types/src/components/Chessboard/index.d.ts.map +1 -0
  86. package/dist/types/src/components/Chessboard/types.d.ts +8 -0
  87. package/dist/types/src/components/Chessboard/types.d.ts.map +1 -0
  88. package/dist/types/src/components/index.d.ts +1 -5
  89. package/dist/types/src/components/index.d.ts.map +1 -1
  90. package/dist/types/src/containers/ChessArticle/ChessArticle.d.ts +5 -0
  91. package/dist/types/src/containers/ChessArticle/ChessArticle.d.ts.map +1 -0
  92. package/dist/types/src/containers/ChessArticle/ChessArticle.stories.d.ts +56 -0
  93. package/dist/types/src/containers/ChessArticle/ChessArticle.stories.d.ts.map +1 -0
  94. package/dist/types/src/containers/ChessArticle/index.d.ts +2 -0
  95. package/dist/types/src/containers/ChessArticle/index.d.ts.map +1 -0
  96. package/dist/types/src/containers/ChessCard/ChessCard.d.ts +5 -0
  97. package/dist/types/src/containers/ChessCard/ChessCard.d.ts.map +1 -0
  98. package/dist/types/src/containers/ChessCard/ChessCard.stories.d.ts +15 -0
  99. package/dist/types/src/containers/ChessCard/ChessCard.stories.d.ts.map +1 -0
  100. package/dist/types/src/containers/ChessCard/index.d.ts +2 -0
  101. package/dist/types/src/containers/ChessCard/index.d.ts.map +1 -0
  102. package/dist/types/src/containers/index.d.ts +4 -0
  103. package/dist/types/src/containers/index.d.ts.map +1 -0
  104. package/dist/types/src/index.d.ts +2 -3
  105. package/dist/types/src/index.d.ts.map +1 -1
  106. package/dist/types/src/meta.d.ts +2 -3
  107. package/dist/types/src/meta.d.ts.map +1 -1
  108. package/dist/types/src/operations/index.d.ts +3 -0
  109. package/dist/types/src/operations/index.d.ts.map +1 -0
  110. package/dist/types/src/operations/move.d.ts +5 -0
  111. package/dist/types/src/operations/move.d.ts.map +1 -0
  112. package/dist/types/src/operations/play.d.ts +5 -0
  113. package/dist/types/src/operations/play.d.ts.map +1 -0
  114. package/dist/types/src/operations/print.d.ts +5 -0
  115. package/dist/types/src/operations/print.d.ts.map +1 -0
  116. package/dist/types/src/plugin.d.ts +4 -0
  117. package/dist/types/src/plugin.d.ts.map +1 -0
  118. package/dist/types/src/testing.d.ts +2 -0
  119. package/dist/types/src/testing.d.ts.map +1 -0
  120. package/dist/types/src/translations.d.ts +32 -14
  121. package/dist/types/src/translations.d.ts.map +1 -1
  122. package/dist/types/src/types/Chess.d.ts +18 -0
  123. package/dist/types/src/types/Chess.d.ts.map +1 -0
  124. package/dist/types/src/types/ChessOperation.d.ts +24 -0
  125. package/dist/types/src/types/ChessOperation.d.ts.map +1 -0
  126. package/dist/types/src/types/index.d.ts +2 -2
  127. package/dist/types/src/types/index.d.ts.map +1 -1
  128. package/dist/types/tsconfig.tsbuildinfo +1 -1
  129. package/package.json +117 -51
  130. package/src/ChessPlugin.node.ts +23 -0
  131. package/src/ChessPlugin.test.ts +50 -0
  132. package/src/ChessPlugin.tsx +20 -54
  133. package/src/ChessPlugin.workerd.ts +18 -0
  134. package/src/blueprints/chess-blueprint.ts +32 -0
  135. package/src/blueprints/index.ts +5 -0
  136. package/src/capabilities/blueprint-definition.ts +19 -0
  137. package/src/capabilities/game-variant.ts +42 -0
  138. package/src/capabilities/index.ts +9 -4
  139. package/src/capabilities/operation-handler.ts +14 -0
  140. package/src/components/Chessboard/Chessboard.stories.tsx +94 -0
  141. package/src/components/Chessboard/Chessboard.tsx +180 -0
  142. package/src/components/Chessboard/Info.tsx +193 -0
  143. package/src/components/Chessboard/index.ts +5 -0
  144. package/src/components/Chessboard/types.ts +18 -0
  145. package/src/components/index.ts +2 -6
  146. package/src/containers/ChessArticle/ChessArticle.stories.tsx +59 -0
  147. package/src/containers/ChessArticle/ChessArticle.tsx +108 -0
  148. package/src/containers/ChessArticle/index.ts +5 -0
  149. package/src/containers/ChessCard/ChessCard.stories.tsx +47 -0
  150. package/src/containers/ChessCard/ChessCard.tsx +27 -0
  151. package/src/containers/ChessCard/index.ts +5 -0
  152. package/src/containers/index.ts +8 -0
  153. package/src/index.ts +2 -4
  154. package/src/meta.ts +11 -7
  155. package/src/operations/index.ts +11 -0
  156. package/src/operations/move.ts +36 -0
  157. package/src/operations/play.ts +45 -0
  158. package/src/operations/print.ts +28 -0
  159. package/src/plugin.ts +11 -0
  160. package/src/testing.ts +7 -0
  161. package/src/translations.ts +18 -12
  162. package/src/types/Chess.ts +59 -0
  163. package/src/types/ChessOperation.ts +85 -0
  164. package/src/types/index.ts +2 -2
  165. package/dist/lib/browser/ChessContainer-SC4ZV6XZ.mjs +0 -129
  166. package/dist/lib/browser/ChessContainer-SC4ZV6XZ.mjs.map +0 -7
  167. package/dist/lib/browser/artifact-definition-A2FSM255.mjs +0 -182
  168. package/dist/lib/browser/artifact-definition-A2FSM255.mjs.map +0 -7
  169. package/dist/lib/browser/chunk-A3WEUKPK.mjs +0 -61
  170. package/dist/lib/browser/chunk-A3WEUKPK.mjs.map +0 -7
  171. package/dist/lib/browser/chunk-KDADGLPC.mjs +0 -8
  172. package/dist/lib/browser/chunk-KDADGLPC.mjs.map +0 -7
  173. package/dist/lib/browser/chunk-ZXH3N4NA.mjs +0 -66
  174. package/dist/lib/browser/chunk-ZXH3N4NA.mjs.map +0 -7
  175. package/dist/lib/browser/index.mjs +0 -98
  176. package/dist/lib/browser/index.mjs.map +0 -7
  177. package/dist/lib/browser/intent-resolver-KQYYX44R.mjs +0 -28
  178. package/dist/lib/browser/intent-resolver-KQYYX44R.mjs.map +0 -7
  179. package/dist/lib/browser/meta.json +0 -1
  180. package/dist/lib/browser/react-surface-PLUCWIYP.mjs +0 -36
  181. package/dist/lib/browser/react-surface-PLUCWIYP.mjs.map +0 -7
  182. package/dist/lib/browser/types/index.mjs +0 -11
  183. package/dist/lib/node-esm/ChessContainer-7GLY5KLY.mjs +0 -130
  184. package/dist/lib/node-esm/ChessContainer-7GLY5KLY.mjs.map +0 -7
  185. package/dist/lib/node-esm/artifact-definition-2H7OUBZO.mjs +0 -183
  186. package/dist/lib/node-esm/artifact-definition-2H7OUBZO.mjs.map +0 -7
  187. package/dist/lib/node-esm/chunk-27D3JA3K.mjs +0 -68
  188. package/dist/lib/node-esm/chunk-27D3JA3K.mjs.map +0 -7
  189. package/dist/lib/node-esm/chunk-IS3Y25PL.mjs +0 -63
  190. package/dist/lib/node-esm/chunk-IS3Y25PL.mjs.map +0 -7
  191. package/dist/lib/node-esm/chunk-QFINI7CC.mjs +0 -10
  192. package/dist/lib/node-esm/chunk-QFINI7CC.mjs.map +0 -7
  193. package/dist/lib/node-esm/index.mjs +0 -99
  194. package/dist/lib/node-esm/index.mjs.map +0 -7
  195. package/dist/lib/node-esm/intent-resolver-GXK2JROQ.mjs +0 -29
  196. package/dist/lib/node-esm/intent-resolver-GXK2JROQ.mjs.map +0 -7
  197. package/dist/lib/node-esm/meta.json +0 -1
  198. package/dist/lib/node-esm/react-surface-NGLNIWN3.mjs +0 -37
  199. package/dist/lib/node-esm/react-surface-NGLNIWN3.mjs.map +0 -7
  200. package/dist/lib/node-esm/types/index.mjs +0 -12
  201. package/dist/types/src/capabilities/artifact-definition.d.ts +0 -11
  202. package/dist/types/src/capabilities/artifact-definition.d.ts.map +0 -1
  203. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  204. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  205. package/dist/types/src/capabilities/react-surface.d.ts +0 -4
  206. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  207. package/dist/types/src/components/Chess.d.ts +0 -14
  208. package/dist/types/src/components/Chess.d.ts.map +0 -1
  209. package/dist/types/src/components/ChessContainer.d.ts +0 -8
  210. package/dist/types/src/components/ChessContainer.d.ts.map +0 -1
  211. package/dist/types/src/components/ChessContainer.stories.d.ts +0 -23
  212. package/dist/types/src/components/ChessContainer.stories.d.ts.map +0 -1
  213. package/dist/types/src/components/ChessPanel.d.ts +0 -11
  214. package/dist/types/src/components/ChessPanel.d.ts.map +0 -1
  215. package/dist/types/src/components/Chessboard.stories.d.ts +0 -8
  216. package/dist/types/src/components/Chessboard.stories.d.ts.map +0 -1
  217. package/dist/types/src/components/PlayerSelector.d.ts +0 -8
  218. package/dist/types/src/components/PlayerSelector.d.ts.map +0 -1
  219. package/dist/types/src/types/schema.d.ts +0 -29
  220. package/dist/types/src/types/schema.d.ts.map +0 -1
  221. package/dist/types/src/types/types.d.ts +0 -32
  222. package/dist/types/src/types/types.d.ts.map +0 -1
  223. package/src/capabilities/artifact-definition.ts +0 -124
  224. package/src/capabilities/intent-resolver.ts +0 -26
  225. package/src/capabilities/react-surface.tsx +0 -23
  226. package/src/components/Chess.tsx +0 -60
  227. package/src/components/ChessContainer.stories.tsx +0 -110
  228. package/src/components/ChessContainer.tsx +0 -71
  229. package/src/components/ChessPanel.tsx +0 -67
  230. package/src/components/Chessboard.stories.tsx +0 -41
  231. package/src/components/PlayerSelector.tsx +0 -82
  232. package/src/types/schema.ts +0 -34
  233. package/src/types/types.ts +0 -20
  234. /package/dist/lib/{browser/types/index.mjs.map → neutral/ChessPlugin.mjs.map} +0 -0
  235. /package/dist/lib/{node-esm/types → neutral/blueprints}/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/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
@@ -0,0 +1,88 @@
1
+ import "./chunk-J5LGTIGS.mjs";
2
+
3
+ // src/containers/ChessArticle/ChessArticle.tsx
4
+ import { Chess as ChessJS } from "chess.js";
5
+ import React, { useCallback, useRef, useState } from "react";
6
+ import { Obj } from "@dxos/echo";
7
+ import { Panel, Toolbar, useTranslation } from "@dxos/react-ui";
8
+ import { mx } from "@dxos/ui-theme";
9
+ import { Chessboard } from "#components";
10
+ import { meta } from "#meta";
11
+ import { Chess } from "#types";
12
+ var ChessArticle = ({ role, variant }) => {
13
+ const { t } = useTranslation(meta.id);
14
+ const [orientation, setOrientation] = useState("white");
15
+ const [showInfo, setShowInfo] = useState(true);
16
+ const controller = useRef(null);
17
+ const handleSelect = useCallback((index) => {
18
+ controller.current?.setMoveNumber(index);
19
+ }, []);
20
+ const isGameOver = (() => {
21
+ if (!Obj.instanceOf(Chess.State, variant) || !variant.pgn && !variant.fen) {
22
+ return false;
23
+ }
24
+ try {
25
+ const chess = new ChessJS();
26
+ if (variant.pgn) {
27
+ chess.loadPgn(variant.pgn);
28
+ } else if (variant.fen) {
29
+ chess.load(variant.fen);
30
+ }
31
+ return chess.isGameOver();
32
+ } catch {
33
+ return false;
34
+ }
35
+ })();
36
+ const handleNewGame = useCallback(() => {
37
+ if (!Obj.instanceOf(Chess.State, variant)) {
38
+ return;
39
+ }
40
+ Obj.update(variant, (variant2) => {
41
+ const mutable = variant2;
42
+ mutable.pgn = void 0;
43
+ mutable.fen = void 0;
44
+ });
45
+ }, [
46
+ variant
47
+ ]);
48
+ if (!Obj.instanceOf(Chess.State, variant)) {
49
+ return null;
50
+ }
51
+ return /* @__PURE__ */ React.createElement(Chessboard.Root, {
52
+ state: variant,
53
+ ref: controller
54
+ }, /* @__PURE__ */ React.createElement(Panel.Root, {
55
+ role,
56
+ classNames: "@container"
57
+ }, /* @__PURE__ */ React.createElement(Panel.Toolbar, {
58
+ asChild: true
59
+ }, /* @__PURE__ */ React.createElement(Toolbar.Root, null, isGameOver && /* @__PURE__ */ React.createElement(Toolbar.Button, {
60
+ onClick: handleNewGame
61
+ }, t("new-game.button")), /* @__PURE__ */ React.createElement("div", {
62
+ className: "grow"
63
+ }), /* @__PURE__ */ React.createElement(Toolbar.IconButton, {
64
+ icon: "ph--info--regular",
65
+ iconOnly: true,
66
+ label: t("toggle-info.button"),
67
+ classNames: mx("invisible @4xl:visible"),
68
+ onClick: () => setShowInfo((open) => !open)
69
+ }))), /* @__PURE__ */ React.createElement(Panel.Content, null, /* @__PURE__ */ React.createElement("div", {
70
+ className: mx("grid h-full w-full", showInfo && "@4xl:grid-cols-[1fr_320px] gap-8", role === "article" && "p-4", role === "section" && "aspect-square", role === "section" && showInfo && "@4xl:aspect-auto")
71
+ }, /* @__PURE__ */ React.createElement(Chessboard.Content, null, /* @__PURE__ */ React.createElement(Chessboard.Board, {
72
+ classNames: "border rounded-xs",
73
+ orientation
74
+ })), showInfo && /* @__PURE__ */ React.createElement("div", {
75
+ className: "hidden @4xl:flex flex-col justify-center items-center overflow-hidden"
76
+ }, /* @__PURE__ */ React.createElement(Chessboard.Info, {
77
+ orientation,
78
+ min: 8,
79
+ max: 8,
80
+ onOrientationChange: setOrientation,
81
+ onClose: () => setShowInfo(false),
82
+ onSelect: handleSelect
83
+ }))))));
84
+ };
85
+ export {
86
+ ChessArticle as default
87
+ };
88
+ //# sourceMappingURL=ChessArticle-QLLKZGPH.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/containers/ChessArticle/ChessArticle.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Chess as ChessJS } from 'chess.js';\nimport React, { useCallback, useRef, useState } from 'react';\n\nimport { Obj } from '@dxos/echo';\nimport { type GameVariantSurfaceProps } from '@dxos/plugin-game';\nimport { Panel, Toolbar, useTranslation } from '@dxos/react-ui';\nimport { type Player } from '@dxos/react-ui-gameboard';\nimport { mx } from '@dxos/ui-theme';\n\nimport { Chessboard, type ChessboardController, type ChessboardInfoProps } from '#components';\nimport { meta } from '#meta';\nimport { Chess } from '#types';\n\nexport type ChessArticleProps = GameVariantSurfaceProps;\n\nexport const ChessArticle = ({ role, variant }: ChessArticleProps) => {\n const { t } = useTranslation(meta.id);\n const [orientation, setOrientation] = useState<Player>('white');\n const [showInfo, setShowInfo] = useState(true);\n const controller = useRef<ChessboardController>(null);\n\n const handleSelect = useCallback<NonNullable<ChessboardInfoProps['onSelect']>>((index) => {\n controller.current?.setMoveNumber(index);\n }, []);\n\n const isGameOver = (() => {\n if (!Obj.instanceOf(Chess.State, variant) || (!variant.pgn && !variant.fen)) {\n return false;\n }\n try {\n const chess = new ChessJS();\n if (variant.pgn) {\n chess.loadPgn(variant.pgn);\n } else if (variant.fen) {\n chess.load(variant.fen);\n }\n return chess.isGameOver();\n } catch {\n return false;\n }\n })();\n\n const handleNewGame = useCallback(() => {\n if (!Obj.instanceOf(Chess.State, variant)) {\n return;\n }\n Obj.update(variant, (variant) => {\n const mutable = variant as Obj.Mutable<typeof variant>;\n mutable.pgn = undefined;\n mutable.fen = undefined;\n });\n }, [variant]);\n\n if (!Obj.instanceOf(Chess.State, variant)) {\n return null;\n }\n\n return (\n <Chessboard.Root state={variant} ref={controller}>\n <Panel.Root role={role} classNames='@container'>\n <Panel.Toolbar asChild>\n <Toolbar.Root>\n {isGameOver && <Toolbar.Button onClick={handleNewGame}>{t('new-game.button')}</Toolbar.Button>}\n <div className='grow' />\n <Toolbar.IconButton\n icon='ph--info--regular'\n iconOnly\n label={t('toggle-info.button')}\n classNames={mx('invisible @4xl:visible')}\n onClick={() => setShowInfo((open) => !open)}\n />\n </Toolbar.Root>\n </Panel.Toolbar>\n <Panel.Content>\n <div\n className={mx(\n 'grid h-full w-full',\n showInfo && '@4xl:grid-cols-[1fr_320px] gap-8',\n role === 'article' && 'p-4',\n role === 'section' && 'aspect-square',\n role === 'section' && showInfo && '@4xl:aspect-auto',\n )}\n >\n <Chessboard.Content>\n <Chessboard.Board classNames='border rounded-xs' orientation={orientation} />\n </Chessboard.Content>\n {showInfo && (\n <div className='hidden @4xl:flex flex-col justify-center items-center overflow-hidden'>\n <Chessboard.Info\n orientation={orientation}\n min={8}\n max={8}\n onOrientationChange={setOrientation}\n onClose={() => setShowInfo(false)}\n onSelect={handleSelect}\n />\n </div>\n )}\n </div>\n </Panel.Content>\n </Panel.Root>\n </Chessboard.Root>\n );\n};\n"],
5
+ "mappings": ";;;AAIA,SAASA,SAASC,eAAe;AACjC,OAAOC,SAASC,aAAaC,QAAQC,gBAAgB;AAErD,SAASC,WAAW;AAEpB,SAASC,OAAOC,SAASC,sBAAsB;AAE/C,SAASC,UAAU;AAEnB,SAASC,kBAAuE;AAChF,SAASC,YAAY;AACrB,SAASZ,aAAa;AAIf,IAAMa,eAAe,CAAC,EAAEC,MAAMC,QAAO,MAAqB;AAC/D,QAAM,EAAEC,EAAC,IAAKP,eAAeG,KAAKK,EAAE;AACpC,QAAM,CAACC,aAAaC,cAAAA,IAAkBd,SAAiB,OAAA;AACvD,QAAM,CAACe,UAAUC,WAAAA,IAAehB,SAAS,IAAA;AACzC,QAAMiB,aAAalB,OAA6B,IAAA;AAEhD,QAAMmB,eAAepB,YAA0D,CAACqB,UAAAA;AAC9EF,eAAWG,SAASC,cAAcF,KAAAA;EACpC,GAAG,CAAA,CAAE;AAEL,QAAMG,cAAc,MAAA;AAClB,QAAI,CAACrB,IAAIsB,WAAW5B,MAAM6B,OAAOd,OAAAA,KAAa,CAACA,QAAQe,OAAO,CAACf,QAAQgB,KAAM;AAC3E,aAAO;IACT;AACA,QAAI;AACF,YAAMC,QAAQ,IAAI/B,QAAAA;AAClB,UAAIc,QAAQe,KAAK;AACfE,cAAMC,QAAQlB,QAAQe,GAAG;MAC3B,WAAWf,QAAQgB,KAAK;AACtBC,cAAME,KAAKnB,QAAQgB,GAAG;MACxB;AACA,aAAOC,MAAML,WAAU;IACzB,QAAQ;AACN,aAAO;IACT;EACF,GAAA;AAEA,QAAMQ,gBAAgBhC,YAAY,MAAA;AAChC,QAAI,CAACG,IAAIsB,WAAW5B,MAAM6B,OAAOd,OAAAA,GAAU;AACzC;IACF;AACAT,QAAI8B,OAAOrB,SAAS,CAACA,aAAAA;AACnB,YAAMsB,UAAUtB;AAChBsB,cAAQP,MAAMQ;AACdD,cAAQN,MAAMO;IAChB,CAAA;EACF,GAAG;IAACvB;GAAQ;AAEZ,MAAI,CAACT,IAAIsB,WAAW5B,MAAM6B,OAAOd,OAAAA,GAAU;AACzC,WAAO;EACT;AAEA,SACE,sBAAA,cAACJ,WAAW4B,MAAI;IAACC,OAAOzB;IAAS0B,KAAKnB;KACpC,sBAAA,cAACf,MAAMgC,MAAI;IAACzB;IAAY4B,YAAW;KACjC,sBAAA,cAACnC,MAAMC,SAAO;IAACmC,SAAAA;KACb,sBAAA,cAACnC,QAAQ+B,MAAI,MACVZ,cAAc,sBAAA,cAACnB,QAAQoC,QAAM;IAACC,SAASV;KAAgBnB,EAAE,iBAAA,CAAA,GAC1D,sBAAA,cAAC8B,OAAAA;IAAIC,WAAU;MACf,sBAAA,cAACvC,QAAQwC,YAAU;IACjBC,MAAK;IACLC,UAAAA;IACAC,OAAOnC,EAAE,oBAAA;IACT0B,YAAYhC,GAAG,wBAAA;IACfmC,SAAS,MAAMxB,YAAY,CAAC+B,SAAS,CAACA,IAAAA;QAI5C,sBAAA,cAAC7C,MAAM8C,SAAO,MACZ,sBAAA,cAACP,OAAAA;IACCC,WAAWrC,GACT,sBACAU,YAAY,oCACZN,SAAS,aAAa,OACtBA,SAAS,aAAa,iBACtBA,SAAS,aAAaM,YAAY,kBAAA;KAGpC,sBAAA,cAACT,WAAW0C,SAAO,MACjB,sBAAA,cAAC1C,WAAW2C,OAAK;IAACZ,YAAW;IAAoBxB;OAElDE,YACC,sBAAA,cAAC0B,OAAAA;IAAIC,WAAU;KACb,sBAAA,cAACpC,WAAW4C,MAAI;IACdrC;IACAsC,KAAK;IACLC,KAAK;IACLC,qBAAqBvC;IACrBwC,SAAS,MAAMtC,YAAY,KAAA;IAC3BuC,UAAUrC;;AAS5B;",
6
+ "names": ["Chess", "ChessJS", "React", "useCallback", "useRef", "useState", "Obj", "Panel", "Toolbar", "useTranslation", "mx", "Chessboard", "meta", "ChessArticle", "role", "variant", "t", "id", "orientation", "setOrientation", "showInfo", "setShowInfo", "controller", "handleSelect", "index", "current", "setMoveNumber", "isGameOver", "instanceOf", "State", "pgn", "fen", "chess", "loadPgn", "load", "handleNewGame", "update", "mutable", "undefined", "Root", "state", "ref", "classNames", "asChild", "Button", "onClick", "div", "className", "IconButton", "icon", "iconOnly", "label", "open", "Content", "Board", "Info", "min", "max", "onOrientationChange", "onClose", "onSelect"]
7
+ }
@@ -0,0 +1,19 @@
1
+ import "./chunk-J5LGTIGS.mjs";
2
+
3
+ // src/containers/ChessCard/ChessCard.tsx
4
+ import React from "react";
5
+ import { Obj } from "@dxos/echo";
6
+ import { Chessboard } from "#components";
7
+ import { Chess } from "#types";
8
+ var ChessCard = ({ variant }) => {
9
+ if (!Obj.instanceOf(Chess.State, variant)) {
10
+ return null;
11
+ }
12
+ return /* @__PURE__ */ React.createElement(Chessboard.Root, {
13
+ state: variant
14
+ }, /* @__PURE__ */ React.createElement(Chessboard.Content, null, /* @__PURE__ */ React.createElement(Chessboard.Board, null)));
15
+ };
16
+ export {
17
+ ChessCard as default
18
+ };
19
+ //# sourceMappingURL=ChessCard-I5RSZZIP.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/containers/ChessCard/ChessCard.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Obj } from '@dxos/echo';\nimport { type GameVariantSurfaceProps } from '@dxos/plugin-game';\n\nimport { Chessboard } from '#components';\nimport { Chess } from '#types';\n\nexport type ChessCardProps = GameVariantSurfaceProps;\n\nexport const ChessCard = ({ variant }: ChessCardProps) => {\n if (!Obj.instanceOf(Chess.State, variant)) {\n return null;\n }\n\n return (\n <Chessboard.Root state={variant}>\n <Chessboard.Content>\n <Chessboard.Board />\n </Chessboard.Content>\n </Chessboard.Root>\n );\n};\n"],
5
+ "mappings": ";;;AAIA,OAAOA,WAAW;AAElB,SAASC,WAAW;AAGpB,SAASC,kBAAkB;AAC3B,SAASC,aAAa;AAIf,IAAMC,YAAY,CAAC,EAAEC,QAAO,MAAkB;AACnD,MAAI,CAACJ,IAAIK,WAAWH,MAAMI,OAAOF,OAAAA,GAAU;AACzC,WAAO;EACT;AAEA,SACE,sBAAA,cAACH,WAAWM,MAAI;IAACC,OAAOJ;KACtB,sBAAA,cAACH,WAAWQ,SAAO,MACjB,sBAAA,cAACR,WAAWS,OAAK,IAAA,CAAA,CAAA;AAIzB;",
6
+ "names": ["React", "Obj", "Chessboard", "Chess", "ChessCard", "variant", "instanceOf", "State", "Root", "state", "Content", "Board"]
7
+ }
@@ -0,0 +1,10 @@
1
+ import {
2
+ ChessPlugin,
3
+ ChessPlugin_default
4
+ } from "./chunk-HVIKFYAW.mjs";
5
+ import "./chunk-J5LGTIGS.mjs";
6
+ export {
7
+ ChessPlugin,
8
+ ChessPlugin_default as default
9
+ };
10
+ //# sourceMappingURL=ChessPlugin.mjs.map
@@ -0,0 +1,23 @@
1
+ import "./chunk-J5LGTIGS.mjs";
2
+
3
+ // src/ChessPlugin.node.ts
4
+ import { Plugin } from "@dxos/app-framework";
5
+ import { AppPlugin } from "@dxos/app-toolkit";
6
+ import { BlueprintDefinition, OperationHandler } from "#capabilities";
7
+ import { meta } from "#meta";
8
+ import { Chess } from "#types";
9
+ var ChessPlugin = Plugin.define(meta).pipe(AppPlugin.addSchemaModule({
10
+ schema: [
11
+ Chess.State
12
+ ]
13
+ }), AppPlugin.addBlueprintDefinitionModule({
14
+ activate: BlueprintDefinition
15
+ }), AppPlugin.addOperationHandlerModule({
16
+ activate: OperationHandler
17
+ }), Plugin.make);
18
+ var ChessPlugin_node_default = ChessPlugin;
19
+ export {
20
+ ChessPlugin,
21
+ ChessPlugin_node_default as default
22
+ };
23
+ //# sourceMappingURL=ChessPlugin.node.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/ChessPlugin.node.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\nimport { AppPlugin } from '@dxos/app-toolkit';\n\nimport { BlueprintDefinition, OperationHandler } from '#capabilities';\nimport { meta } from '#meta';\nimport { Chess } from '#types';\n\n/**\n * Headless variant of ChessPlugin (no React surfaces / GameVariant).\n * Used in node contexts (CLI, agents) where rendering is unavailable.\n */\nexport const ChessPlugin = Plugin.define(meta).pipe(\n AppPlugin.addSchemaModule({ schema: [Chess.State] }),\n AppPlugin.addBlueprintDefinitionModule({ activate: BlueprintDefinition }),\n AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),\n Plugin.make,\n);\n\nexport default ChessPlugin;\n"],
5
+ "mappings": ";;;AAIA,SAASA,cAAc;AACvB,SAASC,iBAAiB;AAE1B,SAASC,qBAAqBC,wBAAwB;AACtD,SAASC,YAAY;AACrB,SAASC,aAAa;AAMf,IAAMC,cAAcN,OAAOO,OAAOH,IAAAA,EAAMI,KAC7CP,UAAUQ,gBAAgB;EAAEC,QAAQ;IAACL,MAAMM;;AAAO,CAAA,GAClDV,UAAUW,6BAA6B;EAAEC,UAAUX;AAAoB,CAAA,GACvED,UAAUa,0BAA0B;EAAED,UAAUV;AAAiB,CAAA,GACjEH,OAAOe,IAAI;AAGb,IAAA,2BAAeT;",
6
+ "names": ["Plugin", "AppPlugin", "BlueprintDefinition", "OperationHandler", "meta", "Chess", "ChessPlugin", "define", "pipe", "addSchemaModule", "schema", "State", "addBlueprintDefinitionModule", "activate", "addOperationHandlerModule", "make"]
7
+ }
@@ -0,0 +1,21 @@
1
+ import "./chunk-J5LGTIGS.mjs";
2
+
3
+ // src/ChessPlugin.workerd.ts
4
+ import { Plugin } from "@dxos/app-framework";
5
+ import { AppPlugin } from "@dxos/app-toolkit";
6
+ import { OperationHandler } from "#capabilities";
7
+ import { meta } from "#meta";
8
+ import { Chess } from "#types";
9
+ var ChessPlugin = Plugin.define(meta).pipe(AppPlugin.addOperationHandlerModule({
10
+ activate: OperationHandler
11
+ }), AppPlugin.addSchemaModule({
12
+ schema: [
13
+ Chess.State
14
+ ]
15
+ }), Plugin.make);
16
+ var ChessPlugin_workerd_default = ChessPlugin;
17
+ export {
18
+ ChessPlugin,
19
+ ChessPlugin_workerd_default as default
20
+ };
21
+ //# sourceMappingURL=ChessPlugin.workerd.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/ChessPlugin.workerd.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\nimport { AppPlugin } from '@dxos/app-toolkit';\n\nimport { OperationHandler } from '#capabilities';\nimport { meta } from '#meta';\nimport { Chess } from '#types';\n\nexport const ChessPlugin = Plugin.define(meta).pipe(\n AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),\n AppPlugin.addSchemaModule({ schema: [Chess.State] }),\n Plugin.make,\n);\n\nexport default ChessPlugin;\n"],
5
+ "mappings": ";;;AAIA,SAASA,cAAc;AACvB,SAASC,iBAAiB;AAE1B,SAASC,wBAAwB;AACjC,SAASC,YAAY;AACrB,SAASC,aAAa;AAEf,IAAMC,cAAcL,OAAOM,OAAOH,IAAAA,EAAMI,KAC7CN,UAAUO,0BAA0B;EAAEC,UAAUP;AAAiB,CAAA,GACjED,UAAUS,gBAAgB;EAAEC,QAAQ;IAACP,MAAMQ;;AAAO,CAAA,GAClDZ,OAAOa,IAAI;AAGb,IAAA,8BAAeR;",
6
+ "names": ["Plugin", "AppPlugin", "OperationHandler", "meta", "Chess", "ChessPlugin", "define", "pipe", "addOperationHandlerModule", "activate", "addSchemaModule", "schema", "State", "make"]
7
+ }
@@ -0,0 +1,15 @@
1
+ import "./chunk-J5LGTIGS.mjs";
2
+
3
+ // src/capabilities/blueprint-definition.ts
4
+ import * as Effect from "effect/Effect";
5
+ import { Capability } from "@dxos/app-framework";
6
+ import { AppCapabilities } from "@dxos/app-toolkit";
7
+ import { ChessBlueprint } from "#blueprints";
8
+ var blueprintDefinition = Capability.makeModule(() => Effect.succeed([
9
+ Capability.contributes(AppCapabilities.BlueprintDefinition, ChessBlueprint)
10
+ ]));
11
+ var blueprint_definition_default = blueprintDefinition;
12
+ export {
13
+ blueprint_definition_default as default
14
+ };
15
+ //# sourceMappingURL=blueprint-definition-PZXHAYLD.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/capabilities/blueprint-definition.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability } from '@dxos/app-framework';\nimport { AppCapabilities } from '@dxos/app-toolkit';\n// eslint-disable-next-line unused-imports/no-unused-imports\nimport type { Blueprint } from '@dxos/compute';\n\nimport { ChessBlueprint } from '#blueprints';\n\nconst blueprintDefinition = Capability.makeModule<\n [],\n Capability.Capability<typeof AppCapabilities.BlueprintDefinition>[]\n>(() => Effect.succeed([Capability.contributes(AppCapabilities.BlueprintDefinition, ChessBlueprint)]));\n\nexport default blueprintDefinition;\n"],
5
+ "mappings": ";;;AAIA,YAAYA,YAAY;AAExB,SAASC,kBAAkB;AAC3B,SAASC,uBAAuB;AAIhC,SAASC,sBAAsB;AAE/B,IAAMC,sBAAsBH,WAAWI,WAGrC,MAAaC,eAAQ;EAACL,WAAWM,YAAYL,gBAAgBM,qBAAqBL,cAAAA;CAAgB,CAAA;AAEpG,IAAA,+BAAeC;",
6
+ "names": ["Effect", "Capability", "AppCapabilities", "ChessBlueprint", "blueprintDefinition", "makeModule", "succeed", "contributes", "BlueprintDefinition"]
7
+ }
@@ -0,0 +1,8 @@
1
+ import {
2
+ chess_blueprint_default
3
+ } from "../chunk-XWKNXG62.mjs";
4
+ import "../chunk-J5LGTIGS.mjs";
5
+ export {
6
+ chess_blueprint_default as ChessBlueprint
7
+ };
8
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,13 @@
1
+ import "../chunk-J5LGTIGS.mjs";
2
+
3
+ // src/capabilities/index.ts
4
+ import { Capability } from "@dxos/app-framework";
5
+ var BlueprintDefinition = Capability.lazy("BlueprintDefinition", () => import("../blueprint-definition-PZXHAYLD.mjs"));
6
+ var GameVariant = Capability.lazy("GameVariant", () => import("../game-variant-24UKIBRM.mjs"));
7
+ var OperationHandler = Capability.lazy("OperationHandler", () => import("../operation-handler-EKZKFQUG.mjs"));
8
+ export {
9
+ BlueprintDefinition,
10
+ GameVariant,
11
+ OperationHandler
12
+ };
13
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/capabilities/index.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\n// eslint-disable-next-line unused-imports/no-unused-imports\nimport type { Blueprint, OperationHandlerSet } from '@dxos/compute';\n\nexport const BlueprintDefinition = Capability.lazy('BlueprintDefinition', () => import('./blueprint-definition'));\nexport const GameVariant = Capability.lazy('GameVariant', () => import('./game-variant'));\nexport const OperationHandler = Capability.lazy<OperationHandlerSet.OperationHandlerSet>(\n 'OperationHandler',\n () => import('./operation-handler'),\n);\n"],
5
+ "mappings": ";;;AAIA,SAASA,kBAAkB;AAIpB,IAAMC,sBAAsBD,WAAWE,KAAK,uBAAuB,MAAM,OAAO,sCAAA,CAAA;AAChF,IAAMC,cAAcH,WAAWE,KAAK,eAAe,MAAM,OAAO,8BAAA,CAAA;AAChE,IAAME,mBAAmBJ,WAAWE,KACzC,oBACA,MAAM,OAAO,mCAAA,CAAA;",
6
+ "names": ["Capability", "BlueprintDefinition", "lazy", "GameVariant", "OperationHandler"]
7
+ }
@@ -0,0 +1,8 @@
1
+ // src/operations/index.ts
2
+ import { OperationHandlerSet } from "@dxos/compute";
3
+ var ChessOperationHandlerSet = OperationHandlerSet.lazy(() => import("./move-RQZ7BJY3.mjs"), () => import("./play-GDGCEPQL.mjs"), () => import("./print-ZQA74KZI.mjs"));
4
+
5
+ export {
6
+ ChessOperationHandlerSet
7
+ };
8
+ //# sourceMappingURL=chunk-5UOTTW6U.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/operations/index.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { OperationHandlerSet } from '@dxos/compute';\n\nexport const ChessOperationHandlerSet = OperationHandlerSet.lazy(\n () => import('./move'),\n () => import('./play'),\n () => import('./print'),\n);\n"],
5
+ "mappings": ";AAIA,SAASA,2BAA2B;AAE7B,IAAMC,2BAA2BD,oBAAoBE,KAC1D,MAAM,OAAO,qBAAA,GACb,MAAM,OAAO,qBAAA,GACb,MAAM,OAAO,sBAAA,CAAA;",
6
+ "names": ["OperationHandlerSet", "ChessOperationHandlerSet", "lazy"]
7
+ }
@@ -0,0 +1,148 @@
1
+ import {
2
+ __export
3
+ } from "./chunk-J5LGTIGS.mjs";
4
+
5
+ // src/types/Chess.ts
6
+ var Chess_exports = {};
7
+ __export(Chess_exports, {
8
+ BLUEPRINT_KEY: () => BLUEPRINT_KEY,
9
+ State: () => State,
10
+ make: () => make
11
+ });
12
+ import { Chess as ChessJS } from "chess.js";
13
+ import * as Schema from "effect/Schema";
14
+ import { BlueprintsAnnotation } from "@dxos/app-toolkit";
15
+ import { Annotation, Obj, Type } from "@dxos/echo";
16
+ import { FormInputAnnotation, SystemTypeAnnotation } from "@dxos/echo/internal";
17
+ import { log } from "@dxos/log";
18
+ var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-chess/src/types/Chess.ts";
19
+ var BLUEPRINT_KEY = "org.dxos.blueprint.chess";
20
+ var State = Schema.Struct({
21
+ pgn: Schema.String.annotations({
22
+ description: "Portable Game Notation."
23
+ }).pipe(FormInputAnnotation.set(false), Schema.optional),
24
+ fen: Schema.String.annotations({
25
+ description: "Forsyth-Edwards Notation."
26
+ }).pipe(FormInputAnnotation.set(false), Schema.optional)
27
+ }).pipe(
28
+ Type.object({
29
+ typename: "org.dxos.type.chess.state",
30
+ version: "0.1.0"
31
+ }),
32
+ Annotation.IconAnnotation.set({
33
+ icon: "ph--shield-chevron--regular",
34
+ hue: "amber"
35
+ }),
36
+ BlueprintsAnnotation.set([
37
+ BLUEPRINT_KEY
38
+ ]),
39
+ // Implementation detail of the unified `Game` schema. The user-facing object is `Game`;
40
+ // this state is only ever referenced via `Game.variant`. SystemType keeps it out of the
41
+ // navtree's typed branches so an orphaned state object doesn't reappear after the
42
+ // wrapping Game is deleted.
43
+ SystemTypeAnnotation.set(true)
44
+ );
45
+ var make = ({ pgn, fen } = {}) => {
46
+ const chess = new ChessJS();
47
+ if (pgn) {
48
+ try {
49
+ chess.loadPgn(pgn);
50
+ } catch {
51
+ log.warn(pgn, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 40, S: void 0 });
52
+ }
53
+ }
54
+ return Obj.make(State, {
55
+ pgn,
56
+ fen
57
+ });
58
+ };
59
+
60
+ // src/types/ChessOperation.ts
61
+ var ChessOperation_exports = {};
62
+ __export(ChessOperation_exports, {
63
+ Move: () => Move,
64
+ Play: () => Play,
65
+ Print: () => Print
66
+ });
67
+ import * as Schema2 from "effect/Schema";
68
+ import { Operation } from "@dxos/compute";
69
+ import { Database } from "@dxos/echo";
70
+ import { GameRef } from "@dxos/plugin-game";
71
+ var Move = Operation.make({
72
+ meta: {
73
+ key: "org.dxos.function.chess.move",
74
+ name: "Move",
75
+ description: "Makes a move in the given chess game."
76
+ },
77
+ input: Schema2.Struct({
78
+ game: GameRef(State).annotations({
79
+ description: "The ID of the game object (variant must be Chess)."
80
+ }),
81
+ move: Schema2.String.annotations({
82
+ description: "The move to make in the chess game.",
83
+ examples: [
84
+ "e4",
85
+ "Bf3"
86
+ ]
87
+ })
88
+ }),
89
+ output: Schema2.Struct({
90
+ pgn: Schema2.String.annotations({
91
+ description: "The PGN of the game after the move was played."
92
+ })
93
+ }),
94
+ services: [
95
+ Database.Service
96
+ ]
97
+ });
98
+ var Play = Operation.make({
99
+ meta: {
100
+ key: "org.dxos.function.chess.play",
101
+ name: "Play",
102
+ description: "Uses the chess engine to play the next move."
103
+ },
104
+ input: Schema2.Struct({
105
+ game: GameRef(State).annotations({
106
+ description: "The ID of the game object (variant must be Chess)."
107
+ }),
108
+ side: Schema2.optional(Schema2.Literal("white", "black", "any")).annotations({
109
+ description: "The side to play.",
110
+ defaultValue: "any"
111
+ })
112
+ }),
113
+ output: Schema2.Struct({
114
+ pgn: Schema2.String.annotations({
115
+ description: "The PGN of the game after the move was played."
116
+ }),
117
+ move: Schema2.optional(Schema2.String).annotations({
118
+ description: "The move that was played."
119
+ })
120
+ }),
121
+ services: [
122
+ Database.Service
123
+ ]
124
+ });
125
+ var Print = Operation.make({
126
+ meta: {
127
+ key: "org.dxos.function.chess.print",
128
+ name: "Print game",
129
+ description: "Prints the chess game to ASCII."
130
+ },
131
+ input: Schema2.Struct({
132
+ pgn: Schema2.optional(Schema2.String.annotations({
133
+ description: "Portable Game Notation."
134
+ })),
135
+ fen: Schema2.optional(Schema2.String.annotations({
136
+ description: "Forsyth-Edwards Notation."
137
+ }))
138
+ }),
139
+ output: Schema2.Struct({
140
+ ascii: Schema2.String
141
+ })
142
+ });
143
+
144
+ export {
145
+ Chess_exports,
146
+ ChessOperation_exports
147
+ };
148
+ //# sourceMappingURL=chunk-E4LZPHAQ.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/types/Chess.ts", "../../../src/types/ChessOperation.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Chess as ChessJS } from 'chess.js';\nimport * as Schema from 'effect/Schema';\n\nimport { BlueprintsAnnotation } from '@dxos/app-toolkit';\nimport { Annotation, Obj, Type } from '@dxos/echo';\nimport { FormInputAnnotation, SystemTypeAnnotation } from '@dxos/echo/internal';\nimport { log } from '@dxos/log';\n\nexport const BLUEPRINT_KEY = 'org.dxos.blueprint.chess';\n\n/**\n * Chess variant state. Referenced by the base `Game` object via `Game.variant`.\n * Players, name, and other game-shared fields live on the base `Game`.\n */\nexport const State = Schema.Struct({\n pgn: Schema.String.annotations({\n description: 'Portable Game Notation.',\n }).pipe(FormInputAnnotation.set(false), Schema.optional),\n fen: Schema.String.annotations({\n description: 'Forsyth-Edwards Notation.',\n }).pipe(FormInputAnnotation.set(false), Schema.optional),\n}).pipe(\n Type.object({\n typename: 'org.dxos.type.chess.state',\n version: '0.1.0',\n }),\n Annotation.IconAnnotation.set({\n icon: 'ph--shield-chevron--regular',\n hue: 'amber',\n }),\n BlueprintsAnnotation.set([BLUEPRINT_KEY]),\n // Implementation detail of the unified `Game` schema. The user-facing object is `Game`;\n // this state is only ever referenced via `Game.variant`. SystemType keeps it out of the\n // navtree's typed branches so an orphaned state object doesn't reappear after the\n // wrapping Game is deleted.\n SystemTypeAnnotation.set(true),\n);\n\nexport interface State extends Schema.Schema.Type<typeof State> {}\n\nexport const make = ({ pgn, fen }: { pgn?: string; fen?: string } = {}): State => {\n const chess = new ChessJS();\n if (pgn) {\n try {\n chess.loadPgn(pgn);\n } catch {\n log.warn(pgn);\n }\n }\n\n return Obj.make(State, {\n pgn,\n fen,\n });\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Schema from 'effect/Schema';\n\nimport { Operation } from '@dxos/compute';\nimport { Database } from '@dxos/echo';\nimport { GameRef } from '@dxos/plugin-game';\n\nimport * as Chess from './Chess';\n\nexport const Move = Operation.make({\n meta: {\n key: 'org.dxos.function.chess.move',\n name: 'Move',\n description: 'Makes a move in the given chess game.',\n },\n input: Schema.Struct({\n game: GameRef(Chess.State).annotations({\n description: 'The ID of the game object (variant must be Chess).',\n }),\n move: Schema.String.annotations({\n description: 'The move to make in the chess game.',\n examples: ['e4', 'Bf3'],\n }),\n }),\n output: Schema.Struct({\n pgn: Schema.String.annotations({\n description: 'The PGN of the game after the move was played.',\n }),\n }),\n services: [Database.Service],\n});\n\nexport const Play = Operation.make({\n meta: {\n key: 'org.dxos.function.chess.play',\n name: 'Play',\n description: 'Uses the chess engine to play the next move.',\n },\n input: Schema.Struct({\n game: GameRef(Chess.State).annotations({\n description: 'The ID of the game object (variant must be Chess).',\n }),\n side: Schema.optional(Schema.Literal('white', 'black', 'any')).annotations({\n description: 'The side to play.',\n defaultValue: 'any',\n }),\n }),\n output: Schema.Struct({\n pgn: Schema.String.annotations({\n description: 'The PGN of the game after the move was played.',\n }),\n move: Schema.optional(Schema.String).annotations({\n description: 'The move that was played.',\n }),\n }),\n services: [Database.Service],\n});\n\nexport const Print = Operation.make({\n meta: {\n key: 'org.dxos.function.chess.print',\n name: 'Print game',\n description: 'Prints the chess game to ASCII.',\n },\n input: Schema.Struct({\n pgn: Schema.optional(\n Schema.String.annotations({\n description: 'Portable Game Notation.',\n }),\n ),\n fen: Schema.optional(\n Schema.String.annotations({\n description: 'Forsyth-Edwards Notation.',\n }),\n ),\n }),\n output: Schema.Struct({\n ascii: Schema.String,\n }),\n});\n"],
5
+ "mappings": ";;;;;AAAA;;;;;;AAIA,SAASA,SAASC,eAAe;AACjC,YAAYC,YAAY;AAExB,SAASC,4BAA4B;AACrC,SAASC,YAAYC,KAAKC,YAAY;AACtC,SAASC,qBAAqBC,4BAA4B;AAC1D,SAASC,WAAW;AAEpB,IAAA,eAAaC;;AAQTC,IAAAA,QAAa,cAAA;EACf,KAAQJ,cAAAA,YAAuB;IAC/BK,aAAYC;UACVF,oBAAa,IAAA,KAAA,GAAA,eAAA;EACf,KAAQJ,cAAAA,YAAuB;IAE/BD,aAAY;EACVQ,CAAAA,EAAAA,KAAAA,oBAAU,IAAA,KAAA,GAAA,eAAA;;EACVC,KAAS,OAAA;IAEXX,UAAAA;IACEY,SAAM;;EACNC,WAAK,eAAA,IAAA;IAEPd,MAAAA;IAA0BO,KAAAA;GAAc;EACxC,qBAAA,IAAA;IACA;EACA,CAAA;;;;;uBAQc,IAAIT,IAAAA;AAAAA;AAClB,IAAS,OAAA,CAAA,EAAA,KAAA,IAAA,IAAA,CAAA,MAAA;QACP,QAAI,IAAA,QAAA;WACFiB;AACF,QAAE;AACAT,YAAIU,QAAKC,GAAAA;IACX,QAAA;AACF,UAAA,KAAA,KAAA,QAAA,EAAA,YAAA,YAAA,GAAA,cAAA,GAAA,IAAA,GAAA,OAAA,CAAA;IAEA;;SAEER,IAAAA,KAAAA,OAAAA;IACF;IACA;;;;;AC1DF;;;;;;AAMA,YAAYS,aAAY;AAExB,SAASC,iBAAiB;AAC1B,SAASC,gBAAgB;AACzB,SAASC,eAAe;AAIjB,IAAMC,OAAOC,UAAUC,KAAK;EACjCC,MAAM;IACJC,KAAK;IACLC,MAAM;IACNC,aAAa;EACf;EACAC,OAAcC,eAAO;IACnBC,MAAMC,QAAcC,KAAK,EAAEC,YAAY;MACrCN,aAAa;IACf,CAAA;IACAO,MAAaC,eAAOF,YAAY;MAC9BN,aAAa;MACbS,UAAU;QAAC;QAAM;;IACnB,CAAA;EACF,CAAA;EACAC,QAAeR,eAAO;IACpBS,KAAYH,eAAOF,YAAY;MAC7BN,aAAa;IACf,CAAA;EACF,CAAA;EACAY,UAAU;IAACC,SAASC;;AACtB,CAAA;AAEO,IAAMC,OAAOpB,UAAUC,KAAK;EACjCC,MAAM;IACJC,KAAK;IACLC,MAAM;IACNC,aAAa;EACf;EACAC,OAAcC,eAAO;IACnBC,MAAMC,QAAcC,KAAK,EAAEC,YAAY;MACrCN,aAAa;IACf,CAAA;IACAgB,MAAaC,iBAAgBC,gBAAQ,SAAS,SAAS,KAAA,CAAA,EAAQZ,YAAY;MACzEN,aAAa;MACbmB,cAAc;IAChB,CAAA;EACF,CAAA;EACAT,QAAeR,eAAO;IACpBS,KAAYH,eAAOF,YAAY;MAC7BN,aAAa;IACf,CAAA;IACAO,MAAaU,iBAAgBT,cAAM,EAAEF,YAAY;MAC/CN,aAAa;IACf,CAAA;EACF,CAAA;EACAY,UAAU;IAACC,SAASC;;AACtB,CAAA;AAEO,IAAMM,QAAQzB,UAAUC,KAAK;EAClCC,MAAM;IACJC,KAAK;IACLC,MAAM;IACNC,aAAa;EACf;EACAC,OAAcC,eAAO;IACnBS,KAAYM,iBACHT,eAAOF,YAAY;MACxBN,aAAa;IACf,CAAA,CAAA;IAEFqB,KAAYJ,iBACHT,eAAOF,YAAY;MACxBN,aAAa;IACf,CAAA,CAAA;EAEJ,CAAA;EACAU,QAAeR,eAAO;IACpBoB,OAAcd;EAChB,CAAA;AACF,CAAA;",
6
+ "names": ["Chess", "ChessJS", "Schema", "BlueprintsAnnotation", "Annotation", "Obj", "Type", "FormInputAnnotation", "SystemTypeAnnotation", "log", "BLUEPRINT_KEY", "description", "fen", "String", "typename", "version", "icon", "hue", "chess", "warn", "pgn", "Schema", "Operation", "Database", "GameRef", "Move", "Operation", "make", "meta", "key", "name", "description", "input", "Struct", "game", "GameRef", "State", "annotations", "move", "String", "examples", "output", "pgn", "services", "Database", "Service", "Play", "side", "optional", "Literal", "defaultValue", "Print", "fen", "ascii"]
7
+ }
@@ -0,0 +1,29 @@
1
+ // src/ChessPlugin.tsx
2
+ import { Plugin } from "@dxos/app-framework";
3
+ import { AppPlugin, AppActivationEvents } from "@dxos/app-toolkit";
4
+ import { BlueprintDefinition, GameVariant, OperationHandler } from "#capabilities";
5
+ import { meta } from "#meta";
6
+ import { translations } from "#translations";
7
+ import { Chess } from "#types";
8
+ var ChessPlugin = Plugin.define(meta).pipe(Plugin.addModule({
9
+ id: "game-variant",
10
+ activatesOn: AppActivationEvents.SetupSchema,
11
+ activate: GameVariant
12
+ }), AppPlugin.addBlueprintDefinitionModule({
13
+ activate: BlueprintDefinition
14
+ }), AppPlugin.addOperationHandlerModule({
15
+ activate: OperationHandler
16
+ }), AppPlugin.addSchemaModule({
17
+ schema: [
18
+ Chess.State
19
+ ]
20
+ }), AppPlugin.addTranslationsModule({
21
+ translations
22
+ }), Plugin.make);
23
+ var ChessPlugin_default = ChessPlugin;
24
+
25
+ export {
26
+ ChessPlugin,
27
+ ChessPlugin_default
28
+ };
29
+ //# sourceMappingURL=chunk-HVIKFYAW.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/ChessPlugin.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\nimport { AppPlugin, AppActivationEvents } from '@dxos/app-toolkit';\n\nimport { BlueprintDefinition, GameVariant, OperationHandler } from '#capabilities';\nimport { meta } from '#meta';\nimport { translations } from '#translations';\nimport { Chess } from '#types';\n\nexport const ChessPlugin = Plugin.define(meta).pipe(\n Plugin.addModule({\n id: 'game-variant',\n activatesOn: AppActivationEvents.SetupSchema,\n activate: GameVariant,\n }),\n AppPlugin.addBlueprintDefinitionModule({ activate: BlueprintDefinition }),\n AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),\n AppPlugin.addSchemaModule({ schema: [Chess.State] }),\n AppPlugin.addTranslationsModule({ translations }),\n Plugin.make,\n);\n\nexport default ChessPlugin;\n"],
5
+ "mappings": ";AAIA,SAASA,cAAc;AACvB,SAASC,WAAWC,2BAA2B;AAE/C,SAASC,qBAAqBC,aAAaC,wBAAwB;AACnE,SAASC,YAAY;AACrB,SAASC,oBAAoB;AAC7B,SAASC,aAAa;AAEf,IAAMC,cAAcT,OAAOU,OAAOJ,IAAAA,EAAMK,KAC7CX,OAAOY,UAAU;EACfC,IAAI;EACJC,aAAaZ,oBAAoBa;EACjCC,UAAUZ;AACZ,CAAA,GACAH,UAAUgB,6BAA6B;EAAED,UAAUb;AAAoB,CAAA,GACvEF,UAAUiB,0BAA0B;EAAEF,UAAUX;AAAiB,CAAA,GACjEJ,UAAUkB,gBAAgB;EAAEC,QAAQ;IAACZ,MAAMa;;AAAO,CAAA,GAClDpB,UAAUqB,sBAAsB;EAAEf;AAAa,CAAA,GAC/CP,OAAOuB,IAAI;AAGb,IAAA,sBAAed;",
6
+ "names": ["Plugin", "AppPlugin", "AppActivationEvents", "BlueprintDefinition", "GameVariant", "OperationHandler", "meta", "translations", "Chess", "ChessPlugin", "define", "pipe", "addModule", "id", "activatesOn", "SetupSchema", "activate", "addBlueprintDefinitionModule", "addOperationHandlerModule", "addSchemaModule", "schema", "State", "addTranslationsModule", "make"]
7
+ }
@@ -0,0 +1,10 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
7
+ export {
8
+ __export
9
+ };
10
+ //# sourceMappingURL=chunk-J5LGTIGS.mjs.map