@dxos/plugin-chess 0.8.4-main.84f28bd → 0.8.4-main.8baae0fced

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 (233) 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-QLLKZGPH.mjs +88 -0
  5. package/dist/lib/neutral/ChessArticle-QLLKZGPH.mjs.map +7 -0
  6. package/dist/lib/neutral/ChessCard-I5RSZZIP.mjs +19 -0
  7. package/dist/lib/neutral/ChessCard-I5RSZZIP.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-PZXHAYLD.mjs +15 -0
  14. package/dist/lib/neutral/blueprint-definition-PZXHAYLD.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/neutral/chunk-5UOTTW6U.mjs +8 -0
  19. package/dist/lib/neutral/chunk-5UOTTW6U.mjs.map +7 -0
  20. package/dist/lib/neutral/chunk-E4LZPHAQ.mjs +148 -0
  21. package/dist/lib/neutral/chunk-E4LZPHAQ.mjs.map +7 -0
  22. package/dist/lib/neutral/chunk-HVIKFYAW.mjs +29 -0
  23. package/dist/lib/neutral/chunk-HVIKFYAW.mjs.map +7 -0
  24. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
  25. package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
  26. package/dist/lib/neutral/chunk-V4UMIQ6K.mjs +31 -0
  27. package/dist/lib/neutral/chunk-V4UMIQ6K.mjs.map +7 -0
  28. package/dist/lib/neutral/chunk-XWKNXG62.mjs +34 -0
  29. package/dist/lib/neutral/chunk-XWKNXG62.mjs.map +7 -0
  30. package/dist/lib/neutral/components/index.mjs +239 -0
  31. package/dist/lib/neutral/components/index.mjs.map +7 -0
  32. package/dist/lib/neutral/containers/index.mjs +11 -0
  33. package/dist/lib/neutral/containers/index.mjs.map +7 -0
  34. package/dist/lib/neutral/game-variant-24UKIBRM.mjs +40 -0
  35. package/dist/lib/neutral/game-variant-24UKIBRM.mjs.map +7 -0
  36. package/dist/lib/neutral/index.mjs +18 -0
  37. package/dist/lib/neutral/index.mjs.map +7 -0
  38. package/dist/lib/neutral/meta.json +1 -0
  39. package/dist/lib/neutral/meta.mjs +8 -0
  40. package/dist/lib/neutral/meta.mjs.map +7 -0
  41. package/dist/lib/neutral/move-RQZ7BJY3.mjs +37 -0
  42. package/dist/lib/neutral/move-RQZ7BJY3.mjs.map +7 -0
  43. package/dist/lib/neutral/operation-handler-EKZKFQUG.mjs +13 -0
  44. package/dist/lib/neutral/operation-handler-EKZKFQUG.mjs.map +7 -0
  45. package/dist/lib/neutral/operations/index.mjs +8 -0
  46. package/dist/lib/neutral/operations/index.mjs.map +7 -0
  47. package/dist/lib/neutral/play-GDGCEPQL.mjs +46 -0
  48. package/dist/lib/neutral/play-GDGCEPQL.mjs.map +7 -0
  49. package/dist/lib/neutral/plugin.mjs +16 -0
  50. package/dist/lib/neutral/plugin.mjs.map +7 -0
  51. package/dist/lib/neutral/print-ZQA74KZI.mjs +29 -0
  52. package/dist/lib/neutral/print-ZQA74KZI.mjs.map +7 -0
  53. package/dist/lib/neutral/testing.mjs +8 -0
  54. package/dist/lib/neutral/testing.mjs.map +7 -0
  55. package/dist/lib/neutral/translations.mjs +34 -0
  56. package/dist/lib/neutral/translations.mjs.map +7 -0
  57. package/dist/lib/neutral/types/index.mjs +10 -0
  58. package/dist/lib/neutral/types/index.mjs.map +7 -0
  59. package/dist/types/src/ChessPlugin.d.ts +3 -1
  60. package/dist/types/src/ChessPlugin.d.ts.map +1 -1
  61. package/dist/types/src/ChessPlugin.node.d.ts +8 -0
  62. package/dist/types/src/ChessPlugin.node.d.ts.map +1 -0
  63. package/dist/types/src/ChessPlugin.test.d.ts +2 -0
  64. package/dist/types/src/ChessPlugin.test.d.ts.map +1 -0
  65. package/dist/types/src/ChessPlugin.workerd.d.ts +4 -0
  66. package/dist/types/src/ChessPlugin.workerd.d.ts.map +1 -0
  67. package/dist/types/src/blueprints/chess-blueprint.d.ts +4 -0
  68. package/dist/types/src/blueprints/chess-blueprint.d.ts.map +1 -0
  69. package/dist/types/src/blueprints/index.d.ts +2 -0
  70. package/dist/types/src/blueprints/index.d.ts.map +1 -0
  71. package/dist/types/src/capabilities/blueprint-definition.d.ts +6 -0
  72. package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
  73. package/dist/types/src/capabilities/game-variant.d.ts +6 -0
  74. package/dist/types/src/capabilities/game-variant.d.ts.map +1 -0
  75. package/dist/types/src/capabilities/index.d.ts +5 -3
  76. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  77. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  78. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  79. package/dist/types/src/components/Chessboard/Chessboard.d.ts +38 -0
  80. package/dist/types/src/components/Chessboard/Chessboard.d.ts.map +1 -0
  81. package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts +57 -0
  82. package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts.map +1 -0
  83. package/dist/types/src/components/Chessboard/Info.d.ts +20 -0
  84. package/dist/types/src/components/Chessboard/Info.d.ts.map +1 -0
  85. package/dist/types/src/components/Chessboard/index.d.ts +2 -0
  86. package/dist/types/src/components/Chessboard/index.d.ts.map +1 -0
  87. package/dist/types/src/components/Chessboard/types.d.ts +8 -0
  88. package/dist/types/src/components/Chessboard/types.d.ts.map +1 -0
  89. package/dist/types/src/components/index.d.ts +1 -5
  90. package/dist/types/src/components/index.d.ts.map +1 -1
  91. package/dist/types/src/containers/ChessArticle/ChessArticle.d.ts +5 -0
  92. package/dist/types/src/containers/ChessArticle/ChessArticle.d.ts.map +1 -0
  93. package/dist/types/src/containers/ChessArticle/ChessArticle.stories.d.ts +56 -0
  94. package/dist/types/src/containers/ChessArticle/ChessArticle.stories.d.ts.map +1 -0
  95. package/dist/types/src/containers/ChessArticle/index.d.ts +2 -0
  96. package/dist/types/src/containers/ChessArticle/index.d.ts.map +1 -0
  97. package/dist/types/src/containers/ChessCard/ChessCard.d.ts +5 -0
  98. package/dist/types/src/containers/ChessCard/ChessCard.d.ts.map +1 -0
  99. package/dist/types/src/containers/ChessCard/ChessCard.stories.d.ts +15 -0
  100. package/dist/types/src/containers/ChessCard/ChessCard.stories.d.ts.map +1 -0
  101. package/dist/types/src/containers/ChessCard/index.d.ts +2 -0
  102. package/dist/types/src/containers/ChessCard/index.d.ts.map +1 -0
  103. package/dist/types/src/containers/index.d.ts +4 -0
  104. package/dist/types/src/containers/index.d.ts.map +1 -0
  105. package/dist/types/src/index.d.ts +2 -3
  106. package/dist/types/src/index.d.ts.map +1 -1
  107. package/dist/types/src/meta.d.ts +2 -3
  108. package/dist/types/src/meta.d.ts.map +1 -1
  109. package/dist/types/src/operations/index.d.ts +3 -0
  110. package/dist/types/src/operations/index.d.ts.map +1 -0
  111. package/dist/types/src/operations/move.d.ts +5 -0
  112. package/dist/types/src/operations/move.d.ts.map +1 -0
  113. package/dist/types/src/operations/play.d.ts +5 -0
  114. package/dist/types/src/operations/play.d.ts.map +1 -0
  115. package/dist/types/src/operations/print.d.ts +5 -0
  116. package/dist/types/src/operations/print.d.ts.map +1 -0
  117. package/dist/types/src/plugin.d.ts +4 -0
  118. package/dist/types/src/plugin.d.ts.map +1 -0
  119. package/dist/types/src/testing.d.ts +2 -0
  120. package/dist/types/src/testing.d.ts.map +1 -0
  121. package/dist/types/src/translations.d.ts +32 -12
  122. package/dist/types/src/translations.d.ts.map +1 -1
  123. package/dist/types/src/types/Chess.d.ts +18 -0
  124. package/dist/types/src/types/Chess.d.ts.map +1 -0
  125. package/dist/types/src/types/ChessOperation.d.ts +24 -0
  126. package/dist/types/src/types/ChessOperation.d.ts.map +1 -0
  127. package/dist/types/src/types/index.d.ts +2 -2
  128. package/dist/types/src/types/index.d.ts.map +1 -1
  129. package/dist/types/tsconfig.tsbuildinfo +1 -1
  130. package/package.json +119 -50
  131. package/src/ChessPlugin.node.ts +23 -0
  132. package/src/ChessPlugin.test.ts +50 -0
  133. package/src/ChessPlugin.tsx +20 -54
  134. package/src/ChessPlugin.workerd.ts +18 -0
  135. package/src/blueprints/chess-blueprint.ts +32 -0
  136. package/src/blueprints/index.ts +5 -0
  137. package/src/capabilities/blueprint-definition.ts +19 -0
  138. package/src/capabilities/game-variant.ts +42 -0
  139. package/src/capabilities/index.ts +9 -4
  140. package/src/capabilities/operation-handler.ts +14 -0
  141. package/src/components/Chessboard/Chessboard.stories.tsx +94 -0
  142. package/src/components/Chessboard/Chessboard.tsx +180 -0
  143. package/src/components/Chessboard/Info.tsx +193 -0
  144. package/src/components/Chessboard/index.ts +5 -0
  145. package/src/components/Chessboard/types.ts +18 -0
  146. package/src/components/index.ts +2 -6
  147. package/src/containers/ChessArticle/ChessArticle.stories.tsx +59 -0
  148. package/src/containers/ChessArticle/ChessArticle.tsx +108 -0
  149. package/src/containers/ChessArticle/index.ts +5 -0
  150. package/src/containers/ChessCard/ChessCard.stories.tsx +47 -0
  151. package/src/containers/ChessCard/ChessCard.tsx +27 -0
  152. package/src/containers/ChessCard/index.ts +5 -0
  153. package/src/containers/index.ts +8 -0
  154. package/src/index.ts +2 -4
  155. package/src/meta.ts +15 -7
  156. package/src/operations/index.ts +11 -0
  157. package/src/operations/move.ts +36 -0
  158. package/src/operations/play.ts +45 -0
  159. package/src/operations/print.ts +28 -0
  160. package/src/plugin.ts +11 -0
  161. package/src/testing.ts +7 -0
  162. package/src/translations.ts +18 -10
  163. package/src/types/Chess.ts +59 -0
  164. package/src/types/ChessOperation.ts +85 -0
  165. package/src/types/index.ts +2 -2
  166. package/dist/lib/browser/ChessContainer-DL5J6VIK.mjs +0 -101
  167. package/dist/lib/browser/ChessContainer-DL5J6VIK.mjs.map +0 -7
  168. package/dist/lib/browser/artifact-definition-4AMZY5LQ.mjs +0 -182
  169. package/dist/lib/browser/artifact-definition-4AMZY5LQ.mjs.map +0 -7
  170. package/dist/lib/browser/chunk-2VF6U52K.mjs +0 -8
  171. package/dist/lib/browser/chunk-2VF6U52K.mjs.map +0 -7
  172. package/dist/lib/browser/chunk-A3WEUKPK.mjs +0 -61
  173. package/dist/lib/browser/chunk-A3WEUKPK.mjs.map +0 -7
  174. package/dist/lib/browser/chunk-AZSYKAFK.mjs +0 -61
  175. package/dist/lib/browser/chunk-AZSYKAFK.mjs.map +0 -7
  176. package/dist/lib/browser/index.mjs +0 -96
  177. package/dist/lib/browser/index.mjs.map +0 -7
  178. package/dist/lib/browser/intent-resolver-KQYYX44R.mjs +0 -28
  179. package/dist/lib/browser/intent-resolver-KQYYX44R.mjs.map +0 -7
  180. package/dist/lib/browser/meta.json +0 -1
  181. package/dist/lib/browser/react-surface-4TBVZUKU.mjs +0 -43
  182. package/dist/lib/browser/react-surface-4TBVZUKU.mjs.map +0 -7
  183. package/dist/lib/browser/types/index.mjs +0 -11
  184. package/dist/lib/node-esm/ChessContainer-WVOL2KSE.mjs +0 -102
  185. package/dist/lib/node-esm/ChessContainer-WVOL2KSE.mjs.map +0 -7
  186. package/dist/lib/node-esm/artifact-definition-TT3747JB.mjs +0 -183
  187. package/dist/lib/node-esm/artifact-definition-TT3747JB.mjs.map +0 -7
  188. package/dist/lib/node-esm/chunk-2DRWEDVT.mjs +0 -63
  189. package/dist/lib/node-esm/chunk-2DRWEDVT.mjs.map +0 -7
  190. package/dist/lib/node-esm/chunk-IS3Y25PL.mjs +0 -63
  191. package/dist/lib/node-esm/chunk-IS3Y25PL.mjs.map +0 -7
  192. package/dist/lib/node-esm/chunk-TD2SWK2H.mjs +0 -10
  193. package/dist/lib/node-esm/chunk-TD2SWK2H.mjs.map +0 -7
  194. package/dist/lib/node-esm/index.mjs +0 -97
  195. package/dist/lib/node-esm/index.mjs.map +0 -7
  196. package/dist/lib/node-esm/intent-resolver-GXK2JROQ.mjs +0 -29
  197. package/dist/lib/node-esm/intent-resolver-GXK2JROQ.mjs.map +0 -7
  198. package/dist/lib/node-esm/meta.json +0 -1
  199. package/dist/lib/node-esm/react-surface-PAUEOIBL.mjs +0 -44
  200. package/dist/lib/node-esm/react-surface-PAUEOIBL.mjs.map +0 -7
  201. package/dist/lib/node-esm/types/index.mjs +0 -12
  202. package/dist/types/src/capabilities/artifact-definition.d.ts +0 -11
  203. package/dist/types/src/capabilities/artifact-definition.d.ts.map +0 -1
  204. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  205. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  206. package/dist/types/src/capabilities/react-surface.d.ts +0 -4
  207. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  208. package/dist/types/src/components/ChessComponent.d.ts +0 -6
  209. package/dist/types/src/components/ChessComponent.d.ts.map +0 -1
  210. package/dist/types/src/components/ChessContainer.d.ts +0 -8
  211. package/dist/types/src/components/ChessContainer.d.ts.map +0 -1
  212. package/dist/types/src/components/ChessPanel.d.ts +0 -11
  213. package/dist/types/src/components/ChessPanel.d.ts.map +0 -1
  214. package/dist/types/src/components/Chessboard.stories.d.ts +0 -8
  215. package/dist/types/src/components/Chessboard.stories.d.ts.map +0 -1
  216. package/dist/types/src/components/PlayerSelector.d.ts +0 -8
  217. package/dist/types/src/components/PlayerSelector.d.ts.map +0 -1
  218. package/dist/types/src/types/schema.d.ts +0 -29
  219. package/dist/types/src/types/schema.d.ts.map +0 -1
  220. package/dist/types/src/types/types.d.ts +0 -32
  221. package/dist/types/src/types/types.d.ts.map +0 -1
  222. package/src/capabilities/artifact-definition.ts +0 -124
  223. package/src/capabilities/intent-resolver.ts +0 -26
  224. package/src/capabilities/react-surface.tsx +0 -30
  225. package/src/components/ChessComponent.tsx +0 -54
  226. package/src/components/ChessContainer.tsx +0 -35
  227. package/src/components/ChessPanel.tsx +0 -67
  228. package/src/components/Chessboard.stories.tsx +0 -39
  229. package/src/components/PlayerSelector.tsx +0 -80
  230. package/src/types/schema.ts +0 -34
  231. package/src/types/types.ts +0 -20
  232. /package/dist/lib/{browser/types/index.mjs.map → neutral/ChessPlugin.mjs.map} +0 -0
  233. /package/dist/lib/{node-esm/types → neutral/blueprints}/index.mjs.map +0 -0
