@dxos/plugin-chess 0.8.4-main.bc674ce → 0.8.4-main.bcb3aa67d6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (216) hide show
  1. package/dist/lib/browser/blueprints/index.mjs +9 -6
  2. package/dist/lib/browser/{chunk-66H3V2YV.mjs → chunk-2TJN26DN.mjs} +9 -6
  3. package/dist/lib/browser/chunk-2TJN26DN.mjs.map +7 -0
  4. package/dist/lib/browser/chunk-GPFHUDFY.mjs +110 -0
  5. package/dist/lib/browser/chunk-GPFHUDFY.mjs.map +7 -0
  6. package/dist/lib/browser/chunk-JKW2ZYHP.mjs +28 -0
  7. package/dist/lib/browser/chunk-JKW2ZYHP.mjs.map +7 -0
  8. package/dist/lib/browser/chunk-MC7L6JNC.mjs +36 -0
  9. package/dist/lib/browser/chunk-MC7L6JNC.mjs.map +7 -0
  10. package/dist/lib/browser/cli/index.mjs +21 -15
  11. package/dist/lib/browser/cli/index.mjs.map +3 -3
  12. package/dist/lib/browser/create-UJ656WLM.mjs +24 -0
  13. package/dist/lib/browser/create-UJ656WLM.mjs.map +7 -0
  14. package/dist/lib/browser/index.mjs +351 -61
  15. package/dist/lib/browser/index.mjs.map +4 -4
  16. package/dist/lib/browser/meta.json +1 -1
  17. package/dist/lib/browser/move-QCJSXFHW.mjs +36 -0
  18. package/dist/lib/browser/move-QCJSXFHW.mjs.map +7 -0
  19. package/dist/lib/browser/operations/index.mjs +19 -0
  20. package/dist/lib/browser/operations/index.mjs.map +7 -0
  21. package/dist/lib/browser/play-YEOTE6KO.mjs +45 -0
  22. package/dist/lib/browser/play-YEOTE6KO.mjs.map +7 -0
  23. package/dist/lib/browser/print-LUCG4CIR.mjs +30 -0
  24. package/dist/lib/browser/print-LUCG4CIR.mjs.map +7 -0
  25. package/dist/lib/browser/types/index.mjs +1 -1
  26. package/dist/lib/node-esm/blueprints/index.mjs +9 -6
  27. package/dist/lib/node-esm/chunk-4HZWCKMR.mjs +38 -0
  28. package/dist/lib/node-esm/chunk-4HZWCKMR.mjs.map +7 -0
  29. package/dist/lib/node-esm/chunk-D72ZBXX6.mjs +29 -0
  30. package/dist/lib/node-esm/chunk-D72ZBXX6.mjs.map +7 -0
  31. package/dist/lib/node-esm/chunk-LPVPGURE.mjs +111 -0
  32. package/dist/lib/node-esm/chunk-LPVPGURE.mjs.map +7 -0
  33. package/dist/lib/node-esm/{chunk-OUNGNJFP.mjs → chunk-OIRJVY2R.mjs} +9 -6
  34. package/dist/lib/node-esm/chunk-OIRJVY2R.mjs.map +7 -0
  35. package/dist/lib/node-esm/cli/index.mjs +21 -15
  36. package/dist/lib/node-esm/cli/index.mjs.map +3 -3
  37. package/dist/lib/node-esm/create-KINGWZOM.mjs +25 -0
  38. package/dist/lib/node-esm/create-KINGWZOM.mjs.map +7 -0
  39. package/dist/lib/node-esm/index.mjs +351 -61
  40. package/dist/lib/node-esm/index.mjs.map +4 -4
  41. package/dist/lib/node-esm/meta.json +1 -1
  42. package/dist/lib/node-esm/move-JDR3KQ5G.mjs +37 -0
  43. package/dist/lib/node-esm/move-JDR3KQ5G.mjs.map +7 -0
  44. package/dist/lib/node-esm/operations/index.mjs +20 -0
  45. package/dist/lib/node-esm/operations/index.mjs.map +7 -0
  46. package/dist/lib/node-esm/play-KIWAE5LA.mjs +46 -0
  47. package/dist/lib/node-esm/play-KIWAE5LA.mjs.map +7 -0
  48. package/dist/lib/node-esm/print-QHFZDMWC.mjs +31 -0
  49. package/dist/lib/node-esm/print-QHFZDMWC.mjs.map +7 -0
  50. package/dist/lib/node-esm/types/index.mjs +1 -1
  51. package/dist/types/src/ChessPlugin.d.ts.map +1 -1
  52. package/dist/types/src/blueprints/chess-blueprint.d.ts +3 -20
  53. package/dist/types/src/blueprints/chess-blueprint.d.ts.map +1 -1
  54. package/dist/types/src/blueprints/index.d.ts +2 -2
  55. package/dist/types/src/blueprints/index.d.ts.map +1 -1
  56. package/dist/types/src/capabilities/{artifact-definition/artifact-definition.d.ts → artifact-definition.d.ts} +1 -1
  57. package/dist/types/src/capabilities/artifact-definition.d.ts.map +1 -0
  58. package/dist/types/src/capabilities/blueprint-definition.d.ts +6 -0
  59. package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
  60. package/dist/types/src/capabilities/index.d.ts +5 -2
  61. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  62. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  63. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  64. package/dist/types/src/capabilities/react-surface.d.ts +5 -0
  65. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  66. package/dist/types/src/cli/plugin.d.ts.map +1 -1
  67. package/dist/types/src/components/{Chessboard.d.ts → Chessboard/Chessboard.d.ts} +4 -9
  68. package/dist/types/src/components/Chessboard/Chessboard.d.ts.map +1 -0
  69. package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts +48 -0
  70. package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts.map +1 -0
  71. package/dist/types/src/components/{Info.d.ts → Chessboard/Info.d.ts} +1 -1
  72. package/dist/types/src/components/Chessboard/Info.d.ts.map +1 -0
  73. package/dist/types/src/components/Chessboard/index.d.ts +2 -0
  74. package/dist/types/src/components/Chessboard/index.d.ts.map +1 -0
  75. package/dist/types/src/components/Chessboard/types.d.ts +8 -0
  76. package/dist/types/src/components/Chessboard/types.d.ts.map +1 -0
  77. package/dist/types/src/components/index.d.ts +0 -1
  78. package/dist/types/src/components/index.d.ts.map +1 -1
  79. package/dist/types/src/containers/ChessArticle/ChessArticle.d.ts +6 -0
  80. package/dist/types/src/containers/ChessArticle/ChessArticle.d.ts.map +1 -0
  81. package/dist/types/src/containers/ChessArticle/ChessArticle.stories.d.ts +47 -0
  82. package/dist/types/src/containers/ChessArticle/ChessArticle.stories.d.ts.map +1 -0
  83. package/dist/types/src/containers/ChessArticle/index.d.ts +3 -0
  84. package/dist/types/src/containers/ChessArticle/index.d.ts.map +1 -0
  85. package/dist/types/src/containers/ChessCard/ChessCard.d.ts +6 -0
  86. package/dist/types/src/containers/ChessCard/ChessCard.d.ts.map +1 -0
  87. package/dist/types/src/{components/Card.stories.d.ts → containers/ChessCard/ChessCard.stories.d.ts} +1 -1
  88. package/dist/types/src/containers/ChessCard/ChessCard.stories.d.ts.map +1 -0
  89. package/dist/types/src/containers/ChessCard/index.d.ts +3 -0
  90. package/dist/types/src/containers/ChessCard/index.d.ts.map +1 -0
  91. package/dist/types/src/containers/index.d.ts +4 -0
  92. package/dist/types/src/containers/index.d.ts.map +1 -0
  93. package/dist/types/src/index.d.ts +1 -2
  94. package/dist/types/src/index.d.ts.map +1 -1
  95. package/dist/types/src/operations/create.d.ts +5 -0
  96. package/dist/types/src/operations/create.d.ts.map +1 -0
  97. package/dist/types/src/operations/definitions.d.ts +51 -0
  98. package/dist/types/src/operations/definitions.d.ts.map +1 -0
  99. package/dist/types/src/operations/index.d.ts +4 -0
  100. package/dist/types/src/operations/index.d.ts.map +1 -0
  101. package/dist/types/src/operations/move.d.ts +5 -0
  102. package/dist/types/src/operations/move.d.ts.map +1 -0
  103. package/dist/types/src/operations/play.d.ts +5 -0
  104. package/dist/types/src/operations/play.d.ts.map +1 -0
  105. package/dist/types/src/operations/print.d.ts +5 -0
  106. package/dist/types/src/operations/print.d.ts.map +1 -0
  107. package/dist/types/src/translations.d.ts +21 -20
  108. package/dist/types/src/translations.d.ts.map +1 -1
  109. package/dist/types/src/types/Chess.d.ts +1 -1
  110. package/dist/types/src/types/Chess.d.ts.map +1 -1
  111. package/dist/types/tsconfig.tsbuildinfo +1 -1
  112. package/package.json +51 -35
  113. package/src/ChessPlugin.tsx +30 -15
  114. package/src/blueprints/chess-blueprint.ts +14 -7
  115. package/src/blueprints/index.ts +2 -2
  116. package/src/capabilities/{artifact-definition/artifact-definition.ts → artifact-definition.ts} +5 -5
  117. package/src/capabilities/blueprint-definition.ts +17 -0
  118. package/src/capabilities/index.ts +9 -2
  119. package/src/capabilities/operation-handler.ts +14 -0
  120. package/src/capabilities/react-surface.tsx +33 -0
  121. package/src/cli/plugin.ts +18 -7
  122. package/src/components/Chessboard/Chessboard.stories.tsx +94 -0
  123. package/src/components/{Chessboard.tsx → Chessboard/Chessboard.tsx} +22 -30
  124. package/src/components/{Info.tsx → Chessboard/Info.tsx} +26 -17
  125. package/src/components/Chessboard/index.ts +5 -0
  126. package/src/components/Chessboard/types.ts +18 -0
  127. package/src/components/index.ts +1 -5
  128. package/src/{components/Chessboard.stories.tsx → containers/ChessArticle/ChessArticle.stories.tsx} +9 -9
  129. package/src/containers/ChessArticle/ChessArticle.tsx +73 -0
  130. package/src/containers/ChessArticle/index.ts +7 -0
  131. package/src/{components/Card.stories.tsx → containers/ChessCard/ChessCard.stories.tsx} +9 -14
  132. package/src/containers/ChessCard/ChessCard.tsx +22 -0
  133. package/src/containers/ChessCard/index.ts +7 -0
  134. package/src/containers/index.ts +8 -0
  135. package/src/index.ts +1 -2
  136. package/src/meta.ts +1 -1
  137. package/src/operations/create.ts +22 -0
  138. package/src/operations/definitions.ts +109 -0
  139. package/src/operations/index.ts +16 -0
  140. package/src/operations/move.ts +37 -0
  141. package/src/operations/play.ts +46 -0
  142. package/src/operations/print.ts +28 -0
  143. package/src/translations.ts +21 -20
  144. package/src/types/Chess.ts +7 -3
  145. package/dist/lib/browser/ChessboardContainer-JZ4ANG4O.mjs +0 -81
  146. package/dist/lib/browser/ChessboardContainer-JZ4ANG4O.mjs.map +0 -7
  147. package/dist/lib/browser/blueprint-definition-P7TYXWMF.mjs +0 -18
  148. package/dist/lib/browser/blueprint-definition-P7TYXWMF.mjs.map +0 -7
  149. package/dist/lib/browser/chunk-66H3V2YV.mjs.map +0 -7
  150. package/dist/lib/browser/chunk-73BDP7UV.mjs +0 -275
  151. package/dist/lib/browser/chunk-73BDP7UV.mjs.map +0 -7
  152. package/dist/lib/browser/chunk-FO4ZNFN6.mjs +0 -229
  153. package/dist/lib/browser/chunk-FO4ZNFN6.mjs.map +0 -7
  154. package/dist/lib/browser/chunk-H3NUMCQ6.mjs +0 -21
  155. package/dist/lib/browser/chunk-H3NUMCQ6.mjs.map +0 -7
  156. package/dist/lib/browser/chunk-OW6S2SRG.mjs +0 -8
  157. package/dist/lib/browser/chunk-OW6S2SRG.mjs.map +0 -7
  158. package/dist/lib/browser/react-surface-VNOWFKC6.mjs +0 -37
  159. package/dist/lib/browser/react-surface-VNOWFKC6.mjs.map +0 -7
  160. package/dist/lib/node-esm/ChessboardContainer-7ONFYN7L.mjs +0 -82
  161. package/dist/lib/node-esm/ChessboardContainer-7ONFYN7L.mjs.map +0 -7
  162. package/dist/lib/node-esm/blueprint-definition-SL4LBVV5.mjs +0 -19
  163. package/dist/lib/node-esm/blueprint-definition-SL4LBVV5.mjs.map +0 -7
  164. package/dist/lib/node-esm/chunk-24GJHLHM.mjs +0 -10
  165. package/dist/lib/node-esm/chunk-24GJHLHM.mjs.map +0 -7
  166. package/dist/lib/node-esm/chunk-C7IWIXCJ.mjs +0 -230
  167. package/dist/lib/node-esm/chunk-C7IWIXCJ.mjs.map +0 -7
  168. package/dist/lib/node-esm/chunk-F5OMIM4F.mjs +0 -23
  169. package/dist/lib/node-esm/chunk-F5OMIM4F.mjs.map +0 -7
  170. package/dist/lib/node-esm/chunk-OUNGNJFP.mjs.map +0 -7
  171. package/dist/lib/node-esm/chunk-WXEPWOHT.mjs +0 -276
  172. package/dist/lib/node-esm/chunk-WXEPWOHT.mjs.map +0 -7
  173. package/dist/lib/node-esm/react-surface-HSHCIOAS.mjs +0 -38
  174. package/dist/lib/node-esm/react-surface-HSHCIOAS.mjs.map +0 -7
  175. package/dist/types/src/blueprints/functions/create.d.ts +0 -15
  176. package/dist/types/src/blueprints/functions/create.d.ts.map +0 -1
  177. package/dist/types/src/blueprints/functions/index.d.ts +0 -5
  178. package/dist/types/src/blueprints/functions/index.d.ts.map +0 -1
  179. package/dist/types/src/blueprints/functions/move.d.ts +0 -8
  180. package/dist/types/src/blueprints/functions/move.d.ts.map +0 -1
  181. package/dist/types/src/blueprints/functions/play.d.ts +0 -9
  182. package/dist/types/src/blueprints/functions/play.d.ts.map +0 -1
  183. package/dist/types/src/blueprints/functions/print.d.ts +0 -8
  184. package/dist/types/src/blueprints/functions/print.d.ts.map +0 -1
  185. package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts.map +0 -1
  186. package/dist/types/src/capabilities/artifact-definition/index.d.ts +0 -3
  187. package/dist/types/src/capabilities/artifact-definition/index.d.ts.map +0 -1
  188. package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +0 -9
  189. package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +0 -1
  190. package/dist/types/src/capabilities/blueprint-definition/index.d.ts +0 -3
  191. package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +0 -1
  192. package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
  193. package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
  194. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +0 -5
  195. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
  196. package/dist/types/src/components/Card.stories.d.ts.map +0 -1
  197. package/dist/types/src/components/Chessboard.d.ts.map +0 -1
  198. package/dist/types/src/components/Chessboard.stories.d.ts +0 -46
  199. package/dist/types/src/components/Chessboard.stories.d.ts.map +0 -1
  200. package/dist/types/src/components/ChessboardArticle.d.ts +0 -6
  201. package/dist/types/src/components/ChessboardArticle.d.ts.map +0 -1
  202. package/dist/types/src/components/ChessboardContainer.d.ts +0 -7
  203. package/dist/types/src/components/ChessboardContainer.d.ts.map +0 -1
  204. package/dist/types/src/components/Info.d.ts.map +0 -1
  205. package/src/blueprints/functions/create.ts +0 -38
  206. package/src/blueprints/functions/index.ts +0 -8
  207. package/src/blueprints/functions/move.ts +0 -49
  208. package/src/blueprints/functions/play.ts +0 -59
  209. package/src/blueprints/functions/print.ts +0 -42
  210. package/src/capabilities/artifact-definition/index.ts +0 -7
  211. package/src/capabilities/blueprint-definition/blueprint-definition.ts +0 -23
  212. package/src/capabilities/blueprint-definition/index.ts +0 -7
  213. package/src/capabilities/react-surface/index.ts +0 -7
  214. package/src/capabilities/react-surface/react-surface.tsx +0 -27
  215. package/src/components/ChessboardArticle.tsx +0 -71
  216. package/src/components/ChessboardContainer.tsx +0 -40
