@dxos/react-ui-gameboard 0.8.4-main.84f28bd → 0.8.4-main.b97322e
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.
- package/dist/lib/browser/index.mjs +147 -156
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +147 -156
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/Chessboard/Chessboard.d.ts +5 -4
- package/dist/types/src/Chessboard/Chessboard.d.ts.map +1 -1
- package/dist/types/src/Chessboard/Chessboard.stories.d.ts.map +1 -1
- package/dist/types/src/Chessboard/chess.d.ts +2 -2
- package/dist/types/src/Chessboard/chess.d.ts.map +1 -1
- package/dist/types/src/Gameboard/Gameboard.d.ts +23 -0
- package/dist/types/src/Gameboard/Gameboard.d.ts.map +1 -0
- package/dist/types/src/Gameboard/Piece.d.ts.map +1 -0
- package/dist/types/src/Gameboard/Square.d.ts.map +1 -0
- package/dist/types/src/Gameboard/context.d.ts +10 -0
- package/dist/types/src/Gameboard/context.d.ts.map +1 -0
- package/dist/types/src/{Board → Gameboard}/index.d.ts +1 -2
- package/dist/types/src/Gameboard/index.d.ts.map +1 -0
- package/dist/types/src/{Board → Gameboard}/types.d.ts +1 -1
- package/dist/types/src/Gameboard/types.d.ts.map +1 -0
- package/dist/types/src/Gameboard/util.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -13
- package/src/Chessboard/Chessboard.stories.tsx +9 -7
- package/src/Chessboard/Chessboard.tsx +115 -111
- package/src/Chessboard/chess.ts +3 -3
- package/src/{Board/Board.tsx → Gameboard/Gameboard.tsx} +36 -19
- package/src/Gameboard/context.ts +22 -0
- package/src/{Board → Gameboard}/index.ts +1 -2
- package/src/{Board → Gameboard}/types.ts +1 -1
- package/src/index.ts +1 -1
- package/dist/types/src/Board/Board.d.ts +0 -15
- package/dist/types/src/Board/Board.d.ts.map +0 -1
- package/dist/types/src/Board/Container.d.ts +0 -14
- package/dist/types/src/Board/Container.d.ts.map +0 -1
- package/dist/types/src/Board/Piece.d.ts.map +0 -1
- package/dist/types/src/Board/Square.d.ts.map +0 -1
- package/dist/types/src/Board/context.d.ts +0 -10
- package/dist/types/src/Board/context.d.ts.map +0 -1
- package/dist/types/src/Board/index.d.ts.map +0 -1
- package/dist/types/src/Board/types.d.ts.map +0 -1
- package/dist/types/src/Board/util.d.ts.map +0 -1
- package/src/Board/Container.tsx +0 -25
- package/src/Board/context.ts +0 -22
- /package/dist/types/src/{Board → Gameboard}/Piece.d.ts +0 -0
- /package/dist/types/src/{Board → Gameboard}/Square.d.ts +0 -0
- /package/dist/types/src/{Board → Gameboard}/util.d.ts +0 -0
- /package/src/{Board → Gameboard}/Piece.tsx +0 -0
- /package/src/{Board → Gameboard}/Square.tsx +0 -0
- /package/src/{Board → Gameboard}/util.ts +0 -0
|
@@ -5,22 +5,22 @@ var __export = (target, all) => {
|
|
|
5
5
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
-
// src/
|
|
8
|
+
// src/Gameboard/context.ts
|
|
9
9
|
import { createContext, useContext } from "react";
|
|
10
10
|
import { raise } from "@dxos/debug";
|
|
11
|
-
var
|
|
11
|
+
var GameboardContext = createContext(void 0);
|
|
12
12
|
var useBoardContext = () => {
|
|
13
|
-
return useContext(
|
|
13
|
+
return useContext(GameboardContext) ?? raise(new Error("Missing BoardContext"));
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
// src/
|
|
16
|
+
// src/Gameboard/types.ts
|
|
17
17
|
var locationToString = (location) => location.join("-");
|
|
18
18
|
var stringToLocation = (str) => str.split("-").map(Number);
|
|
19
19
|
var isPiece = (piece) => piece != null && typeof piece === "object" && "id" in piece && "type" in piece && "location" in piece && isLocation(piece.location);
|
|
20
20
|
var isLocation = (token) => Array.isArray(token) && token.length === 2 && token.every((val) => typeof val === "number");
|
|
21
21
|
var isEqualLocation = (l1, l2) => l1[0] === l2[0] && l1[1] === l2[1];
|
|
22
22
|
|
|
23
|
-
// src/
|
|
23
|
+
// src/Gameboard/util.ts
|
|
24
24
|
var getRelativeBounds = (container, element) => {
|
|
25
25
|
const containerRect = container.getBoundingClientRect();
|
|
26
26
|
const elementRect = element.getBoundingClientRect();
|
|
@@ -32,36 +32,15 @@ var getRelativeBounds = (container, element) => {
|
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
// src/
|
|
36
|
-
import { useSignals as
|
|
35
|
+
// src/Gameboard/Gameboard.tsx
|
|
36
|
+
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
37
37
|
import { monitorForElements } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
|
|
38
|
-
import
|
|
38
|
+
import React, { forwardRef, useCallback, useEffect, useState } from "react";
|
|
39
39
|
import { log } from "@dxos/log";
|
|
40
|
-
import { mx as mx2 } from "@dxos/react-ui-theme";
|
|
41
|
-
|
|
42
|
-
// src/Board/Container.tsx
|
|
43
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
44
|
-
import React, { forwardRef } from "react";
|
|
45
40
|
import { mx } from "@dxos/react-ui-theme";
|
|
46
|
-
var
|
|
41
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/ui/react-ui-gameboard/src/Gameboard/Gameboard.tsx";
|
|
42
|
+
var GameboardRoot = ({ children, model, onDrop }) => {
|
|
47
43
|
var _effect = _useSignals();
|
|
48
|
-
try {
|
|
49
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
50
|
-
ref: forwardedRef,
|
|
51
|
-
style,
|
|
52
|
-
className: "flex w-full h-full justify-center overflow-hidden"
|
|
53
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
54
|
-
className: mx("max-w-full max-h-full content-center", classNames)
|
|
55
|
-
}, children));
|
|
56
|
-
} finally {
|
|
57
|
-
_effect.f();
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
// src/Board/Board.tsx
|
|
62
|
-
var __dxlog_file = "/__w/dxos/dxos/packages/ui/react-ui-gameboard/src/Board/Board.tsx";
|
|
63
|
-
var Root = ({ children, classNames, model, onDrop }) => {
|
|
64
|
-
var _effect = _useSignals2();
|
|
65
44
|
try {
|
|
66
45
|
const [dragging, setDragging] = useState(false);
|
|
67
46
|
const [promoting, setPromoting] = useState();
|
|
@@ -70,7 +49,7 @@ var Root = ({ children, classNames, model, onDrop }) => {
|
|
|
70
49
|
move
|
|
71
50
|
}, {
|
|
72
51
|
F: __dxlog_file,
|
|
73
|
-
L:
|
|
52
|
+
L: 29,
|
|
74
53
|
S: void 0,
|
|
75
54
|
C: (f, a) => f(...a)
|
|
76
55
|
});
|
|
@@ -87,7 +66,7 @@ var Root = ({ children, classNames, model, onDrop }) => {
|
|
|
87
66
|
source
|
|
88
67
|
}, {
|
|
89
68
|
F: __dxlog_file,
|
|
90
|
-
L:
|
|
69
|
+
L: 42,
|
|
91
70
|
S: void 0,
|
|
92
71
|
C: (f, a) => f(...a)
|
|
93
72
|
});
|
|
@@ -99,7 +78,7 @@ var Root = ({ children, classNames, model, onDrop }) => {
|
|
|
99
78
|
location
|
|
100
79
|
}, {
|
|
101
80
|
F: __dxlog_file,
|
|
102
|
-
L:
|
|
81
|
+
L: 46,
|
|
103
82
|
S: void 0,
|
|
104
83
|
C: (f, a) => f(...a)
|
|
105
84
|
});
|
|
@@ -131,35 +110,48 @@ var Root = ({ children, classNames, model, onDrop }) => {
|
|
|
131
110
|
}, [
|
|
132
111
|
model
|
|
133
112
|
]);
|
|
134
|
-
return /* @__PURE__ */
|
|
113
|
+
return /* @__PURE__ */ React.createElement(GameboardContext.Provider, {
|
|
135
114
|
value: {
|
|
136
115
|
model,
|
|
137
116
|
dragging,
|
|
138
117
|
promoting,
|
|
139
118
|
onPromotion
|
|
140
119
|
}
|
|
141
|
-
},
|
|
142
|
-
classNames: mx2("aspect-square", classNames)
|
|
143
|
-
}, children));
|
|
120
|
+
}, children);
|
|
144
121
|
} finally {
|
|
145
122
|
_effect.f();
|
|
146
123
|
}
|
|
147
124
|
};
|
|
148
|
-
|
|
149
|
-
var
|
|
150
|
-
|
|
125
|
+
GameboardRoot.displayName = "Gameboard.Root";
|
|
126
|
+
var GameboardContent = /* @__PURE__ */ forwardRef(({ children, classNames, style }, forwardedRef) => {
|
|
127
|
+
var _effect = _useSignals();
|
|
128
|
+
try {
|
|
129
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
130
|
+
ref: forwardedRef,
|
|
131
|
+
style,
|
|
132
|
+
className: "flex w-full h-full justify-center overflow-hidden"
|
|
133
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
134
|
+
className: mx("max-w-full max-h-full content-center aspect-square", classNames)
|
|
135
|
+
}, children));
|
|
136
|
+
} finally {
|
|
137
|
+
_effect.f();
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
var Gameboard = {
|
|
141
|
+
Root: GameboardRoot,
|
|
142
|
+
Content: GameboardContent
|
|
151
143
|
};
|
|
152
144
|
|
|
153
|
-
// src/
|
|
154
|
-
import { useSignals as
|
|
145
|
+
// src/Gameboard/Square.tsx
|
|
146
|
+
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
155
147
|
import { dropTargetForElements } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
|
|
156
|
-
import
|
|
148
|
+
import React2, { useRef, useState as useState2, useEffect as useEffect2, memo } from "react";
|
|
157
149
|
import { invariant } from "@dxos/invariant";
|
|
158
150
|
import { log as log2 } from "@dxos/log";
|
|
159
|
-
import { mx as
|
|
160
|
-
var __dxlog_file2 = "/__w/dxos/dxos/packages/ui/react-ui-gameboard/src/
|
|
151
|
+
import { mx as mx2 } from "@dxos/react-ui-theme";
|
|
152
|
+
var __dxlog_file2 = "/__w/dxos/dxos/packages/ui/react-ui-gameboard/src/Gameboard/Square.tsx";
|
|
161
153
|
var Square = /* @__PURE__ */ memo(({ location, bounds, label, classNames }) => {
|
|
162
|
-
var _effect =
|
|
154
|
+
var _effect = _useSignals2();
|
|
163
155
|
try {
|
|
164
156
|
const ref = useRef(null);
|
|
165
157
|
const [state, setState] = useState2("idle");
|
|
@@ -221,12 +213,12 @@ var Square = /* @__PURE__ */ memo(({ location, bounds, label, classNames }) => {
|
|
|
221
213
|
model,
|
|
222
214
|
location
|
|
223
215
|
]);
|
|
224
|
-
return /* @__PURE__ */
|
|
216
|
+
return /* @__PURE__ */ React2.createElement("div", {
|
|
225
217
|
ref,
|
|
226
218
|
style: bounds,
|
|
227
|
-
className:
|
|
228
|
-
}, label && /* @__PURE__ */
|
|
229
|
-
className:
|
|
219
|
+
className: mx2("absolute flex justify-center items-center border-2 box-border select-none", classNames, state === "validMove" ? "border-neutral-800" : "border-transparent")
|
|
220
|
+
}, label && /* @__PURE__ */ React2.createElement("div", {
|
|
221
|
+
className: mx2("absolute bottom-1 left-1 text-xs text-neutral-500")
|
|
230
222
|
}, label));
|
|
231
223
|
} finally {
|
|
232
224
|
_effect.f();
|
|
@@ -234,20 +226,20 @@ var Square = /* @__PURE__ */ memo(({ location, bounds, label, classNames }) => {
|
|
|
234
226
|
});
|
|
235
227
|
Square.displayName = "Square";
|
|
236
228
|
|
|
237
|
-
// src/
|
|
238
|
-
import { useSignals as
|
|
229
|
+
// src/Gameboard/Piece.tsx
|
|
230
|
+
import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
|
|
239
231
|
import { draggable } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
|
|
240
232
|
import { centerUnderPointer } from "@atlaskit/pragmatic-drag-and-drop/element/center-under-pointer";
|
|
241
233
|
import { setCustomNativeDragPreview } from "@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview";
|
|
242
|
-
import
|
|
234
|
+
import React3, { useState as useState3, useRef as useRef2, useEffect as useEffect3, memo as memo2 } from "react";
|
|
243
235
|
import { createPortal } from "react-dom";
|
|
244
236
|
import { invariant as invariant2 } from "@dxos/invariant";
|
|
245
237
|
import { log as log3 } from "@dxos/log";
|
|
246
238
|
import { useDynamicRef, useTrackProps } from "@dxos/react-ui";
|
|
247
|
-
import { mx as
|
|
248
|
-
var __dxlog_file3 = "/__w/dxos/dxos/packages/ui/react-ui-gameboard/src/
|
|
239
|
+
import { mx as mx3 } from "@dxos/react-ui-theme";
|
|
240
|
+
var __dxlog_file3 = "/__w/dxos/dxos/packages/ui/react-ui-gameboard/src/Gameboard/Piece.tsx";
|
|
249
241
|
var Piece = /* @__PURE__ */ memo2(({ classNames, piece, orientation, bounds, label, Component }) => {
|
|
250
|
-
var _effect =
|
|
242
|
+
var _effect = _useSignals3();
|
|
251
243
|
try {
|
|
252
244
|
useTrackProps({
|
|
253
245
|
classNames,
|
|
@@ -352,26 +344,26 @@ var Piece = /* @__PURE__ */ memo2(({ classNames, piece, orientation, bounds, lab
|
|
|
352
344
|
piece.location,
|
|
353
345
|
bounds
|
|
354
346
|
]);
|
|
355
|
-
return /* @__PURE__ */
|
|
347
|
+
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement("div", {
|
|
356
348
|
ref,
|
|
357
349
|
style: {
|
|
358
350
|
width: bounds?.width,
|
|
359
351
|
height: bounds?.height
|
|
360
352
|
},
|
|
361
|
-
className:
|
|
353
|
+
className: mx3(
|
|
362
354
|
"absolute",
|
|
363
355
|
classNames,
|
|
364
356
|
// orientation === 'black' && '_rotate-180',
|
|
365
357
|
dragging && "opacity-20",
|
|
366
358
|
isDragging && "pointer-events-none"
|
|
367
359
|
)
|
|
368
|
-
}, /* @__PURE__ */
|
|
360
|
+
}, /* @__PURE__ */ React3.createElement(Component, {
|
|
369
361
|
className: "grow"
|
|
370
|
-
}), label && /* @__PURE__ */
|
|
362
|
+
}), label && /* @__PURE__ */ React3.createElement("div", {
|
|
371
363
|
className: "absolute inset-1 text-xs text-black"
|
|
372
|
-
}, label)), preview && /* @__PURE__ */ createPortal(/* @__PURE__ */
|
|
373
|
-
className:
|
|
374
|
-
}, /* @__PURE__ */
|
|
364
|
+
}, label)), preview && /* @__PURE__ */ createPortal(/* @__PURE__ */ React3.createElement("div", {
|
|
365
|
+
className: mx3(classNames)
|
|
366
|
+
}, /* @__PURE__ */ React3.createElement(Component, {
|
|
375
367
|
className: "grow"
|
|
376
368
|
})), preview));
|
|
377
369
|
} finally {
|
|
@@ -403,19 +395,19 @@ __export(alpha_exports, {
|
|
|
403
395
|
});
|
|
404
396
|
|
|
405
397
|
// src/gen/pieces/chess/alpha/bB.tsx
|
|
406
|
-
import { useSignals as
|
|
407
|
-
import * as
|
|
398
|
+
import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
|
|
399
|
+
import * as React4 from "react";
|
|
408
400
|
var SvgBB = (props) => {
|
|
409
|
-
var _effect =
|
|
401
|
+
var _effect = _useSignals4();
|
|
410
402
|
try {
|
|
411
|
-
return /* @__PURE__ */
|
|
403
|
+
return /* @__PURE__ */ React4.createElement("svg", {
|
|
412
404
|
xmlns: "http://www.w3.org/2000/svg",
|
|
413
405
|
viewBox: "0 0 2048 2048",
|
|
414
406
|
...props
|
|
415
|
-
}, /* @__PURE__ */
|
|
407
|
+
}, /* @__PURE__ */ React4.createElement("path", {
|
|
416
408
|
fill: "#f9f9f9",
|
|
417
409
|
d: "M732 1290 628 993l386-417 421 375-132 380 49 152-658-9z"
|
|
418
|
-
}), /* @__PURE__ */
|
|
410
|
+
}), /* @__PURE__ */ React4.createElement("path", {
|
|
419
411
|
fill: "#101010",
|
|
420
412
|
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"
|
|
421
413
|
}));
|
|
@@ -426,19 +418,19 @@ var SvgBB = (props) => {
|
|
|
426
418
|
var bB_default = SvgBB;
|
|
427
419
|
|
|
428
420
|
// src/gen/pieces/chess/alpha/bK.tsx
|
|
429
|
-
import { useSignals as
|
|
430
|
-
import * as
|
|
421
|
+
import { useSignals as _useSignals5 } from "@preact-signals/safe-react/tracking";
|
|
422
|
+
import * as React5 from "react";
|
|
431
423
|
var SvgBK = (props) => {
|
|
432
|
-
var _effect =
|
|
424
|
+
var _effect = _useSignals5();
|
|
433
425
|
try {
|
|
434
|
-
return /* @__PURE__ */
|
|
426
|
+
return /* @__PURE__ */ React5.createElement("svg", {
|
|
435
427
|
xmlns: "http://www.w3.org/2000/svg",
|
|
436
428
|
viewBox: "0 0 2048 2048",
|
|
437
429
|
...props
|
|
438
|
-
}, /* @__PURE__ */
|
|
430
|
+
}, /* @__PURE__ */ React5.createElement("path", {
|
|
439
431
|
fill: "#f9f9f9",
|
|
440
432
|
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"
|
|
441
|
-
}), /* @__PURE__ */
|
|
433
|
+
}), /* @__PURE__ */ React5.createElement("path", {
|
|
442
434
|
fill: "#101010",
|
|
443
435
|
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"
|
|
444
436
|
}));
|
|
@@ -449,19 +441,19 @@ var SvgBK = (props) => {
|
|
|
449
441
|
var bK_default = SvgBK;
|
|
450
442
|
|
|
451
443
|
// src/gen/pieces/chess/alpha/bN.tsx
|
|
452
|
-
import { useSignals as
|
|
453
|
-
import * as
|
|
444
|
+
import { useSignals as _useSignals6 } from "@preact-signals/safe-react/tracking";
|
|
445
|
+
import * as React6 from "react";
|
|
454
446
|
var SvgBN = (props) => {
|
|
455
|
-
var _effect =
|
|
447
|
+
var _effect = _useSignals6();
|
|
456
448
|
try {
|
|
457
|
-
return /* @__PURE__ */
|
|
449
|
+
return /* @__PURE__ */ React6.createElement("svg", {
|
|
458
450
|
xmlns: "http://www.w3.org/2000/svg",
|
|
459
451
|
viewBox: "0 0 2048 2048",
|
|
460
452
|
...props
|
|
461
|
-
}, /* @__PURE__ */
|
|
453
|
+
}, /* @__PURE__ */ React6.createElement("path", {
|
|
462
454
|
fill: "#f9f9f9",
|
|
463
455
|
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"
|
|
464
|
-
}), /* @__PURE__ */
|
|
456
|
+
}), /* @__PURE__ */ React6.createElement("path", {
|
|
465
457
|
fill: "#101010",
|
|
466
458
|
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"
|
|
467
459
|
}));
|
|
@@ -472,16 +464,16 @@ var SvgBN = (props) => {
|
|
|
472
464
|
var bN_default = SvgBN;
|
|
473
465
|
|
|
474
466
|
// src/gen/pieces/chess/alpha/bP.tsx
|
|
475
|
-
import { useSignals as
|
|
476
|
-
import * as
|
|
467
|
+
import { useSignals as _useSignals7 } from "@preact-signals/safe-react/tracking";
|
|
468
|
+
import * as React7 from "react";
|
|
477
469
|
var SvgBP = (props) => {
|
|
478
|
-
var _effect =
|
|
470
|
+
var _effect = _useSignals7();
|
|
479
471
|
try {
|
|
480
|
-
return /* @__PURE__ */
|
|
472
|
+
return /* @__PURE__ */ React7.createElement("svg", {
|
|
481
473
|
xmlns: "http://www.w3.org/2000/svg",
|
|
482
474
|
viewBox: "0 0 2048 2048",
|
|
483
475
|
...props
|
|
484
|
-
}, /* @__PURE__ */
|
|
476
|
+
}, /* @__PURE__ */ React7.createElement("path", {
|
|
485
477
|
fill: "#101010",
|
|
486
478
|
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"
|
|
487
479
|
}));
|
|
@@ -492,19 +484,19 @@ var SvgBP = (props) => {
|
|
|
492
484
|
var bP_default = SvgBP;
|
|
493
485
|
|
|
494
486
|
// src/gen/pieces/chess/alpha/bQ.tsx
|
|
495
|
-
import { useSignals as
|
|
496
|
-
import * as
|
|
487
|
+
import { useSignals as _useSignals8 } from "@preact-signals/safe-react/tracking";
|
|
488
|
+
import * as React8 from "react";
|
|
497
489
|
var SvgBQ = (props) => {
|
|
498
|
-
var _effect =
|
|
490
|
+
var _effect = _useSignals8();
|
|
499
491
|
try {
|
|
500
|
-
return /* @__PURE__ */
|
|
492
|
+
return /* @__PURE__ */ React8.createElement("svg", {
|
|
501
493
|
xmlns: "http://www.w3.org/2000/svg",
|
|
502
494
|
viewBox: "0 0 2048 2048",
|
|
503
495
|
...props
|
|
504
|
-
}, /* @__PURE__ */
|
|
496
|
+
}, /* @__PURE__ */ React8.createElement("path", {
|
|
505
497
|
fill: "#f9f9f9",
|
|
506
498
|
d: "m520 1801.8 41.5-448.7 474-128.9 458 133.5 34.4 446.4z"
|
|
507
|
-
}), /* @__PURE__ */
|
|
499
|
+
}), /* @__PURE__ */ React8.createElement("path", {
|
|
508
500
|
fill: "#101010",
|
|
509
501
|
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"
|
|
510
502
|
}));
|
|
@@ -515,19 +507,19 @@ var SvgBQ = (props) => {
|
|
|
515
507
|
var bQ_default = SvgBQ;
|
|
516
508
|
|
|
517
509
|
// src/gen/pieces/chess/alpha/bR.tsx
|
|
518
|
-
import { useSignals as
|
|
519
|
-
import * as
|
|
510
|
+
import { useSignals as _useSignals9 } from "@preact-signals/safe-react/tracking";
|
|
511
|
+
import * as React9 from "react";
|
|
520
512
|
var SvgBR = (props) => {
|
|
521
|
-
var _effect =
|
|
513
|
+
var _effect = _useSignals9();
|
|
522
514
|
try {
|
|
523
|
-
return /* @__PURE__ */
|
|
515
|
+
return /* @__PURE__ */ React9.createElement("svg", {
|
|
524
516
|
xmlns: "http://www.w3.org/2000/svg",
|
|
525
517
|
viewBox: "0 0 2048 2048",
|
|
526
518
|
...props
|
|
527
|
-
}, /* @__PURE__ */
|
|
519
|
+
}, /* @__PURE__ */ React9.createElement("path", {
|
|
528
520
|
fill: "#f9f9f9",
|
|
529
521
|
d: "m674 732-76 807 851 14-75-833z"
|
|
530
|
-
}), /* @__PURE__ */
|
|
522
|
+
}), /* @__PURE__ */ React9.createElement("path", {
|
|
531
523
|
fill: "#101010",
|
|
532
524
|
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"
|
|
533
525
|
}));
|
|
@@ -538,19 +530,19 @@ var SvgBR = (props) => {
|
|
|
538
530
|
var bR_default = SvgBR;
|
|
539
531
|
|
|
540
532
|
// src/gen/pieces/chess/alpha/wB.tsx
|
|
541
|
-
import { useSignals as
|
|
542
|
-
import * as
|
|
533
|
+
import { useSignals as _useSignals10 } from "@preact-signals/safe-react/tracking";
|
|
534
|
+
import * as React10 from "react";
|
|
543
535
|
var SvgWB = (props) => {
|
|
544
|
-
var _effect =
|
|
536
|
+
var _effect = _useSignals10();
|
|
545
537
|
try {
|
|
546
|
-
return /* @__PURE__ */
|
|
538
|
+
return /* @__PURE__ */ React10.createElement("svg", {
|
|
547
539
|
xmlns: "http://www.w3.org/2000/svg",
|
|
548
540
|
viewBox: "0 0 2048 2048",
|
|
549
541
|
...props
|
|
550
|
-
}, /* @__PURE__ */
|
|
542
|
+
}, /* @__PURE__ */ React10.createElement("path", {
|
|
551
543
|
fill: "#f9f9f9",
|
|
552
544
|
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"
|
|
553
|
-
}), /* @__PURE__ */
|
|
545
|
+
}), /* @__PURE__ */ React10.createElement("path", {
|
|
554
546
|
fill: "#101010",
|
|
555
547
|
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"
|
|
556
548
|
}));
|
|
@@ -561,19 +553,19 @@ var SvgWB = (props) => {
|
|
|
561
553
|
var wB_default = SvgWB;
|
|
562
554
|
|
|
563
555
|
// src/gen/pieces/chess/alpha/wK.tsx
|
|
564
|
-
import { useSignals as
|
|
565
|
-
import * as
|
|
556
|
+
import { useSignals as _useSignals11 } from "@preact-signals/safe-react/tracking";
|
|
557
|
+
import * as React11 from "react";
|
|
566
558
|
var SvgWK = (props) => {
|
|
567
|
-
var _effect =
|
|
559
|
+
var _effect = _useSignals11();
|
|
568
560
|
try {
|
|
569
|
-
return /* @__PURE__ */
|
|
561
|
+
return /* @__PURE__ */ React11.createElement("svg", {
|
|
570
562
|
xmlns: "http://www.w3.org/2000/svg",
|
|
571
563
|
viewBox: "0 0 2048 2048",
|
|
572
564
|
...props
|
|
573
|
-
}, /* @__PURE__ */
|
|
565
|
+
}, /* @__PURE__ */ React11.createElement("path", {
|
|
574
566
|
fill: "#f9f9f9",
|
|
575
567
|
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"
|
|
576
|
-
}), /* @__PURE__ */
|
|
568
|
+
}), /* @__PURE__ */ React11.createElement("path", {
|
|
577
569
|
fill: "#101010",
|
|
578
570
|
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"
|
|
579
571
|
}));
|
|
@@ -584,19 +576,19 @@ var SvgWK = (props) => {
|
|
|
584
576
|
var wK_default = SvgWK;
|
|
585
577
|
|
|
586
578
|
// src/gen/pieces/chess/alpha/wN.tsx
|
|
587
|
-
import { useSignals as
|
|
588
|
-
import * as
|
|
579
|
+
import { useSignals as _useSignals12 } from "@preact-signals/safe-react/tracking";
|
|
580
|
+
import * as React12 from "react";
|
|
589
581
|
var SvgWN = (props) => {
|
|
590
|
-
var _effect =
|
|
582
|
+
var _effect = _useSignals12();
|
|
591
583
|
try {
|
|
592
|
-
return /* @__PURE__ */
|
|
584
|
+
return /* @__PURE__ */ React12.createElement("svg", {
|
|
593
585
|
xmlns: "http://www.w3.org/2000/svg",
|
|
594
586
|
viewBox: "0 0 2048 2048",
|
|
595
587
|
...props
|
|
596
|
-
}, /* @__PURE__ */
|
|
588
|
+
}, /* @__PURE__ */ React12.createElement("path", {
|
|
597
589
|
fill: "#f9f9f9",
|
|
598
590
|
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"
|
|
599
|
-
}), /* @__PURE__ */
|
|
591
|
+
}), /* @__PURE__ */ React12.createElement("path", {
|
|
600
592
|
fill: "#101010",
|
|
601
593
|
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"
|
|
602
594
|
}));
|
|
@@ -607,19 +599,19 @@ var SvgWN = (props) => {
|
|
|
607
599
|
var wN_default = SvgWN;
|
|
608
600
|
|
|
609
601
|
// src/gen/pieces/chess/alpha/wP.tsx
|
|
610
|
-
import { useSignals as
|
|
611
|
-
import * as
|
|
602
|
+
import { useSignals as _useSignals13 } from "@preact-signals/safe-react/tracking";
|
|
603
|
+
import * as React13 from "react";
|
|
612
604
|
var SvgWP = (props) => {
|
|
613
|
-
var _effect =
|
|
605
|
+
var _effect = _useSignals13();
|
|
614
606
|
try {
|
|
615
|
-
return /* @__PURE__ */
|
|
607
|
+
return /* @__PURE__ */ React13.createElement("svg", {
|
|
616
608
|
xmlns: "http://www.w3.org/2000/svg",
|
|
617
609
|
viewBox: "0 0 2048 2048",
|
|
618
610
|
...props
|
|
619
|
-
}, /* @__PURE__ */
|
|
611
|
+
}, /* @__PURE__ */ React13.createElement("path", {
|
|
620
612
|
fill: "#f9f9f9",
|
|
621
613
|
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"
|
|
622
|
-
}), /* @__PURE__ */
|
|
614
|
+
}), /* @__PURE__ */ React13.createElement("path", {
|
|
623
615
|
fill: "#101010",
|
|
624
616
|
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"
|
|
625
617
|
}));
|
|
@@ -630,19 +622,19 @@ var SvgWP = (props) => {
|
|
|
630
622
|
var wP_default = SvgWP;
|
|
631
623
|
|
|
632
624
|
// src/gen/pieces/chess/alpha/wQ.tsx
|
|
633
|
-
import { useSignals as
|
|
634
|
-
import * as
|
|
625
|
+
import { useSignals as _useSignals14 } from "@preact-signals/safe-react/tracking";
|
|
626
|
+
import * as React14 from "react";
|
|
635
627
|
var SvgWQ = (props) => {
|
|
636
|
-
var _effect =
|
|
628
|
+
var _effect = _useSignals14();
|
|
637
629
|
try {
|
|
638
|
-
return /* @__PURE__ */
|
|
630
|
+
return /* @__PURE__ */ React14.createElement("svg", {
|
|
639
631
|
xmlns: "http://www.w3.org/2000/svg",
|
|
640
632
|
viewBox: "0 0 2048 2048",
|
|
641
633
|
...props
|
|
642
|
-
}, /* @__PURE__ */
|
|
634
|
+
}, /* @__PURE__ */ React14.createElement("path", {
|
|
643
635
|
fill: "#f9f9f9",
|
|
644
636
|
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"
|
|
645
|
-
}), /* @__PURE__ */
|
|
637
|
+
}), /* @__PURE__ */ React14.createElement("path", {
|
|
646
638
|
fill: "#101010",
|
|
647
639
|
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"
|
|
648
640
|
}));
|
|
@@ -653,19 +645,19 @@ var SvgWQ = (props) => {
|
|
|
653
645
|
var wQ_default = SvgWQ;
|
|
654
646
|
|
|
655
647
|
// src/gen/pieces/chess/alpha/wR.tsx
|
|
656
|
-
import { useSignals as
|
|
657
|
-
import * as
|
|
648
|
+
import { useSignals as _useSignals15 } from "@preact-signals/safe-react/tracking";
|
|
649
|
+
import * as React15 from "react";
|
|
658
650
|
var SvgWR = (props) => {
|
|
659
|
-
var _effect =
|
|
651
|
+
var _effect = _useSignals15();
|
|
660
652
|
try {
|
|
661
|
-
return /* @__PURE__ */
|
|
653
|
+
return /* @__PURE__ */ React15.createElement("svg", {
|
|
662
654
|
xmlns: "http://www.w3.org/2000/svg",
|
|
663
655
|
viewBox: "0 0 2048 2048",
|
|
664
656
|
...props
|
|
665
|
-
}, /* @__PURE__ */
|
|
657
|
+
}, /* @__PURE__ */ React15.createElement("path", {
|
|
666
658
|
fill: "#f9f9f9",
|
|
667
659
|
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"
|
|
668
|
-
}), /* @__PURE__ */
|
|
660
|
+
}), /* @__PURE__ */ React15.createElement("path", {
|
|
669
661
|
fill: "#101010",
|
|
670
662
|
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"
|
|
671
663
|
}));
|
|
@@ -849,14 +841,14 @@ var mapPieces = (before, after) => {
|
|
|
849
841
|
};
|
|
850
842
|
|
|
851
843
|
// src/Chessboard/Chessboard.tsx
|
|
852
|
-
import { useSignals as
|
|
853
|
-
import
|
|
844
|
+
import { useSignals as _useSignals16 } from "@preact-signals/safe-react/tracking";
|
|
845
|
+
import React16, { useRef as useRef3, useMemo, useEffect as useEffect4, useState as useState4, memo as memo3 } from "react";
|
|
854
846
|
import { useResizeDetector } from "react-resize-detector";
|
|
855
847
|
import { useTrackProps as useTrackProps2 } from "@dxos/react-ui";
|
|
856
|
-
import { mx as
|
|
848
|
+
import { mx as mx4 } from "@dxos/react-ui-theme";
|
|
857
849
|
import { isNotFalsy } from "@dxos/util";
|
|
858
|
-
var Chessboard = /* @__PURE__ */ memo3(({ orientation, showLabels, debug, rows = 8, cols = 8 }) => {
|
|
859
|
-
var _effect =
|
|
850
|
+
var Chessboard = /* @__PURE__ */ memo3(({ orientation, showLabels, debug, rows = 8, cols = 8, classNames }) => {
|
|
851
|
+
var _effect = _useSignals16();
|
|
860
852
|
try {
|
|
861
853
|
useTrackProps2({
|
|
862
854
|
orientation,
|
|
@@ -883,7 +875,7 @@ var Chessboard = /* @__PURE__ */ memo3(({ orientation, showLabels, debug, rows =
|
|
|
883
875
|
]);
|
|
884
876
|
const layout = useMemo(() => {
|
|
885
877
|
return locations.map((location) => {
|
|
886
|
-
return /* @__PURE__ */
|
|
878
|
+
return /* @__PURE__ */ React16.createElement("div", {
|
|
887
879
|
key: locationToString(location),
|
|
888
880
|
["data-location"]: locationToString(location)
|
|
889
881
|
});
|
|
@@ -926,28 +918,28 @@ var Chessboard = /* @__PURE__ */ memo3(({ orientation, showLabels, debug, rows =
|
|
|
926
918
|
model?.pieces.value,
|
|
927
919
|
promoting
|
|
928
920
|
]);
|
|
929
|
-
return /* @__PURE__ */
|
|
921
|
+
return /* @__PURE__ */ React16.createElement("div", {
|
|
930
922
|
ref: containerRef,
|
|
931
|
-
className: "relative"
|
|
932
|
-
}, /* @__PURE__ */
|
|
923
|
+
className: mx4("relative", classNames)
|
|
924
|
+
}, /* @__PURE__ */ React16.createElement("div", {
|
|
933
925
|
ref: gridRef,
|
|
934
926
|
className: "grid grid-rows-8 grid-cols-8 aspect-square select-none"
|
|
935
|
-
}, layout), /* @__PURE__ */
|
|
927
|
+
}, layout), /* @__PURE__ */ React16.createElement("div", null, locations.map((location) => /* @__PURE__ */ React16.createElement(Square, {
|
|
936
928
|
key: locationToString(location),
|
|
937
929
|
location,
|
|
938
930
|
label: showLabels ? locationToPos(location) : void 0,
|
|
939
931
|
bounds: grid[locationToString(location)],
|
|
940
932
|
classNames: getSquareColor(location)
|
|
941
|
-
}))), /* @__PURE__ */
|
|
942
|
-
className:
|
|
943
|
-
}, positions.map(({ bounds, piece }) => /* @__PURE__ */
|
|
933
|
+
}))), /* @__PURE__ */ React16.createElement("div", {
|
|
934
|
+
className: mx4(promoting && "opacity-50")
|
|
935
|
+
}, positions.map(({ bounds, piece }) => /* @__PURE__ */ React16.createElement(Piece, {
|
|
944
936
|
key: piece.id,
|
|
945
937
|
piece,
|
|
946
938
|
bounds,
|
|
947
939
|
label: debug ? piece.id : void 0,
|
|
948
940
|
orientation,
|
|
949
941
|
Component: ChessPieces[piece.type]
|
|
950
|
-
}))), /* @__PURE__ */
|
|
942
|
+
}))), /* @__PURE__ */ React16.createElement("div", null, promoting && /* @__PURE__ */ React16.createElement(PromotionSelector, {
|
|
951
943
|
grid,
|
|
952
944
|
piece: promoting,
|
|
953
945
|
onSelect: (piece) => {
|
|
@@ -968,7 +960,7 @@ var getSquareLocation = (container, location) => {
|
|
|
968
960
|
return container.querySelector(`[data-location="${locationToString(location)}"]`);
|
|
969
961
|
};
|
|
970
962
|
var PromotionSelector = ({ grid, piece, onSelect }) => {
|
|
971
|
-
var _effect =
|
|
963
|
+
var _effect = _useSignals16();
|
|
972
964
|
try {
|
|
973
965
|
const positions = [
|
|
974
966
|
"Q",
|
|
@@ -996,27 +988,26 @@ var PromotionSelector = ({ grid, piece, onSelect }) => {
|
|
|
996
988
|
type: selected.type
|
|
997
989
|
});
|
|
998
990
|
};
|
|
999
|
-
return /* @__PURE__ */
|
|
991
|
+
return /* @__PURE__ */ React16.createElement("div", null, positions.map(({ piece: piece2, bounds }) => /* @__PURE__ */ React16.createElement("div", {
|
|
1000
992
|
key: piece2.id,
|
|
1001
993
|
style: bounds,
|
|
1002
994
|
onClick: () => handleSelect(piece2)
|
|
1003
|
-
}, /* @__PURE__ */
|
|
995
|
+
}, /* @__PURE__ */ React16.createElement(Piece, {
|
|
1004
996
|
piece: piece2,
|
|
1005
997
|
bounds,
|
|
1006
998
|
Component: ChessPieces[piece2.type],
|
|
1007
|
-
classNames:
|
|
999
|
+
classNames: mx4("border-2 border-neutral-700 rounded-full", boardStyles.promotion)
|
|
1008
1000
|
}))));
|
|
1009
1001
|
} finally {
|
|
1010
1002
|
_effect.f();
|
|
1011
1003
|
}
|
|
1012
1004
|
};
|
|
1013
1005
|
export {
|
|
1014
|
-
Board,
|
|
1015
|
-
BoardContext,
|
|
1016
1006
|
ChessModel,
|
|
1017
1007
|
ChessPieces,
|
|
1018
1008
|
Chessboard,
|
|
1019
|
-
|
|
1009
|
+
Gameboard,
|
|
1010
|
+
GameboardContext,
|
|
1020
1011
|
Piece,
|
|
1021
1012
|
Square,
|
|
1022
1013
|
boardStyles,
|