@@ -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
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,31 @@
1
+ // src/meta.ts
2
+ import { meta as gameMeta } from "@dxos/plugin-game";
3
+ import { trim } from "@dxos/util";
4
+ var meta = {
5
+ id: "org.dxos.plugin.chess",
6
+ name: "Chess",
7
+ author: "DXOS",
8
+ description: trim`
9
+ Full-featured chess game supporting multiplayer matches with friends or practice sessions against AI opponents.
10
+ Track game history and analyze moves in real-time.
11
+ `,
12
+ icon: "ph--shield-chevron--regular",
13
+ iconHue: "amber",
14
+ source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-chess",
15
+ spec: "PLUGIN.mdl",
16
+ screenshots: [
17
+ "https://dxos.network/plugin-details-chess-dark.png"
18
+ ],
19
+ dependsOn: [
20
+ gameMeta.id
21
+ ],
22
+ version: "0.8.3",
23
+ tags: [
24
+ "game"
25
+ ]
26
+ };
27
+
28
+ export {
29
+ meta
30
+ };
31
+ //# sourceMappingURL=chunk-V4UMIQ6K.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/meta.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Plugin } from '@dxos/app-framework';\nimport { meta as gameMeta } from '@dxos/plugin-game';\nimport { trim } from '@dxos/util';\n\nexport const meta: Plugin.Meta = {\n id: 'org.dxos.plugin.chess',\n name: 'Chess',\n author: 'DXOS',\n description: trim`\n Full-featured chess game supporting multiplayer matches with friends or practice sessions against AI opponents.\n Track game history and analyze moves in real-time.\n `,\n icon: 'ph--shield-chevron--regular',\n iconHue: 'amber',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-chess',\n spec: 'PLUGIN.mdl',\n screenshots: ['https://dxos.network/plugin-details-chess-dark.png'],\n dependsOn: [gameMeta.id],\n version: '0.8.3',\n tags: ['game'],\n};\n"],
5
+ "mappings": ";AAKA,SAASA,QAAQC,gBAAgB;AACjC,SAASC,YAAY;AAEd,IAAMF,OAAoB;EAC/BG,IAAI;EACJC,MAAM;EACNC,QAAQ;EACRC,aAAaJ;;;;EAIbK,MAAM;EACNC,SAAS;EACTC,QAAQ;EACRC,MAAM;EACNC,aAAa;IAAC;;EACdC,WAAW;IAACX,SAASE;;EACrBU,SAAS;EACTC,MAAM;IAAC;;AACT;",
6
+ "names": ["meta", "gameMeta", "trim", "id", "name", "author", "description", "icon", "iconHue", "source", "spec", "screenshots", "dependsOn", "version", "tags"]
7
+ }
@@ -0,0 +1,34 @@
1
+ // src/blueprints/chess-blueprint.ts
2
+ import { Blueprint, Template } from "@dxos/compute";
3
+ import { trim } from "@dxos/util";
4
+ import { Chess, ChessOperation } from "#types";
5
+ var operations = [
6
+ ChessOperation.Move,
7
+ ChessOperation.Play,
8
+ ChessOperation.Print
9
+ ];
10
+ var make = () => Blueprint.make({
11
+ key: Chess.BLUEPRINT_KEY,
12
+ name: "Chess",
13
+ tools: Blueprint.toolDefinitions({
14
+ operations
15
+ }),
16
+ instructions: Template.make({
17
+ source: trim`
18
+ You are an expert chess player.
19
+ To analyze a game you can access the "pgn" property by loading the context object that represents the current game.
20
+ You could suggest a good next move or offer to play a move.
21
+ Don't actually make a move unless you are asked to.
22
+ `
23
+ })
24
+ });
25
+ var blueprint = {
26
+ key: Chess.BLUEPRINT_KEY,
27
+ make
28
+ };
29
+ var chess_blueprint_default = blueprint;
30
+
31
+ export {
32
+ chess_blueprint_default
33
+ };
34
+ //# sourceMappingURL=chunk-XWKNXG62.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/blueprints/chess-blueprint.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Blueprint, Template } from '@dxos/compute';\nimport { trim } from '@dxos/util';\n\nimport { Chess, ChessOperation } from '#types';\n\nconst operations = [ChessOperation.Move, ChessOperation.Play, ChessOperation.Print];\n\nconst make = () =>\n Blueprint.make({\n key: Chess.BLUEPRINT_KEY,\n name: 'Chess',\n tools: Blueprint.toolDefinitions({ operations }),\n instructions: Template.make({\n source: trim`\n You are an expert chess player.\n To analyze a game you can access the \"pgn\" property by loading the context object that represents the current game.\n You could suggest a good next move or offer to play a move.\n Don't actually make a move unless you are asked to.\n `,\n }),\n });\n\nconst blueprint: Blueprint.Definition = {\n key: Chess.BLUEPRINT_KEY,\n make,\n};\n\nexport default blueprint;\n"],
5
+ "mappings": ";AAIA,SAASA,WAAWC,gBAAgB;AACpC,SAASC,YAAY;AAErB,SAASC,OAAOC,sBAAsB;AAEtC,IAAMC,aAAa;EAACD,eAAeE;EAAMF,eAAeG;EAAMH,eAAeI;;AAE7E,IAAMC,OAAO,MACXT,UAAUS,KAAK;EACbC,KAAKP,MAAMQ;EACXC,MAAM;EACNC,OAAOb,UAAUc,gBAAgB;IAAET;EAAW,CAAA;EAC9CU,cAAcd,SAASQ,KAAK;IAC1BO,QAAQd;;;;;;EAMV,CAAA;AACF,CAAA;AAEF,IAAMe,YAAkC;EACtCP,KAAKP,MAAMQ;EACXF;AACF;AAEA,IAAA,0BAAeQ;",
6
+ "names": ["Blueprint", "Template", "trim", "Chess", "ChessOperation", "operations", "Move", "Play", "Print", "make", "key", "BLUEPRINT_KEY", "name", "tools", "toolDefinitions", "instructions", "source", "blueprint"]
7
+ }