@@ -4,33 +4,34 @@
4
4
 
5
5
  import { type Resource } from '@dxos/react-ui';
6
6
 
7
- import { meta } from './meta';
8
- import { Chess } from './types';
7
+ import { meta } from '#meta';
8
+ import { Chess } from '#types';
9
9
 
10
10
  export const translations = [
11
11
  {
12
12
  'en-US': {
13
13
  [Chess.Game.typename]: {
14
- 'typename label': 'Game',
15
- 'typename label_zero': 'Games',
16
- 'typename label_one': 'Game',
17
- 'typename label_other': 'Games',
18
- 'object name placeholder': 'New game',
19
- 'rename object label': 'Rename game',
20
- 'delete object label': 'Delete game',
21
- 'object deleted label': 'Game deleted',
14
+ 'typename.label': 'Game',
15
+ 'typename.label_zero': 'Games',
16
+ 'typename.label_one': 'Game',
17
+ 'typename.label_other': 'Games',
18
+ 'object-name.placeholder': 'New game',
19
+ 'add-object.label': 'Add game',
20
+ 'rename-object.label': 'Rename game',
21
+ 'delete-object.label': 'Delete game',
22
+ 'object-deleted.label': 'Game deleted',
22
23
  },
23
24
  [meta.id]: {
24
- 'plugin name': 'Chess',
25
- 'delete game label': 'Delete',
26
- 'game.checkmate label': 'Checkmate',
27
- 'game.stalemate label': 'Stalemate',
28
- 'game.draw label': 'Draw',
29
- 'game.check label': 'Check',
30
- 'select player button': 'Select player',
31
- 'toggle info button': 'Toggle info',
32
- 'close info button': 'Close info',
33
- 'flip board button': 'Flip board',
25
+ 'plugin.name': 'Chess',
26
+ 'delete-game.label': 'Delete',
27
+ 'game.checkmate.label': 'Checkmate',
28
+ 'game.stalemate.label': 'Stalemate',
29
+ 'game.draw.label': 'Draw',
30
+ 'game.check.label': 'Check',
31
+ 'select-player.button': 'Select player',
32
+ 'toggle-info.button': 'Toggle info',
33
+ 'close-info.button': 'Close info',
34
+ 'flip-board.button': 'Flip board',
34
35
  },
35
36
  },
36
37
  },
@@ -5,7 +5,7 @@
5
5
  import { Chess as ChessJS } from 'chess.js';
6
6
  import * as Schema from 'effect/Schema';
7
7
 
8
- import { Obj, Type } from '@dxos/echo';
8
+ import { Annotation, Obj, Type } from '@dxos/echo';
9
9
  import { FormInputAnnotation, LabelAnnotation } from '@dxos/echo/internal';
10
10
  import { log } from '@dxos/log';
11
11
 
@@ -31,10 +31,14 @@ export const Game = Schema.Struct({
31
31
  }).pipe(FormInputAnnotation.set(false), Schema.optional),
32
32
  }).pipe(
33
33
  Type.object({
34
- typename: 'dxos.org/type/Chess',
35
- version: '0.2.0',
34
+ typename: 'org.dxos.type.chess',
35
+ version: '0.1.0',
36
36
  }),
37
37
  LabelAnnotation.set(['name']),
38
+ Annotation.IconAnnotation.set({
39
+ icon: 'ph--shield-chevron--regular',
40
+ hue: 'amber',
41
+ }),
38
42
  );
