@dxos/react-ui-gameboard 0.8.3 → 0.8.4-main.1c7ec43d41

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 (101) hide show
  1. package/README.md +2 -0
  2. package/dist/lib/browser/index.mjs +705 -825
  3. package/dist/lib/browser/index.mjs.map +4 -4
  4. package/dist/lib/browser/meta.json +1 -1
  5. package/dist/lib/node-esm/index.mjs +705 -825
  6. package/dist/lib/node-esm/index.mjs.map +4 -4
  7. package/dist/lib/node-esm/meta.json +1 -1
  8. package/dist/types/src/components/Chessboard/Chessboard.d.ts +20 -0
  9. package/dist/types/src/components/Chessboard/Chessboard.d.ts.map +1 -0
  10. package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts +31 -0
  11. package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts.map +1 -0
  12. package/dist/types/src/components/Chessboard/chess.d.ts +60 -0
  13. package/dist/types/src/components/Chessboard/chess.d.ts.map +1 -0
  14. package/dist/types/src/components/Chessboard/chess.test.d.ts +2 -0
  15. package/dist/types/src/components/Chessboard/chess.test.d.ts.map +1 -0
  16. package/dist/types/src/components/Chessboard/index.d.ts.map +1 -0
  17. package/dist/types/src/components/Gameboard/Gameboard.d.ts +41 -0
  18. package/dist/types/src/components/Gameboard/Gameboard.d.ts.map +1 -0
  19. package/dist/types/src/{Board → components/Gameboard}/Piece.d.ts +3 -2
  20. package/dist/types/src/components/Gameboard/Piece.d.ts.map +1 -0
  21. package/dist/types/src/components/Gameboard/Square.d.ts.map +1 -0
  22. package/dist/types/src/components/Gameboard/index.d.ts +4 -0
  23. package/dist/types/src/components/Gameboard/index.d.ts.map +1 -0
  24. package/dist/types/src/{Board → components/Gameboard}/types.d.ts +4 -3
  25. package/dist/types/src/components/Gameboard/types.d.ts.map +1 -0
  26. package/dist/types/src/components/Gameboard/util.d.ts.map +1 -0
  27. package/dist/types/src/components/index.d.ts +3 -0
  28. package/dist/types/src/components/index.d.ts.map +1 -0
  29. package/dist/types/src/gen/pieces/chess/alpha/bB.d.ts.map +1 -1
  30. package/dist/types/src/gen/pieces/chess/alpha/bK.d.ts.map +1 -1
  31. package/dist/types/src/gen/pieces/chess/alpha/bN.d.ts.map +1 -1
  32. package/dist/types/src/gen/pieces/chess/alpha/bP.d.ts.map +1 -1
  33. package/dist/types/src/gen/pieces/chess/alpha/bQ.d.ts.map +1 -1
  34. package/dist/types/src/gen/pieces/chess/alpha/bR.d.ts.map +1 -1
  35. package/dist/types/src/gen/pieces/chess/alpha/wB.d.ts.map +1 -1
  36. package/dist/types/src/gen/pieces/chess/alpha/wK.d.ts.map +1 -1
  37. package/dist/types/src/gen/pieces/chess/alpha/wN.d.ts.map +1 -1
  38. package/dist/types/src/gen/pieces/chess/alpha/wP.d.ts.map +1 -1
  39. package/dist/types/src/gen/pieces/chess/alpha/wQ.d.ts.map +1 -1
  40. package/dist/types/src/gen/pieces/chess/alpha/wR.d.ts.map +1 -1
  41. package/dist/types/src/gen/pieces/chess/cburnett/bB.d.ts.map +1 -1
  42. package/dist/types/src/gen/pieces/chess/cburnett/bK.d.ts.map +1 -1
  43. package/dist/types/src/gen/pieces/chess/cburnett/bN.d.ts.map +1 -1
  44. package/dist/types/src/gen/pieces/chess/cburnett/bP.d.ts.map +1 -1
  45. package/dist/types/src/gen/pieces/chess/cburnett/bQ.d.ts.map +1 -1
  46. package/dist/types/src/gen/pieces/chess/cburnett/bR.d.ts.map +1 -1
  47. package/dist/types/src/gen/pieces/chess/cburnett/wB.d.ts.map +1 -1
  48. package/dist/types/src/gen/pieces/chess/cburnett/wK.d.ts.map +1 -1
  49. package/dist/types/src/gen/pieces/chess/cburnett/wN.d.ts.map +1 -1
  50. package/dist/types/src/gen/pieces/chess/cburnett/wP.d.ts.map +1 -1
  51. package/dist/types/src/gen/pieces/chess/cburnett/wQ.d.ts.map +1 -1
  52. package/dist/types/src/gen/pieces/chess/cburnett/wR.d.ts.map +1 -1
  53. package/dist/types/src/index.d.ts +1 -2
  54. package/dist/types/src/index.d.ts.map +1 -1
  55. package/dist/types/tsconfig.tsbuildinfo +1 -1
  56. package/package.json +29 -24
  57. package/src/components/Chessboard/Chessboard.stories.tsx +113 -0
  58. package/src/components/Chessboard/Chessboard.tsx +205 -0
  59. package/src/components/Chessboard/chess.test.ts +19 -0
  60. package/src/components/Chessboard/chess.ts +325 -0
  61. package/src/components/Gameboard/Gameboard.tsx +139 -0
  62. package/src/{Board → components/Gameboard}/Piece.tsx +27 -23
  63. package/src/{Board → components/Gameboard}/Square.tsx +8 -6
  64. package/src/components/Gameboard/index.ts +8 -0
  65. package/src/{Board → components/Gameboard}/types.ts +5 -3
  66. package/src/components/index.ts +6 -0
  67. package/src/index.ts +1 -2
  68. package/dist/lib/node/index.cjs +0 -1039
  69. package/dist/lib/node/index.cjs.map +0 -7
  70. package/dist/lib/node/meta.json +0 -1
  71. package/dist/types/src/Board/Board.d.ts +0 -15
  72. package/dist/types/src/Board/Board.d.ts.map +0 -1
  73. package/dist/types/src/Board/Container.d.ts +0 -14
  74. package/dist/types/src/Board/Container.d.ts.map +0 -1
  75. package/dist/types/src/Board/Piece.d.ts.map +0 -1
  76. package/dist/types/src/Board/Square.d.ts.map +0 -1
  77. package/dist/types/src/Board/context.d.ts +0 -10
  78. package/dist/types/src/Board/context.d.ts.map +0 -1
  79. package/dist/types/src/Board/index.d.ts +0 -8
  80. package/dist/types/src/Board/index.d.ts.map +0 -1
  81. package/dist/types/src/Board/types.d.ts.map +0 -1
  82. package/dist/types/src/Board/util.d.ts.map +0 -1
  83. package/dist/types/src/Chessboard/Chessboard.d.ts +0 -14
  84. package/dist/types/src/Chessboard/Chessboard.d.ts.map +0 -1
  85. package/dist/types/src/Chessboard/Chessboard.stories.d.ts +0 -16
  86. package/dist/types/src/Chessboard/Chessboard.stories.d.ts.map +0 -1
  87. package/dist/types/src/Chessboard/chess.d.ts +0 -40
  88. package/dist/types/src/Chessboard/chess.d.ts.map +0 -1
  89. package/dist/types/src/Chessboard/index.d.ts.map +0 -1
  90. package/src/Board/Board.tsx +0 -86
  91. package/src/Board/Container.tsx +0 -25
  92. package/src/Board/context.ts +0 -22
  93. package/src/Board/index.ts +0 -12
  94. package/src/Chessboard/Chessboard.stories.tsx +0 -108
  95. package/src/Chessboard/Chessboard.tsx +0 -190
  96. package/src/Chessboard/chess.ts +0 -213
  97. /package/dist/types/src/{Chessboard → components/Chessboard}/index.d.ts +0 -0
  98. /package/dist/types/src/{Board → components/Gameboard}/Square.d.ts +0 -0
  99. /package/dist/types/src/{Board → components/Gameboard}/util.d.ts +0 -0
  100. /package/src/{Chessboard → components/Chessboard}/index.ts +0 -0
  101. /package/src/{Board → components/Gameboard}/util.ts +0 -0
@@ -4,22 +4,14 @@ var __export = (target, all) => {
4
4
  __defProp(target, name, { get: all[name], enumerable: true });
5
5
  };
6
6
 
7
- // packages/ui/react-ui-gameboard/src/Board/context.ts
8
- import { createContext, useContext } from "react";
9
- import { raise } from "@dxos/debug";
10
- var BoardContext = createContext(void 0);
11
- var useBoardContext = () => {
12
- return useContext(BoardContext) ?? raise(new Error("Missing BoardContext"));
13
- };
14
-
15
- // packages/ui/react-ui-gameboard/src/Board/types.ts
7
+ // src/components/Gameboard/types.ts
16
8
  var locationToString = (location) => location.join("-");
17
9
  var stringToLocation = (str) => str.split("-").map(Number);
18
10
  var isPiece = (piece) => piece != null && typeof piece === "object" && "id" in piece && "type" in piece && "location" in piece && isLocation(piece.location);
19
11
  var isLocation = (token) => Array.isArray(token) && token.length === 2 && token.every((val) => typeof val === "number");
20
12
  var isEqualLocation = (l1, l2) => l1[0] === l2[0] && l1[1] === l2[1];
21
13
 
22
- // packages/ui/react-ui-gameboard/src/Board/util.ts
14
+ // src/components/Gameboard/util.ts
23
15
  var getRelativeBounds = (container, element) => {
24
16
  const containerRect = container.getBoundingClientRect();
25
17
  const elementRect = element.getBoundingClientRect();
@@ -31,360 +23,284 @@ var getRelativeBounds = (container, element) => {
31
23
  };
32
24
  };
33
25
 
34
- // packages/ui/react-ui-gameboard/src/Board/Board.tsx
35
- import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
26
+ // src/components/Gameboard/Gameboard.tsx
36
27
  import { monitorForElements } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