39
43
 
40
44
  export interface Game extends Schema.Schema.Type<typeof Game> {}
@@ -1,81 +0,0 @@
1
- import {
2
- Chessboard
3
- } from "./chunk-73BDP7UV.mjs";
4
- import {
5
- meta
6
- } from "./chunk-H3NUMCQ6.mjs";
7
- import "./chunk-J5LGTIGS.mjs";
8
-
9
- // src/components/ChessboardContainer.tsx
10
- import React2 from "react";
11
- import { Obj } from "@dxos/echo";
12
-
13
- // src/components/ChessboardArticle.tsx
14
- import React, { useCallback, useRef, useState } from "react";
15
- import { Toolbar, useTranslation } from "@dxos/react-ui";
16
- import { Layout } from "@dxos/react-ui-mosaic";
17
- import { mx } from "@dxos/ui-theme";
18
- var ChessboardArticle = ({ role, subject: game }) => {
19
- const { t } = useTranslation(meta.id);
20
- const [orientation, setOrientation] = useState("white");
21
- const [open, setOpen] = useState(true);
22
- const controller = useRef(null);
23
- const handleSelect = useCallback((index) => {
24
- controller.current?.setMoveNumber(index);
25
- }, []);
26
- return /* @__PURE__ */ React.createElement(Layout.Main, {
27
- toolbar: true,
28
- classNames: "@container"
29
- }, /* @__PURE__ */ React.createElement(Chessboard.Root, {
30
- game,
31
- ref: controller
32
- }, /* @__PURE__ */ React.createElement(Toolbar.Root, null, /* @__PURE__ */ React.createElement(Toolbar.IconButton, {
33
- icon: "ph--info--regular",
34
- iconOnly: true,
35
- label: t("toggle info button"),
36
- disabled: open,
37
- classNames: mx("invisible @3xl:visible"),
38
- onClick: () => setOpen((open2) => !open2)
39
- })), /* @__PURE__ */ React.createElement("div", {
40
- className: mx("grid bs-full is-full gap-2", open && "@3xl:grid-cols-[1fr_320px]", role === "section" && "aspect-square", role === "section" && open && "@3xl:aspect-auto")
41
- }, /* @__PURE__ */ React.createElement(Chessboard.Content, null, /* @__PURE__ */ React.createElement(Chessboard.Board, {
42
- classNames: "m-4 rounded-sm overflow-hidden",
43
- orientation
44
- })), open && /* @__PURE__ */ React.createElement("div", {
45
- className: "hidden @3xl:flex flex-col p-8 justify-center items-center overflow-hidden"
46
- }, /* @__PURE__ */ React.createElement(Chessboard.Info, {
47
- orientation,
48
- min: 8,
49
- max: 8,
50
- onOrientationChange: setOrientation,
51
- onClose: () => setOpen(false),
52
- onSelect: handleSelect
53
- })))));
54
- };
55
-
56
- // src/components/ChessboardContainer.tsx
57
- var ChessboardContainer = ({ role, subject: game }) => {
58
- const db = Obj.getDatabase(game);
59
- if (!db) {
60
- return null;
61
- }
62
- switch (role) {
63
- case "card--content": {
64
- return /* @__PURE__ */ React2.createElement(Chessboard.Root, {
65
- game
66
- }, /* @__PURE__ */ React2.createElement(Chessboard.Content, null, /* @__PURE__ */ React2.createElement(Chessboard.Board, null)));
67
- }
68
- default: {
69
- return /* @__PURE__ */ React2.createElement(ChessboardArticle, {
70
- role,
71
- subject: game
72
- });
73
- }
74
- }
75
- };
76
- var ChessboardContainer_default = ChessboardContainer;
77
- export {
78
- ChessboardContainer,
79
- ChessboardContainer_default as default
80
- };
81
- //# sourceMappingURL=ChessboardContainer-JZ4ANG4O.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/ChessboardContainer.tsx", "../../../src/components/ChessboardArticle.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type SurfaceComponentProps } from '@dxos/app-framework/react';\nimport { Obj } from '@dxos/echo';\n\nimport { type Chess } from '../types';\n\nimport { Chessboard } from './Chessboard';\nimport { ChessboardArticle } from './ChessboardArticle';\n\nexport type ChessboardContainerProps = SurfaceComponentProps<Chess.Game>;\n\nexport const ChessboardContainer = ({ role, subject: game }: ChessboardContainerProps) => {\n const db = Obj.getDatabase(game);\n if (!db) {\n return null;\n }\n\n switch (role) {\n case 'card--content': {\n return (\n <Chessboard.Root game={game}>\n <Chessboard.Content>\n <Chessboard.Board />\n </Chessboard.Content>\n </Chessboard.Root>\n );\n }\n\n default: {\n return <ChessboardArticle role={role} subject={game} />;\n }\n }\n};\n\nexport default ChessboardContainer;\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useCallback, useRef, useState } from 'react';\n\nimport { type SurfaceComponentProps } from '@dxos/app-framework/react';\nimport { Toolbar, useTranslation } from '@dxos/react-ui';\nimport { type Player } from '@dxos/react-ui-gameboard';\nimport { Layout } from '@dxos/react-ui-mosaic';\nimport { mx } from '@dxos/ui-theme';\n\nimport { meta } from '../meta';\nimport { type Chess } from '../types';\n\nimport { Chessboard, type ChessboardController, type ChessboardInfoProps } from './Chessboard';\n\nexport type ChessboardArticleProps = SurfaceComponentProps<Chess.Game>;\n\nexport const ChessboardArticle = ({ role, subject: game }: ChessboardArticleProps) => {\n const { t } = useTranslation(meta.id);\n const [orientation, setOrientation] = useState<Player>('white');\n const [open, setOpen] = useState(true);\n const controller = useRef<ChessboardController>(null);\n\n // TODO(burdon): Keyboard handler.\n const handleSelect = useCallback<NonNullable<ChessboardInfoProps['onSelect']>>((index) => {\n controller.current?.setMoveNumber(index);\n }, []);\n\n return (\n <Layout.Main toolbar classNames='@container'>\n <Chessboard.Root game={game} ref={controller}>\n <Toolbar.Root>\n <Toolbar.IconButton\n icon='ph--info--regular'\n iconOnly\n label={t('toggle info button')}\n disabled={open}\n classNames={mx('invisible @3xl:visible')}\n onClick={() => setOpen((open) => !open)}\n />\n </Toolbar.Root>\n <div\n className={mx(\n 'grid bs-full is-full gap-2',\n open && '@3xl:grid-cols-[1fr_320px]',\n role === 'section' && 'aspect-square',\n role === 'section' && open && '@3xl:aspect-auto',\n )}\n >\n <Chessboard.Content>\n <Chessboard.Board classNames='m-4 rounded-sm overflow-hidden' orientation={orientation} />\n </Chessboard.Content>\n {open && (\n <div className='hidden @3xl:flex flex-col p-8 justify-center items-center overflow-hidden'>\n <Chessboard.Info\n orientation={orientation}\n min={8}\n max={8}\n onOrientationChange={setOrientation}\n onClose={() => setOpen(false)}\n onSelect={handleSelect}\n />\n </div>\n )}\n </div>\n </Chessboard.Root>\n </Layout.Main>\n );\n};\n"],
5
- "mappings": ";;;;;;;;;AAIA,OAAOA,YAAW;AAGlB,SAASC,WAAW;;;ACHpB,OAAOC,SAASC,aAAaC,QAAQC,gBAAgB;AAGrD,SAASC,SAASC,sBAAsB;AAExC,SAASC,cAAc;AACvB,SAASC,UAAU;AASZ,IAAMC,oBAAoB,CAAC,EAAEC,MAAMC,SAASC,KAAI,MAA0B;AAC/E,QAAM,EAAEC,EAAC,IAAKC,eAAeC,KAAKC,EAAE;AACpC,QAAM,CAACC,aAAaC,cAAAA,IAAkBC,SAAiB,OAAA;AACvD,QAAM,CAACC,MAAMC,OAAAA,IAAWF,SAAS,IAAA;AACjC,QAAMG,aAAaC,OAA6B,IAAA;AAGhD,QAAMC,eAAeC,YAA0D,CAACC,UAAAA;AAC9EJ,eAAWK,SAASC,cAAcF,KAAAA;EACpC,GAAG,CAAA,CAAE;AAEL,SACE,sBAAA,cAACG,OAAOC,MAAI;IAACC,SAAAA;IAAQC,YAAW;KAC9B,sBAAA,cAACC,WAAWC,MAAI;IAACtB;IAAYuB,KAAKb;KAChC,sBAAA,cAACc,QAAQF,MAAI,MACX,sBAAA,cAACE,QAAQC,YAAU;IACjBC,MAAK;IACLC,UAAAA;IACAC,OAAO3B,EAAE,oBAAA;IACT4B,UAAUrB;IACVY,YAAYU,GAAG,wBAAA;IACfC,SAAS,MAAMtB,QAAQ,CAACD,UAAS,CAACA,KAAAA;OAGtC,sBAAA,cAACwB,OAAAA;IACCC,WAAWH,GACT,8BACAtB,QAAQ,8BACRV,SAAS,aAAa,iBACtBA,SAAS,aAAaU,QAAQ,kBAAA;KAGhC,sBAAA,cAACa,WAAWa,SAAO,MACjB,sBAAA,cAACb,WAAWc,OAAK;IAACf,YAAW;IAAiCf;OAE/DG,QACC,sBAAA,cAACwB,OAAAA;IAAIC,WAAU;KACb,sBAAA,cAACZ,WAAWe,MAAI;IACd/B;IACAgC,KAAK;IACLC,KAAK;IACLC,qBAAqBjC;IACrBkC,SAAS,MAAM/B,QAAQ,KAAA;IACvBgC,UAAU7B;;AAQ1B;;;ADtDO,IAAM8B,sBAAsB,CAAC,EAAEC,MAAMC,SAASC,KAAI,MAA4B;AACnF,QAAMC,KAAKC,IAAIC,YAAYH,IAAAA;AAC3B,MAAI,CAACC,IAAI;AACP,WAAO;EACT;AAEA,UAAQH,MAAAA;IACN,KAAK,iBAAiB;AACpB,aACE,gBAAAM,OAAA,cAACC,WAAWC,MAAI;QAACN;SACf,gBAAAI,OAAA,cAACC,WAAWE,SAAO,MACjB,gBAAAH,OAAA,cAACC,WAAWG,OAAK,IAAA,CAAA,CAAA;IAIzB;IAEA,SAAS;AACP,aAAO,gBAAAJ,OAAA,cAACK,mBAAAA;QAAkBX;QAAYC,SAASC;;IACjD;EACF;AACF;AAEA,IAAA,8BAAeH;",
6
- "names": ["React", "Obj", "React", "useCallback", "useRef", "useState", "Toolbar", "useTranslation", "Layout", "mx", "ChessboardArticle", "role", "subject", "game", "t", "useTranslation", "meta", "id", "orientation", "setOrientation", "useState", "open", "setOpen", "controller", "useRef", "handleSelect", "useCallback", "index", "current", "setMoveNumber", "Layout", "Main", "toolbar", "classNames", "Chessboard", "Root", "ref", "Toolbar", "IconButton", "icon", "iconOnly", "label", "disabled", "mx", "onClick", "div", "className", "Content", "Board", "Info", "min", "max", "onOrientationChange", "onClose", "onSelect", "ChessboardContainer", "role", "subject", "game", "db", "Obj", "getDatabase", "React", "Chessboard", "Root", "Content", "Board", "ChessboardArticle"]
7
- }
@@ -1,18 +0,0 @@
1
- import {
2
- chess_blueprint_exports
3
- } from "./chunk-FO4ZNFN6.mjs";
4
- import "./chunk-66H3V2YV.mjs";
5
- import "./chunk-J5LGTIGS.mjs";
6
-
7
- // src/capabilities/blueprint-definition/blueprint-definition.ts
8
- import * as Effect from "effect/Effect";
9
- import { Capability, Common } from "@dxos/app-framework";
10
- var blueprintDefinition = Capability.makeModule(() => Effect.succeed([
11
- Capability.contributes(Common.Capability.Functions, chess_blueprint_exports.functions),
12
- Capability.contributes(Common.Capability.BlueprintDefinition, chess_blueprint_exports.make())
13
- ]));
14
- var blueprint_definition_default = blueprintDefinition;
15
- export {
16
- blueprint_definition_default as default
17
- };
18
- //# sourceMappingURL=blueprint-definition-P7TYXWMF.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/blueprint-definition/blueprint-definition.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability, Common } from '@dxos/app-framework';\n\nimport { ChessBlueprint } from '../../blueprints';\n\nexport type BlueprintCapabilities = [\n Capability.Capability<typeof Common.Capability.Functions>,\n Capability.Capability<typeof Common.Capability.BlueprintDefinition>,\n];\n\nconst blueprintDefinition = Capability.makeModule<[], BlueprintCapabilities>(() =>\n Effect.succeed([\n Capability.contributes(Common.Capability.Functions, ChessBlueprint.functions),\n Capability.contributes(Common.Capability.BlueprintDefinition, ChessBlueprint.make()),\n ]),\n);\n\nexport default blueprintDefinition;\n"],
5
- "mappings": ";;;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,YAAYC,cAAc;AASnC,IAAMC,sBAAsBC,WAAWC,WAAsC,MACpEC,eAAQ;EACbF,WAAWG,YAAYC,OAAOJ,WAAWK,WAAWC,wBAAeC,SAAS;EAC5EP,WAAWG,YAAYC,OAAOJ,WAAWQ,qBAAqBF,wBAAeG,KAAI,CAAA;CAClF,CAAA;AAGH,IAAA,+BAAeV;",
6
- "names": ["Effect", "Capability", "Common", "blueprintDefinition", "Capability", "makeModule", "succeed", "contributes", "Common", "Functions", "ChessBlueprint", "functions", "BlueprintDefinition", "make"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/types/Chess.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 { Obj, Type } from '@dxos/echo';\nimport { FormInputAnnotation, LabelAnnotation } from '@dxos/echo/internal';\nimport { log } from '@dxos/log';\n\nexport const Game = Schema.Struct({\n name: Schema.optional(Schema.String),\n players: Schema.Struct({\n white: Schema.optional(\n Schema.String.annotations({\n description: 'DID of white player',\n }),\n ),\n black: Schema.optional(\n Schema.String.annotations({\n description: 'DID of black player',\n }),\n ),\n }).pipe(FormInputAnnotation.set(false), Schema.optional),\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: 'dxos.org/type/Chess',\n version: '0.2.0',\n }),\n LabelAnnotation.set(['name']),\n);\n\nexport interface Game extends Schema.Schema.Type<typeof Game> {}\n\nexport const make = ({ name, pgn, fen }: { name?: string; pgn?: string; fen?: string } = {}) => {\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(Game, {\n name,\n pgn,\n fen,\n players: {},\n });\n};\n"],
5
- "mappings": ";;;;;AAAA;;;;;AAIA,SAASA,SAASC,eAAe;AACjC,YAAYC,YAAY;AAExB,SAASC,KAAKC,YAAY;AAC1B,SAASC,qBAAqBC,uBAAuB;AACrD,SAASC,WAAW;;AAEb,IAAMC,OAAcC,cAAO;EAChCC,MAAaC,gBAAgBC,aAAM;EACnCC,SAAgBJ,cAAO;IACrBK,OAAcH,gBACLC,cAAOG,YAAY;MACxBC,aAAa;IACf,CAAA,CAAA;IAEFC,OAAcN,gBACLC,cAAOG,YAAY;MACxBC,aAAa;IACf,CAAA,CAAA;EAEJ,CAAA,EAAGE,KAAKb,oBAAoBc,IAAI,KAAA,GAAeR,eAAQ;EACvDS,KAAYR,cAAOG,YAAY;IAC7BC,aAAa;EACf,CAAA,EAAGE,KAAKb,oBAAoBc,IAAI,KAAA,GAAeR,eAAQ;EACvDU,KAAYT,cAAOG,YAAY;IAC7BC,aAAa;EACf,CAAA,EAAGE,KAAKb,oBAAoBc,IAAI,KAAA,GAAeR,eAAQ;AACzD,CAAA,EAAGO,KACDd,KAAKkB,OAAO;EACVC,UAAU;EACVC,SAAS;AACX,CAAA,GACAlB,gBAAgBa,IAAI;EAAC;CAAO,CAAA;AAKvB,IAAMM,OAAO,CAAC,EAAEf,MAAMU,KAAKC,IAAG,IAAoD,CAAC,MAAC;AACzF,QAAMK,QAAQ,IAAIzB,QAAAA;AAClB,MAAImB,KAAK;AACP,QAAI;AACFM,YAAMC,QAAQP,GAAAA;IAChB,QAAQ;AACNb,UAAIqB,KAAKR,KAAAA,QAAAA;;;;;;IACX;EACF;AAEA,SAAOjB,IAAIsB,KAAKjB,MAAM;IACpBE;IACAU;IACAC;IACAR,SAAS,CAAC;EACZ,CAAA;AACF;",
6
- "names": ["Chess", "ChessJS", "Schema", "Obj", "Type", "FormInputAnnotation", "LabelAnnotation", "log", "Game", "Struct", "name", "optional", "String", "players", "white", "annotations", "description", "black", "pipe", "set", "pgn", "fen", "object", "typename", "version", "make", "chess", "loadPgn", "warn"]
7
- }
@@ -1,275 +0,0 @@
1
- import {
2
- meta
3
- } from "./chunk-H3NUMCQ6.mjs";
4
-
5
- // src/components/Chessboard.tsx
6
- import { RegistryContext } from "@effect-atom/atom-react";
7
- import React2, { forwardRef, useCallback, useContext, useEffect as useEffect2, useImperativeHandle, useMemo as useMemo2, useRef as useRef2 } from "react";
8
- import { addEventListener } from "@dxos/async";
9
- import { Obj as Obj2 } from "@dxos/echo";
10
- import { ChessModel, Gameboard, Chessboard as NaturalChessboard, getRawPgn, useGameboardContext as useGameboardContext2 } from "@dxos/react-ui-gameboard";
11
- import { useSoundEffect } from "@dxos/react-ui-sfx";
12
- import { mx as mx2 } from "@dxos/ui-theme";
13
-
14
- // src/components/Info.tsx
15
- import { useAtomValue } from "@effect-atom/atom-react";
16
- import React, { useEffect, useMemo, useRef } from "react";
17
- import { generateName } from "@dxos/display-name";
18
- import { Obj } from "@dxos/echo";
19
- import { useMembers } from "@dxos/react-client/echo";
20
- import { Icon, IconButton, Select, useTranslation } from "@dxos/react-ui";
21
- import { useGameboardContext } from "@dxos/react-ui-gameboard";
22
- import { mx } from "@dxos/ui-theme";
23
- var Info = ({ classNames, orientation = "white", onOrientationChange, onClose, ...props }) => {
24
- const { t } = useTranslation(meta.id);
25
- const { model } = useGameboardContext(Info.displayName);
26
- const db = Obj.getDatabase(model.object);
27
- const members = useMembers(db?.spaceId);
28
- return /* @__PURE__ */ React.createElement("div", {
29
- className: mx("grid grid-rows-[min-content_1fr_min-content] is-full min-is-[18rem] p-2 overflow-hidden bg-groupSurface rounded-sm", classNames)
30
- }, /* @__PURE__ */ React.createElement(PlayerIndicator, {
31
- model,
32
- player: orientation === "white" ? "black" : "white",
33
- icon: onClose && /* @__PURE__ */ React.createElement(IconButton, {
34
- icon: "ph--x--regular",
35
- iconOnly: true,
36
- label: t("close info button"),
37
- size: 4,
38
- onClick: onClose
39
- })
40
- }, /* @__PURE__ */ React.createElement(PlayerSelector, {
41
- value: model.object.players?.[orientation === "white" ? "black" : "white"],
42
- onValueChange: (value) => {
43
- Obj.change(model.object, (obj) => {
44
- obj.players[orientation === "white" ? "black" : "white"] = value;
45
- });
46
- },
47
- members
48
- })), /* @__PURE__ */ React.createElement(History, {
49
- model,
50
- ...props
51
- }), /* @__PURE__ */ React.createElement(PlayerIndicator, {
52
- model,
53
- player: orientation,
54
- icon: onOrientationChange && /* @__PURE__ */ React.createElement(IconButton, {
55
- classNames: mx("transition duration-200 ease-linear", orientation === "white" && "rotate-180"),
56
- icon: "ph--arrows-clockwise--regular",
57
- iconOnly: true,
58
- label: t("flip board button"),
59
- size: 4,
60
- onClick: () => onOrientationChange(orientation === "white" ? "black" : "white")
61
- })
62
- }, /* @__PURE__ */ React.createElement(PlayerSelector, {
63
- value: model.object.players?.[orientation],
64
- onValueChange: (value) => {
65
- Obj.change(model.object, (obj) => {
66
- obj.players[orientation] = value;
67
- });
68
- },
69
- members
70
- })));
71
- };
72
- Info.displayName = "Chessboard.Info";
73
- var History = ({ classNames, model, min, max, onSelect }) => {
74
- const { t } = useTranslation(meta.id);
75
- const moveIndex = useAtomValue(model.moveIndex);
76
- const label = model.game.isGameOver() ? model.game.isCheckmate() ? t("game.checkmate label") : model.game.isStalemate() ? t("game.stalemate label") : t("game.draw label") : model.game.isCheck() ? t("game.check label") : void 0;
77
- const history = model.game.history();
78
- const moves = useMemo(() => history.reduce((acc, move, index) => {
79
- if (index % 2 === 0) {
80
- acc.push([
81
- {
82
- index,
83
- move
84
- }
85
- ]);
86
- } else {
87
- acc[acc.length - 1].push({
88
- index,
89
- move
90
- });
91
- }
92
- return acc;
93
- }, []), [
94
- history.length
95
- ]);
96
- const scrollerRef = useRef(null);
97
- useEffect(() => {
98
- scrollerRef.current?.scrollTo({
99
- top: scrollerRef.current.scrollHeight
100
- });
101
- }, [
102
- history.length
103
- ]);
104
- useEffect(() => {
105
- const div = scrollerRef.current?.querySelector(`[data-index="${moveIndex - 1}"]`);
106
- scrollerRef.current?.classList.add("scrollbar-none");
107
- div?.scrollIntoView({
108
- behavior: "smooth"
109
- });
110
- scrollerRef.current?.classList.remove("scrollbar-none");
111
- }, [
112
- moveIndex
113
- ]);
114
- return /* @__PURE__ */ React.createElement("div", {
115
- ref: scrollerRef,
116
- className: mx("overflow-y-auto", classNames),
117
- style: {
118
- minHeight: min === void 0 ? "auto" : `${min * 24}px`,
119
- maxHeight: max === void 0 ? "auto" : `${max * 24}px`
120
- }
121
- }, moves.map(([a, b], index) => /* @__PURE__ */ React.createElement("div", {
122
- key: index,
123
- className: "grid grid-cols-[3rem_1fr_1fr_1rem] gap-2 pis-4 leading-1"
124
- }, /* @__PURE__ */ React.createElement("div", {
125
- className: "content-center text-xs text-subdued"
126
- }, index + 1), a && /* @__PURE__ */ React.createElement("div", {
127
- "data-index": a.index,
128
- className: mx("pis-2 cursor-pointer", a.index === moveIndex - 1 && "bg-primary-500"),
129
- onClick: () => onSelect?.(a.index + 1)
130
- }, a.move), b && /* @__PURE__ */ React.createElement("div", {
131
- "data-index": b.index,
132
- className: mx("pis-2 cursor-pointer", b.index === moveIndex - 1 && "bg-primary-500"),
133
- onClick: () => onSelect?.(b.index + 1)
134
- }, b.move))), label && /* @__PURE__ */ React.createElement("div", {
135
- className: "text-center"
136
- }, label));
137
- };
138
- var PlayerIndicator = ({ children, model, player, icon }) => {
139
- const turn = player === (model.game.turn() === "w" ? "white" : "black");
140
- return /* @__PURE__ */ React.createElement("div", {
141
- className: "grid grid-cols-[2rem_1fr_2rem] gap-2 bs-[--rail-size] pli-1 flex items-center overflow-hidden"
142
- }, /* @__PURE__ */ React.createElement("div", {
143
- className: "place-items-center"
144
- }, /* @__PURE__ */ React.createElement(Icon, {
145
- icon: turn ? "ph--circle--fill" : "ph--circle--thin",
146
- size: 6,
147
- classNames: mx(turn && (model.game.isCheckmate() ? "text-red-500" : "text-green-500"))
148
- })), /* @__PURE__ */ React.createElement("div", {
149
- className: "truncate overflow-hidden items-center"
150
- }, children), icon);
151
- };
152
- var PlayerSelector = ({ value, onValueChange, members }) => {
153
- const { t } = useTranslation(meta.id);
154
- return /* @__PURE__ */ React.createElement(Select.Root, {
155
- value,
156
- onValueChange
157
- }, /* @__PURE__ */ React.createElement(Select.TriggerButton, {
158
- placeholder: t("select player button")
159
- }), /* @__PURE__ */ React.createElement(Select.Portal, null, /* @__PURE__ */ React.createElement(Select.Content, null, /* @__PURE__ */ React.createElement(Select.Viewport, null, members.map((member) => {
160
- const memberKey = member.identity.identityKey.toHex();
161
- const displayName = member.identity?.profile?.displayName || generateName(memberKey);
162
- return /* @__PURE__ */ React.createElement(Select.Option, {
163
- key: memberKey,
164
- value: memberKey
165
- }, displayName);
166
- })), /* @__PURE__ */ React.createElement(Select.Arrow, null))));
167
- };
168
-
169
- // src/components/Chessboard.tsx
170
- var ExtendedChessModel = class extends ChessModel {
171
- object;
172
- constructor(registry, object) {
173
- super(registry), this.object = object;
174
- }
175
- };
176
- var Root = /* @__PURE__ */ forwardRef(({ game, children }, forwardedRef) => {
177
- const registry = useContext(RegistryContext);
178
- const model = useMemo2(() => new ExtendedChessModel(registry, game), [
179
- registry
180
- ]);
181
- const click = useSoundEffect("Click");
182
- useImperativeHandle(forwardedRef, () => {
183
- return {
184
- setMoveNumber: (index) => model.setMoveIndex(index)
185
- };
186
- }, [
187
- model
188
- ]);
189
- useEffect2(() => {
190
- if (model.pgn !== getRawPgn(game.pgn ?? "")) {
191
- const silent = model.pgn === "*";
192
- model.update(game.pgn);
193
- if (!silent) {
194
- void click.play();
195
- }
196
- }
197
- }, [
198
- game.pgn
199
- ]);
200
- const handleDrop = useCallback((move) => {
201
- if (!model.makeMove(move)) {
202
- return false;
203
- }
204
- void click.play();
205
- Obj2.change(game, (g) => {
206
- g.pgn = model.pgn;
207
- });
208
- return true;
209
- }, [
210
- model
211
- ]);
212
- return /* @__PURE__ */ React2.createElement(Gameboard.Root, {
213
- model,
214
- onDrop: handleDrop
215
- }, children);
216
- });
217
- var Content = ({ classNames, children, role }) => {
218
- return /* @__PURE__ */ React2.createElement(Gameboard.Content, {
219
- classNames: mx2(classNames, role === "card--popover" && "size-container popover-square"),
220
- grow: !role || role === "card--extrinsic",
221
- contain: !role || role === "card--extrinsic" || role === "card--popover"
222
- }, children);
223
- };
224
- var Board = (props) => {
225
- const registry = useContext(RegistryContext);
226
- const { model } = useGameboardContext2(Board.displayName);
227
- const ref = useRef2(null);
228
- useEffect2(() => {
229
- if (!ref.current) {
230
- return;
231
- }
232
- ref.current.setAttribute("data-arrow-keys", "all");
233
- return addEventListener(ref.current, "keydown", (ev) => {
234
- const moveIndex = registry.get(model.moveIndex);
235
- switch (ev.key) {
236
- case "ArrowUp":
237
- model.setMoveIndex(0);
238
- break;
239
- case "ArrowDown":
240
- model.setMoveIndex(model.game.history().length);
241
- break;
242
- case "ArrowLeft":
243
- if (moveIndex > 0) {
244
- model.setMoveIndex(moveIndex - 1);
245
- }
246
- break;
247
- case "ArrowRight":
248
- if (moveIndex < model.game.history().length) {
249
- model.setMoveIndex(moveIndex + 1);
250
- }
251
- break;
252
- }
253
- });
254
- }, [
255
- registry,
256
- model
257
- ]);
258
- return /* @__PURE__ */ React2.createElement(NaturalChessboard, {
259
- ref,
260
- ...props
261
- });
262
- };
263
- Board.displayName = "Chessboard.Board";
264
- var Chessboard = {
265
- Root,
266
- Content,
267
- Board,
268
- Info
269
- };
270
-
271
- export {
272
- ExtendedChessModel,
273
- Chessboard
274
- };
275
- //# sourceMappingURL=chunk-73BDP7UV.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/Chessboard.tsx", "../../../src/components/Info.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { type Registry, RegistryContext } from '@effect-atom/atom-react';\nimport React, {\n type PropsWithChildren,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n} from 'react';\n\nimport { addEventListener } from '@dxos/async';\nimport { Obj } from '@dxos/echo';\nimport { type ThemedClassName } from '@dxos/react-ui';\nimport {\n ChessModel,\n Gameboard,\n type GameboardRootProps,\n Chessboard as NaturalChessboard,\n type ChessboardProps as NaturalChessboardProps,\n getRawPgn,\n useGameboardContext,\n} from '@dxos/react-ui-gameboard';\nimport { useSoundEffect } from '@dxos/react-ui-sfx';\nimport { mx } from '@dxos/ui-theme';\n\nimport { type Chess } from '../types';\n\nimport { Info, type InfoProps } from './Info';\n\nexport interface ChessboardController {\n setMoveNumber(index: number): void;\n}\n\nexport class ExtendedChessModel extends ChessModel {\n constructor(\n registry: Registry.Registry,\n readonly object: Chess.Game,\n ) {\n super(registry);\n }\n}\n\n//\n// Root\n//\n\ntype RootProps = PropsWithChildren<{\n game: Chess.Game;\n}>;\n\nconst Root = forwardRef<ChessboardController, RootProps>(({ game, children }, forwardedRef) => {\n const registry = useContext(RegistryContext);\n const model = useMemo(() => new ExtendedChessModel(registry, game), [registry]);\n const click = useSoundEffect('Click');\n\n // Controller.\n useImperativeHandle(forwardedRef, () => {\n return {\n setMoveNumber: (index) => model.setMoveIndex(index),\n };\n }, [model]);\n\n // External change.\n // NOTE: Warning if user has not interacted with the board.\n useEffect(() => {\n if (model.pgn !== getRawPgn(game.pgn ?? '')) {\n const silent = model.pgn === '*';\n model.update(game.pgn);\n if (!silent) {\n void click.play();\n }\n }\n }, [game.pgn]);\n\n // Move.\n const handleDrop = useCallback<NonNullable<GameboardRootProps<ChessModel>['onDrop']>>(\n (move) => {\n if (!model.makeMove(move)) {\n return false;\n }\n\n void click.play();\n Obj.change(game, (g) => {\n g.pgn = model.pgn;\n });\n return true;\n },\n [model],\n );\n\n return (\n <Gameboard.Root model={model} onDrop={handleDrop}>\n {children}\n </Gameboard.Root>\n );\n});\n\n//\n// Content\n//\n\ntype Role = 'card--popover' | 'card--intrinsic' | 'card--extrinsic';\n\ntype ContentProps = ThemedClassName<PropsWithChildren<{ role?: Role }>>;\n\nconst Content = ({ classNames, children, role }: ContentProps) => {\n return (\n <Gameboard.Content\n classNames={mx(classNames, role === 'card--popover' && 'size-container popover-square')}\n grow={!role || role === 'card--extrinsic'}\n contain={!role || role === 'card--extrinsic' || role === 'card--popover'}\n >\n {children}\n </Gameboard.Content>\n );\n};\n\n//\n// Board\n//\n\ntype BoardProps = NaturalChessboardProps;\n\nconst Board = (props: BoardProps) => {\n const registry = useContext(RegistryContext);\n const { model } = useGameboardContext<ChessModel>(Board.displayName);\n\n // Keyboard navigation.\n const ref = useRef<HTMLDivElement>(null);\n useEffect(() => {\n if (!ref.current) {\n return;\n }\n\n // Participate in keyboard navigation (set tabIndex={0})\n ref.current.setAttribute('data-arrow-keys', 'all');\n\n return addEventListener(ref.current, 'keydown', (ev) => {\n const moveIndex = registry.get(model.moveIndex);\n switch (ev.key) {\n case 'ArrowUp':\n model.setMoveIndex(0);\n break;\n case 'ArrowDown':\n model.setMoveIndex(model.game.history().length);\n break;\n case 'ArrowLeft':\n if (moveIndex > 0) {\n model.setMoveIndex(moveIndex - 1);\n }\n break;\n case 'ArrowRight':\n if (moveIndex < model.game.history().length) {\n model.setMoveIndex(moveIndex + 1);\n }\n break;\n }\n });\n }, [registry, model]);\n\n return <NaturalChessboard ref={ref} {...props} />;\n};\n\nBoard.displayName = 'Chessboard.Board';\n\n//\n// Chessboard\n//\n\nexport const Chessboard = {\n Root: Root,\n Content: Content,\n Board: Board,\n Info: Info,\n};\n\nexport type {\n RootProps as ChessboardRootProps,\n ContentProps as ChessboardContentProps,\n BoardProps as ChessboardBoardProps,\n InfoProps as ChessboardInfoProps,\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { useAtomValue } from '@effect-atom/atom-react';\nimport React, { type JSX, type PropsWithChildren, useEffect, useMemo, useRef } from 'react';\n\nimport { generateName } from '@dxos/display-name';\nimport { Obj } from '@dxos/echo';\nimport { type SpaceMember, useMembers } from '@dxos/react-client/echo';\nimport { Icon, IconButton, Select, type ThemedClassName, useTranslation } from '@dxos/react-ui';\nimport { type Player, useGameboardContext } from '@dxos/react-ui-gameboard';\nimport { mx } from '@dxos/ui-theme';\n\nimport { meta } from '../meta';\n\nimport { type ExtendedChessModel } from './Chessboard';\n\nexport type InfoProps = ThemedClassName<\n {\n orientation?: Player;\n onOrientationChange?: (orientation: Player) => void;\n onClose?: () => void;\n } & Pick<HistoryProps, 'min' | 'max' | 'onSelect'>\n>;\n\nexport const Info = ({ classNames, orientation = 'white', onOrientationChange, onClose, ...props }: InfoProps) => {\n const { t } = useTranslation(meta.id);\n const { model } = useGameboardContext<ExtendedChessModel>(Info.displayName);\n const db = Obj.getDatabase(model.object);\n const members = useMembers(db?.spaceId);\n\n return (\n <div\n className={mx(\n 'grid grid-rows-[min-content_1fr_min-content] is-full min-is-[18rem] p-2 overflow-hidden bg-groupSurface rounded-sm',\n classNames,\n )}\n >\n <PlayerIndicator\n model={model}\n player={orientation === 'white' ? 'black' : 'white'}\n icon={\n onClose && (\n <IconButton icon='ph--x--regular' iconOnly label={t('close info button')} size={4} onClick={onClose} />\n )\n }\n >\n <PlayerSelector\n value={model.object.players?.[orientation === 'white' ? 'black' : 'white']}\n onValueChange={(value) => {\n Obj.change(model.object, (obj) => {\n obj.players![orientation === 'white' ? 'black' : 'white'] = value;\n });\n }}\n members={members}\n />\n </PlayerIndicator>\n\n <History model={model} {...props} />\n\n <PlayerIndicator\n model={model}\n player={orientation}\n icon={\n onOrientationChange && (\n <IconButton\n classNames={mx('transition duration-200 ease-linear', orientation === 'white' && 'rotate-180')}\n icon='ph--arrows-clockwise--regular'\n iconOnly\n label={t('flip board button')}\n size={4}\n onClick={() => onOrientationChange(orientation === 'white' ? 'black' : 'white')}\n />\n )\n }\n >\n <PlayerSelector\n value={model.object.players?.[orientation]}\n onValueChange={(value) => {\n Obj.change(model.object, (obj) => {\n obj.players![orientation] = value;\n });\n }}\n members={members}\n />\n </PlayerIndicator>\n </div>\n );\n};\n\nInfo.displayName = 'Chessboard.Info';\n\n//\n// History\n//\n\ntype HistoryProps = ThemedClassName<{\n model: ExtendedChessModel;\n min?: number;\n max?: number;\n onSelect?: (index: number) => void;\n}>;\n\nconst History = ({ classNames, model, min, max, onSelect }: HistoryProps) => {\n const { t } = useTranslation(meta.id);\n const moveIndex = useAtomValue(model.moveIndex);\n const label = model.game.isGameOver()\n ? model.game.isCheckmate()\n ? t('game.checkmate label')\n : model.game.isStalemate()\n ? t('game.stalemate label')\n : t('game.draw label')\n : model.game.isCheck()\n ? t('game.check label')\n : undefined;\n\n const history = model.game.history();\n const moves = useMemo(\n () =>\n history.reduce(\n (acc, move, index) => {\n if (index % 2 === 0) {\n acc.push([{ index, move }]);\n } else {\n acc[acc.length - 1].push({ index, move });\n }\n return acc;\n },\n [] as { index: number; move: string }[][],\n ),\n [history.length],\n );\n\n const scrollerRef = useRef<HTMLDivElement>(null);\n useEffect(() => {\n scrollerRef.current?.scrollTo({ top: scrollerRef.current.scrollHeight });\n }, [history.length]);\n\n useEffect(() => {\n const div = scrollerRef.current?.querySelector(`[data-index=\"${moveIndex - 1}\"]`);\n scrollerRef.current?.classList.add('scrollbar-none');\n div?.scrollIntoView({ behavior: 'smooth' });\n scrollerRef.current?.classList.remove('scrollbar-none');\n }, [moveIndex]);\n\n return (\n <div\n ref={scrollerRef}\n className={mx('overflow-y-auto', classNames)}\n style={{\n minHeight: min === undefined ? 'auto' : `${min * 24}px`,\n maxHeight: max === undefined ? 'auto' : `${max * 24}px`,\n }}\n >\n {moves.map(([a, b], index) => (\n <div key={index} className='grid grid-cols-[3rem_1fr_1fr_1rem] gap-2 pis-4 leading-1'>\n <div className='content-center text-xs text-subdued'>{index + 1}</div>\n {a && (\n <div\n data-index={a.index}\n className={mx('pis-2 cursor-pointer', a.index === moveIndex - 1 && 'bg-primary-500')}\n onClick={() => onSelect?.(a.index + 1)}\n >\n {a.move}\n </div>\n )}\n {b && (\n <div\n data-index={b.index}\n className={mx('pis-2 cursor-pointer', b.index === moveIndex - 1 && 'bg-primary-500')}\n onClick={() => onSelect?.(b.index + 1)}\n >\n {b.move}\n </div>\n )}\n </div>\n ))}\n {label && <div className='text-center'>{label}</div>}\n </div>\n );\n};\n\n//\n// PlayerIndicator\n//\n\ntype PlayerIndicatorProps = PropsWithChildren<{\n model: ExtendedChessModel;\n player: Player;\n icon?: JSX.Element;\n}>;\n\nconst PlayerIndicator = ({ children, model, player, icon }: PlayerIndicatorProps) => {\n const turn = player === (model.game.turn() === 'w' ? 'white' : 'black');\n return (\n <div className='grid grid-cols-[2rem_1fr_2rem] gap-2 bs-[--rail-size] pli-1 flex items-center overflow-hidden'>\n <div className='place-items-center'>\n <Icon\n icon={turn ? 'ph--circle--fill' : 'ph--circle--thin'}\n size={6}\n classNames={mx(turn && (model.game.isCheckmate() ? 'text-red-500' : 'text-green-500'))}\n />\n </div>\n <div className='truncate overflow-hidden items-center'>{children}</div>\n {icon}\n </div>\n );\n};\n\n//\n// PlayerSelector\n//\n\ntype PlayerSelectorProps = {\n value?: string;\n onValueChange: (player: string) => void;\n members: SpaceMember[];\n};\n\nconst PlayerSelector = ({ value, onValueChange, members }: PlayerSelectorProps) => {\n const { t } = useTranslation(meta.id);\n return (\n <Select.Root value={value} onValueChange={onValueChange}>\n <Select.TriggerButton placeholder={t('select player button')} />\n <Select.Portal>\n <Select.Content>\n <Select.Viewport>\n {members.map((member) => {\n const memberKey = member.identity.identityKey.toHex();\n const displayName = member.identity?.profile?.displayName || generateName(memberKey);\n return (\n <Select.Option key={memberKey} value={memberKey}>\n {displayName}\n </Select.Option>\n );\n })}\n </Select.Viewport>\n <Select.Arrow />\n </Select.Content>\n </Select.Portal>\n </Select.Root>\n );\n};\n"],
5
- "mappings": ";;;;;AAIA,SAAwBA,uBAAuB;AAC/C,OAAOC,UAELC,YACAC,aACAC,YACAC,aAAAA,YACAC,qBACAC,WAAAA,UACAC,UAAAA,eACK;AAEP,SAASC,wBAAwB;AACjC,SAASC,OAAAA,YAAW;AAEp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A;AAGP;AAQA,IAAMkC,QAAQ,CAACC,UAAAA;AACb,QAAMxC,WAAWO,WAAWC,eAAAA;AAC5B,QAAM,EAAEC,MAAK,IAAKgC,qBAAgCF,MAAMG,WAAW;AAGnE,QAAMC,MAAMC,QAAuB,IAAA;AACnC3B,EAAAA,WAAU,MAAA;AACR,QAAI,CAAC0B,IAAIE,SAAS;AAChB;IACF;AAGAF,QAAIE,QAAQC,aAAa,mBAAmB,KAAA;AAE5C,WAAOC,iBAAiBJ,IAAIE,SAAS,WAAW,CAACG,OAAAA;AAC/C,YAAMC,YAAYjD,SAASkD,IAAIzC,MAAMwC,SAAS;AAC9C,cAAQD,GAAGG,KAAG;QACZ,KAAK;AACH1C,gBAAMO,aAAa,CAAA;AACnB;QACF,KAAK;AACHP,gBAAMO,aAAaP,MAAML,KAAKgD,QAAO,EAAGC,MAAM;AAC9C;QACF,KAAK;AACH,cAAIJ,YAAY,GAAG;AACjBxC,kBAAMO,aAAaiC,YAAY,CAAA;UACjC;AACA;QACF,KAAK;AACH,cAAIA,YAAYxC,MAAML,KAAKgD,QAAO,EAAGC,QAAQ;AAC3C5C,kBAAMO,aAAaiC,YAAY,CAAA;UACjC;AACA;MACJ;IACF,CAAA;EACF,GAAG;IAACjD;IAAUS;GAAM;AAEpB,SAAO,gBAAAqB,OAAA,cAACwB,mBAAAA;IAAkBX;IAAW,GAAGH;;AAC1C;AAEAD,MAAMG,cAAc;AAMb,IAAMa,aAAa;EACxBrD;EACA+B;EACAM;EACAiB;AACF;",
6
- "names": ["RegistryContext", "React", "forwardRef", "useCallback", "useContext", "useEffect", "useImperativeHandle", "useMemo", "useRef", "addEventListener", "Obj", "ChessModel", "Gameboard", "Chessboard", "NaturalChessboard", "getRawPgn", "useGameboardContext", "useSoundEffect", "mx", "useAtomValue", "React", "useEffect", "useMemo", "useRef", "generateName", "Obj", "useMembers", "Icon", "IconButton", "Select", "useTranslation", "useGameboardContext", "mx", "Info", "classNames", "orientation", "onOrientationChange", "onClose", "props", "t", "useTranslation", "meta", "id", "model", "useGameboardContext", "displayName", "db", "Obj", "getDatabase", "object", "members", "useMembers", "spaceId", "div", "className", "mx", "PlayerIndicator", "player", "icon", "IconButton", "iconOnly", "label", "size", "onClick", "PlayerSelector", "value", "players", "onValueChange", "change", "obj", "History", "min", "max", "onSelect", "moveIndex", "useAtomValue", "game", "isGameOver", "isCheckmate", "isStalemate", "isCheck", "undefined", "history", "moves", "useMemo", "reduce", "acc", "move", "index", "push", "length", "scrollerRef", "useRef", "useEffect", "current", "scrollTo", "top", "scrollHeight", "querySelector", "classList", "add", "scrollIntoView", "behavior", "remove", "ref", "style", "minHeight", "maxHeight", "map", "a", "b", "key", "data-index", "children", "turn", "Icon", "Select", "Root", "TriggerButton", "placeholder", "Portal", "Content", "Viewport", "member", "memberKey", "identity", "identityKey", "toHex", "profile", "generateName", "Option", "Arrow", "ExtendedChessModel", "ChessModel", "registry", "object", "Root", "forwardRef", "game", "children", "forwardedRef", "useContext", "RegistryContext", "model", "useMemo", "click", "useSoundEffect", "useImperativeHandle", "setMoveNumber", "index", "setMoveIndex", "useEffect", "pgn", "getRawPgn", "silent", "update", "play", "handleDrop", "useCallback", "move", "makeMove", "Obj", "change", "g", "React", "Gameboard", "onDrop", "Content", "classNames", "role", "mx", "grow", "contain", "Board", "props", "useGameboardContext", "displayName", "ref", "useRef", "current", "setAttribute", "addEventListener", "ev", "moveIndex", "get", "key", "history", "length", "NaturalChessboard", "Chessboard", "Info"]
7
- }