37
- import React2, { useCallback, useEffect, useState } from "react";
38
- import { log } from "@dxos/log";
39
- import { mx as mx2 } from "@dxos/react-ui-theme";
40
-
41
- // packages/ui/react-ui-gameboard/src/Board/Container.tsx
42
- import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
43
- import React, { forwardRef } from "react";
44
- import { mx } from "@dxos/react-ui-theme";
45
- var Container = /* @__PURE__ */ forwardRef(({ children, classNames, style }, forwardedRef) => {
46
- var _effect = _useSignals();
47
- try {
48
- return /* @__PURE__ */ React.createElement("div", {
49
- ref: forwardedRef,
50
- style,
51
- className: "flex w-full h-full justify-center overflow-hidden"
52
- }, /* @__PURE__ */ React.createElement("div", {
53
- className: mx("max-w-full max-h-full content-center", classNames)
54
- }, children));
55
- } finally {
56
- _effect.f();
57
- }
58
- });
59
-
60
- // packages/ui/react-ui-gameboard/src/Board/Board.tsx
61
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/ui/react-ui-gameboard/src/Board/Board.tsx";
62
- var Root = ({ children, classNames, model, onDrop }) => {
63
- var _effect = _useSignals2();
64
- try {
65
- const [dragging, setDragging] = useState(false);
66
- const [promoting, setPromoting] = useState();
67
- const onPromotion = useCallback((move) => {
68
- log("onPromotion", {
69
- move
70
- }, {
71
- F: __dxlog_file,
72
- L: 32,
73
- S: void 0,
74
- C: (f, a) => f(...a)
75
- });
76
- setPromoting(void 0);
77
- onDrop?.(move);
78
- }, []);
79
- useEffect(() => {
80
- if (!model) {
81
- return;
82
- }
83
- return monitorForElements({
84
- onDragStart: ({ source }) => {
85
- log("onDragStart", {
86
- source
87
- }, {
88
- F: __dxlog_file,
89
- L: 45,
90
- S: void 0,
91
- C: (f, a) => f(...a)
92
- });
93
- setDragging(true);
94
- },
95
- onDrop: ({ source, location }) => {
96
- log("onDrop", {
97
- source,
98
- location
99
- }, {
100
- F: __dxlog_file,
101
- L: 49,
102
- S: void 0,
103
- C: (f, a) => f(...a)
104
- });
105
- const target = location.current.dropTargets[0];
106
- if (!target) {
107
- return;
108
- }
109
- const targetLocation = target.data.location;
110
- const piece = source.data.piece;
111
- if (!isLocation(targetLocation) || !isPiece(piece)) {
112
- return;
113
- }
114
- const move = {
115
- from: piece.location,
116
- to: targetLocation,
117
- piece: piece.type
118
- };
119
- if (model.canPromote?.(move)) {
120
- setPromoting({
121
- ...piece,
122
- location: targetLocation
123
- });
124
- } else {
125
- onDrop?.(move);
126
- }
127
- setDragging(false);
128
- }
129
- });
130
- }, [
131
- model
132
- ]);
133
- return /* @__PURE__ */ React2.createElement(BoardContext.Provider, {
134
- value: {
135
- model,
136
- dragging,
137
- promoting,
138
- onPromotion
139
- }
140
- }, /* @__PURE__ */ React2.createElement(Container, {
141
- classNames: mx2("aspect-square", classNames)
142
- }, children));
143
- } finally {
144
- _effect.f();
145
- }
146
- };
147
- Root.displayName = "Board.Root";
148
- var Board = {
149
- Root
150
- };
151
-
152
- // packages/ui/react-ui-gameboard/src/Board/Square.tsx
153
- import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
154
- import { dropTargetForElements } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
155
- import React3, { useRef, useState as useState2, useEffect as useEffect2, memo } from "react";
156
- import { invariant } from "@dxos/invariant";
157
- import { log as log2 } from "@dxos/log";
158
- import { mx as mx3 } from "@dxos/react-ui-theme";
159
- var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-gameboard/src/Board/Square.tsx";
160
- var Square = /* @__PURE__ */ memo(({ location, bounds, label, classNames }) => {
161
- var _effect = _useSignals3();
162
- try {
163
- const ref = useRef(null);
164
- const [state, setState] = useState2("idle");
165
- const { model } = useBoardContext();
166
- useEffect2(() => {
167
- const el = ref.current;
168
- invariant(el, void 0, {
169
- F: __dxlog_file2,
170
- L: 32,
171
- S: void 0,
172
- A: [
173
- "el",
174
- ""
175
- ]
176
- });
177
- return dropTargetForElements({
178
- element: el,
179
- getData: () => ({
180
- location
181
- }),
182
- canDrop: ({ source }) => {
183
- log2("canDrop", {
184
- source: source.data
185
- }, {
186
- F: __dxlog_file2,
187
- L: 38,
188
- S: void 0,
189
- C: (f, a) => f(...a)
190
- });
191
- return true;
192
- },
193
- onDragEnter: ({ source }) => {
194
- log2("onDragEnter", {
195
- source: source.data
196
- }, {
197
- F: __dxlog_file2,
198
- L: 42,
199
- S: void 0,
200
- C: (f, a) => f(...a)
201
- });
202
- const piece = source.data.piece;
203
- if (!isPiece(piece)) {
204
- return;
205
- }
206
- if (model?.isValidMove({
207
- from: piece.location,
208
- to: location,
209
- piece: piece.type
210
- })) {
211
- setState("validMove");
212
- } else {
213
- setState("invalidMove");
214
- }
215
- },
216
- onDragLeave: () => setState("idle"),
217
- onDrop: () => setState("idle")
218
- });
219
- }, [
220
- model,
221
- location
222
- ]);
223
- return /* @__PURE__ */ React3.createElement("div", {
224
- ref,
225
- style: bounds,
226
- className: mx3("absolute flex justify-center items-center border-2 box-border select-none", classNames, state === "validMove" ? "border-neutral-800" : "border-transparent")
227
- }, label && /* @__PURE__ */ React3.createElement("div", {
228
- className: mx3("absolute bottom-1 left-1 text-xs text-neutral-500")
229
- }, label));
230
- } finally {
231
- _effect.f();
232
- }
233
- });
234
- Square.displayName = "Square";
28
+ import { createContext } from "@radix-ui/react-context";
29
+ import React3, { forwardRef, useCallback, useEffect as useEffect3, useState as useState3 } from "react";
30
+ import { log as log3 } from "@dxos/log";
31
+ import { mx as mx3 } from "@dxos/ui-theme";
235
32
 
236
- // packages/ui/react-ui-gameboard/src/Board/Piece.tsx
237
- import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
33
+ // src/components/Gameboard/Piece.tsx
238
34
  import { draggable } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
239
35
  import { centerUnderPointer } from "@atlaskit/pragmatic-drag-and-drop/element/center-under-pointer";
240
36
  import { setCustomNativeDragPreview } from "@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview";
241
- import React4, { useState as useState3, useRef as useRef2, useEffect as useEffect3, memo as memo2 } from "react";
37
+ import React, { memo, useEffect, useRef, useState } from "react";
242
38
  import { createPortal } from "react-dom";
243
- import { invariant as invariant2 } from "@dxos/invariant";
244
- import { log as log3 } from "@dxos/log";
245
- import { useDynamicRef, useTrackProps } from "@dxos/react-ui";
246
- import { mx as mx4 } from "@dxos/react-ui-theme";
247
- var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-gameboard/src/Board/Piece.tsx";
248
- var Piece = /* @__PURE__ */ memo2(({ classNames, piece, orientation, bounds, label, Component }) => {
249
- var _effect = _useSignals4();
250
- try {
251
- useTrackProps({
252
- classNames,
253
- piece,
254
- orientation,
255
- bounds,
256
- label,
257
- Component
258
- }, Piece.displayName, false);
259
- const { model } = useBoardContext();
260
- const { dragging: isDragging, promoting } = useBoardContext();
261
- const promotingRef = useDynamicRef(promoting);
262
- const [dragging, setDragging] = useState3(false);
263
- const [preview, setPreview] = useState3();
264
- const [current, setCurrent] = useState3({});
265
- const ref = useRef2(null);
266
- useEffect3(() => {
267
- const el = ref.current;
268
- invariant2(el, void 0, {
269
- F: __dxlog_file3,
270
- L: 44,
271
- S: void 0,
272
- A: [
273
- "el",
274
- ""
275
- ]
276
- });
277
- return draggable({
278
- element: el,
279
- getInitialData: () => ({
280
- piece
281
- }),
282
- onGenerateDragPreview: ({ nativeSetDragImage, location, source }) => {
283
- log3("onGenerateDragPreview", {
284
- source: source.data
285
- }, {
286
- F: __dxlog_file3,
287
- L: 50,
288
- S: void 0,
289
- C: (f, a) => f(...a)
290
- });
291
- setCustomNativeDragPreview({
292
- getOffset: centerUnderPointer,
293
- // getOffset: preserveOffsetOnSource({
294
- // element: source.element,
295
- // input: location.current.input,
296
- // }),
297
- render: ({ container }) => {
298
- setPreview(container);
299
- const { width, height } = el.getBoundingClientRect();
300
- container.style.width = width + "px";
301
- container.style.height = height + "px";
302
- return () => {
303
- setPreview(void 0);
304
- };
305
- },
306
- nativeSetDragImage
307
- });
308
- },
309
- canDrag: () => !promotingRef.current && model?.turn === piece.side,
310
- onDragStart: () => setDragging(true),
311
- onDrop: ({ location: { current: current2 } }) => {
312
- const location = current2.dropTargets[0].data.location;
39
+ import { invariant } from "@dxos/invariant";
40
+ import { log } from "@dxos/log";
41
+ import { useDynamicRef } from "@dxos/react-ui";
42
+ import { mx } from "@dxos/ui-theme";
43
+ var __dxlog_file = "/__w/dxos/dxos/packages/ui/react-ui-gameboard/src/components/Gameboard/Piece.tsx";
44
+ var PIECE_NAME = "Piece";
45
+ var Piece = /* @__PURE__ */ memo(({ classNames, Component, piece, bounds, label, onClick }) => {
46
+ const { model, dragging: isDragging, promoting } = useGameboardContext(PIECE_NAME);
47
+ const promotingRef = useDynamicRef(promoting);
48
+ const [dragging, setDragging] = useState(false);
49
+ const [preview, setPreview] = useState();
50
+ const [current, setCurrent] = useState({});
51
+ const ref = useRef(null);
52
+ useEffect(() => {
53
+ if (!model) {
54
+ return;
55
+ }
56
+ const el = ref.current;
57
+ invariant(el, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 29, S: void 0, A: ["el", ""] });
58
+ return draggable({
59
+ element: el,
60
+ getInitialData: () => ({
61
+ piece
62
+ }),
63
+ onGenerateDragPreview: ({ nativeSetDragImage, source }) => {
64
+ log("onGenerateDragPreview", {
65
+ source: source.data
66
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 36, S: void 0 });
67
+ setCustomNativeDragPreview({
68
+ getOffset: centerUnderPointer,
69
+ render: ({ container }) => {
70
+ setPreview(container);
71
+ const { width, height } = el.getBoundingClientRect();
72
+ container.style.width = width + "px";
73
+ container.style.height = height + "px";
74
+ return () => {
75
+ setPreview(void 0);
76
+ };
77
+ },
78
+ nativeSetDragImage
79
+ });
80
+ },
81
+ canDrag: () => !promotingRef.current && !model.readonly && model.turn === piece.side,
82
+ onDragStart: () => setDragging(true),
83
+ onDrop: ({ location: { current: current2 } }) => {
84
+ try {
85
+ const location = current2.dropTargets[0]?.data.location;
313
86
  if (isLocation(location)) {
314
87
  setCurrent((current3) => ({
315
88
  ...current3,
316
89
  location
317
90
  }));
318
91
  }
319
- setDragging(false);
92
+ } catch {
320
93
  }
321
- });
322
- }, [
323
- model,
324
- piece
325
- ]);
326
- useEffect3(() => {
327
- requestAnimationFrame(() => {
328
- if (!ref.current || !bounds) {
94
+ setDragging(false);
95
+ }
96
+ });
97
+ }, [
98
+ model,
99
+ piece
100
+ ]);
101
+ useEffect(() => {
102
+ requestAnimationFrame(() => {
103
+ if (!ref.current || !bounds) {
104
+ return;
105
+ }
106
+ if (!current.location || !isEqualLocation(current.location, piece.location)) {
107
+ ref.current.style.transition = "top 250ms ease-out, left 250ms ease-out";
108
+ ref.current.style.top = bounds.top + "px";
109
+ ref.current.style.left = bounds.left + "px";
110
+ setCurrent({
111
+ location: piece.location,
112
+ bounds
113
+ });
114
+ } else if (current.bounds !== bounds) {
115
+ ref.current.style.transition = "none";
116
+ ref.current.style.top = bounds.top + "px";
117
+ ref.current.style.left = bounds.left + "px";
118
+ setCurrent({
119
+ location: piece.location,
120
+ bounds
121
+ });
122
+ }
123
+ });
124
+ }, [
125
+ current,
126
+ piece.location,
127
+ bounds
128
+ ]);
129
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
130
+ ref,
131
+ style: {
132
+ width: bounds?.width,
133
+ height: bounds?.height
134
+ },
135
+ className: mx("absolute", classNames, dragging && "opacity-20", isDragging && "pointer-events-none"),
136
+ onClick
137
+ }, /* @__PURE__ */ React.createElement(Component, {
138
+ className: "grow"
139
+ }), label && /* @__PURE__ */ React.createElement("div", {
140
+ className: "absolute inset-1 text-xs text-black"
141
+ }, label)), preview && /* @__PURE__ */ createPortal(/* @__PURE__ */ React.createElement("div", {
142
+ className: mx(classNames)
143
+ }, /* @__PURE__ */ React.createElement(Component, {
144
+ className: "grow"
145
+ })), preview));
146
+ });
147
+ Piece.displayName = PIECE_NAME;
148
+
149
+ // src/components/Gameboard/Square.tsx
150
+ import { dropTargetForElements } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
151
+ import React2, { memo as memo2, useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
152
+ import { invariant as invariant2 } from "@dxos/invariant";
153
+ import { log as log2 } from "@dxos/log";
154
+ import { mx as mx2 } from "@dxos/ui-theme";
155
+ var __dxlog_file2 = "/__w/dxos/dxos/packages/ui/react-ui-gameboard/src/components/Gameboard/Square.tsx";
156
+ var SQUARE_NAME = "Square";
157
+ var Square = /* @__PURE__ */ memo2(({ location, bounds, label, classNames }) => {
158
+ const ref = useRef2(null);
159
+ const [state, setState] = useState2("idle");
160
+ const { model } = useGameboardContext(SQUARE_NAME);
161
+ useEffect2(() => {
162
+ const el = ref.current;
163
+ invariant2(el, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 18, S: void 0, A: ["el", ""] });
164
+ return dropTargetForElements({
165
+ element: el,
166
+ getData: () => ({
167
+ location
168
+ }),
169
+ canDrop: ({ source }) => {
170
+ log2("canDrop", {
171
+ source: source.data
172
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 25, S: void 0 });
173
+ return true;
174
+ },
175
+ onDragEnter: ({ source }) => {
176
+ log2("onDragEnter", {
177
+ source: source.data
178
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 31, S: void 0 });
179
+ const piece = source.data.piece;
180
+ if (!isPiece(piece)) {
329
181
  return;
330
182
  }
331
- if (!current.location || !isEqualLocation(current.location, piece.location)) {
332
- ref.current.style.transition = "top 400ms ease-out, left 400ms ease-out";
333
- ref.current.style.top = bounds.top + "px";
334
- ref.current.style.left = bounds.left + "px";
335
- setCurrent({
336
- location: piece.location,
337
- bounds
338
- });
339
- } else if (current.bounds !== bounds) {
340
- ref.current.style.transition = "none";
341
- ref.current.style.top = bounds.top + "px";
342
- ref.current.style.left = bounds.left + "px";
343
- setCurrent({
344
- location: piece.location,
345
- bounds
346
- });
183
+ if (model?.isValidMove({
184
+ from: piece.location,
185
+ to: location,
186
+ piece: piece.type
187
+ })) {
188
+ setState("validMove");
189
+ } else {
190
+ setState("invalidMove");
347
191
  }
348
- });
349
- }, [
350
- current,
351
- piece.location,
352
- bounds
353
- ]);
354
- return /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement("div", {
355
- ref,
356
- style: {
357
- width: bounds?.width,
358
- height: bounds?.height
359
192
  },
360
- className: mx4(
361
- "absolute",
362
- classNames,
363
- // orientation === 'black' && '_rotate-180',
364
- dragging && "opacity-20",
365
- isDragging && "pointer-events-none"
366
- )
367
- }, /* @__PURE__ */ React4.createElement(Component, {
368
- className: "grow"
369
- }), label && /* @__PURE__ */ React4.createElement("div", {
370
- className: "absolute inset-1 text-xs text-black"
371
- }, label)), preview && /* @__PURE__ */ createPortal(/* @__PURE__ */ React4.createElement("div", {
372
- className: mx4(classNames)
373
- }, /* @__PURE__ */ React4.createElement(Component, {
374
- className: "grow"
375
- })), preview));
376
- } finally {
377
- _effect.f();
378
- }
193
+ onDragLeave: () => setState("idle"),
194
+ onDrop: () => setState("idle")
195
+ });
196
+ }, [
197
+ model,
198
+ location
199
+ ]);
200
+ return /* @__PURE__ */ React2.createElement("div", {
201
+ ref,
202
+ style: bounds,
203
+ className: mx2("absolute flex justify-center items-center border-2 box-border select-none", classNames, state === "validMove" ? "border-neutral-800" : "border-transparent")
204
+ }, label && /* @__PURE__ */ React2.createElement("div", {
205
+ className: mx2("absolute bottom-1 left-1 text-xs text-neutral-500")
206
+ }, label));
207
+ });
208
+ Square.displayName = SQUARE_NAME;
209
+
210
+ // src/components/Gameboard/Gameboard.tsx
211
+ var __dxlog_file3 = "/__w/dxos/dxos/packages/ui/react-ui-gameboard/src/components/Gameboard/Gameboard.tsx";
212
+ var [GameboardContextProvider, useRadixGameboardContext] = createContext("Gameboard");
213
+ var useGameboardContext = (consumerName) => {
214
+ return useRadixGameboardContext(consumerName);
215
+ };
216
+ var GameboardRoot = ({ children, model, onDrop }) => {
217
+ const [dragging, setDragging] = useState3(false);
218
+ const [promoting, setPromoting] = useState3();
219
+ const handlePromotion = useCallback((move) => {
220
+ log3("onPromotion", {
221
+ move
222
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 22, S: void 0 });
223
+ setPromoting(void 0);
224
+ onDrop?.(move);
225
+ }, []);
226
+ useEffect3(() => {
227
+ if (!model) {
228
+ return;
229
+ }
230
+ return monitorForElements({
231
+ onDragStart: ({ source }) => {
232
+ log3("onDragStart", {
233
+ source
234
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 35, S: void 0 });
235
+ setDragging(true);
236
+ },
237
+ onDrop: ({ source, location }) => {
238
+ log3("onDrop", {
239
+ source,
240
+ location
241
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 41, S: void 0 });
242
+ const target = location.current.dropTargets[0];
243
+ if (!target) {
244
+ return;
245
+ }
246
+ const targetLocation = target.data.location;
247
+ const piece = source.data.piece;
248
+ if (!isLocation(targetLocation) || !isPiece(piece)) {
249
+ return;
250
+ }
251
+ const move = {
252
+ from: piece.location,
253
+ to: targetLocation,
254
+ piece: piece.type
255
+ };
256
+ if (model.isValidMove(move)) {
257
+ if (model.canPromote?.(move)) {
258
+ setPromoting({
259
+ ...piece,
260
+ location: targetLocation
261
+ });
262
+ } else {
263
+ onDrop?.(move);
264
+ }
265
+ }
266
+ setDragging(false);
267
+ }
268
+ });
269
+ }, [
270
+ model
271
+ ]);
272
+ return /* @__PURE__ */ React3.createElement(GameboardContextProvider, {
273
+ model,
274
+ dragging,
275
+ promoting,
276
+ onPromotion: handlePromotion
277
+ }, children);
278
+ };
279
+ GameboardRoot.displayName = "Gameboard.Root";
280
+ var GameboardContent = /* @__PURE__ */ forwardRef(({ children, classNames, grow, contain }, forwardedRef) => {
281
+ return /* @__PURE__ */ React3.createElement("div", {
282
+ role: "none",
283
+ className: mx3(grow && "dx-size-container dx-expander grid place-content-center", classNames),
284
+ ref: forwardedRef
285
+ }, contain ? /* @__PURE__ */ React3.createElement("div", {
286
+ className: "w-[min(100cqw,100cqh)] h-[min(100cqw,100cqh)]"
287
+ }, children) : children);
379
288
  });
380
- Piece.displayName = "Piece";
289
+ GameboardContent.displayName = "Gameboard.Content";
290
+ var Gameboard = {
291
+ Root: GameboardRoot,
292
+ Content: GameboardContent,
293
+ Piece,
294
+ Square
295
+ };
381
296
 
382
- // packages/ui/react-ui-gameboard/src/Chessboard/chess.ts
383
- import { signal } from "@preact/signals-core";
384
- import { Chess, validateFen } from "chess.js";
297
+ // src/components/Chessboard/chess.ts
298
+ import { Atom } from "@effect-atom/atom-react";
299
+ import { Chess as ChessJS } from "chess.js";
300
+ import { invariant as invariant3 } from "@dxos/invariant";
385
301
  import { log as log4 } from "@dxos/log";
386
302
 
387
- // packages/ui/react-ui-gameboard/src/gen/pieces/chess/alpha/index.ts
303
+ // src/gen/pieces/chess/alpha/index.ts
388
304
  var alpha_exports = {};
389
305
  __export(alpha_exports, {
390
306
  BB: () => bB_default,
@@ -401,281 +317,185 @@ __export(alpha_exports, {
401
317
  WR: () => wR_default
402
318
  });
403
319
 
404
- // packages/ui/react-ui-gameboard/src/gen/pieces/chess/alpha/bB.tsx
405
- import { useSignals as _useSignals5 } from "@preact-signals/safe-react/tracking";
406
- import * as React5 from "react";
407
- var SvgBB = (props) => {
408
- var _effect = _useSignals5();
409
- try {
410
- return /* @__PURE__ */ React5.createElement("svg", {
411
- xmlns: "http://www.w3.org/2000/svg",
412
- viewBox: "0 0 2048 2048",
413
- ...props
414
- }, /* @__PURE__ */ React5.createElement("path", {
415
- fill: "#f9f9f9",
416
- d: "M732 1290 628 993l386-417 421 375-132 380 49 152-658-9z"
417
- }), /* @__PURE__ */ React5.createElement("path", {
418
- fill: "#101010",
419
- d: "M768 1365q-5 39-26 82h564q-18-36-26-82zm495-73 46-73q-142-49-285-47-144-2-285 47l46 73q118-40 239-38 120-2 239 38m-432 227H624q67-116 72-229-114-119-162-223t-6-224q33-96 118-189t312-247q-17-11-46-36t-29-79q0-58 41-96t100-38q58 0 100 38t41 96q0 54-29 79t-46 36q226 153 311 247t119 189q42 119-6 224t-162 223q4 113 72 229h-207l10 16q33 53 70 60t89 7h250q76 0 142 62t65 179h-495q-123 0-223-84t-101-199q0 114-101 199t-223 84H205q0-117 65-179t142-62h250q51 0 88-7t71-60zm146-701h-95v89h95v165h94V907h95v-89h-95V714h-94z"
420
- }));
421
- } finally {
422
- _effect.f();
423
- }
424
- };
320
+ // src/gen/pieces/chess/alpha/bB.tsx
321
+ import * as React4 from "react";
322
+ var SvgBB = (props) => /* @__PURE__ */ React4.createElement("svg", {
323
+ xmlns: "http://www.w3.org/2000/svg",
324
+ viewBox: "0 0 2048 2048",
325
+ ...props
326
+ }, /* @__PURE__ */ React4.createElement("path", {
327
+ fill: "#f9f9f9",
328
+ d: "M732 1290 628 993l386-417 421 375-132 380 49 152-658-9z"
329
+ }), /* @__PURE__ */ React4.createElement("path", {
330
+ fill: "#101010",
331
+ d: "M768 1365q-5 39-26 82h564q-18-36-26-82zm495-73 46-73q-142-49-285-47-144-2-285 47l46 73q118-40 239-38 120-2 239 38m-432 227H624q67-116 72-229-114-119-162-223t-6-224q33-96 118-189t312-247q-17-11-46-36t-29-79q0-58 41-96t100-38q58 0 100 38t41 96q0 54-29 79t-46 36q226 153 311 247t119 189q42 119-6 224t-162 223q4 113 72 229h-207l10 16q33 53 70 60t89 7h250q76 0 142 62t65 179h-495q-123 0-223-84t-101-199q0 114-101 199t-223 84H205q0-117 65-179t142-62h250q51 0 88-7t71-60zm146-701h-95v89h95v165h94V907h95v-89h-95V714h-94z"
332
+ }));
425
333
  var bB_default = SvgBB;
426
334
 
427
- // packages/ui/react-ui-gameboard/src/gen/pieces/chess/alpha/bK.tsx
428
- import { useSignals as _useSignals6 } from "@preact-signals/safe-react/tracking";
429
- import * as React6 from "react";
430
- var SvgBK = (props) => {
431
- var _effect = _useSignals6();
432
- try {
433
- return /* @__PURE__ */ React6.createElement("svg", {
434
- xmlns: "http://www.w3.org/2000/svg",
435
- viewBox: "0 0 2048 2048",
436
- ...props
437
- }, /* @__PURE__ */ React6.createElement("path", {
438
- fill: "#f9f9f9",
439
- d: "m553 1485-55 320 1048 5-48-335s324-313 330-467c7-153-35-331-241-406-183-67-372 121-372 121l-182-161-190 160S658 586 587 592a373 373 0 0 0-362 333c10 331 328 560 328 560"
440
- }), /* @__PURE__ */ React6.createElement("path", {
441
- fill: "#101010",
442
- d: "M1024 1769h489l-12-73H547l-12 73zm0-921q-25-60-62-111 31-48 62-65 30 17 62 65-38 51-62 111m-97 454q-154 11-303 58-123-108-200-213t-77-202q0-89 74-159t148-70q67 0 135 63t102 130q30 54 75 175t46 218m-350 217-26 156 145-84zm447-907q-47 0-136 121-31-36-50-55 93-140 186-140 92 0 186 140-20 19-50 55-90-121-136-121m0 775q-1-126-42-267t-84-227l-14-27-12-23q-28-43-48-69-51-63-120-105t-134-42q-103 0-208 93T257 949q0 120 99 255t249 259q201-74 419-76m0 456H448l61-365q-325-280-326-535-1-159 125-274t267-116q78 0 159 47t142 119q61 74 99 165t49 150q12-60 49-150t99-165q61-72 142-119t159-47q140 0 266 116t126 274q-2 255-326 535l61 365zm97-541q0-97 45-218t76-175q34-68 102-130t135-63q74 0 148 70t74 159q0 96-77 202t-200 213q-150-47-303-58m350 217-119 72 145 84zm-447-132q217 2 419 76 150-125 249-259t99-255q0-136-105-229t-208-93q-66 0-135 42t-119 105q-21 26-48 69l-12 23-14 27q-44 85-85 227t-41 267m-139 159 139 86 139-84-139-86zm92-1248v-95h94v95h107v95h-107v153q-48-16-94 0V393H870v-95z"
443
- }));
444
- } finally {
445
- _effect.f();
446
- }
447
- };
335
+ // src/gen/pieces/chess/alpha/bK.tsx
336
+ import * as React5 from "react";
337
+ var SvgBK = (props) => /* @__PURE__ */ React5.createElement("svg", {
338
+ xmlns: "http://www.w3.org/2000/svg",
339
+ viewBox: "0 0 2048 2048",
340
+ ...props
341
+ }, /* @__PURE__ */ React5.createElement("path", {
342
+ fill: "#f9f9f9",
343
+ d: "m553 1485-55 320 1048 5-48-335s324-313 330-467c7-153-35-331-241-406-183-67-372 121-372 121l-182-161-190 160S658 586 587 592a373 373 0 0 0-362 333c10 331 328 560 328 560"
344
+ }), /* @__PURE__ */ React5.createElement("path", {
345
+ fill: "#101010",
346
+ d: "M1024 1769h489l-12-73H547l-12 73zm0-921q-25-60-62-111 31-48 62-65 30 17 62 65-38 51-62 111m-97 454q-154 11-303 58-123-108-200-213t-77-202q0-89 74-159t148-70q67 0 135 63t102 130q30 54 75 175t46 218m-350 217-26 156 145-84zm447-907q-47 0-136 121-31-36-50-55 93-140 186-140 92 0 186 140-20 19-50 55-90-121-136-121m0 775q-1-126-42-267t-84-227l-14-27-12-23q-28-43-48-69-51-63-120-105t-134-42q-103 0-208 93T257 949q0 120 99 255t249 259q201-74 419-76m0 456H448l61-365q-325-280-326-535-1-159 125-274t267-116q78 0 159 47t142 119q61 74 99 165t49 150q12-60 49-150t99-165q61-72 142-119t159-47q140 0 266 116t126 274q-2 255-326 535l61 365zm97-541q0-97 45-218t76-175q34-68 102-130t135-63q74 0 148 70t74 159q0 96-77 202t-200 213q-150-47-303-58m350 217-119 72 145 84zm-447-132q217 2 419 76 150-125 249-259t99-255q0-136-105-229t-208-93q-66 0-135 42t-119 105q-21 26-48 69l-12 23-14 27q-44 85-85 227t-41 267m-139 159 139 86 139-84-139-86zm92-1248v-95h94v95h107v95h-107v153q-48-16-94 0V393H870v-95z"
347
+ }));
448
348
  var bK_default = SvgBK;
449
349
 
450
- // packages/ui/react-ui-gameboard/src/gen/pieces/chess/alpha/bN.tsx
451
- import { useSignals as _useSignals7 } from "@preact-signals/safe-react/tracking";
452
- import * as React7 from "react";
453
- var SvgBN = (props) => {
454
- var _effect = _useSignals7();
455
- try {
456
- return /* @__PURE__ */ React7.createElement("svg", {
457
- xmlns: "http://www.w3.org/2000/svg",
458
- viewBox: "0 0 2048 2048",
459
- ...props
460
- }, /* @__PURE__ */ React7.createElement("path", {
461
- fill: "#f9f9f9",
462
- d: "M1658 1806c-408-301-71-920-452-1343l60-16s296 167 320 257c182 468 41 691 135 1077zM972 523l120 176-312-3zM498 981l-93-41 42-93 127 28z"
463
- }), /* @__PURE__ */ React7.createElement("path", {
464
- fill: "#101010",
465
- d: "m502 868-52 1-26 64 69 21 46-55zm536-187q34 1-16-68t-80-42L826 680zm-338-98q6-39 116-107t220-144l115-154 96 217q342 172 433 418t47 603q-18 128 5 236t57 190l-1242 1q-9-178 39-301t183-238q50-11 83-39t53-59l63-1 138-29 139-97 66-207q0-17-8-34t-12-37q-62 228-161 289t-191 58q-236-42-292 60l-56 102-217-121 115-82-51-50-122 86-12-297zm981 1192q-102-130-85-308t27-363-50-351-316-276q220 164 253 342t16 351-12 329 167 276"
466
- }));
467
- } finally {
468
- _effect.f();
469
- }
470
- };
350
+ // src/gen/pieces/chess/alpha/bN.tsx
351
+ import * as React6 from "react";
352
+ var SvgBN = (props) => /* @__PURE__ */ React6.createElement("svg", {
353
+ xmlns: "http://www.w3.org/2000/svg",
354
+ viewBox: "0 0 2048 2048",
355
+ ...props
356
+ }, /* @__PURE__ */ React6.createElement("path", {
357
+ fill: "#f9f9f9",
358
+ d: "M1658 1806c-408-301-71-920-452-1343l60-16s296 167 320 257c182 468 41 691 135 1077zM972 523l120 176-312-3zM498 981l-93-41 42-93 127 28z"
359
+ }), /* @__PURE__ */ React6.createElement("path", {
360
+ fill: "#101010",
361
+ d: "m502 868-52 1-26 64 69 21 46-55zm536-187q34 1-16-68t-80-42L826 680zm-338-98q6-39 116-107t220-144l115-154 96 217q342 172 433 418t47 603q-18 128 5 236t57 190l-1242 1q-9-178 39-301t183-238q50-11 83-39t53-59l63-1 138-29 139-97 66-207q0-17-8-34t-12-37q-62 228-161 289t-191 58q-236-42-292 60l-56 102-217-121 115-82-51-50-122 86-12-297zm981 1192q-102-130-85-308t27-363-50-351-316-276q220 164 253 342t16 351-12 329 167 276"
362
+ }));
471
363
  var bN_default = SvgBN;
472
364
 
473
- // packages/ui/react-ui-gameboard/src/gen/pieces/chess/alpha/bP.tsx
474
- import { useSignals as _useSignals8 } from "@preact-signals/safe-react/tracking";
475
- import * as React8 from "react";
476
- var SvgBP = (props) => {
477
- var _effect = _useSignals8();
478
- try {
479
- return /* @__PURE__ */ React8.createElement("svg", {
480
- xmlns: "http://www.w3.org/2000/svg",
481
- viewBox: "0 0 2048 2048",
482
- ...props
483
- }, /* @__PURE__ */ React8.createElement("path", {
484
- fill: "#101010",
485
- d: "M1024 1843H446v-74q-4-80 42-137t125-108q117-91 172-217t78-268H576l284-239q-86-74-86-188 0-103 73-177t177-74q103 0 177 74t73 177q0 114-86 188l284 239h-287q23 141 78 268t172 217q79 51 125 108t42 137v74z"
486
- }));
487
- } finally {
488
- _effect.f();
489
- }
490
- };
365
+ // src/gen/pieces/chess/alpha/bP.tsx
366
+ import * as React7 from "react";
367
+ var SvgBP = (props) => /* @__PURE__ */ React7.createElement("svg", {
368
+ xmlns: "http://www.w3.org/2000/svg",
369
+ viewBox: "0 0 2048 2048",
370
+ ...props
371
+ }, /* @__PURE__ */ React7.createElement("path", {
372
+ fill: "#101010",
373
+ d: "M1024 1843H446v-74q-4-80 42-137t125-108q117-91 172-217t78-268H576l284-239q-86-74-86-188 0-103 73-177t177-74q103 0 177 74t73 177q0 114-86 188l284 239h-287q23 141 78 268t172 217q79 51 125 108t42 137v74z"
374
+ }));
491
375
  var bP_default = SvgBP;
492
376
 
493
- // packages/ui/react-ui-gameboard/src/gen/pieces/chess/alpha/bQ.tsx
494
- import { useSignals as _useSignals9 } from "@preact-signals/safe-react/tracking";
495
- import * as React9 from "react";
496
- var SvgBQ = (props) => {
497
- var _effect = _useSignals9();
498
- try {
499
- return /* @__PURE__ */ React9.createElement("svg", {
500
- xmlns: "http://www.w3.org/2000/svg",
501
- viewBox: "0 0 2048 2048",
502
- ...props
503
- }, /* @__PURE__ */ React9.createElement("path", {
504
- fill: "#f9f9f9",
505
- d: "m520 1801.8 41.5-448.7 474-128.9 458 133.5 34.4 446.4z"
506
- }), /* @__PURE__ */ React9.createElement("path", {
507
- fill: "#101010",
508
- d: "M590 1519q4 72-15 158l134-86zm434 324H441q114-231 57.5-456.5T296 937q-12 2-19 2-54 0-92.5-38.5T146 808t38.5-92.5T277 677t92.5 38.5T408 808q0 20-6 38-4 14-15 33l196 139 100-486q-64-31-72-103-5-44 29-91t88-53q54-5 96 29t48 88q7 68-46 114l198 412 198-412q-54-46-46-114 6-54 48-88t96-29q54 6 87.5 53t29.5 91q-9 72-72 103l100 486 196-139q-12-19-15-33-6-18-6-38 0-54 38.5-92.5T1771 677t92.5 38.5T1902 808t-38.5 92.5T1771 939q-7 0-19-2-147 224-203 449.5t58 456.5zm0-450q109 0 222 28.5t213 67.5q2-41 11-89-108-42-221.5-68t-224.5-26-225 26-221 68q8 48 11 89 99-39 212-67.5t223-28.5m0 376h478q-15-34-24-73H570q-10 39-24 73zm434-250-119 72 134 86q-20-86-15-158m-573 47 139 87 139-84-139-86z"
509
- }));
510
- } finally {
511
- _effect.f();
512
- }
513
- };
377
+ // src/gen/pieces/chess/alpha/bQ.tsx
378
+ import * as React8 from "react";
379
+ var SvgBQ = (props) => /* @__PURE__ */ React8.createElement("svg", {
380
+ xmlns: "http://www.w3.org/2000/svg",
381
+ viewBox: "0 0 2048 2048",
382
+ ...props
383
+ }, /* @__PURE__ */ React8.createElement("path", {
384
+ fill: "#f9f9f9",
385
+ d: "m520 1801.8 41.5-448.7 474-128.9 458 133.5 34.4 446.4z"
386
+ }), /* @__PURE__ */ React8.createElement("path", {
387
+ fill: "#101010",
388
+ d: "M590 1519q4 72-15 158l134-86zm434 324H441q114-231 57.5-456.5T296 937q-12 2-19 2-54 0-92.5-38.5T146 808t38.5-92.5T277 677t92.5 38.5T408 808q0 20-6 38-4 14-15 33l196 139 100-486q-64-31-72-103-5-44 29-91t88-53q54-5 96 29t48 88q7 68-46 114l198 412 198-412q-54-46-46-114 6-54 48-88t96-29q54 6 87.5 53t29.5 91q-9 72-72 103l100 486 196-139q-12-19-15-33-6-18-6-38 0-54 38.5-92.5T1771 677t92.5 38.5T1902 808t-38.5 92.5T1771 939q-7 0-19-2-147 224-203 449.5t58 456.5zm0-450q109 0 222 28.5t213 67.5q2-41 11-89-108-42-221.5-68t-224.5-26-225 26-221 68q8 48 11 89 99-39 212-67.5t223-28.5m0 376h478q-15-34-24-73H570q-10 39-24 73zm434-250-119 72 134 86q-20-86-15-158m-573 47 139 87 139-84-139-86z"
389
+ }));
514
390
  var bQ_default = SvgBQ;
515
391
 
516
- // packages/ui/react-ui-gameboard/src/gen/pieces/chess/alpha/bR.tsx
517
- import { useSignals as _useSignals10 } from "@preact-signals/safe-react/tracking";
518
- import * as React10 from "react";
519
- var SvgBR = (props) => {
520
- var _effect = _useSignals10();
521
- try {
522
- return /* @__PURE__ */ React10.createElement("svg", {
523
- xmlns: "http://www.w3.org/2000/svg",
524
- viewBox: "0 0 2048 2048",
525
- ...props
526
- }, /* @__PURE__ */ React10.createElement("path", {
527
- fill: "#f9f9f9",
528
- d: "m674 732-76 807 851 14-75-833z"
529
- }), /* @__PURE__ */ React10.createElement("path", {
530
- fill: "#101010",
531
- d: "M1024 1843H383l29-264 159-118 50-659-149-107-17-341h289v147h137V354h286v147h137V354h289l-17 341-149 107 50 659 159 118 29 264zm0-989h333l-6-88H697l-6 88zm0 647h381l-6-87H649l-6 87z"
532
- }));
533
- } finally {
534
- _effect.f();
535
- }
536
- };
392
+ // src/gen/pieces/chess/alpha/bR.tsx
393
+ import * as React9 from "react";
394
+ var SvgBR = (props) => /* @__PURE__ */ React9.createElement("svg", {
395
+ xmlns: "http://www.w3.org/2000/svg",
396
+ viewBox: "0 0 2048 2048",
397
+ ...props
398
+ }, /* @__PURE__ */ React9.createElement("path", {
399
+ fill: "#f9f9f9",
400
+ d: "m674 732-76 807 851 14-75-833z"
401
+ }), /* @__PURE__ */ React9.createElement("path", {
402
+ fill: "#101010",
403
+ d: "M1024 1843H383l29-264 159-118 50-659-149-107-17-341h289v147h137V354h286v147h137V354h289l-17 341-149 107 50 659 159 118 29 264zm0-989h333l-6-88H697l-6 88zm0 647h381l-6-87H649l-6 87z"
404
+ }));
537
405
  var bR_default = SvgBR;
538
406
 
539
- // packages/ui/react-ui-gameboard/src/gen/pieces/chess/alpha/wB.tsx
540
- import { useSignals as _useSignals11 } from "@preact-signals/safe-react/tracking";
541
- import * as React11 from "react";
542
- var SvgWB = (props) => {
543
- var _effect = _useSignals11();
544
- try {
545
- return /* @__PURE__ */ React11.createElement("svg", {
546
- xmlns: "http://www.w3.org/2000/svg",
547
- viewBox: "0 0 2048 2048",
548
- ...props
549
- }, /* @__PURE__ */ React11.createElement("path", {
550
- fill: "#f9f9f9",
551
- d: "m948 366 1-139 148-7 1 147zM564 860c114-267 456-443 456-443s392 176 476 502c-9 209-183 332-183 332l27 221-653 6 46-233s-230-171-169-385m-101 790c175 6 355 23 425-142h92s0 190-88 246c-163 103-625 38-625 38s-15-146 196-142m631 37-36-185 102 5s22 153 315 131c381-17 318 153 318 153l-483 5z"
552
- }), /* @__PURE__ */ React11.createElement("path", {
553
- fill: "#101010",
554
- d: "M1024 356q66 0 64-66 1-55-64-55-66 0-64 55-3 66 64 66m0 1204q0 114-101 199t-223 84H205q0-117 65-179t142-62h250q51 0 88-7t71-60l10-16h76q-7 21-3 13-45 105-109 125t-146 19H409q-52 0-86 40t-34 53h424q66 0 159-65t93-185H624q67-116 72-229-114-119-162-223t-6-224q33-96 118-189t312-247q-17-11-46-36t-29-79q0-58 41-96t100-38q58 0 100 38t41 96q0 54-29 79t-46 36q226 153 311 247t119 189q42 119-6 224t-162 223q4 113 72 229h-341q0 120 93 185t159 65h424q0-13-34-53t-86-40h-240q-83 0-146-19t-109-125q4 8-3-13h76l10 16q33 53 70 60t89 7h250q76 0 142 62t65 179h-495q-123 0-223-84t-101-199m0-114h283q-28-84-29-154-120-41-254-38-135-3-254 38-2 70-29 154zm0-267q159-1 285 42 189-180 142-346-60-193-427-431-368 238-427 431-48 166 142 346 125-43 285-42m-47-361V714h94v104h95v89h-95v165h-94V907h-95v-89z"
555
- }));
556
- } finally {
557
- _effect.f();
558
- }
559
- };
407
+ // src/gen/pieces/chess/alpha/wB.tsx
408
+ import * as React10 from "react";
409
+ var SvgWB = (props) => /* @__PURE__ */ React10.createElement("svg", {
410
+ xmlns: "http://www.w3.org/2000/svg",
411
+ viewBox: "0 0 2048 2048",
412
+ ...props
413
+ }, /* @__PURE__ */ React10.createElement("path", {
414
+ fill: "#f9f9f9",
415
+ d: "m948 366 1-139 148-7 1 147zM564 860c114-267 456-443 456-443s392 176 476 502c-9 209-183 332-183 332l27 221-653 6 46-233s-230-171-169-385m-101 790c175 6 355 23 425-142h92s0 190-88 246c-163 103-625 38-625 38s-15-146 196-142m631 37-36-185 102 5s22 153 315 131c381-17 318 153 318 153l-483 5z"
416
+ }), /* @__PURE__ */ React10.createElement("path", {
417
+ fill: "#101010",
418
+ d: "M1024 356q66 0 64-66 1-55-64-55-66 0-64 55-3 66 64 66m0 1204q0 114-101 199t-223 84H205q0-117 65-179t142-62h250q51 0 88-7t71-60l10-16h76q-7 21-3 13-45 105-109 125t-146 19H409q-52 0-86 40t-34 53h424q66 0 159-65t93-185H624q67-116 72-229-114-119-162-223t-6-224q33-96 118-189t312-247q-17-11-46-36t-29-79q0-58 41-96t100-38q58 0 100 38t41 96q0 54-29 79t-46 36q226 153 311 247t119 189q42 119-6 224t-162 223q4 113 72 229h-341q0 120 93 185t159 65h424q0-13-34-53t-86-40h-240q-83 0-146-19t-109-125q4 8-3-13h76l10 16q33 53 70 60t89 7h250q76 0 142 62t65 179h-495q-123 0-223-84t-101-199m0-114h283q-28-84-29-154-120-41-254-38-135-3-254 38-2 70-29 154zm0-267q159-1 285 42 189-180 142-346-60-193-427-431-368 238-427 431-48 166 142 346 125-43 285-42m-47-361V714h94v104h95v89h-95v165h-94V907h-95v-89z"
419
+ }));
560
420
  var wB_default = SvgWB;
561
421
 
562
- // packages/ui/react-ui-gameboard/src/gen/pieces/chess/alpha/wK.tsx
563
- import { useSignals as _useSignals12 } from "@preact-signals/safe-react/tracking";
564
- import * as React12 from "react";
565
- var SvgWK = (props) => {
566
- var _effect = _useSignals12();
567
- try {
568
- return /* @__PURE__ */ React12.createElement("svg", {
569
- xmlns: "http://www.w3.org/2000/svg",
570
- viewBox: "0 0 2048 2048",
571
- ...props
572
- }, /* @__PURE__ */ React12.createElement("path", {
573
- fill: "#f9f9f9",
574
- d: "m501.6 1811 48.4-354.4-260-269.2s-166.4-288.2 29.9-481C582.2 448.7 826 727.2 826 727.2l195.6-165.7 184 165.7s216.4-232.5 430.4-76 255.4 317.6 117.4 531.6c-138.1 214-250.9 280.7-250.9 280.7L1558 1811z"
575
- }), /* @__PURE__ */ React12.createElement("path", {
576
- fill: "#101010",
577
- d: "M977 298v-95h94v95h107v95h-107v153q-48-16-94 0V393H870v-95zm47 314q-47 0-136 121-31-36-50-55 93-140 186-140 92 0 186 140-20 19-50 55-90-121-136-121m-447 907-26 156 145-84zm410-206q-1-147-36.5-274.5T870 845q-45-88-131.5-153T570 627q-103 0-208 93T257 949q0 109 86.5 236T546 1408q212-88 441-95m37 530H448l61-365q-325-280-326-535-1-159 125-274.5T575 553q78 0 158.5 47T876 719q61 74 98.5 164.5T1024 1034q12-60 49-150.5t99-164.5q61-72 142-119t159-47q140 0 266 115.5T1865 943q-2 255-326 535l61 365zm0-74h489l-50-298q-216-84-439-84t-439 84l-50 298zm447-250 26 156-145-84zm-410-206q229 7 441 95 115-96 202-223t87-236q0-136-105.5-229T1478 627q-83 0-169.5 65T1178 845q-46 66-81.5 193.5T1061 1313m-176 233 141-84 137 86-141 84z"
578
- }));
579
- } finally {
580
- _effect.f();
581
- }
582
- };
422
+ // src/gen/pieces/chess/alpha/wK.tsx
423
+ import * as React11 from "react";
424
+ var SvgWK = (props) => /* @__PURE__ */ React11.createElement("svg", {
425
+ xmlns: "http://www.w3.org/2000/svg",
426
+ viewBox: "0 0 2048 2048",
427
+ ...props
428
+ }, /* @__PURE__ */ React11.createElement("path", {
429
+ fill: "#f9f9f9",
430
+ d: "m501.6 1811 48.4-354.4-260-269.2s-166.4-288.2 29.9-481C582.2 448.7 826 727.2 826 727.2l195.6-165.7 184 165.7s216.4-232.5 430.4-76 255.4 317.6 117.4 531.6c-138.1 214-250.9 280.7-250.9 280.7L1558 1811z"
431
+ }), /* @__PURE__ */ React11.createElement("path", {
432
+ fill: "#101010",
433
+ d: "M977 298v-95h94v95h107v95h-107v153q-48-16-94 0V393H870v-95zm47 314q-47 0-136 121-31-36-50-55 93-140 186-140 92 0 186 140-20 19-50 55-90-121-136-121m-447 907-26 156 145-84zm410-206q-1-147-36.5-274.5T870 845q-45-88-131.5-153T570 627q-103 0-208 93T257 949q0 109 86.5 236T546 1408q212-88 441-95m37 530H448l61-365q-325-280-326-535-1-159 125-274.5T575 553q78 0 158.5 47T876 719q61 74 98.5 164.5T1024 1034q12-60 49-150.5t99-164.5q61-72 142-119t159-47q140 0 266 115.5T1865 943q-2 255-326 535l61 365zm0-74h489l-50-298q-216-84-439-84t-439 84l-50 298zm447-250 26 156-145-84zm-410-206q229 7 441 95 115-96 202-223t87-236q0-136-105.5-229T1478 627q-83 0-169.5 65T1178 845q-46 66-81.5 193.5T1061 1313m-176 233 141-84 137 86-141 84z"
434
+ }));
583
435
  var wK_default = SvgWK;
584
436
 
585
- // packages/ui/react-ui-gameboard/src/gen/pieces/chess/alpha/wN.tsx
586
- import { useSignals as _useSignals13 } from "@preact-signals/safe-react/tracking";
587
- import * as React13 from "react";
588
- var SvgWN = (props) => {
589
- var _effect = _useSignals13();
590
- try {
591
- return /* @__PURE__ */ React13.createElement("svg", {
592
- xmlns: "http://www.w3.org/2000/svg",
593
- viewBox: "0 0 2048 2048",
594
- ...props
595
- }, /* @__PURE__ */ React13.createElement("path", {
596
- fill: "#f9f9f9",
597
- d: "m352 861 787-569 94 148s336 103 398 388c63 286 51 974 51 974l-1088 9s-37-290 184-460c221-171 221-212 221-212s-226-71-295-16-117 138-117 138l-129-67 74-85-88-97-94 56z"
598
- }), /* @__PURE__ */ React13.createElement("path", {
599
- fill: "#101010",
600
- d: "m1151 178-115 154c-74 50-147 98-220 144-73 45-112 81-116 107L304 846l12 297 122-86 51 50-115 82 217 121 56-102c37-68 135-88 292-60l-55 85c-25 37-63 60-115 71a608 608 0 0 0-183 238c-32 82-45 182-39 301h1242c-23-55-42-118-57-190-15-73-17-152-5-237 29-239 13-440-47-603-61-164-205-303-433-418zm-17 145 59 133a664 664 0 0 1 262 188c55 72 100 150 134 234 27 97 40 181 41 253 0 71-3 140-9 205-7 65-11 131-13 199-2 67 9 145 32 234H621c-4-84 12-158 48-223s85-124 146-177c78-22 129-56 152-102s53-90 90-131c13-10 27-15 38-15 10-1 21 0 33-2 52-7 95-36 129-85 33-49 51-104 52-165l-19-67c-37 159-99 245-188 257l-45 6c-16 1-33 10-52 26-41-25-87-35-138-31q-111 9-165 27l-108 73-39 45-47-28 78-65-138-144-64 41-4-125 366-241c15-34 58-74 131-120l208-131zM960 564c-6 0-12 2-18 7L826 671l212 2c23 0 17-21-16-63-24-31-44-46-62-46M502 868l-33 4-33 56 57 26 46-55z"
601
- }));
602
- } finally {
603
- _effect.f();
604
- }
605
- };
437
+ // src/gen/pieces/chess/alpha/wN.tsx
438
+ import * as React12 from "react";
439
+ var SvgWN = (props) => /* @__PURE__ */ React12.createElement("svg", {
440
+ xmlns: "http://www.w3.org/2000/svg",
441
+ viewBox: "0 0 2048 2048",
442
+ ...props
443
+ }, /* @__PURE__ */ React12.createElement("path", {
444
+ fill: "#f9f9f9",
445
+ d: "m352 861 787-569 94 148s336 103 398 388c63 286 51 974 51 974l-1088 9s-37-290 184-460c221-171 221-212 221-212s-226-71-295-16-117 138-117 138l-129-67 74-85-88-97-94 56z"
446
+ }), /* @__PURE__ */ React12.createElement("path", {
447
+ fill: "#101010",
448
+ d: "m1151 178-115 154c-74 50-147 98-220 144-73 45-112 81-116 107L304 846l12 297 122-86 51 50-115 82 217 121 56-102c37-68 135-88 292-60l-55 85c-25 37-63 60-115 71a608 608 0 0 0-183 238c-32 82-45 182-39 301h1242c-23-55-42-118-57-190-15-73-17-152-5-237 29-239 13-440-47-603-61-164-205-303-433-418zm-17 145 59 133a664 664 0 0 1 262 188c55 72 100 150 134 234 27 97 40 181 41 253 0 71-3 140-9 205-7 65-11 131-13 199-2 67 9 145 32 234H621c-4-84 12-158 48-223s85-124 146-177c78-22 129-56 152-102s53-90 90-131c13-10 27-15 38-15 10-1 21 0 33-2 52-7 95-36 129-85 33-49 51-104 52-165l-19-67c-37 159-99 245-188 257l-45 6c-16 1-33 10-52 26-41-25-87-35-138-31q-111 9-165 27l-108 73-39 45-47-28 78-65-138-144-64 41-4-125 366-241c15-34 58-74 131-120l208-131zM960 564c-6 0-12 2-18 7L826 671l212 2c23 0 17-21-16-63-24-31-44-46-62-46M502 868l-33 4-33 56 57 26 46-55z"
449
+ }));
606
450
  var wN_default = SvgWN;
607
451
 
608
- // packages/ui/react-ui-gameboard/src/gen/pieces/chess/alpha/wP.tsx
609
- import { useSignals as _useSignals14 } from "@preact-signals/safe-react/tracking";
610
- import * as React14 from "react";
611
- var SvgWP = (props) => {
612
- var _effect = _useSignals14();
613
- try {
614
- return /* @__PURE__ */ React14.createElement("svg", {
615
- xmlns: "http://www.w3.org/2000/svg",
616
- viewBox: "0 0 2048 2048",
617
- ...props
618
- }, /* @__PURE__ */ React14.createElement("path", {
619
- fill: "#f9f9f9",
620
- d: "m734 981 196-193s-189-82-79-288c79-149 303-114 361 50 63 179-113 240-113 240l226 197Zm-235 799s-8-107 50-154c196-173 338-386 371-599l210 2c33 206 182 447 321 561 101 59 99 199 99 199z"
621
- }), /* @__PURE__ */ React14.createElement("path", {
622
- fill: "#101010",
623
- d: "M520 1769h1008q8-97-132-182-132-101-196-239t-80-309H928q-15 170-79 309t-197 239q-141 85-132 182m504 74H446v-74q-4-80 42-137t125-108q117-91 172-217t78-268H576l284-239q-86-74-86-188 0-103 73-177t177-74q103 0 177 74t73 177q0 114-86 188l284 239h-287q23 141 78 268t172 217q79 51 125 108t42 137v74zM756 974h536l-225-191q134-31 134-171 0-76-52-126t-125-51q-73 0-125 51t-52 126q0 140 134 171z"
624
- }));
625
- } finally {
626
- _effect.f();
627
- }
628
- };
452
+ // src/gen/pieces/chess/alpha/wP.tsx
453
+ import * as React13 from "react";
454
+ var SvgWP = (props) => /* @__PURE__ */ React13.createElement("svg", {
455
+ xmlns: "http://www.w3.org/2000/svg",
456
+ viewBox: "0 0 2048 2048",
457
+ ...props
458
+ }, /* @__PURE__ */ React13.createElement("path", {
459
+ fill: "#f9f9f9",
460
+ d: "m734 981 196-193s-189-82-79-288c79-149 303-114 361 50 63 179-113 240-113 240l226 197Zm-235 799s-8-107 50-154c196-173 338-386 371-599l210 2c33 206 182 447 321 561 101 59 99 199 99 199z"
461
+ }), /* @__PURE__ */ React13.createElement("path", {
462
+ fill: "#101010",
463
+ d: "M520 1769h1008q8-97-132-182-132-101-196-239t-80-309H928q-15 170-79 309t-197 239q-141 85-132 182m504 74H446v-74q-4-80 42-137t125-108q117-91 172-217t78-268H576l284-239q-86-74-86-188 0-103 73-177t177-74q103 0 177 74t73 177q0 114-86 188l284 239h-287q23 141 78 268t172 217q79 51 125 108t42 137v74zM756 974h536l-225-191q134-31 134-171 0-76-52-126t-125-51q-73 0-125 51t-52 126q0 140 134 171z"
464
+ }));
629
465
  var wP_default = SvgWP;
630
466
 
631
- // packages/ui/react-ui-gameboard/src/gen/pieces/chess/alpha/wQ.tsx
632
- import { useSignals as _useSignals15 } from "@preact-signals/safe-react/tracking";
633
- import * as React15 from "react";
634
- var SvgWQ = (props) => {
635
- var _effect = _useSignals15();
636
- try {
637
- return /* @__PURE__ */ React15.createElement("svg", {
638
- xmlns: "http://www.w3.org/2000/svg",
639
- viewBox: "0 0 2048 2048",
640
- ...props
641
- }, /* @__PURE__ */ React15.createElement("path", {
642
- fill: "#f9f9f9",
643
- d: "m508.5 1815.6 48.4-356.7-216.3-554.6-135.8-20.7-16.1-126.5 112.7-43.8 78.3 73.7-18.4 99 246.2 197.8 112.8-568.3L635 428l78.3-108 112.8 43.7-23 161 223.2 474 244-490-66.8-105.9 92-92 105.9 73.6L1337 534l103.5 529.2 260-161-16-142.7 131-46 57.6 131.1-207 103.6-175 529.2 48.4 308.4z"
644
- }), /* @__PURE__ */ React15.createElement("path", {
645
- fill: "#101010",
646
- d: "M1024 1769h478q-53-130-43-280-100-39-213-67.5t-222-28.5q-110 0-223 28.5T589 1489q9 150-43 280zm0-450q111 0 223.5 26.5T1468 1413q17-105 60.5-212.5T1634 988l-220 155-123-601-267 555-267-555-123 601-220-155q61 105 104.5 212.5T580 1413q108-41 220.5-67.5T1024 1319m0 524H441q114-231 57.5-456.5T296 937q-12 2-19 2-54 0-92.5-38.5T146 808t38.5-92.5T277 677t92.5 38.5T408 808q0 20-6 38-4 14-15 33l196 139 100-486q-64-31-72-103-5-44 29-91t88-53q54-5 96 29t48 88q7 68-46 114l198 412 198-412q-54-46-46-114 6-54 48-88t96-29q54 6 87.5 53t29.5 91q-9 72-72 103l100 486 196-139q-12-19-15-33-6-18-6-38 0-54 38.5-92.5T1771 677t92.5 38.5T1902 808t-38.5 92.5T1771 939q-7 0-19-2-147 224-203 449.5t58 456.5zM276 746q-62 0-62 62t62 62q63 0 63-62t-63-62m466-394q-62 0-62 62t62 62 62-62-62-62M590 1519l119 72-134 86q19-86 15-158m1182-773q-63 0-63 62t63 62q62 0 62-62t-62-62m-466-394q-62 0-62 62t62 62 62-62-62-62m152 1167-119 72 134 86q-20-86-15-158m-573 47 139-83 139 86-139 84z"
647
- }));
648
- } finally {
649
- _effect.f();
650
- }
651
- };
467
+ // src/gen/pieces/chess/alpha/wQ.tsx
468
+ import * as React14 from "react";
469
+ var SvgWQ = (props) => /* @__PURE__ */ React14.createElement("svg", {
470
+ xmlns: "http://www.w3.org/2000/svg",
471
+ viewBox: "0 0 2048 2048",
472
+ ...props
473
+ }, /* @__PURE__ */ React14.createElement("path", {
474
+ fill: "#f9f9f9",
475
+ d: "m508.5 1815.6 48.4-356.7-216.3-554.6-135.8-20.7-16.1-126.5 112.7-43.8 78.3 73.7-18.4 99 246.2 197.8 112.8-568.3L635 428l78.3-108 112.8 43.7-23 161 223.2 474 244-490-66.8-105.9 92-92 105.9 73.6L1337 534l103.5 529.2 260-161-16-142.7 131-46 57.6 131.1-207 103.6-175 529.2 48.4 308.4z"
476
+ }), /* @__PURE__ */ React14.createElement("path", {
477
+ fill: "#101010",
478
+ d: "M1024 1769h478q-53-130-43-280-100-39-213-67.5t-222-28.5q-110 0-223 28.5T589 1489q9 150-43 280zm0-450q111 0 223.5 26.5T1468 1413q17-105 60.5-212.5T1634 988l-220 155-123-601-267 555-267-555-123 601-220-155q61 105 104.5 212.5T580 1413q108-41 220.5-67.5T1024 1319m0 524H441q114-231 57.5-456.5T296 937q-12 2-19 2-54 0-92.5-38.5T146 808t38.5-92.5T277 677t92.5 38.5T408 808q0 20-6 38-4 14-15 33l196 139 100-486q-64-31-72-103-5-44 29-91t88-53q54-5 96 29t48 88q7 68-46 114l198 412 198-412q-54-46-46-114 6-54 48-88t96-29q54 6 87.5 53t29.5 91q-9 72-72 103l100 486 196-139q-12-19-15-33-6-18-6-38 0-54 38.5-92.5T1771 677t92.5 38.5T1902 808t-38.5 92.5T1771 939q-7 0-19-2-147 224-203 449.5t58 456.5zM276 746q-62 0-62 62t62 62q63 0 63-62t-63-62m466-394q-62 0-62 62t62 62 62-62-62-62M590 1519l119 72-134 86q19-86 15-158m1182-773q-63 0-63 62t63 62q62 0 62-62t-62-62m-466-394q-62 0-62 62t62 62 62-62-62-62m152 1167-119 72 134 86q-20-86-15-158m-573 47 139-83 139 86-139 84z"
479
+ }));
652
480
  var wQ_default = SvgWQ;
653
481
 
654
- // packages/ui/react-ui-gameboard/src/gen/pieces/chess/alpha/wR.tsx
655
- import { useSignals as _useSignals16 } from "@preact-signals/safe-react/tracking";
656
- import * as React16 from "react";
657
- var SvgWR = (props) => {
658
- var _effect = _useSignals16();
659
- try {
660
- return /* @__PURE__ */ React16.createElement("svg", {
661
- xmlns: "http://www.w3.org/2000/svg",
662
- viewBox: "0 0 2048 2048",
663
- ...props
664
- }, /* @__PURE__ */ React16.createElement("path", {
665
- fill: "#f9f9f9",
666
- d: "m435 1804 16-212 152-115 51-688-148-115-7-276 210-2 4 138 198 2 7-140 212-3 14 145 193-4 5-138h204l-7 285-145 106 42 693 172 124 19 207z"
667
- }), /* @__PURE__ */ React16.createElement("path", {
668
- fill: "#101010",
669
- d: "M1024 1501H643l5-74h752l5 74zm0-661H692l5-74h654l5 74zm0 1003H383l29-264 159-118 50-659-149-107-17-341h289v147h137V354h286v147h137V354h289l-17 341-149 107 50 659 159 118 29 264zm0-74h557l-15-149-161-119-54-735 152-109 13-230h-138v148h-285V427H955v148H670V427H532l13 230 152 109-54 735-161 119-15 149z"
670
- }));
671
- } finally {
672
- _effect.f();
673
- }
674
- };
482
+ // src/gen/pieces/chess/alpha/wR.tsx
483
+ import * as React15 from "react";
484
+ var SvgWR = (props) => /* @__PURE__ */ React15.createElement("svg", {
485
+ xmlns: "http://www.w3.org/2000/svg",
486
+ viewBox: "0 0 2048 2048",
487
+ ...props
488
+ }, /* @__PURE__ */ React15.createElement("path", {
489
+ fill: "#f9f9f9",
490
+ d: "m435 1804 16-212 152-115 51-688-148-115-7-276 210-2 4 138 198 2 7-140 212-3 14 145 193-4 5-138h204l-7 285-145 106 42 693 172 124 19 207z"
491
+ }), /* @__PURE__ */ React15.createElement("path", {
492
+ fill: "#101010",
493
+ d: "M1024 1501H643l5-74h752l5 74zm0-661H692l5-74h654l5 74zm0 1003H383l29-264 159-118 50-659-149-107-17-341h289v147h137V354h286v147h137V354h289l-17 341-149 107 50 659 159 118 29 264zm0-74h557l-15-149-161-119-54-735 152-109 13-230h-138v148h-285V427H955v148H670V427H532l13 230 152 109-54 735-161 119-15 149z"
494
+ }));
675
495
  var wR_default = SvgWR;
676
496
 
677
- // packages/ui/react-ui-gameboard/src/Chessboard/chess.ts
678
- var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-gameboard/src/Chessboard/chess.ts";
497
+ // src/components/Chessboard/chess.ts
498
+ var __dxlog_file4 = "/__w/dxos/dxos/packages/ui/react-ui-gameboard/src/components/Chessboard/chess.ts";
679
499
  var ChessPieces = alpha_exports;
680
500
  var posToLocation = (pos) => {
681
501
  const col = pos.charCodeAt(0) - "a".charCodeAt(0);
@@ -688,6 +508,9 @@ var posToLocation = (pos) => {
688
508
  var locationToPos = ([row, col]) => {
689
509
  return String.fromCharCode(col + "a".charCodeAt(0)) + (row + 1);
690
510
  };
511
+ var getRawPgn = (pgn) => {
512
+ return pgn.replace(/\[.*?\]/g, "").trim();
513
+ };
691
514
  var styles = {
692
515
  neutral: {
693
516
  black: "bg-neutral-50",
@@ -714,55 +537,85 @@ var boardStyles = styles.original;
714
537
  var getSquareColor = ([row, col]) => {
715
538
  return (col + row) % 2 === 0 ? boardStyles.black : boardStyles.white;
716
539
  };
717
- var makeMove = (game, move) => {
718
- const from = locationToPos(move.from);
719
- const to = locationToPos(move.to);
720
- try {
721
- log4("makeMove", {
722
- move
723
- }, {
724
- F: __dxlog_file4,
725
- L: 72,
726
- S: void 0,
727
- C: (f, a) => f(...a)
728
- });
729
- const promotion = move.promotion ? move.promotion[1].toLowerCase() : "q";
730
- game.move({
731
- from,
732
- to,
733
- promotion
734
- }, {
735
- strict: false
736
- });
737
- return game;
738
- } catch (err) {
739
- return null;
540
+ var createChess = (pgn) => {
541
+ const chess = new ChessJS();
542
+ if (pgn) {
543
+ try {
544
+ chess.loadPgn(pgn);
545
+ } catch {
546
+ log4.warn(pgn, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file4, L: 57, S: void 0 });
547
+ }
740
548
  }
549
+ return chess;
741
550
  };
742
551
  var ChessModel = class {
743
- constructor(fen) {
744
- this._pieces = signal({});
745
- this.initialize(fen);
552
+ _registry;
553
+ _chess = new ChessJS();
554
+ _pieces = Atom.make({});
555
+ _moveIndex = Atom.make(0);
556
+ constructor(_registry, pgn) {
557
+ this._registry = _registry;
558
+ this.update(pgn);
559
+ }
560
+ get readonly() {
561
+ return this._registry.get(this._moveIndex) !== this._chess.history().length;
746
562
  }
747
563
  get turn() {
748
- return this._game.turn() === "w" ? "white" : "black";
564
+ return this._chess.turn() === "w" ? "white" : "black";
565
+ }
566
+ get game() {
567
+ return this._chess;
749
568
  }
750
569
  get pieces() {
751
570
  return this._pieces;
752
571
  }
753
- get game() {
754
- return this._game;
572
+ get moveIndex() {
573
+ return this._moveIndex;
755
574
  }
756
575
  get fen() {
757
- return this._game.fen();
576
+ return this._chess.fen();
758
577
  }
759
- initialize(fen) {
760
- this._pieces.value = {};
761
- this._game = new Chess(fen ? validateFen(fen).ok ? fen : void 0 : void 0);
762
- this._update();
578
+ /**
579
+ * PGN with headers.
580
+ *
581
+ * [Event "?"]
582
+ * [Site "?"]
583
+ * [Date "2025.08.05"]
584
+ * [Round "?"]
585
+ * [White "?"]
586
+ * [Black "?"]
587
+ * [Result "*"]
588
+ */
589
+ // TODO(burdon): Update headers.
590
+ get pgn() {
591
+ return getRawPgn(this._chess.pgn());
592
+ }
593
+ setMoveIndex(index) {
594
+ const temp = new ChessJS();
595
+ const history = this._chess.history({
596
+ verbose: true
597
+ });
598
+ for (let i = 0; i < index && i < history.length; i++) {
599
+ temp.move(history[i]);
600
+ }
601
+ this._updateBoard(temp);
602
+ }
603
+ update(pgn = "") {
604
+ const previous = this._chess.history();
605
+ try {
606
+ this._chess.loadPgn(pgn);
607
+ this._chess.setHeader("Date", createDate());
608
+ this._chess.setHeader("Site", "dxos.org");
609
+ } catch {
610
+ }
611
+ const current = this._chess.history();
612
+ if (!isValidNextMove(previous, current)) {
613
+ this._registry.set(this._pieces, {});
614
+ }
615
+ this._updateBoard(this._chess);
763
616
  }
764
617
  isValidMove(move) {
765
- return makeMove(new Chess(this._game.fen()), move) !== null;
618
+ return tryMove(new ChessJS(this._chess.fen()), move) !== null;
766
619
  }
767
620
  canPromote(move) {
768
621
  const isPawnMove = move.piece === "BP" || move.piece === "WP";
@@ -770,47 +623,96 @@ var ChessModel = class {
770
623
  return isPawnMove && isToLastRank;
771
624
  }
772
625
  makeMove(move) {
773
- const game = makeMove(this._game, move);
626
+ const game = tryMove(this._chess, move);
774
627
  if (!game) {
775
628
  return false;
776
629
  }
777
- this._game = game;
778
- this._update();
630
+ this._updateBoard(this._chess);
779
631
  return true;
780
632
  }
781
633
  makeRandomMove() {
782
- const moves = this._game.moves();
634
+ const moves = this._chess.moves();
783
635
  if (!moves.length) {
784
636
  return false;
785
637
  }
786
638
  const move = moves[Math.floor(Math.random() * moves.length)];
787
- this._game.move(move);
788
- this._update();
639
+ this._chess.move(move);
640
+ this._updateBoard(this._chess);
789
641
  return true;
790
642
  }
791
643
  /**
792
644
  * Update pieces preserving identity.
793
645
  */
794
- _update() {
795
- const pieces = {};
796
- this._game.board().flatMap((row) => row.forEach((record) => {
797
- if (!record) {
798
- return;
799
- }
800
- const { square, type, color } = record;
801
- const pieceType = `${color.toUpperCase()}${type.toUpperCase()}`;
802
- const location = posToLocation(square);
803
- pieces[locationToString(location)] = {
804
- id: `${square}-${pieceType}`,
805
- type: pieceType,
806
- side: color === "w" ? "white" : "black",
807
- location
808
- };
809
- }));
810
- this._pieces.value = mapPieces(this._pieces.value, pieces);
646
+ _updateBoard(chess) {
647
+ this._registry.set(this._pieces, createPieceMap(chess));
648
+ this._registry.set(this._moveIndex, chess.history().length);
811
649
  }
812
650
  };
813
- var mapPieces = (before, after) => {
651
+ var tryMove = (chess, move) => {
652
+ const from = locationToPos(move.from);
653
+ const to = locationToPos(move.to);
654
+ try {
655
+ const promotion = move.promotion ? move.promotion[1].toLowerCase() : "q";
656
+ chess.move({
657
+ from,
658
+ to,
659
+ promotion
660
+ }, {
661
+ strict: false
662
+ });
663
+ return chess;
664
+ } catch {
665
+ return null;
666
+ }
667
+ };
668
+ var isValidNextMove = (previous, current) => {
669
+ if (current.length > previous.length + 1) {
670
+ return false;
671
+ }
672
+ for (let i = 0; i < previous.length; i++) {
673
+ if (previous[i] !== current[i]) {
674
+ return false;
675
+ }
676
+ }
677
+ return true;
678
+ };
679
+ var createPieceMap = (chess) => {
680
+ const temp = new ChessJS();
681
+ let pieces = _createPieceMap(temp);
682
+ const history = chess.history({
683
+ verbose: true
684
+ });
685
+ for (let i = 0; i < history.length; i++) {
686
+ const move = history[i];
687
+ temp.move(move);
688
+ pieces = _diffPieces(pieces, _createPieceMap(temp));
689
+ const test = /* @__PURE__ */ new Set();
690
+ Object.values(pieces).forEach((piece) => {
691
+ invariant3(!test.has(piece.id), "Duplicate: " + piece.id, { "~LogMeta": "~LogMeta", F: __dxlog_file4, L: 213, S: void 0, A: ["!test.has(piece.id)", "'Duplicate: ' + piece.id"] });
692
+ test.add(piece.id);
693
+ });
694
+ }
695
+ return pieces;
696
+ };
697
+ var _createPieceMap = (chess) => {
698
+ const pieces = {};
699
+ chess.board().flatMap((row) => row.forEach((record) => {
700
+ if (!record) {
701
+ return;
702
+ }
703
+ const { square, type, color } = record;
704
+ const pieceType = `${color.toUpperCase()}${type.toUpperCase()}`;
705
+ const location = posToLocation(square);
706
+ pieces[locationToString(location)] = {
707
+ id: `${square}-${pieceType}`,
708
+ type: pieceType,
709
+ side: color === "w" ? "white" : "black",
710
+ location
711
+ };
712
+ }));
713
+ return pieces;
714
+ };
715
+ var _diffPieces = (before, after) => {
814
716
  const difference = {
815
717
  removed: {},
816
718
  added: {}
@@ -833,192 +735,171 @@ var mapPieces = (before, after) => {
833
735
  piece.id = previous.id;
834
736
  }
835
737
  }
836
- log4("delta", {
837
- before: Object.keys(before).length,
838
- after: Object.keys(after).length,
839
- removed: Object.keys(difference.removed).length,
840
- added: Object.keys(difference.added).length
841
- }, {
842
- F: __dxlog_file4,
843
- L: 205,
844
- S: void 0,
845
- C: (f, a) => f(...a)
846
- });
847
738
  return after;
848
739
  };
740
+ var createDate = (date = /* @__PURE__ */ new Date()) => date.toISOString().slice(0, 10).replace(/-/g, ".");
849
741
 
850
- // packages/ui/react-ui-gameboard/src/Chessboard/Chessboard.tsx
851
- import { useSignals as _useSignals17 } from "@preact-signals/safe-react/tracking";
852
- import React17, { useRef as useRef3, useMemo, useEffect as useEffect4, useState as useState4, memo as memo3 } from "react";
742
+ // src/components/Chessboard/Chessboard.tsx
743
+ import { Atom as Atom2, useAtomValue } from "@effect-atom/atom-react";
744
+ import React16, { forwardRef as forwardRef2, memo as memo3, useEffect as useEffect4, useMemo, useRef as useRef3, useState as useState4 } from "react";
853
745
  import { useResizeDetector } from "react-resize-detector";
854
- import { useTrackProps as useTrackProps2 } from "@dxos/react-ui";
855
- import { mx as mx5 } from "@dxos/react-ui-theme";
856
- import { isNotFalsy } from "@dxos/util";
857
- var Chessboard = /* @__PURE__ */ memo3(({ orientation, showLabels, debug, rows = 8, cols = 8 }) => {
858
- var _effect = _useSignals17();
859
- try {
860
- useTrackProps2({
861
- orientation,
862
- showLabels,
863
- debug
864
- }, Chessboard.displayName, false);
865
- const { ref: containerRef, width, height } = useResizeDetector({
866
- refreshRate: 200
867
- });
868
- const { model, promoting, onPromotion } = useBoardContext();
869
- const locations = useMemo(() => {
870
- return Array.from({
871
- length: rows
872
- }, (_, i) => orientation === "black" ? i : rows - 1 - i).flatMap((row) => Array.from({
873
- length: cols
874
- }).map((_, col) => [
875
- row,
876
- col
877
- ]));
878
- }, [
879
- orientation,
880
- rows,
881
- cols
882
- ]);
883
- const layout = useMemo(() => {
884
- return locations.map((location) => {
885
- return /* @__PURE__ */ React17.createElement("div", {
886
- key: locationToString(location),
887
- ["data-location"]: locationToString(location)
888
- });
746
+ import { useForwardedRef } from "@dxos/react-ui";
747
+ import { mx as mx4 } from "@dxos/ui-theme";
748
+ import { isNonNullable } from "@dxos/util";
749
+ var EMPTY_PIECES_ATOM = Atom2.make({});
750
+ var CHESSBOARD_NAME = "Chessboard";
751
+ var ChessboardComponent = /* @__PURE__ */ forwardRef2(({ classNames, orientation, showLabels, debug, rows = 8, cols = 8 }, forwardedRef) => {
752
+ const targetRef = useForwardedRef(forwardedRef);
753
+ const { width, height } = useResizeDetector({
754
+ targetRef,
755
+ refreshRate: 200
756
+ });
757
+ const { model, promoting, onPromotion } = useGameboardContext(CHESSBOARD_NAME);
758
+ const pieces = useAtomValue(model?.pieces ?? EMPTY_PIECES_ATOM);
759
+ const squares = useMemo(() => {
760
+ return Array.from({
761
+ length: rows
762
+ }, (_, i) => orientation === "black" ? i : rows - 1 - i).flatMap((row) => Array.from({
763
+ length: cols
764
+ }).map((_, col) => [
765
+ row,
766
+ col
767
+ ]));
768
+ }, [
769
+ orientation,
770
+ rows,
771
+ cols
772
+ ]);
773
+ const layout = useMemo(() => {
774
+ return squares.map((location) => {
775
+ return /* @__PURE__ */ React16.createElement("div", {
776
+ key: locationToString(location),
777
+ "data-location": locationToString(location)
889
778
  });
890
- }, [
891
- locations
892
- ]);
893
- const [grid, setGrid] = useState4({});
894
- const gridRef = useRef3(null);
895
- useEffect4(() => {
896
- setGrid(locations.reduce((acc, location) => {
897
- const square = getSquareLocation(gridRef.current, location);
898
- const bounds = getRelativeBounds(gridRef.current, square);
899
- return {
900
- ...acc,
901
- [locationToString(location)]: bounds
902
- };
903
- }, {}));
904
- }, [
905
- locations,
906
- width,
907
- height
908
- ]);
909
- const positions = useMemo(() => {
910
- if (!gridRef.current) {
911
- return [];
912
- }
913
- return Object.values(model?.pieces.value ?? {}).map((piece) => {
914
- if (piece.id === promoting?.id) {
915
- return null;
916
- }
917
- const bounds = grid[locationToString(piece.location)];
918
- return {
919
- piece,
920
- bounds
921
- };
922
- }).filter(isNotFalsy);
923
- }, [
924
- grid,
925
- model?.pieces.value,
926
- promoting
927
- ]);
928
- return /* @__PURE__ */ React17.createElement("div", {
929
- ref: containerRef,
930
- className: "relative"
931
- }, /* @__PURE__ */ React17.createElement("div", {
932
- ref: gridRef,
933
- className: "grid grid-rows-8 grid-cols-8 aspect-square select-none"
934
- }, layout), /* @__PURE__ */ React17.createElement("div", null, locations.map((location) => /* @__PURE__ */ React17.createElement(Square, {
935
- key: locationToString(location),
936
- location,
937
- label: showLabels ? locationToPos(location) : void 0,
938
- bounds: grid[locationToString(location)],
939
- classNames: getSquareColor(location)
940
- }))), /* @__PURE__ */ React17.createElement("div", {
941
- className: mx5(promoting && "opacity-50")
942
- }, positions.map(({ bounds, piece }) => /* @__PURE__ */ React17.createElement(Piece, {
943
- key: piece.id,
944
- piece,
945
- bounds,
946
- label: debug ? piece.id : void 0,
947
- orientation,
948
- Component: ChessPieces[piece.type]
949
- }))), /* @__PURE__ */ React17.createElement("div", null, promoting && /* @__PURE__ */ React17.createElement(PromotionSelector, {
950
- grid,
951
- piece: promoting,
952
- onSelect: (piece) => {
953
- onPromotion({
954
- from: Object.values(model.pieces.value).find((p) => p.id === promoting.id).location,
955
- to: piece.location,
956
- piece: promoting.type,
957
- promotion: piece.type
958
- });
779
+ });
780
+ }, [
781
+ squares
782
+ ]);
783
+ const [grid, setGrid] = useState4({});
784
+ const gridRef = useRef3(null);
785
+ useEffect4(() => {
786
+ setGrid(squares.reduce((acc, location) => {
787
+ const square = getSquareLocation(gridRef.current, location);
788
+ const bounds = getRelativeBounds(gridRef.current, square);
789
+ return {
790
+ ...acc,
791
+ [locationToString(location)]: bounds
792
+ };
793
+ }, {}));
794
+ }, [
795
+ squares,
796
+ width,
797
+ height
798
+ ]);
799
+ const positions = useMemo(() => {
800
+ if (!gridRef.current) {
801
+ return [];
802
+ }
803
+ return Object.values(pieces).map((piece) => {
804
+ if (piece.id === promoting?.id) {
805
+ return null;
959
806
  }
960
- })));
961
- } finally {
962
- _effect.f();
963
- }
964
- });
965
- Chessboard.displayName = "Chessboard";
966
- var getSquareLocation = (container, location) => {
967
- return container.querySelector(`[data-location="${locationToString(location)}"]`);
968
- };
969
- var PromotionSelector = ({ grid, piece, onSelect }) => {
970
- var _effect = _useSignals17();
971
- try {
972
- const positions = [
973
- "Q",
974
- "N",
975
- "R",
976
- "B"
977
- ].map((pieceType, i) => {
978
- const location = [
979
- piece.location[0] + (piece.location[0] === 0 ? i : -i),
980
- piece.location[1]
981
- ];
807
+ const bounds = grid[locationToString(piece.location)];
982
808
  return {
983
- piece: {
984
- id: `promotion-${pieceType}`,
985
- type: (piece.side === "black" ? "B" : "W") + pieceType,
986
- side: piece.side,
987
- location
988
- },
989
- bounds: grid[locationToString(location)]
809
+ piece,
810
+ bounds
990
811
  };
991
- });
992
- const handleSelect = (selected) => {
993
- onSelect({
994
- ...piece,
995
- type: selected.type
812
+ }).filter(isNonNullable);
813
+ }, [
814
+ grid,
815
+ pieces,
816
+ promoting
817
+ ]);
818
+ return /* @__PURE__ */ React16.createElement("div", {
819
+ ref: targetRef,
820
+ tabIndex: 0,
821
+ className: mx4("dx-expander relative outline-hidden", classNames)
822
+ }, /* @__PURE__ */ React16.createElement("div", {
823
+ ref: gridRef,
824
+ className: "grid grid-rows-8 grid-cols-8 aspect-square select-none"
825
+ }, layout), /* @__PURE__ */ React16.createElement("div", null, squares.map((location) => /* @__PURE__ */ React16.createElement(Gameboard.Square, {
826
+ key: locationToString(location),
827
+ location,
828
+ label: showLabels ? locationToPos(location) : void 0,
829
+ bounds: grid[locationToString(location)],
830
+ classNames: getSquareColor(location)
831
+ }))), /* @__PURE__ */ React16.createElement("div", {
832
+ className: mx4(promoting && "opacity-50")
833
+ }, positions.map(({ bounds, piece }) => /* @__PURE__ */ React16.createElement(Gameboard.Piece, {
834
+ key: piece.id,
835
+ piece,
836
+ bounds,
837
+ label: debug ? piece.id : void 0,
838
+ orientation,
839
+ Component: ChessPieces[piece.type]
840
+ }))), promoting && /* @__PURE__ */ React16.createElement(PromotionSelector, {
841
+ grid,
842
+ piece: promoting,
843
+ onSelect: (piece) => {
844
+ onPromotion({
845
+ from: Object.values(pieces).find((p) => p.id === promoting.id).location,
846
+ to: piece.location,
847
+ piece: promoting.type,
848
+ promotion: piece.type
996
849
  });
850
+ }
851
+ }));
852
+ });
853
+ ChessboardComponent.displayName = CHESSBOARD_NAME;
854
+ var Chessboard = /* @__PURE__ */ memo3(ChessboardComponent);
855
+ var PromotionSelector = ({ grid, piece, onSelect }) => {
856
+ const positions = [
857
+ "Q",
858
+ "N",
859
+ "R",
860
+ "B"
861
+ ].map((pieceType, i) => {
862
+ const location = [
863
+ piece.location[0] + (piece.location[0] === 0 ? i : -i),
864
+ piece.location[1]
865
+ ];
866
+ return {
867
+ piece: {
868
+ id: `promotion-${pieceType}`,
869
+ type: (piece.side === "black" ? "B" : "W") + pieceType,
870
+ side: piece.side,
871
+ location
872
+ },
873
+ bounds: grid[locationToString(location)]
997
874
  };
998
- return /* @__PURE__ */ React17.createElement("div", null, positions.map(({ piece: piece2, bounds }) => /* @__PURE__ */ React17.createElement("div", {
999
- key: piece2.id,
1000
- style: bounds,
1001
- onClick: () => handleSelect(piece2)
1002
- }, /* @__PURE__ */ React17.createElement(Piece, {
1003
- piece: piece2,
1004
- bounds,
1005
- Component: ChessPieces[piece2.type],
1006
- classNames: mx5("border-2 border-neutral-700 rounded-full", boardStyles.promotion)
1007
- }))));
1008
- } finally {
1009
- _effect.f();
1010
- }
875
+ });
876
+ const handleSelect = (selected) => {
877
+ onSelect({
878
+ ...piece,
879
+ type: selected.type
880
+ });
881
+ };
882
+ return /* @__PURE__ */ React16.createElement(React16.Fragment, null, positions.map(({ piece: piece2, bounds }) => /* @__PURE__ */ React16.createElement(Gameboard.Piece, {
883
+ key: piece2.id,
884
+ classNames: mx4("border-2 border-neutral-700 rounded-full", boardStyles.promotion),
885
+ piece: piece2,
886
+ bounds,
887
+ Component: ChessPieces[piece2.type],
888
+ onClick: () => handleSelect(piece2)
889
+ })));
890
+ };
891
+ var getSquareLocation = (container, location) => {
892
+ return container.querySelector(`[data-location="${locationToString(location)}"]`);
1011
893
  };
1012
894
  export {
1013
- Board,
1014
- BoardContext,
1015
895
  ChessModel,
1016
896
  ChessPieces,
1017
897
  Chessboard,
1018
- Container,
1019
- Piece,
1020
- Square,
898
+ Gameboard,
1021
899
  boardStyles,
900
+ createChess,
901
+ createPieceMap,
902
+ getRawPgn,
1022
903
  getRelativeBounds,
1023
904
  getSquareColor,
1024
905
  isEqualLocation,
@@ -1026,9 +907,8 @@ export {
1026
907
  isPiece,
1027
908
  locationToPos,
1028
909
  locationToString,
1029
- mapPieces,
1030
910
  posToLocation,
1031
911
  stringToLocation,
1032
- useBoardContext
912
+ useGameboardContext
1033
913
  };
1034
914
  //# sourceMappingURL=index.mjs.map